Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22193b1872 | ||
|
|
306e7b5201 | ||
|
|
0c8104af96 | ||
|
|
3b06f7a105 | ||
|
|
0869623c1d | ||
|
|
bfa79a6f68 | ||
|
|
cda842485f | ||
|
|
db35306a26 | ||
|
|
2363861a62 | ||
|
|
2960585250 | ||
|
|
ff830ee50d | ||
|
|
3c917da56a | ||
|
|
6ea1d9ec73 | ||
|
|
5ebd7cbb63 | ||
|
|
0d91444ee2 | ||
|
|
9459c78e7c | ||
|
|
b326a7148d | ||
|
|
5ae850dbe8 | ||
|
|
2ef9c9c68e | ||
|
|
613bd000d2 | ||
|
|
f7ea5bcb7b | ||
|
|
b8b5b8ae9b | ||
|
|
e6085a64be | ||
|
|
e77acf9b1e | ||
|
|
dc4299d315 | ||
|
|
1c8d2ba19e | ||
|
|
d46455c021 | ||
|
|
abd4c24138 | ||
|
|
1e922ae074 | ||
|
|
335059a681 | ||
|
|
a530991119 | ||
|
|
45130b5f85 | ||
|
|
70fd411640 | ||
|
|
4d47cd4a4a | ||
|
|
bb694ca9cb | ||
|
|
7ede8424d0 | ||
|
|
1167cf51b5 | ||
|
|
13d2c81c5c | ||
|
|
102a34a3f3 | ||
|
|
0c490f2bdb | ||
|
|
8f69f9cef9 | ||
|
|
00e65a39de | ||
|
|
8698c6099c | ||
|
|
da3fbdb401 | ||
|
|
b28052c46c | ||
|
|
b438a7f03d | ||
|
|
c144035d95 | ||
|
|
7658c3980a | ||
|
|
c11297a733 | ||
|
|
c89e60adf6 | ||
|
|
fa33f61183 | ||
|
|
f3e57d816c | ||
|
|
bf2e1eface | ||
|
|
a69fff9b53 | ||
|
|
9fc0038bd5 | ||
|
|
ffd8dd5633 | ||
|
|
c3947b0f6a | ||
|
|
84b17b17fe | ||
|
|
3956a1123e | ||
|
|
f04185f6fd | ||
|
|
10d188ee40 | ||
|
|
63e2d3740f | ||
|
|
672173437f | ||
|
|
2c851158f5 | ||
|
|
367733676a | ||
|
|
538cd2078b | ||
|
|
731833d9be | ||
|
|
7ebd71283f | ||
|
|
5eb1942ad2 | ||
|
|
999222f3a4 | ||
|
|
e82d726898 | ||
|
|
0f48c75512 | ||
|
|
183d3ea666 | ||
|
|
4e4e9123f2 | ||
|
|
c09566d38a | ||
|
|
750ac6f2ec | ||
|
|
1ed78fa680 | ||
|
|
48a26cf1f7 | ||
|
|
bc6a63a1f0 | ||
|
|
45f360904f | ||
|
|
bdf39a1dd7 | ||
|
|
abff198d01 | ||
|
|
6721ecf113 | ||
|
|
3899c71317 | ||
|
|
b8e4ec9c9f | ||
|
|
92cb120dd0 | ||
|
|
7a8f9c38eb | ||
|
|
dc7498e505 | ||
|
|
02e925f77a | ||
|
|
7dc2a479b6 | ||
|
|
1913d629e7 | ||
|
|
59a750f41c | ||
|
|
46dfafe0b2 | ||
|
|
1faab05032 | ||
|
|
c895f0db56 | ||
|
|
c622df96f0 | ||
|
|
30ac13ec73 | ||
|
|
efbe809982 | ||
|
|
92df5dd36a | ||
|
|
ebdf13678a | ||
|
|
0a0d46033c | ||
|
|
7f72565e24 | ||
|
|
cfcf1e2fcb | ||
|
|
faf2f7a38c | ||
|
|
ace7e5abdd | ||
|
|
f50e547980 | ||
|
|
c05a303568 | ||
|
|
4fcd41d3cc | ||
|
|
3e6c4c1b13 | ||
|
|
55d356ea40 | ||
|
|
a752421efe | ||
|
|
aa4b41612f | ||
|
|
f576228c2d | ||
|
|
c93add3b83 | ||
|
|
117446cebb | ||
|
|
4bee5ec6c8 | ||
|
|
92776c9e8d | ||
|
|
eea3fb5c54 | ||
|
|
dbd0727af2 | ||
|
|
a4cf49754a | ||
|
|
587c5991f1 | ||
|
|
10234ffcef | ||
|
|
2a2710e391 | ||
|
|
f1b5423d94 | ||
|
|
1cb916d16a | ||
|
|
6396120fb0 | ||
|
|
2fe5157519 | ||
|
|
4ce480defb | ||
|
|
3ea5d16f19 | ||
|
|
31fc58576c | ||
|
|
9573799eba | ||
|
|
df94e94b31 | ||
|
|
98b561b186 | ||
|
|
8ee469343c | ||
|
|
e54d129577 | ||
|
|
a7a3237f4f | ||
|
|
4b17c3963f | ||
|
|
93925a03b9 | ||
|
|
a74707ee82 | ||
|
|
909034d4f3 | ||
|
|
c261d33980 | ||
|
|
e9654c9b04 | ||
|
|
4742a290c8 | ||
|
|
bbae3351a5 | ||
|
|
db149cd3aa | ||
|
|
1a94748958 | ||
|
|
a20ad88532 | ||
|
|
93b4ba1167 | ||
|
|
693d6d6663 | ||
|
|
67bb1a2627 | ||
|
|
d20f91018d | ||
|
|
9414627772 | ||
|
|
6134fb26c6 | ||
|
|
6445df4d2f | ||
|
|
1069803681 | ||
|
|
60f9d19c6c | ||
|
|
b2d001d238 | ||
|
|
ea26cdbb9f | ||
|
|
f3154081f4 | ||
|
|
5388bbfc16 | ||
|
|
48284acf06 | ||
|
|
852830c894 | ||
|
|
97b2c8f080 | ||
|
|
888869d5fc | ||
|
|
9452c65438 | ||
|
|
08db580076 | ||
|
|
649135e6d4 | ||
|
|
fb255fd46a | ||
|
|
ba01e9f0fe | ||
|
|
c6b6a4012e | ||
|
|
964c1a82db | ||
|
|
6eb2a8db45 | ||
|
|
abf5466883 | ||
|
|
c40fcdee9e | ||
|
|
ca66205493 | ||
|
|
8bdea4a3cd | ||
|
|
d11797be41 | ||
|
|
332a5df506 | ||
|
|
024125cf52 | ||
|
|
5b747d6fea | ||
|
|
f4b2597d95 | ||
|
|
4a24b98868 | ||
|
|
932f82a08b | ||
|
|
c20709b377 | ||
|
|
f1fd813ddc | ||
|
|
dfb8089db3 | ||
|
|
cf6cd74e8f | ||
|
|
5b93bd79a9 | ||
|
|
5831adbcc6 | ||
|
|
133b6df382 | ||
|
|
0e9abac8a2 | ||
|
|
b6b172ebfd | ||
|
|
561f508e02 | ||
|
|
b36a29a5c7 | ||
|
|
938f17b559 | ||
|
|
9feec7f6e3 | ||
|
|
b1f0e7bbfd | ||
|
|
24335cb2fc | ||
|
|
4d41ae9448 | ||
|
|
d380560ff0 | ||
|
|
aa649ca9a9 | ||
|
|
754f9c51ea | ||
|
|
c6a2f79946 | ||
|
|
3e6a735217 | ||
|
|
d0d9d70445 | ||
|
|
9db715b916 | ||
|
|
7c88c004b6 | ||
|
|
6215d77b72 | ||
|
|
c947f53d2c | ||
|
|
d9029284c3 | ||
|
|
48b099e182 | ||
|
|
cbac258a6a | ||
|
|
256a39643b | ||
|
|
9dc21315b8 | ||
|
|
d27ada63b1 | ||
|
|
97a2874218 | ||
|
|
1c3471f7b9 | ||
|
|
b8b677e7a8 | ||
|
|
986873e945 | ||
|
|
7e90a439a6 | ||
|
|
ba2dab02a6 | ||
|
|
5aad361ebd | ||
|
|
418443300c | ||
|
|
3958a48137 | ||
|
|
c829b2d9bf | ||
|
|
12d78786f0 | ||
|
|
87655c9e28 | ||
|
|
eb54d7c250 | ||
|
|
78a7b93c21 | ||
|
|
4da8378aef | ||
|
|
2f6687ec90 | ||
|
|
38b2584153 | ||
|
|
a25d36da29 | ||
|
|
6f7c3ec39c | ||
|
|
d9e94d52f5 | ||
|
|
035f651b9f | ||
|
|
98d2c69640 | ||
|
|
0dfeb2dcc8 | ||
|
|
645e7780f3 | ||
|
|
d635e31afc | ||
|
|
91d0882ad8 | ||
|
|
4ab4ac7668 | ||
|
|
48115b3f2d | ||
|
|
f55559d6d6 | ||
|
|
0bf1afd7af | ||
|
|
1ff4f47102 | ||
|
|
70dbd7eac1 | ||
|
|
ff7ebe0629 | ||
|
|
0d847607a2 | ||
|
|
dd53862d37 | ||
|
|
9df5366fc6 | ||
|
|
69f888fe29 | ||
|
|
bdc08ef95c | ||
|
|
7b098bb6dd | ||
|
|
43085d0c13 | ||
|
|
89885f5e9d | ||
|
|
3d48bdeee6 | ||
|
|
e331f2e293 | ||
|
|
0a605d518b | ||
|
|
72f02bd16d | ||
|
|
ff9a6884a9 | ||
|
|
9fd6c89c5b | ||
|
|
73d2644e96 | ||
|
|
e8de07bdb8 | ||
|
|
3003acdc81 | ||
|
|
350241f517 | ||
|
|
ed6289341a | ||
|
|
0811eb75df | ||
|
|
619408e272 | ||
|
|
c43ff9dc95 | ||
|
|
7fd461ef61 | ||
|
|
3b17a24f29 | ||
|
|
95358bf16b | ||
|
|
d8de262111 | ||
|
|
5f78ee7f95 | ||
|
|
c3cbdf5a24 | ||
|
|
ac1f7d158a | ||
|
|
bdf8823855 | ||
|
|
17693ec3f2 | ||
|
|
1afea8f39c | ||
|
|
f0068144dc | ||
|
|
90a4de1343 | ||
|
|
e83a8ef7e7 | ||
|
|
2526cb65ba | ||
|
|
4f419b86e2 | ||
|
|
6c1baa9ec1 | ||
|
|
b499d540dc | ||
|
|
522bd5d4b0 | ||
|
|
d3d6d1a565 | ||
|
|
e6b639040b | ||
|
|
64259502db | ||
|
|
a5a9c1330b | ||
|
|
c9fb6ad2ac | ||
|
|
3ecc752c6c | ||
|
|
db0f97542f | ||
|
|
c9d372223e | ||
|
|
d5be79198c | ||
|
|
b75a5b56d2 | ||
|
|
a1da000157 | ||
|
|
965d1fd2b7 | ||
|
|
bc34cd9b5e | ||
|
|
d3d2368be0 | ||
|
|
afb78ac8b8 | ||
|
|
b675ad785d | ||
|
|
649bd85fd5 | ||
|
|
f302fb7da5 | ||
|
|
a9ad35a379 | ||
|
|
ed412c221a | ||
|
|
e46da24e03 | ||
|
|
c9ef64b81f | ||
|
|
18a6235844 | ||
|
|
357566805b | ||
|
|
f89a2b8447 | ||
|
|
2528b9ff2a | ||
|
|
3a8b3689fb | ||
|
|
74d2a17867 | ||
|
|
e77c90debe | ||
|
|
8364e86980 | ||
|
|
fc5206456e | ||
|
|
216e3afec7 | ||
|
|
70b86277bd | ||
|
|
488163c945 | ||
|
|
5c8916d32e | ||
|
|
9f1fa7601b | ||
|
|
a3f59ed7a2 | ||
|
|
20ad4003b7 | ||
|
|
c059dd916e | ||
|
|
61b582f676 | ||
|
|
4bf6ae897f | ||
|
|
74b15ce766 | ||
|
|
cea4a5431e | ||
|
|
12e0105b5a | ||
|
|
17be43d0d2 | ||
|
|
dd071c912a | ||
|
|
32cdacb4be | ||
|
|
c1cbebd782 | ||
|
|
2a334445dc | ||
|
|
34bba5a636 | ||
|
|
3c18ac0d96 | ||
|
|
9b9005087e | ||
|
|
88f0bc4c28 | ||
|
|
c8d368e86f | ||
|
|
318d6956fa | ||
|
|
5443214033 | ||
|
|
2bdabbcd4c | ||
|
|
38eaa59518 | ||
|
|
ed6fa92f51 | ||
|
|
7f0b4bccb3 | ||
|
|
f4edfb870b | ||
|
|
9a07256a70 | ||
|
|
b744754949 | ||
|
|
f08859b377 | ||
|
|
fb5475b724 | ||
|
|
798d26ddae | ||
|
|
cd2eb2e0d9 | ||
|
|
dfa1c29fa0 | ||
|
|
090e85ea1c | ||
|
|
d1fd7c1eb0 | ||
|
|
775cba5667 | ||
|
|
6f40bc5b1b | ||
|
|
e14fb974b4 | ||
|
|
dbf29c6b83 | ||
|
|
ad44fd3382 | ||
|
|
61df41d5fe | ||
|
|
942a795c2c | ||
|
|
5f948badd1 | ||
|
|
f07f32b169 | ||
|
|
905257d039 | ||
|
|
4af7500e42 | ||
|
|
a9a3a0037b | ||
|
|
111d16319b | ||
|
|
269a74da52 | ||
|
|
51a094a502 | ||
|
|
b048c017bf | ||
|
|
d725756498 | ||
|
|
65649bbb72 | ||
|
|
7e246e9d78 | ||
|
|
cdf965f4da | ||
|
|
b2e19bb89a | ||
|
|
ba6cfb0a55 | ||
|
|
8a24dbfdaf | ||
|
|
d84e13e2ef | ||
|
|
c4727aa3d8 | ||
|
|
110b5d4c87 | ||
|
|
b8c834794b | ||
|
|
bcc1cc412e | ||
|
|
ff96880cc2 | ||
|
|
6f4e9662db | ||
|
|
5da99fc5f0 | ||
|
|
ec3fc8737a | ||
|
|
5fd3dcda36 | ||
|
|
938aaba898 | ||
|
|
cb7e6c96b0 | ||
|
|
49b128a20c | ||
|
|
7f683eb920 | ||
|
|
489c89205d | ||
|
|
4b0b91de98 | ||
|
|
c54b1ab4a0 | ||
|
|
8055a2b651 | ||
|
|
71ababc4d1 | ||
|
|
498b885398 | ||
|
|
774fcfd497 | ||
|
|
0967e475d5 | ||
|
|
2bd6fc444e | ||
|
|
dfa025952b | ||
|
|
30918675bf | ||
|
|
91f6c11821 | ||
|
|
bf16fbe84b | ||
|
|
ffb8003245 | ||
|
|
1645b5f362 | ||
|
|
aa03cb5f89 | ||
|
|
1d8025b0cf | ||
|
|
3ac8998377 | ||
|
|
5160f61523 | ||
|
|
68c5fa10f4 | ||
|
|
620f564ae5 | ||
|
|
b840d481a8 | ||
|
|
7872a59a89 | ||
|
|
62c7f92563 | ||
|
|
283f237180 | ||
|
|
6dcd1c43fe | ||
|
|
805bad437c | ||
|
|
f476fb1cc0 | ||
|
|
f35f8b1b29 | ||
|
|
061ed7e765 | ||
|
|
fbbfe78828 | ||
|
|
557132b4c5 | ||
|
|
5bc7a15c15 | ||
|
|
0fa34e3eeb | ||
|
|
eeef8bd468 | ||
|
|
6b5eeea3b7 | ||
|
|
6e9fd540c5 | ||
|
|
c4da8ce9df | ||
|
|
5cc50e6e06 | ||
|
|
5088ea7b80 | ||
|
|
d7ae175a00 | ||
|
|
60e47f2ffc | ||
|
|
850c2d3b8a | ||
|
|
cdddd5eacf | ||
|
|
fd4793db99 | ||
|
|
9006dbee87 | ||
|
|
073923d072 | ||
|
|
dfb006584e | ||
|
|
c00383ce81 | ||
|
|
ca9d61d955 | ||
|
|
37a8549d21 | ||
|
|
6c753b5058 | ||
|
|
7395ed0c2b | ||
|
|
2b55c2b5e0 | ||
|
|
41d9aa488f | ||
|
|
3e46d2ad84 | ||
|
|
dac990716d | ||
|
|
ed56e14574 | ||
|
|
acf72397b6 | ||
|
|
02d97e440f | ||
|
|
f2e67d3727 | ||
|
|
ae11b24c7a | ||
|
|
6f2b77fbdc | ||
|
|
11d4df8c36 | ||
|
|
f221b01811 | ||
|
|
236e9e60da | ||
|
|
40cfb3d111 | ||
|
|
05190e6384 | ||
|
|
77ab8ed85b | ||
|
|
059cf5e631 | ||
|
|
b304c7ebe8 | ||
|
|
9b097d3a42 | ||
|
|
4dc2e1f262 | ||
|
|
6a10cdd8cd | ||
|
|
7febdf13b7 | ||
|
|
47b0b678e4 | ||
|
|
4e21c606ef | ||
|
|
aef143256d | ||
|
|
7c76bd91b4 | ||
|
|
2ddce7b69b | ||
|
|
73df916b86 | ||
|
|
85285a2005 | ||
|
|
5a3b90ec12 | ||
|
|
13bc0b7d46 | ||
|
|
814e11a153 | ||
|
|
262988a0f8 | ||
|
|
4376bf069c | ||
|
|
995d75c95a | ||
|
|
f9773de1d8 | ||
|
|
c46cc41bc4 | ||
|
|
bcef06a1f1 | ||
|
|
45941784a8 | ||
|
|
d646853c2e | ||
|
|
eedc3ccc69 | ||
|
|
036a9a12cc | ||
|
|
59d8746cb3 | ||
|
|
cf8e266c4c | ||
|
|
363c53ede2 | ||
|
|
f9175ffd03 | ||
|
|
041b2538d3 | ||
|
|
58daf0993b | ||
|
|
2be75b28d9 | ||
|
|
3e9549088a | ||
|
|
0428a87c71 | ||
|
|
9121df192d | ||
|
|
b63d85d341 | ||
|
|
423a762cad | ||
|
|
2c68d395f7 | ||
|
|
b1132c901a | ||
|
|
db1fd83c8b | ||
|
|
4592ba8d38 | ||
|
|
05951c0776 | ||
|
|
070c010156 | ||
|
|
3e0741b6d8 | ||
|
|
8ec0e3348b | ||
|
|
e81a63c695 | ||
|
|
d41976829a | ||
|
|
09589ec899 | ||
|
|
9553f1ca74 | ||
|
|
2d91e87ca0 | ||
|
|
1cd09bace7 | ||
|
|
a896464e4c | ||
|
|
052d492f59 | ||
|
|
d0fc8c3f73 | ||
|
|
02322e50ab | ||
|
|
029aa6d466 | ||
|
|
9fbbb43ec1 | ||
|
|
8429539527 | ||
|
|
935f878688 | ||
|
|
5596d1f8a6 | ||
|
|
00028248c0 | ||
|
|
75feb7b409 | ||
|
|
5fefe96963 | ||
|
|
7572cdb25d | ||
|
|
77834809f6 | ||
|
|
b72edac261 | ||
|
|
4c4623d92d | ||
|
|
162b51f1fa | ||
|
|
f667c4f3ad | ||
|
|
b291f6b26c | ||
|
|
a679acfb6a | ||
|
|
c546294cd9 | ||
|
|
474c6e2112 | ||
|
|
dbce80b4fa | ||
|
|
4399cdadb0 | ||
|
|
14e7f5bbb8 | ||
|
|
3440017db8 | ||
|
|
1223b2b4eb | ||
|
|
731fbc3083 | ||
|
|
bb9487b35e | ||
|
|
43ea2a0f84 | ||
|
|
f5606aea09 | ||
|
|
2d10d080a4 | ||
|
|
e36c007176 | ||
|
|
60c2784643 | ||
|
|
49d91caafd | ||
|
|
6c4e9fc29b | ||
|
|
e49fa835a8 | ||
|
|
ab1e7c623f | ||
|
|
725ce14ed6 | ||
|
|
a154445723 | ||
|
|
b09e49ddae | ||
|
|
f94f39a31c | ||
|
|
a4172acdf2 | ||
|
|
8823762b16 | ||
|
|
5b9f44e73d | ||
|
|
af1b5f135b | ||
|
|
14399f46cf | ||
|
|
eccd154046 | ||
|
|
e7e789aadb | ||
|
|
1f171427fc | ||
|
|
1cf054f50c | ||
|
|
e824c3830e | ||
|
|
b93b0eaef7 | ||
|
|
be4c4e7455 | ||
|
|
5dbb53f053 | ||
|
|
550946be5e | ||
|
|
8819e2dddc | ||
|
|
ae14412385 | ||
|
|
276a731f53 | ||
|
|
6873c8bc72 | ||
|
|
13a3a85916 | ||
|
|
79c25e5dd4 | ||
|
|
05e1710953 | ||
|
|
756698bda6 | ||
|
|
8965acb17c | ||
|
|
87e6fc3d03 | ||
|
|
438959e42b | ||
|
|
c5713c6079 | ||
|
|
2251df5a6f | ||
|
|
4474aee7fa | ||
|
|
4dcc637065 | ||
|
|
d793eec2e0 | ||
|
|
3ece1c3636 | ||
|
|
c135cad669 | ||
|
|
3d9e636cc3 | ||
|
|
b64c4966e0 | ||
|
|
7695fe8659 | ||
|
|
ad7e021928 | ||
|
|
73233ad6de | ||
|
|
3e96c793b1 | ||
|
|
6d10a87efc | ||
|
|
0228b7d0a4 | ||
|
|
798377416d | ||
|
|
9b64c65816 | ||
|
|
2030fe4461 | ||
|
|
c8f9fb8bac | ||
|
|
cce698578e | ||
|
|
2bf8146489 | ||
|
|
7148477209 | ||
|
|
fe0e68ab37 | ||
|
|
24420db4c4 | ||
|
|
2a0e067472 | ||
|
|
8126ffc980 | ||
|
|
9d530e095a | ||
|
|
8dd8ed45b4 | ||
|
|
c825d91779 | ||
|
|
38a2c3f26b | ||
|
|
3b8aba29d5 | ||
|
|
3aa77e5022 | ||
|
|
543bacf448 | ||
|
|
4518dadcf6 | ||
|
|
f07b7412f5 | ||
|
|
474dc0e5d6 | ||
|
|
202cb91ac3 | ||
|
|
4e2672d9ae | ||
|
|
b281bdf392 | ||
|
|
168245c3c1 | ||
|
|
6d1856ceba | ||
|
|
dc58e89a0d | ||
|
|
16f4866c38 | ||
|
|
93492828dc | ||
|
|
e6fb6fd95b | ||
|
|
57b2f308da | ||
|
|
93d259b1d8 | ||
|
|
daf447cbdd | ||
|
|
9e438e1498 | ||
|
|
ce213356b9 | ||
|
|
f5fa11dcc3 | ||
|
|
841902bcaf | ||
|
|
3de83b6745 | ||
|
|
18ae00f5a4 | ||
|
|
8639bf98f4 | ||
|
|
543c5f9b23 | ||
|
|
102ba18a05 | ||
|
|
54e0ed3f82 | ||
|
|
d86b0043ff | ||
|
|
1a214e6526 | ||
|
|
af7cf16786 | ||
|
|
5ac2405834 | ||
|
|
08325b8528 | ||
|
|
6573c5ea80 | ||
|
|
77ca8e7069 | ||
|
|
3dbd99f052 | ||
|
|
4d34794957 | ||
|
|
8c99189d79 | ||
|
|
4dae3cb826 | ||
|
|
52d4f63418 | ||
|
|
76e3ba2e4a | ||
|
|
1bea439fa0 | ||
|
|
36459d62b6 | ||
|
|
3699a24809 | ||
|
|
fc8691470c | ||
|
|
a03be85474 | ||
|
|
701964bc46 | ||
|
|
18604ba8bd | ||
|
|
b6b9b7c90e | ||
|
|
5aa7217c1b | ||
|
|
7fb5c96322 | ||
|
|
3d9729f992 | ||
|
|
8c61e32798 | ||
|
|
0bb38e4fce | ||
|
|
9eb9e9df25 | ||
|
|
e8d7857044 | ||
|
|
2c782fba62 | ||
|
|
31cd7f009c | ||
|
|
068c0307af | ||
|
|
54c885d1cf | ||
|
|
bbb434e2b5 | ||
|
|
bc879f847d | ||
|
|
1a474e9d22 | ||
|
|
cbb2453f6b | ||
|
|
e372d23b6e | ||
|
|
a3507d5975 | ||
|
|
c4f28c12f8 | ||
|
|
69939d5957 | ||
|
|
c2b0fda80a | ||
|
|
b62a0b0f4f | ||
|
|
5f9376ca63 | ||
|
|
f1087573dc | ||
|
|
62f188eb72 | ||
|
|
cdfa3e6779 | ||
|
|
f64406f70f | ||
|
|
cabae400e6 | ||
|
|
d5b3796ae9 | ||
|
|
442c7c28d4 | ||
|
|
e7fd16dd45 | ||
|
|
868d065d5d | ||
|
|
185b0ff2df | ||
|
|
e60b1cc26a | ||
|
|
5cecad9088 | ||
|
|
f26799c65c | ||
|
|
6046b48285 | ||
|
|
4bf925f1b1 | ||
|
|
fa55a8b354 | ||
|
|
38a8f76b88 | ||
|
|
dc574c0569 | ||
|
|
c52791e029 | ||
|
|
37c31d8a0f | ||
|
|
4e99654d1d | ||
|
|
a9a84ffdfc | ||
|
|
9bb51da3c1 | ||
|
|
3f73224d97 | ||
|
|
b79c62341e | ||
|
|
33a47f2ed1 | ||
|
|
3177e91e58 | ||
|
|
3ec4ffcab2 | ||
|
|
2f8449bb04 | ||
|
|
011f3edcbc | ||
|
|
abb6762a4f | ||
|
|
382a28c983 | ||
|
|
c7a8d343b5 | ||
|
|
bc21a53d44 | ||
|
|
d3bdad56e4 | ||
|
|
c9a2a4acbb | ||
|
|
eaf30e6c2d | ||
|
|
5979160a6a | ||
|
|
0181fde243 | ||
|
|
a5599dc673 | ||
|
|
25290ae202 | ||
|
|
4d36812cd6 | ||
|
|
a9f402cd6d | ||
|
|
2798ba7648 | ||
|
|
349558e62e | ||
|
|
91ca2a220e | ||
|
|
93104e4b40 | ||
|
|
d8adcdd1e5 | ||
|
|
c4b210a8db | ||
|
|
d54323fde0 | ||
|
|
c02be50242 | ||
|
|
a883ce0f43 | ||
|
|
ace353d71d | ||
|
|
18dbb24375 | ||
|
|
78daf54716 | ||
|
|
ee6541ba54 | ||
|
|
e4e9fe05e1 | ||
|
|
9d4035c94e | ||
|
|
293d38bd09 | ||
|
|
28be05600b | ||
|
|
03649820ce | ||
|
|
93515d2f88 | ||
|
|
d7dc70c0df | ||
|
|
ce0738782a | ||
|
|
df738b9c1d | ||
|
|
8bf0033d22 | ||
|
|
01e08e4928 | ||
|
|
90aee54a3c | ||
|
|
b7c42b5c8c | ||
|
|
008b5254c6 | ||
|
|
1b1163a100 | ||
|
|
70c14514e6 | ||
|
|
5830813170 | ||
|
|
a07d4d1b8a | ||
|
|
29c4ccf4d9 | ||
|
|
417006cfa3 | ||
|
|
907a8578ca | ||
|
|
7e63babd47 | ||
|
|
c289bb0af3 | ||
|
|
80767e7cd6 | ||
|
|
90e6dd8738 | ||
|
|
d3de9c65e6 | ||
|
|
48993f0486 | ||
|
|
918c6fb41b | ||
|
|
d121841fdf | ||
|
|
95ace2aa39 | ||
|
|
b8cd52563d | ||
|
|
70754af167 | ||
|
|
80bad7ad56 | ||
|
|
e214d6d69e | ||
|
|
0e7509d966 | ||
|
|
58a5b16484 | ||
|
|
a8df588b33 | ||
|
|
ef948f16f1 | ||
|
|
11f942771f | ||
|
|
f507e15bfc | ||
|
|
64ebc345b5 | ||
|
|
f94dbcd66d | ||
|
|
881303b73d | ||
|
|
97a2ff7125 | ||
|
|
22e968796d | ||
|
|
0c5f90d4ad | ||
|
|
0f51e19d44 | ||
|
|
5c720aa58a | ||
|
|
19d7ef0669 | ||
|
|
04a22be542 | ||
|
|
6ff2a9b48c | ||
|
|
19d3b736cb | ||
|
|
2bcdf170ad | ||
|
|
23d79ba536 | ||
|
|
fe6de6f309 | ||
|
|
29251978c4 | ||
|
|
a10e8d5aab | ||
|
|
5973761e2e | ||
|
|
00f3fb47d5 | ||
|
|
37e6782032 | ||
|
|
f58bdba273 | ||
|
|
e02f74032b | ||
|
|
6213bd4500 | ||
|
|
7739249364 | ||
|
|
2308deba33 | ||
|
|
8252f52862 | ||
|
|
9b05d46c77 | ||
|
|
a8e9a932cb | ||
|
|
d1858f22cf | ||
|
|
307f0e12bc | ||
|
|
3caf3ee0a8 | ||
|
|
a0fea79359 | ||
|
|
b01e6b5928 | ||
|
|
23457854b7 | ||
|
|
68d5dcd5f3 | ||
|
|
d9905665b2 | ||
|
|
58af4bae55 | ||
|
|
9c5aefd8d1 | ||
|
|
bca0e07c23 | ||
|
|
4676c2c2b3 | ||
|
|
196542ce5e | ||
|
|
a550bcca07 | ||
|
|
17d3d86127 | ||
|
|
2c0efcb2c3 | ||
|
|
53f17731b3 | ||
|
|
5fb1ffebc1 | ||
|
|
9093eb9693 | ||
|
|
60ba0bb63e | ||
|
|
2215aa84c0 | ||
|
|
6d2ac18859 | ||
|
|
056f346f1f | ||
|
|
50c0babb24 | ||
|
|
deb47c032b | ||
|
|
2d3b0b9001 | ||
|
|
26b076a981 | ||
|
|
6b8d58c230 | ||
|
|
54aca0323a | ||
|
|
5546e904f4 | ||
|
|
cd48cd0635 | ||
|
|
f8ec8e1dbb | ||
|
|
13db4f6dab | ||
|
|
cdafc60bf0 | ||
|
|
d505f7f27b | ||
|
|
6b82952f2a | ||
|
|
b0c1fbf769 | ||
|
|
0f55b478c2 | ||
|
|
d8cd526545 | ||
|
|
0fe4a1a64b | ||
|
|
b19183b802 | ||
|
|
25f6d3752b | ||
|
|
cd96d11769 | ||
|
|
2558210d10 | ||
|
|
fb584a7c89 | ||
|
|
112beb7edd | ||
|
|
fa8891ca34 | ||
|
|
d9beca97d7 | ||
|
|
143221825d | ||
|
|
d2d3a84b07 | ||
|
|
70f18f8aeb | ||
|
|
169c3cefc1 | ||
|
|
a6b8d2c133 | ||
|
|
42620cbf50 | ||
|
|
7897e1cb76 | ||
|
|
ccfcc1103c | ||
|
|
c202c86ce4 | ||
|
|
c4132d2b6b | ||
|
|
ecbf970ae3 | ||
|
|
aca497ba2d | ||
|
|
b06f240755 | ||
|
|
61e26262b0 | ||
|
|
6ca0f0e176 | ||
|
|
7f9ae158ec | ||
|
|
2b1c7f739d | ||
|
|
5a3f7c17ed | ||
|
|
329c2049c3 | ||
|
|
2e51bd1ffa | ||
|
|
1a8c6d6e90 | ||
|
|
64a31b5729 | ||
|
|
2dcc94e534 | ||
|
|
81cbc9f5e9 | ||
|
|
0d68735b60 | ||
|
|
bb8591b0ef | ||
|
|
e513ab4a09 | ||
|
|
e162fac30a | ||
|
|
3ae93cc1ad | ||
|
|
59001d466a | ||
|
|
c8dcdedae0 | ||
|
|
0c61abf4f0 | ||
|
|
8e5e875fe0 | ||
|
|
e6d7065461 | ||
|
|
8b87a4612c | ||
|
|
e8d7293e2a | ||
|
|
c283feb699 | ||
|
|
b895a9bc48 | ||
|
|
0d33319ad4 | ||
|
|
2af9d58f06 | ||
|
|
427e9d6482 | ||
|
|
e21fd954d3 | ||
|
|
e7f47c7a5a | ||
|
|
54c6dac322 | ||
|
|
cf64958562 | ||
|
|
ea31a3b42a | ||
|
|
353dbedbb9 | ||
|
|
a87c446c31 | ||
|
|
85f1d06b02 | ||
|
|
17d3e9b3d0 | ||
|
|
de47b9e774 | ||
|
|
acfa8d9fe2 | ||
|
|
930246e6c5 | ||
|
|
c6b8272448 | ||
|
|
24b832a217 | ||
|
|
3acf002f95 | ||
|
|
16f9b3f6b1 | ||
|
|
3c38c7cc25 | ||
|
|
efbc930125 | ||
|
|
90b326e6b9 | ||
|
|
d3e7fe212d | ||
|
|
803d83f8e1 | ||
|
|
59b060fbc0 | ||
|
|
6d64bd4cdf | ||
|
|
ada4850f65 | ||
|
|
2c0b49d7f8 | ||
|
|
e534eebc4d | ||
|
|
db16676cc4 | ||
|
|
0f1e5b858b | ||
|
|
a39d2e46e1 |
No files matched your search
@@ -9,10 +9,15 @@ updates:
|
||||
- mavenCentral
|
||||
schedule:
|
||||
interval: "daily"
|
||||
cooldown:
|
||||
default-days: 7
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
cooldown:
|
||||
default-days: 7
|
||||
|
||||
# Workaround for https://github.com/dependabot/dependabot-core/issues/6888
|
||||
registries:
|
||||
|
||||
@@ -4,11 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- staging
|
||||
- trying
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
permissions:
|
||||
actions: none
|
||||
checks: none
|
||||
@@ -24,47 +20,66 @@ permissions:
|
||||
security-events: none
|
||||
statuses: none
|
||||
env:
|
||||
JAVA_HOME: /usr/lib/jvm/java-21-openjdk-amd64
|
||||
JAVA_HOME: /usr/lib/jvm/java-25-openjdk-amd64
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
flavor: [Foss, Gplay]
|
||||
flavor: [fdroidLegacy, foss, gplay]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: gradle/actions/wrapper-validation@v5
|
||||
- name: set up OpenJDK 21
|
||||
- uses: actions/checkout@v7.0.1
|
||||
- name: Ensure sentence-cased flavor variables
|
||||
run: |
|
||||
flavor="$(echo ${{ matrix.flavor }})"
|
||||
echo "sentenceCasedFlavor=${flavor^}" >> "$GITHUB_ENV"
|
||||
- uses: gradle/actions/wrapper-validation@v6.2.0
|
||||
- name: set up OpenJDK 25
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y openjdk-21-jdk-headless
|
||||
sudo apt-get install -y openjdk-25-jdk-headless
|
||||
sudo update-alternatives --auto java
|
||||
- name: Build
|
||||
run: ./gradlew assemble${{ matrix.flavor }}Release
|
||||
run: ./gradlew assemble${sentenceCasedFlavor}Release
|
||||
- name: Check for non-free libraries
|
||||
run: |
|
||||
# Get Katastima APK scanner
|
||||
wget -q https://codeberg.org/Katastima/apkscanner/releases/download/v0.0.9/apk-scanner_v0.0.9.jar
|
||||
# Print pretty result
|
||||
java -jar apk-scanner_v0.0.9.jar scan-apk "$(echo 'app/build/outputs/apk/${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release-unsigned.apk')"
|
||||
# Check for offending libraries
|
||||
# Exit code 4 = no result, which is what we want
|
||||
set +e
|
||||
java -jar apk-scanner_v0.0.9.jar scan-apk --json=yes "$(echo 'app/build/outputs/apk/${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release-unsigned.apk')" | jq --exit-status '.libraryCheckResult.offendingLibraries[] | select((.libraryId == "/org/acra" and .license == "Apache-2.0")|not)'
|
||||
if [ "$?" -ne 4 ]; then
|
||||
echo "Bad libraries found!"
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
- name: Check lint
|
||||
run: ./gradlew lint${{ matrix.flavor }}Release
|
||||
run: ./gradlew lint${sentenceCasedFlavor}Release
|
||||
- name: Run unit tests
|
||||
run: timeout 5m ./gradlew test${{ matrix.flavor }}ReleaseUnitTest || { ./gradlew --stop && timeout 5m ./gradlew test${{ matrix.flavor }}ReleaseUnitTest; }
|
||||
run: timeout 5m ./gradlew test${sentenceCasedFlavor}DebugUnitTest || { ./gradlew --stop && timeout 5m ./gradlew test${sentenceCasedFlavor}DebugUnitTest; }
|
||||
- name: Enable KVM
|
||||
run: |
|
||||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
- name: Run instrumented tests (API 21)
|
||||
uses: ReactiveCircus/android-emulator-runner@v2
|
||||
- name: Run instrumented tests (API 23)
|
||||
uses: ReactiveCircus/android-emulator-runner@v2.38.0
|
||||
with:
|
||||
api-level: 21
|
||||
api-level: 23
|
||||
arch: x86_64
|
||||
script: ./gradlew connected${{ matrix.flavor }}DebugAndroidTest
|
||||
script: ./gradlew connected${sentenceCasedFlavor}DebugAndroidTest
|
||||
- name: Run instrumented tests (API 35)
|
||||
uses: ReactiveCircus/android-emulator-runner@v2
|
||||
uses: ReactiveCircus/android-emulator-runner@v2.38.0
|
||||
with:
|
||||
api-level: 35
|
||||
arch: x86_64
|
||||
script: ./gradlew connected${{ matrix.flavor }}DebugAndroidTest
|
||||
script: ./gradlew connected${sentenceCasedFlavor}DebugAndroidTest
|
||||
- name: Archive test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v5.0.0
|
||||
uses: actions/upload-artifact@v7.0.1
|
||||
with:
|
||||
name: test-results-flavor${{ matrix.flavor }}
|
||||
name: test-results-flavor-${{ matrix.flavor }}
|
||||
path: app/build/reports
|
||||
@@ -19,15 +19,15 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
id: checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7.0.1
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v6.1.0
|
||||
uses: actions/setup-python@v7.0.0
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Run converter script
|
||||
run: python .scripts/changelog_to_fastlane.py
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7.0.11
|
||||
uses: peter-evans/create-pull-request@v8.1.1
|
||||
with:
|
||||
title: "Update Fastlane changelogs"
|
||||
commit-message: "Update Fastlane changelogs"
|
||||
|
||||
@@ -17,15 +17,17 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
id: checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7.0.1
|
||||
- name: Update contributors
|
||||
id: update_contributors
|
||||
uses: TheLastProject/contributors-to-file-action@v3.2.0
|
||||
with:
|
||||
file_in_repo: app/src/main/res/raw/contributors.txt
|
||||
min_commit_count: 5
|
||||
- name: Remove gradle-update-robot from contributors (not a person)
|
||||
run: "sed -i '/^gradle-update-robot$/d' app/src/main/res/raw/contributors.txt"
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7.0.11
|
||||
uses: peter-evans/create-pull-request@v8.1.1
|
||||
with:
|
||||
title: "Update contributors"
|
||||
commit-message: "Update contributors"
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
generate-feature-graphic:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7.0.1
|
||||
- name: Install requirements
|
||||
run: |
|
||||
sudo apt-get update
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
- name: Generate featureGraphic.png for each language
|
||||
run: .scripts/generate_feature_graphic/generate_feature_graphic.sh
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7.0.11
|
||||
uses: peter-evans/create-pull-request@v8.1.1
|
||||
with:
|
||||
title: "Update feature graphic"
|
||||
commit-message: "Update feature graphic"
|
||||
|
||||
@@ -4,11 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- staging
|
||||
- trying
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
permissions:
|
||||
actions: none
|
||||
checks: none
|
||||
@@ -27,7 +23,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7.0.1
|
||||
- name: Fail on bad translations
|
||||
run: if grep -ri "<xliff" app/src/main/res/values*/strings.xml; then echo "Invalidly escaped translations found"; exit 1; fi
|
||||
- name: Check app_name consistency
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
name: Update Gradle Wrapper
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
update-gradle-wrapper:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Update Gradle Wrapper
|
||||
uses: gradle-update/update-gradle-wrapper-action@v2
|
||||
@@ -17,13 +17,13 @@ jobs:
|
||||
update-locales:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7.0.1
|
||||
- name: Add new locales
|
||||
run: .scripts/new-locales.py
|
||||
- name: Update locales
|
||||
run: .scripts/locales.py
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7.0.11
|
||||
uses: peter-evans/create-pull-request@v8.1.1
|
||||
with:
|
||||
title: "Update locales"
|
||||
commit-message: "Update locales"
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
name: Android Wear CI
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
permissions:
|
||||
actions: none
|
||||
checks: none
|
||||
contents: read
|
||||
deployments: none
|
||||
discussions: none
|
||||
id-token: none
|
||||
issues: none
|
||||
packages: none
|
||||
pages: none
|
||||
pull-requests: none
|
||||
repository-projects: none
|
||||
security-events: none
|
||||
statuses: none
|
||||
env:
|
||||
JAVA_HOME: /usr/lib/jvm/java-25-openjdk-amd64
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- uses: gradle/actions/wrapper-validation@v6.2.0
|
||||
- name: set up OpenJDK 25
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y openjdk-25-jdk-headless
|
||||
sudo update-alternatives --auto java
|
||||
- name: Build
|
||||
run: ./gradlew :wear:assembleRelease
|
||||
- name: Check for non-free libraries
|
||||
run: |
|
||||
# Get Katastima APK scanner
|
||||
wget -q https://codeberg.org/Katastima/apkscanner/releases/download/v0.0.9/apk-scanner_v0.0.9.jar
|
||||
# Print pretty result
|
||||
java -jar apk-scanner_v0.0.9.jar scan-apk "wear/build/outputs/apk/release/wear-release-unsigned.apk"
|
||||
# Check for offending libraries
|
||||
# Exit code 4 = no result, which is what we want
|
||||
set +e
|
||||
java -jar apk-scanner_v0.0.9.jar scan-apk --json=yes "wear/build/outputs/apk/release/wear-release-unsigned.apk" | jq --exit-status '.libraryCheckResult.offendingLibraries[]'
|
||||
if [ "$?" -ne 4 ]; then
|
||||
echo "Bad libraries found!"
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
- name: Check lint
|
||||
run: ./gradlew :wear:lintRelease
|
||||
@@ -19,8 +19,10 @@
|
||||
/app/*.log
|
||||
/app/build
|
||||
/app/release
|
||||
/.idea
|
||||
|
||||
/wear/build
|
||||
/wear/release
|
||||
/.idea/*
|
||||
!/.idea/icon.svg
|
||||
# Bundle
|
||||
/.bundle/
|
||||
/vendor/bundle
|
||||
@@ -28,3 +30,4 @@
|
||||
|
||||
# Catima-specific
|
||||
SHA256SUMS
|
||||
/shared/build
|
||||
@@ -0,0 +1 @@
|
||||
../.design/ic_launcher_foreground.svg
|
||||
@@ -0,0 +1 @@
|
||||
3.3.11
|
||||
@@ -15,7 +15,7 @@ with open('CHANGELOG.md') as changelog:
|
||||
changelogs[version_code] = text
|
||||
|
||||
text = []
|
||||
match = re.match("## \S* - (\d*).*", line)
|
||||
match = re.match("## .+ - (\d*).*", line)
|
||||
if not match:
|
||||
raise ValueError(f"Invalid version line: {line}")
|
||||
version_code = match.group(1)
|
||||
|
||||
@@ -12,7 +12,8 @@ NC='\033[0m' # No Color
|
||||
# Vars
|
||||
SUCCESS=1
|
||||
CANONICAL_TITLE="Catima"
|
||||
ALLOWLIST=("ar" "bn" "fa" "fa-IR" "he-IL" "hi" "hi-IN" "kn" "kn-IN" "ml" "mr" "ta" "ta-IN" "zh-rTW" "zh-TW") # TODO: Link values and fastlane with different codes together
|
||||
# peo is only temporarily allowed due to https://github.com/WeblateOrg/weblate/issues/17455
|
||||
ALLOWLIST=("ar" "bn" "fa" "fa-IR" "he-IL" "hi" "hi-IN" "kn" "kn-IN" "ml" "mr" "peo", "ta" "ta-IN" "zh-rTW" "zh-TW") # TODO: Link values and fastlane with different codes together
|
||||
|
||||
function get_lang() {
|
||||
LANG_DIRNAME=$(dirname "$FILE" | xargs basename)
|
||||
|
||||
@@ -1,5 +1,80 @@
|
||||
# Changelog
|
||||
|
||||
## v2.45.0 (Android) - 1002
|
||||
|
||||
- Add a Bluetooth server for Wear OS companion app support
|
||||
- Remove embedded CHANGELOG
|
||||
|
||||
## v1.0.0 (Wear OS) - 200
|
||||
|
||||
- Initial release of Wear OS companion app
|
||||
|
||||
## v2.44.0 - 168 (2026-07-28)
|
||||
|
||||
- Add option to open image in internal image viewer in gallery
|
||||
|
||||
## v2.43.0 - 167 (2026-07-12)
|
||||
|
||||
- Add support for showing the card ID in the card list
|
||||
- Add support to sort by most recently added
|
||||
- Add internal image viewer for zooming card front/back/icon images
|
||||
|
||||
## v2.42.1 - 166 (2026-05-16)
|
||||
|
||||
- Prevent crash on devices with misbehaving NFC
|
||||
|
||||
## v2.42.0 - 165 (2026-05-06)
|
||||
|
||||
- Disable NFC while showing a card by default
|
||||
- Ask keyboard to capitalize each word in store name in edit screen
|
||||
- Put date in export file name
|
||||
|
||||
## v2.41.7 - 164 (2026-03-06)
|
||||
|
||||
Android 5.0 and 5.1 are no longer supported starting with this release. If you want to use Catima on these versions, please use version 2.41.6.
|
||||
|
||||
- Fix crash when switching cards using volume buttons if only one card is available
|
||||
- Fix shortcut returning to previous card after rotation
|
||||
|
||||
## v2.41.6 - 163 (2026-01-23)
|
||||
|
||||
- Auto-detect URLs in card ID and make the clickable in card ID details pop-up
|
||||
- Fix barcode selector activity showing white squares instead of barcodes
|
||||
|
||||
## v2.41.5 - 162 (2026-01-15)
|
||||
|
||||
- Fix list widget sometimes opening wrong card
|
||||
- Fix several bugs with shortcut handling
|
||||
- Fix About activity not using pure black title bar in OLED mode
|
||||
- Fully remove automatic barcode encoding detection
|
||||
- Expose barcode encoding through ContentProvider (used by Gadgetbridge)
|
||||
|
||||
## v2.41.4 - 161 (2026-01-04)
|
||||
|
||||
- Disable automatic barcode encoding detection for now (breaks too many cards)
|
||||
|
||||
## v2.41.3 - 160 (2026-01-04)
|
||||
|
||||
- Follow-up for fix in 2.41.2 for cards explicitly set to ISO-8859-1
|
||||
- Migrate old cards to ISO-8859-1 to fix sudden behaviour differences for existing cards
|
||||
|
||||
## v2.41.2 - 159 (2026-01-03)
|
||||
|
||||
- Fix change introduced in 2.41.0 that broke support for some scanners for non-UTF-8 barcodes
|
||||
|
||||
## v2.41.1 - 158 (2025-12-31)
|
||||
|
||||
- Fix status and navigation bar colour in new About activity
|
||||
|
||||
## v2.41.0 - 157 (2025-12-30)
|
||||
|
||||
- Add support for UTF-8 barcodes
|
||||
- Add duplicate option to main screen and reorder options slightly
|
||||
- Fix column count setting not being applied to group card list
|
||||
- Remove theme colour support
|
||||
- Reduce max photo size to reduce storage use (only for newly added photos)
|
||||
- Migrate About activity from Android XML to Jetpack Compose
|
||||
|
||||
## v2.40.0 - 156 (2025-12-08)
|
||||
|
||||
- Copy card ID to clipboard from view dialog or long press
|
||||
|
||||
@@ -23,7 +23,9 @@ for good reason.
|
||||
|
||||
## Code Changes
|
||||
|
||||
Note: submitting LLM ("AI") generated code is strongly discouraged, as such
|
||||
### LLM ("AI") and coding agents
|
||||
|
||||
**Note:** submitting LLM ("AI") generated code is strongly discouraged, as such
|
||||
code is often (subtly) incorrect or overcomplicated (for example: unnecessarily
|
||||
pulling in extra libraries for functionality already covered by existing
|
||||
libraries). It also often makes unrelated changes that increase the risk of
|
||||
@@ -47,6 +49,14 @@ risk.
|
||||
|
||||
Please never submit LLM-generated code as-is.
|
||||
|
||||
### Kotlin and Compose migration
|
||||
|
||||
Catima uses a lot of "legacy" tech, Java, Android XML. This will be ported to Kotlin,
|
||||
then Jetpack Compose; for further details, see
|
||||
<https://github.com/CatimaLoyalty/Android/issues/2483>.
|
||||
|
||||
Thus, prefer Kotlin and Jetpack Compose for new code/UI where practical, especially new files/features.
|
||||
|
||||
### Test Your Code
|
||||
|
||||
There are four possible tests you can run to verify your code. The first
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "fastlane"
|
||||
|
||||
# https://github.com/fastlane/fastlane/issues/29183
|
||||
gem "abbrev"
|
||||
gem "mutex_m"
|
||||
gem "ostruct"
|
||||
@@ -1,48 +1,50 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.7)
|
||||
base64
|
||||
nkf
|
||||
rexml
|
||||
CFPropertyList (3.0.8)
|
||||
abbrev (0.1.2)
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
addressable (2.9.0)
|
||||
public_suffix (>= 2.0.2, < 8.0)
|
||||
artifactory (3.0.17)
|
||||
atomos (0.1.3)
|
||||
aws-eventstream (1.4.0)
|
||||
aws-partitions (1.1117.0)
|
||||
aws-sdk-core (3.226.0)
|
||||
aws-partitions (1.1269.0)
|
||||
aws-sdk-core (3.254.0)
|
||||
aws-eventstream (~> 1, >= 1.3.0)
|
||||
aws-partitions (~> 1, >= 1.992.0)
|
||||
aws-sigv4 (~> 1.9)
|
||||
base64
|
||||
bigdecimal
|
||||
jmespath (~> 1, >= 1.6.1)
|
||||
logger
|
||||
aws-sdk-kms (1.105.0)
|
||||
aws-sdk-core (~> 3, >= 3.225.0)
|
||||
aws-sdk-kms (1.130.0)
|
||||
aws-sdk-core (~> 3, >= 3.254.0)
|
||||
aws-sigv4 (~> 1.5)
|
||||
aws-sdk-s3 (1.189.1)
|
||||
aws-sdk-core (~> 3, >= 3.225.0)
|
||||
aws-sdk-s3 (1.227.0)
|
||||
aws-sdk-core (~> 3, >= 3.254.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.5)
|
||||
aws-sigv4 (1.12.1)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
babosa (1.0.4)
|
||||
base64 (0.3.0)
|
||||
benchmark (0.5.0)
|
||||
bigdecimal (4.1.2)
|
||||
claide (1.1.0)
|
||||
colored (1.2)
|
||||
colored2 (3.1.2)
|
||||
commander (4.6.0)
|
||||
highline (~> 2.0.0)
|
||||
csv (3.3.5)
|
||||
declarative (0.0.20)
|
||||
digest-crc (0.7.0)
|
||||
rake (>= 12.0.0, < 14.0.0)
|
||||
domain_name (0.6.20240107)
|
||||
dotenv (2.8.1)
|
||||
emoji_regex (3.2.3)
|
||||
excon (0.112.0)
|
||||
faraday (1.10.4)
|
||||
excon (1.5.0)
|
||||
logger
|
||||
faraday (1.10.6)
|
||||
faraday-em_http (~> 1.0)
|
||||
faraday-em_synchrony (~> 1.0)
|
||||
faraday-excon (~> 1.1)
|
||||
@@ -54,53 +56,62 @@ GEM
|
||||
faraday-rack (~> 1.0)
|
||||
faraday-retry (~> 1.0)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-cookie_jar (0.0.7)
|
||||
faraday-cookie_jar (0.0.8)
|
||||
faraday (>= 0.8.0)
|
||||
http-cookie (~> 1.0.0)
|
||||
http-cookie (>= 1.0.0)
|
||||
faraday-em_http (1.0.0)
|
||||
faraday-em_synchrony (1.0.1)
|
||||
faraday-excon (1.1.0)
|
||||
faraday-httpclient (1.0.1)
|
||||
faraday-multipart (1.1.1)
|
||||
faraday-multipart (1.2.0)
|
||||
multipart-post (~> 2.0)
|
||||
faraday-net_http (1.0.2)
|
||||
faraday-net_http_persistent (1.2.0)
|
||||
faraday-patron (1.0.0)
|
||||
faraday-rack (1.0.0)
|
||||
faraday-retry (1.0.3)
|
||||
faraday-retry (1.0.4)
|
||||
faraday_middleware (1.2.1)
|
||||
faraday (~> 1.0)
|
||||
fastimage (2.4.0)
|
||||
fastlane (2.228.0)
|
||||
CFPropertyList (>= 2.3, < 4.0.0)
|
||||
addressable (>= 2.8, < 3.0.0)
|
||||
fastimage (2.4.1)
|
||||
fastlane (2.237.0)
|
||||
CFPropertyList (>= 2.3, < 5.0.0)
|
||||
abbrev (~> 0.1)
|
||||
addressable (>= 2.9.0, < 3.0.0)
|
||||
artifactory (~> 3.0)
|
||||
aws-sdk-s3 (~> 1.0)
|
||||
aws-sdk-s3 (~> 1.197)
|
||||
babosa (>= 1.0.3, < 2.0.0)
|
||||
bundler (>= 1.12.0, < 3.0.0)
|
||||
base64 (~> 0.2)
|
||||
benchmark (>= 0.1.0)
|
||||
bundler (>= 2.4.0, < 5.0.0)
|
||||
colored (~> 1.2)
|
||||
commander (~> 4.6)
|
||||
csv (~> 3.3)
|
||||
dotenv (>= 2.1.1, < 3.0.0)
|
||||
emoji_regex (>= 0.1, < 4.0)
|
||||
excon (>= 0.71.0, < 1.0.0)
|
||||
excon (>= 0.71.0, < 2.0.0)
|
||||
faraday (~> 1.0)
|
||||
faraday-cookie_jar (~> 0.0.6)
|
||||
faraday_middleware (~> 1.0)
|
||||
fastimage (>= 2.1.0, < 3.0.0)
|
||||
fastlane-sirp (>= 1.0.0)
|
||||
fastlane-sirp (>= 1.1.0)
|
||||
gh_inspector (>= 1.1.2, < 2.0.0)
|
||||
google-apis-androidpublisher_v3 (~> 0.3)
|
||||
google-apis-playcustomapp_v1 (~> 0.1)
|
||||
google-cloud-env (>= 1.6.0, < 2.0.0)
|
||||
google-cloud-env (>= 1.6.0, < 2.3.0)
|
||||
google-cloud-storage (~> 1.31)
|
||||
highline (~> 2.0)
|
||||
http-cookie (~> 1.0.5)
|
||||
json (< 3.0.0)
|
||||
jwt (>= 2.1.0, < 3)
|
||||
jwt (>= 2.10.3, < 4)
|
||||
logger (>= 1.6, < 2.0)
|
||||
mini_magick (>= 4.9.4, < 5.0.0)
|
||||
multi_json (~> 1.12)
|
||||
multipart-post (>= 2.0.0, < 3.0.0)
|
||||
mutex_m (~> 0.3)
|
||||
naturally (~> 2.2)
|
||||
nkf (~> 0.2)
|
||||
optparse (>= 0.1.1, < 1.0.0)
|
||||
ostruct (>= 0.1.0)
|
||||
plist (>= 3.1.0, < 4.0.0)
|
||||
rubyzip (>= 2.0.0, < 3.0.0)
|
||||
security (= 0.1.5)
|
||||
@@ -113,44 +124,48 @@ GEM
|
||||
xcodeproj (>= 1.13.0, < 2.0.0)
|
||||
xcpretty (~> 0.4.1)
|
||||
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
|
||||
fastlane-sirp (1.0.0)
|
||||
sysrandom (~> 1.0)
|
||||
fastlane-sirp (1.1.0)
|
||||
gh_inspector (1.1.3)
|
||||
google-apis-androidpublisher_v3 (0.54.0)
|
||||
google-apis-core (>= 0.11.0, < 2.a)
|
||||
google-apis-core (0.11.3)
|
||||
google-apis-androidpublisher_v3 (0.104.0)
|
||||
google-apis-core (>= 0.15.0, < 2.a)
|
||||
google-apis-core (0.18.0)
|
||||
addressable (~> 2.5, >= 2.5.1)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
httpclient (>= 2.8.1, < 3.a)
|
||||
googleauth (~> 1.9)
|
||||
httpclient (>= 2.8.3, < 3.a)
|
||||
mini_mime (~> 1.0)
|
||||
mutex_m
|
||||
representable (~> 3.0)
|
||||
retriable (>= 2.0, < 4.a)
|
||||
rexml
|
||||
google-apis-iamcredentials_v1 (0.17.0)
|
||||
google-apis-core (>= 0.11.0, < 2.a)
|
||||
google-apis-playcustomapp_v1 (0.13.0)
|
||||
google-apis-core (>= 0.11.0, < 2.a)
|
||||
google-apis-storage_v1 (0.31.0)
|
||||
google-apis-core (>= 0.11.0, < 2.a)
|
||||
google-cloud-core (1.8.0)
|
||||
google-apis-iamcredentials_v1 (0.28.0)
|
||||
google-apis-core (>= 0.15.0, < 2.a)
|
||||
google-apis-playcustomapp_v1 (0.18.0)
|
||||
google-apis-core (>= 0.15.0, < 2.a)
|
||||
google-apis-storage_v1 (0.64.0)
|
||||
google-apis-core (>= 0.15.0, < 2.a)
|
||||
google-cloud-core (1.9.0)
|
||||
google-cloud-env (>= 1.0, < 3.a)
|
||||
google-cloud-errors (~> 1.0)
|
||||
google-cloud-env (1.6.0)
|
||||
faraday (>= 0.17.3, < 3.0)
|
||||
google-cloud-errors (1.5.0)
|
||||
google-cloud-storage (1.47.0)
|
||||
google-cloud-env (2.2.2)
|
||||
base64 (~> 0.2)
|
||||
faraday (>= 1.0, < 3.a)
|
||||
google-cloud-errors (1.7.0)
|
||||
google-cloud-storage (1.62.0)
|
||||
addressable (~> 2.8)
|
||||
digest-crc (~> 0.4)
|
||||
google-apis-iamcredentials_v1 (~> 0.1)
|
||||
google-apis-storage_v1 (~> 0.31.0)
|
||||
google-apis-core (>= 0.18, < 2)
|
||||
google-apis-iamcredentials_v1 (~> 0.18)
|
||||
google-apis-storage_v1 (>= 0.42)
|
||||
google-cloud-core (~> 1.6)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
googleauth (~> 1.9)
|
||||
mini_mime (~> 1.0)
|
||||
googleauth (1.8.1)
|
||||
faraday (>= 0.17.3, < 3.a)
|
||||
jwt (>= 1.4, < 3.0)
|
||||
multi_json (~> 1.11)
|
||||
google-logging-utils (0.2.0)
|
||||
googleauth (1.17.1)
|
||||
faraday (>= 1.0, < 3.a)
|
||||
google-cloud-env (~> 2.2)
|
||||
google-logging-utils (~> 0.1)
|
||||
jwt (>= 1.4, < 4.0)
|
||||
os (>= 0.9, < 2.0)
|
||||
pstore (~> 0.1)
|
||||
signet (>= 0.16, < 2.a)
|
||||
highline (2.0.3)
|
||||
http-cookie (1.0.8)
|
||||
@@ -158,43 +173,42 @@ GEM
|
||||
httpclient (2.9.0)
|
||||
mutex_m
|
||||
jmespath (1.6.2)
|
||||
json (2.12.2)
|
||||
jwt (2.10.1)
|
||||
json (2.21.1)
|
||||
jwt (3.2.0)
|
||||
base64
|
||||
logger (1.7.0)
|
||||
mini_magick (4.13.2)
|
||||
mini_mime (1.1.5)
|
||||
multi_json (1.15.0)
|
||||
multi_json (1.21.1)
|
||||
multipart-post (2.4.1)
|
||||
mutex_m (0.3.0)
|
||||
nanaimo (0.4.0)
|
||||
naturally (2.3.0)
|
||||
nkf (0.2.0)
|
||||
optparse (0.6.0)
|
||||
nkf (0.3.0)
|
||||
optparse (0.8.1)
|
||||
os (1.1.4)
|
||||
ostruct (0.6.1)
|
||||
ostruct (0.6.3)
|
||||
plist (3.7.2)
|
||||
public_suffix (6.0.2)
|
||||
rake (13.3.0)
|
||||
pstore (0.2.1)
|
||||
public_suffix (7.0.5)
|
||||
rake (13.4.2)
|
||||
representable (3.2.0)
|
||||
declarative (< 0.1.0)
|
||||
trailblazer-option (>= 0.1.1, < 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
retriable (3.1.2)
|
||||
rexml (3.4.1)
|
||||
retriable (3.8.0)
|
||||
rexml (3.4.4)
|
||||
rouge (3.28.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.4.1)
|
||||
security (0.1.5)
|
||||
signet (0.20.0)
|
||||
signet (0.22.0)
|
||||
addressable (~> 2.8)
|
||||
faraday (>= 0.17.5, < 3.a)
|
||||
jwt (>= 1.5, < 3.0)
|
||||
multi_json (~> 1.10)
|
||||
jwt (>= 1.5, < 4.0)
|
||||
simctl (1.6.10)
|
||||
CFPropertyList
|
||||
naturally
|
||||
sysrandom (1.0.5)
|
||||
terminal-notifier (2.0.0)
|
||||
terminal-table (3.0.2)
|
||||
unicode-display_width (>= 1.1.1, < 3)
|
||||
@@ -206,12 +220,14 @@ GEM
|
||||
uber (0.1.0)
|
||||
unicode-display_width (2.6.0)
|
||||
word_wrap (1.0.0)
|
||||
xcodeproj (1.27.0)
|
||||
xcodeproj (1.28.1)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
base64
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.4.0)
|
||||
nkf
|
||||
rexml (>= 3.3.6, < 4.0)
|
||||
xcpretty (0.4.1)
|
||||
rouge (~> 3.28.0)
|
||||
@@ -222,10 +238,7 @@ PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
abbrev
|
||||
fastlane
|
||||
mutex_m
|
||||
ostruct
|
||||
|
||||
BUNDLED WITH
|
||||
2.5.22
|
||||
@@ -1,12 +1,14 @@
|
||||
**Last updated**
|
||||
September 30 2025
|
||||
August 7 2026
|
||||
|
||||
# Privacy Policy
|
||||
Catima does not collect or transmit any personal information.
|
||||
|
||||
To ensure correct app functionality, we require access to the following:
|
||||
|
||||
- Bluetooth: When using Catima together with the Wear OS companion app, Bluetooth access is needed to be able to communicate to Wear OS. This may show up as "find, connect to, and determine the relative position of nearby devices" because Android considers Bluetooth as part of location, but location information is never collected or used. The app can still be used when Bluetooth permission is denied, but you will not be able to use the Wear OS companion app.
|
||||
- Camera: We need access to your camera to be able to scan barcodes. The app can still be used when camera access is denied, but you will have to manually type the barcode information.
|
||||
- NFC: We need NFC access to temporarily disable NFC while showing a barcode to prevent NFC payment apps from triggering (such as when using a check-in gates which support both barcodes and NFC payments). This functionality can be disabled in settings.
|
||||
- Storage (Android 5 and 6 only): We need access to your device storage to create or import backups. The app can still be used when storage access is denied, but you will not be able to create or import backups.
|
||||
|
||||
Catima offers a feature to share cards with other users. All the relevant data is in the generated shareable URLs and never transmitted to our servers. When viewed through catima.app, the data in the URL is rendered using client-side Javascript to further ensure no data is ever transmitted to us.
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import com.android.build.gradle.internal.tasks.factory.dependsOn
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.com.android.application)
|
||||
alias(libs.plugins.org.jetbrains.kotlin.android)
|
||||
alias(libs.plugins.org.jetbrains.kotlin.plugin.compose)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@@ -15,15 +17,15 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "me.hackerchick.catima"
|
||||
minSdk = 21
|
||||
minSdk = 23
|
||||
targetSdk = 36
|
||||
versionCode = 156
|
||||
versionName = "2.40.0"
|
||||
versionCode = 1002
|
||||
versionName = "2.45.0"
|
||||
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
multiDexEnabled = true
|
||||
|
||||
resourceConfigurations += listOf("ar", "be", "bg", "bn", "bn-rIN", "bs", "cs", "da", "de", "el-rGR", "en", "eo", "es", "es-rAR", "et", "fa", "fi", "fr", "gl", "he-rIL", "hi", "hr", "hu", "in-rID", "is", "it", "ja", "ko", "lt", "lv", "nb-rNO", "nl", "oc", "pl", "pt", "pt-rBR", "pt-rPT", "ro-rRO", "ru", "sk", "sl", "sr", "sv", "ta", "tr", "uk", "vi", "zh-rCN", "zh-rTW")
|
||||
resourceConfigurations += listOf("ar", "be", "bg", "bn", "bn-rIN", "bs", "cs", "da", "de", "el-rGR", "en", "eo", "es", "es-rAR", "et", "fa", "fi", "fr", "gl", "he-rIL", "hi", "hr", "hu", "in-rID", "is", "it", "ja", "ko", "lt", "lv", "nb-rNO", "nl", "oc", "peo", "pl", "pt", "pt-rBR", "pt-rPT", "ro-rRO", "ru", "sk", "sl", "sr", "sv", "ta", "tr", "uk", "vi", "zh-rCN", "zh-rTW")
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -36,7 +38,7 @@ android {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android.txt"),
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
@@ -47,6 +49,7 @@ android {
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
compose = true
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
@@ -56,8 +59,14 @@ android {
|
||||
dimension = "type"
|
||||
isDefault = true
|
||||
}
|
||||
create("fdroidLegacy") {
|
||||
dimension = "type"
|
||||
versionNameSuffix = " (F-Droid)"
|
||||
versionCode = defaultConfig.versionCode!! - 1
|
||||
}
|
||||
create("gplay") {
|
||||
dimension = "type"
|
||||
versionNameSuffix = " (Google)"
|
||||
|
||||
// Google doesn't allow donation links
|
||||
buildConfigField("boolean", "showDonate", "false")
|
||||
@@ -74,16 +83,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
encoding = "UTF-8"
|
||||
|
||||
// Flag to enable support for the new language APIs
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("test") {
|
||||
resources.srcDirs("src/test/res")
|
||||
@@ -102,16 +101,26 @@ android {
|
||||
lint {
|
||||
lintConfig = file("lint.xml")
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "21"
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget = JvmTarget.JVM_21
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
encoding = "UTF-8"
|
||||
|
||||
// Flag to enable support for the new language APIs
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":shared"))
|
||||
|
||||
// AndroidX
|
||||
implementation(libs.androidx.appcompat.appcompat)
|
||||
implementation(libs.androidx.constraintlayout.constraintlayout)
|
||||
@@ -124,6 +133,19 @@ dependencies {
|
||||
implementation(libs.com.google.android.material.material)
|
||||
coreLibraryDesugaring(libs.com.android.tools.desugar.jdk.libs)
|
||||
|
||||
// Compose
|
||||
implementation(libs.androidx.activity.activity.compose)
|
||||
val composeBom = platform(libs.androidx.compose.compose.bom)
|
||||
implementation(composeBom)
|
||||
implementation(libs.androidx.compose.foundation.foundation)
|
||||
implementation(libs.androidx.compose.material3.material3)
|
||||
implementation(libs.androidx.compose.material.material.icons.extended)
|
||||
implementation(libs.androidx.compose.ui.ui.tooling.preview.android)
|
||||
debugImplementation(libs.androidx.compose.ui.ui.test.manifest)
|
||||
|
||||
androidTestImplementation(composeBom)
|
||||
androidTestImplementation(libs.androidx.compose.ui.ui.test.junit4)
|
||||
|
||||
// Third-party
|
||||
implementation(libs.com.journeyapps.zxing.android.embedded)
|
||||
implementation(libs.com.github.yalantis.ucrop)
|
||||
@@ -143,13 +165,14 @@ dependencies {
|
||||
androidTestImplementation(libs.bundles.androidx.test)
|
||||
androidTestImplementation(libs.junit.junit)
|
||||
androidTestImplementation(libs.androidx.test.ext.junit)
|
||||
androidTestImplementation(libs.androidx.test.rules)
|
||||
androidTestImplementation(libs.androidx.test.runner)
|
||||
androidTestImplementation(libs.androidx.test.uiautomator.uiautomator)
|
||||
androidTestImplementation(libs.androidx.test.espresso.espresso.core)
|
||||
}
|
||||
|
||||
tasks.register("copyRawResFiles", Copy::class) {
|
||||
from(
|
||||
layout.projectDirectory.file("../CHANGELOG.md"),
|
||||
layout.projectDirectory.file("../PRIVACY.md")
|
||||
)
|
||||
into(layout.projectDirectory.dir("src/main/res/raw"))
|
||||
@@ -157,7 +180,7 @@ tasks.register("copyRawResFiles", Copy::class) {
|
||||
}.also {
|
||||
tasks.preBuild.dependsOn(it)
|
||||
tasks.getByName<Delete>("clean") {
|
||||
val filesNamesToDelete = listOf("CHANGELOG", "PRIVACY")
|
||||
val filesNamesToDelete = listOf("PRIVACY")
|
||||
filesNamesToDelete.forEach { fileName ->
|
||||
delete(layout.projectDirectory.file("src/main/res/raw/${fileName.lowercase()}.md"))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package protect.card_locker
|
||||
|
||||
import android.app.Instrumentation
|
||||
import androidx.compose.ui.test.ExperimentalTestApi
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.assertIsNotDisplayed
|
||||
import androidx.compose.ui.test.junit4.ComposeContentTestRule
|
||||
import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.performScrollTo
|
||||
import androidx.compose.ui.test.runComposeUiTest
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import protect.card_locker.compose.theme.CatimaTheme
|
||||
|
||||
@OptIn(ExperimentalTestApi::class)
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class AboutActivityTest {
|
||||
@get:Rule
|
||||
private val rule: ComposeContentTestRule = createComposeRule()
|
||||
|
||||
private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
|
||||
private val content: AboutContent = AboutContent(instrumentation.targetContext)
|
||||
|
||||
@Test
|
||||
fun testInitialState(): Unit = runComposeUiTest {
|
||||
setContent {
|
||||
AboutScreenContent(content = content)
|
||||
}
|
||||
|
||||
onNodeWithTag("topbar_catima").assertIsDisplayed()
|
||||
|
||||
onNodeWithTag("card_version_history").assertIsDisplayed()
|
||||
onNodeWithText(content.versionHistory).assertIsDisplayed()
|
||||
|
||||
onNodeWithTag("card_credits").assertIsDisplayed()
|
||||
onNodeWithText(content.copyrightShort).assertIsDisplayed()
|
||||
|
||||
onNodeWithTag("card_translate").assertIsDisplayed()
|
||||
onNodeWithTag("card_license").assertIsDisplayed()
|
||||
|
||||
// We might be off the screen so start scrolling
|
||||
onNodeWithTag("card_source_github").performScrollTo().assertIsDisplayed()
|
||||
onNodeWithTag("card_privacy_policy").performScrollTo().assertIsDisplayed()
|
||||
onNodeWithTag("card_donate").performScrollTo().assertIsDisplayed()
|
||||
// Dont scroll to this, since its not displayed
|
||||
onNodeWithTag("card_rate_google").assertIsNotDisplayed()
|
||||
onNodeWithTag("card_report_error").performScrollTo().assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDonateAndGoogleCardVisible(): Unit = runComposeUiTest {
|
||||
setContent {
|
||||
CatimaTheme {
|
||||
AboutScreenContent(
|
||||
content = content,
|
||||
showDonate = true,
|
||||
showRateOnGooglePlay = true,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
onNodeWithTag("card_donate").performScrollTo().assertIsDisplayed()
|
||||
onNodeWithTag("card_rate_google").performScrollTo().assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDonateAndGoogleCardHidden(): Unit = runComposeUiTest {
|
||||
setContent {
|
||||
CatimaTheme {
|
||||
AboutScreenContent(
|
||||
content = content,
|
||||
showDonate = false,
|
||||
showRateOnGooglePlay = false,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
onNodeWithTag("card_privacy_policy").performScrollTo().assertIsDisplayed()
|
||||
onNodeWithTag("card_donate").assertIsNotDisplayed()
|
||||
onNodeWithTag("card_rate_google").assertIsNotDisplayed()
|
||||
onNodeWithTag("card_report_error").performScrollTo().assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Catima Debug</string>
|
||||
</resources>
|
||||
<string name="app_name">Debug di Catima</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Depuração do Catima</string>
|
||||
</resources>
|
||||
@@ -12,8 +12,18 @@
|
||||
<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.NFC" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="23" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.nfc"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.camera"
|
||||
android:required="false" />
|
||||
@@ -94,9 +104,12 @@
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
<activity
|
||||
android:name=".LoyaltyCardViewActivity"
|
||||
android:name=".cardview.LoyaltyCardViewActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".cardimageview.LoyaltyCardImageViewActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".LoyaltyCardEditActivity"
|
||||
android:exported="true"
|
||||
@@ -219,5 +232,26 @@
|
||||
<action android:name="android.service.controls.ControlsProviderService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".wearos.BluetoothServerService"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="connectedDevice" />
|
||||
|
||||
<activity
|
||||
android:name=".wearos.BluetoothPairingActivity"
|
||||
android:exported="false"
|
||||
android:excludeFromRecents="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/AppTheme.Transparent" />
|
||||
|
||||
<receiver
|
||||
android:name=".wearos.BluetoothPairingReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="protect.card_locker.wearos.action.ALLOW_DEVICE" />
|
||||
<action android:name="protect.card_locker.wearos.action.BLOCK_DEVICE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1,149 +1,160 @@
|
||||
package protect.card_locker
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.Spanned
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.ScrollView
|
||||
import android.widget.TextView
|
||||
import androidx.activity.OnBackPressedDispatcher
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.TextLinkStyles
|
||||
import androidx.compose.ui.text.fromHtml
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import protect.card_locker.compose.CatimaAboutSection
|
||||
import protect.card_locker.compose.CatimaTopAppBar
|
||||
import protect.card_locker.compose.theme.CatimaTheme
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.view.isVisible
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
|
||||
import protect.card_locker.databinding.AboutActivityBinding
|
||||
|
||||
class AboutActivity : CatimaAppCompatActivity() {
|
||||
private companion object {
|
||||
private const val TAG = "Catima"
|
||||
}
|
||||
|
||||
private lateinit var binding: AboutActivityBinding
|
||||
class AboutActivity : CatimaComponentActivity() {
|
||||
private lateinit var content: AboutContent
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = AboutActivityBinding.inflate(layoutInflater)
|
||||
|
||||
fixedEdgeToEdge()
|
||||
|
||||
content = AboutContent(this)
|
||||
title = content.pageTitle
|
||||
setContentView(binding.root)
|
||||
setSupportActionBar(binding.toolbar)
|
||||
enableToolbarBackButton()
|
||||
|
||||
binding.apply {
|
||||
creditsSub.text = content.copyrightShort
|
||||
versionHistorySub.text = content.versionHistory
|
||||
|
||||
versionHistory.tag = "https://catima.app/changelog/"
|
||||
translate.tag = "https://hosted.weblate.org/engage/catima/"
|
||||
license.tag = "https://github.com/CatimaLoyalty/Android/blob/main/LICENSE"
|
||||
repo.tag = "https://github.com/CatimaLoyalty/Android/"
|
||||
privacy.tag = "https://catima.app/privacy-policy/"
|
||||
reportError.tag = "https://github.com/CatimaLoyalty/Android/issues"
|
||||
rate.tag = "https://play.google.com/store/apps/details?id=me.hackerchick.catima"
|
||||
donate.tag = "https://catima.app/donate"
|
||||
|
||||
// Hide Google Play rate button if not on Google Play
|
||||
rate.isVisible = BuildConfig.showRateOnGooglePlay
|
||||
// Hide donate button on Google Play (Google Play doesn't allow donation links)
|
||||
donate.isVisible = BuildConfig.showDonate
|
||||
}
|
||||
|
||||
bindClickListeners()
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
finish()
|
||||
true
|
||||
setContent {
|
||||
CatimaTheme {
|
||||
AboutScreenContent(
|
||||
content = content,
|
||||
showDonate = BuildConfig.showDonate,
|
||||
showRateOnGooglePlay = BuildConfig.showRateOnGooglePlay,
|
||||
onBackPressedDispatcher = onBackPressedDispatcher
|
||||
)
|
||||
}
|
||||
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
content.destroy()
|
||||
clearClickListeners()
|
||||
}
|
||||
|
||||
private fun bindClickListeners() {
|
||||
binding.apply {
|
||||
versionHistory.setOnClickListener { showHistory(it) }
|
||||
translate.setOnClickListener { openExternalBrowser(it) }
|
||||
license.setOnClickListener { showLicense(it) }
|
||||
repo.setOnClickListener { openExternalBrowser(it) }
|
||||
privacy.setOnClickListener { showPrivacy(it) }
|
||||
reportError.setOnClickListener { openExternalBrowser(it) }
|
||||
rate.setOnClickListener { openExternalBrowser(it) }
|
||||
donate.setOnClickListener { openExternalBrowser(it) }
|
||||
credits.setOnClickListener { showCredits() }
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearClickListeners() {
|
||||
binding.apply {
|
||||
versionHistory.setOnClickListener(null)
|
||||
translate.setOnClickListener(null)
|
||||
license.setOnClickListener(null)
|
||||
repo.setOnClickListener(null)
|
||||
privacy.setOnClickListener(null)
|
||||
reportError.setOnClickListener(null)
|
||||
rate.setOnClickListener(null)
|
||||
donate.setOnClickListener(null)
|
||||
credits.setOnClickListener(null)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showCredits() {
|
||||
showHTML(R.string.credits, content.contributorInfo, null)
|
||||
}
|
||||
|
||||
private fun showHistory(view: View) {
|
||||
showHTML(R.string.version_history, content.historyInfo, view)
|
||||
}
|
||||
|
||||
private fun showLicense(view: View) {
|
||||
showHTML(R.string.license, content.licenseInfo, view)
|
||||
}
|
||||
|
||||
private fun showPrivacy(view: View) {
|
||||
showHTML(R.string.privacy_policy, content.privacyInfo, view)
|
||||
}
|
||||
|
||||
private fun showHTML(@StringRes title: Int, text: Spanned, view: View?) {
|
||||
val dialogContentPadding = resources.getDimensionPixelSize(R.dimen.alert_dialog_content_padding)
|
||||
val textView = TextView(this).apply {
|
||||
setText(text)
|
||||
Utils.makeTextViewLinksClickable(this, text)
|
||||
}
|
||||
|
||||
val scrollView = ScrollView(this).apply {
|
||||
addView(textView)
|
||||
setPadding(dialogContentPadding, dialogContentPadding / 2, dialogContentPadding, 0)
|
||||
}
|
||||
|
||||
MaterialAlertDialogBuilder(this).apply {
|
||||
setTitle(title)
|
||||
setView(scrollView)
|
||||
setPositiveButton(R.string.ok, null)
|
||||
|
||||
// Add View online button if an URL is linked to this view
|
||||
view?.tag?.let {
|
||||
setNeutralButton(R.string.view_online) { _, _ -> openExternalBrowser(view) }
|
||||
}
|
||||
|
||||
show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun openExternalBrowser(view: View) {
|
||||
val tag = view.tag
|
||||
if (tag is String && tag.startsWith("https://")) {
|
||||
OpenWebLinkHandler().openBrowser(this, tag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AboutScreenContent(
|
||||
content: AboutContent,
|
||||
showDonate: Boolean = true,
|
||||
showRateOnGooglePlay: Boolean = false,
|
||||
onBackPressedDispatcher: OnBackPressedDispatcher? = null,
|
||||
) {
|
||||
Scaffold(
|
||||
topBar = { CatimaTopAppBar(content.pageTitle.toString(), onBackPressedDispatcher) }
|
||||
) { innerPadding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(innerPadding)
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
CatimaAboutSection(
|
||||
stringResource(R.string.version_history),
|
||||
content.versionHistory,
|
||||
modifier = Modifier.testTag("card_version_history"),
|
||||
onClickUrl = "https://catima.app/changelog/"
|
||||
)
|
||||
CatimaAboutSection(
|
||||
stringResource(R.string.credits),
|
||||
content.copyrightShort,
|
||||
modifier = Modifier.testTag("card_credits"),
|
||||
onClickDialogText = AnnotatedString.fromHtml(
|
||||
htmlString = content.contributorInfoHtml,
|
||||
linkStyles = TextLinkStyles(
|
||||
style = SpanStyle(
|
||||
textDecoration = TextDecoration.Underline,
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
CatimaAboutSection(
|
||||
stringResource(R.string.help_translate_this_app),
|
||||
stringResource(R.string.translate_platform),
|
||||
modifier = Modifier.testTag("card_translate"),
|
||||
onClickUrl = "https://hosted.weblate.org/engage/catima/"
|
||||
)
|
||||
CatimaAboutSection(
|
||||
stringResource(R.string.license),
|
||||
stringResource(R.string.app_license),
|
||||
modifier = Modifier.testTag("card_license"),
|
||||
onClickUrl = "https://github.com/CatimaLoyalty/Android/blob/main/LICENSE",
|
||||
onClickDialogText = AnnotatedString.fromHtml(
|
||||
htmlString = content.licenseHtml,
|
||||
linkStyles = TextLinkStyles(
|
||||
style = SpanStyle(
|
||||
textDecoration = TextDecoration.Underline,
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
CatimaAboutSection(
|
||||
stringResource(R.string.source_repository),
|
||||
stringResource(R.string.on_github),
|
||||
modifier = Modifier.testTag("card_source_github"),
|
||||
onClickUrl = "https://github.com/CatimaLoyalty/Android/"
|
||||
)
|
||||
CatimaAboutSection(
|
||||
stringResource(R.string.privacy_policy),
|
||||
stringResource(R.string.and_data_usage),
|
||||
modifier = Modifier.testTag("card_privacy_policy"),
|
||||
onClickUrl = "https://catima.app/privacy-policy/",
|
||||
onClickDialogText = AnnotatedString.fromHtml(
|
||||
htmlString = content.privacyHtml,
|
||||
linkStyles = TextLinkStyles(
|
||||
style = SpanStyle(
|
||||
textDecoration = TextDecoration.Underline,
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
if (showDonate) {
|
||||
CatimaAboutSection(
|
||||
stringResource(R.string.donate),
|
||||
"",
|
||||
modifier = Modifier.testTag("card_donate"),
|
||||
onClickUrl = "https://catima.app/donate"
|
||||
)
|
||||
}
|
||||
if (showRateOnGooglePlay) {
|
||||
CatimaAboutSection(
|
||||
stringResource(R.string.rate_this_app),
|
||||
stringResource(R.string.on_google_play),
|
||||
modifier = Modifier.testTag("card_rate_google"),
|
||||
onClickUrl = "https://play.google.com/store/apps/details?id=me.hackerchick.catima"
|
||||
)
|
||||
}
|
||||
CatimaAboutSection(
|
||||
stringResource(R.string.report_error),
|
||||
stringResource(R.string.on_github),
|
||||
modifier = Modifier.testTag("card_report_error"),
|
||||
onClickUrl = "https://github.com/CatimaLoyalty/Android/issues"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun AboutActivityPreview() {
|
||||
AboutScreenContent(AboutContent(LocalContext.current))
|
||||
}
|
||||
@@ -3,11 +3,8 @@ package protect.card_locker;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.text.HtmlCompat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -55,7 +52,7 @@ public class AboutContent {
|
||||
return context.getString(R.string.app_copyright_short);
|
||||
}
|
||||
|
||||
public String getContributors() {
|
||||
public String getContributorsHtml() {
|
||||
String contributors;
|
||||
try {
|
||||
contributors = "<br/>" + Utils.readTextFile(context, R.raw.contributors);
|
||||
@@ -65,19 +62,7 @@ public class AboutContent {
|
||||
return contributors.replace("\n", "<br />");
|
||||
}
|
||||
|
||||
public String getHistory() {
|
||||
String versionHistory;
|
||||
try {
|
||||
versionHistory = Utils.readTextFile(context, R.raw.changelog)
|
||||
.replace("# Changelog\n\n", "");
|
||||
} catch (IOException ignored) {
|
||||
return "";
|
||||
}
|
||||
return Utils.linkify(Utils.basicMDToHTML(versionHistory))
|
||||
.replace("\n", "<br />");
|
||||
}
|
||||
|
||||
public String getLicense() {
|
||||
public String getLicenseHtml() {
|
||||
try {
|
||||
return Utils.readTextFile(context, R.raw.license);
|
||||
} catch (IOException ignored) {
|
||||
@@ -85,7 +70,7 @@ public class AboutContent {
|
||||
}
|
||||
}
|
||||
|
||||
public String getPrivacy() {
|
||||
public String getPrivacyHtml() {
|
||||
String privacyPolicy;
|
||||
try {
|
||||
privacyPolicy = Utils.readTextFile(context, R.raw.privacy)
|
||||
@@ -97,7 +82,7 @@ public class AboutContent {
|
||||
.replace("\n", "<br />");
|
||||
}
|
||||
|
||||
public String getThirdPartyLibraries() {
|
||||
public String getThirdPartyLibrariesHtml() {
|
||||
final List<ThirdPartyInfo> usedLibraries = new ArrayList<>();
|
||||
usedLibraries.add(new ThirdPartyInfo("ACRA", "https://github.com/ACRA/acra", "Apache 2.0"));
|
||||
usedLibraries.add(new ThirdPartyInfo("Color Picker", "https://github.com/jaredrummler/ColorPicker", "Apache 2.0"));
|
||||
@@ -116,7 +101,7 @@ public class AboutContent {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public String getUsedThirdPartyAssets() {
|
||||
public String getUsedThirdPartyAssetsHtml() {
|
||||
final List<ThirdPartyInfo> usedAssets = new ArrayList<>();
|
||||
usedAssets.add(new ThirdPartyInfo("Android icons", "https://fonts.google.com/icons?selected=Material+Icons", "Apache 2.0"));
|
||||
|
||||
@@ -129,31 +114,19 @@ public class AboutContent {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public Spanned getContributorInfo() {
|
||||
public String getContributorInfoHtml() {
|
||||
StringBuilder contributorInfo = new StringBuilder();
|
||||
contributorInfo.append(getCopyright());
|
||||
contributorInfo.append("<br/><br/>");
|
||||
contributorInfo.append(context.getString(R.string.app_copyright_old));
|
||||
contributorInfo.append("<br/><br/>");
|
||||
contributorInfo.append(String.format(context.getString(R.string.app_contributors), getContributors()));
|
||||
contributorInfo.append(String.format(context.getString(R.string.app_contributors), getContributorsHtml()));
|
||||
contributorInfo.append("<br/><br/>");
|
||||
contributorInfo.append(String.format(context.getString(R.string.app_libraries), getThirdPartyLibraries()));
|
||||
contributorInfo.append(String.format(context.getString(R.string.app_libraries), getThirdPartyLibrariesHtml()));
|
||||
contributorInfo.append("<br/><br/>");
|
||||
contributorInfo.append(String.format(context.getString(R.string.app_resources), getUsedThirdPartyAssets()));
|
||||
contributorInfo.append(String.format(context.getString(R.string.app_resources), getUsedThirdPartyAssetsHtml()));
|
||||
|
||||
return HtmlCompat.fromHtml(contributorInfo.toString(), HtmlCompat.FROM_HTML_MODE_COMPACT);
|
||||
}
|
||||
|
||||
public Spanned getHistoryInfo() {
|
||||
return HtmlCompat.fromHtml(getHistory(), HtmlCompat.FROM_HTML_MODE_COMPACT);
|
||||
}
|
||||
|
||||
public Spanned getLicenseInfo() {
|
||||
return HtmlCompat.fromHtml(getLicense(), HtmlCompat.FROM_HTML_MODE_LEGACY);
|
||||
}
|
||||
|
||||
public Spanned getPrivacyInfo() {
|
||||
return HtmlCompat.fromHtml(getPrivacy(), HtmlCompat.FROM_HTML_MODE_COMPACT);
|
||||
return contributorInfo.toString();
|
||||
}
|
||||
|
||||
public String getVersionHistory() {
|
||||
|
||||
@@ -4,17 +4,27 @@ import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.MultiFormatWriter;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.common.StringUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import protect.card_locker.async.CompatCallable;
|
||||
|
||||
@@ -39,6 +49,7 @@ public class BarcodeImageWriterTask implements CompatCallable<Bitmap> {
|
||||
private final WeakReference<TextView> textViewReference;
|
||||
private String cardId;
|
||||
private final CatimaBarcode format;
|
||||
private final Charset encoding;
|
||||
private final int imageHeight;
|
||||
private final int imageWidth;
|
||||
private final int imagePadding;
|
||||
@@ -46,9 +57,9 @@ public class BarcodeImageWriterTask implements CompatCallable<Bitmap> {
|
||||
private final boolean showFallback;
|
||||
private final BarcodeImageWriterResultCallback callback;
|
||||
|
||||
BarcodeImageWriterTask(
|
||||
public BarcodeImageWriterTask(
|
||||
Context context, ImageView imageView, String cardIdString,
|
||||
CatimaBarcode barcodeFormat, TextView textView,
|
||||
CatimaBarcode barcodeFormat, @NonNull Charset barcodeEncoding, TextView textView,
|
||||
boolean showFallback, BarcodeImageWriterResultCallback callback, boolean roundCornerPadding, boolean isFullscreen
|
||||
) {
|
||||
mContext = context;
|
||||
@@ -62,6 +73,7 @@ public class BarcodeImageWriterTask implements CompatCallable<Bitmap> {
|
||||
|
||||
cardId = cardIdString;
|
||||
format = barcodeFormat;
|
||||
encoding = barcodeEncoding;
|
||||
|
||||
int imageViewHeight = imageView.getHeight();
|
||||
int imageViewWidth = imageView.getWidth();
|
||||
@@ -172,10 +184,32 @@ public class BarcodeImageWriterTask implements CompatCallable<Bitmap> {
|
||||
}
|
||||
|
||||
MultiFormatWriter writer = new MultiFormatWriter();
|
||||
|
||||
Map<EncodeHintType, Object> encodeHints = new ArrayMap<>();
|
||||
// We don't want to pass the ISO-8859-1 as an encoding hint as zxing may add this as ECI
|
||||
// inside the barcode.
|
||||
//
|
||||
// Due to many barcode scanners in the wild being badly coded they may trip over ECI
|
||||
// info existing and fail to scan.
|
||||
// See:
|
||||
// - https://github.com/CatimaLoyalty/Android/issues/2921
|
||||
// - https://github.com/CatimaLoyalty/Android/issues/2932
|
||||
//
|
||||
// Just not always passing the encoding hint is slightly hacky, but in 5+ years of Catima
|
||||
// cards without encode hints have never caused any issues (unless they were UTF-8), yet
|
||||
// just days after passing ISO-8859-1 as CHARACTER_SET in the encode hints already 2
|
||||
// scan failures were reported (one for QR, one for Aztec).
|
||||
if (!Objects.equals(encoding.name(), StandardCharsets.ISO_8859_1.name())) {
|
||||
Log.d(TAG, "Chosen encoding is not ISO_8859_1, so passing as encoding hint");
|
||||
encodeHints.put(EncodeHintType.CHARACTER_SET, encoding);
|
||||
} else {
|
||||
Log.d(TAG, "Not passing encoding as encoding hint");
|
||||
}
|
||||
|
||||
BitMatrix bitMatrix;
|
||||
try {
|
||||
try {
|
||||
bitMatrix = writer.encode(cardId, format.format(), imageWidth, imageHeight, null);
|
||||
bitMatrix = writer.encode(cardId, format.format(), imageWidth, imageHeight, encodeHints);
|
||||
} catch (Exception e) {
|
||||
// Cast a wider net here and catch any exception, as there are some
|
||||
// cases where an encoder may fail if the data is invalid for the
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import protect.card_locker.async.TaskHandler;
|
||||
@@ -74,6 +75,9 @@ public class BarcodeSelectorAdapter extends ArrayAdapter<CatimaBarcodeWithValue>
|
||||
return viewHolder.image.getTag() != null && (boolean) viewHolder.image.getTag();
|
||||
}
|
||||
|
||||
// FIXME: The examples in the selector activity are always rendering using ISO-8859-1, even if UTF-8 is the selected type
|
||||
// This needs some refactoring to properly retrieve the barcode encoding when rendering an active barcode
|
||||
// This is the case for example when editing an active card, pressing the "Edit barcode" button, then "More options" and then "Enter the barcode manually"
|
||||
private void createBarcodeOption(final ImageView image, final String formatType, final String cardId, final TextView text) {
|
||||
final CatimaBarcode format = CatimaBarcode.fromName(formatType);
|
||||
|
||||
@@ -92,13 +96,13 @@ public class BarcodeSelectorAdapter extends ArrayAdapter<CatimaBarcodeWithValue>
|
||||
|
||||
Log.d(TAG, "Generating barcode for type " + formatType);
|
||||
|
||||
BarcodeImageWriterTask barcodeWriter = new BarcodeImageWriterTask(getContext(), image, cardId, format, text, true, null, true, false);
|
||||
BarcodeImageWriterTask barcodeWriter = new BarcodeImageWriterTask(getContext(), image, cardId, format, StandardCharsets.ISO_8859_1, text, true, null, true, false);
|
||||
mTasks.executeTask(TaskHandler.TYPE.BARCODE, barcodeWriter);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.d(TAG, "Generating barcode for type " + formatType);
|
||||
BarcodeImageWriterTask barcodeWriter = new BarcodeImageWriterTask(getContext(), image, cardId, format, text, true, null, true, false);
|
||||
BarcodeImageWriterTask barcodeWriter = new BarcodeImageWriterTask(getContext(), image, cardId, format, StandardCharsets.ISO_8859_1, text, true, null, true, false);
|
||||
mTasks.executeTask(TaskHandler.TYPE.BARCODE, barcodeWriter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import java.util.List;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import protect.card_locker.cardview.LoyaltyCardViewActivity;
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
public class CardsOnPowerScreenService extends ControlsProviderService {
|
||||
|
||||
|
||||
@@ -38,15 +38,10 @@ public class CatimaAppCompatActivity extends AppCompatActivity {
|
||||
Window window = getWindow();
|
||||
if (window != null) {
|
||||
boolean darkMode = Utils.isDarkModeEnabled(this);
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
View decorView = window.getDecorView();
|
||||
WindowInsetsControllerCompat wic = new WindowInsetsControllerCompat(window, decorView);
|
||||
wic.setAppearanceLightStatusBars(!darkMode);
|
||||
window.setStatusBarColor(Color.TRANSPARENT);
|
||||
} else {
|
||||
// icons are always white back then
|
||||
window.setStatusBarColor(darkMode ? Color.TRANSPARENT : Color.argb(127, 0, 0, 0));
|
||||
}
|
||||
View decorView = window.getDecorView();
|
||||
WindowInsetsControllerCompat wic = new WindowInsetsControllerCompat(window, decorView);
|
||||
wic.setAppearanceLightStatusBars(!darkMode);
|
||||
window.setStatusBarColor(Color.TRANSPARENT);
|
||||
}
|
||||
// XXX android 9 and below has a nasty rendering bug if the theme was patched earlier
|
||||
Utils.postPatchColors(this);
|
||||
@@ -66,7 +61,4 @@ public class CatimaAppCompatActivity extends AppCompatActivity {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void onMockedRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package protect.card_locker
|
||||
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.SystemBarStyle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import protect.card_locker.preferences.Settings
|
||||
|
||||
open class CatimaComponentActivity() : ComponentActivity() {
|
||||
fun fixedEdgeToEdge() {
|
||||
// Fix edge-to-edge
|
||||
// When overriding onCreate this does not correctly get applied, which is why it is its own function
|
||||
|
||||
// We explicitly need to set the systemBarStyle ourselves, to prevent issues where Android
|
||||
// for example renders white icons on top of a white statusbar (or black on black)
|
||||
val settings = Settings(this)
|
||||
val systemBarStyle = when (settings.theme) {
|
||||
AppCompatDelegate.MODE_NIGHT_NO ->
|
||||
SystemBarStyle.light(
|
||||
scrim = Color.TRANSPARENT,
|
||||
darkScrim = Color.TRANSPARENT,
|
||||
)
|
||||
AppCompatDelegate.MODE_NIGHT_YES ->
|
||||
SystemBarStyle.dark(
|
||||
scrim = Color.TRANSPARENT,
|
||||
)
|
||||
else ->
|
||||
SystemBarStyle.auto(
|
||||
lightScrim = Color.TRANSPARENT,
|
||||
darkScrim = Color.TRANSPARENT
|
||||
)
|
||||
}
|
||||
|
||||
enableEdgeToEdge(
|
||||
statusBarStyle = systemBarStyle,
|
||||
navigationBarStyle = systemBarStyle
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,12 @@ import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Currency;
|
||||
@@ -23,7 +27,7 @@ import java.util.Set;
|
||||
public class DBHelper extends SQLiteOpenHelper {
|
||||
public static final String DATABASE_NAME = "Catima.db";
|
||||
public static final int ORIGINAL_DATABASE_VERSION = 1;
|
||||
public static final int DATABASE_VERSION = 17;
|
||||
public static final int DATABASE_VERSION = 20;
|
||||
|
||||
// NB: changing these values requires a migration
|
||||
public static final int DEFAULT_ZOOM_LEVEL = 100;
|
||||
@@ -49,6 +53,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
public static final String CARD_ID = "cardid";
|
||||
public static final String BARCODE_ID = "barcodeid";
|
||||
public static final String BARCODE_TYPE = "barcodetype";
|
||||
public static final String BARCODE_ENCODING = "barcodeencoding";
|
||||
public static final String STAR_STATUS = "starstatus";
|
||||
public static final String LAST_USED = "lastused";
|
||||
public static final String ZOOM_LEVEL = "zoomlevel";
|
||||
@@ -71,6 +76,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
|
||||
public enum LoyaltyCardOrder {
|
||||
Alpha,
|
||||
LastAdded,
|
||||
LastUsed,
|
||||
ValidFrom,
|
||||
Expiry
|
||||
@@ -112,6 +118,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
LoyaltyCardDbIds.CARD_ID + " TEXT not null," +
|
||||
LoyaltyCardDbIds.BARCODE_ID + " TEXT," +
|
||||
LoyaltyCardDbIds.BARCODE_TYPE + " TEXT," +
|
||||
LoyaltyCardDbIds.BARCODE_ENCODING + " TEXT not null," +
|
||||
LoyaltyCardDbIds.STAR_STATUS + " INTEGER DEFAULT '0'," +
|
||||
LoyaltyCardDbIds.LAST_USED + " INTEGER DEFAULT '0', " +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL + " INTEGER DEFAULT '" + DEFAULT_ZOOM_LEVEL + "', " +
|
||||
@@ -335,6 +342,160 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
db.execSQL("ALTER TABLE " + LoyaltyCardDbIds.TABLE
|
||||
+ " ADD COLUMN " + LoyaltyCardDbIds.ZOOM_LEVEL_WIDTH + " INTEGER DEFAULT '100' ");
|
||||
}
|
||||
|
||||
if (oldVersion < 18 && newVersion >= 18) {
|
||||
db.execSQL("ALTER TABLE " + LoyaltyCardDbIds.TABLE
|
||||
+ " ADD COLUMN " + LoyaltyCardDbIds.BARCODE_ENCODING + " TEXT");
|
||||
}
|
||||
|
||||
// On upgrade to 2.41.3, force all existing "Automatic" cards to ISO-8859-1.
|
||||
// UTF-8 support was only added in 2.42.0, before that, all barcodes were saved without
|
||||
// any encoding info. As many scanners deal badly with ECI info, automatically guessing
|
||||
// UTF-8 for old barcodes may break them.
|
||||
//
|
||||
// New cards will be saved using either "Automatic" encoding to guess or, for pkpass files,
|
||||
// whatever encoding is specified.
|
||||
if (oldVersion < 19 && newVersion >= 19) {
|
||||
db.execSQL("UPDATE " + LoyaltyCardDbIds.TABLE + " SET " + LoyaltyCardDbIds.BARCODE_ENCODING + " = 'ISO-8859-1' WHERE " + LoyaltyCardDbIds.BARCODE_ENCODING + " IS NULL");
|
||||
}
|
||||
|
||||
if (oldVersion < 20 && newVersion >= 20) {
|
||||
// SQLite doesn't support modify column
|
||||
// So we need to create a temp column to make barcode encoding non-nullable
|
||||
// https://www.sqlite.org/faq.html#q11
|
||||
db.beginTransaction();
|
||||
|
||||
// First migrate all cards to ISO-8859-1
|
||||
db.execSQL("UPDATE " + LoyaltyCardDbIds.TABLE + " SET " + LoyaltyCardDbIds.BARCODE_ENCODING + " = 'ISO-8859-1' WHERE " + LoyaltyCardDbIds.BARCODE_ENCODING + " IS NULL");
|
||||
|
||||
// create temp table
|
||||
db.execSQL("CREATE TEMPORARY TABLE tmp (" +
|
||||
LoyaltyCardDbIds.ID + " INTEGER primary key autoincrement," +
|
||||
LoyaltyCardDbIds.STORE + " TEXT not null," +
|
||||
LoyaltyCardDbIds.NOTE + " TEXT not null," +
|
||||
LoyaltyCardDbIds.VALID_FROM + " INTEGER," +
|
||||
LoyaltyCardDbIds.EXPIRY + " INTEGER," +
|
||||
LoyaltyCardDbIds.BALANCE + " TEXT not null DEFAULT '0'," +
|
||||
LoyaltyCardDbIds.BALANCE_TYPE + " TEXT," +
|
||||
LoyaltyCardDbIds.HEADER_COLOR + " INTEGER," +
|
||||
LoyaltyCardDbIds.CARD_ID + " TEXT not null," +
|
||||
LoyaltyCardDbIds.BARCODE_ID + " TEXT," +
|
||||
LoyaltyCardDbIds.BARCODE_TYPE + " TEXT," +
|
||||
LoyaltyCardDbIds.BARCODE_ENCODING + " TEXT not null," +
|
||||
LoyaltyCardDbIds.STAR_STATUS + " INTEGER DEFAULT '0'," +
|
||||
LoyaltyCardDbIds.LAST_USED + " INTEGER DEFAULT '0', " +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL + " INTEGER DEFAULT '" + DEFAULT_ZOOM_LEVEL + "', " +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL_WIDTH + " INTEGER DEFAULT '" + DEFAULT_ZOOM_LEVEL_WIDTH + "', " +
|
||||
LoyaltyCardDbIds.ARCHIVE_STATUS + " INTEGER DEFAULT '0' )");
|
||||
|
||||
// Insert all cards into temp table
|
||||
db.execSQL("INSERT INTO tmp (" +
|
||||
LoyaltyCardDbIds.ID + " ," +
|
||||
LoyaltyCardDbIds.STORE + " ," +
|
||||
LoyaltyCardDbIds.NOTE + " ," +
|
||||
LoyaltyCardDbIds.VALID_FROM + " , " +
|
||||
LoyaltyCardDbIds.EXPIRY + " ," +
|
||||
LoyaltyCardDbIds.BALANCE + " ," +
|
||||
LoyaltyCardDbIds.BALANCE_TYPE + " ," +
|
||||
LoyaltyCardDbIds.HEADER_COLOR + " ," +
|
||||
LoyaltyCardDbIds.CARD_ID + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_ID + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_TYPE + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_ENCODING + " ," +
|
||||
LoyaltyCardDbIds.STAR_STATUS + " ," +
|
||||
LoyaltyCardDbIds.LAST_USED + " ," +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL + " ," +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL_WIDTH + " ," +
|
||||
LoyaltyCardDbIds.ARCHIVE_STATUS + ")" +
|
||||
" SELECT " +
|
||||
LoyaltyCardDbIds.ID + " ," +
|
||||
LoyaltyCardDbIds.STORE + " ," +
|
||||
LoyaltyCardDbIds.NOTE + " ," +
|
||||
LoyaltyCardDbIds.VALID_FROM + " ," +
|
||||
LoyaltyCardDbIds.EXPIRY + " ," +
|
||||
LoyaltyCardDbIds.BALANCE + " ," +
|
||||
LoyaltyCardDbIds.BALANCE_TYPE + " ," +
|
||||
LoyaltyCardDbIds.HEADER_COLOR + " ," +
|
||||
LoyaltyCardDbIds.CARD_ID + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_ID + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_TYPE + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_ENCODING + " ," +
|
||||
LoyaltyCardDbIds.STAR_STATUS + " ," +
|
||||
LoyaltyCardDbIds.LAST_USED + " ," +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL + " ," +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL_WIDTH + " ," +
|
||||
LoyaltyCardDbIds.ARCHIVE_STATUS +
|
||||
" FROM " + LoyaltyCardDbIds.TABLE);
|
||||
|
||||
// Drop old table
|
||||
db.execSQL("DROP TABLE " + LoyaltyCardDbIds.TABLE);
|
||||
|
||||
// Create table again
|
||||
db.execSQL("CREATE TABLE " + LoyaltyCardDbIds.TABLE + "(" +
|
||||
LoyaltyCardDbIds.ID + " INTEGER primary key autoincrement," +
|
||||
LoyaltyCardDbIds.STORE + " TEXT not null," +
|
||||
LoyaltyCardDbIds.NOTE + " TEXT not null," +
|
||||
LoyaltyCardDbIds.VALID_FROM + " INTEGER," +
|
||||
LoyaltyCardDbIds.EXPIRY + " INTEGER," +
|
||||
LoyaltyCardDbIds.BALANCE + " TEXT not null DEFAULT '0'," +
|
||||
LoyaltyCardDbIds.BALANCE_TYPE + " TEXT," +
|
||||
LoyaltyCardDbIds.HEADER_COLOR + " INTEGER," +
|
||||
LoyaltyCardDbIds.CARD_ID + " TEXT not null," +
|
||||
LoyaltyCardDbIds.BARCODE_ID + " TEXT," +
|
||||
LoyaltyCardDbIds.BARCODE_TYPE + " TEXT," +
|
||||
LoyaltyCardDbIds.BARCODE_ENCODING + " TEXT not null," +
|
||||
LoyaltyCardDbIds.STAR_STATUS + " INTEGER DEFAULT '0'," +
|
||||
LoyaltyCardDbIds.LAST_USED + " INTEGER DEFAULT '0', " +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL + " INTEGER DEFAULT '" + DEFAULT_ZOOM_LEVEL + "', " +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL_WIDTH + " INTEGER DEFAULT '" + DEFAULT_ZOOM_LEVEL_WIDTH + "', " +
|
||||
LoyaltyCardDbIds.ARCHIVE_STATUS + " INTEGER DEFAULT '0' )");
|
||||
|
||||
// Insert all temp cards into newly created table
|
||||
db.execSQL("INSERT INTO " + LoyaltyCardDbIds.TABLE + "(" +
|
||||
LoyaltyCardDbIds.ID + " ," +
|
||||
LoyaltyCardDbIds.STORE + " ," +
|
||||
LoyaltyCardDbIds.NOTE + " ," +
|
||||
LoyaltyCardDbIds.VALID_FROM + " , " +
|
||||
LoyaltyCardDbIds.EXPIRY + " ," +
|
||||
LoyaltyCardDbIds.BALANCE + " ," +
|
||||
LoyaltyCardDbIds.BALANCE_TYPE + " ," +
|
||||
LoyaltyCardDbIds.HEADER_COLOR + " ," +
|
||||
LoyaltyCardDbIds.CARD_ID + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_ID + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_TYPE + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_ENCODING + " ," +
|
||||
LoyaltyCardDbIds.STAR_STATUS + " ," +
|
||||
LoyaltyCardDbIds.LAST_USED + " ," +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL + " ," +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL_WIDTH + " ," +
|
||||
LoyaltyCardDbIds.ARCHIVE_STATUS + ")" +
|
||||
" SELECT " +
|
||||
LoyaltyCardDbIds.ID + " ," +
|
||||
LoyaltyCardDbIds.STORE + " ," +
|
||||
LoyaltyCardDbIds.NOTE + " ," +
|
||||
LoyaltyCardDbIds.VALID_FROM + " ," +
|
||||
LoyaltyCardDbIds.EXPIRY + " ," +
|
||||
LoyaltyCardDbIds.BALANCE + " ," +
|
||||
LoyaltyCardDbIds.BALANCE_TYPE + " ," +
|
||||
LoyaltyCardDbIds.HEADER_COLOR + " ," +
|
||||
LoyaltyCardDbIds.CARD_ID + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_ID + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_TYPE + " ," +
|
||||
LoyaltyCardDbIds.BARCODE_ENCODING + " ," +
|
||||
LoyaltyCardDbIds.STAR_STATUS + " ," +
|
||||
LoyaltyCardDbIds.LAST_USED + " ," +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL + " ," +
|
||||
LoyaltyCardDbIds.ZOOM_LEVEL_WIDTH + " ," +
|
||||
LoyaltyCardDbIds.ARCHIVE_STATUS +
|
||||
" FROM tmp");
|
||||
|
||||
// Drop tmp table
|
||||
db.execSQL("DROP TABLE tmp");
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Set<String> imageFiles(Context context, final SQLiteDatabase database) {
|
||||
@@ -396,7 +557,8 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
public static long insertLoyaltyCard(
|
||||
final SQLiteDatabase database, final String store, final String note, final Date validFrom,
|
||||
final Date expiry, final BigDecimal balance, final Currency balanceType, final String cardId,
|
||||
final String barcodeId, final CatimaBarcode barcodeType, final Integer headerColor,
|
||||
final String barcodeId, final CatimaBarcode barcodeType, final @NonNull Charset barcodeEncoding,
|
||||
final Integer headerColor,
|
||||
final int starStatus, final Long lastUsed, final int archiveStatus) {
|
||||
database.beginTransaction();
|
||||
|
||||
@@ -411,6 +573,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
contentValues.put(LoyaltyCardDbIds.CARD_ID, cardId);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_ID, barcodeId);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_TYPE, barcodeType != null ? barcodeType.name() : null);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_ENCODING, barcodeEncoding.name());
|
||||
contentValues.put(LoyaltyCardDbIds.HEADER_COLOR, headerColor);
|
||||
contentValues.put(LoyaltyCardDbIds.STAR_STATUS, starStatus);
|
||||
contentValues.put(LoyaltyCardDbIds.LAST_USED, lastUsed != null ? lastUsed : Utils.getUnixTime());
|
||||
@@ -430,7 +593,8 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
final SQLiteDatabase database, final int id, final String store, final String note,
|
||||
final Date validFrom, final Date expiry, final BigDecimal balance,
|
||||
final Currency balanceType, final String cardId, final String barcodeId,
|
||||
final CatimaBarcode barcodeType, final Integer headerColor, final int starStatus,
|
||||
final CatimaBarcode barcodeType, final @NonNull Charset barcodeEncoding,
|
||||
final Integer headerColor, final int starStatus,
|
||||
final Long lastUsed, final int archiveStatus) {
|
||||
database.beginTransaction();
|
||||
|
||||
@@ -446,6 +610,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
contentValues.put(LoyaltyCardDbIds.CARD_ID, cardId);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_ID, barcodeId);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_TYPE, barcodeType != null ? barcodeType.name() : null);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_ENCODING, barcodeEncoding.name());
|
||||
contentValues.put(LoyaltyCardDbIds.HEADER_COLOR, headerColor);
|
||||
contentValues.put(LoyaltyCardDbIds.STAR_STATUS, starStatus);
|
||||
contentValues.put(LoyaltyCardDbIds.LAST_USED, lastUsed != null ? lastUsed : Utils.getUnixTime());
|
||||
@@ -465,7 +630,8 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
SQLiteDatabase database, final int id, final String store, final String note,
|
||||
final Date validFrom, final Date expiry, final BigDecimal balance,
|
||||
final Currency balanceType, final String cardId, final String barcodeId,
|
||||
final CatimaBarcode barcodeType, final Integer headerColor, final int starStatus,
|
||||
final CatimaBarcode barcodeType, final @NonNull Charset barcodeEncoding,
|
||||
final Integer headerColor, final int starStatus,
|
||||
final Long lastUsed, final int archiveStatus) {
|
||||
database.beginTransaction();
|
||||
|
||||
@@ -480,6 +646,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
contentValues.put(LoyaltyCardDbIds.CARD_ID, cardId);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_ID, barcodeId);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_TYPE, barcodeType != null ? barcodeType.name() : null);
|
||||
contentValues.put(LoyaltyCardDbIds.BARCODE_ENCODING, barcodeEncoding.name());
|
||||
contentValues.put(LoyaltyCardDbIds.HEADER_COLOR, headerColor);
|
||||
contentValues.put(LoyaltyCardDbIds.STAR_STATUS, starStatus);
|
||||
contentValues.put(LoyaltyCardDbIds.LAST_USED, lastUsed != null ? lastUsed : Utils.getUnixTime());
|
||||
@@ -923,6 +1090,10 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
return LoyaltyCardDbIds.STORE;
|
||||
}
|
||||
|
||||
if (order == LoyaltyCardOrder.LastAdded) {
|
||||
return LoyaltyCardDbIds.ID;
|
||||
}
|
||||
|
||||
if (order == LoyaltyCardOrder.LastUsed) {
|
||||
return LoyaltyCardDbIds.LAST_USED;
|
||||
}
|
||||
@@ -939,8 +1110,8 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
private static String getDbDirection(LoyaltyCardOrder order, LoyaltyCardOrderDirection direction) {
|
||||
if (order == LoyaltyCardOrder.LastUsed) {
|
||||
// We want the default sorting to put the most recently used first
|
||||
if (order == LoyaltyCardOrder.LastAdded || order == LoyaltyCardOrder.LastUsed) {
|
||||
// We want the default sorting to put the most recently added/used first
|
||||
return direction == LoyaltyCardOrderDirection.Descending ? "ASC" : "DESC";
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ import protect.card_locker.importexport.ImportExportResultType
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
class ImportExportActivity : CatimaAppCompatActivity() {
|
||||
private lateinit var binding: ImportExportActivityBinding
|
||||
@@ -45,6 +48,11 @@ class ImportExportActivity : CatimaAppCompatActivity() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "Catima"
|
||||
|
||||
internal fun getExportFilename(): String {
|
||||
val sdf = SimpleDateFormat("yyyyMMdd", Locale.US)
|
||||
return "catima_${sdf.format(Date())}.zip"
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -107,7 +115,7 @@ class ImportExportActivity : CatimaAppCompatActivity() {
|
||||
val intentCreateDocumentAction = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
type = "application/zip"
|
||||
putExtra(Intent.EXTRA_TITLE, "catima.zip")
|
||||
putExtra(Intent.EXTRA_TITLE, getExportFilename())
|
||||
}
|
||||
|
||||
val exportButton: Button = binding.exportButton
|
||||
|
||||
@@ -4,11 +4,14 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.io.InvalidObjectException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Currency;
|
||||
import java.util.Date;
|
||||
@@ -25,6 +28,7 @@ public class ImportURIHelper {
|
||||
private static final String CARD_ID = DBHelper.LoyaltyCardDbIds.CARD_ID;
|
||||
private static final String BARCODE_ID = DBHelper.LoyaltyCardDbIds.BARCODE_ID;
|
||||
private static final String BARCODE_TYPE = DBHelper.LoyaltyCardDbIds.BARCODE_TYPE;
|
||||
private static final String BARCODE_ENCODING = DBHelper.LoyaltyCardDbIds.BARCODE_ENCODING;
|
||||
private static final String HEADER_COLOR = DBHelper.LoyaltyCardDbIds.HEADER_COLOR;
|
||||
|
||||
private final Context context;
|
||||
@@ -66,6 +70,7 @@ public class ImportURIHelper {
|
||||
try {
|
||||
// These values are allowed to be null
|
||||
CatimaBarcode barcodeType = null;
|
||||
Charset barcodeEncoding = StandardCharsets.ISO_8859_1;
|
||||
Date validFrom = null;
|
||||
Date expiry = null;
|
||||
BigDecimal balance = new BigDecimal("0");
|
||||
@@ -103,6 +108,11 @@ public class ImportURIHelper {
|
||||
barcodeType = CatimaBarcode.fromName(unparsedBarcodeType);
|
||||
}
|
||||
|
||||
String unparsedBarcodeEncoding = kv.get(BARCODE_ENCODING);
|
||||
if (unparsedBarcodeEncoding != null && !unparsedBarcodeEncoding.equals("")) {
|
||||
barcodeEncoding = Charset.forName(unparsedBarcodeEncoding);
|
||||
}
|
||||
|
||||
String unparsedBalance = kv.get(BALANCE);
|
||||
if (unparsedBalance != null && !unparsedBalance.equals("")) {
|
||||
balance = new BigDecimal(unparsedBalance);
|
||||
@@ -136,6 +146,7 @@ public class ImportURIHelper {
|
||||
cardId,
|
||||
barcodeId,
|
||||
barcodeType,
|
||||
barcodeEncoding,
|
||||
headerColor,
|
||||
0,
|
||||
Utils.getUnixTime(),
|
||||
@@ -195,6 +206,7 @@ public class ImportURIHelper {
|
||||
if (loyaltyCard.barcodeType != null) {
|
||||
fragment = appendFragment(fragment, BARCODE_TYPE, loyaltyCard.barcodeType.name());
|
||||
}
|
||||
fragment = appendFragment(fragment, BARCODE_ENCODING, loyaltyCard.barcodeEncoding.name());
|
||||
if (loyaltyCard.headerColor != null) {
|
||||
fragment = appendFragment(fragment, HEADER_COLOR, loyaltyCard.headerColor.toString());
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import android.view.View
|
||||
import android.widget.RemoteViews
|
||||
import androidx.core.widget.RemoteViewsCompat
|
||||
import protect.card_locker.DBHelper.LoyaltyCardArchiveFilter
|
||||
import protect.card_locker.cardview.LoyaltyCardViewActivity
|
||||
import protect.card_locker.shared.ForegroundColorHelper
|
||||
|
||||
class ListWidget : AppWidgetProvider() {
|
||||
fun updateAll(context: Context) {
|
||||
@@ -69,7 +71,9 @@ class ListWidget : AppWidgetProvider() {
|
||||
if (hasCards) {
|
||||
// If we have cards, create the list
|
||||
views = RemoteViews(context.packageName, R.layout.list_widget)
|
||||
val templateIntent = Intent(context, LoyaltyCardViewActivity::class.java)
|
||||
val templateIntent = Intent(context, LoyaltyCardViewActivity::class.java).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
}
|
||||
val pendingIntent = PendingIntent.getActivity(
|
||||
context,
|
||||
0,
|
||||
@@ -97,11 +101,10 @@ class ListWidget : AppWidgetProvider() {
|
||||
// Note: Android 5 will not use bitmaps
|
||||
val remoteViews = RemoteViews(context.packageName, R.layout.list_widget_item).apply {
|
||||
val headerColor = Utils.getHeaderColor(context, loyaltyCard)
|
||||
val foreground = if (Utils.needsDarkForeground(headerColor)) Color.BLACK else Color.WHITE
|
||||
val foreground = if (ForegroundColorHelper.needsDarkForeground(headerColor)) Color.BLACK else Color.WHITE
|
||||
setInt(R.id.item_container_foreground, "setBackgroundColor", headerColor)
|
||||
val icon = loyaltyCard.getImageThumbnail(context)
|
||||
// setImageViewIcon is not supported on Android 5, so force Android 5 down the text path
|
||||
// FIXME: The icon flow causes a crash up to Android 12L, so SDK_INT is forced up from 23 to 33
|
||||
// FIXME: The icon flow causes a crash up to Android 12L, so force anything below 33 down this path
|
||||
if (icon != null && Build.VERSION.SDK_INT >= 32) {
|
||||
setInt(R.id.item_container_foreground, "setBackgroundColor", foreground)
|
||||
setImageViewIcon(R.id.item_image, Icon.createWithBitmap(icon))
|
||||
@@ -128,4 +131,4 @@ class ListWidget : AppWidgetProvider() {
|
||||
|
||||
return remoteViews
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Currency;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -30,6 +32,7 @@ public class LoyaltyCard {
|
||||
public String barcodeId;
|
||||
@Nullable
|
||||
public CatimaBarcode barcodeType;
|
||||
public Charset barcodeEncoding;
|
||||
@Nullable
|
||||
public Integer headerColor;
|
||||
public int starStatus;
|
||||
@@ -62,6 +65,7 @@ public class LoyaltyCard {
|
||||
public static final String BUNDLE_LOYALTY_CARD_CARD_ID = "loyaltyCardCardId";
|
||||
public static final String BUNDLE_LOYALTY_CARD_BARCODE_ID = "loyaltyCardBarcodeId";
|
||||
public static final String BUNDLE_LOYALTY_CARD_BARCODE_TYPE = "loyaltyCardBarcodeType";
|
||||
public static final String BUNDLE_LOYALTY_CARD_BARCODE_ENCODING = "loyaltyCardBarcodeEncoding";
|
||||
public static final String BUNDLE_LOYALTY_CARD_HEADER_COLOR = "loyaltyCardHeaderColor";
|
||||
public static final String BUNDLE_LOYALTY_CARD_STAR_STATUS = "loyaltyCardStarStatus";
|
||||
public static final String BUNDLE_LOYALTY_CARD_LAST_USED = "loyaltyCardLastUsed";
|
||||
@@ -90,6 +94,7 @@ public class LoyaltyCard {
|
||||
setCardId("");
|
||||
setBarcodeId(null);
|
||||
setBarcodeType(null);
|
||||
setBarcodeEncoding(StandardCharsets.ISO_8859_1);
|
||||
setHeaderColor(null);
|
||||
setStarStatus(0);
|
||||
setLastUsed(Utils.getUnixTime());
|
||||
@@ -124,7 +129,7 @@ public class LoyaltyCard {
|
||||
public LoyaltyCard(final int id, final String store, final String note, @Nullable final Date validFrom,
|
||||
@Nullable final Date expiry, final BigDecimal balance, @Nullable final Currency balanceType,
|
||||
final String cardId, @Nullable final String barcodeId, @Nullable final CatimaBarcode barcodeType,
|
||||
@Nullable final Integer headerColor, final int starStatus,
|
||||
@NonNull final Charset barcodeEncoding, @Nullable final Integer headerColor, final int starStatus,
|
||||
final long lastUsed, final int zoomLevel, final int zoomLevelWidth, final int archiveStatus,
|
||||
@Nullable Bitmap imageThumbnail, @Nullable String imageThumbnailPath,
|
||||
@Nullable Bitmap imageFront, @Nullable String imageFrontPath,
|
||||
@@ -139,6 +144,7 @@ public class LoyaltyCard {
|
||||
setCardId(cardId);
|
||||
setBarcodeId(barcodeId);
|
||||
setBarcodeType(barcodeType);
|
||||
setBarcodeEncoding(barcodeEncoding);
|
||||
setHeaderColor(headerColor);
|
||||
setStarStatus(starStatus);
|
||||
setLastUsed(lastUsed);
|
||||
@@ -244,6 +250,10 @@ public class LoyaltyCard {
|
||||
this.barcodeType = barcodeType;
|
||||
}
|
||||
|
||||
public void setBarcodeEncoding(@NonNull Charset barcodeEncoding) {
|
||||
this.barcodeEncoding = barcodeEncoding;
|
||||
}
|
||||
|
||||
public void setHeaderColor(@Nullable Integer headerColor) {
|
||||
this.headerColor = headerColor;
|
||||
}
|
||||
@@ -379,6 +389,11 @@ public class LoyaltyCard {
|
||||
} else if (requireFull) {
|
||||
throw new IllegalArgumentException("Missing key " + BUNDLE_LOYALTY_CARD_BARCODE_TYPE);
|
||||
}
|
||||
if (bundle.containsKey(BUNDLE_LOYALTY_CARD_BARCODE_ENCODING)) {
|
||||
setBarcodeEncoding(Charset.forName(bundle.getString(BUNDLE_LOYALTY_CARD_BARCODE_ENCODING)));
|
||||
} else if (requireFull) {
|
||||
throw new IllegalArgumentException("Missing key " + BUNDLE_LOYALTY_CARD_BARCODE_ENCODING);
|
||||
}
|
||||
if (bundle.containsKey(BUNDLE_LOYALTY_CARD_HEADER_COLOR)) {
|
||||
int tmpHeaderColor = bundle.getInt(BUNDLE_LOYALTY_CARD_HEADER_COLOR);
|
||||
setHeaderColor(tmpHeaderColor != -1 ? tmpHeaderColor : null);
|
||||
@@ -462,6 +477,9 @@ public class LoyaltyCard {
|
||||
if (!exportIsLimited || exportLimit.contains(BUNDLE_LOYALTY_CARD_BARCODE_TYPE)) {
|
||||
bundle.putString(BUNDLE_LOYALTY_CARD_BARCODE_TYPE, barcodeType != null ? barcodeType.name() : null);
|
||||
}
|
||||
if (!exportIsLimited || exportLimit.contains(BUNDLE_LOYALTY_CARD_BARCODE_ENCODING)) {
|
||||
bundle.putString(BUNDLE_LOYALTY_CARD_BARCODE_ENCODING, barcodeEncoding.name());
|
||||
}
|
||||
if (!exportIsLimited || exportLimit.contains(BUNDLE_LOYALTY_CARD_HEADER_COLOR)) {
|
||||
bundle.putInt(BUNDLE_LOYALTY_CARD_HEADER_COLOR, headerColor != null ? headerColor : -1);
|
||||
}
|
||||
@@ -539,6 +557,8 @@ public class LoyaltyCard {
|
||||
// barcodeType
|
||||
int barcodeTypeColumn = cursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.BARCODE_TYPE);
|
||||
CatimaBarcode barcodeType = !cursor.isNull(barcodeTypeColumn) ? CatimaBarcode.fromName(cursor.getString(barcodeTypeColumn)) : null;
|
||||
// barcodeEncoding
|
||||
Charset barcodeEncoding = Charset.forName(cursor.getString(cursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.BARCODE_ENCODING)));
|
||||
// headerColor
|
||||
int headerColorColumn = cursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.HEADER_COLOR);
|
||||
Integer headerColor = !cursor.isNull(headerColorColumn) ? cursor.getInt(headerColorColumn) : null;
|
||||
@@ -564,6 +584,7 @@ public class LoyaltyCard {
|
||||
cardId,
|
||||
barcodeId,
|
||||
barcodeType,
|
||||
barcodeEncoding,
|
||||
headerColor,
|
||||
starStatus,
|
||||
lastUsed,
|
||||
@@ -593,6 +614,7 @@ public class LoyaltyCard {
|
||||
Utils.equals(a.barcodeId, b.barcodeId) && // nullable String
|
||||
Utils.equals(a.barcodeType == null ? null : a.barcodeType.format(),
|
||||
b.barcodeType == null ? null : b.barcodeType.format()) && // nullable CatimaBarcode with no overridden .equals(), so we need to check .format()
|
||||
a.barcodeEncoding.name().equals(b.barcodeEncoding.name()) && // non-nullable String
|
||||
Utils.equals(a.headerColor, b.headerColor) && // nullable Integer
|
||||
a.starStatus == b.starStatus && // non-nullable int
|
||||
a.archiveStatus == b.archiveStatus && // non-nullable int
|
||||
@@ -619,7 +641,7 @@ public class LoyaltyCard {
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"LoyaltyCard{%n id=%s,%n store=%s,%n note=%s,%n validFrom=%s,%n expiry=%s,%n"
|
||||
+ " balance=%s,%n balanceType=%s,%n cardId=%s,%n barcodeId=%s,%n barcodeType=%s,%n"
|
||||
+ " balance=%s,%n balanceType=%s,%n cardId=%s,%n barcodeId=%s,%n barcodeType=%s,%n barcodeEncoding=%s,%n"
|
||||
+ " headerColor=%s,%n starStatus=%s,%n lastUsed=%s,%n zoomLevel=%s,%n zoomLevelWidth=%s,%n archiveStatus=%s%n"
|
||||
+ " imageThumbnail=%s,%n imageThumbnailPath=%s,%n imageFront=%s,%n imageFrontPath=%s,%n imageBack=%s,%n imageBackPath=%s,%n}",
|
||||
this.id,
|
||||
@@ -632,6 +654,7 @@ public class LoyaltyCard {
|
||||
this.cardId,
|
||||
this.barcodeId,
|
||||
this.barcodeType != null ? this.barcodeType.format() : null,
|
||||
this.barcodeEncoding.name(),
|
||||
this.headerColor,
|
||||
this.starStatus,
|
||||
this.lastUsed,
|
||||
|
||||
@@ -105,6 +105,12 @@ public class LoyaltyCardCursorAdapter extends BaseCursorAdapter<LoyaltyCardCurso
|
||||
inputHolder.setNoteField(null);
|
||||
}
|
||||
|
||||
if (mLoyaltyCardListDisplayOptions.showingCardId() && !loyaltyCard.cardId.isEmpty()) {
|
||||
inputHolder.setExtraField(inputHolder.mCardIdField, loyaltyCard.cardId, null, showDivider);
|
||||
} else {
|
||||
inputHolder.setExtraField(inputHolder.mCardIdField, null, null, false);
|
||||
}
|
||||
|
||||
if (mLoyaltyCardListDisplayOptions.showingBalance() && !loyaltyCard.balance.equals(new BigDecimal("0"))) {
|
||||
inputHolder.setExtraField(inputHolder.mBalanceField, Utils.formatBalance(mContext, loyaltyCard.balance, loyaltyCard.balanceType), null, showDivider);
|
||||
} else {
|
||||
@@ -211,7 +217,7 @@ public class LoyaltyCardCursorAdapter extends BaseCursorAdapter<LoyaltyCardCurso
|
||||
|
||||
public class LoyaltyCardListItemViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public TextView mCardText, mStoreField, mNoteField, mBalanceField, mValidFromField, mExpiryField;
|
||||
public TextView mCardText, mStoreField, mNoteField, mCardIdField, mBalanceField, mValidFromField, mExpiryField;
|
||||
public ImageView mCardIcon, mTickIcon;
|
||||
public MaterialCardView mRow;
|
||||
public ConstraintLayout mStar, mArchived;
|
||||
@@ -224,6 +230,7 @@ public class LoyaltyCardCursorAdapter extends BaseCursorAdapter<LoyaltyCardCurso
|
||||
mDivider = loyaltyCardLayoutBinding.infoDivider;
|
||||
mStoreField = loyaltyCardLayoutBinding.store;
|
||||
mNoteField = loyaltyCardLayoutBinding.note;
|
||||
mCardIdField = loyaltyCardLayoutBinding.cardId;
|
||||
mBalanceField = loyaltyCardLayoutBinding.balance;
|
||||
mValidFromField = loyaltyCardLayoutBinding.validFrom;
|
||||
mExpiryField = loyaltyCardLayoutBinding.expiry;
|
||||
|
||||
@@ -70,6 +70,8 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InvalidObjectException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
@@ -89,6 +91,7 @@ import java.util.concurrent.Callable;
|
||||
import protect.card_locker.async.TaskHandler;
|
||||
import protect.card_locker.databinding.LayoutChipChoiceBinding;
|
||||
import protect.card_locker.databinding.LoyaltyCardEditActivityBinding;
|
||||
import protect.card_locker.shared.ForegroundColorHelper;
|
||||
import protect.card_locker.viewmodels.LoyaltyCardEditActivityViewModel;
|
||||
|
||||
public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements BarcodeImageWriterResultCallback, ColorPickerDialogListener {
|
||||
@@ -128,6 +131,7 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
TextView cardIdFieldView;
|
||||
AutoCompleteTextView barcodeIdField;
|
||||
AutoCompleteTextView barcodeTypeField;
|
||||
AutoCompleteTextView barcodeEncodingField;
|
||||
ImageView barcodeImage;
|
||||
View barcodeImageLayout;
|
||||
View barcodeCaptureLayout;
|
||||
@@ -229,6 +233,14 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
viewModel.setHasChanged(true);
|
||||
}
|
||||
|
||||
protected void setLoyaltyCardBarcodeEncoding(@NonNull Charset barcodeEncoding) {
|
||||
viewModel.getLoyaltyCard().setBarcodeEncoding(barcodeEncoding);
|
||||
|
||||
generateBarcode();
|
||||
|
||||
viewModel.setHasChanged(true);
|
||||
}
|
||||
|
||||
protected void setLoyaltyCardHeaderColor(@Nullable Integer headerColor) {
|
||||
viewModel.getLoyaltyCard().setHeaderColor(headerColor);
|
||||
|
||||
@@ -334,6 +346,7 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
cardIdFieldView = binding.cardIdView;
|
||||
barcodeIdField = binding.barcodeIdField;
|
||||
barcodeTypeField = binding.barcodeTypeField;
|
||||
barcodeEncodingField = binding.barcodeEncodingField;
|
||||
barcodeImage = binding.barcode;
|
||||
barcodeImage.setClipToOutline(true);
|
||||
barcodeImageLayout = binding.barcodeLayout;
|
||||
@@ -577,6 +590,25 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
}
|
||||
});
|
||||
|
||||
barcodeEncodingField.addTextChangedListener(new SimpleTextWatcher() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (!s.toString().isEmpty()) {
|
||||
Log.d(TAG, "Setting barcode encoding to " + s.toString());
|
||||
setLoyaltyCardBarcodeEncoding(Charset.forName(s.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
ArrayList<String> barcodeEncodingList = new ArrayList<>();
|
||||
barcodeEncodingList.add(StandardCharsets.ISO_8859_1.name());
|
||||
barcodeEncodingList.add(StandardCharsets.UTF_8.name());
|
||||
ArrayAdapter<String> barcodeEncodingAdapter = new ArrayAdapter<>(LoyaltyCardEditActivity.this, android.R.layout.select_dialog_item, barcodeEncodingList);
|
||||
barcodeEncodingField.setAdapter(barcodeEncodingAdapter);
|
||||
}
|
||||
});
|
||||
|
||||
binding.tabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
@@ -688,6 +720,14 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mDatabase != null && mDatabase.isOpen()) {
|
||||
mDatabase.close();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void selectTab(int index) {
|
||||
binding.tabs.selectTab(binding.tabs.getTabAt(index));
|
||||
viewModel.setTabIndex(index);
|
||||
@@ -773,6 +813,8 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
barcodeIdField.setText(barcodeId != null && !barcodeId.isEmpty() ? barcodeId : getString(R.string.sameAsCardId));
|
||||
CatimaBarcode barcodeType = viewModel.getLoyaltyCard().barcodeType;
|
||||
barcodeTypeField.setText(barcodeType != null ? barcodeType.prettyName() : getString(R.string.noBarcode));
|
||||
Charset barcodeEncoding = viewModel.getLoyaltyCard().barcodeEncoding;
|
||||
barcodeEncodingField.setText(barcodeEncoding.name());
|
||||
|
||||
// We set the balance here (with onResuming/onRestoring == true) to prevent formatBalanceCurrencyField() from setting it (via onTextChanged),
|
||||
// which can cause issues when switching locale because it parses the balance and e.g. the decimal separator may have changed.
|
||||
@@ -855,8 +897,8 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
Integer headerColor = viewModel.getLoyaltyCard().headerColor;
|
||||
if (headerColor != null) {
|
||||
thumbnail.setOnClickListener(new ChooseCardImage());
|
||||
thumbnailEditIcon.setBackgroundColor(Utils.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
thumbnailEditIcon.setColorFilter(Utils.needsDarkForeground(headerColor) ? Color.WHITE : Color.BLACK);
|
||||
thumbnailEditIcon.setBackgroundColor(ForegroundColorHelper.Companion.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
thumbnailEditIcon.setColorFilter(ForegroundColorHelper.Companion.needsDarkForeground(headerColor) ? Color.WHITE : Color.BLACK);
|
||||
}
|
||||
|
||||
onResuming = false;
|
||||
@@ -878,18 +920,18 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
|
||||
setLoyaltyCardHeaderColor(headerColor);
|
||||
|
||||
thumbnail.setBackgroundColor(Utils.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
thumbnail.setBackgroundColor(ForegroundColorHelper.Companion.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
|
||||
thumbnailEditIcon.setBackgroundColor(Utils.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
thumbnailEditIcon.setColorFilter(Utils.needsDarkForeground(headerColor) ? Color.WHITE : Color.BLACK);
|
||||
thumbnailEditIcon.setBackgroundColor(ForegroundColorHelper.Companion.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
thumbnailEditIcon.setColorFilter(ForegroundColorHelper.Companion.needsDarkForeground(headerColor) ? Color.WHITE : Color.BLACK);
|
||||
} else {
|
||||
generateIcon(storeFieldEdit.getText().toString().trim());
|
||||
|
||||
Integer headerColor = viewModel.getLoyaltyCard().headerColor;
|
||||
|
||||
if (headerColor != null) {
|
||||
thumbnailEditIcon.setBackgroundColor(Utils.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
thumbnailEditIcon.setColorFilter(Utils.needsDarkForeground(headerColor) ? Color.WHITE : Color.BLACK);
|
||||
thumbnailEditIcon.setBackgroundColor(ForegroundColorHelper.Companion.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
thumbnailEditIcon.setColorFilter(ForegroundColorHelper.Companion.needsDarkForeground(headerColor) ? Color.WHITE : Color.BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1479,9 +1521,9 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
// This makes the DBHelper set it to the current date
|
||||
// So that new and edited card are always on top when sorting by recently used
|
||||
if (viewModel.getUpdateLoyaltyCard()) {
|
||||
DBHelper.updateLoyaltyCard(mDatabase, viewModel.getLoyaltyCardId(), viewModel.getLoyaltyCard().store, viewModel.getLoyaltyCard().note, viewModel.getLoyaltyCard().validFrom, viewModel.getLoyaltyCard().expiry, viewModel.getLoyaltyCard().balance, viewModel.getLoyaltyCard().balanceType, viewModel.getLoyaltyCard().cardId, viewModel.getLoyaltyCard().barcodeId, viewModel.getLoyaltyCard().barcodeType, viewModel.getLoyaltyCard().headerColor, viewModel.getLoyaltyCard().starStatus, null, viewModel.getLoyaltyCard().archiveStatus);
|
||||
DBHelper.updateLoyaltyCard(mDatabase, viewModel.getLoyaltyCardId(), viewModel.getLoyaltyCard().store, viewModel.getLoyaltyCard().note, viewModel.getLoyaltyCard().validFrom, viewModel.getLoyaltyCard().expiry, viewModel.getLoyaltyCard().balance, viewModel.getLoyaltyCard().balanceType, viewModel.getLoyaltyCard().cardId, viewModel.getLoyaltyCard().barcodeId, viewModel.getLoyaltyCard().barcodeType, viewModel.getLoyaltyCard().barcodeEncoding, viewModel.getLoyaltyCard().headerColor, viewModel.getLoyaltyCard().starStatus, null, viewModel.getLoyaltyCard().archiveStatus);
|
||||
} else {
|
||||
viewModel.setLoyaltyCardId((int) DBHelper.insertLoyaltyCard(mDatabase, viewModel.getLoyaltyCard().store, viewModel.getLoyaltyCard().note, viewModel.getLoyaltyCard().validFrom, viewModel.getLoyaltyCard().expiry, viewModel.getLoyaltyCard().balance, viewModel.getLoyaltyCard().balanceType, viewModel.getLoyaltyCard().cardId, viewModel.getLoyaltyCard().barcodeId, viewModel.getLoyaltyCard().barcodeType, viewModel.getLoyaltyCard().headerColor, 0, null, 0));
|
||||
viewModel.setLoyaltyCardId((int) DBHelper.insertLoyaltyCard(mDatabase, viewModel.getLoyaltyCard().store, viewModel.getLoyaltyCard().note, viewModel.getLoyaltyCard().validFrom, viewModel.getLoyaltyCard().expiry, viewModel.getLoyaltyCard().balance, viewModel.getLoyaltyCard().balanceType, viewModel.getLoyaltyCard().cardId, viewModel.getLoyaltyCard().barcodeId, viewModel.getLoyaltyCard().barcodeType, viewModel.getLoyaltyCard().barcodeEncoding, viewModel.getLoyaltyCard().headerColor, 0, null, 0));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -1494,7 +1536,7 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
|
||||
DBHelper.setLoyaltyCardGroups(mDatabase, viewModel.getLoyaltyCardId(), selectedGroups);
|
||||
|
||||
ShortcutHelper.updateShortcuts(this, DBHelper.getLoyaltyCard(this, mDatabase, viewModel.getLoyaltyCardId()));
|
||||
ShortcutHelper.updateShortcuts(this);
|
||||
|
||||
if (viewModel.getDuplicateFromLoyaltyCardId()) {
|
||||
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
|
||||
@@ -1596,6 +1638,7 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
|
||||
String cardIdString = viewModel.getLoyaltyCard().barcodeId != null ? viewModel.getLoyaltyCard().barcodeId : viewModel.getLoyaltyCard().cardId;
|
||||
CatimaBarcode barcodeFormat = viewModel.getLoyaltyCard().barcodeType;
|
||||
Charset barcodeEncoding = viewModel.getLoyaltyCard().barcodeEncoding;
|
||||
|
||||
if (cardIdString == null || cardIdString.isEmpty() || barcodeFormat == null) {
|
||||
barcodeImageLayout.setVisibility(View.GONE);
|
||||
@@ -1615,13 +1658,13 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity implements
|
||||
barcodeImage.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
|
||||
Log.d(TAG, "ImageView size now known");
|
||||
BarcodeImageWriterTask barcodeWriter = new BarcodeImageWriterTask(getApplicationContext(), barcodeImage, cardIdString, barcodeFormat, null, false, LoyaltyCardEditActivity.this, true, false);
|
||||
BarcodeImageWriterTask barcodeWriter = new BarcodeImageWriterTask(getApplicationContext(), barcodeImage, cardIdString, barcodeFormat, barcodeEncoding, null, false, LoyaltyCardEditActivity.this, true, false);
|
||||
viewModel.getTaskHandler().executeTask(TaskHandler.TYPE.BARCODE, barcodeWriter);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.d(TAG, "ImageView size known known, creating barcode");
|
||||
BarcodeImageWriterTask barcodeWriter = new BarcodeImageWriterTask(getApplicationContext(), barcodeImage, cardIdString, barcodeFormat, null, false, this, true, false);
|
||||
BarcodeImageWriterTask barcodeWriter = new BarcodeImageWriterTask(getApplicationContext(), barcodeImage, cardIdString, barcodeFormat, barcodeEncoding, null, false, this, true, false);
|
||||
viewModel.getTaskHandler().executeTask(TaskHandler.TYPE.BARCODE, barcodeWriter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class LoyaltyCardListDisplayOptionsManager {
|
||||
|
||||
private boolean mShowNameBelowThumbnail;
|
||||
private boolean mShowNote;
|
||||
private boolean mShowCardId;
|
||||
private boolean mShowBalance;
|
||||
private boolean mShowValidity;
|
||||
private boolean mShowArchivedCards;
|
||||
@@ -50,6 +51,7 @@ public class LoyaltyCardListDisplayOptionsManager {
|
||||
Context.MODE_PRIVATE);
|
||||
mShowNameBelowThumbnail = mCardDetailsPref.getBoolean(mContext.getString(R.string.sharedpreference_card_details_show_name_below_thumbnail), false);
|
||||
mShowNote = mCardDetailsPref.getBoolean(mContext.getString(R.string.sharedpreference_card_details_show_note), true);
|
||||
mShowCardId = mCardDetailsPref.getBoolean(mContext.getString(R.string.sharedpreference_card_details_show_card_id), false);
|
||||
mShowBalance = mCardDetailsPref.getBoolean(mContext.getString(R.string.sharedpreference_card_details_show_balance), true);
|
||||
mShowValidity = mCardDetailsPref.getBoolean(mContext.getString(R.string.sharedpreference_card_details_show_validity), true);
|
||||
mShowArchivedCards = mCardDetailsPref.getBoolean(mContext.getString(R.string.sharedpreference_card_details_show_archived_cards), true);
|
||||
@@ -83,6 +85,17 @@ public class LoyaltyCardListDisplayOptionsManager {
|
||||
return mShowNote;
|
||||
}
|
||||
|
||||
public void showCardId(boolean show) {
|
||||
mShowCardId = show;
|
||||
mRefreshCardsCallback.run();
|
||||
|
||||
saveDetailState(R.string.sharedpreference_card_details_show_card_id, show);
|
||||
}
|
||||
|
||||
public boolean showingCardId() {
|
||||
return mShowCardId;
|
||||
}
|
||||
|
||||
public void showBalance(boolean show) {
|
||||
mShowBalance = show;
|
||||
mRefreshCardsCallback.run();
|
||||
@@ -137,6 +150,11 @@ public class LoyaltyCardListDisplayOptionsManager {
|
||||
showingNote(),
|
||||
this::showNote
|
||||
));
|
||||
displayOptions.add(new LoyaltyCardDisplayOption(
|
||||
mContext.getString(R.string.show_card_id),
|
||||
showingCardId(),
|
||||
this::showCardId
|
||||
));
|
||||
displayOptions.add(new LoyaltyCardDisplayOption(
|
||||
mContext.getString(R.string.show_balance),
|
||||
showingBalance(),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package protect.card_locker;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.config.CoreConfigurationBuilder;
|
||||
import org.acra.config.DialogConfigurationBuilder;
|
||||
@@ -11,6 +11,7 @@ import org.acra.config.MailSenderConfigurationBuilder;
|
||||
import org.acra.data.StringFormat;
|
||||
|
||||
import protect.card_locker.preferences.Settings;
|
||||
import protect.card_locker.wearos.WearSyncServiceManager;
|
||||
|
||||
public class LoyaltyCardLockerApplication extends Application {
|
||||
|
||||
@@ -41,5 +42,10 @@ public class LoyaltyCardLockerApplication extends Application {
|
||||
// Set theme
|
||||
Settings settings = new Settings(this);
|
||||
AppCompatDelegate.setDefaultNightMode(settings.getTheme());
|
||||
|
||||
// Start Bluetooth server for Wear OS companion if enabled.
|
||||
// The service checks BLUETOOTH_CONNECT itself and stops if the permission is missing.
|
||||
// The permission is requested from the launcher Activity when the UI resumes.
|
||||
WearSyncServiceManager.INSTANCE.synchronize(this, null);
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,13 @@ import com.google.android.material.tabs.TabLayout.OnTabSelectedListener
|
||||
import protect.card_locker.DBHelper.LoyaltyCardOrder
|
||||
import protect.card_locker.DBHelper.LoyaltyCardOrderDirection
|
||||
import protect.card_locker.LoyaltyCardCursorAdapter.CardAdapterListener
|
||||
import protect.card_locker.cardview.LoyaltyCardViewActivity
|
||||
import protect.card_locker.databinding.ContentMainBinding
|
||||
import protect.card_locker.databinding.MainActivityBinding
|
||||
import protect.card_locker.databinding.SortingOptionBinding
|
||||
import protect.card_locker.preferences.Settings
|
||||
import protect.card_locker.preferences.SettingsActivity
|
||||
import protect.card_locker.wearos.WearSyncPermissionRequester
|
||||
import java.io.UnsupportedEncodingException
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import androidx.core.content.edit
|
||||
@@ -58,8 +60,9 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
private var selectedTab: Int = 0
|
||||
private lateinit var groupsTabLayout: TabLayout
|
||||
private lateinit var mUpdateLoyaltyCardListRunnable: Runnable
|
||||
private lateinit var mBarcodeScannerLauncher: ActivityResultLauncher<Intent?>
|
||||
private lateinit var mSettingsLauncher: ActivityResultLauncher<Intent?>
|
||||
private lateinit var mBarcodeScannerLauncher: ActivityResultLauncher<Intent>
|
||||
private lateinit var mSettingsLauncher: ActivityResultLauncher<Intent>
|
||||
private lateinit var mWearSyncPermissionRequester: WearSyncPermissionRequester
|
||||
|
||||
private val mCurrentActionModeCallback: ActionMode.Callback = object : ActionMode.Callback {
|
||||
override fun onCreateActionMode(inputMode: ActionMode, inputMenu: Menu?): Boolean {
|
||||
@@ -105,6 +108,24 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
inputMode.finish()
|
||||
return true
|
||||
}
|
||||
R.id.action_duplicate -> {
|
||||
require(mAdapter.selectedItemCount == 1) { "Cannot duplicate more than 1 card at a time" }
|
||||
|
||||
startActivity(
|
||||
Intent(applicationContext, LoyaltyCardEditActivity::class.java).apply {
|
||||
putExtras(Bundle().apply {
|
||||
putInt(
|
||||
LoyaltyCardEditActivity.BUNDLE_ID,
|
||||
mAdapter.getSelectedItems()[0].id
|
||||
)
|
||||
putBoolean(LoyaltyCardEditActivity.BUNDLE_DUPLICATE_ID, true)
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
inputMode.finish()
|
||||
return true
|
||||
}
|
||||
R.id.action_delete -> {
|
||||
MaterialAlertDialogBuilder(this@MainActivity).apply {
|
||||
// The following may seem weird, but it is necessary to give translators enough flexibility.
|
||||
@@ -138,8 +159,6 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
Log.d(TAG, "Deleting card: " + loyaltyCard.id)
|
||||
|
||||
DBHelper.deleteLoyaltyCard(mDatabase, this@MainActivity, loyaltyCard.id)
|
||||
|
||||
ShortcutHelper.removeShortcut(this@MainActivity, loyaltyCard.id)
|
||||
}
|
||||
val tab = groupsTabLayout.getTabAt(selectedTab)
|
||||
mGroup = tab?.tag
|
||||
@@ -159,7 +178,6 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
for (loyaltyCard in mAdapter.getSelectedItems()) {
|
||||
Log.d(TAG, "Archiving card: " + loyaltyCard.id)
|
||||
DBHelper.updateLoyaltyCardArchiveStatus(mDatabase, loyaltyCard.id, 1)
|
||||
ShortcutHelper.removeShortcut(this@MainActivity, loyaltyCard.id)
|
||||
updateLoyaltyCardList(false)
|
||||
inputMode.finish()
|
||||
invalidateOptionsMenu()
|
||||
@@ -302,6 +320,8 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
}
|
||||
}
|
||||
|
||||
mWearSyncPermissionRequester = WearSyncPermissionRequester(this, this)
|
||||
|
||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
if (mSearchView != null && !mSearchView!!.isIconified) {
|
||||
@@ -372,11 +392,14 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
}
|
||||
binding.fabAdd.bringToFront()
|
||||
|
||||
// Apply column count setting to card list
|
||||
val layoutManager = contentMainBinding.list.layoutManager as GridLayoutManager?
|
||||
if (layoutManager != null) {
|
||||
val settings = Settings(this)
|
||||
layoutManager.setSpanCount(settings.getPreferredColumnCount())
|
||||
}
|
||||
|
||||
mWearSyncPermissionRequester.synchronize()
|
||||
}
|
||||
|
||||
private fun displayCardSetupOptions(menu: Menu, shouldShow: Boolean) {
|
||||
@@ -447,13 +470,10 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
}
|
||||
|
||||
ListWidget().updateAll(mAdapter.mContext)
|
||||
ShortcutHelper.updateShortcuts(mAdapter.mContext)
|
||||
}
|
||||
|
||||
private fun processParseResultList(
|
||||
parseResultList: MutableList<ParseResult?>,
|
||||
group: String?,
|
||||
closeAppOnNoBarcode: Boolean
|
||||
) {
|
||||
private fun processParseResultList(parseResultList: MutableList<ParseResult?>) {
|
||||
require(!parseResultList.isEmpty()) { "parseResultList may not be empty" }
|
||||
|
||||
Utils.makeUserChooseParseResultFromList(
|
||||
@@ -464,17 +484,12 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
val intent =
|
||||
Intent(applicationContext, LoyaltyCardEditActivity::class.java)
|
||||
val bundle = parseResult.toLoyaltyCardBundle(this@MainActivity)
|
||||
if (group != null) {
|
||||
bundle.putString(LoyaltyCardEditActivity.BUNDLE_ADDGROUP, group)
|
||||
}
|
||||
intent.putExtras(bundle)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
override fun onUserDismissedSelector() {
|
||||
if (closeAppOnNoBarcode) {
|
||||
finish()
|
||||
}
|
||||
finish()
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -538,7 +553,7 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
return
|
||||
}
|
||||
|
||||
processParseResultList(parseResultList, null, true)
|
||||
processParseResultList(parseResultList)
|
||||
}
|
||||
|
||||
private fun extractIntentFields(intent: Intent) {
|
||||
@@ -824,6 +839,7 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
)
|
||||
|
||||
val editItem = mCurrentActionMode!!.menu.findItem(R.id.action_edit)
|
||||
val duplicateItem = mCurrentActionMode!!.menu.findItem(R.id.action_duplicate)
|
||||
val archiveItem = mCurrentActionMode!!.menu.findItem(R.id.action_archive)
|
||||
val unarchiveItem = mCurrentActionMode!!.menu.findItem(R.id.action_unarchive)
|
||||
val starItem = mCurrentActionMode!!.menu.findItem(R.id.action_star)
|
||||
@@ -861,12 +877,16 @@ class MainActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
unstarItem.isVisible = !hasUnstarred
|
||||
editItem.isVisible = true
|
||||
editItem.isEnabled = true
|
||||
duplicateItem.isVisible = true
|
||||
duplicateItem.isEnabled = true
|
||||
} else {
|
||||
starItem.isVisible = hasUnstarred
|
||||
unstarItem.isVisible = hasStarred
|
||||
|
||||
editItem.isVisible = false
|
||||
editItem.isEnabled = false
|
||||
duplicateItem.isVisible = false
|
||||
duplicateItem.isEnabled = false
|
||||
}
|
||||
|
||||
mCurrentActionMode!!.invalidate()
|
||||
|
||||
@@ -12,10 +12,12 @@ import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import protect.card_locker.LoyaltyCardCursorAdapter.CardAdapterListener
|
||||
import protect.card_locker.databinding.ActivityManageGroupBinding
|
||||
import protect.card_locker.preferences.Settings
|
||||
|
||||
class ManageGroupActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
private lateinit var binding: ActivityManageGroupBinding
|
||||
@@ -132,7 +134,15 @@ class ManageGroupActivity : CatimaAppCompatActivity(), CardAdapterListener {
|
||||
override fun handleOnBackPressed() {
|
||||
leaveWithoutSaving()
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
// Apply column count setting to card list
|
||||
val layoutManager = mCardList.layoutManager as GridLayoutManager?
|
||||
if (layoutManager != null) {
|
||||
val settings = Settings(this)
|
||||
layoutManager.setSpanCount(settings.getPreferredColumnCount())
|
||||
}
|
||||
}
|
||||
|
||||
private fun adapterStateToBundle(adapterState: HashMap<Int, Boolean>): Bundle {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package protect.card_locker
|
||||
|
||||
object NotificationInfo {
|
||||
object WearBluetooth {
|
||||
const val NOTIFICATION_ID = 1001
|
||||
const val CHANNEL_ID = "catima_wear_bt"
|
||||
const val PAIRING_CHANNEL_ID = "catima_wear_bt_pairing"
|
||||
const val CRITICAL_ERROR_NOTIFICATION_ID = 1002
|
||||
const val CRITICAL_ERROR_CHANNEL_ID = "catima_wear_bt_critical_error"
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,17 @@
|
||||
package protect.card_locker;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class OpenWebLinkHandler {
|
||||
|
||||
private static final String TAG = "Catima";
|
||||
|
||||
public void openBrowser(AppCompatActivity activity, String url) {
|
||||
public void openBrowser(Activity activity, String url) {
|
||||
if (url == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,11 +34,6 @@ public class PermissionUtils {
|
||||
* @return
|
||||
*/
|
||||
public static boolean needsCameraPermission(Activity activity) {
|
||||
// Android only introduced the runtime permission system in Marshmallow (Android 6.0)
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ContextCompat.checkSelfPermission(activity, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED;
|
||||
}
|
||||
|
||||
@@ -49,21 +44,14 @@ public class PermissionUtils {
|
||||
* @param activity
|
||||
* @param requestCode
|
||||
*/
|
||||
public static void requestStorageReadPermission(CatimaAppCompatActivity activity, int requestCode) {
|
||||
public static void requestStorageReadPermission(Activity activity, int requestCode) {
|
||||
String[] permissions = new String[]{ android.Manifest.permission.READ_EXTERNAL_STORAGE };
|
||||
int[] mockedResults = new int[]{ PackageManager.PERMISSION_GRANTED };
|
||||
|
||||
if (needsStorageReadPermission(activity)) {
|
||||
ActivityCompat.requestPermissions(activity, permissions, requestCode);
|
||||
} else {
|
||||
// FIXME: This points to onMockedRequestPermissionResult instead of to
|
||||
// onRequestPermissionResult because onRequestPermissionResult was only introduced in
|
||||
// Android 6.0 (SDK 23) and we and to support Android 5.0 (SDK 21) too.
|
||||
//
|
||||
// When minSdk becomes 23, this should point to onRequestPermissionResult directly and
|
||||
// the activity input variable should be changed from CatimaAppCompatActivity to
|
||||
// Activity.
|
||||
activity.onMockedRequestPermissionsResult(requestCode, permissions, mockedResults);
|
||||
activity.onRequestPermissionsResult(requestCode, permissions, mockedResults);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,21 +62,14 @@ public class PermissionUtils {
|
||||
* @param activity
|
||||
* @param requestCode
|
||||
*/
|
||||
public static void requestCameraPermission(CatimaAppCompatActivity activity, int requestCode) {
|
||||
public static void requestCameraPermission(Activity activity, int requestCode) {
|
||||
String[] permissions = new String[]{ Manifest.permission.CAMERA };
|
||||
int[] mockedResults = new int[]{ PackageManager.PERMISSION_GRANTED };
|
||||
|
||||
if (needsCameraPermission(activity)) {
|
||||
ActivityCompat.requestPermissions(activity, permissions, requestCode);
|
||||
} else {
|
||||
// FIXME: This points to onMockedRequestPermissionResult instead of to
|
||||
// onRequestPermissionResult because onRequestPermissionResult was only introduced in
|
||||
// Android 6.0 (SDK 23) and we and to support Android 5.0 (SDK 21) too.
|
||||
//
|
||||
// When minSdk becomes 23, this should point to onRequestPermissionResult directly and
|
||||
// the activity input variable should be changed from CatimaAppCompatActivity to
|
||||
// Activity.
|
||||
activity.onMockedRequestPermissionsResult(requestCode, permissions, mockedResults);
|
||||
activity.onRequestPermissionsResult(requestCode, permissions, mockedResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ import org.json.JSONObject
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.IOException
|
||||
import java.math.BigDecimal
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.text.DateFormat
|
||||
import java.text.ParseException
|
||||
import java.time.ZonedDateTime
|
||||
@@ -40,6 +42,7 @@ class PkpassParser(context: Context, uri: Uri?) {
|
||||
private var cardId: String = context.getString(R.string.noBarcode)
|
||||
private var barcodeId: String? = null
|
||||
private var barcodeType: CatimaBarcode? = null
|
||||
private var barcodeEncoding: Charset = StandardCharsets.ISO_8859_1
|
||||
private var headerColor: Int? = null
|
||||
private val starStatus = 0
|
||||
private val lastUsed: Long = 0
|
||||
@@ -134,6 +137,7 @@ class PkpassParser(context: Context, uri: Uri?) {
|
||||
cardId,
|
||||
barcodeId,
|
||||
barcodeType,
|
||||
barcodeEncoding,
|
||||
headerColor,
|
||||
starStatus,
|
||||
lastUsed,
|
||||
@@ -342,7 +346,6 @@ class PkpassParser(context: Context, uri: Uri?) {
|
||||
else -> throw IllegalArgumentException("No valid barcode type")
|
||||
}
|
||||
|
||||
// FIXME: We probably need to do something with the messageEncoding field
|
||||
try {
|
||||
cardId = barcodeInfo.getString("altText")
|
||||
barcodeId = barcodeInfo.getString("message")
|
||||
@@ -351,6 +354,12 @@ class PkpassParser(context: Context, uri: Uri?) {
|
||||
barcodeId = null
|
||||
}
|
||||
|
||||
try {
|
||||
barcodeEncoding = Charset.forName(barcodeInfo.getString("messageEncoding"))
|
||||
} catch (ignored: Exception) {
|
||||
// If encoding is not defined, null or otherwise invalid, stick to the default
|
||||
}
|
||||
|
||||
// Don't set barcodeId if it's the same as cardId
|
||||
if (cardId == barcodeId) {
|
||||
barcodeId = null
|
||||
|
||||
@@ -538,19 +538,11 @@ class ScanActivity : CatimaAppCompatActivity() {
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<String?>,
|
||||
permissions: Array<String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
|
||||
onMockedRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
}
|
||||
|
||||
override fun onMockedRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<String?>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
val granted =
|
||||
grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED
|
||||
|
||||
|
||||
@@ -2,31 +2,36 @@ package protect.card_locker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.content.pm.ShortcutInfoCompat;
|
||||
import androidx.core.content.pm.ShortcutManagerCompat;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.core.graphics.drawable.IconCompat;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
class ShortcutHelper {
|
||||
// Android documentation says that no more than 5 shortcuts
|
||||
// are supported. However, that may be too many, as not all
|
||||
// launcher will show all 5. Instead, the number is limited
|
||||
// to 3 here, so that the most recent shortcut has a good
|
||||
// chance of being shown.
|
||||
private static final int MAX_SHORTCUTS = 3;
|
||||
import protect.card_locker.cardview.LoyaltyCardViewActivity;
|
||||
import protect.card_locker.shared.ForegroundColorHelper;
|
||||
|
||||
public class ShortcutHelper {
|
||||
/**
|
||||
* This variable controls the maximum number of shortcuts available.
|
||||
* It is made public only to make testing easier and should not be
|
||||
* manually modified. We use -1 here as a default value to check if
|
||||
* the value has been set either manually by the test scenario or
|
||||
* automatically in the `updateShortcuts` function.
|
||||
* Its actual value will be set based on the maximum amount of shortcuts
|
||||
* declared by the launcher via `getMaxShortcutCountPerActivity`.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public static int maxShortcuts = -1;
|
||||
|
||||
// https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable.html
|
||||
private static final int ADAPTIVE_BITMAP_SCALE = 1;
|
||||
@@ -35,86 +40,45 @@ class ShortcutHelper {
|
||||
private static final int ADAPTIVE_BITMAP_IMAGE_SIZE = ADAPTIVE_BITMAP_VISIBLE_SIZE + 5 * ADAPTIVE_BITMAP_SCALE;
|
||||
|
||||
/**
|
||||
* Add a card to the app shortcuts, and maintain a list of the most
|
||||
* recently used cards. If there is already a shortcut for the card,
|
||||
* the card is marked as the most recently used card. If adding this
|
||||
* card exceeds the max number of shortcuts, then the least recently
|
||||
* used card shortcut is discarded.
|
||||
* Update the dynamic shortcut list with the most recently viewed cards
|
||||
* based on the lastUsed field. Archived cards are excluded from the shortcuts
|
||||
* list. The list keeps at most maxShortcuts number of elements.
|
||||
*/
|
||||
static void updateShortcuts(Context context, LoyaltyCard card) {
|
||||
if (card.archiveStatus == 1) {
|
||||
// Don't add archived card to menu
|
||||
return;
|
||||
public static void updateShortcuts(Context context) {
|
||||
if (maxShortcuts == -1) {
|
||||
maxShortcuts = ShortcutManagerCompat.getMaxShortcutCountPerActivity(context);
|
||||
}
|
||||
|
||||
LinkedList<ShortcutInfoCompat> list = new LinkedList<>(ShortcutManagerCompat.getDynamicShortcuts(context));
|
||||
|
||||
SQLiteDatabase database = new DBHelper(context).getReadableDatabase();
|
||||
|
||||
String shortcutId = Integer.toString(card.id);
|
||||
|
||||
// Sort the shortcuts by rank, so working with the relative order will be easier.
|
||||
// This sorts so that the lowest rank is first.
|
||||
Collections.sort(list, Comparator.comparingInt(ShortcutInfoCompat::getRank));
|
||||
|
||||
Integer foundIndex = null;
|
||||
|
||||
for (int index = 0; index < list.size(); index++) {
|
||||
if (list.get(index).getId().equals(shortcutId)) {
|
||||
// Found the item already
|
||||
foundIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundIndex != null) {
|
||||
// If the item is already found, then the list needs to be
|
||||
// reordered, so that the selected item now has the lowest
|
||||
// rank, thus letting it survive longer.
|
||||
ShortcutInfoCompat found = list.remove(foundIndex.intValue());
|
||||
list.addFirst(found);
|
||||
} else {
|
||||
// The item is new to the list. We add it and trim the list later.
|
||||
ShortcutInfoCompat shortcut = createShortcutBuilder(context, card).build();
|
||||
list.addFirst(shortcut);
|
||||
}
|
||||
|
||||
LinkedList<ShortcutInfoCompat> finalList = new LinkedList<>();
|
||||
int rank = 0;
|
||||
DBHelper dbHelper = new DBHelper(context);
|
||||
SQLiteDatabase database = dbHelper.getReadableDatabase();
|
||||
try (Cursor loyaltyCardCursor = DBHelper.getLoyaltyCardCursor(
|
||||
database,
|
||||
"",
|
||||
null,
|
||||
DBHelper.LoyaltyCardOrder.LastUsed,
|
||||
DBHelper.LoyaltyCardOrderDirection.Ascending,
|
||||
DBHelper.LoyaltyCardArchiveFilter.Unarchived
|
||||
)) {
|
||||
int rank = 0;
|
||||
|
||||
// The ranks are now updated; the order in the list is the rank.
|
||||
for (int index = 0; index < list.size(); index++) {
|
||||
ShortcutInfoCompat prevShortcut = list.get(index);
|
||||
while (rank < maxShortcuts && loyaltyCardCursor.moveToNext()) {
|
||||
int id = loyaltyCardCursor.getInt(loyaltyCardCursor.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.ID));
|
||||
LoyaltyCard loyaltyCard = DBHelper.getLoyaltyCard(context, database, id);
|
||||
|
||||
LoyaltyCard loyaltyCard = DBHelper.getLoyaltyCard(context, database, Integer.parseInt(prevShortcut.getId()));
|
||||
|
||||
// skip outdated cards that no longer exist
|
||||
if (loyaltyCard != null) {
|
||||
ShortcutInfoCompat updatedShortcut = createShortcutBuilder(context, loyaltyCard)
|
||||
.setRank(rank)
|
||||
.build();
|
||||
|
||||
finalList.addLast(updatedShortcut);
|
||||
rank++;
|
||||
|
||||
// trim the list
|
||||
if (rank >= MAX_SHORTCUTS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
dbHelper.close();
|
||||
}
|
||||
|
||||
ShortcutManagerCompat.setDynamicShortcuts(context, finalList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given card id from the app shortcuts, if such a
|
||||
* shortcut exists.
|
||||
*/
|
||||
static void removeShortcut(Context context, int cardId) {
|
||||
ShortcutManagerCompat.removeDynamicShortcuts(context, Collections.singletonList(Integer.toString(cardId)));
|
||||
}
|
||||
|
||||
static @NotNull
|
||||
Bitmap createAdaptiveBitmap(@NotNull Bitmap in, int paddingColor) {
|
||||
Bitmap ret = Bitmap.createBitmap(ADAPTIVE_BITMAP_SIZE, ADAPTIVE_BITMAP_SIZE, Bitmap.Config.ARGB_8888);
|
||||
@@ -130,7 +94,7 @@ class ShortcutHelper {
|
||||
intent.setAction(Intent.ACTION_MAIN);
|
||||
// Prevent instances of the view activity from piling up; if one exists let this
|
||||
// one replace it.
|
||||
intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putInt(LoyaltyCardViewActivity.BUNDLE_ID, loyaltyCard.id);
|
||||
intent.putExtras(bundle);
|
||||
@@ -139,7 +103,7 @@ class ShortcutHelper {
|
||||
if (iconBitmap == null) {
|
||||
iconBitmap = Utils.generateIcon(context, loyaltyCard, true).getLetterTile();
|
||||
} else {
|
||||
iconBitmap = createAdaptiveBitmap(iconBitmap, Utils.needsDarkForeground(Utils.getHeaderColor(context, loyaltyCard)) ? Color.BLACK : Color.WHITE);
|
||||
iconBitmap = createAdaptiveBitmap(iconBitmap, ForegroundColorHelper.Companion.needsDarkForeground(Utils.getHeaderColor(context, loyaltyCard)) ? Color.BLACK : Color.WHITE);
|
||||
}
|
||||
|
||||
IconCompat icon = IconCompat.createWithAdaptiveBitmap(iconBitmap);
|
||||
@@ -150,4 +114,4 @@ class ShortcutHelper {
|
||||
.setIntent(intent)
|
||||
.setIcon(icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,16 +40,9 @@ class UCropWrapper : UCropActivity() {
|
||||
return
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
val decorView = window.decorView
|
||||
val wic = WindowInsetsControllerCompat(window, decorView)
|
||||
wic.isAppearanceLightStatusBars = !darkMode
|
||||
} else if (!darkMode) {
|
||||
window.statusBarColor = ColorUtils.compositeColors(
|
||||
Color.argb(127, 0, 0, 0),
|
||||
window.statusBarColor
|
||||
)
|
||||
}
|
||||
val decorView = window.decorView
|
||||
val wic = WindowInsetsControllerCompat(window, decorView)
|
||||
wic.isAppearanceLightStatusBars = !darkMode
|
||||
}
|
||||
|
||||
private fun checkViews(darkMode: Boolean) {
|
||||
|
||||
@@ -39,7 +39,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RawRes;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.os.LocaleListCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
@@ -95,6 +94,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import protect.card_locker.preferences.Settings;
|
||||
import protect.card_locker.shared.ForegroundColorHelper;
|
||||
|
||||
public class Utils {
|
||||
private static final String TAG = "Catima";
|
||||
@@ -115,10 +115,8 @@ public class Utils {
|
||||
|
||||
public static final String CARD_IMAGE_FILENAME_REGEX = "^(card_)(\\d+)(_(?:front|back|icon)\\.png)$";
|
||||
|
||||
static final double LUMINANCE_MIDPOINT = 0.5;
|
||||
|
||||
static final int BITMAP_SIZE_SMALL = 512;
|
||||
static final int BITMAP_SIZE_BIG = 2048;
|
||||
static final int BITMAP_SIZE_BIG = 1600;
|
||||
|
||||
static public LetterBitmap generateIcon(Context context, LoyaltyCard loyaltyCard, boolean forShortcut) {
|
||||
return generateIcon(context, loyaltyCard.store, loyaltyCard.headerColor, forShortcut);
|
||||
@@ -147,11 +145,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
return new LetterBitmap(context, store, store,
|
||||
tileLetterFontSize, pixelSize, pixelSize, backgroundColor, needsDarkForeground(backgroundColor) ? Color.BLACK : Color.WHITE);
|
||||
}
|
||||
|
||||
static public boolean needsDarkForeground(Integer backgroundColor) {
|
||||
return ColorUtils.calculateLuminance(backgroundColor) > LUMINANCE_MIDPOINT;
|
||||
tileLetterFontSize, pixelSize, pixelSize, backgroundColor, ForegroundColorHelper.Companion.needsDarkForeground(backgroundColor) ? Color.BLACK : Color.WHITE);
|
||||
}
|
||||
|
||||
static public List<ParseResult> retrieveBarcodesFromImage(Context context, Uri uri) {
|
||||
@@ -963,31 +957,9 @@ public class Utils {
|
||||
// replace colors in the current theme
|
||||
public static void patchColors(AppCompatActivity activity) {
|
||||
Settings settings = new Settings(activity);
|
||||
String color = settings.getColor();
|
||||
|
||||
Resources.Theme theme = activity.getTheme();
|
||||
Resources resources = activity.getResources();
|
||||
if (color.equals(resources.getString(R.string.settings_key_pink_theme))) {
|
||||
theme.applyStyle(R.style.pink, true);
|
||||
} else if (color.equals(resources.getString(R.string.settings_key_magenta_theme))) {
|
||||
theme.applyStyle(R.style.magenta, true);
|
||||
} else if (color.equals(resources.getString(R.string.settings_key_violet_theme))) {
|
||||
theme.applyStyle(R.style.violet, true);
|
||||
} else if (color.equals(resources.getString(R.string.settings_key_blue_theme))) {
|
||||
theme.applyStyle(R.style.blue, true);
|
||||
} else if (color.equals(resources.getString(R.string.settings_key_sky_blue_theme))) {
|
||||
theme.applyStyle(R.style.skyblue, true);
|
||||
} else if (color.equals(resources.getString(R.string.settings_key_green_theme))) {
|
||||
theme.applyStyle(R.style.green, true);
|
||||
} else if (color.equals(resources.getString(R.string.settings_key_brown_theme))) {
|
||||
theme.applyStyle(R.style.brown, true);
|
||||
} else if (color.equals(resources.getString(R.string.settings_key_catima_theme))) {
|
||||
// catima theme is AppTheme itself, no dynamic colors nor applyStyle
|
||||
} else {
|
||||
// final catch all in case of invalid theme value from older versions
|
||||
// also handles R.string.settings_key_system_theme
|
||||
DynamicColors.applyToActivityIfAvailable(activity);
|
||||
}
|
||||
DynamicColors.applyToActivityIfAvailable(activity);
|
||||
|
||||
if (isDarkModeEnabled(activity) && settings.getOledDark()) {
|
||||
theme.applyStyle(R.style.DarkBackground, true);
|
||||
@@ -1092,7 +1064,7 @@ public class Utils {
|
||||
|
||||
if (icon != null) {
|
||||
// Use header colour to decide if this image will need a white or black background
|
||||
backgroundOrIcon.setBackgroundColor(needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
backgroundOrIcon.setBackgroundColor(ForegroundColorHelper.Companion.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
|
||||
// Ensure correct cropping style
|
||||
backgroundOrIcon.setScaleType(Utils.getRecommendedScaleTypeForThumbnailImage(icon));
|
||||
@@ -1122,7 +1094,7 @@ public class Utils {
|
||||
// Actually set the text and colour
|
||||
textWhenNoImage.setVisibility(View.VISIBLE);
|
||||
textWhenNoImage.setText(loyaltyCard.store);
|
||||
textWhenNoImage.setTextColor(Utils.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
textWhenNoImage.setTextColor(ForegroundColorHelper.Companion.needsDarkForeground(headerColor) ? Color.BLACK : Color.WHITE);
|
||||
}
|
||||
|
||||
return headerColor;
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
package protect.card_locker.cardimageview
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Bundle
|
||||
import android.view.WindowManager
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedDispatcher
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.gestures.detectTapGestures
|
||||
import androidx.compose.foundation.gestures.rememberTransformableState
|
||||
import androidx.compose.foundation.gestures.transformable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableFloatStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.layout.onSizeChanged
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.IntSize
|
||||
import androidx.core.content.FileProvider
|
||||
import protect.card_locker.CatimaComponentActivity
|
||||
import protect.card_locker.ImageLocationType
|
||||
import protect.card_locker.R
|
||||
import protect.card_locker.Utils
|
||||
import protect.card_locker.compose.CatimaTopAppBar
|
||||
import protect.card_locker.compose.theme.CatimaTheme
|
||||
import protect.card_locker.preferences.Settings
|
||||
|
||||
class LoyaltyCardImageViewActivity : CatimaComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
fixedEdgeToEdge()
|
||||
applyWindowPreferences()
|
||||
|
||||
val imageLocationType = intent.imageLocationType()
|
||||
val loyaltyCardId = intent.getIntExtra(BUNDLE_ID, 0)
|
||||
val bitmap = imageLocationType?.let {
|
||||
Utils.retrieveCardImage(this, loyaltyCardId, it)
|
||||
}
|
||||
|
||||
if (loyaltyCardId == 0 || imageLocationType == null || bitmap == null) {
|
||||
Toast.makeText(this, R.string.failedToRetrieveImageFile, Toast.LENGTH_SHORT).show()
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
title = getString(imageLocationType.descriptionRes())
|
||||
|
||||
setContent {
|
||||
CatimaTheme {
|
||||
LoyaltyCardImageViewScreen(
|
||||
bitmap = bitmap,
|
||||
imageLocationType = imageLocationType,
|
||||
cardId = loyaltyCardId,
|
||||
contentDescriptionRes = imageLocationType.descriptionRes(),
|
||||
onBackPressedDispatcher = onBackPressedDispatcher
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun applyWindowPreferences() {
|
||||
val settings = Settings(this)
|
||||
val currentWindow = window ?: return
|
||||
|
||||
val attributes = currentWindow.attributes
|
||||
if (settings.useMaxBrightnessDisplayingBarcode()) {
|
||||
attributes.screenBrightness = 1F
|
||||
}
|
||||
|
||||
if (settings.keepScreenOn) {
|
||||
currentWindow.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
|
||||
currentWindow.attributes = attributes
|
||||
}
|
||||
|
||||
private fun Intent.imageLocationType(): ImageLocationType? {
|
||||
val name = getStringExtra(BUNDLE_IMAGE_LOCATION_TYPE) ?: return null
|
||||
return runCatching { ImageLocationType.valueOf(name) }.getOrNull()
|
||||
}
|
||||
|
||||
private fun ImageLocationType.descriptionRes(): Int {
|
||||
return when (this) {
|
||||
ImageLocationType.icon -> R.string.thumbnailDescription
|
||||
ImageLocationType.front -> R.string.frontImageDescription
|
||||
ImageLocationType.back -> R.string.backImageDescription
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val BUNDLE_ID = "id"
|
||||
const val BUNDLE_IMAGE_LOCATION_TYPE = "imageLocationType"
|
||||
|
||||
@JvmStatic
|
||||
fun createIntent(
|
||||
context: Context,
|
||||
loyaltyCardId: Int,
|
||||
imageLocationType: ImageLocationType
|
||||
): Intent {
|
||||
return Intent(context, LoyaltyCardImageViewActivity::class.java)
|
||||
.putExtra(BUNDLE_ID, loyaltyCardId)
|
||||
.putExtra(BUNDLE_IMAGE_LOCATION_TYPE, imageLocationType.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun LoyaltyCardImageViewScreen(
|
||||
bitmap: Bitmap,
|
||||
imageLocationType: ImageLocationType,
|
||||
cardId: Int,
|
||||
@StringRes contentDescriptionRes: Int,
|
||||
onBackPressedDispatcher: OnBackPressedDispatcher,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
var scale by remember { mutableFloatStateOf(1F) }
|
||||
var offset by remember { mutableStateOf(Offset.Zero) }
|
||||
var size by remember { mutableStateOf(IntSize.Zero) }
|
||||
val zoomState = rememberTransformableState { _, zoomChange, panChange, _ ->
|
||||
val nextScale = (scale * zoomChange).coerceIn(1F, MAX_IMAGE_SCALE)
|
||||
scale = nextScale
|
||||
offset = if (nextScale == 1F) {
|
||||
Offset.Zero
|
||||
} else {
|
||||
(offset + panChange).clampTo(size, nextScale)
|
||||
}
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
CatimaTopAppBar(
|
||||
title = stringResource(contentDescriptionRes),
|
||||
onBackPressedDispatcher = onBackPressedDispatcher,
|
||||
actions = {
|
||||
var expanded by remember { mutableStateOf(false) }
|
||||
IconButton(onClick = { expanded = !expanded }) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.MoreVert,
|
||||
contentDescription = stringResource(R.string.action_more_options)
|
||||
)
|
||||
}
|
||||
DropdownMenu(
|
||||
expanded = expanded,
|
||||
onDismissRequest = { expanded = false }
|
||||
) {
|
||||
DropdownMenuItem(onClick = { openInImageGallery(context, cardId, imageLocationType) },
|
||||
text = { Text(stringResource(R.string.open_in_gallery)) },
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
) { innerPadding ->
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(innerPadding)
|
||||
.background(MaterialTheme.colorScheme.background)
|
||||
.testTag("card_image_zoom")
|
||||
) {
|
||||
Image(
|
||||
bitmap = bitmap.asImageBitmap(),
|
||||
contentDescription = stringResource(contentDescriptionRes),
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.onSizeChanged { size = it }
|
||||
.pointerInput(bitmap) {
|
||||
detectTapGestures(
|
||||
onDoubleTap = {
|
||||
scale = 1F
|
||||
offset = Offset.Zero
|
||||
}
|
||||
)
|
||||
}
|
||||
.transformable(zoomState)
|
||||
.graphicsLayer {
|
||||
scaleX = scale
|
||||
scaleY = scale
|
||||
translationX = offset.x
|
||||
translationY = offset.y
|
||||
}
|
||||
.testTag("card_image")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Offset.clampTo(size: IntSize, scale: Float): Offset {
|
||||
if (size.width == 0 || size.height == 0) {
|
||||
return this
|
||||
}
|
||||
|
||||
val maxX = size.width * (scale - 1F) / 2F
|
||||
val maxY = size.height * (scale - 1F) / 2F
|
||||
return Offset(
|
||||
x = x.coerceIn(-maxX, maxX),
|
||||
y = y.coerceIn(-maxY, maxY)
|
||||
)
|
||||
}
|
||||
|
||||
private fun openInImageGallery(context: Context, cardId: Int, imageLocationType: ImageLocationType){
|
||||
val imagePath = Utils.getCardImageFileName(cardId, imageLocationType)
|
||||
val viewInGalleryIntent = Intent(Intent.ACTION_VIEW).apply {
|
||||
setDataAndType(FileProvider.getUriForFile(context, context.packageName, context.getFileStreamPath(imagePath)), "image/*")
|
||||
flags = FLAG_GRANT_READ_URI_PERMISSION
|
||||
}
|
||||
context.startActivity(viewInGalleryIntent)
|
||||
}
|
||||
|
||||
private const val MAX_IMAGE_SCALE = 5F
|
||||
@@ -0,0 +1,103 @@
|
||||
package protect.card_locker.cardview;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
final class LoyaltyCardImageNavigator {
|
||||
private final List<LoyaltyCardImageType> imageTypes;
|
||||
private int currentIndex;
|
||||
|
||||
LoyaltyCardImageNavigator(List<LoyaltyCardImageType> imageTypes, int currentIndex) {
|
||||
this.imageTypes = new ArrayList<>(imageTypes);
|
||||
this.currentIndex = clampIndex(currentIndex);
|
||||
}
|
||||
|
||||
LoyaltyCardImageType getCurrent() {
|
||||
if (isEmpty()) {
|
||||
return LoyaltyCardImageType.NONE;
|
||||
}
|
||||
return imageTypes.get(currentIndex);
|
||||
}
|
||||
|
||||
boolean isEmpty() {
|
||||
return imageTypes.isEmpty();
|
||||
}
|
||||
|
||||
int size() {
|
||||
return imageTypes.size();
|
||||
}
|
||||
|
||||
boolean remove(LoyaltyCardImageType type) {
|
||||
int removedIndex = imageTypes.indexOf(type);
|
||||
if (removedIndex == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
imageTypes.remove(removedIndex);
|
||||
currentIndex = clampIndex(currentIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean canGoPrevious() {
|
||||
return currentIndex > 0;
|
||||
}
|
||||
|
||||
boolean canGoNext() {
|
||||
return currentIndex < imageTypes.size() - 1;
|
||||
}
|
||||
|
||||
boolean movePrevious() {
|
||||
if (!canGoPrevious()) {
|
||||
return false;
|
||||
}
|
||||
currentIndex--;
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean moveNext(boolean overflow) {
|
||||
if (isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (canGoNext()) {
|
||||
currentIndex++;
|
||||
return true;
|
||||
}
|
||||
if (overflow) {
|
||||
currentIndex = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int getCurrentIndex() {
|
||||
return currentIndex;
|
||||
}
|
||||
|
||||
LoyaltyCardImageType peekNext(boolean overflow) {
|
||||
if (isEmpty()) {
|
||||
return LoyaltyCardImageType.NONE;
|
||||
}
|
||||
|
||||
if (canGoNext()) {
|
||||
return imageTypes.get(currentIndex + 1);
|
||||
}
|
||||
|
||||
return overflow ? imageTypes.get(0) : getCurrent();
|
||||
}
|
||||
|
||||
private int clampIndex(int index) {
|
||||
if (imageTypes.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Math.max(0, Math.min(index, imageTypes.size() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
enum LoyaltyCardImageType {
|
||||
NONE,
|
||||
ICON,
|
||||
BARCODE,
|
||||
IMAGE_FRONT,
|
||||
IMAGE_BACK
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package protect.card_locker.cardview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.card.MaterialCardView;
|
||||
import com.google.android.material.color.MaterialColors;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import protect.card_locker.*;
|
||||
import protect.card_locker.async.TaskHandler;
|
||||
|
||||
final class LoyaltyCardMainImageRenderer {
|
||||
private final Context context;
|
||||
private final TaskHandler tasks = new TaskHandler();
|
||||
private final BarcodeImageWriterResultCallback barcodeCallback;
|
||||
|
||||
LoyaltyCardMainImageRenderer(
|
||||
Context context,
|
||||
BarcodeImageWriterResultCallback barcodeCallback
|
||||
) {
|
||||
this.context = context;
|
||||
this.barcodeCallback = barcodeCallback;
|
||||
}
|
||||
|
||||
void renderCurrent(
|
||||
LoyaltyCardImageType imageType,
|
||||
Bitmap frontImageBitmap,
|
||||
Bitmap backImageBitmap,
|
||||
CatimaBarcode format,
|
||||
Charset barcodeEncoding,
|
||||
String cardIdString,
|
||||
String barcodeIdString,
|
||||
ImageView barcodeRenderTarget,
|
||||
TextView mainImageDescription,
|
||||
MaterialCardView mainCardView,
|
||||
boolean isFullscreen,
|
||||
boolean waitForResize
|
||||
) {
|
||||
if (imageType == LoyaltyCardImageType.NONE) {
|
||||
// With no renderable media left, show the raw card ID instead of an empty card area.
|
||||
barcodeRenderTarget.setVisibility(View.GONE);
|
||||
mainCardView.setCardBackgroundColor(Color.TRANSPARENT);
|
||||
mainImageDescription.setTextColor(
|
||||
MaterialColors.getColor(
|
||||
mainImageDescription,
|
||||
com.google.android.material.R.attr.colorOnSurfaceVariant
|
||||
)
|
||||
);
|
||||
mainImageDescription.setText(cardIdString);
|
||||
return;
|
||||
}
|
||||
|
||||
if (imageType == LoyaltyCardImageType.BARCODE) {
|
||||
barcodeRenderTarget.setBackgroundColor(Color.WHITE);
|
||||
mainCardView.setCardBackgroundColor(Color.WHITE);
|
||||
mainImageDescription.setTextColor(context.getResources().getColor(R.color.md_theme_light_onSurfaceVariant));
|
||||
|
||||
if (waitForResize) {
|
||||
redrawBarcodeAfterResize(
|
||||
barcodeRenderTarget,
|
||||
barcodeIdString,
|
||||
cardIdString,
|
||||
format,
|
||||
barcodeEncoding,
|
||||
!isFullscreen,
|
||||
isFullscreen
|
||||
);
|
||||
} else {
|
||||
drawBarcode(
|
||||
barcodeRenderTarget,
|
||||
barcodeIdString,
|
||||
cardIdString,
|
||||
format,
|
||||
barcodeEncoding,
|
||||
!isFullscreen,
|
||||
isFullscreen
|
||||
);
|
||||
}
|
||||
|
||||
mainImageDescription.setText(cardIdString);
|
||||
barcodeRenderTarget.setContentDescription(
|
||||
context.getString(R.string.barcodeImageDescriptionWithType, format.prettyName())
|
||||
);
|
||||
} else if (imageType == LoyaltyCardImageType.IMAGE_FRONT) {
|
||||
barcodeRenderTarget.setImageBitmap(frontImageBitmap);
|
||||
barcodeRenderTarget.setBackgroundColor(Color.TRANSPARENT);
|
||||
mainCardView.setCardBackgroundColor(Color.TRANSPARENT);
|
||||
mainImageDescription.setTextColor(
|
||||
MaterialColors.getColor(
|
||||
mainImageDescription,
|
||||
com.google.android.material.R.attr.colorOnSurfaceVariant
|
||||
)
|
||||
);
|
||||
mainImageDescription.setText(context.getString(R.string.frontImageDescription));
|
||||
barcodeRenderTarget.setContentDescription(context.getString(R.string.frontImageDescription));
|
||||
} else if (imageType == LoyaltyCardImageType.IMAGE_BACK) {
|
||||
barcodeRenderTarget.setImageBitmap(backImageBitmap);
|
||||
barcodeRenderTarget.setBackgroundColor(Color.TRANSPARENT);
|
||||
mainCardView.setCardBackgroundColor(Color.TRANSPARENT);
|
||||
mainImageDescription.setTextColor(
|
||||
MaterialColors.getColor(
|
||||
mainImageDescription,
|
||||
com.google.android.material.R.attr.colorOnSurfaceVariant
|
||||
)
|
||||
);
|
||||
mainImageDescription.setText(context.getString(R.string.backImageDescription));
|
||||
barcodeRenderTarget.setContentDescription(context.getString(R.string.backImageDescription));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown image type: " + imageType);
|
||||
}
|
||||
|
||||
barcodeRenderTarget.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void redrawBarcodeAfterResize(
|
||||
ImageView barcodeRenderTarget,
|
||||
String barcodeIdString,
|
||||
String cardIdString,
|
||||
CatimaBarcode format,
|
||||
Charset barcodeEncoding,
|
||||
boolean addPadding,
|
||||
boolean isFullscreen
|
||||
) {
|
||||
if (format == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Barcode dimensions depend on the final ImageView size, so wait for layout before rendering.
|
||||
barcodeRenderTarget.getViewTreeObserver().addOnGlobalLayoutListener(
|
||||
new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
barcodeRenderTarget.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
drawBarcode(
|
||||
barcodeRenderTarget,
|
||||
barcodeIdString,
|
||||
cardIdString,
|
||||
format,
|
||||
barcodeEncoding,
|
||||
addPadding,
|
||||
isFullscreen
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void drawBarcode(
|
||||
ImageView barcodeRenderTarget,
|
||||
String barcodeIdString,
|
||||
String cardIdString,
|
||||
CatimaBarcode format,
|
||||
Charset barcodeEncoding,
|
||||
boolean addPadding,
|
||||
boolean isFullscreen
|
||||
) {
|
||||
// Barcodes are regenerated eagerly because zoom/fullscreen changes affect the output bitmap.
|
||||
tasks.flushTaskList(TaskHandler.TYPE.BARCODE, true, false, false);
|
||||
if (format == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
BarcodeImageWriterTask barcodeWriter = new BarcodeImageWriterTask(
|
||||
context.getApplicationContext(),
|
||||
barcodeRenderTarget,
|
||||
barcodeIdString != null ? barcodeIdString : cardIdString,
|
||||
format,
|
||||
barcodeEncoding,
|
||||
null,
|
||||
false,
|
||||
barcodeCallback,
|
||||
addPadding,
|
||||
isFullscreen
|
||||
);
|
||||
tasks.executeTask(TaskHandler.TYPE.BARCODE, barcodeWriter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package protect.card_locker.cardview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.InputType;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.DigitsKeyListener;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.util.Linkify;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import protect.card_locker.*;
|
||||
|
||||
final class LoyaltyCardViewDialogs {
|
||||
interface BalanceUpdateListener {
|
||||
void onBalanceUpdated(BigDecimal newBalance);
|
||||
}
|
||||
|
||||
void showInfoDialog(Context context, LoyaltyCard loyaltyCard, List<Group> loyaltyCardGroups) {
|
||||
AlertDialog.Builder infoDialog = new MaterialAlertDialogBuilder(context);
|
||||
|
||||
int dialogContentPadding = context.getResources().getDimensionPixelSize(R.dimen.alert_dialog_content_padding);
|
||||
infoDialog.setTitle(loyaltyCard.store);
|
||||
|
||||
TextView infoTextview = new TextView(context);
|
||||
infoTextview.setPadding(
|
||||
dialogContentPadding,
|
||||
dialogContentPadding / 2,
|
||||
dialogContentPadding,
|
||||
0
|
||||
);
|
||||
infoTextview.setAutoLinkMask(Linkify.EMAIL_ADDRESSES | Linkify.PHONE_NUMBERS | Linkify.WEB_URLS);
|
||||
infoTextview.setTextIsSelectable(true);
|
||||
|
||||
SpannableStringBuilder infoText = new SpannableStringBuilder();
|
||||
if (!loyaltyCard.note.isEmpty()) {
|
||||
infoText.append(loyaltyCard.note);
|
||||
}
|
||||
|
||||
if (!loyaltyCardGroups.isEmpty()) {
|
||||
List<String> groupNames = new ArrayList<>();
|
||||
for (Group group : loyaltyCardGroups) {
|
||||
groupNames.add(group._id);
|
||||
}
|
||||
|
||||
padSpannableString(infoText);
|
||||
infoText.append(context.getString(R.string.groupsList, TextUtils.join(", ", groupNames)));
|
||||
}
|
||||
|
||||
if (hasBalance(loyaltyCard)) {
|
||||
padSpannableString(infoText);
|
||||
infoText.append(context.getString(
|
||||
R.string.balanceSentence,
|
||||
Utils.formatBalance(context, loyaltyCard.balance, loyaltyCard.balanceType)
|
||||
));
|
||||
}
|
||||
|
||||
appendDateInfo(
|
||||
context,
|
||||
infoText,
|
||||
loyaltyCard.validFrom,
|
||||
Utils::isNotYetValid,
|
||||
R.string.validFromSentence,
|
||||
R.string.validFromSentence
|
||||
);
|
||||
appendDateInfo(
|
||||
context,
|
||||
infoText,
|
||||
loyaltyCard.expiry,
|
||||
Utils::hasExpired,
|
||||
R.string.expiryStateSentenceExpired,
|
||||
R.string.expiryStateSentence
|
||||
);
|
||||
|
||||
infoTextview.setText(infoText);
|
||||
infoDialog.setView(infoTextview);
|
||||
infoDialog.setPositiveButton(R.string.ok, (dialogInterface, i) -> dialogInterface.dismiss());
|
||||
infoDialog.create().show();
|
||||
}
|
||||
|
||||
void showBalanceUpdateDialog(
|
||||
Context context,
|
||||
LoyaltyCard loyaltyCard,
|
||||
BalanceUpdateListener balanceUpdateListener
|
||||
) {
|
||||
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(context);
|
||||
builder.setTitle(R.string.updateBalanceTitle);
|
||||
|
||||
FrameLayout container = new FrameLayout(context);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
int contentPadding = context.getResources().getDimensionPixelSize(R.dimen.alert_dialog_content_padding);
|
||||
params.leftMargin = contentPadding;
|
||||
params.topMargin = contentPadding / 2;
|
||||
params.rightMargin = contentPadding;
|
||||
|
||||
LinearLayout layout = new LinearLayout(context);
|
||||
layout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
TextView currentTextview = new TextView(context);
|
||||
currentTextview.setText(context.getString(
|
||||
R.string.currentBalanceSentence,
|
||||
Utils.formatBalance(context, loyaltyCard.balance, loyaltyCard.balanceType)
|
||||
));
|
||||
layout.addView(currentTextview);
|
||||
|
||||
final TextInputEditText input = new TextInputEditText(context);
|
||||
input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||
input.setKeyListener(DigitsKeyListener.getInstance("0123456789,."));
|
||||
input.setHint(R.string.updateBalanceHint);
|
||||
|
||||
layout.addView(input);
|
||||
layout.setLayoutParams(params);
|
||||
container.addView(layout);
|
||||
builder.setView(container);
|
||||
|
||||
builder.setPositiveButton(R.string.spend, (dialogInterface, i) -> {
|
||||
try {
|
||||
BigDecimal balanceChange = Utils.parseBalance(input.getText().toString(), loyaltyCard.balanceType);
|
||||
BigDecimal newBalance = loyaltyCard.balance.subtract(balanceChange).max(new BigDecimal(0));
|
||||
balanceUpdateListener.onBalanceUpdated(newBalance);
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(
|
||||
R.string.newBalanceSentence,
|
||||
Utils.formatBalance(context, newBalance, loyaltyCard.balanceType)
|
||||
),
|
||||
Toast.LENGTH_LONG
|
||||
).show();
|
||||
} catch (ParseException e) {
|
||||
Toast.makeText(context, R.string.amountParsingFailed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.receive, (dialogInterface, i) -> {
|
||||
try {
|
||||
BigDecimal balanceChange = Utils.parseBalance(input.getText().toString(), loyaltyCard.balanceType);
|
||||
BigDecimal newBalance = loyaltyCard.balance.add(balanceChange);
|
||||
balanceUpdateListener.onBalanceUpdated(newBalance);
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(
|
||||
R.string.newBalanceSentence,
|
||||
Utils.formatBalance(context, newBalance, loyaltyCard.balanceType)
|
||||
),
|
||||
Toast.LENGTH_LONG
|
||||
).show();
|
||||
} catch (ParseException e) {
|
||||
Toast.makeText(context, R.string.amountParsingFailed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(context.getString(R.string.cancel), (dialog, which) -> dialog.cancel());
|
||||
AlertDialog dialog = builder.create();
|
||||
|
||||
// Button state depends on the parsed input, so listeners must be bound after the dialog exists.
|
||||
input.addTextChangedListener(new SimpleTextWatcher() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
BigDecimal balanceChange;
|
||||
|
||||
try {
|
||||
balanceChange = Utils.parseBalance(s.toString(), loyaltyCard.balanceType);
|
||||
} catch (ParseException e) {
|
||||
input.setError(context.getString(R.string.amountParsingFailed));
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
input.setError(null);
|
||||
boolean hasNonZeroValue = !balanceChange.equals(new BigDecimal(0));
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(hasNonZeroValue);
|
||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setEnabled(hasNonZeroValue);
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
// Touching dialog buttons before show() can crash because they are not created yet.
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setEnabled(false);
|
||||
|
||||
if (dialog.getWindow() != null) {
|
||||
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
|
||||
}
|
||||
// Focus immediately so the keyboard opens on the amount field.
|
||||
input.requestFocus();
|
||||
}
|
||||
|
||||
private boolean hasBalance(LoyaltyCard loyaltyCard) {
|
||||
return !loyaltyCard.balance.equals(new BigDecimal(0));
|
||||
}
|
||||
|
||||
private SpannableStringBuilder padSpannableString(SpannableStringBuilder spannableStringBuilder) {
|
||||
if (spannableStringBuilder.length() > 0) {
|
||||
spannableStringBuilder.append("\n\n");
|
||||
}
|
||||
|
||||
return spannableStringBuilder;
|
||||
}
|
||||
|
||||
private void appendDateInfo(
|
||||
Context context,
|
||||
SpannableStringBuilder infoText,
|
||||
Date date,
|
||||
Predicate<Date> dateCheck,
|
||||
@StringRes int dateCheckTrueString,
|
||||
@StringRes int dateCheckFalseString
|
||||
) {
|
||||
if (date == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String formattedDate = DateFormat.getDateInstance(DateFormat.LONG).format(date);
|
||||
|
||||
padSpannableString(infoText);
|
||||
if (dateCheck.test(date)) {
|
||||
int start = infoText.length();
|
||||
infoText.append(context.getString(dateCheckTrueString, formattedDate));
|
||||
infoText.setSpan(new ForegroundColorSpan(Color.RED), start, infoText.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
} else {
|
||||
infoText.append(context.getString(dateCheckFalseString, formattedDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package protect.card_locker.compose
|
||||
|
||||
import androidx.activity.compose.LocalActivity
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.hideFromAccessibility
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.unit.dp
|
||||
import protect.card_locker.OpenWebLinkHandler
|
||||
import protect.card_locker.R
|
||||
|
||||
@Composable
|
||||
fun CatimaAboutSection(
|
||||
title: String,
|
||||
message: String,
|
||||
modifier: Modifier = Modifier,
|
||||
onClickUrl: String? = null,
|
||||
onClickDialogText: AnnotatedString? = null,
|
||||
) {
|
||||
val activity = LocalActivity.current
|
||||
|
||||
val openDialog = remember { mutableStateOf(false) }
|
||||
|
||||
Row(
|
||||
modifier = modifier
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||
.clickable {
|
||||
if (onClickDialogText != null) {
|
||||
openDialog.value = true
|
||||
} else if (onClickUrl != null) {
|
||||
OpenWebLinkHandler().openBrowser(activity, onClickUrl)
|
||||
}
|
||||
}
|
||||
.semantics(mergeDescendants = true) {}
|
||||
) {
|
||||
Column(modifier = Modifier.weight(1F)) {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleMedium
|
||||
)
|
||||
Text(text = message)
|
||||
}
|
||||
Text(modifier = Modifier.align(Alignment.CenterVertically).semantics() { hideFromAccessibility() },
|
||||
text = ">",
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
)
|
||||
}
|
||||
if (openDialog.value && onClickDialogText != null) {
|
||||
AlertDialog(
|
||||
icon = {},
|
||||
title = {
|
||||
Text(text = title)
|
||||
},
|
||||
text = {
|
||||
Text(
|
||||
text = onClickDialogText,
|
||||
modifier = Modifier.verticalScroll(rememberScrollState())
|
||||
)
|
||||
},
|
||||
onDismissRequest = {
|
||||
openDialog.value = false
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
openDialog.value = false
|
||||
}
|
||||
) {
|
||||
Text(stringResource(R.string.ok))
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
if (onClickUrl != null) {
|
||||
TextButton(
|
||||
onClick = {
|
||||
OpenWebLinkHandler().openBrowser(activity, onClickUrl)
|
||||
}
|
||||
) {
|
||||
Text(stringResource(R.string.view_online))
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package protect.card_locker.compose
|
||||
|
||||
import androidx.activity.OnBackPressedDispatcher
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import protect.card_locker.R
|
||||
import protect.card_locker.preferences.Settings
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun CatimaTopAppBar(title: String,
|
||||
onBackPressedDispatcher: OnBackPressedDispatcher?,
|
||||
actions : @Composable RowScope.() -> Unit = {}) {
|
||||
// Use pure black in OLED theme
|
||||
val context = LocalContext.current
|
||||
val settings = Settings(context)
|
||||
val isDarkMode = when (settings.theme) {
|
||||
AppCompatDelegate.MODE_NIGHT_NO -> false
|
||||
AppCompatDelegate.MODE_NIGHT_YES -> true
|
||||
else -> isSystemInDarkTheme()
|
||||
}
|
||||
|
||||
val appBarColors = if (isDarkMode && settings.oledDark) {
|
||||
TopAppBarDefaults.topAppBarColors().copy(containerColor = Color.Black)
|
||||
} else {
|
||||
TopAppBarDefaults.topAppBarColors()
|
||||
}
|
||||
|
||||
TopAppBar(
|
||||
modifier = Modifier.testTag("topbar_catima"),
|
||||
title = { Text(text = title) },
|
||||
colors = appBarColors,
|
||||
navigationIcon = {
|
||||
if (onBackPressedDispatcher != null) {
|
||||
IconButton(onClick = { onBackPressedDispatcher.onBackPressed() }) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = stringResource(R.string.back)
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
actions = actions
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package protect.card_locker.compose.theme
|
||||
|
||||
import android.os.Build
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import protect.card_locker.R
|
||||
import protect.card_locker.preferences.Settings
|
||||
|
||||
@Composable
|
||||
fun CatimaTheme(content: @Composable () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
val settings = Settings(context)
|
||||
|
||||
val isDynamicColorSupported = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
|
||||
|
||||
val lightTheme = if (isDynamicColorSupported) {
|
||||
dynamicLightColorScheme(context)
|
||||
} else {
|
||||
lightColorScheme(primary = colorResource(id = R.color.md_theme_light_primary))
|
||||
}
|
||||
|
||||
var darkTheme = if (isDynamicColorSupported) {
|
||||
dynamicDarkColorScheme(context)
|
||||
} else {
|
||||
darkColorScheme(primary = colorResource(id = R.color.md_theme_dark_primary))
|
||||
}
|
||||
|
||||
if (settings.oledDark) {
|
||||
darkTheme = darkTheme.copy(background = Color.Black)
|
||||
}
|
||||
|
||||
val colorScheme = when (settings.theme) {
|
||||
AppCompatDelegate.MODE_NIGHT_NO -> lightTheme
|
||||
AppCompatDelegate.MODE_NIGHT_YES -> darkTheme
|
||||
else -> if (isSystemInDarkTheme()) darkTheme else lightTheme
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class CardsContentProvider extends ContentProvider {
|
||||
public static final String MAJOR_COLUMN = "major";
|
||||
public static final String MINOR_COLUMN = "minor";
|
||||
public static final int MAJOR = 1;
|
||||
public static final int MINOR = 0;
|
||||
public static final int MINOR = 1;
|
||||
}
|
||||
|
||||
private static final int URI_VERSION = 0;
|
||||
@@ -52,6 +52,7 @@ public class CardsContentProvider extends ContentProvider {
|
||||
LoyaltyCardDbIds.CARD_ID,
|
||||
LoyaltyCardDbIds.BARCODE_ID,
|
||||
LoyaltyCardDbIds.BARCODE_TYPE,
|
||||
LoyaltyCardDbIds.BARCODE_ENCODING,
|
||||
LoyaltyCardDbIds.STAR_STATUS,
|
||||
LoyaltyCardDbIds.LAST_USED,
|
||||
LoyaltyCardDbIds.ARCHIVE_STATUS,
|
||||
@@ -76,13 +77,6 @@ public class CardsContentProvider extends ContentProvider {
|
||||
@Nullable final String selection,
|
||||
@Nullable final String[] selectionArgs,
|
||||
@Nullable final String sortOrder) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
// Disable the content provider on SDK < 23 since it grants dangerous
|
||||
// permissions at install-time
|
||||
Log.w(TAG, "Content provider read is only available for SDK >= 23");
|
||||
return null;
|
||||
}
|
||||
|
||||
final Settings settings = new Settings(getContext());
|
||||
if (!settings.getAllowContentProviderRead()) {
|
||||
Log.w(TAG, "Content provider read is disabled");
|
||||
|
||||
@@ -134,6 +134,7 @@ public class CatimaExporter implements Exporter {
|
||||
DBHelper.LoyaltyCardDbIds.CARD_ID,
|
||||
DBHelper.LoyaltyCardDbIds.BARCODE_ID,
|
||||
DBHelper.LoyaltyCardDbIds.BARCODE_TYPE,
|
||||
DBHelper.LoyaltyCardDbIds.BARCODE_ENCODING,
|
||||
DBHelper.LoyaltyCardDbIds.HEADER_COLOR,
|
||||
DBHelper.LoyaltyCardDbIds.STAR_STATUS,
|
||||
DBHelper.LoyaltyCardDbIds.LAST_USED,
|
||||
@@ -154,6 +155,7 @@ public class CatimaExporter implements Exporter {
|
||||
card.cardId,
|
||||
card.barcodeId,
|
||||
card.barcodeType != null ? card.barcodeType.name() : "",
|
||||
card.barcodeEncoding.name(),
|
||||
card.headerColor,
|
||||
card.starStatus,
|
||||
card.lastUsed,
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.StringReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Currency;
|
||||
@@ -127,10 +128,10 @@ public class CatimaImporter implements Importer {
|
||||
LoyaltyCard existing = DBHelper.getLoyaltyCard(context, database, card.id);
|
||||
if (existing == null) {
|
||||
DBHelper.insertLoyaltyCard(database, card.id, card.store, card.note, card.validFrom, card.expiry, card.balance, card.balanceType,
|
||||
card.cardId, card.barcodeId, card.barcodeType, card.headerColor, card.starStatus, card.lastUsed, card.archiveStatus);
|
||||
card.cardId, card.barcodeId, card.barcodeType, card.barcodeEncoding, card.headerColor, card.starStatus, card.lastUsed, card.archiveStatus);
|
||||
} else if (!isDuplicate(context, existing, card, existingImages, imageChecksums)) {
|
||||
long newId = DBHelper.insertLoyaltyCard(database, card.store, card.note, card.validFrom, card.expiry, card.balance, card.balanceType,
|
||||
card.cardId, card.barcodeId, card.barcodeType, card.headerColor, card.starStatus, card.lastUsed, card.archiveStatus);
|
||||
card.cardId, card.barcodeId, card.barcodeType, card.barcodeEncoding, card.headerColor, card.starStatus, card.lastUsed, card.archiveStatus);
|
||||
idMap.put(card.id, (int) newId);
|
||||
}
|
||||
}
|
||||
@@ -458,6 +459,15 @@ public class CatimaImporter implements Importer {
|
||||
barcodeType = CatimaBarcode.fromName(unparsedBarcodeType);
|
||||
}
|
||||
|
||||
// Barcode encoding information is only supported since Catima 2.41.0, so old exports will lack this field
|
||||
// Database migration 19 forcing ISO-8859-1 on all cards, so we should treat imports from old Catima versions the same and force ISO-8859-1 there too
|
||||
// This limits the risk of breaking cards when importing an old database backup
|
||||
Charset barcodeEncoding = StandardCharsets.ISO_8859_1;
|
||||
String unparsedBarcodeEncoding = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.BARCODE_ENCODING, record, "");
|
||||
if (!unparsedBarcodeEncoding.isEmpty()) {
|
||||
barcodeEncoding = Charset.forName(unparsedBarcodeEncoding);
|
||||
}
|
||||
|
||||
Integer headerColor = null;
|
||||
try {
|
||||
headerColor = CSVHelpers.extractInt(DBHelper.LoyaltyCardDbIds.HEADER_COLOR, record);
|
||||
@@ -501,6 +511,7 @@ public class CatimaImporter implements Importer {
|
||||
cardId,
|
||||
barcodeId,
|
||||
barcodeType,
|
||||
barcodeEncoding,
|
||||
headerColor,
|
||||
starStatus,
|
||||
lastUsed,
|
||||
|
||||
@@ -160,6 +160,7 @@ public class FidmeImporter implements Importer {
|
||||
cardId,
|
||||
null,
|
||||
barcodeType,
|
||||
StandardCharsets.ISO_8859_1,
|
||||
headerColor,
|
||||
starStatus,
|
||||
Utils.getUnixTime(),
|
||||
@@ -181,7 +182,7 @@ public class FidmeImporter implements Importer {
|
||||
for (LoyaltyCard card : data.cards) {
|
||||
// Do not use card.id which is set to -1
|
||||
DBHelper.insertLoyaltyCard(database, card.store, card.note, card.validFrom, card.expiry, card.balance, card.balanceType,
|
||||
card.cardId, card.barcodeId, card.barcodeType, card.headerColor, card.starStatus, card.lastUsed, card.archiveStatus);
|
||||
card.cardId, card.barcodeId, card.barcodeType, card.barcodeEncoding, card.headerColor, card.starStatus, card.lastUsed, card.archiveStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,6 +162,7 @@ public class VoucherVaultImporter implements Importer {
|
||||
cardId,
|
||||
null,
|
||||
barcodeType,
|
||||
StandardCharsets.ISO_8859_1,
|
||||
headerColor,
|
||||
0,
|
||||
Utils.getUnixTime(),
|
||||
@@ -186,7 +187,7 @@ public class VoucherVaultImporter implements Importer {
|
||||
for (LoyaltyCard card : data.cards) {
|
||||
// Do not use card.id which is set to -1
|
||||
DBHelper.insertLoyaltyCard(database, card.store, card.note, card.validFrom, card.expiry, card.balance, card.balanceType,
|
||||
card.cardId, card.barcodeId, card.barcodeType, card.headerColor, card.starStatus, card.lastUsed, card.archiveStatus);
|
||||
card.cardId, card.barcodeId, card.barcodeType, card.barcodeEncoding, card.headerColor, card.starStatus, card.lastUsed, card.archiveStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,10 @@ public class Settings {
|
||||
return getBoolean(R.string.settings_key_disable_lockscreen_while_viewing_card, true);
|
||||
}
|
||||
|
||||
public boolean getDisableNfcWhileViewingCard() {
|
||||
return getBoolean(R.string.settings_key_disable_nfc_while_viewing_card, true);
|
||||
}
|
||||
|
||||
public boolean getAllowContentProviderRead() {
|
||||
return getBoolean(R.string.settings_key_allow_content_provider_read, true);
|
||||
}
|
||||
@@ -90,10 +94,6 @@ public class Settings {
|
||||
return getBoolean(R.string.settings_key_oled_dark, false);
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return getString(R.string.setting_key_theme_color, mContext.getResources().getString(R.string.settings_key_system_theme));
|
||||
}
|
||||
|
||||
public int getPreferredColumnCount() {
|
||||
var defaultSymbol = mContext.getResources().getString(R.string.settings_key_automatic_column_count);
|
||||
var defaultColumnCount = mContext.getResources().getInteger(R.integer.main_view_card_columns);
|
||||
@@ -112,4 +112,8 @@ public class Settings {
|
||||
public boolean useVolumeKeysForNavigation() {
|
||||
return getBoolean(R.string.settings_key_use_volume_keys_navigation, false);
|
||||
}
|
||||
|
||||
public boolean getWearSyncEnabled() {
|
||||
return getBoolean(R.string.settings_key_wear_sync, false);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,42 @@
|
||||
package protect.card_locker.preferences
|
||||
|
||||
import android.app.Activity
|
||||
import android.annotation.SuppressLint
|
||||
import android.bluetooth.BluetoothDevice
|
||||
import android.bluetooth.BluetoothManager
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.MenuItem
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.os.LocaleListCompat
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import androidx.preference.SwitchPreferenceCompat
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import protect.card_locker.BuildConfig
|
||||
import protect.card_locker.CatimaAppCompatActivity
|
||||
import protect.card_locker.MainActivity
|
||||
import protect.card_locker.R
|
||||
import protect.card_locker.Utils
|
||||
import protect.card_locker.databinding.SettingsActivityBinding
|
||||
import protect.card_locker.shared.BluetoothPermissionHelper
|
||||
import protect.card_locker.shared.WearBluetoothSecurity
|
||||
import protect.card_locker.wearos.BluetoothPairingNotificationManager
|
||||
import protect.card_locker.wearos.WearSyncPermissionRequester
|
||||
|
||||
class SettingsActivity : CatimaAppCompatActivity() {
|
||||
|
||||
@@ -82,11 +101,62 @@ class SettingsActivity : CatimaAppCompatActivity() {
|
||||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
var mReloadMain: Boolean = false
|
||||
|
||||
private lateinit var wearSyncPermissionRequester: WearSyncPermissionRequester
|
||||
private var currentDevicesDialog: AlertDialog? = null
|
||||
private var currentDevicesDialogIsBlocked: Boolean = false
|
||||
private val devicesChangedReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action != BluetoothPairingNotificationManager.ACTION_DEVICES_CHANGED) {
|
||||
return
|
||||
}
|
||||
findPreference<Preference>(getString(R.string.settings_key_wear_sync_devices))?.let { updateWearSyncAllowedDevicesSummary(it) }
|
||||
findPreference<Preference>(getString(R.string.settings_key_wear_sync_blocked_devices))?.let { updateWearSyncBlockedDevicesSummary(it) }
|
||||
if (currentDevicesDialog?.isShowing != true) {
|
||||
return
|
||||
}
|
||||
val isBlocked = currentDevicesDialogIsBlocked
|
||||
currentDevicesDialog?.dismiss()
|
||||
if (isBlocked) {
|
||||
showWearSyncBlockedDevicesDialog()
|
||||
} else {
|
||||
showWearSyncAllowedDevicesDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
wearSyncPermissionRequester.synchronize()
|
||||
findPreference<Preference>(getString(R.string.settings_key_wear_sync_devices))?.let { updateWearSyncAllowedDevicesSummary(it) }
|
||||
findPreference<Preference>(getString(R.string.settings_key_wear_sync_blocked_devices))?.let { updateWearSyncBlockedDevicesSummary(it) }
|
||||
ContextCompat.registerReceiver(
|
||||
requireContext(),
|
||||
devicesChangedReceiver,
|
||||
IntentFilter(BluetoothPairingNotificationManager.ACTION_DEVICES_CHANGED),
|
||||
ContextCompat.RECEIVER_NOT_EXPORTED
|
||||
)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
requireContext().unregisterReceiver(devicesChangedReceiver)
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
wearSyncPermissionRequester = WearSyncPermissionRequester(this, requireContext())
|
||||
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.preferences)
|
||||
|
||||
// Show pretty names and summaries
|
||||
setupThemePreference()
|
||||
setupOledDarkPreference()
|
||||
setupLocalePreference()
|
||||
setupCrashReporterPreference()
|
||||
setupWearSyncPreference()
|
||||
setupWearSyncDevicePreferences()
|
||||
}
|
||||
|
||||
private fun setupThemePreference() {
|
||||
val themePreference = findPreference<ListPreference>(getString(R.string.settings_key_theme))
|
||||
themePreference!!.setOnPreferenceChangeListener { _, o ->
|
||||
when (o.toString()) {
|
||||
@@ -102,23 +172,17 @@ class SettingsActivity : CatimaAppCompatActivity() {
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
val themeColorPreference = findPreference<ListPreference>(getString(R.string.setting_key_theme_color))
|
||||
themeColorPreference!!.setOnPreferenceChangeListener { _, _ ->
|
||||
refreshActivity(true)
|
||||
true
|
||||
}
|
||||
if (!DynamicColors.isDynamicColorAvailable()) {
|
||||
themeColorPreference.setEntryValues(R.array.color_values_no_dynamic)
|
||||
themeColorPreference.setEntries(R.array.color_value_strings_no_dynamic)
|
||||
}
|
||||
|
||||
private fun setupOledDarkPreference() {
|
||||
val oledDarkPreference = findPreference<Preference>(getString(R.string.settings_key_oled_dark))
|
||||
oledDarkPreference!!.setOnPreferenceChangeListener { _, _ ->
|
||||
refreshActivity(true)
|
||||
refreshActivity()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupLocalePreference() {
|
||||
val localePreference =
|
||||
findPreference<ListPreference>(getString(R.string.settings_key_locale))!!
|
||||
localePreference.let {
|
||||
@@ -159,7 +223,7 @@ class SettingsActivity : CatimaAppCompatActivity() {
|
||||
localePreference.setOnPreferenceChangeListener { _, newValue ->
|
||||
// See corresponding comment in Utils.updateBaseContextLocale for Android 6- notes
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||
refreshActivity(true)
|
||||
refreshActivity()
|
||||
return@setOnPreferenceChangeListener true
|
||||
}
|
||||
val newLocale = newValue as String
|
||||
@@ -167,20 +231,205 @@ class SettingsActivity : CatimaAppCompatActivity() {
|
||||
AppCompatDelegate.setApplicationLocales(if (newLocale.isEmpty()) LocaleListCompat.getEmptyLocaleList() else LocaleListCompat.create(Utils.stringToLocale(newLocale)))
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
// Disable content provider on SDK < 23 since dangerous permissions
|
||||
// are granted at install-time
|
||||
val contentProviderReadPreference = findPreference<Preference>(getString(R.string.settings_key_allow_content_provider_read))
|
||||
contentProviderReadPreference!!.isVisible =
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||
|
||||
private fun setupCrashReporterPreference() {
|
||||
// Hide crash reporter settings on builds it's not enabled on
|
||||
val crashReporterPreference = findPreference<Preference>("acra.enable")
|
||||
crashReporterPreference!!.isVisible = BuildConfig.useAcraCrashReporter
|
||||
}
|
||||
|
||||
private fun refreshActivity(reloadMain: Boolean) {
|
||||
mReloadMain = reloadMain || mReloadMain
|
||||
private fun setupWearSyncPreference() {
|
||||
val wearSyncPreference = findPreference<SwitchPreferenceCompat>(getString(R.string.settings_key_wear_sync))
|
||||
wearSyncPreference!!.setOnPreferenceChangeListener { preference, newValue ->
|
||||
val enabled = newValue as Boolean
|
||||
if (enabled) {
|
||||
wearSyncPermissionRequester.onWearSyncChanged(true) { granted ->
|
||||
if (granted) {
|
||||
(preference as? SwitchPreferenceCompat)?.isChecked = true
|
||||
} else {
|
||||
showWearSyncPermissionDeniedSnackbar()
|
||||
}
|
||||
}
|
||||
false
|
||||
} else {
|
||||
wearSyncPermissionRequester.onWearSyncChanged(false)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupWearSyncDevicePreferences() {
|
||||
val allowedPreference = findPreference<Preference>(getString(R.string.settings_key_wear_sync_devices))
|
||||
allowedPreference!!.setOnPreferenceClickListener {
|
||||
showWearSyncAllowedDevicesDialog()
|
||||
true
|
||||
}
|
||||
updateWearSyncAllowedDevicesSummary(allowedPreference)
|
||||
|
||||
val blockedPreference = findPreference<Preference>(getString(R.string.settings_key_wear_sync_blocked_devices))
|
||||
blockedPreference!!.setOnPreferenceClickListener {
|
||||
showWearSyncBlockedDevicesDialog()
|
||||
true
|
||||
}
|
||||
updateWearSyncBlockedDevicesSummary(blockedPreference)
|
||||
}
|
||||
|
||||
private fun updateWearSyncAllowedDevicesSummary(preference: Preference) {
|
||||
val count = WearBluetoothSecurity.listTrustedDevices(requireContext()).size
|
||||
preference.summary = if (count == 0) {
|
||||
getString(R.string.settings_wear_sync_no_devices)
|
||||
} else {
|
||||
resources.getQuantityString(R.plurals.settings_wear_sync_devices_summary_count, count, count)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateWearSyncBlockedDevicesSummary(preference: Preference) {
|
||||
val count = WearBluetoothSecurity.listBlockedDevices(requireContext()).size
|
||||
preference.summary = if (count == 0) {
|
||||
getString(R.string.settings_wear_sync_no_blocked_devices)
|
||||
} else {
|
||||
resources.getQuantityString(R.plurals.settings_wear_sync_blocked_devices_summary_count, count, count)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
private fun showWearSyncDeviceListDialog(
|
||||
titleRes: Int,
|
||||
noDevicesRes: Int,
|
||||
messageRes: Int,
|
||||
addresses: Set<String>,
|
||||
isBlocked: Boolean,
|
||||
onRemove: (String, String) -> Unit
|
||||
) {
|
||||
val context = requireContext()
|
||||
if (!BluetoothPermissionHelper.isBluetoothConnectGranted(context)) {
|
||||
showWearSyncPermissionDeniedSnackbar()
|
||||
return
|
||||
}
|
||||
val knownAddresses = addresses.toList()
|
||||
currentDevicesDialog?.dismiss()
|
||||
currentDevicesDialogIsBlocked = isBlocked
|
||||
if (knownAddresses.isEmpty()) {
|
||||
currentDevicesDialog = MaterialAlertDialogBuilder(context)
|
||||
.setTitle(titleRes)
|
||||
.setMessage(noDevicesRes)
|
||||
.setOnDismissListener {
|
||||
currentDevicesDialog = null
|
||||
currentDevicesDialogIsBlocked = false
|
||||
}
|
||||
.setPositiveButton(android.R.string.ok) { dialog, _ -> dialog.dismiss() }
|
||||
.show()
|
||||
return
|
||||
}
|
||||
|
||||
val adapter = context.getSystemService(BLUETOOTH_SERVICE) as? BluetoothManager
|
||||
val bondedDevices = try {
|
||||
adapter?.adapter?.bondedDevices ?: emptySet()
|
||||
} catch (_: SecurityException) {
|
||||
emptySet<BluetoothDevice>()
|
||||
}
|
||||
val deviceMap = bondedDevices.associateBy { it.address }
|
||||
|
||||
val content = View.inflate(context, R.layout.wear_sync_device_list, null)
|
||||
content.findViewById<TextView>(R.id.wear_sync_device_list_message).text = getString(messageRes)
|
||||
val container = content.findViewById<LinearLayout>(R.id.wear_sync_device_list_container)
|
||||
|
||||
knownAddresses.forEach { address ->
|
||||
val name = deviceName(deviceMap[address], address)
|
||||
val itemView = LayoutInflater.from(context).inflate(R.layout.wear_sync_device_list_item, container, false) as TextView
|
||||
itemView.text = getString(R.string.settings_wear_sync_device_name, name, address)
|
||||
itemView.setOnClickListener { onRemove(address, name) }
|
||||
container.addView(itemView)
|
||||
}
|
||||
|
||||
currentDevicesDialog = MaterialAlertDialogBuilder(context)
|
||||
.setTitle(titleRes)
|
||||
.setView(content)
|
||||
.setOnDismissListener {
|
||||
currentDevicesDialog = null
|
||||
currentDevicesDialogIsBlocked = false
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel) { dialog, _ -> dialog.dismiss() }
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun showWearSyncAllowedDevicesDialog() {
|
||||
showWearSyncDeviceListDialog(
|
||||
R.string.settings_wear_sync_devices,
|
||||
R.string.settings_wear_sync_no_devices,
|
||||
R.string.settings_wear_sync_tap_to_remove,
|
||||
WearBluetoothSecurity.listTrustedDevices(requireContext()),
|
||||
isBlocked = false
|
||||
) { address, name -> confirmRemoveAllowedDevice(address, name) }
|
||||
}
|
||||
|
||||
private fun showWearSyncBlockedDevicesDialog() {
|
||||
showWearSyncDeviceListDialog(
|
||||
R.string.settings_wear_sync_blocked_devices,
|
||||
R.string.settings_wear_sync_no_blocked_devices,
|
||||
R.string.settings_wear_sync_tap_to_remove,
|
||||
WearBluetoothSecurity.listBlockedDevices(requireContext()),
|
||||
isBlocked = true
|
||||
) { address, name -> confirmRemoveBlockedDevice(address, name) }
|
||||
}
|
||||
|
||||
private fun confirmRemoveAllowedDevice(address: String, name: String) {
|
||||
confirmRemoveDevice(
|
||||
address,
|
||||
name,
|
||||
R.string.settings_wear_sync_unpair_message,
|
||||
onRemove = { WearBluetoothSecurity.untrustDevice(requireContext(), address) }
|
||||
)
|
||||
}
|
||||
|
||||
private fun confirmRemoveBlockedDevice(address: String, name: String) {
|
||||
confirmRemoveDevice(
|
||||
address,
|
||||
name,
|
||||
R.string.settings_wear_sync_unblock_message,
|
||||
onRemove = { WearBluetoothSecurity.unblockDevice(requireContext(), address) }
|
||||
)
|
||||
}
|
||||
|
||||
private fun confirmRemoveDevice(address: String, name: String, messageRes: Int, onRemove: () -> Unit) {
|
||||
val context = requireContext()
|
||||
MaterialAlertDialogBuilder(context)
|
||||
.setTitle(R.string.settings_wear_sync_unpair_title)
|
||||
.setMessage(getString(messageRes, name))
|
||||
.setPositiveButton(R.string.settings_wear_sync_unpair) { dialog, _ ->
|
||||
onRemove()
|
||||
BluetoothPairingNotificationManager.cancel(context, address)
|
||||
BluetoothPairingNotificationManager.notifyDevicesChanged(context)
|
||||
findPreference<Preference>(getString(R.string.settings_key_wear_sync_devices))?.let { updateWearSyncAllowedDevicesSummary(it) }
|
||||
findPreference<Preference>(getString(R.string.settings_key_wear_sync_blocked_devices))?.let { updateWearSyncBlockedDevicesSummary(it) }
|
||||
dialog.dismiss()
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel) { dialog, _ -> dialog.dismiss() }
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun deviceName(device: BluetoothDevice?, fallback: String): String {
|
||||
return try { device?.name } catch (_: SecurityException) { null } ?: fallback
|
||||
}
|
||||
|
||||
private fun showWearSyncPermissionDeniedSnackbar() {
|
||||
Snackbar.make(
|
||||
requireView(),
|
||||
R.string.wear_sync_permission_required,
|
||||
Snackbar.LENGTH_LONG
|
||||
).setAction(R.string.open_settings) {
|
||||
startActivity(
|
||||
Intent(
|
||||
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
|
||||
Uri.fromParts("package", requireContext().packageName, null)
|
||||
)
|
||||
)
|
||||
}.show()
|
||||
}
|
||||
|
||||
private fun refreshActivity() {
|
||||
mReloadMain = true
|
||||
activity?.recreate()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package protect.card_locker.wearos
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import protect.card_locker.R
|
||||
import protect.card_locker.shared.WearBluetoothSecurity
|
||||
|
||||
class BluetoothPairingActivity : AppCompatActivity() {
|
||||
|
||||
private var currentDialog: AlertDialog? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
showPairingDialog(intent)
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
showPairingDialog(intent)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
currentDialog?.dismiss()
|
||||
currentDialog = null
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun showPairingDialog(intent: Intent) {
|
||||
val address = intent.getStringExtra(BluetoothPairingConstants.DEVICE_ADDRESS) ?: return finish()
|
||||
val deviceName = intent.getStringExtra(BluetoothPairingConstants.DEVICE_NAME) ?: address
|
||||
val token = intent.getStringExtra(BluetoothPairingConstants.DEVICE_TOKEN)
|
||||
val isMismatch = intent.getBooleanExtra(BluetoothPairingConstants.IS_MISMATCH, false)
|
||||
|
||||
val titleRes = if (isMismatch) {
|
||||
R.string.wear_bt_pairing_mismatch_title
|
||||
} else {
|
||||
R.string.wear_bt_pairing_title
|
||||
}
|
||||
val messageRes = if (isMismatch) {
|
||||
R.string.wear_bt_pairing_mismatch_message
|
||||
} else {
|
||||
R.string.wear_bt_pairing_message
|
||||
}
|
||||
|
||||
currentDialog?.dismiss()
|
||||
currentDialog = MaterialAlertDialogBuilder(this)
|
||||
.setTitle(getString(titleRes, deviceName))
|
||||
.setMessage(getString(messageRes, deviceName))
|
||||
.setPositiveButton(R.string.wear_bt_pairing_allow) { _, _ ->
|
||||
WearBluetoothSecurity.trustDevice(this, address, token)
|
||||
BluetoothPairingNotificationManager.updateResultNotification(this, address, deviceName, true)
|
||||
BluetoothPairingNotificationManager.notifyDevicesChanged(this)
|
||||
finish()
|
||||
}
|
||||
.setNegativeButton(R.string.wear_bt_pairing_block) { _, _ ->
|
||||
WearBluetoothSecurity.blockDevice(this, address)
|
||||
BluetoothPairingNotificationManager.updateResultNotification(this, address, deviceName, false)
|
||||
BluetoothPairingNotificationManager.notifyDevicesChanged(this)
|
||||
finish()
|
||||
}
|
||||
.setOnCancelListener { finish() }
|
||||
.setCancelable(true)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package protect.card_locker.wearos
|
||||
|
||||
object BluetoothPairingConstants {
|
||||
const val DEVICE_ADDRESS = "device_address"
|
||||
const val DEVICE_NAME = "device_name"
|
||||
const val DEVICE_TOKEN = "device_token"
|
||||
const val IS_MISMATCH = "is_mismatch"
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package protect.card_locker.wearos
|
||||
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.NotificationCompat
|
||||
import protect.card_locker.NotificationInfo
|
||||
import protect.card_locker.R
|
||||
|
||||
object BluetoothPairingNotificationManager {
|
||||
|
||||
const val ACTION_DEVICES_CHANGED = "protect.card_locker.wearos.ACTION_DEVICES_CHANGED"
|
||||
|
||||
fun notifyDevicesChanged(context: Context) {
|
||||
context.sendBroadcast(Intent(ACTION_DEVICES_CHANGED).apply { setPackage(context.packageName) })
|
||||
}
|
||||
|
||||
fun showAuthorizationNotification(
|
||||
context: Context,
|
||||
deviceName: String,
|
||||
address: String,
|
||||
token: String,
|
||||
isMismatch: Boolean = false
|
||||
) {
|
||||
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val channel = NotificationChannel(
|
||||
NotificationInfo.WearBluetooth.PAIRING_CHANNEL_ID,
|
||||
context.getString(R.string.wear_bt_pairing_channel_name),
|
||||
NotificationManager.IMPORTANCE_HIGH
|
||||
)
|
||||
notificationManager.createNotificationChannel(channel)
|
||||
}
|
||||
|
||||
val titleRes = if (isMismatch) {
|
||||
R.string.wear_bt_pairing_mismatch_title
|
||||
} else {
|
||||
R.string.wear_bt_pairing_title
|
||||
}
|
||||
val messageRes = if (isMismatch) {
|
||||
R.string.wear_bt_pairing_mismatch_message
|
||||
} else {
|
||||
R.string.wear_bt_pairing_message
|
||||
}
|
||||
|
||||
val allowIntent = Intent(context, BluetoothPairingReceiver::class.java).apply {
|
||||
action = BluetoothPairingReceiver.ACTION_ALLOW
|
||||
putExtra(BluetoothPairingConstants.DEVICE_ADDRESS, address)
|
||||
putExtra(BluetoothPairingConstants.DEVICE_NAME, deviceName)
|
||||
putExtra(BluetoothPairingConstants.DEVICE_TOKEN, token)
|
||||
}
|
||||
val blockIntent = Intent(context, BluetoothPairingReceiver::class.java).apply {
|
||||
action = BluetoothPairingReceiver.ACTION_BLOCK
|
||||
putExtra(BluetoothPairingConstants.DEVICE_ADDRESS, address)
|
||||
putExtra(BluetoothPairingConstants.DEVICE_NAME, deviceName)
|
||||
putExtra(BluetoothPairingConstants.IS_MISMATCH, isMismatch)
|
||||
}
|
||||
|
||||
val allowPendingIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
address.hashCode(),
|
||||
allowIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
val blockPendingIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
address.hashCode() + 1,
|
||||
blockIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
val contentIntent = PendingIntent.getActivity(
|
||||
context,
|
||||
address.hashCode() + 2,
|
||||
Intent(context, BluetoothPairingActivity::class.java).apply {
|
||||
putExtra(BluetoothPairingConstants.DEVICE_ADDRESS, address)
|
||||
putExtra(BluetoothPairingConstants.DEVICE_NAME, deviceName)
|
||||
putExtra(BluetoothPairingConstants.DEVICE_TOKEN, token)
|
||||
putExtra(BluetoothPairingConstants.IS_MISMATCH, isMismatch)
|
||||
},
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
val notification = NotificationCompat.Builder(context, NotificationInfo.WearBluetooth.PAIRING_CHANNEL_ID)
|
||||
.setSmallIcon(R.drawable.ic_notification_catima)
|
||||
.setContentTitle(context.getString(titleRes, deviceName))
|
||||
.setContentText(context.getString(messageRes, deviceName))
|
||||
.setStyle(NotificationCompat.BigTextStyle().bigText(context.getString(messageRes, deviceName)))
|
||||
.addAction(0, context.getString(R.string.wear_bt_pairing_allow), allowPendingIntent)
|
||||
.addAction(0, context.getString(R.string.wear_bt_pairing_block), blockPendingIntent)
|
||||
.setContentIntent(contentIntent)
|
||||
.setAutoCancel(false)
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.build()
|
||||
|
||||
notificationManager.notify(notificationId(address), notification)
|
||||
}
|
||||
|
||||
fun cancel(context: Context, address: String) {
|
||||
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationManager.cancel(notificationId(address))
|
||||
}
|
||||
|
||||
fun updateResultNotification(context: Context, address: String, deviceName: String, allowed: Boolean) {
|
||||
cancel(context, address)
|
||||
val message = if (allowed) {
|
||||
context.getString(R.string.wear_bt_pairing_allowed, deviceName)
|
||||
} else {
|
||||
context.getString(R.string.wear_bt_pairing_blocked, deviceName)
|
||||
}
|
||||
|
||||
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
fun notificationId(address: String): Int = address.hashCode()
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package protect.card_locker.wearos
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import protect.card_locker.shared.WearBluetoothSecurity
|
||||
|
||||
class BluetoothPairingReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val address = intent.getStringExtra(BluetoothPairingConstants.DEVICE_ADDRESS) ?: return
|
||||
val deviceName = intent.getStringExtra(BluetoothPairingConstants.DEVICE_NAME) ?: address
|
||||
val token = intent.getStringExtra(BluetoothPairingConstants.DEVICE_TOKEN)
|
||||
|
||||
when (intent.action) {
|
||||
ACTION_ALLOW -> {
|
||||
WearBluetoothSecurity.trustDevice(context, address, token)
|
||||
BluetoothPairingNotificationManager.updateResultNotification(context, address, deviceName, true)
|
||||
BluetoothPairingNotificationManager.notifyDevicesChanged(context)
|
||||
}
|
||||
ACTION_BLOCK -> {
|
||||
WearBluetoothSecurity.blockDevice(context, address)
|
||||
BluetoothPairingNotificationManager.updateResultNotification(context, address, deviceName, false)
|
||||
BluetoothPairingNotificationManager.notifyDevicesChanged(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val ACTION_ALLOW = "protect.card_locker.wearos.action.ALLOW_DEVICE"
|
||||
const val ACTION_BLOCK = "protect.card_locker.wearos.action.BLOCK_DEVICE"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
package protect.card_locker.wearos
|
||||
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.app.Service
|
||||
import android.bluetooth.BluetoothAdapter
|
||||
import android.bluetooth.BluetoothManager
|
||||
import android.bluetooth.BluetoothServerSocket
|
||||
import android.bluetooth.BluetoothSocket
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import protect.card_locker.DBHelper
|
||||
import protect.card_locker.NotificationInfo
|
||||
import protect.card_locker.R
|
||||
import protect.card_locker.Utils
|
||||
import protect.card_locker.shared.BluetoothPermissionHelper
|
||||
import protect.card_locker.shared.WearBluetoothProtocol
|
||||
import protect.card_locker.shared.WearBluetoothSecurity
|
||||
import java.io.BufferedReader
|
||||
import java.io.IOException
|
||||
import java.io.InputStreamReader
|
||||
import java.io.OutputStreamWriter
|
||||
import java.io.PrintWriter
|
||||
|
||||
class BluetoothServerService : Service() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "CatimaBtServer"
|
||||
private const val NOTIFICATION_ID = NotificationInfo.WearBluetooth.NOTIFICATION_ID
|
||||
private const val CHANNEL_ID = NotificationInfo.WearBluetooth.CHANNEL_ID
|
||||
}
|
||||
|
||||
private var serverThread: AcceptThread? = null
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
if (!BluetoothPermissionHelper.isBluetoothConnectGranted(this)) {
|
||||
Log.w(TAG, "BLUETOOTH_CONNECT permission not granted, stopping")
|
||||
stopSelf()
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
val adapter = (getSystemService(BLUETOOTH_SERVICE) as? BluetoothManager)?.adapter
|
||||
if (adapter == null || !adapter.isEnabled) {
|
||||
Log.w(TAG, "Bluetooth not available or disabled")
|
||||
stopSelf()
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
|
||||
// Avoid tearing down a working accept socket every time Settings is resumed.
|
||||
if (serverThread?.isAlive == true) {
|
||||
Log.d(TAG, "Bluetooth server already listening")
|
||||
return START_STICKY
|
||||
}
|
||||
|
||||
startForegroundWithNotification()
|
||||
serverThread?.cancel()
|
||||
serverThread = AcceptThread(adapter).also { it.start() }
|
||||
Log.d(TAG, "Bluetooth server started")
|
||||
return START_STICKY
|
||||
}
|
||||
|
||||
private fun startForegroundWithNotification() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val channel = NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
getString(R.string.wear_bt_channel_name),
|
||||
NotificationManager.IMPORTANCE_MIN
|
||||
).apply { setShowBadge(false) }
|
||||
getSystemService(NotificationManager::class.java).createNotificationChannel(channel)
|
||||
}
|
||||
val notification = NotificationCompat.Builder(this, CHANNEL_ID)
|
||||
.setContentTitle(getString(R.string.wear_bt_notification_title))
|
||||
.setSmallIcon(R.drawable.ic_notification_sync)
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.setSilent(true)
|
||||
.build()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
startForeground(NOTIFICATION_ID, notification,
|
||||
android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE)
|
||||
} else {
|
||||
startForeground(NOTIFICATION_ID, notification)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
serverThread?.cancel()
|
||||
serverThread = null
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
private inner class AcceptThread(adapter: BluetoothAdapter) : Thread() {
|
||||
private var serverSocket: BluetoothServerSocket? = null
|
||||
@Volatile private var running = true
|
||||
|
||||
init {
|
||||
try {
|
||||
if (BluetoothPermissionHelper.isBluetoothConnectGranted(this@BluetoothServerService)) {
|
||||
serverSocket = adapter.listenUsingRfcommWithServiceRecord(
|
||||
WearBluetoothProtocol.BT_SERVICE_NAME,
|
||||
WearBluetoothProtocol.BT_SERVICE_UUID
|
||||
)
|
||||
} else {
|
||||
Log.w(TAG, "BLUETOOTH_CONNECT permission missing, cannot open server socket")
|
||||
running = false
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
Log.e(TAG, "BLUETOOTH_CONNECT permission missing, cannot create server socket", e)
|
||||
running = false
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to create server socket", e)
|
||||
running = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun run() {
|
||||
Log.d(TAG, "Listening for Bluetooth connections")
|
||||
while (running) {
|
||||
val socket: BluetoothSocket = try {
|
||||
serverSocket?.accept() ?: break
|
||||
} catch (e: Exception) {
|
||||
if (running) Log.e(TAG, "Accept failed", e)
|
||||
break
|
||||
}
|
||||
// Handle each client on its own thread so a slow/stuck client
|
||||
// cannot block the accept loop.
|
||||
Thread { handleConnection(socket) }.start()
|
||||
}
|
||||
Log.d(TAG, "Accept loop ended")
|
||||
if (running) {
|
||||
Log.w(TAG, "Accept loop exited unexpectedly, restarting service")
|
||||
stopSelf()
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleConnection(socket: BluetoothSocket) {
|
||||
val address = try { socket.remoteDevice.address } catch (_: SecurityException) { null } ?: return
|
||||
val deviceName = try { socket.remoteDevice.name } catch (_: SecurityException) { address }
|
||||
Log.d(TAG, "Connected to $deviceName ($address)")
|
||||
try {
|
||||
val reader = BufferedReader(InputStreamReader(socket.inputStream, "UTF-8"))
|
||||
val writer = PrintWriter(OutputStreamWriter(socket.outputStream, "UTF-8"), false)
|
||||
val firstLine = reader.readLine()?.trim() ?: return
|
||||
|
||||
if (firstLine == WearBluetoothProtocol.BT_CMD_VERSIONS) {
|
||||
val versions = JSONArray().put("${WearBluetoothProtocol.PROTOCOL_VERSION}.${WearBluetoothProtocol.PROTOCOL_MINOR_VERSION}").toString()
|
||||
writer.println(versions)
|
||||
writer.flush()
|
||||
Log.d(TAG, "Sent supported versions to $deviceName: $versions")
|
||||
return
|
||||
}
|
||||
|
||||
var commandLine: String? = firstLine
|
||||
while (commandLine != null) {
|
||||
val command = commandLine
|
||||
Log.d(TAG, "Received command: $command from $deviceName")
|
||||
|
||||
if (!command.startsWith(WearBluetoothProtocol.BT_CMD_VERSION_PREFIX)) {
|
||||
notAuthorized(writer)
|
||||
Log.w(TAG, "Unsupported command from $deviceName: $command")
|
||||
break
|
||||
}
|
||||
|
||||
val tokenLine = reader.readLine()?.trim()
|
||||
if (tokenLine == null || !tokenLine.startsWith(WearBluetoothProtocol.BT_CMD_TOKEN_PREFIX)) {
|
||||
notAuthorized(writer)
|
||||
Log.w(TAG, "Malformed token line from $deviceName: $tokenLine")
|
||||
break
|
||||
}
|
||||
val token = tokenLine.removePrefix(WearBluetoothProtocol.BT_CMD_TOKEN_PREFIX)
|
||||
|
||||
val isTrusted = WearBluetoothSecurity.isDeviceTrusted(this@BluetoothServerService, address)
|
||||
val storedToken = WearBluetoothSecurity.getDeviceToken(this@BluetoothServerService, address)
|
||||
val tokenMatches = storedToken != null && storedToken == token
|
||||
|
||||
when {
|
||||
WearBluetoothSecurity.isDeviceBlocked(this@BluetoothServerService, address) -> {
|
||||
notAuthorized(writer)
|
||||
Log.w(TAG, "Rejected blocked device $deviceName")
|
||||
break
|
||||
}
|
||||
isTrusted && tokenMatches -> {
|
||||
if (!serveCommand(writer, deviceName, command)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
isTrusted && !tokenMatches -> {
|
||||
BluetoothPairingNotificationManager.showAuthorizationNotification(
|
||||
this@BluetoothServerService,
|
||||
deviceName,
|
||||
address,
|
||||
token,
|
||||
isMismatch = true
|
||||
)
|
||||
notAuthorized(writer)
|
||||
Log.w(TAG, "Token mismatch for $deviceName")
|
||||
break
|
||||
}
|
||||
else -> {
|
||||
BluetoothPairingNotificationManager.showAuthorizationNotification(
|
||||
this@BluetoothServerService,
|
||||
deviceName,
|
||||
address,
|
||||
token,
|
||||
isMismatch = false
|
||||
)
|
||||
notAuthorized(writer)
|
||||
Log.d(TAG, "Requested authorization for $deviceName")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
commandLine = reader.readLine()?.trim()
|
||||
}
|
||||
} catch (_: IOException) {
|
||||
// Client closed the socket; this is a normal end-of-stream after
|
||||
// the watch has received the pages it needs.
|
||||
Log.d(TAG, "Connection closed by $deviceName")
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Error handling connection from $deviceName", e)
|
||||
} finally {
|
||||
try { socket.close() } catch (_: Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
private fun notAuthorized(writer: PrintWriter) {
|
||||
writer.println(WearBluetoothProtocol.BT_RESPONSE_NOT_AUTHORIZED)
|
||||
writer.flush()
|
||||
}
|
||||
|
||||
private fun serveCommand(
|
||||
writer: PrintWriter,
|
||||
deviceName: String,
|
||||
command: String
|
||||
): Boolean {
|
||||
when {
|
||||
command.startsWith(WearBluetoothProtocol.BT_CMD_CARDS_PAGE_PREFIX) -> {
|
||||
val pageIndex = command.removePrefix(WearBluetoothProtocol.BT_CMD_CARDS_PAGE_PREFIX).toIntOrNull()
|
||||
if (pageIndex == null || pageIndex < 0) {
|
||||
Log.w(TAG, "Invalid page index from $deviceName: $command")
|
||||
notAuthorized(writer)
|
||||
return false
|
||||
}
|
||||
val json = buildCardsPageJson(pageIndex)
|
||||
writer.println(json)
|
||||
writer.flush()
|
||||
Log.d(TAG, "Sent page $pageIndex to $deviceName")
|
||||
return true
|
||||
}
|
||||
else -> {
|
||||
Log.w(TAG, "Unsupported command from $deviceName: $command")
|
||||
notAuthorized(writer)
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildCardsPageJson(pageIndex: Int): String {
|
||||
val dbHelper = DBHelper(this@BluetoothServerService)
|
||||
val db = dbHelper.readableDatabase
|
||||
val order = Utils.getLoyaltyCardOrder(this@BluetoothServerService)
|
||||
val orderDirection = Utils.getLoyaltyCardOrderDirection(this@BluetoothServerService)
|
||||
val cursor = DBHelper.getLoyaltyCardCursor(
|
||||
db, "", null, order, orderDirection,
|
||||
DBHelper.LoyaltyCardArchiveFilter.Unarchived
|
||||
)
|
||||
val totalCards = cursor.count
|
||||
val totalPages = if (totalCards == 0) 1 else (totalCards + WearBluetoothProtocol.PAGE_SIZE - 1) / WearBluetoothProtocol.PAGE_SIZE
|
||||
val offset = pageIndex * WearBluetoothProtocol.PAGE_SIZE
|
||||
val array = JSONArray()
|
||||
cursor.use {
|
||||
if (it.move(offset + 1)) {
|
||||
val idIdx = it.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.ID)
|
||||
val storeIdx = it.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.STORE)
|
||||
val cardIdIdx = it.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.CARD_ID)
|
||||
val barcodeIdIdx = it.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.BARCODE_ID)
|
||||
val barcodeTypeIdx = it.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.BARCODE_TYPE)
|
||||
val headerColorIdx = it.getColumnIndexOrThrow(DBHelper.LoyaltyCardDbIds.HEADER_COLOR)
|
||||
var count = 0
|
||||
do {
|
||||
array.put(JSONObject().apply {
|
||||
put("id", it.getInt(idIdx))
|
||||
put("store", it.getString(storeIdx) ?: "")
|
||||
put("cardId", it.getString(cardIdIdx) ?: "")
|
||||
put("barcodeId", if (it.isNull(barcodeIdIdx)) JSONObject.NULL else it.getString(barcodeIdIdx))
|
||||
put("barcodeType", if (it.isNull(barcodeTypeIdx)) JSONObject.NULL else it.getString(barcodeTypeIdx))
|
||||
put("headerColor", if (it.isNull(headerColorIdx)) JSONObject.NULL else it.getInt(headerColorIdx))
|
||||
})
|
||||
count++
|
||||
} while (count < WearBluetoothProtocol.PAGE_SIZE && it.moveToNext())
|
||||
}
|
||||
}
|
||||
return JSONObject().apply {
|
||||
put("page", pageIndex)
|
||||
put("totalPages", totalPages)
|
||||
put("cards", array)
|
||||
}.toString()
|
||||
}
|
||||
|
||||
fun cancel() {
|
||||
running = false
|
||||
try { serverSocket?.close() } catch (_: Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package protect.card_locker.wearos
|
||||
|
||||
import android.Manifest
|
||||
import android.app.ForegroundServiceStartNotAllowedException
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import androidx.activity.result.ActivityResultCaller
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.edit
|
||||
import androidx.preference.PreferenceManager
|
||||
import protect.card_locker.NotificationInfo
|
||||
import protect.card_locker.R
|
||||
import protect.card_locker.preferences.Settings
|
||||
import protect.card_locker.shared.BluetoothPermissionHelper
|
||||
|
||||
class WearSyncPermissionRequester(
|
||||
caller: ActivityResultCaller,
|
||||
context: Context
|
||||
) {
|
||||
private val context = context.applicationContext
|
||||
private var pendingResultCallback: ((Boolean) -> Unit)? = null
|
||||
|
||||
private val permissionLauncher = caller.registerForActivityResult(
|
||||
ActivityResultContracts.RequestMultiplePermissions()
|
||||
) { results ->
|
||||
val allGranted = results.all { it.value }
|
||||
pendingResultCallback?.invoke(allGranted)
|
||||
WearSyncServiceManager.onPermissionResult(this.context, allGranted)
|
||||
pendingResultCallback = null
|
||||
}
|
||||
|
||||
fun synchronize() {
|
||||
WearSyncServiceManager.synchronize(context) {
|
||||
permissionLauncher.launch(getRequiredPermissions())
|
||||
}
|
||||
}
|
||||
|
||||
fun onWearSyncChanged(enabled: Boolean, onPermissionResult: ((Boolean) -> Unit)? = null) {
|
||||
val applied = WearSyncServiceManager.onWearSyncChanged(context, enabled) {
|
||||
pendingResultCallback = onPermissionResult
|
||||
permissionLauncher.launch(getRequiredPermissions())
|
||||
}
|
||||
if (applied) {
|
||||
onPermissionResult?.invoke(true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getRequiredPermissions(): Array<String> = buildList {
|
||||
if (BluetoothPermissionHelper.isBluetoothConnectRequired()) {
|
||||
add(Manifest.permission.BLUETOOTH_CONNECT)
|
||||
}
|
||||
if (BluetoothPermissionHelper.isPostNotificationsRequired()) {
|
||||
add(Manifest.permission.POST_NOTIFICATIONS)
|
||||
}
|
||||
}.toTypedArray()
|
||||
}
|
||||
|
||||
object WearSyncServiceManager {
|
||||
private const val TAG = "CatimaWearSyncServiceManager"
|
||||
|
||||
fun synchronize(context: Context, requestPermission: (() -> Unit)? = null) {
|
||||
if (!Settings(context).wearSyncEnabled) {
|
||||
stop(context)
|
||||
} else if (arePermissionsGranted(context)) {
|
||||
start(context)
|
||||
} else if (requestPermission != null) {
|
||||
requestPermission()
|
||||
} else {
|
||||
stop(context)
|
||||
}
|
||||
}
|
||||
|
||||
fun onWearSyncChanged(
|
||||
context: Context,
|
||||
enabled: Boolean,
|
||||
requestPermission: () -> Unit
|
||||
): Boolean {
|
||||
return if (enabled) {
|
||||
if (arePermissionsGranted(context)) {
|
||||
start(context)
|
||||
true
|
||||
} else {
|
||||
requestPermission()
|
||||
false
|
||||
}
|
||||
} else {
|
||||
stop(context)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun arePermissionsGranted(context: Context): Boolean {
|
||||
return BluetoothPermissionHelper.isBluetoothConnectGranted(context) &&
|
||||
BluetoothPermissionHelper.isPostNotificationsGranted(context)
|
||||
}
|
||||
|
||||
fun onPermissionResult(context: Context, granted: Boolean) {
|
||||
if (granted && Settings(context).wearSyncEnabled) {
|
||||
start(context)
|
||||
} else {
|
||||
stop(context)
|
||||
if (!granted) {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit {
|
||||
putBoolean(context.getString(R.string.settings_key_wear_sync), false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun start(context: Context) {
|
||||
// Exception can only throw on API level 31 and up
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
try {
|
||||
ContextCompat.startForegroundService(
|
||||
context,
|
||||
Intent(context, BluetoothServerService::class.java)
|
||||
)
|
||||
} catch (e: ForegroundServiceStartNotAllowedException) {
|
||||
// We naively assume we have enough permissions to show a notification as the service should never try to start
|
||||
// before the user gave notification access anyway
|
||||
Log.d(TAG, "Foreground service failed to launch: $e")
|
||||
val channel = NotificationChannel(
|
||||
NotificationInfo.WearBluetooth.CRITICAL_ERROR_CHANNEL_ID,
|
||||
context.getString(R.string.wear_bt_critical_error_channel_name),
|
||||
NotificationManager.IMPORTANCE_HIGH
|
||||
).apply { setShowBadge(false) }
|
||||
context.getSystemService(NotificationManager::class.java).createNotificationChannel(channel)
|
||||
val notification = NotificationCompat.Builder(context, NotificationInfo.WearBluetooth.CRITICAL_ERROR_CHANNEL_ID)
|
||||
.setSmallIcon(R.drawable.ic_notification_error)
|
||||
.setContentTitle(context.getString(R.string.wear_bt_failed_foreground_notification_title))
|
||||
.setContentText(e.message)
|
||||
.build()
|
||||
with(NotificationManagerCompat.from(context)) {
|
||||
if (ActivityCompat.checkSelfPermission(
|
||||
context,
|
||||
Manifest.permission.POST_NOTIFICATIONS
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
return@with
|
||||
}
|
||||
notify(
|
||||
NotificationInfo.WearBluetooth.CRITICAL_ERROR_NOTIFICATION_ID,
|
||||
notification
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ContextCompat.startForegroundService(
|
||||
context,
|
||||
Intent(context, BluetoothServerService::class.java)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun stop(context: Context) {
|
||||
context.stopService(Intent(context, BluetoothServerService::class.java))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<!--
|
||||
~ Copyright (C) 2026 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="#FFFFFF">
|
||||
<group android:scaleX="1.104"
|
||||
android:scaleY="1.104"
|
||||
android:translateX="-49.92"
|
||||
android:translateY="-49.92">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M508.5,668.5Q520,657 520,640Q520,623 508.5,611.5Q497,600 480,600Q463,600 451.5,611.5Q440,623 440,640Q440,657 451.5,668.5Q463,680 480,680Q497,680 508.5,668.5ZM440,520L520,520L520,280L440,280L440,520ZM480,880Q397,880 324,848.5Q251,817 197,763Q143,709 111.5,636Q80,563 80,480Q80,397 111.5,324Q143,251 197,197Q251,143 324,111.5Q397,80 480,80Q563,80 636,111.5Q709,143 763,197Q817,251 848.5,324Q880,397 880,480Q880,563 848.5,636Q817,709 763,763Q709,817 636,848.5Q563,880 480,880ZM480,800Q614,800 707,707Q800,614 800,480Q800,346 707,253Q614,160 480,160Q346,160 253,253Q160,346 160,480Q160,614 253,707Q346,800 480,800ZM480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Z"/>
|
||||
</group>
|
||||
</vector>
|
||||
@@ -0,0 +1,30 @@
|
||||
<!--
|
||||
~ Copyright (C) 2026 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="#FFFFFF">
|
||||
<group android:scaleX="0.92"
|
||||
android:scaleY="0.92"
|
||||
android:translateX="38.4"
|
||||
android:translateY="38.4">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M160,800L160,720L270,720L254,706Q202,660 181,601Q160,542 160,482Q160,371 226.5,284.5Q293,198 400,170L400,254Q328,280 284,342.5Q240,405 240,482Q240,527 257,569.5Q274,612 310,648L320,658L320,560L400,560L400,800L160,800ZM560,790L560,706Q632,680 676,617.5Q720,555 720,478Q720,433 703,390.5Q686,348 650,312L640,302L640,400L560,400L560,160L800,160L800,240L690,240L706,254Q755,303 777.5,360.5Q800,418 800,478Q800,589 733.5,675.5Q667,762 560,790Z"/>
|
||||
</group>
|
||||
</vector>
|
||||
|
After Width: | Height: | Size: 790 B |
|
After Width: | Height: | Size: 752 B |
|
After Width: | Height: | Size: 499 B |
|
After Width: | Height: | Size: 509 B |
|
After Width: | Height: | Size: 478 B |
|
After Width: | Height: | Size: 346 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 919 B |
|
After Width: | Height: | Size: 656 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 918 B |
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M2,6h2v12L2,18L2,6zM5,6h1v12L5,18L5,6zM7,6h3v12L7,18L7,6zM11,6h1v12h-1L11,6zM13,6h2v12h-2L13,6zM16,6h2v12h-2L16,6zM19,6h1v12h-1L19,6zM21,6h1v12h-1L21,6z"/>
|
||||
</vector>
|
||||
@@ -1,421 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="protect.card_locker.MainActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
style="?attr/toolbarStyle" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:paddingVertical="8dp"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/version_history"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/version_history_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/version_history"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/version_history_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/version_history_main" />
|
||||
|
||||
<TextView
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/arrow"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/credits"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/credits_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/credits"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/credits_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/credits_main" />
|
||||
|
||||
<TextView
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/arrow"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/translate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/translate_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/help_translate_this_app"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/translate_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/translate_platform"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/translate_main"/>
|
||||
|
||||
<TextView
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/arrow"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/license"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/license_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/license"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/license_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/app_license"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/license_main"/>
|
||||
|
||||
<TextView
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/arrow"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/repo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/repo_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/source_repository"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/repo_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/on_github"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/repo_main" />
|
||||
|
||||
<TextView
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/arrow"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/privacy"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/privacy_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/privacy_policy"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/privacy_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/and_data_usage"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/privacy_main" />
|
||||
|
||||
<TextView
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/arrow"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/donate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/donate_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/donate"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/arrow"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/rate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rate_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/rate_this_app"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rate_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/on_google_play"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/rate_main" />
|
||||
|
||||
<TextView
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/arrow"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/report_error"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="?android:selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/report_error_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:text="@string/report_error"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/report_error_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/report_error_main"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/on_github" />
|
||||
|
||||
<TextView
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/arrow"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -109,7 +109,8 @@
|
||||
android:id="@+id/storeNameEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
android:singleLine="true"
|
||||
android:inputType="textCapWords" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
@@ -191,6 +192,32 @@
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Barcode encoding -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/inputPadding"
|
||||
android:paddingTop="@dimen/inputPadding"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- Barcode type -->
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/barcodeEncodingView"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:hint="@string/barcodeEncoding"
|
||||
android:labelFor="@+id/barcodeEncodingField">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/barcodeEncodingField"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="none"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Barcode -->
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_marginTop="10.0dp"
|
||||
|
||||
@@ -158,10 +158,31 @@
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintTop_toBottomOf="@+id/note"
|
||||
app:layout_constraintBottom_toTopOf="@+id/balance"
|
||||
app:layout_constraintBottom_toTopOf="@+id/cardId"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cardId"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:textAppearance="?attr/textAppearanceBody2"
|
||||
app:drawableLeftCompat="@drawable/ic_card_id_24dp"
|
||||
android:drawablePadding="4dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/info_divider"
|
||||
app:layout_constraintBottom_toTopOf="@+id/balance"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:visibility="visible"
|
||||
tools:text="1234567890"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/balance"
|
||||
android:layout_width="match_parent"
|
||||
@@ -174,7 +195,7 @@
|
||||
app:drawableLeftCompat="@drawable/ic_baseline_payments_24"
|
||||
android:drawablePadding="4dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/info_divider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardId"
|
||||
app:layout_constraintBottom_toTopOf="@+id/validFrom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/wear_sync_device_list_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wear_sync_device_list_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="?attr/dialogPreferredPadding"
|
||||
android:paddingEnd="?attr/dialogPreferredPadding"
|
||||
style="?attr/materialAlertDialogBodyTextStyle" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/listPreferredItemHeightSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="?attr/listPreferredItemPaddingLeft"
|
||||
android:paddingEnd="?attr/listPreferredItemPaddingRight"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
style="?attr/materialAlertDialogBodyTextStyle" />
|
||||
@@ -40,10 +40,16 @@
|
||||
android:titleCondensed="@string/unarchive"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_duplicate"
|
||||
android:title="@string/duplicateCard"
|
||||
android:titleCondensed="@string/duplicateCard"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_delete"
|
||||
android:icon="@drawable/ic_delete_white_24dp"
|
||||
android:title="@string/delete"
|
||||
android:titleCondensed="@string/delete"
|
||||
app:showAsAction="never"/>
|
||||
</menu>
|
||||
</menu>
|
||||
@@ -21,25 +21,25 @@
|
||||
app:showAsAction="always">
|
||||
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/action_archive"
|
||||
android:title="@string/archive"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_unarchive"
|
||||
android:title="@string/unarchive"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_duplicate"
|
||||
android:title="@string/duplicateCard"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_archive"
|
||||
android:title="@string/archive"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/action_unarchive"
|
||||
android:title="@string/unarchive"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/action_delete"
|
||||
android:title="@string/delete"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
|
||||
</item>
|
||||
|
||||
@@ -3,97 +3,109 @@ Branden Archer
|
||||
J. Lavoie
|
||||
solokot
|
||||
Allan Nordhøy
|
||||
Heimen Stoffels
|
||||
Oğuz Ersen
|
||||
FC (Fay) Stegerman
|
||||
StoyanDimitrov
|
||||
大王叫我来巡山
|
||||
SlavekB
|
||||
Katharine Chui
|
||||
Heimen Stoffels
|
||||
B o d o
|
||||
FC (Fay) Stegerman
|
||||
大王叫我来巡山
|
||||
StoyanDimitrov
|
||||
SlavekB
|
||||
Katharine Chui / Katie
|
||||
Silvério Santos
|
||||
mondstern
|
||||
IllusiveMan196
|
||||
Silvério Santos
|
||||
Altonss
|
||||
Edgars Andersons
|
||||
Joel A
|
||||
Michael Moroni
|
||||
Liner Seven
|
||||
Priit Jõerüüt
|
||||
Eric
|
||||
Максим Горпиніч
|
||||
GitSpoon
|
||||
GM
|
||||
Edgars Andersons
|
||||
Liner Seven
|
||||
Fjuro
|
||||
laralem
|
||||
GitSpoon
|
||||
Joel A
|
||||
Altonss
|
||||
Priit Jõerüüt
|
||||
Michael Moroni
|
||||
Eric
|
||||
GM
|
||||
Petr Novák
|
||||
laralem
|
||||
Vasilis
|
||||
Taco
|
||||
Milo Ivir
|
||||
nadiafekihahmed
|
||||
pfaffenrodt
|
||||
Aayush Gupta
|
||||
damjang
|
||||
Scrambled777
|
||||
josé m
|
||||
ikanakova
|
||||
Nyatsuki
|
||||
Giovanni Donisi
|
||||
Milo Ivir
|
||||
HudobniVolk
|
||||
Горпиніч Максим Олександрович
|
||||
Vasilis
|
||||
Kachelkaiser
|
||||
Jiri Grönroos
|
||||
Giovanni Donisi
|
||||
Kachelkaiser
|
||||
109247019824
|
||||
HudobniVolk
|
||||
Warder
|
||||
Samantaz Fox
|
||||
Balázs Meskó
|
||||
Traductor
|
||||
Samantaz Fox
|
||||
mdvhimself
|
||||
AMIR-G98
|
||||
Cliff Heraldo
|
||||
Sergio Paredes
|
||||
Ankit Tiwari
|
||||
Feike
|
||||
Arno-github
|
||||
Feike Donia
|
||||
109247019824
|
||||
Jose Delvani
|
||||
mdvhimself
|
||||
Milan Šalka
|
||||
Robin
|
||||
தமிழ்நேரம்
|
||||
damjang
|
||||
Govindgopalyadav
|
||||
Skrripy
|
||||
huuhaa
|
||||
Skrripy
|
||||
NooB9496
|
||||
Govindgopalyadav
|
||||
Gideon
|
||||
waffshappen
|
||||
Marnick L'Eau
|
||||
JungHee Lee
|
||||
pacavarn
|
||||
ngocanhtve
|
||||
aradxxx
|
||||
Watchman89
|
||||
StellarSand
|
||||
Quentin PAGÈS
|
||||
Projjal Moitra
|
||||
Aliaksandr Trush
|
||||
e-michalak
|
||||
JungHee Lee
|
||||
தமிழ் நேரம்
|
||||
josé m.
|
||||
hajertabbane
|
||||
inavleb
|
||||
Ziad OUALHADJ
|
||||
Aliaksandr Trush
|
||||
Denis Shilin
|
||||
Renko
|
||||
Ricky Tigg
|
||||
Robin Liu
|
||||
Ricky Tigg
|
||||
Renko
|
||||
Denis Shilin
|
||||
しいたけ
|
||||
Alexander Ivanov
|
||||
Miha Frangež
|
||||
stavpup
|
||||
mrestivill
|
||||
ehrt74
|
||||
Virginie
|
||||
Thu-Trang Pham
|
||||
Tim Trek
|
||||
Peter Dave Hello
|
||||
MisterCosta96
|
||||
Virginie
|
||||
dukezas
|
||||
ehrt74
|
||||
ezn24
|
||||
mrestivill
|
||||
stavpup
|
||||
Miha Frangež
|
||||
Alì Mortacci
|
||||
Andre Costa
|
||||
arshbeerSingh
|
||||
Augustin LAVILLE
|
||||
Traductor
|
||||
Freddo espresso
|
||||
Gideon
|
||||
vasudev-cell
|
||||
Govind S Nair
|
||||
Kim Seohyun
|
||||
Libre
|
||||
echo r"0xX4H" | rev
|
||||
rudy3
|
||||
Michael Gangolf
|
||||
PRATHAMESH BHAGAT
|
||||
Peter Dave Hello
|
||||
Thomas Bertels
|
||||
@@ -1,40 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" xmlns:tools="http://schemas.android.com/tools">
|
||||
<string name="action_search">بحث</string>
|
||||
<string name="action_add">أضف</string>
|
||||
<string name="noGiftCards">اضغط على زر الإضافة + لإضافة بطاقة، أو استورد من القائمة خلال ⋮</string>
|
||||
<string name="noMatchingGiftCards">لا نتائج. حاول تغيير كلمات البحث.</string>
|
||||
<string name="storeName">اسم</string>
|
||||
<string name="note">مذكرة</string>
|
||||
<string name="action_add">إضافة</string>
|
||||
<string name="noGiftCards">انقر على زر + لإضافة بطاقة، أو استوردها من قائمة ⋮</string>
|
||||
<string name="noMatchingGiftCards">لا توجد نتائج. حاول تغيير بحثك.</string>
|
||||
<string name="storeName">الاسم</string>
|
||||
<string name="note">ملاحظة</string>
|
||||
<string name="cardId">معرّف البطاقة</string>
|
||||
<string name="barcodeType">نوع الباركود</string>
|
||||
<string name="noBarcode">لا يوجد باركود</string>
|
||||
<string name="star">أضف الى المفضلة</string>
|
||||
<string name="unstar">حذف من المفضلة</string>
|
||||
<string name="star">إضافة إلى المفضلة</string>
|
||||
<string name="unstar">إزالة من المفضلة</string>
|
||||
<string name="cancel">إلغاء</string>
|
||||
<string name="save">حفظ</string>
|
||||
<string name="edit">تعديل</string>
|
||||
<string name="delete">مسح</string>
|
||||
<string name="delete">حذف</string>
|
||||
<string name="confirm">تأكيد</string>
|
||||
<string name="deleteConfirmation">مسح هذة البطاقة نهائيا؟</string>
|
||||
<string name="ok">حسنا</string>
|
||||
<string name="share">شارك</string>
|
||||
<string name="sendLabel">ارسل…</string>
|
||||
<string name="editCardTitle">عدل البطاقة</string>
|
||||
<string name="addCardTitle">اضف بطاقة</string>
|
||||
<string name="scanCardBarcode">مسح باركود</string>
|
||||
<string name="deleteConfirmation">هل ترغب في حذف هذه البطاقة نهائيًّا؟</string>
|
||||
<string name="ok">حسنًا</string>
|
||||
<string name="share">مشاركة</string>
|
||||
<string name="sendLabel">إرسال…</string>
|
||||
<string name="editCardTitle">تعديل البطاقة</string>
|
||||
<string name="addCardTitle">إضافة بطاقة</string>
|
||||
<string name="scanCardBarcode">مسح الباركود</string>
|
||||
<string name="cardShortcut">اختصار البطاقة</string>
|
||||
<string name="noCardsMessage">اضف بطاقة أولا</string>
|
||||
<string name="noCardsMessage">أضف بطاقة أولًا</string>
|
||||
<string name="barcodeImageDescriptionWithType">صورة <xliff:g>%s</xliff:g> الباركود</string>
|
||||
<string name="noCardExistsError">لا يمكن العثور على هذه البطاقة</string>
|
||||
<string name="failedParsingImportUriError">لا يمكن تحليل الرابط المستورد</string>
|
||||
<string name="noCardExistsError">لم يتمّ العثور على تلك البطاقة</string>
|
||||
<string name="failedParsingImportUriError">لا يمكن تحليل عنوان URL المستورد</string>
|
||||
<string name="importExport">استيراد/تصدير</string>
|
||||
<string name="importExportHelp">انشاء نسخة احتياطية من بياناتك يسمح بنقلها إلى جهاز آخر.</string>
|
||||
<string name="importFailed">تعذر إجراء الاستيراد</string>
|
||||
<string name="exportSuccessfulTitle">متصدر</string>
|
||||
<string name="importExportHelp">تتيح لك عملية النسخ الاحتياطي لبياناتك نقلها إلى جهاز آخر</string>
|
||||
<string name="importFailed">تعذّر إجراء عملية الاستيراد</string>
|
||||
<string name="exportSuccessfulTitle">تمّ التصدير</string>
|
||||
<string name="exportFailedTitle">فشل التصدير</string>
|
||||
<string name="exportFailed">لا يمكن عمل التصدير</string>
|
||||
<string name="exportOptionExplanation">ستتم كتابة البيانات في الموقع الذي تختاره.</string>
|
||||
<string name="exportFailed">تعذّر إجراء عملية التصدير</string>
|
||||
<string name="exportOptionExplanation">ستكون البيانات مكتوبة في المسار الذي تختاره</string>
|
||||
<string name="importOptionFilesystemButton">من نظام الملفات</string>
|
||||
<string name="about">حول</string>
|
||||
<string name="app_copyright_old">بناء على Loyalty Card Keychain
|
||||
@@ -53,7 +53,7 @@
|
||||
<string name="exportSuccessful">تم تصدير البيانات</string>
|
||||
<string name="enter_group_name">أدخل اسم المجموعة</string>
|
||||
<string name="group_edit">تعديل المجموعة</string>
|
||||
<string name="noGroups">اضغط زر + لإضافة مجموعات للتصنيف.</string>
|
||||
<string name="noGroups">اضغط زر + لإضافة مجموعات للتصنيف</string>
|
||||
<string name="noGroupCards">هذه المجموعة فارغة</string>
|
||||
<string name="group_name_already_in_use">اسم المجموعة قيد الاستخدام بالفعل</string>
|
||||
<string name="group_name_is_empty">لا يمكن أن يكون اسم المجموعة فارغًا</string>
|
||||
@@ -73,9 +73,9 @@
|
||||
<string name="importCatima">الاستيراد من Catima</string>
|
||||
<string name="importCatimaMessage">حدّد ملفك تصدير من Catima للاستيراد.\nإنشئها من قائمة الاستيراد / التصدير لتطبيق Catima آخر بالضغط على تصدير .</string>
|
||||
<string name="importFidme">الاستيراد من FidMe</string>
|
||||
<string name="importFidmeMessage">حدّد ملفك <i>fidme-export-request-xxxxxx.zip</i> تصدير من FidMe للاستيراد، ثم حدد أنواع الباركود يدويًا بعد ذلك. \nإنشئها من ملف تعريف FidMe الخاص بك عن طريق اختيار حماية البيانات ثم الضغط على استخراج بياناتي أولاً.</string>
|
||||
<string name="importFidmeMessage">حدّد للتصدير من FidMe للاستيراد، ثم حدد أنواع الباركود يدويًا بعد ذلك. \nقم بإنشاءها من ملفك التعريفي في FidMe عن طريق اختيار \"حماية البيانات\" ثم النقر على \"استخراج بياناتي\".</string>
|
||||
<string name="importVoucherVault">الاستيراد من Voucher Vault</string>
|
||||
<string name="importVoucherVaultMessage">حدّد ملفك <i>vouchervault.json</i> تصدير من Voucher Vault للاستيراد. \nإنشئها بالضغط على تصدير في Voucher Vault أولاً.</string>
|
||||
<string name="importVoucherVaultMessage">حدّد ملفك <i>vouchervault.json</i> تصدير من Voucher Vault للاستيراد.\nإنشئها بالضغط على تصدير في Voucher Vault.</string>
|
||||
<string name="barcodeId">قيمة الباركود</string>
|
||||
<string name="sameAsCardId">نفس بطاقة الهوية</string>
|
||||
<string name="setBarcodeId">عيّن قيمة الباركود</string>
|
||||
@@ -101,14 +101,6 @@
|
||||
<string name="settings_locale">لغة</string>
|
||||
<string name="settings_system_locale">النظام</string>
|
||||
<string name="setIcon">تعيين الصورة المصغرة</string>
|
||||
<string name="settings_catima_theme">Catima</string>
|
||||
<string name="settings_pink_theme">زهري</string>
|
||||
<string name="settings_magenta_theme">أرجواني</string>
|
||||
<string name="settings_violet_theme">البنفسجي</string>
|
||||
<string name="settings_blue_theme">أزرق</string>
|
||||
<string name="settings_sky_blue_theme">أزرق سماوي</string>
|
||||
<string name="settings_green_theme">أخضر</string>
|
||||
<string name="settings_brown_theme">بني</string>
|
||||
<string name="app_contributors">أصبح ممكنًا بواسطة: <xliff:g id="app_contributors">%s</xliff:g></string>
|
||||
<string name="sort">فرز</string>
|
||||
<string name="showMoreInfo">اظهر المعلومات</string>
|
||||
@@ -130,21 +122,21 @@
|
||||
<string name="archived">تمت أرشفة البطاقة</string>
|
||||
<string name="unarchived">البطاقة غير مؤرشفة</string>
|
||||
<string name="failedLaunchingPhotoPicker">تعذر العثور على تطبيق معرض مدعوم</string>
|
||||
<string name="noGiftCardsGroup">أنشئ بعض البطاقات، ثم عيّنهم لهذه المجموعة.</string>
|
||||
<string name="deleteTitle">مسح بطاقة</string>
|
||||
<string name="noGiftCardsGroup">أنشئ بعض البطاقات، ثم عيّنها للمجموعة هنا</string>
|
||||
<string name="deleteTitle">حذف البطاقة</string>
|
||||
<plurals name="selectedCardCount">
|
||||
<item quantity="zero"><xliff:g>%d</xliff:g> محدد</item>
|
||||
<item quantity="zero"><xliff:g>%d</xliff:g> محددة</item>
|
||||
<item quantity="one"><xliff:g>%d</xliff:g> محددة</item>
|
||||
<item quantity="two"><xliff:g>%d</xliff:g> محدد</item>
|
||||
<item quantity="few"><xliff:g>%d</xliff:g> محدد</item>
|
||||
<item quantity="many"><xliff:g>%d</xliff:g> محدد</item>
|
||||
<item quantity="other"><xliff:g>%d</xliff:g> محدد</item>
|
||||
<item quantity="two"><xliff:g>%d</xliff:g> محددتين</item>
|
||||
<item quantity="few"><xliff:g>%d</xliff:g> محددة</item>
|
||||
<item quantity="many"><xliff:g>%d</xliff:g> محددة</item>
|
||||
<item quantity="other"><xliff:g>%d</xliff:g> محددة</item>
|
||||
</plurals>
|
||||
<string name="importing">جار الاستيراد…</string>
|
||||
<string name="importing">جارٍ الاستيراد…</string>
|
||||
<string name="exportName">تصدير</string>
|
||||
<string name="exporting">جار التصدير…</string>
|
||||
<string name="importSuccessfulTitle">مستورد</string>
|
||||
<string name="importFailedTitle">فشل بالاستيراد</string>
|
||||
<string name="importSuccessfulTitle">تمّ الاستيراد</string>
|
||||
<string name="importFailedTitle">فشل الاستيراد</string>
|
||||
<string name="sort_by_most_recently_used">الأكثر أستعمالا مؤخرا</string>
|
||||
<string name="license">رخصة</string>
|
||||
<string name="sort_by_name">اسم</string>
|
||||
@@ -158,23 +150,23 @@
|
||||
<item quantity="other"><xliff:g>%1$d</xliff:g> بطاقات ( <xliff:g id="archivedCount">%2$d</xliff:g> مؤرشفة)</item>
|
||||
</plurals>
|
||||
<plurals name="deleteCardsTitle">
|
||||
<item quantity="zero">مسح <xliff:g>%d</xliff:g> بطاقة</item>
|
||||
<item quantity="one">مسح <xliff:g>%d</xliff:g> بطاقة</item>
|
||||
<item quantity="two">مسح <xliff:g>%d</xliff:g> بطاقتين</item>
|
||||
<item quantity="few">مسح <xliff:g>%d</xliff:g> بطائق</item>
|
||||
<item quantity="many">مسح <xliff:g>%d</xliff:g> بطاقة</item>
|
||||
<item quantity="other">مسح <xliff:g>%d</xliff:g> بطاقة</item>
|
||||
<item quantity="zero">حذف <xliff:g>%d</xliff:g> بطاقة</item>
|
||||
<item quantity="one">حذف <xliff:g>%d</xliff:g> بطاقة</item>
|
||||
<item quantity="two">حذف <xliff:g>%d</xliff:g> بطاقتَين</item>
|
||||
<item quantity="few">حذف <xliff:g>%d</xliff:g> من البطاقات</item>
|
||||
<item quantity="many">حذف <xliff:g>%d</xliff:g> من البطاقات</item>
|
||||
<item quantity="other">حذف <xliff:g>%d</xliff:g> من البطاقات</item>
|
||||
</plurals>
|
||||
<plurals name="deleteCardsConfirmation">
|
||||
<item quantity="zero">مسح هذه <xliff:g>%d</xliff:g> البطاقة نهائيا؟</item>
|
||||
<item quantity="one">مسح هذه <xliff:g>%d</xliff:g> البطاقة نهائيا؟</item>
|
||||
<item quantity="two">مسح هذه <xliff:g>%d</xliff:g> البطاقتين نهائيا؟</item>
|
||||
<item quantity="few">مسح هذه <xliff:g>%d</xliff:g> البطاقات نهائيا؟</item>
|
||||
<item quantity="many">مسح هذه <xliff:g>%d</xliff:g> البطاقات نهائيا؟</item>
|
||||
<item quantity="other">مسح هذه <xliff:g>%d</xliff:g> البطاقات نهائيا؟</item>
|
||||
<item quantity="zero">حذف هذه <xliff:g>%d</xliff:g> البطاقة نهائيًا؟</item>
|
||||
<item quantity="one">حذف هذه <xliff:g>%d</xliff:g> البطاقة نهائيًا؟</item>
|
||||
<item quantity="two">حذف هذه <xliff:g>%d</xliff:g> البطاقتين نهائيًا؟</item>
|
||||
<item quantity="few">هل ترغب في حذف هذه البطاقات الـ <xliff:g>%d</xliff:g> نهائيًّا؟</item>
|
||||
<item quantity="many">هل ترغب في حذف هذه البطاقات الـ <xliff:g>%d</xliff:g> نهائيًّا؟</item>
|
||||
<item quantity="other">هل ترغب في حذف هذه البطاقات الـ <xliff:g>%d</xliff:g> نهائيًا؟</item>
|
||||
</plurals>
|
||||
<string name="importOptionFilesystemTitle">الاستيراد من نظام الملفات</string>
|
||||
<string name="importOptionFilesystemExplanation">اختر ملفًا محددًا من نظام الملفات.</string>
|
||||
<string name="importOptionFilesystemExplanation">اختر ملفًا محددًا من نظام الملفات</string>
|
||||
<string name="about_title_fmt">حول <xliff:g id="app_name">%s</xliff:g></string>
|
||||
<string name="debug_version_fmt">نسخة: <xliff:g id="version">%s</xliff:g></string>
|
||||
<string name="settings_system_theme">النظام</string>
|
||||
@@ -221,15 +213,13 @@
|
||||
<string name="report_error">الإبلاغ عن خطأ</string>
|
||||
<string name="sort_by_expiry">انقضاء</string>
|
||||
<string name="importLoyaltyCardKeychain">الاستيراد من Loyalty Card Keychain</string>
|
||||
<string name="importLoyaltyCardKeychainMessage">حدّد ملفك <i>LoyaltyCardKeychain.csv</i> التصدير من Loyalty Card Keychain للاستيراد. \nإنشئها من قائمة الاستيراد / التصدير في Loyalty Card Keychain بالضغط على تصدير هناك أولاً.</string>
|
||||
<string name="importLoyaltyCardKeychainMessage">حدد تصديرك من سلسلة مفاتيح بطاقة الولاء للتصدير.\nانشئها من قائمة استيراد/تصدير في سلسلة مفاتيح بطاقة الولاء عبر ضغط زر تصدير.</string>
|
||||
<string name="failedGeneratingShareURL">تعذر إنشاء عنوان URL قابل للمشاركة</string>
|
||||
<string name="help_translate_this_app">ساعد في ترجمة هذا التطبيق</string>
|
||||
<string name="on_google_play">على Google Play</string>
|
||||
<string name="settings_theme_color">لون المظهر</string>
|
||||
<string name="previousCard">السابق</string>
|
||||
<string name="nextCard">التالي</string>
|
||||
<string name="failedToRetrieveImageFile">فشل في استخراج ملف الصورة</string>
|
||||
<string name="barcodeLongPressMessage">يمكن فتح صور فقط في تطبيق معرض الصور</string>
|
||||
<string name="failedToOpenUrl">ثبت متصفح ويب أولاً</string>
|
||||
<string name="welcome">مرحبًا بك في كاتيما</string>
|
||||
<string name="updateBalanceTitle">كم أنفقت أو استلمت؟</string>
|
||||
@@ -237,22 +227,21 @@
|
||||
<string name="importCards">استيراد البطاقات</string>
|
||||
<string name="newBalanceSentence">الرصيد الجديد: <xliff:g>%s</xliff:g></string>
|
||||
<string name="cameraPermissionDeniedTitle">تعذر الوصول إلى الكاميرا</string>
|
||||
<string name="noCameraPermissionDirectToSystemSetting">لمسح الباركود، ستحتاج Catima إلى الوصول إلى الكاميرا. اضغط هنا لتغيير إعدادات الأذونات.</string>
|
||||
<string name="noCameraPermissionDirectToSystemSetting">لمسح الباركود، ستحتاج كاتيما إلى الوصول إلى الكاميرا. اضغط هنا لتغيير إعدادات الأذونات.</string>
|
||||
<string name="updateBalance">تحديث الرصيد</string>
|
||||
<string name="updateBalanceHint">أدخل المبلغ</string>
|
||||
<string name="storageReadPermissionRequired">الصلاحيه للوصل للتخزين مطلوبة لهذا الاجراء…</string>
|
||||
<string name="storageReadPermissionRequired">الصلاحيه للوصول للتخزين مطلوبة لهذا الاجراء…</string>
|
||||
<string name="validFromDate">عربيه</string>
|
||||
<string name="cameraPermissionRequired">إذن للوصول إلى الكاميرا اللازمة لهذا الإجراء…</string>
|
||||
<string name="anyDate">أي تاريخ</string>
|
||||
<string name="chooseValidFromDate">اختر صالح من التاريخ</string>
|
||||
<string name="validFromSentence">صالح من:<xliff:g>%s</xliff:g></string>
|
||||
<string name="height">الطول</string>
|
||||
<string name="permissionReadCardsDescription">اقرأ بطاقتك مع جميع التفاصيل، بما فيه الملاحضات والصور</string>
|
||||
<string name="permissionReadCardsDescription">اقرأ بطاقتك مع جميع التفاصيل، بما فيه الملاحظات والصور</string>
|
||||
<string name="settings_display_barcode_max_brightness_summary">ظروري لعمل بعض الماسحات الضوئية</string>
|
||||
<string name="permissionReadCardsLabel">اقرأ بطاقات كاتيما</string>
|
||||
<string name="app_copyright_fmt" tools:ignore="PluralsCandidate">حقوق النشر © 2019–<xliff:g>%d</xliff:g> Sylvia van Os والمساهمون</string>
|
||||
<string name="app_copyright_short">حقوق النشر © Sylvia van Os والمساهمون</string>
|
||||
<string name="openFrontImageInGalleryApp">افتح الصورة الأمامية في تطبيق المعرض</string>
|
||||
<string name="show_name_below_image_thumbnail">إظهار الاسم أسفل الصورة المصغرة</string>
|
||||
<string name="show_validity">إظهار الصلاحية</string>
|
||||
<string name="view_online">مشاهدة حية</string>
|
||||
@@ -268,7 +257,6 @@
|
||||
<string name="switchToFrontImage">التبديل إلى الصورة الأمامية</string>
|
||||
<string name="settings_allow_content_provider_read_summary">سيظل يتعين على التطبيقات طلب الإذن لمنحها حق الوصول</string>
|
||||
<string name="setBarcodeHeight">ضبط ارتفاع الباركود</string>
|
||||
<string name="openBackImageInGalleryApp">فتح الصورة الخلفية في تطبيق المعرض</string>
|
||||
<string name="settings_allow_content_provider_read_title">السماح للتطبيقات الأخرى بالوصول إلى بياناتي</string>
|
||||
<string name="donate">تبرّع</string>
|
||||
<string name="show_archived_cards">عرض البطاقات المؤرشفة</string>
|
||||
@@ -289,7 +277,7 @@
|
||||
<string name="spend">انفق</string>
|
||||
<string name="receive">استلم</string>
|
||||
<string name="amountParsingFailed">كمية غير صحيحة</string>
|
||||
<string name="add_manually_warning_message">في بعض المتاجر قيمة الباركود تختلف عن الرقم الموجود على البطاقة. لهذا السبب إدخال الباركود يدوياً لن ينجح دائماً. من المستحسن فحص الباركود بكاميرا بدلا من ذالك. هل انت مُصِر على الاستكمال؟</string>
|
||||
<string name="add_manually_warning_message">بالنسبة لبعض البطاقات، تختلف قيمة الرمز الشريطي عن الرقم المكتوب عليها. لذا، قد لا ينجح إدخال الرمز الشريطي يدويًا دائمًا. يُنصح بمسح الرمز الشريطي باستخدام الكاميرا. هل ما زلت ترغب في المتابعة؟</string>
|
||||
<string name="addFromPdfFile">تحديد ملف PDF</string>
|
||||
<string name="errorReadingFile">لا يمكن قراءة الملف</string>
|
||||
<string name="failedLaunchingFileManager">لم يتم العثور على مدير ملفات مدعوم</string>
|
||||
@@ -300,7 +288,7 @@
|
||||
<string name="exportCancelled">تم الغاء الاستخراج</string>
|
||||
<string name="useFrontImage">استخدام صورة أمامية</string>
|
||||
<string name="useBackImage">استخدم صورة خلفية</string>
|
||||
<string name="addFromPkpass">اختر ملف الدفتر (.pkpass)</string>
|
||||
<string name="addFromPkpass">اختر ملف الدفتر الحساب [Passbook] (.pkpass. / pkpasses)</string>
|
||||
<string name="unsupportedFile">هذا الملف غير مدعوم</string>
|
||||
<string name="generic_error_please_retry">حدث خطأ ما</string>
|
||||
<string name="settings_use_volume_keys_navigation">بدّل البطاقات باستخدام أزرار الصوت</string>
|
||||
@@ -322,4 +310,21 @@
|
||||
<string name="card_list_widget_name">قائمة البطاقات</string>
|
||||
<string name="cardWithNumber">البطاقة <xliff:g>%d</xliff:g></string>
|
||||
<string name="cardWithNumberAndLocale">البطاقة <xliff:g>%d</xliff:g> (<xliff:g>%s</xliff:g>)</string>
|
||||
<string name="card_list_widget_empty">بعد أن تضيف بطاقات الولاء في كاتيما، ستظهر هنا. وإذا كنت تملك البطاقات، تأكد من عدم وجودهن جميعا في الأرشفة.</string>
|
||||
<string name="pleaseDoNotRotateTheDevice">نرجو منك عدم تدوير الجهاز، أو سيُلغى هذا الإجراء</string>
|
||||
<string name="acra_catima_has_crashed">نأسف، لقد توقف <xliff:g id="app_name">%s</xliff:g>. ساعدنا في إصلاح هذه المشكلة من خلال إرسال تقرير للأخطاء.</string>
|
||||
<string name="acra_explain_crash">بقدر الإمكان، نرجو منك أن تضيف مزيدا من المعلومات عمَّ كنت تفعل هنا:</string>
|
||||
<string name="acra_crash_email_subject">تقرير الأخطاء لـ<xliff:g id="app_name">%s</xliff:g></string>
|
||||
<string name="copy_value">قيمة النسخ</string>
|
||||
<string name="copied_to_clipboard">تم النسخ إلى الحافظة</string>
|
||||
<string name="nothing_to_copy">لم يتم العثور على قيمة</string>
|
||||
<string name="barcodeEncoding">طريقة ترميز الرمز الشريطي \"الباركود\"</string>
|
||||
<string name="back">رجوع</string>
|
||||
<string name="pref_enable_acra">إخطار بإرسال تقارير الأخطاء</string>
|
||||
<string name="pref_enable_acra_summary">عند التفعيل, سيتم سؤالك للابلاغ بالاعطال عندما تحدث. لا ولن يتم الابلاغ بالاعطال تلفائيا.</string>
|
||||
<string name="settings_disable_nfc_while_viewing_card">وقف NFC</string>
|
||||
<string name="settings_disable_nfc_while_viewing_card_summary">وقف NFC لمنع NFC من العمل أثناء عرض بطاقة</string>
|
||||
<string name="nfc_blocked_while_viewing_card">NFC موقوف</string>
|
||||
<string name="change_settings">تغير الاعدادات</string>
|
||||
<string name="nfc_block_system_error">فشل في ايقاف NFC</string>
|
||||
</resources>
|
||||
@@ -10,7 +10,7 @@
|
||||
<string name="action_add">Дадаць</string>
|
||||
<string name="app_name">Catima</string>
|
||||
<string name="action_search">Пошук</string>
|
||||
<string name="noGiftCards">Націсніце кнопку + плюс, каб дадаць картку, або імпартуйце праз меню ⋮.</string>
|
||||
<string name="noGiftCards">Націсніце кнопку + плюс, каб дадаць картку, або імпартуйце праз меню ⋮</string>
|
||||
<string name="storeName">Назва</string>
|
||||
<string name="star">Дадаць у абраныя</string>
|
||||
<string name="unstar">Выдаліць з абраных</string>
|
||||
@@ -37,7 +37,7 @@
|
||||
<string name="storageReadPermissionRequired">Для гэтага дзеяння патрабуецца дазвол на чытанне сховішча…</string>
|
||||
<string name="cameraPermissionRequired">Для гэтага дзеяння патрабуецца дазвол на доступ да камеры…</string>
|
||||
<string name="permissionReadCardsLabel">Чытаць карты Catima</string>
|
||||
<string name="exportOptionExplanation">Даныя будуць запісаны ў выбранае вамі месца.</string>
|
||||
<string name="exportOptionExplanation">Даныя будуць запісаны ў выбранае вамі месца</string>
|
||||
<string name="importOptionFilesystemExplanation">Выберыце пэўны файл з файлавай сістэмы.</string>
|
||||
<string name="importOptionFilesystemButton">З файлавай сістэмы</string>
|
||||
<string name="about">Аб праграме</string>
|
||||
@@ -65,7 +65,7 @@
|
||||
<string name="importExport">Імпарт/Экспарт</string>
|
||||
<string name="importOptionFilesystemTitle">Імпарт з файлавай сістэмы</string>
|
||||
<string name="app_copyright_fmt" tools:ignore="PluralsCandidate">Аўтарскае права © 2019–<xliff:g>%d</xliff:g> Sylvia van Os і суаўтары</string>
|
||||
<string name="importExportHelp">Рэзервовае капіяванне даных дазваляе перанесці іх на іншую прыладу.</string>
|
||||
<string name="importExportHelp">Рэзервовае капіяванне даных дазваляе перанесці іх на іншую прыладу</string>
|
||||
<string name="failedParsingImportUriError">Не атрымалася разабраць URI імпарту</string>
|
||||
<string name="exportFailedTitle">Не ўдалося экспартаваць</string>
|
||||
<string name="exportFailed">Немагчыма выканаць экспарт</string>
|
||||
@@ -158,15 +158,11 @@
|
||||
<string name="settings_oled_dark">Чысты чорны фон для цёмнай тэмы</string>
|
||||
<string name="selectColor">Выбраць колер</string>
|
||||
<string name="setIcon">Задаць мініяцюру</string>
|
||||
<string name="settings_theme_color">Колер тэмы</string>
|
||||
<string name="settings_catima_theme">Catima</string>
|
||||
<string name="settings_magenta_theme">Пурпурны</string>
|
||||
<string name="app_contributors">Стала магчымым дзякуючы: <xliff:g id="app_contributors">%s</xliff:g></string>
|
||||
<string name="sort">Сартаваць</string>
|
||||
<string name="showMoreInfo">Паказаць інфармацыю</string>
|
||||
<string name="updateBalance">Абнавіць баланс</string>
|
||||
<string name="failedToRetrieveImageFile">Не ўдалося атрымаць файл відарысу</string>
|
||||
<string name="barcodeLongPressMessage">У галерэі можна адкрываць толькі відарысы</string>
|
||||
<string name="sort_by_name">Назва</string>
|
||||
<string name="sort_by_most_recently_used">Частата выкарыстання</string>
|
||||
<string name="sort_by_valid_from">Дзейнічае ад</string>
|
||||
@@ -206,7 +202,6 @@
|
||||
<string name="validFromSentence">Дзейнічае з: <xliff:g>%s</xliff:g></string>
|
||||
<string name="height">Вышыня</string>
|
||||
<string name="switchToFrontImage">Пераключыцца на пярэдні відарыс</string>
|
||||
<string name="openBackImageInGalleryApp">Адкрыць задні відарыс у галерэі</string>
|
||||
<string name="setBarcodeHeight">Задаць вышыню штрыхкода</string>
|
||||
<string name="donate">Ахвяраваць</string>
|
||||
<string name="icon_header_click_text">Доўгі націск для рэдагавання мініяцюры</string>
|
||||
@@ -275,8 +270,6 @@
|
||||
<string name="switchToBackImage">Пераключыцца на задні відарыс</string>
|
||||
<string name="importFidmeMessage">Каб імпартаваць, выберыце файл <i>fidme-export-request-xxxxxx.zip</i> з FidMe, а потым уручную выберыце тыпы штрыхкодаў. \nСтварыце яго з вашага профілю FidMe, выбраўшы \"Абарону даных\", а затым націснуўшы \"Выняць мае даныя\".</string>
|
||||
<string name="importCatimaMessage">Каб імпартаваць, выберыце файл <i>catima.zip</i> з Catima. \nСтварыце яго з меню \"Імпарт/Экспарт\" іншай праграмы Catima, спачатку націснуўшы там \"Экспарт\".</string>
|
||||
<string name="settings_sky_blue_theme">Нябесна-блакітны</string>
|
||||
<string name="settings_brown_theme">Карычневы</string>
|
||||
<string name="switchToBarcode">Пераключыцца на штрыхкод</string>
|
||||
<string name="settings_locale">Мова</string>
|
||||
<plurals name="groupCardCountWithArchived">
|
||||
@@ -288,16 +281,11 @@
|
||||
<string name="unarchived">Карта разархівавана</string>
|
||||
<string name="updateBarcodeQuestionText">Вы змянілі ID. Вы хочаце таксама абнавіць штрыхкод, каб выкарыстоўваць тое ж значэнне?</string>
|
||||
<string name="no">Не</string>
|
||||
<string name="settings_pink_theme">Ружовы</string>
|
||||
<string name="settings_system_locale">Сістэма</string>
|
||||
<string name="settings_violet_theme">Фіялетавы</string>
|
||||
<string name="multipleBarcodesFoundPleaseChooseOne">Які са знойдзеных штрыхкодаў вы хочаце выкарыстоўваць?</string>
|
||||
<string name="settings_blue_theme">Сіні</string>
|
||||
<string name="settings_green_theme">Зялёны</string>
|
||||
<string name="report_error">Паведаміць пра памылку</string>
|
||||
<string name="failedLaunchingPhotoPicker">Не атрымалася знайсці праграму для галерэі, якая падтрымліваецца</string>
|
||||
<string name="unsupportedFile">Гэты файл не падтрымліваецца</string>
|
||||
<string name="openFrontImageInGalleryApp">Адкрыць пярэдні відарыс у галерэі</string>
|
||||
<string name="field_must_not_be_empty">Поле не павінна быць пустым</string>
|
||||
<string name="add_manually_warning_title">Рэкамендуецца сканаванне</string>
|
||||
<string name="errorReadingFile">Не атрымалася прачытаць файл</string>
|
||||
@@ -316,4 +304,9 @@
|
||||
<string name="card_list_widget_name">Спіс карт</string>
|
||||
<string name="card_list_widget_empty">Пасля таго, як вы дадасце некалькі картак лаяльнасці ў Catima, яны з\'явяцца тут. Калі ў вас ёсць карты, пераканайцеся, што яны не ўсе заархіваваны.</string>
|
||||
<string name="acra_catima_has_crashed">Прабачце, але ў праграме <xliff:g id="app_name">%s</xliff:g> адбыўся збой. Калі ласка, дапамажыце нам выправіць гэту праблему, даслаўшы нам справаздачу аб памылцы.</string>
|
||||
<string name="back">Назад</string>
|
||||
<string name="copy_value">Скапіяваць значэнне</string>
|
||||
<string name="copied_to_clipboard">Скапіявана ў буфер абмену</string>
|
||||
<string name="nothing_to_copy">Значэнне не знойдзенае</string>
|
||||
<string name="barcodeEncoding">Кадыяванне штрых-кодаў</string>
|
||||
</resources>
|
||||
@@ -143,15 +143,6 @@
|
||||
<item quantity="other">Желаете ли тези <xliff:g>%d</xliff:g> карти да бъдат премахнати\?</item>
|
||||
</plurals>
|
||||
<string name="app_contributors">Осъществено от: <xliff:g id="app_contributors">%s</xliff:g></string>
|
||||
<string name="settings_brown_theme">Кафяво</string>
|
||||
<string name="settings_green_theme">Зелено</string>
|
||||
<string name="settings_sky_blue_theme">Небесносиньо</string>
|
||||
<string name="settings_blue_theme">Синьо</string>
|
||||
<string name="settings_violet_theme">Виолетово</string>
|
||||
<string name="settings_magenta_theme">Цикламено</string>
|
||||
<string name="settings_pink_theme">Розово</string>
|
||||
<string name="settings_catima_theme">Catima</string>
|
||||
<string name="settings_theme_color">Цвят на темата</string>
|
||||
<string name="settings_system_locale">Система</string>
|
||||
<string name="settings_locale">Език</string>
|
||||
<string name="noGroupCards">Групата е празна</string>
|
||||
@@ -207,7 +198,6 @@
|
||||
<string name="nextCard">Следваща</string>
|
||||
<string name="failedToOpenUrl">Първо инсталирайте уеб браузър</string>
|
||||
<string name="welcome">Добре дошли при Катима</string>
|
||||
<string name="barcodeLongPressMessage">В приложението галерия могат да бъдат отваряни само изображения</string>
|
||||
<string name="failedToRetrieveImageFile">Не е възможно извличане на изображение</string>
|
||||
<string name="noCameraPermissionDirectToSystemSetting">За да сканирате щрихкодове с Catima е необходим достъп до камерата. За да промените разрешението докоснете тук.</string>
|
||||
<string name="updateBalanceTitle">Колко е похарчено или получено?</string>
|
||||
@@ -227,8 +217,6 @@
|
||||
<string name="switchToFrontImage">Показване на предната страна</string>
|
||||
<string name="switchToBackImage">Показване на задната страна</string>
|
||||
<string name="switchToBarcode">Показване на щрихкода</string>
|
||||
<string name="openFrontImageInGalleryApp">Отваряне на изображението на предната страна в приложение за преглед за изображения</string>
|
||||
<string name="openBackImageInGalleryApp">Отваряне на изображението на задната страна в приложение за преглед за изображения</string>
|
||||
<string name="setBarcodeHeight">Задаване на височина на щрихкода</string>
|
||||
<string name="donate">Даряване</string>
|
||||
<string name="icon_header_click_text">Задръжте, за да промените миниатюрата</string>
|
||||
@@ -308,4 +296,16 @@
|
||||
<string name="copy_value">Копиране на стойността</string>
|
||||
<string name="copied_to_clipboard">Копирано</string>
|
||||
<string name="nothing_to_copy">Няма стойност</string>
|
||||
<string name="back">Назад</string>
|
||||
<string name="barcodeEncoding">Кодиране на щрихкода</string>
|
||||
<string name="settings_disable_nfc_while_viewing_card">Пауза на NFC</string>
|
||||
<string name="settings_disable_nfc_while_viewing_card_summary">Спира NFC, за да бъдат предотвратени безконтактни плащания при преглед на карта</string>
|
||||
<string name="nfc_blocked_while_viewing_card">NFC е на пауза</string>
|
||||
<string name="change_settings">Настройки</string>
|
||||
<string name="nfc_block_system_error">Грешка при спиране на NFC</string>
|
||||
<string name="sort_by_most_recently_added">Поредност на добавяне</string>
|
||||
<string name="zoomFrontImage">Увеличаване на предното изображение</string>
|
||||
<string name="zoomBackImage">Увеличаване на задното изображение</string>
|
||||
<string name="show_card_id">Показване номера на картата</string>
|
||||
<string name="open_in_gallery">Отваряне в галерията</string>
|
||||
</resources>
|
||||
@@ -3,13 +3,13 @@
|
||||
<string name="save">সংরক্ষণ</string>
|
||||
<string name="cancel">বাতিল</string>
|
||||
<string name="unstar">তারা মুক্ত</string>
|
||||
<string name="star">তারা</string>
|
||||
<string name="barcodeType">বারকোড ধরন</string>
|
||||
<string name="note">বিঃদ্রঃ</string>
|
||||
<string name="storeName">দোকানের নাম</string>
|
||||
<string name="star">পছন্দের তালিকায় যোগ করুন</string>
|
||||
<string name="barcodeType">বারকোডের ধরন</string>
|
||||
<string name="note">উল্লেখ্য</string>
|
||||
<string name="storeName">নাম</string>
|
||||
<string name="noMatchingGiftCards">কোনো ফলাফল পাওয়া যায়নি। অনুসন্ধানের বাক্যটি বদলে দেখুন।</string>
|
||||
<string name="noGiftCards">প্লাস বোতামটি টিপে একটি কার্ড যোগ করুন বা ⋮ মেনু থেকে কিছু নিয়ে আসুন।</string>
|
||||
<string name="action_add">কর্ম যোগ</string>
|
||||
<string name="action_add">যোগ করুন</string>
|
||||
<string name="all">সব</string>
|
||||
<string name="noGroupCards">এই গ্রুপটি খালি</string>
|
||||
<string name="noGroups">+ যোগ বোতামটি টিপে গ্রুপ যোগ করুন যাতে তাদের শ্রেণীকরণ করা যায়।</string>
|
||||
@@ -50,15 +50,6 @@
|
||||
<string name="turn_flashlight_off">টর্চলাইট বন্ধ করুন</string>
|
||||
<string name="settings_locale">লোকেল</string>
|
||||
<string name="settings_system_locale">সিস্টেম লোকেল</string>
|
||||
<string name="settings_theme_color">থিম রঙ</string>
|
||||
<string name="settings_catima_theme">কটিমা থিম</string>
|
||||
<string name="settings_pink_theme">গোলাপী থিম</string>
|
||||
<string name="settings_magenta_theme">ম্যাজেন্টা থিম</string>
|
||||
<string name="settings_violet_theme">ভায়োলেট থিম</string>
|
||||
<string name="settings_blue_theme">নীল থিম</string>
|
||||
<string name="settings_sky_blue_theme">আকাশী নীল থিম</string>
|
||||
<string name="settings_green_theme">সবুজ থিম</string>
|
||||
<string name="settings_brown_theme">বাদামী থিম</string>
|
||||
<string name="sort">সাজান</string>
|
||||
<string name="sort_by_name">নামের দ্বারা সাজান</string>
|
||||
<string name="sort_by_most_recently_used">সর্বাধিক সম্প্রতি ব্যবহৃত দ্বারা সাজান</string>
|
||||
@@ -202,7 +193,6 @@
|
||||
<string name="settings_oled_dark">অন্ধকার থিমের জন্য খাঁটি কালো পটভূমি</string>
|
||||
<string name="setIcon">আইকন সেট করুন</string>
|
||||
<string name="updateBalance">ব্যালেন্স আপডেট করুন</string>
|
||||
<string name="barcodeLongPressMessage">গ্যালারি অ্যাপে শুধুমাত্র ছবি খোলা যাবে</string>
|
||||
<string name="translate_platform">Weblate-এ</string>
|
||||
<string name="on_google_play">Google Play-তে</string>
|
||||
<string name="shortcutSelectCard">একটি কার্ড নির্বাচন করুন</string>
|
||||
@@ -234,8 +224,6 @@
|
||||
<string name="switchToBackImage">পিছনের ছবিটিতে সুইচ করুন</string>
|
||||
<string name="switchToFrontImage">সামনের ছবিটিতে সুইচ করুন</string>
|
||||
<string name="switchToBarcode">বারকোডে সুইচ করুন</string>
|
||||
<string name="openFrontImageInGalleryApp">সামনের ছবিটি গ্যালারি অ্যাপে খুলুন</string>
|
||||
<string name="openBackImageInGalleryApp">পিছনের ছবিটি গ্যালারি অ্যাপে খুলুন</string>
|
||||
<string name="setBarcodeHeight">বারকোডের উচ্চতা সেট করুন</string>
|
||||
<string name="icon_header_click_text">দীর্ঘক্ষন টাচ করে থাম্বনেইল এডিট করবেন</string>
|
||||
<string name="show_balance">ব্যালান্স দেখান</string>
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="settings_locale">ভাষা</string>
|
||||
<string name="action_search">খুঁজুন</string>
|
||||
<string name="settings_pink_theme">গুলাপি</string>
|
||||
<string name="settings_blue_theme">নীল</string>
|
||||
<string name="settings_green_theme">সবুজ</string>
|
||||
<string name="settings_brown_theme">বাদামি</string>
|
||||
<string name="save">সংরক্ষণ</string>
|
||||
<string name="cardId">কার্ড আইডি</string>
|
||||
<string name="barcodeType">বারকোডের ধরন</string>
|
||||
@@ -19,7 +15,6 @@
|
||||
<string name="all">সকল</string>
|
||||
<string name="never">কখনো না</string>
|
||||
<string name="currency">মুদ্রা</string>
|
||||
<string name="settings_violet_theme">বেগুনি</string>
|
||||
<string name="no">না</string>
|
||||
<string name="nextCard">পরবর্তী</string>
|
||||
<string name="action_add">যুক্ত করুন</string>
|
||||
|
||||