mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-16 06:23:56 +00:00
Compare commits
1560 Commits
v3.1.0-bet
...
l10n_dev_c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53807ff68d | ||
|
|
902bf96a29 | ||
|
|
91743dc0b7 | ||
|
|
384f8603b5 | ||
|
|
6c4edda017 | ||
|
|
2f4f7345e4 | ||
|
|
8847d37a7d | ||
|
|
4e1f82aada | ||
|
|
2395a57271 | ||
|
|
43cbf35761 | ||
|
|
d095f87a1a | ||
|
|
6be5fbd0c8 | ||
|
|
5450d331b8 | ||
|
|
d53cdce2e2 | ||
|
|
bb8d03f776 | ||
|
|
df65eec0d3 | ||
|
|
b112db7803 | ||
|
|
178d7f7820 | ||
|
|
afaa162907 | ||
|
|
1c4a7ff8af | ||
|
|
19c14d81c3 | ||
|
|
a794550969 | ||
|
|
dfa55741cf | ||
|
|
2a32c92cfc | ||
|
|
eaaf0f355a | ||
|
|
7262795cb0 | ||
|
|
4c7a644e0a | ||
|
|
b802338fdf | ||
|
|
d4346d292a | ||
|
|
ba3e5b8ae2 | ||
|
|
08b9820ff6 | ||
|
|
65cd62a94a | ||
|
|
0154eeace4 | ||
|
|
bb8db3cc67 | ||
|
|
b03908ca5c | ||
|
|
67b8e51fdb | ||
|
|
3bf67b1997 | ||
|
|
486b3fbaa9 | ||
|
|
7d5264760d | ||
|
|
2707e461e7 | ||
|
|
d82f4b633a | ||
|
|
17ab29dc03 | ||
|
|
b66e625a53 | ||
|
|
b54384fe33 | ||
|
|
edfa6f0ed0 | ||
|
|
53e5f86ae2 | ||
|
|
a6531ac9cc | ||
|
|
7b9e4d4870 | ||
|
|
aa2e0cd5e0 | ||
|
|
4d0e777401 | ||
|
|
9f6882888f | ||
|
|
2044681859 | ||
|
|
7b17f9a29c | ||
|
|
46e094bdf8 | ||
|
|
a60e371b0f | ||
|
|
aa5f94cd14 | ||
|
|
baf6f59f8a | ||
|
|
fa0c69aecf | ||
|
|
ebd1a22c75 | ||
|
|
16cce05bbd | ||
|
|
0daf2cf26f | ||
|
|
8bbfa6166b | ||
|
|
dbc3884b1c | ||
|
|
f2b5b5ef62 | ||
|
|
a5c57ab6c2 | ||
|
|
6ac7978d7c | ||
|
|
b26c764999 | ||
|
|
de3012692f | ||
|
|
0ca0474920 | ||
|
|
8328759f95 | ||
|
|
393afa4159 | ||
|
|
a25f701e8f | ||
|
|
903a77bd6d | ||
|
|
353f7023a8 | ||
|
|
4b8d96849f | ||
|
|
090fcf8e10 | ||
|
|
8df7cb9dd2 | ||
|
|
c6188c45dc | ||
|
|
25b5ea1474 | ||
|
|
35bdfe3999 | ||
|
|
bd70ee1031 | ||
|
|
640fff73f5 | ||
|
|
a271c5740f | ||
|
|
31b8d7c7f9 | ||
|
|
983afff3f7 | ||
|
|
e89c180f09 | ||
|
|
aac0246fd6 | ||
|
|
aa10bd8000 | ||
|
|
ebd0cca6b6 | ||
|
|
4b21582059 | ||
|
|
1ca92afb65 | ||
|
|
49d92e1867 | ||
|
|
120a91b591 | ||
|
|
bf74fbfd15 | ||
|
|
a564a2f48b | ||
|
|
2687769c64 | ||
|
|
a17991be84 | ||
|
|
700cdf4a93 | ||
|
|
773c1d17c4 | ||
|
|
3222931be6 | ||
|
|
fd63096466 | ||
|
|
f4a799d514 | ||
|
|
9f65441677 | ||
|
|
ceb10ba179 | ||
|
|
17547ad7b6 | ||
|
|
02a6c85575 | ||
|
|
963ab68f83 | ||
|
|
e85425ede8 | ||
|
|
7835a90aed | ||
|
|
2ac94487ac | ||
|
|
7ec12e5ee1 | ||
|
|
840c5635d2 | ||
|
|
bc7c46b3e8 | ||
|
|
2136181d2c | ||
|
|
783eb588b1 | ||
|
|
9345295270 | ||
|
|
e257a8ca99 | ||
|
|
c062780519 | ||
|
|
8fa3a995db | ||
|
|
7e0ade4a38 | ||
|
|
e0fb5530f6 | ||
|
|
d94e8be220 | ||
|
|
472e4a788c | ||
|
|
300d0600af | ||
|
|
87ae95dffc | ||
|
|
4873b8b6ee | ||
|
|
26ed3bacc5 | ||
|
|
5fbf9fdb26 | ||
|
|
f0bcbb5fee | ||
|
|
b494b60251 | ||
|
|
e621306f6d | ||
|
|
94d69d530e | ||
|
|
5fb343972a | ||
|
|
edbe16959d | ||
|
|
8d77450384 | ||
|
|
6a69567cdc | ||
|
|
645972c451 | ||
|
|
114504cfa2 | ||
|
|
0a1d9090c0 | ||
|
|
12cb670af4 | ||
|
|
3ff66d7792 | ||
|
|
b34d6c1cb0 | ||
|
|
1fe5e5f0c0 | ||
|
|
58251d19ef | ||
|
|
1715cebaea | ||
|
|
ba6c162e1f | ||
|
|
8137ef0acc | ||
|
|
836cdde7fb | ||
|
|
dc3d48edd6 | ||
|
|
2dffa1c4ac | ||
|
|
f829fd29e0 | ||
|
|
d47e0bf6af | ||
|
|
cb495dffbd | ||
|
|
3d109b1ff0 | ||
|
|
b8d6b097fe | ||
|
|
999b6f8f4c | ||
|
|
71d85838c7 | ||
|
|
9d509c581f | ||
|
|
7c8b8b17a2 | ||
|
|
126ed7a2fb | ||
|
|
93ac9b1e81 | ||
|
|
840190bd1d | ||
|
|
113e156900 | ||
|
|
e1a07c7c3b | ||
|
|
c1e657d63a | ||
|
|
019b4e3389 | ||
|
|
44b904ac81 | ||
|
|
22223af035 | ||
|
|
90f7256edc | ||
|
|
927435a1c6 | ||
|
|
47b9e8cc3b | ||
|
|
f5a03146ea | ||
|
|
2c8bff7b78 | ||
|
|
00084bd87d | ||
|
|
b46de0bd62 | ||
|
|
d317f9bf36 | ||
|
|
6226f933ff | ||
|
|
bbc0d97d2a | ||
|
|
7fa74c755b | ||
|
|
9d0708f2ff | ||
|
|
ab9ad65e5b | ||
|
|
81bb2586ea | ||
|
|
51c9d1c3b9 | ||
|
|
4e568a1d82 | ||
|
|
f892fab256 | ||
|
|
f8e98da62f | ||
|
|
18664fb239 | ||
|
|
7f2edc4b63 | ||
|
|
96fa35f0a9 | ||
|
|
916c585c38 | ||
|
|
e13f001379 | ||
|
|
f4e5bf8927 | ||
|
|
327b843f8a | ||
|
|
cab38e8bff | ||
|
|
bcdf515f95 | ||
|
|
2f1dbceb6c | ||
|
|
652bb76bdf | ||
|
|
ee9c9e0134 | ||
|
|
3763363199 | ||
|
|
9197f163e3 | ||
|
|
08c8e83d15 | ||
|
|
7fab2e8cb5 | ||
|
|
4f0056e0dc | ||
|
|
5aa78c739f | ||
|
|
ac747dfcc1 | ||
|
|
a7a07de396 | ||
|
|
526670ff6d | ||
|
|
60b6254167 | ||
|
|
8329ed0ce8 | ||
|
|
952beb75b3 | ||
|
|
e2729c3274 | ||
|
|
1e2dac074c | ||
|
|
ee59b5aea1 | ||
|
|
f3ba74f46a | ||
|
|
f74c32e4b8 | ||
|
|
d1860831e3 | ||
|
|
c89ca91f4a | ||
|
|
50f375f187 | ||
|
|
2cb26442d3 | ||
|
|
07f161baf9 | ||
|
|
b2ceaa01fa | ||
|
|
dfbf849691 | ||
|
|
ddc8cbf6fa | ||
|
|
bc2e05c75b | ||
|
|
2bd1f9affb | ||
|
|
b376ab2f5d | ||
|
|
494280b4aa | ||
|
|
93154eef9e | ||
|
|
007bbd3154 | ||
|
|
a54af8d312 | ||
|
|
294b6b0aa6 | ||
|
|
713fa77a0b | ||
|
|
8004a5e194 | ||
|
|
ac470df370 | ||
|
|
0eef242112 | ||
|
|
286db2e1a9 | ||
|
|
aeb00cc790 | ||
|
|
555554d3fd | ||
|
|
e148ac132d | ||
|
|
ae2f19709a | ||
|
|
f2a0897f1e | ||
|
|
97eb752000 | ||
|
|
a92d41398d | ||
|
|
4c360d306a | ||
|
|
aaa4751c17 | ||
|
|
20498bc429 | ||
|
|
c4062af91a | ||
|
|
2d7fb67ad5 | ||
|
|
8eae6906d8 | ||
|
|
54d60c9603 | ||
|
|
a577970705 | ||
|
|
2e97a62365 | ||
|
|
abe4a1e394 | ||
|
|
b42ec620df | ||
|
|
58a68271fc | ||
|
|
c58eb14c59 | ||
|
|
7726abcf00 | ||
|
|
93f9547e3e | ||
|
|
4f72028284 | ||
|
|
caa4ff6d7a | ||
|
|
92655c62c4 | ||
|
|
671565b80c | ||
|
|
020e0e385e | ||
|
|
aa271aa26d | ||
|
|
ccae92a605 | ||
|
|
ca3057326d | ||
|
|
417acee7da | ||
|
|
b95da94f7f | ||
|
|
2cbb78f804 | ||
|
|
a2903ec1bf | ||
|
|
48fae1cc73 | ||
|
|
cc5faa8f9a | ||
|
|
5dfa5001fa | ||
|
|
4859fa2532 | ||
|
|
d6b3cd3e4f | ||
|
|
9ab29af5af | ||
|
|
a4a82d6a56 | ||
|
|
2aa742aaf0 | ||
|
|
1e951baeb4 | ||
|
|
1a0d912083 | ||
|
|
0071286153 | ||
|
|
6a966e7166 | ||
|
|
734805458d | ||
|
|
8de9831954 | ||
|
|
04a2cea6fe | ||
|
|
2f34669301 | ||
|
|
4f6ab17ea1 | ||
|
|
ccbb50bc3a | ||
|
|
a3bf2bc18e | ||
|
|
b616850895 | ||
|
|
ed2c8902fd | ||
|
|
d59c96fad9 | ||
|
|
1ad544d0df | ||
|
|
942bf83d24 | ||
|
|
408d1abe16 | ||
|
|
0e198b3423 | ||
|
|
d1b0cf65b0 | ||
|
|
323ab1d4ab | ||
|
|
7950982bfc | ||
|
|
d70b3fd541 | ||
|
|
6877c82315 | ||
|
|
860d108f82 | ||
|
|
bacc7708c0 | ||
|
|
d4766e27be | ||
|
|
bf130bfc72 | ||
|
|
09aa955299 | ||
|
|
4efbdd0554 | ||
|
|
12f0a83c7d | ||
|
|
26c345d130 | ||
|
|
660a40ce23 | ||
|
|
2fda4d62b7 | ||
|
|
e00942001a | ||
|
|
13d9084456 | ||
|
|
5ee1d2d5b7 | ||
|
|
87e31ff7f7 | ||
|
|
842f24af91 | ||
|
|
fb2373c385 | ||
|
|
ca50c3c1d4 | ||
|
|
ad7f452b8e | ||
|
|
a7e6773428 | ||
|
|
aa1c46caf3 | ||
|
|
0ef412d5f3 | ||
|
|
ba8772b54d | ||
|
|
13595fe1b9 | ||
|
|
59d3d4f816 | ||
|
|
b0618733a3 | ||
|
|
1d5dc80d43 | ||
|
|
1b4e675c68 | ||
|
|
d883a30a75 | ||
|
|
4bc900c74b | ||
|
|
303965ea97 | ||
|
|
b50241a123 | ||
|
|
728a02a034 | ||
|
|
005601ab53 | ||
|
|
649cab0bcc | ||
|
|
00728d1fed | ||
|
|
a398674276 | ||
|
|
bcf10dd11a | ||
|
|
1f2d7899ca | ||
|
|
c60dc58173 | ||
|
|
5fa1e8d863 | ||
|
|
441e296afa | ||
|
|
e7763b97e3 | ||
|
|
9f9076844e | ||
|
|
097ab3915e | ||
|
|
891a5e6264 | ||
|
|
3c32490d38 | ||
|
|
0964d1f531 | ||
|
|
9ffa3c4176 | ||
|
|
f8861d7a61 | ||
|
|
368a166b5c | ||
|
|
5d1dc0e70a | ||
|
|
75dd72b5d6 | ||
|
|
12d76ead3c | ||
|
|
edb24815ff | ||
|
|
c5bf3886a4 | ||
|
|
1a692e7779 | ||
|
|
4f80667943 | ||
|
|
e583701755 | ||
|
|
0f0d3e577a | ||
|
|
c655a04c41 | ||
|
|
869da4b0d8 | ||
|
|
323e725c74 | ||
|
|
965e8dc1b8 | ||
|
|
917902a695 | ||
|
|
64fb8b06ee | ||
|
|
7bf2b9cc8f | ||
|
|
f03ed32617 | ||
|
|
c7d01058e5 | ||
|
|
a039f73f4e | ||
|
|
5bd6ce8f1a | ||
|
|
5c3ad3f7a0 | ||
|
|
d297215db2 | ||
|
|
cabafc02fd | ||
|
|
becfda37a2 | ||
|
|
97882ffea7 | ||
|
|
ac4a0bb214 | ||
|
|
677dca710b | ||
|
|
1bd821edb8 | ||
|
|
4714d6b0e7 | ||
|
|
979dd05298 | ||
|
|
ac39785d4a | ||
|
|
15e900d51b | ||
|
|
2e7da05f0e | ||
|
|
5c882d43c7 | ||
|
|
5be0c6bd89 | ||
|
|
748d2f8ba1 | ||
|
|
b0ae50eabb | ||
|
|
bcf3c0f2a1 | ||
|
|
a6cee5586a | ||
|
|
2222cfe991 | ||
|
|
9f9a97998e | ||
|
|
e95181958a | ||
|
|
7777f87ab4 | ||
|
|
1b821b1524 | ||
|
|
6c83fd97c8 | ||
|
|
4046539610 | ||
|
|
63d50a73d2 | ||
|
|
b2a789d882 | ||
|
|
4222e587c5 | ||
|
|
3cc3618782 | ||
|
|
c371639aee | ||
|
|
c1db16262e | ||
|
|
0d0c5cea05 | ||
|
|
92c2e40e12 | ||
|
|
a64865603f | ||
|
|
323dc38918 | ||
|
|
6d44ac01e5 | ||
|
|
01a0288cf8 | ||
|
|
db1d66e3fd | ||
|
|
b1d821451c | ||
|
|
a0ce7464a5 | ||
|
|
91f1546d10 | ||
|
|
89a5b7812b | ||
|
|
4315c09d2e | ||
|
|
0bb02a50c1 | ||
|
|
27b3a28c8b | ||
|
|
97edd35840 | ||
|
|
3913e4f27a | ||
|
|
ce4f7f1884 | ||
|
|
6c68b48e89 | ||
|
|
de5f238b64 | ||
|
|
2d698d2a62 | ||
|
|
6db124b4cc | ||
|
|
549a34e153 | ||
|
|
9eaf959a5a | ||
|
|
ee62edcc7e | ||
|
|
2968d91535 | ||
|
|
2fb95c6099 | ||
|
|
a7825297ed | ||
|
|
e72c235078 | ||
|
|
89a4847c9f | ||
|
|
15719ad29b | ||
|
|
cc0f7113e9 | ||
|
|
004290c5fe | ||
|
|
83b28e40db | ||
|
|
737fce70fb | ||
|
|
8759c336dc | ||
|
|
d85f99e32a | ||
|
|
b2740a8b21 | ||
|
|
30fc3ff713 | ||
|
|
406007f4ed | ||
|
|
7c5e42f941 | ||
|
|
e890c417a0 | ||
|
|
0c01f435d8 | ||
|
|
dbb7759b0f | ||
|
|
905f72b965 | ||
|
|
77ee082809 | ||
|
|
3a19684dcb | ||
|
|
2890ca1c4a | ||
|
|
3b00572b91 | ||
|
|
ed89ddb2ba | ||
|
|
4de630b08a | ||
|
|
6bc26e3144 | ||
|
|
579411aefb | ||
|
|
7c9f52d986 | ||
|
|
2a55c7a846 | ||
|
|
1268763d99 | ||
|
|
1338bc0ebb | ||
|
|
423a657da7 | ||
|
|
d36d818bfa | ||
|
|
4a851ade4f | ||
|
|
8dba9243a4 | ||
|
|
b4013d1d28 | ||
|
|
6bc23ba8e1 | ||
|
|
4d6aaf6f36 | ||
|
|
291f516e6f | ||
|
|
5fb0fb14e7 | ||
|
|
c40d61f471 | ||
|
|
80da5e3480 | ||
|
|
cfd5790589 | ||
|
|
98e700ab11 | ||
|
|
5c55a9a597 | ||
|
|
2833c58856 | ||
|
|
38ccb8926d | ||
|
|
76b5e2f3c2 | ||
|
|
da02ee2706 | ||
|
|
92cae18d53 | ||
|
|
2e70f13a42 | ||
|
|
0358341e42 | ||
|
|
5a65d2ef5f | ||
|
|
ad713a357a | ||
|
|
d8776b6ab0 | ||
|
|
d2de96f486 | ||
|
|
acf1a4ea32 | ||
|
|
2fdafedc2f | ||
|
|
d04fa0eaa7 | ||
|
|
9d23caab12 | ||
|
|
2121400e78 | ||
|
|
e02da10e23 | ||
|
|
3bada69085 | ||
|
|
7845d3059f | ||
|
|
5921dd8e9b | ||
|
|
43e0aff3ab | ||
|
|
ed5a4cb9be | ||
|
|
824b13cf6e | ||
|
|
6e1f5c7993 | ||
|
|
05eceec6ce | ||
|
|
35d3e35004 | ||
|
|
3a4dec04df | ||
|
|
dd3f5e74f8 | ||
|
|
6c434bbbce | ||
|
|
8f5416080c | ||
|
|
c633c62c4c | ||
|
|
7e5622ba0a | ||
|
|
9f1253274c | ||
|
|
2c7a43b32f | ||
|
|
a1c5d5d818 | ||
|
|
851f137723 | ||
|
|
706af34e90 | ||
|
|
9d650bf3c7 | ||
|
|
f575cc8a70 | ||
|
|
ad44e77934 | ||
|
|
788bd4dd0b | ||
|
|
911e7432e4 | ||
|
|
d62b26813a | ||
|
|
32be2cf617 | ||
|
|
bbd6e7ec45 | ||
|
|
8655a53519 | ||
|
|
0b9fbe31b9 | ||
|
|
c95ee7ce82 | ||
|
|
a25dff9106 | ||
|
|
0835f879b3 | ||
|
|
b336ce3915 | ||
|
|
271f71fe21 | ||
|
|
afec155692 | ||
|
|
b08497d7cb | ||
|
|
9600fb2efb | ||
|
|
6540fb511b | ||
|
|
55689edc6e | ||
|
|
5adae74ad8 | ||
|
|
7187e681e8 | ||
|
|
b106f4e66b | ||
|
|
869d982bfb | ||
|
|
11b7de55ca | ||
|
|
11912ddff3 | ||
|
|
ba7fc2cf6d | ||
|
|
114f34feed | ||
|
|
a611265534 | ||
|
|
ceaa5d6445 | ||
|
|
08b858a28f | ||
|
|
da24a8e348 | ||
|
|
2db010d4b7 | ||
|
|
35cc7a6374 | ||
|
|
0b2b7f3769 | ||
|
|
4fa97d8abc | ||
|
|
fc9fe84744 | ||
|
|
fc27b92ef8 | ||
|
|
7d508ba843 | ||
|
|
b312535e83 | ||
|
|
319cfc7542 | ||
|
|
7a81f941c1 | ||
|
|
b5e2d5c2e9 | ||
|
|
60872f9095 | ||
|
|
ded8525d23 | ||
|
|
1c9799cdab | ||
|
|
204747fc94 | ||
|
|
13444a2176 | ||
|
|
5f7cc092c7 | ||
|
|
b026d8ffef | ||
|
|
035344677f | ||
|
|
76756bed4a | ||
|
|
78d49f7ad1 | ||
|
|
d35c9d3ea9 | ||
|
|
dbf25344a9 | ||
|
|
e83edad329 | ||
|
|
656e03f799 | ||
|
|
72d5f555ca | ||
|
|
36f52612dc | ||
|
|
dac5ee262a | ||
|
|
f693c8288d | ||
|
|
40a3a192a7 | ||
|
|
814da6172e | ||
|
|
e729b096bb | ||
|
|
5d888d6dac | ||
|
|
f7fe4d09f9 | ||
|
|
ce50b9d241 | ||
|
|
a4a53a3e0e | ||
|
|
a20c8477d7 | ||
|
|
0d73819d17 | ||
|
|
ee9e2ad4a3 | ||
|
|
9664cdc72a | ||
|
|
b2caa71f23 | ||
|
|
b31424b529 | ||
|
|
b1446f87d7 | ||
|
|
fce0b9279b | ||
|
|
cc7d7cfb22 | ||
|
|
01aa52caa1 | ||
|
|
82cb690138 | ||
|
|
194b1b1428 | ||
|
|
55bdf10282 | ||
|
|
c87034ff39 | ||
|
|
53e6509db6 | ||
|
|
d81ab5abbe | ||
|
|
50268e609e | ||
|
|
46db6182b3 | ||
|
|
321cc097e8 | ||
|
|
97fde6a5c1 | ||
|
|
b92a2999a6 | ||
|
|
736801ef1f | ||
|
|
e774678ce8 | ||
|
|
28a0e09b64 | ||
|
|
57c5d332b0 | ||
|
|
96bc7bfc53 | ||
|
|
0b2082763b | ||
|
|
9975f76f3f | ||
|
|
8de08bd0e0 | ||
|
|
9289674ff2 | ||
|
|
bde36d85dc | ||
|
|
15ece3d939 | ||
|
|
3cd60c004c | ||
|
|
cd9a64f4b7 | ||
|
|
989d3dbb77 | ||
|
|
8b9e4eca77 | ||
|
|
91207627ba | ||
|
|
d458d30e6e | ||
|
|
75b382f53c | ||
|
|
650ab0a9ac | ||
|
|
a07bef0613 | ||
|
|
01b061890c | ||
|
|
a970337ef7 | ||
|
|
878b8af0b3 | ||
|
|
bde4e73cd1 | ||
|
|
b13a6e0943 | ||
|
|
0be9ee6c49 | ||
|
|
c19d15dbf6 | ||
|
|
27bab50e57 | ||
|
|
3ea85878c9 | ||
|
|
1ff415900a | ||
|
|
19cd0596a5 | ||
|
|
603fbf6254 | ||
|
|
317958257c | ||
|
|
51cc16013a | ||
|
|
6b565ba0ab | ||
|
|
c1bbd34f51 | ||
|
|
795ceb9f5b | ||
|
|
74e73a663b | ||
|
|
d3f34f0bae | ||
|
|
1e1cd929c9 | ||
|
|
b19f9326d1 | ||
|
|
cbe3e556ca | ||
|
|
ea2a3fb56d | ||
|
|
3f5eb4b858 | ||
|
|
898bba3827 | ||
|
|
63c3b1b5e8 | ||
|
|
a19a896da3 | ||
|
|
ac5f810a12 | ||
|
|
b03ad95e4c | ||
|
|
ed7d49644b | ||
|
|
73a7143ea3 | ||
|
|
80de313a26 | ||
|
|
fe2d89f6a3 | ||
|
|
e53ad65049 | ||
|
|
fcda0eae62 | ||
|
|
01323c4d2c | ||
|
|
d62705f509 | ||
|
|
3f26e78de1 | ||
|
|
b47f231701 | ||
|
|
ec8bb5634a | ||
|
|
bc39551fb1 | ||
|
|
a3e84ce41a | ||
|
|
11ffca8650 | ||
|
|
4584b1b74d | ||
|
|
1afee8c9ee | ||
|
|
5012c4efa6 | ||
|
|
83af384e80 | ||
|
|
6b32ea4acb | ||
|
|
f677121794 | ||
|
|
7118dfc74a | ||
|
|
55f400c205 | ||
|
|
9ba281f552 | ||
|
|
beece59947 | ||
|
|
0d43fc0781 | ||
|
|
e14142b4f6 | ||
|
|
765b6d2452 | ||
|
|
076d821e8c | ||
|
|
17985bf61f | ||
|
|
03dbeddabb | ||
|
|
ae372998f0 | ||
|
|
262ce571ba | ||
|
|
c0eb96f3cd | ||
|
|
cfbf4e109d | ||
|
|
e05af0dfcc | ||
|
|
64f078263f | ||
|
|
c4aa8c91f8 | ||
|
|
a91285a40f | ||
|
|
d56578b8be | ||
|
|
b05c14e880 | ||
|
|
60644590f4 | ||
|
|
a8b1dc11a5 | ||
|
|
2cbeb28cd7 | ||
|
|
579c23907f | ||
|
|
a16ae62fb3 | ||
|
|
0bf623c9d4 | ||
|
|
67dd9b8e01 | ||
|
|
7b1824cf36 | ||
|
|
085adbfdaa | ||
|
|
7fb70627f9 | ||
|
|
ea12e5a054 | ||
|
|
a5b24ac8b7 | ||
|
|
830ca60883 | ||
|
|
f0c1bc88a5 | ||
|
|
cea67261d5 | ||
|
|
c33934c211 | ||
|
|
3ec0b9aba2 | ||
|
|
748b359615 | ||
|
|
e22734dd54 | ||
|
|
6dc6f801a8 | ||
|
|
c6c95cdde7 | ||
|
|
c0d0d931b0 | ||
|
|
991a040f3f | ||
|
|
29b9e57bd8 | ||
|
|
f52bd0e51c | ||
|
|
b8c03ecc10 | ||
|
|
7c09419fae | ||
|
|
576c99d702 | ||
|
|
a7c2f60307 | ||
|
|
2a2101d926 | ||
|
|
1379617f23 | ||
|
|
85fba27644 | ||
|
|
17084b4ec3 | ||
|
|
b77d6076ab | ||
|
|
2997aa9784 | ||
|
|
df77ec6ee1 | ||
|
|
d5409a80a3 | ||
|
|
c42c0b49f9 | ||
|
|
23893f88d5 | ||
|
|
240d4faf09 | ||
|
|
0e8eb5eb16 | ||
|
|
827dae53a5 | ||
|
|
6d49928a11 | ||
|
|
f63028c98c | ||
|
|
a4d8100b73 | ||
|
|
34d328507d | ||
|
|
245384c720 | ||
|
|
fb7a6e57b2 | ||
|
|
5af59582df | ||
|
|
8e7647a3b5 | ||
|
|
c57e1ad0e9 | ||
|
|
953183a956 | ||
|
|
29ab73e5c9 | ||
|
|
eced8e1ea6 | ||
|
|
600a6898f1 | ||
|
|
9e14c03322 | ||
|
|
0125d075b2 | ||
|
|
5e68906a22 | ||
|
|
a0618d1b5d | ||
|
|
e5a0a2fa34 | ||
|
|
25cc16c408 | ||
|
|
3f430fc8e0 | ||
|
|
5a3bb27566 | ||
|
|
31fed55966 | ||
|
|
d056cd2f13 | ||
|
|
06029f2827 | ||
|
|
c07efc1595 | ||
|
|
93a320ded2 | ||
|
|
b14778c7ac | ||
|
|
73544c3fc1 | ||
|
|
bfaf4f6f96 | ||
|
|
84c0fe7100 | ||
|
|
a541161bd0 | ||
|
|
d6496ba028 | ||
|
|
3d6d0c70a0 | ||
|
|
7461de1292 | ||
|
|
4a3deb30b8 | ||
|
|
bba3cbfb47 | ||
|
|
bba915b898 | ||
|
|
f8934ef315 | ||
|
|
4e84e5d32c | ||
|
|
536ccfd38f | ||
|
|
514c24fefa | ||
|
|
e3b556bdd0 | ||
|
|
dea15469c1 | ||
|
|
442fdec098 | ||
|
|
3b65bfa2d5 | ||
|
|
ae5b47db1e | ||
|
|
cb4accec08 | ||
|
|
1349640272 | ||
|
|
f65e1f6e55 | ||
|
|
6eb7cd0f26 | ||
|
|
bff337ac03 | ||
|
|
11a6cdd2e5 | ||
|
|
d6a72097c0 | ||
|
|
d166294de6 | ||
|
|
35cd54a7d9 | ||
|
|
4a12d8e9b3 | ||
|
|
0a4164431f | ||
|
|
d04673204e | ||
|
|
8a56ca74a5 | ||
|
|
b1a2f89693 | ||
|
|
3c3eb138e0 | ||
|
|
01599086f7 | ||
|
|
744dc3082b | ||
|
|
7363a7c2d4 | ||
|
|
79136ba5b7 | ||
|
|
c951eefdd4 | ||
|
|
f44cb5e57d | ||
|
|
e5cbb6afeb | ||
|
|
18722a45ba | ||
|
|
88f6fb61c9 | ||
|
|
68802999ce | ||
|
|
fd8c84d3c0 | ||
|
|
25e7496927 | ||
|
|
72a24df665 | ||
|
|
d832ce6410 | ||
|
|
5d4d91c737 | ||
|
|
c617b72483 | ||
|
|
83dc58cc82 | ||
|
|
79b9a4a649 | ||
|
|
4794037b2b | ||
|
|
f7a4853e78 | ||
|
|
27fef48103 | ||
|
|
6ec9ab7c81 | ||
|
|
332d607f42 | ||
|
|
95da8c4197 | ||
|
|
a4cb07eb3b | ||
|
|
9dcc7b7a25 | ||
|
|
4ea399a6e4 | ||
|
|
ec3366bcce | ||
|
|
35a217ae6e | ||
|
|
3ef634693d | ||
|
|
3a925edd63 | ||
|
|
e7e85e0c2f | ||
|
|
aec6d40af8 | ||
|
|
128ba28da8 | ||
|
|
297f21a9dd | ||
|
|
77a0371c4b | ||
|
|
7d1528ca1e | ||
|
|
b82b0c6167 | ||
|
|
bd59707f61 | ||
|
|
4130ea2dd3 | ||
|
|
86db993344 | ||
|
|
accf7e117b | ||
|
|
63fe89f064 | ||
|
|
8ce0b64fe3 | ||
|
|
5a2610fd9e | ||
|
|
f3977f54d5 | ||
|
|
e82e6200b0 | ||
|
|
4b9036a4ce | ||
|
|
33c4d9c244 | ||
|
|
14115678ef | ||
|
|
d5fb143f28 | ||
|
|
6ab5eb31ca | ||
|
|
3e75bc405c | ||
|
|
8405c38557 | ||
|
|
9818eb699e | ||
|
|
21a378e078 | ||
|
|
9a3a96ed19 | ||
|
|
bd30cc4b0f | ||
|
|
02d04ecb57 | ||
|
|
e23311e817 | ||
|
|
60fe855813 | ||
|
|
5c0bd7bf90 | ||
|
|
d4d6e8c5a0 | ||
|
|
e779dfbe9d | ||
|
|
9e39a3cc64 | ||
|
|
7e02a7d928 | ||
|
|
8c3fe1bd80 | ||
|
|
0b72160c93 | ||
|
|
f529a0cc3f | ||
|
|
b4520d91b5 | ||
|
|
771985d063 | ||
|
|
feba28f55d | ||
|
|
32d3376d44 | ||
|
|
7ae51daf39 | ||
|
|
b5a7e69040 | ||
|
|
7f431a1e7b | ||
|
|
c2a7aae848 | ||
|
|
9a3fff9c09 | ||
|
|
90ad8b016e | ||
|
|
ed6fc25507 | ||
|
|
1b13ef9f34 | ||
|
|
7f7e7e2e82 | ||
|
|
dfdc866dfc | ||
|
|
58021c5813 | ||
|
|
aa1fb1d921 | ||
|
|
25cb70e766 | ||
|
|
48dd69fbf6 | ||
|
|
bfa2bcb3e4 | ||
|
|
ebad32f0d3 | ||
|
|
167dd4dff0 | ||
|
|
f9cf7365fd | ||
|
|
c03b5100d3 | ||
|
|
745a605052 | ||
|
|
f6e63144fc | ||
|
|
65b6ff90c3 | ||
|
|
0261a20572 | ||
|
|
878d0b7e42 | ||
|
|
1705f29cbf | ||
|
|
22abc94065 | ||
|
|
5ad1ee917e | ||
|
|
37dcf7e9a4 | ||
|
|
bf270794e9 | ||
|
|
e8c43da0c9 | ||
|
|
f910c6da18 | ||
|
|
8a76fd33a9 | ||
|
|
5c4153cb6b | ||
|
|
7f0ee95236 | ||
|
|
c3e47fc417 | ||
|
|
555490129c | ||
|
|
2dcc49c6a9 | ||
|
|
0d294990c5 | ||
|
|
9924aa4e93 | ||
|
|
4f44cf6840 | ||
|
|
d9e4d2da95 | ||
|
|
fdc46093c6 | ||
|
|
0cff00c426 | ||
|
|
5f22941164 | ||
|
|
4f6c587388 | ||
|
|
b2349c9757 | ||
|
|
47cd0648ac | ||
|
|
70746f8786 | ||
|
|
919fd87bbc | ||
|
|
a80c0a6a3b | ||
|
|
7f78515dd0 | ||
|
|
d466d47751 | ||
|
|
a834620606 | ||
|
|
b898001fa3 | ||
|
|
c9eb224aaa | ||
|
|
885c764c87 | ||
|
|
99996bb82f | ||
|
|
9b42b21d44 | ||
|
|
d1fcd3394c | ||
|
|
e54cab033b | ||
|
|
9a01ae279c | ||
|
|
cfc67e2700 | ||
|
|
996d35408a | ||
|
|
333af057f4 | ||
|
|
45d7d06e0f | ||
|
|
acce63ce24 | ||
|
|
80c9ce35cb | ||
|
|
e51a64c242 | ||
|
|
59cf2e4d79 | ||
|
|
7edfc676f1 | ||
|
|
f197b71950 | ||
|
|
c61404545c | ||
|
|
9d349dae5b | ||
|
|
779ee45b20 | ||
|
|
f0c5802471 | ||
|
|
4b7dc3921c | ||
|
|
100e96f843 | ||
|
|
30391805dc | ||
|
|
49f0424956 | ||
|
|
eea76dde54 | ||
|
|
74be4a8e7f | ||
|
|
4452839d76 | ||
|
|
eae3785c21 | ||
|
|
d818abc578 | ||
|
|
80f8024ae8 | ||
|
|
294a3a168a | ||
|
|
59b1e4203a | ||
|
|
598613e189 | ||
|
|
2e69f2f967 | ||
|
|
ee60f5e59b | ||
|
|
c652792404 | ||
|
|
af04890cd9 | ||
|
|
6bdae9f53e | ||
|
|
10657bfd78 | ||
|
|
400570f4b9 | ||
|
|
48eacbc5cc | ||
|
|
787d2a4456 | ||
|
|
a8088cdae7 | ||
|
|
29f3ce0278 | ||
|
|
b787d9a27d | ||
|
|
8f72a4d6eb | ||
|
|
b4faf8a0a5 | ||
|
|
f8042d2e99 | ||
|
|
f3a3707b95 | ||
|
|
82e5f6b50f | ||
|
|
b06784d9c1 | ||
|
|
6910fde9a2 | ||
|
|
d70f82b26e | ||
|
|
0279b837ee | ||
|
|
510d02c7cf | ||
|
|
cc5cd9f21a | ||
|
|
8bdf09b71b | ||
|
|
ffa8a19eca | ||
|
|
dcfdb48dc2 | ||
|
|
a418295ece | ||
|
|
fda5cf70fc | ||
|
|
40d3602f55 | ||
|
|
3e6382a051 | ||
|
|
3dbd4f9cfc | ||
|
|
a807c251d1 | ||
|
|
9ec5532ea6 | ||
|
|
eb5f3045f4 | ||
|
|
3e72fa3430 | ||
|
|
59c6bc6e96 | ||
|
|
28fc390837 | ||
|
|
1a32f5d161 | ||
|
|
05642967a7 | ||
|
|
a6ac55f9f2 | ||
|
|
d83061b2bb | ||
|
|
cb9a4960d2 | ||
|
|
96ed8f2867 | ||
|
|
743b73f0bf | ||
|
|
7ad26fe339 | ||
|
|
359b6e8d28 | ||
|
|
f0051fcc22 | ||
|
|
2dca6fe24c | ||
|
|
ce662ee561 | ||
|
|
fb06244e1d | ||
|
|
ee2d700298 | ||
|
|
adcdadd0f1 | ||
|
|
1d5b752c42 | ||
|
|
b70629c592 | ||
|
|
3fb72e39d4 | ||
|
|
69275c7fc7 | ||
|
|
b747f9fc62 | ||
|
|
a66237d108 | ||
|
|
97d53b7850 | ||
|
|
c9a2a93908 | ||
|
|
7509e117c7 | ||
|
|
899dd5cb52 | ||
|
|
751c020935 | ||
|
|
6a751a66cd | ||
|
|
c21355e1af | ||
|
|
ba90993038 | ||
|
|
c3841e14e0 | ||
|
|
4e20be58a1 | ||
|
|
418fd2565d | ||
|
|
464578bdb8 | ||
|
|
f4712ed3d6 | ||
|
|
b48b335afb | ||
|
|
c77710fa95 | ||
|
|
402116ff4c | ||
|
|
c362239d15 | ||
|
|
bed2816fb8 | ||
|
|
fd5bdecf88 | ||
|
|
a96a1ec7e2 | ||
|
|
4e588cd59a | ||
|
|
354f223d7e | ||
|
|
eacd16331c | ||
|
|
5b215fe72a | ||
|
|
7ba70f4d44 | ||
|
|
732b61c160 | ||
|
|
19f23f4ea1 | ||
|
|
8c8641c1a8 | ||
|
|
495157a5c3 | ||
|
|
d0b1eb44b5 | ||
|
|
aea4081784 | ||
|
|
a2b70003ec | ||
|
|
e4b37dde33 | ||
|
|
8236c18239 | ||
|
|
aefff852bc | ||
|
|
f23187ba10 | ||
|
|
bf6c35388f | ||
|
|
99fe7170f8 | ||
|
|
488822e454 | ||
|
|
a9dc432786 | ||
|
|
a9632a9024 | ||
|
|
e26ada0623 | ||
|
|
05f5548747 | ||
|
|
cb95978428 | ||
|
|
f3371acb3b | ||
|
|
7f930cf0c9 | ||
|
|
3136511af3 | ||
|
|
aff8fd93db | ||
|
|
f6a4181658 | ||
|
|
760489f6f9 | ||
|
|
3407301b98 | ||
|
|
399c6c877c | ||
|
|
df98acdc9a | ||
|
|
ca9f976241 | ||
|
|
1d715cf631 | ||
|
|
704c604ee4 | ||
|
|
8c8d9f15d2 | ||
|
|
94c53a0d33 | ||
|
|
5e48094d77 | ||
|
|
57042c593a | ||
|
|
e930a24f48 | ||
|
|
7052c19af4 | ||
|
|
59bb4270fb | ||
|
|
8906a9b93e | ||
|
|
201007a46a | ||
|
|
41aa4edb91 | ||
|
|
5635dfd447 | ||
|
|
f48ca609e5 | ||
|
|
2df8d8690b | ||
|
|
2782f89a21 | ||
|
|
6e1a831f69 | ||
|
|
08f189753a | ||
|
|
048c1b0cc7 | ||
|
|
946ce1873b | ||
|
|
01d4dc7c2e | ||
|
|
705abf68be | ||
|
|
13eeaf5321 | ||
|
|
0a160bfba5 | ||
|
|
ee70ab63b6 | ||
|
|
6b6e49efd3 | ||
|
|
949d88736c | ||
|
|
22c2bf33c0 | ||
|
|
39a62977fe | ||
|
|
6aea176253 | ||
|
|
45e088a635 | ||
|
|
113db63e2d | ||
|
|
8fa9d696b1 | ||
|
|
f64e68beb7 | ||
|
|
a19ee36bf8 | ||
|
|
f6cab9cc54 | ||
|
|
8beebf67e2 | ||
|
|
ab9a7cfa5a | ||
|
|
45277ecfef | ||
|
|
dcb08b00f9 | ||
|
|
126f526f9f | ||
|
|
c750cf78a4 | ||
|
|
4e369e372b | ||
|
|
150010839d | ||
|
|
1dc4dfdef8 | ||
|
|
2175796c6d | ||
|
|
42ad2e5a3d | ||
|
|
ebe4ad6b96 | ||
|
|
9f70c63544 | ||
|
|
afb7c6cd7f | ||
|
|
9114c2a8c2 | ||
|
|
33e29746b7 | ||
|
|
b2900c5751 | ||
|
|
f368c066d6 | ||
|
|
5129d6a698 | ||
|
|
65f7b25668 | ||
|
|
b7b05be5af | ||
|
|
863de3bfa4 | ||
|
|
e4a925969d | ||
|
|
6be81dfbea | ||
|
|
72709618b0 | ||
|
|
28e968cad4 | ||
|
|
3ba5e319a5 | ||
|
|
45ce1ce649 | ||
|
|
67998c5535 | ||
|
|
3dfe673b93 | ||
|
|
1ebfea677b | ||
|
|
ac8bb3a9cf | ||
|
|
30b0c06eb3 | ||
|
|
1e3a5892e9 | ||
|
|
db94c1e5ee | ||
|
|
7a043abc64 | ||
|
|
651684c8e4 | ||
|
|
b50eebca22 | ||
|
|
8f8d293439 | ||
|
|
3a6b97aed1 | ||
|
|
35bd0ab3bc | ||
|
|
0a85ffb366 | ||
|
|
7bfbad11a0 | ||
|
|
3b1339b60a | ||
|
|
726db46420 | ||
|
|
45c9d3495f | ||
|
|
0258c235d5 | ||
|
|
c2f9d7abfe | ||
|
|
e53758abd9 | ||
|
|
4e6e61b736 | ||
|
|
7ac82a64c1 | ||
|
|
aef0d31d98 | ||
|
|
e521032291 | ||
|
|
6d34e1f594 | ||
|
|
a8bcc48530 | ||
|
|
52332fe578 | ||
|
|
9b42bdba7b | ||
|
|
73e073b5fe | ||
|
|
506b6383e2 | ||
|
|
fd4f675615 | ||
|
|
280e9cce25 | ||
|
|
498e857d07 | ||
|
|
46c80e8a37 | ||
|
|
8923a9dcc1 | ||
|
|
167a56c962 | ||
|
|
bd6bca881d | ||
|
|
60109beab1 | ||
|
|
b3026581d8 | ||
|
|
4705e9fd0f | ||
|
|
6a6514365d | ||
|
|
7679753b51 | ||
|
|
c27a009d02 | ||
|
|
3974dac2ee | ||
|
|
c8bb46178a | ||
|
|
2c92d4afec | ||
|
|
356c83eb5a | ||
|
|
425f8e4758 | ||
|
|
d389b54a40 | ||
|
|
9ec9867bf5 | ||
|
|
73f7552f28 | ||
|
|
8349936447 | ||
|
|
4b98ddcf21 | ||
|
|
f1b041dd47 | ||
|
|
766c77f32b | ||
|
|
1f051b2ef0 | ||
|
|
3676e52899 | ||
|
|
4ad70054ae | ||
|
|
dbd1ef9ff8 | ||
|
|
803a9843ea | ||
|
|
ae1a98211a | ||
|
|
6a3e0dabbd | ||
|
|
7900b7b44e | ||
|
|
16a8a37bd4 | ||
|
|
dee2b68a8a | ||
|
|
4182f7ca04 | ||
|
|
d29d3c6e2a | ||
|
|
3522f3e7fd | ||
|
|
1f46ac6e32 | ||
|
|
7de46bd778 | ||
|
|
40a4c23839 | ||
|
|
c32b3312ea | ||
|
|
8fa0a10103 | ||
|
|
6b4028a456 | ||
|
|
2f780447b6 | ||
|
|
ed4164d03e | ||
|
|
fef05061b4 | ||
|
|
8fb0d9ffa1 | ||
|
|
2c17e80367 | ||
|
|
dcdcc3432b | ||
|
|
42d719d3b5 | ||
|
|
8e019e8ff9 | ||
|
|
2720887870 | ||
|
|
69fe1670c3 | ||
|
|
1fcf0bf3e6 | ||
|
|
86c0d671e4 | ||
|
|
338a450746 | ||
|
|
c84b1effba | ||
|
|
8be2d6a7d0 | ||
|
|
8830b2b08a | ||
|
|
f4cd9b78b4 | ||
|
|
179c77f09c | ||
|
|
911fd058a6 | ||
|
|
8d8def030a | ||
|
|
ac89630e11 | ||
|
|
f05e1f1693 | ||
|
|
e59ab24424 | ||
|
|
4254320fc9 | ||
|
|
f5ff73d87d | ||
|
|
ed5ffbd813 | ||
|
|
afc8a2f76d | ||
|
|
8f8561d175 | ||
|
|
36b54ad384 | ||
|
|
668b7ca1b2 | ||
|
|
9bc48c16c7 | ||
|
|
a980793630 | ||
|
|
94a2f544d5 | ||
|
|
3ad3c163ed | ||
|
|
714a92af06 | ||
|
|
c7b1879ba9 | ||
|
|
64a53dccd1 | ||
|
|
15d0e3d702 | ||
|
|
d3ded0c897 | ||
|
|
d473d3fe95 | ||
|
|
9688633de9 | ||
|
|
b4f860990d | ||
|
|
e7771046d3 | ||
|
|
ce86b82eed | ||
|
|
3a3e470ac8 | ||
|
|
029807ec6b | ||
|
|
affdd0454a | ||
|
|
fd3172e5a9 | ||
|
|
2db8f8f3ff | ||
|
|
78c2a92949 | ||
|
|
75cd2e1422 | ||
|
|
1231089989 | ||
|
|
86f14fc006 | ||
|
|
f9966694b8 | ||
|
|
737012db0f | ||
|
|
f3d4bdcc3a | ||
|
|
5863d697be | ||
|
|
29627a396b | ||
|
|
ab72d6c3ef | ||
|
|
77f2e7f756 | ||
|
|
83cbc23e71 | ||
|
|
01d1453453 | ||
|
|
0b733a7743 | ||
|
|
afa99d3034 | ||
|
|
67f63f6afe | ||
|
|
257a3ecb40 | ||
|
|
69283ec1e5 | ||
|
|
3fa5e0c105 | ||
|
|
45fa72005b | ||
|
|
7f1681944e | ||
|
|
7a8c0ba119 | ||
|
|
bc0b86652f | ||
|
|
6174cdabde | ||
|
|
83b002cb91 | ||
|
|
80f06334aa | ||
|
|
9125cc3af1 | ||
|
|
308bba8ca2 | ||
|
|
5659a33a7c | ||
|
|
7d8144a1c3 | ||
|
|
fbec5ec038 | ||
|
|
bc2f283ea8 | ||
|
|
3f822ae3eb | ||
|
|
bc9ab7c639 | ||
|
|
fa153e57ce | ||
|
|
0516c4fb9a | ||
|
|
3e9253a78e | ||
|
|
9dbb221082 | ||
|
|
fd3f0a22e2 | ||
|
|
2d05133150 | ||
|
|
4fb65c7090 | ||
|
|
e7c8d17097 | ||
|
|
ddacc4ff4b | ||
|
|
011ccf495e | ||
|
|
460b430fa3 | ||
|
|
fef54c8599 | ||
|
|
f2535a4b0c | ||
|
|
a876d967b7 | ||
|
|
8a3c448712 | ||
|
|
ac199cf65a | ||
|
|
e272c8b7f3 | ||
|
|
b86b4ff67f | ||
|
|
15233b73b6 | ||
|
|
75deddff97 | ||
|
|
7817706d73 | ||
|
|
15baf7f5dc | ||
|
|
b4b5228d00 | ||
|
|
52312c5450 | ||
|
|
ec837e3877 | ||
|
|
b5bfd0831d | ||
|
|
3bc80163e3 | ||
|
|
6879a16b8c | ||
|
|
ea18684ccd | ||
|
|
9ccaf2c7e5 | ||
|
|
329c3b1320 | ||
|
|
1ca8af3c4a | ||
|
|
a9e5167ccd | ||
|
|
46b3567fc9 | ||
|
|
724ce1e509 | ||
|
|
afc91edbb2 | ||
|
|
850921b289 | ||
|
|
133af98ad1 | ||
|
|
4b6a88ac32 | ||
|
|
22afe4d49f | ||
|
|
21b1e0d7f5 | ||
|
|
6ae813378c | ||
|
|
99c1902c1e | ||
|
|
883d8efe9b | ||
|
|
dc72e1d18f | ||
|
|
55a9290c44 | ||
|
|
b25d072dab | ||
|
|
72af12b41e | ||
|
|
66919726ca | ||
|
|
f91ea98d7e | ||
|
|
f37444d50a | ||
|
|
43580be7e8 | ||
|
|
a6dd46d129 | ||
|
|
757bd5aa9f | ||
|
|
e16ea086a6 | ||
|
|
4c876ac6c7 | ||
|
|
cbff202864 | ||
|
|
3ab3f9bb1b | ||
|
|
7a382c24af | ||
|
|
94ac5f6689 | ||
|
|
f35fa44c8b | ||
|
|
2acb388bdd | ||
|
|
4f79cf0b8c | ||
|
|
e593341696 | ||
|
|
a48e5a6ea0 | ||
|
|
f8a78d1604 | ||
|
|
2f889a8704 | ||
|
|
4e4766497d | ||
|
|
032bf88d55 | ||
|
|
8ea84f7d96 | ||
|
|
a00cf15fa4 | ||
|
|
155f570f17 | ||
|
|
d7485623be | ||
|
|
c4ef64472d | ||
|
|
8b986f76fa | ||
|
|
66ea2ff9d7 | ||
|
|
34f6de4efd | ||
|
|
cf58724481 | ||
|
|
1db981ae20 | ||
|
|
22d98b8991 | ||
|
|
ce77a63ed8 | ||
|
|
b307f0aa00 | ||
|
|
94ac7c8bf2 | ||
|
|
3de880dd3a | ||
|
|
5443d7c61a | ||
|
|
8ec7a8139f | ||
|
|
efa6d077c1 | ||
|
|
fa71c538c5 | ||
|
|
a983b3c318 | ||
|
|
1e9922a62e | ||
|
|
3e24113e1b | ||
|
|
d02b9cfab5 | ||
|
|
8c33ac660d | ||
|
|
22f6f2d7b5 | ||
|
|
bf1e35bba0 | ||
|
|
df48a08fe8 | ||
|
|
c6258a6174 | ||
|
|
a38c2086d0 | ||
|
|
4db3876129 | ||
|
|
1c5782ebec | ||
|
|
03856c1827 | ||
|
|
bcda9d7a9b | ||
|
|
c401b1bde7 | ||
|
|
31b0cfe1b6 | ||
|
|
f4f411ab75 | ||
|
|
7856855de5 | ||
|
|
ee55ca3e37 | ||
|
|
a40a9e9be6 | ||
|
|
e45f0ab83f | ||
|
|
fff90c3904 | ||
|
|
d06effc960 | ||
|
|
8d08743360 | ||
|
|
7c77c8a229 | ||
|
|
9b683dbb6a | ||
|
|
4328f0f58e | ||
|
|
062da007a8 | ||
|
|
e31b4a603d | ||
|
|
196b7497e4 | ||
|
|
8cfdce6e1b | ||
|
|
8ed6d69da1 | ||
|
|
1d62aa80a0 | ||
|
|
b81dea93ab | ||
|
|
364a1588a2 | ||
|
|
9a88f0b09a | ||
|
|
92a614b4b5 | ||
|
|
f4262f39c4 | ||
|
|
f17af3ca50 | ||
|
|
261ef768de | ||
|
|
7fba2bdcba | ||
|
|
7d760b9f42 | ||
|
|
a3a65d7a3b | ||
|
|
24fc2c2ce1 | ||
|
|
796003063f | ||
|
|
53412c31b6 | ||
|
|
023c19ee7c | ||
|
|
532da69263 | ||
|
|
ec63af57e6 | ||
|
|
56ca158f29 | ||
|
|
e143c87bfd | ||
|
|
3a03e5040e | ||
|
|
c147658497 | ||
|
|
bc4b354421 | ||
|
|
dd60a6ea88 | ||
|
|
cab18a8347 | ||
|
|
7a7aaba633 | ||
|
|
2cfa16f328 | ||
|
|
a73db6b36d | ||
|
|
2c859734a3 | ||
|
|
4dac190cbd | ||
|
|
8136f8eff6 | ||
|
|
13959496e8 | ||
|
|
e079a06796 | ||
|
|
1ece2bd8e2 | ||
|
|
93e9f0cc1c | ||
|
|
962f065410 | ||
|
|
ffd609ae8e | ||
|
|
f047ae115c | ||
|
|
036dae1f5f | ||
|
|
cff63e6469 | ||
|
|
f9be2d1bec | ||
|
|
7046766386 | ||
|
|
8b4c5498b9 | ||
|
|
af62fab676 | ||
|
|
defe4749f0 | ||
|
|
ff2086e4c9 | ||
|
|
a3ccf78bf7 | ||
|
|
b1285b61ef | ||
|
|
9cc80f0dda | ||
|
|
1f38eed471 | ||
|
|
d8c7856966 | ||
|
|
420c16ad8c | ||
|
|
a07e5eeddb | ||
|
|
250179ee59 | ||
|
|
d2279aa36b | ||
|
|
fbd98588f2 | ||
|
|
877c321664 | ||
|
|
c6efa74d23 | ||
|
|
9f196828ef | ||
|
|
2eb72ad756 | ||
|
|
590be6b406 | ||
|
|
5201752c8e | ||
|
|
92691578dd | ||
|
|
cbc3172627 | ||
|
|
fac4729dfe | ||
|
|
ca6fcb5441 | ||
|
|
3b12d31f1b | ||
|
|
d93daf50fd | ||
|
|
8ec35f5d5f | ||
|
|
d61e1ca97e | ||
|
|
b284d9cb74 | ||
|
|
ef9e6e9e6c | ||
|
|
f558dc5a5b | ||
|
|
544e5cd964 | ||
|
|
3dfb48c7d7 | ||
|
|
ecd7f2fefd | ||
|
|
73a7fe09f3 | ||
|
|
fec8eb3ae2 | ||
|
|
db84a65931 | ||
|
|
c9a8625199 | ||
|
|
0c316a7ea3 | ||
|
|
0ff1db33bd | ||
|
|
b2283db2dc | ||
|
|
1d90e47ef2 | ||
|
|
461ee0b583 | ||
|
|
4b47ad45d4 | ||
|
|
8a15f32b00 | ||
|
|
cc1ee25cd3 | ||
|
|
f482b18147 | ||
|
|
c1329578f9 | ||
|
|
4d92dafb4f | ||
|
|
2516a1c3f3 | ||
|
|
dc01193951 | ||
|
|
12eae5a462 | ||
|
|
078cfba980 | ||
|
|
34d1f12ae2 | ||
|
|
96c205bf0d | ||
|
|
5005d77666 | ||
|
|
f4d0274899 | ||
|
|
c9f23aeee1 | ||
|
|
589b28532b | ||
|
|
9e462acb32 | ||
|
|
7c80270673 | ||
|
|
59c2ed2459 | ||
|
|
d14d0734e8 | ||
|
|
e10a09fc61 | ||
|
|
8ed44ada20 | ||
|
|
54e83ed342 | ||
|
|
fe423d1e68 | ||
|
|
559ae7592c | ||
|
|
ab5f6817cf | ||
|
|
54b080695e | ||
|
|
4e66e4e8e1 | ||
|
|
ab29f07c13 | ||
|
|
82150eca62 | ||
|
|
64c0045ad6 | ||
|
|
04ee4c5a0f | ||
|
|
6afeab4fad | ||
|
|
e49e1a1eea | ||
|
|
105d7f9e1d | ||
|
|
a4c6ae7fe4 | ||
|
|
2279ab984e | ||
|
|
0b8e0fa179 | ||
|
|
4c34730904 | ||
|
|
0e0b991fa2 | ||
|
|
9d6950d80c | ||
|
|
07db1871a6 | ||
|
|
f87f2f7058 | ||
|
|
3e253a0978 | ||
|
|
d44bb97e2b | ||
|
|
1c52a960c7 | ||
|
|
bfa4e6941a | ||
|
|
7452eee4a3 | ||
|
|
119a701d60 | ||
|
|
f2de9a4b3b | ||
|
|
896304e6fb | ||
|
|
71c5e456e3 | ||
|
|
a5047813f0 | ||
|
|
8dd78abe91 | ||
|
|
7e5f7389a5 | ||
|
|
414a98b879 | ||
|
|
ca2343a2f4 | ||
|
|
ac836e2011 | ||
|
|
f7c47e3a8b | ||
|
|
92dc364364 | ||
|
|
1a1919971a | ||
|
|
595055073c | ||
|
|
832befc9a7 | ||
|
|
3ef4a6388d | ||
|
|
63a5800025 | ||
|
|
11c875c4a3 | ||
|
|
0f57f83093 | ||
|
|
33276a1724 | ||
|
|
adeb627556 | ||
|
|
d45a5c0b46 |
2
.github/workflows/beta.yml
vendored
2
.github/workflows/beta.yml
vendored
@@ -108,7 +108,7 @@ jobs:
|
||||
|
||||
#Telegram
|
||||
curl -F "chat_id=${{ secrets.TELEGRAM_CHANNEL_ID }}" \
|
||||
-F "document=@app/build/outputs/apk/google/alpha/app-google-universal-alpha.apk" \
|
||||
-F "document=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" \
|
||||
-F "caption=Alpha-Build: ${VERSION}: ${commit_messages}" \
|
||||
https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument
|
||||
|
||||
|
||||
675
LICENSE.md
675
LICENSE.md
@@ -1,17 +1,674 @@
|
||||
## Unabandon Public License (UPL)
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
**Preamble**
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
This Unabandon Public License (UPL) is designed to ensure the continued development and public availability of source code based on works released under the GNU General Public License Version 3 (GPLv3) while upholding the core principles of GPLv3. This license extends GPLv3 by mandating public accessibility of source code for any derivative works.
|
||||
Preamble
|
||||
|
||||
**Body**
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
1. **Incorporation of GPLv3:** This UPL incorporates all terms and conditions of the GNU General Public License Version 3 (GPLv3) as published by the Free Software Foundation. You can find the complete text of GPLv3 at [https://www.gnu.org/licenses/licenses.en.html](https://www.gnu.org/licenses/licenses.en.html).
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
2. **Public Source Requirement:** In addition to the terms of GPLv3, the source code for any software distributed under this license, including modifications and derivative works, must be publicly available. Public availability means the source code must be accessible to anyone through a publicly accessible repository or download link without any access restrictions or fees.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
3. **Source Code Availability:** The source code must be made publicly available using a recognized open-source hosting platform (e.g., GitHub, GitLab) or be downloadable from a publicly accessible website. The chosen method must clearly identify the source code and its corresponding licensed work.
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
**Termination**
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
This UPL terminates automatically if the terms and conditions are not followed by the licensee.
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
@@ -18,8 +18,8 @@ android {
|
||||
minSdk 21
|
||||
targetSdk 34
|
||||
versionCode((System.currentTimeMillis() / 60000).toInteger())
|
||||
versionName "3.1.0"
|
||||
versionCode 300100000
|
||||
versionName "3.0.0"
|
||||
versionCode 300000000
|
||||
signingConfig signingConfigs.debug
|
||||
|
||||
}
|
||||
@@ -51,7 +51,7 @@ android {
|
||||
}
|
||||
debug {
|
||||
applicationIdSuffix ".beta"
|
||||
versionNameSuffix "-beta01"
|
||||
versionNameSuffix "-beta02"
|
||||
manifestPlaceholders.icon_placeholder = "@mipmap/ic_launcher_beta"
|
||||
manifestPlaceholders.icon_placeholder_round = "@mipmap/ic_launcher_beta_round"
|
||||
debuggable false
|
||||
@@ -81,13 +81,13 @@ android {
|
||||
dependencies {
|
||||
|
||||
// FireBase
|
||||
googleImplementation platform('com.google.firebase:firebase-bom:33.0.0')
|
||||
googleImplementation 'com.google.firebase:firebase-analytics-ktx:22.0.0'
|
||||
googleImplementation 'com.google.firebase:firebase-crashlytics-ktx:19.0.0'
|
||||
googleImplementation platform('com.google.firebase:firebase-bom:32.8.1')
|
||||
googleImplementation 'com.google.firebase:firebase-analytics-ktx:21.6.2'
|
||||
googleImplementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.4'
|
||||
// Core
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.browser:browser:1.8.0'
|
||||
implementation 'androidx.core:core-ktx:1.13.1'
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.6.2'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
@@ -99,7 +99,7 @@ dependencies {
|
||||
implementation 'com.github.Blatzar:NiceHttp:0.4.4'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'
|
||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||
implementation 'androidx.webkit:webkit:1.11.0'
|
||||
implementation 'androidx.webkit:webkit:1.10.0'
|
||||
implementation "com.anggrayudi:storage:1.5.5"
|
||||
|
||||
// Glide
|
||||
@@ -123,7 +123,7 @@ dependencies {
|
||||
implementation "androidx.mediarouter:mediarouter:1.7.0"
|
||||
|
||||
// UI
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'com.google.android.material:material:1.11.0'
|
||||
implementation 'com.github.RepoDevil:AnimatedBottomBar:7fcb9af'
|
||||
implementation 'com.flaviofaria:kenburnsview:1.0.7'
|
||||
implementation 'com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0'
|
||||
|
||||
@@ -129,8 +129,6 @@
|
||||
<data android:scheme="file" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".others.calc.CalcActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity android:name=".settings.FAQActivity" />
|
||||
<activity android:name=".settings.ReaderSettingsActivity" />
|
||||
<activity android:name=".settings.UserInterfaceSettingsActivity" />
|
||||
@@ -141,9 +139,6 @@
|
||||
<activity
|
||||
android:name=".settings.SettingsAboutActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".home.status.StatusActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".settings.SettingsAccountActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
@@ -200,15 +195,6 @@
|
||||
<activity
|
||||
android:name=".others.imagesearch.ImageSearchActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".util.MarkdownCreatorActivity"/>
|
||||
<activity android:name=".parsers.ParserTestActivity" />
|
||||
<activity
|
||||
android:name=".media.ReviewActivity"
|
||||
android:parentActivityName=".media.MediaDetailsActivity" />
|
||||
<activity
|
||||
android:name=".media.ReviewViewActivity"
|
||||
android:parentActivityName=".media.ReviewActivity" />
|
||||
<activity
|
||||
android:name=".media.SearchActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
@@ -228,9 +214,6 @@
|
||||
android:label="@string/manga"
|
||||
android:launchMode="singleTask" />
|
||||
<activity android:name=".media.GenreActivity" />
|
||||
<activity
|
||||
android:name=".media.MediaListViewActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".media.MediaDetailsActivity"
|
||||
android:parentActivityName=".MainActivity"
|
||||
@@ -238,11 +221,6 @@
|
||||
android:windowSoftInputMode="adjustResize|stateHidden" />
|
||||
<activity android:name=".media.CharacterDetailsActivity" />
|
||||
<activity android:name=".home.NoInternet" />
|
||||
<activity android:name=".others.CrashActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true"
|
||||
android:process=":error_process"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".media.anime.ExoplayerView"
|
||||
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
|
||||
@@ -393,7 +371,7 @@
|
||||
<activity
|
||||
android:name="eu.kanade.tachiyomi.extension.util.ExtensionInstallActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/Theme.AppCompat" />
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
|
||||
|
||||
<receiver
|
||||
android:name=".notifications.AlarmPermissionStateReceiver"
|
||||
@@ -457,7 +435,7 @@
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" />
|
||||
<service
|
||||
android:name=".addons.torrent.TorrentServerService"
|
||||
android:name=".addons.torrent.ServerService"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="dataSync"
|
||||
android:stopWithTask="true" />
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.multidex.MultiDex
|
||||
import androidx.multidex.MultiDexApplication
|
||||
import ani.dantotsu.addons.download.DownloadAddonManager
|
||||
@@ -29,16 +28,13 @@ import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager
|
||||
import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.launch
|
||||
import logcat.AndroidLogcatLogger
|
||||
import logcat.LogPriority
|
||||
import logcat.LogcatLogger
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.addSingletonFactory
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
|
||||
@@ -61,22 +57,15 @@ class App : MultiDexApplication() {
|
||||
|
||||
val mFTActivityLifecycleCallbacks = FTActivityLifecycleCallbacks()
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
PrefManager.init(this)
|
||||
|
||||
val crashlytics =
|
||||
ani.dantotsu.connections.crashlytics.CrashlyticsFactory.createCrashlytics()
|
||||
Injekt.addSingletonFactory<CrashlyticsInterface> { crashlytics }
|
||||
crashlytics.initialize(this)
|
||||
Logger.init(this)
|
||||
Thread.setDefaultUncaughtExceptionHandler(FinalExceptionHandler())
|
||||
Logger.log(Log.WARN, "App: Logging started")
|
||||
|
||||
Injekt.importModule(AppModule(this))
|
||||
Injekt.importModule(PreferenceModule(this))
|
||||
|
||||
val crashlytics = Injekt.get<CrashlyticsInterface>()
|
||||
crashlytics.initialize(this)
|
||||
|
||||
val useMaterialYou: Boolean = PrefManager.getVal(PrefName.UseMaterialYou)
|
||||
if (useMaterialYou) {
|
||||
@@ -98,6 +87,10 @@ class App : MultiDexApplication() {
|
||||
}
|
||||
crashlytics.setCustomKey("device Info", SettingsActivity.getDeviceInfo())
|
||||
|
||||
Logger.init(this)
|
||||
Thread.setDefaultUncaughtExceptionHandler(FinalExceptionHandler())
|
||||
Logger.log("App: Logging started")
|
||||
|
||||
initializeNetwork()
|
||||
|
||||
setupNotificationChannels()
|
||||
@@ -105,40 +98,44 @@ class App : MultiDexApplication() {
|
||||
LogcatLogger.install(AndroidLogcatLogger(LogPriority.VERBOSE))
|
||||
}
|
||||
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
animeExtensionManager = Injekt.get()
|
||||
animeExtensionManager = Injekt.get()
|
||||
mangaExtensionManager = Injekt.get()
|
||||
novelExtensionManager = Injekt.get()
|
||||
torrentAddonManager = Injekt.get()
|
||||
downloadAddonManager = Injekt.get()
|
||||
|
||||
val animeScope = CoroutineScope(Dispatchers.Default)
|
||||
animeScope.launch {
|
||||
animeExtensionManager.findAvailableExtensions()
|
||||
Logger.log("Anime Extensions: ${animeExtensionManager.installedExtensionsFlow.first()}")
|
||||
AnimeSources.init(animeExtensionManager.installedExtensionsFlow)
|
||||
}
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
mangaExtensionManager = Injekt.get()
|
||||
val mangaScope = CoroutineScope(Dispatchers.Default)
|
||||
mangaScope.launch {
|
||||
mangaExtensionManager.findAvailableExtensions()
|
||||
Logger.log("Manga Extensions: ${mangaExtensionManager.installedExtensionsFlow.first()}")
|
||||
MangaSources.init(mangaExtensionManager.installedExtensionsFlow)
|
||||
}
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
novelExtensionManager = Injekt.get()
|
||||
val novelScope = CoroutineScope(Dispatchers.Default)
|
||||
novelScope.launch {
|
||||
novelExtensionManager.findAvailableExtensions()
|
||||
Logger.log("Novel Extensions: ${novelExtensionManager.installedExtensionsFlow.first()}")
|
||||
NovelSources.init(novelExtensionManager.installedExtensionsFlow)
|
||||
}
|
||||
GlobalScope.launch {
|
||||
torrentAddonManager = Injekt.get()
|
||||
downloadAddonManager = Injekt.get()
|
||||
val addonScope = CoroutineScope(Dispatchers.Default)
|
||||
addonScope.launch {
|
||||
torrentAddonManager.init()
|
||||
downloadAddonManager.init()
|
||||
CommentsAPI.fetchAuthToken(this@App)
|
||||
|
||||
val useAlarmManager = PrefManager.getVal<Boolean>(PrefName.UseAlarmManager)
|
||||
val scheduler = TaskScheduler.create(this@App, useAlarmManager)
|
||||
try {
|
||||
scheduler.scheduleAllTasks(this@App)
|
||||
} catch (e: IllegalStateException) {
|
||||
Logger.log("Failed to schedule tasks")
|
||||
Logger.log(e)
|
||||
}
|
||||
}
|
||||
val commentsScope = CoroutineScope(Dispatchers.Default)
|
||||
commentsScope.launch {
|
||||
CommentsAPI.fetchAuthToken()
|
||||
}
|
||||
|
||||
val useAlarmManager = PrefManager.getVal<Boolean>(PrefName.UseAlarmManager)
|
||||
val scheduler = TaskScheduler.create(this, useAlarmManager)
|
||||
scheduler.scheduleAllTasks(this)
|
||||
scheduler.scheduleSingleWork(this)
|
||||
}
|
||||
|
||||
private fun setupNotificationChannels() {
|
||||
@@ -152,11 +149,7 @@ class App : MultiDexApplication() {
|
||||
|
||||
inner class FTActivityLifecycleCallbacks : ActivityLifecycleCallbacks {
|
||||
var currentActivity: Activity? = null
|
||||
var lastActivity: String? = null
|
||||
override fun onActivityCreated(p0: Activity, p1: Bundle?) {
|
||||
lastActivity = p0.javaClass.simpleName
|
||||
}
|
||||
|
||||
override fun onActivityCreated(p0: Activity, p1: Bundle?) {}
|
||||
override fun onActivityStarted(p0: Activity) {
|
||||
currentActivity = p0
|
||||
}
|
||||
@@ -172,7 +165,7 @@ class App : MultiDexApplication() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
var instance: App? = null
|
||||
private var instance: App? = null
|
||||
|
||||
/** Reference to the application context.
|
||||
*
|
||||
|
||||
@@ -67,12 +67,9 @@ import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.ContextCompat.getSystemService
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.math.MathUtils.clamp
|
||||
@@ -84,7 +81,6 @@ import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@@ -96,12 +92,9 @@ import ani.dantotsu.connections.bakaupdates.MangaUpdates
|
||||
import ani.dantotsu.connections.crashlytics.CrashlyticsInterface
|
||||
import ani.dantotsu.databinding.ItemCountDownBinding
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaDetailsActivity
|
||||
import ani.dantotsu.notifications.IncognitoNotificationClickReceiver
|
||||
import ani.dantotsu.others.ImageViewDialog
|
||||
import ani.dantotsu.others.SpoilerPlugin
|
||||
import ani.dantotsu.parsers.ShowResponse
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.internal.PreferenceKeystore
|
||||
@@ -120,7 +113,6 @@ import com.bumptech.glide.load.resource.gif.GifDrawable
|
||||
import com.bumptech.glide.request.RequestListener
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.bumptech.glide.request.target.Target
|
||||
import com.bumptech.glide.request.target.ViewTarget
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
@@ -347,8 +339,14 @@ open class BottomSheetDialogFragment : BottomSheetDialogFragment() {
|
||||
val behavior = BottomSheetBehavior.from(requireView().parent as View)
|
||||
behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
window.navigationBarColor =
|
||||
requireContext().getThemeColor(com.google.android.material.R.attr.colorSurface)
|
||||
val typedValue = TypedValue()
|
||||
val theme = requireContext().theme
|
||||
theme.resolveAttribute(
|
||||
com.google.android.material.R.attr.colorSurface,
|
||||
typedValue,
|
||||
true
|
||||
)
|
||||
window.navigationBarColor = typedValue.data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,24 +636,6 @@ fun ImageView.loadImage(file: FileUrl?, size: Int = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
fun ImageView.loadImage(file: FileUrl?, width: Int = 0, height: Int = 0) {
|
||||
file?.url = PrefManager.getVal<String>(PrefName.ImageUrl).ifEmpty { file?.url ?: "" }
|
||||
if (file?.url?.isNotEmpty() == true) {
|
||||
tryWith {
|
||||
if (file.url.startsWith("content://")) {
|
||||
Glide.with(this.context).load(Uri.parse(file.url)).transition(withCrossFade())
|
||||
.override(width, height).into(this)
|
||||
} else {
|
||||
val glideUrl = GlideUrl(file.url) { file.headers }
|
||||
Glide.with(this.context).load(glideUrl).transition(withCrossFade())
|
||||
.override(width, height)
|
||||
.into(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun ImageView.loadLocalImage(file: File?, size: Int = 0) {
|
||||
if (file?.exists() == true) {
|
||||
tryWith {
|
||||
@@ -1365,10 +1345,10 @@ fun blurImage(imageView: ImageView, banner: String?) {
|
||||
if (banner != null) {
|
||||
val radius = PrefManager.getVal<Float>(PrefName.BlurRadius).toInt()
|
||||
val sampling = PrefManager.getVal<Float>(PrefName.BlurSampling).toInt()
|
||||
val context = imageView.context
|
||||
if (!(context as Activity).isDestroyed) {
|
||||
val url = PrefManager.getVal<String>(PrefName.ImageUrl).ifEmpty { banner }
|
||||
if (PrefManager.getVal(PrefName.BlurBanners)) {
|
||||
if (PrefManager.getVal(PrefName.BlurBanners)) {
|
||||
val context = imageView.context
|
||||
if (!(context as Activity).isDestroyed) {
|
||||
val url = PrefManager.getVal<String>(PrefName.ImageUrl).ifEmpty { banner }
|
||||
Glide.with(context as Context)
|
||||
.load(
|
||||
if (banner.startsWith("http")) GlideUrl(url) else if (banner.startsWith("content://")) Uri.parse(
|
||||
@@ -1378,80 +1358,15 @@ fun blurImage(imageView: ImageView, banner: String?) {
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE).override(400)
|
||||
.apply(RequestOptions.bitmapTransform(BlurTransformation(radius, sampling)))
|
||||
.into(imageView)
|
||||
|
||||
} else {
|
||||
Glide.with(context as Context)
|
||||
.load(
|
||||
if (banner.startsWith("http")) GlideUrl(url) else if (banner.startsWith("content://")) Uri.parse(
|
||||
url
|
||||
) else File(url)
|
||||
)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE).override(400)
|
||||
.into(imageView)
|
||||
}
|
||||
} else {
|
||||
imageView.loadImage(banner)
|
||||
}
|
||||
} else {
|
||||
imageView.setImageResource(R.drawable.linear_gradient_bg)
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.getThemeColor(@AttrRes attribute: Int): Int {
|
||||
val typedValue = TypedValue()
|
||||
theme.resolveAttribute(attribute, typedValue, true)
|
||||
return typedValue.data
|
||||
}
|
||||
|
||||
fun ImageView.openImage(title: String, image: String) {
|
||||
setOnLongClickListener {
|
||||
ImageViewDialog.newInstance(
|
||||
context as FragmentActivity, title, image
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to open the link in the app, otherwise copies it to the clipboard
|
||||
* @param link the link to open
|
||||
*/
|
||||
fun openOrCopyAnilistLink(link: String) {
|
||||
if (link.startsWith("https://anilist.co/anime/") || link.startsWith("https://anilist.co/manga/")) {
|
||||
val mangaAnime = link.substringAfter("https://anilist.co/").substringBefore("/")
|
||||
val id =
|
||||
link.substringAfter("https://anilist.co/$mangaAnime/").substringBefore("/")
|
||||
.toIntOrNull()
|
||||
if (id != null && currContext() != null) {
|
||||
ContextCompat.startActivity(
|
||||
currContext()!!,
|
||||
Intent(currContext()!!, MediaDetailsActivity::class.java)
|
||||
.putExtra("mediaId", id),
|
||||
null
|
||||
)
|
||||
} else {
|
||||
copyToClipboard(link, true)
|
||||
}
|
||||
} else if (link.startsWith("https://anilist.co/user/")) {
|
||||
val username = link.substringAfter("https://anilist.co/user/").substringBefore("/")
|
||||
val id = username.toIntOrNull()
|
||||
if (currContext() != null) {
|
||||
val intent = Intent(currContext()!!, ProfileActivity::class.java)
|
||||
if (id != null) {
|
||||
intent.putExtra("userId", id)
|
||||
} else {
|
||||
intent.putExtra("username", username)
|
||||
}
|
||||
ContextCompat.startActivity(
|
||||
currContext()!!,
|
||||
intent,
|
||||
null
|
||||
)
|
||||
} else {
|
||||
copyToClipboard(link, true)
|
||||
}
|
||||
} else {
|
||||
copyToClipboard(link, true)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the markwon instance with all the plugins
|
||||
* @return the markwon instance
|
||||
@@ -1459,15 +1374,14 @@ fun openOrCopyAnilistLink(link: String) {
|
||||
fun buildMarkwon(
|
||||
activity: Context,
|
||||
userInputContent: Boolean = true,
|
||||
fragment: Fragment? = null,
|
||||
anilist: Boolean = false
|
||||
fragment: Fragment? = null
|
||||
): Markwon {
|
||||
val glideContext = fragment?.let { Glide.with(it) } ?: Glide.with(activity)
|
||||
val markwon = Markwon.builder(activity)
|
||||
.usePlugin(object : AbstractMarkwonPlugin() {
|
||||
override fun configureConfiguration(builder: MarkwonConfiguration.Builder) {
|
||||
builder.linkResolver { _, link ->
|
||||
openOrCopyAnilistLink(link)
|
||||
copyToClipboard(link, true)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1476,7 +1390,7 @@ fun buildMarkwon(
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.usePlugin(TablePlugin.create(activity))
|
||||
.usePlugin(TaskListPlugin.create(activity))
|
||||
.usePlugin(SpoilerPlugin(anilist))
|
||||
.usePlugin(SpoilerPlugin())
|
||||
.usePlugin(HtmlPlugin.create { plugin ->
|
||||
if (userInputContent) {
|
||||
plugin.addHandler(
|
||||
|
||||
@@ -13,6 +13,7 @@ import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.Settings
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.AnticipateInterpolator
|
||||
@@ -33,12 +34,12 @@ import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import androidx.work.OneTimeWorkRequest
|
||||
import ani.dantotsu.addons.torrent.ServerService
|
||||
import ani.dantotsu.addons.torrent.TorrentAddonManager
|
||||
import ani.dantotsu.addons.torrent.TorrentServerService
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.AnilistHomeViewModel
|
||||
import ani.dantotsu.databinding.ActivityMainBinding
|
||||
import ani.dantotsu.databinding.DialogUserAgentBinding
|
||||
import ani.dantotsu.databinding.SplashScreenBinding
|
||||
import ani.dantotsu.home.AnimeFragment
|
||||
import ani.dantotsu.home.HomeFragment
|
||||
@@ -46,9 +47,9 @@ import ani.dantotsu.home.LoginFragment
|
||||
import ani.dantotsu.home.MangaFragment
|
||||
import ani.dantotsu.home.NoInternet
|
||||
import ani.dantotsu.media.MediaDetailsActivity
|
||||
import ani.dantotsu.notifications.TaskScheduler
|
||||
import ani.dantotsu.notifications.anilist.AnilistNotificationWorker
|
||||
import ani.dantotsu.notifications.comment.CommentNotificationWorker
|
||||
import ani.dantotsu.others.CustomBottomDialog
|
||||
import ani.dantotsu.others.calc.CalcActivity
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.profile.activity.FeedActivity
|
||||
import ani.dantotsu.profile.activity.NotificationActivity
|
||||
@@ -100,21 +101,12 @@ class MainActivity : AppCompatActivity() {
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
TaskScheduler.scheduleSingleWork(this)
|
||||
if (!CalcActivity.hasPermission) {
|
||||
val pin: String = PrefManager.getVal(PrefName.AppPassword)
|
||||
if (pin.isNotEmpty()) {
|
||||
ContextCompat.startActivity(
|
||||
this@MainActivity,
|
||||
Intent(this@MainActivity, CalcActivity::class.java)
|
||||
.putExtra("code", pin)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK),
|
||||
null
|
||||
)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
androidx.work.WorkManager.getInstance(this)
|
||||
.enqueue(OneTimeWorkRequest.Companion.from(CommentNotificationWorker::class.java))
|
||||
|
||||
androidx.work.WorkManager.getInstance(this)
|
||||
.enqueue(OneTimeWorkRequest.Companion.from(AnilistNotificationWorker::class.java))
|
||||
|
||||
val action = intent.action
|
||||
val type = intent.type
|
||||
@@ -303,37 +295,6 @@ class MainActivity : AppCompatActivity() {
|
||||
} else {
|
||||
PrefManager.getVal(PrefName.DefaultStartUpTab)
|
||||
}
|
||||
val navbar = binding.includedNavbar.navbar
|
||||
bottomBar = navbar
|
||||
navbar.visibility = View.VISIBLE
|
||||
binding.mainProgressBar.visibility = View.GONE
|
||||
val mainViewPager = binding.viewpager
|
||||
mainViewPager.isUserInputEnabled = false
|
||||
mainViewPager.adapter =
|
||||
ViewPagerAdapter(supportFragmentManager, lifecycle)
|
||||
mainViewPager.setPageTransformer(ZoomOutPageTransformer())
|
||||
navbar.selectTabAt(selectedOption)
|
||||
navbar.setOnTabSelectListener(object :
|
||||
AnimatedBottomBar.OnTabSelectListener {
|
||||
override fun onTabSelected(
|
||||
lastIndex: Int,
|
||||
lastTab: AnimatedBottomBar.Tab?,
|
||||
newIndex: Int,
|
||||
newTab: AnimatedBottomBar.Tab
|
||||
) {
|
||||
navbar.animate().translationZ(12f).setDuration(200).start()
|
||||
selectedOption = newIndex
|
||||
mainViewPager.setCurrentItem(newIndex, false)
|
||||
}
|
||||
})
|
||||
if (mainViewPager.currentItem != selectedOption) {
|
||||
mainViewPager.post {
|
||||
mainViewPager.setCurrentItem(
|
||||
selectedOption,
|
||||
false
|
||||
)
|
||||
}
|
||||
}
|
||||
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin = navBarHeight
|
||||
}
|
||||
@@ -382,7 +343,45 @@ class MainActivity : AppCompatActivity() {
|
||||
startActivity(Intent(this, NoInternet::class.java))
|
||||
} else {
|
||||
val model: AnilistHomeViewModel by viewModels()
|
||||
|
||||
model.genres.observe(this) {
|
||||
if (it != null) {
|
||||
if (it) {
|
||||
val navbar = binding.includedNavbar.navbar
|
||||
bottomBar = navbar
|
||||
navbar.visibility = View.VISIBLE
|
||||
binding.mainProgressBar.visibility = View.GONE
|
||||
val mainViewPager = binding.viewpager
|
||||
mainViewPager.isUserInputEnabled = false
|
||||
mainViewPager.adapter =
|
||||
ViewPagerAdapter(supportFragmentManager, lifecycle)
|
||||
mainViewPager.setPageTransformer(ZoomOutPageTransformer())
|
||||
navbar.setOnTabSelectListener(object :
|
||||
AnimatedBottomBar.OnTabSelectListener {
|
||||
override fun onTabSelected(
|
||||
lastIndex: Int,
|
||||
lastTab: AnimatedBottomBar.Tab?,
|
||||
newIndex: Int,
|
||||
newTab: AnimatedBottomBar.Tab
|
||||
) {
|
||||
navbar.animate().translationZ(12f).setDuration(200).start()
|
||||
selectedOption = newIndex
|
||||
mainViewPager.setCurrentItem(newIndex, false)
|
||||
}
|
||||
})
|
||||
if (mainViewPager.currentItem != selectedOption) {
|
||||
navbar.selectTabAt(selectedOption)
|
||||
mainViewPager.post {
|
||||
mainViewPager.setCurrentItem(
|
||||
selectedOption,
|
||||
false
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
binding.mainProgressBar.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
//Load Data
|
||||
if (!load && !launched) {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
@@ -460,8 +459,8 @@ class MainActivity : AppCompatActivity() {
|
||||
fun startTorrent() {
|
||||
if (torrentManager.isAvailable() && PrefManager.getVal(PrefName.TorrentEnabled)) {
|
||||
launchIO {
|
||||
if (!TorrentServerService.isRunning()) {
|
||||
TorrentServerService.start()
|
||||
if (!ServerService.isRunning()) {
|
||||
ServerService.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -494,14 +493,16 @@ class MainActivity : AppCompatActivity() {
|
||||
val password = CharArray(16).apply { fill('0') }
|
||||
|
||||
// Inflate the dialog layout
|
||||
val dialogView = DialogUserAgentBinding.inflate(layoutInflater)
|
||||
dialogView.userAgentTextBox.hint = "Password"
|
||||
dialogView.subtitle.visibility = View.VISIBLE
|
||||
dialogView.subtitle.text = getString(R.string.enter_password_to_decrypt_file)
|
||||
val dialogView =
|
||||
LayoutInflater.from(this).inflate(R.layout.dialog_user_agent, null)
|
||||
dialogView.findViewById<TextInputEditText>(R.id.userAgentTextBox)?.hint = "Password"
|
||||
val subtitleTextView = dialogView.findViewById<TextView>(R.id.subtitle)
|
||||
subtitleTextView?.visibility = View.VISIBLE
|
||||
subtitleTextView?.text = getString(R.string.enter_password_to_decrypt_file)
|
||||
|
||||
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
|
||||
.setTitle("Enter Password")
|
||||
.setView(dialogView.root)
|
||||
.setView(dialogView)
|
||||
.setPositiveButton("OK", null)
|
||||
.setNegativeButton("Cancel") { dialog, _ ->
|
||||
password.fill('0')
|
||||
|
||||
@@ -137,14 +137,12 @@ suspend fun <T> tryWithSuspend(
|
||||
* **/
|
||||
data class FileUrl(
|
||||
var url: String,
|
||||
var headers: Map<String, String> = mapOf()
|
||||
val headers: Map<String, String> = mapOf()
|
||||
) : Serializable {
|
||||
companion object {
|
||||
operator fun get(url: String?, headers: Map<String, String> = mapOf()): FileUrl? {
|
||||
return FileUrl(url ?: return null, headers)
|
||||
}
|
||||
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class AddonDownloader {
|
||||
val md = r.body ?: ""
|
||||
val version = v.ifEmpty { throw Exception("Weird Version : ${r.tagName}") }
|
||||
|
||||
Logger.log("Git Version for $repo: $version")
|
||||
Logger.log("Git Version : $version")
|
||||
Pair(md, version)
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error checking for update")
|
||||
@@ -79,6 +79,7 @@ class AddonDownloader {
|
||||
activity.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
val installerSteps = InstallerSteps(notificationManager, activity)
|
||||
manager.install(this)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{ installStep -> installerSteps.onInstallStep(installStep) {} },
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import androidx.core.content.pm.PackageInfoCompat
|
||||
import ani.dantotsu.addons.download.DownloadAddon
|
||||
import ani.dantotsu.addons.download.DownloadAddonApiV2
|
||||
import ani.dantotsu.addons.download.DownloadAddonApi
|
||||
import ani.dantotsu.addons.download.DownloadAddonManager
|
||||
import ani.dantotsu.addons.download.DownloadLoadResult
|
||||
import ani.dantotsu.addons.torrent.TorrentAddon
|
||||
@@ -21,20 +21,6 @@ import eu.kanade.tachiyomi.util.system.getApplicationIcon
|
||||
|
||||
class AddonLoader {
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Load an extension from a package name with a specific class name
|
||||
* @param context the context
|
||||
* @param packageName the package name of the extension
|
||||
* @param type the type of extension
|
||||
* @return the loaded extension
|
||||
* @throws IllegalStateException if the extension is not of the correct type
|
||||
* @throws ClassNotFoundException if the extension class is not found
|
||||
* @throws NoClassDefFoundError if the extension class is not found
|
||||
* @throws Exception if any other error occurs
|
||||
* @throws PackageManager.NameNotFoundException if the package is not found
|
||||
* @throws IllegalStateException if the extension is not found
|
||||
*/
|
||||
fun loadExtension(
|
||||
context: Context,
|
||||
packageName: String,
|
||||
@@ -84,11 +70,11 @@ class AddonLoader {
|
||||
val loadedClass = try {
|
||||
Class.forName(className, false, classLoader)
|
||||
} catch (e: ClassNotFoundException) {
|
||||
Logger.log("ClassNotFoundException load error: $extName ($className)")
|
||||
Logger.log("Extension load error: $extName ($className)")
|
||||
Logger.log(e)
|
||||
throw e
|
||||
} catch (e: NoClassDefFoundError) {
|
||||
Logger.log("NoClassDefFoundError load error: $extName ($className)")
|
||||
Logger.log("Extension load error: $extName ($className)")
|
||||
Logger.log(e)
|
||||
throw e
|
||||
} catch (e: Exception) {
|
||||
@@ -115,8 +101,8 @@ class AddonLoader {
|
||||
}
|
||||
|
||||
AddonType.DOWNLOAD -> {
|
||||
val extension = instance as? DownloadAddonApiV2
|
||||
?: throw IllegalStateException("Extension is not a DownloadAddonApiV2")
|
||||
val extension = instance as? DownloadAddonApi
|
||||
?: throw IllegalStateException("Extension is not a DownloadAddonApi")
|
||||
DownloadLoadResult.Success(
|
||||
DownloadAddon.Installed(
|
||||
name = extName,
|
||||
@@ -131,43 +117,24 @@ class AddonLoader {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an extension from a package name (class is determined by type)
|
||||
* @param context the context
|
||||
* @param packageName the package name of the extension
|
||||
* @param type the type of extension
|
||||
* @return the loaded extension
|
||||
*/
|
||||
fun loadFromPkgName(context: Context, packageName: String, type: AddonType): LoadResult? {
|
||||
return try {
|
||||
when (type) {
|
||||
AddonType.TORRENT -> loadExtension(
|
||||
context,
|
||||
packageName,
|
||||
TorrentAddonManager.TORRENT_CLASS,
|
||||
type
|
||||
)
|
||||
return when (type) {
|
||||
AddonType.TORRENT -> loadExtension(
|
||||
context,
|
||||
packageName,
|
||||
TorrentAddonManager.TORRENT_CLASS,
|
||||
type
|
||||
)
|
||||
|
||||
AddonType.DOWNLOAD -> loadExtension(
|
||||
context,
|
||||
packageName,
|
||||
DownloadAddonManager.DOWNLOAD_CLASS,
|
||||
type
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error loading extension from package name: $packageName")
|
||||
Logger.log(e)
|
||||
null
|
||||
AddonType.DOWNLOAD -> loadExtension(
|
||||
context,
|
||||
packageName,
|
||||
DownloadAddonManager.DOWNLOAD_CLASS,
|
||||
type
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a package is an extension by comparing the package name
|
||||
* @param type the type of extension
|
||||
* @param pkgInfo the package info
|
||||
* @return true if the package is an extension
|
||||
*/
|
||||
private fun isPackageAnExtension(type: String, pkgInfo: PackageInfo): Boolean {
|
||||
return pkgInfo.packageName.equals(type)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ abstract class AddonManager<T : Addon.Installed>(
|
||||
protected var onListenerAction: ((AddonListener.ListenerAction) -> Unit)? = null
|
||||
|
||||
abstract suspend fun init()
|
||||
abstract fun isAvailable(andEnabled: Boolean = true): Boolean
|
||||
abstract fun isAvailable(): Boolean
|
||||
abstract fun getVersion(): String?
|
||||
abstract fun getPackageName(): String?
|
||||
abstract fun hadError(context: Context): String?
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package ani.dantotsu.addons
|
||||
package ani.dantotsu.addons.download
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.core.content.ContextCompat
|
||||
import ani.dantotsu.addons.download.DownloadAddonManager
|
||||
import ani.dantotsu.addons.AddonListener
|
||||
import ani.dantotsu.addons.AddonLoader
|
||||
import ani.dantotsu.addons.torrent.TorrentAddonManager
|
||||
import ani.dantotsu.media.AddonType
|
||||
import eu.kanade.tachiyomi.extension.util.ExtensionInstallReceiver
|
||||
@@ -75,6 +76,7 @@ internal class AddonInstallReceiver : BroadcastReceiver() {
|
||||
}
|
||||
|
||||
Intent.ACTION_PACKAGE_REPLACED -> {
|
||||
if (ExtensionInstallReceiver.isReplacing(intent)) return
|
||||
launchNow {
|
||||
when (type) {
|
||||
AddonType.DOWNLOAD -> {
|
||||
@@ -10,7 +10,7 @@ sealed class DownloadAddon : Addon() {
|
||||
override val pkgName: String,
|
||||
override val versionName: String,
|
||||
override val versionCode: Long,
|
||||
val extension: DownloadAddonApiV2,
|
||||
val extension: DownloadAddonApi,
|
||||
val icon: Drawable?,
|
||||
val hasUpdate: Boolean = false,
|
||||
) : Addon.Installed(name, pkgName, versionName, versionCode)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package ani.dantotsu.addons.download
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
|
||||
interface DownloadAddonApi {
|
||||
|
||||
fun cancelDownload(sessionId: Long)
|
||||
|
||||
fun setDownloadPath(context: Context, uri: Uri): String
|
||||
|
||||
suspend fun executeFFProbe(request: String, logCallback: (String) -> Unit)
|
||||
|
||||
suspend fun executeFFMpeg(request: String, statCallback: (Double) -> Unit): Long
|
||||
|
||||
fun getState(sessionId: Long): String
|
||||
|
||||
fun getStackTrace(sessionId: Long): String?
|
||||
|
||||
fun hadError(sessionId: Long): Boolean
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package ani.dantotsu.addons.download
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
|
||||
interface DownloadAddonApiV2 {
|
||||
|
||||
fun cancelDownload(sessionId: Long)
|
||||
|
||||
fun setDownloadPath(context: Context, uri: Uri): String
|
||||
|
||||
fun getReadPath(context: Context, uri: Uri): String
|
||||
|
||||
suspend fun executeFFProbe(
|
||||
videoUrl: String,
|
||||
headers: Map<String, String> = emptyMap(),
|
||||
logCallback: (String) -> Unit
|
||||
)
|
||||
|
||||
suspend fun executeFFMpeg(
|
||||
videoUrl: String,
|
||||
downloadPath: String,
|
||||
headers: Map<String, String> = emptyMap(),
|
||||
subtitleUrls: List<Pair<String, String>> = emptyList(),
|
||||
audioUrls: List<Pair<String, String>> = emptyList(),
|
||||
statCallback: (Double) -> Unit
|
||||
): Long
|
||||
|
||||
suspend fun customFFMpeg(command: String, videoUrls: List<String>, logCallback: (String) -> Unit): Long
|
||||
|
||||
suspend fun customFFProbe(command: String, videoUrls: List<String>, logCallback: (String) -> Unit)
|
||||
|
||||
fun getState(sessionId: Long): String
|
||||
|
||||
fun getStackTrace(sessionId: Long): String?
|
||||
|
||||
fun hadError(sessionId: Long): Boolean
|
||||
|
||||
fun getFileExtension(): Pair<String, String> = Pair("mkv", "video/x-matroska")
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.addons.AddonDownloader
|
||||
import ani.dantotsu.addons.AddonInstallReceiver
|
||||
import ani.dantotsu.addons.AddonListener
|
||||
import ani.dantotsu.addons.AddonLoader
|
||||
import ani.dantotsu.addons.AddonManager
|
||||
@@ -24,7 +23,7 @@ class DownloadAddonManager(
|
||||
override var name: String = "Download Addon"
|
||||
override var type = AddonType.DOWNLOAD
|
||||
|
||||
private val _isInitialized = MutableLiveData(false)
|
||||
private val _isInitialized = MutableLiveData<Boolean>().apply { value = false }
|
||||
val isInitialized: LiveData<Boolean> = _isInitialized
|
||||
|
||||
private var error: String? = null
|
||||
@@ -53,18 +52,17 @@ class DownloadAddonManager(
|
||||
hasUpdate = AddonDownloader.hasUpdate(REPO, it.extension.versionName)
|
||||
}
|
||||
}
|
||||
Logger.log("Download addon initialized successfully")
|
||||
withContext(Dispatchers.Main) {
|
||||
_isInitialized.value = true
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error initializing Download addon")
|
||||
Logger.log("Error initializing Download extension")
|
||||
Logger.log(e)
|
||||
error = e.message
|
||||
}
|
||||
}
|
||||
|
||||
override fun isAvailable(andEnabled: Boolean): Boolean {
|
||||
override fun isAvailable(): Boolean {
|
||||
return extension?.extension != null
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,8 @@ import ani.dantotsu.addons.AddonListener
|
||||
import ani.dantotsu.addons.AddonLoader
|
||||
import ani.dantotsu.addons.AddonManager
|
||||
import ani.dantotsu.addons.LoadResult
|
||||
import ani.dantotsu.addons.AddonInstallReceiver
|
||||
import ani.dantotsu.addons.download.AddonInstallReceiver
|
||||
import ani.dantotsu.media.AddonType
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.util.Logger
|
||||
import eu.kanade.tachiyomi.extension.InstallStep
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -27,7 +25,7 @@ class TorrentAddonManager(
|
||||
override var type: AddonType = AddonType.TORRENT
|
||||
var torrentHash: String? = null
|
||||
|
||||
private val _isInitialized = MutableLiveData(false)
|
||||
private val _isInitialized = MutableLiveData<Boolean>().apply { value = false }
|
||||
val isInitialized: LiveData<Boolean> = _isInitialized
|
||||
|
||||
private var error: String? = null
|
||||
@@ -61,21 +59,18 @@ class TorrentAddonManager(
|
||||
hasUpdate = hasUpdate(REPO, it.extension.versionName)
|
||||
}
|
||||
}
|
||||
Logger.log("Torrent addon initialized successfully")
|
||||
withContext(Dispatchers.Main) {
|
||||
_isInitialized.value = true
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error initializing torrent addon")
|
||||
Logger.log("Error initializing torrent extension")
|
||||
Logger.log(e)
|
||||
error = e.message
|
||||
}
|
||||
}
|
||||
|
||||
override fun isAvailable(andEnabled: Boolean): Boolean {
|
||||
return extension?.extension != null && if (andEnabled) {
|
||||
PrefManager.getVal(PrefName.TorrentEnabled)
|
||||
} else true
|
||||
override fun isAvailable(): Boolean {
|
||||
return extension?.extension != null
|
||||
}
|
||||
|
||||
override fun getVersion(): String? {
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* modified source from
|
||||
* https://github.com/rebelonion/Dantotsu/pull/305
|
||||
* and https://github.com/LuftVerbot/kuukiyomi
|
||||
* all credits to the original authors
|
||||
*/
|
||||
|
||||
package ani.dantotsu.addons.torrent
|
||||
|
||||
import android.app.ActivityManager
|
||||
@@ -29,10 +22,10 @@ import uy.kohesive.injekt.api.get
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
|
||||
|
||||
class TorrentServerService : Service() {
|
||||
class ServerService : Service() {
|
||||
private val serviceScope = CoroutineScope(EmptyCoroutineContext)
|
||||
private val applicationContext = Injekt.get<Application>()
|
||||
private lateinit var extension: TorrentAddonApi
|
||||
private val extension = Injekt.get<TorrentAddonManager>().extension!!.extension
|
||||
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
@@ -41,7 +34,6 @@ class TorrentServerService : Service() {
|
||||
flags: Int,
|
||||
startId: Int,
|
||||
): Int {
|
||||
extension = Injekt.get<TorrentAddonManager>().extension?.extension ?: return START_NOT_STICKY
|
||||
intent?.let {
|
||||
if (it.action != null) {
|
||||
when (it.action) {
|
||||
@@ -83,7 +75,7 @@ class TorrentServerService : Service() {
|
||||
PendingIntent.getService(
|
||||
applicationContext,
|
||||
0,
|
||||
Intent(applicationContext, TorrentServerService::class.java).apply {
|
||||
Intent(applicationContext, ServerService::class.java).apply {
|
||||
action = ACTION_STOP
|
||||
},
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
|
||||
@@ -121,7 +113,7 @@ class TorrentServerService : Service() {
|
||||
with(Injekt.get<Application>().getSystemService(ACTIVITY_SERVICE) as ActivityManager) {
|
||||
@Suppress("DEPRECATION") // We only need our services
|
||||
getRunningServices(Int.MAX_VALUE).forEach {
|
||||
if (TorrentServerService::class.java.name.equals(it.service.className)) {
|
||||
if (ServerService::class.java.name.equals(it.service.className)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -130,12 +122,9 @@ class TorrentServerService : Service() {
|
||||
}
|
||||
|
||||
fun start() {
|
||||
if (Injekt.get<TorrentAddonManager>().extension?.extension == null) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
val intent =
|
||||
Intent(Injekt.get<Application>(), TorrentServerService::class.java).apply {
|
||||
Intent(Injekt.get<Application>(), ServerService::class.java).apply {
|
||||
action = ACTION_START
|
||||
}
|
||||
Injekt.get<Application>().startService(intent)
|
||||
@@ -148,7 +137,7 @@ class TorrentServerService : Service() {
|
||||
fun stop() {
|
||||
try {
|
||||
val intent =
|
||||
Intent(Injekt.get<Application>(), TorrentServerService::class.java).apply {
|
||||
Intent(Injekt.get<Application>(), ServerService::class.java).apply {
|
||||
action = ACTION_STOP
|
||||
}
|
||||
Injekt.get<Application>().startService(intent)
|
||||
|
||||
@@ -60,6 +60,10 @@ class AppModule(val app: Application) : InjektModule {
|
||||
|
||||
addSingletonFactory { StandaloneDatabaseProvider(app) }
|
||||
|
||||
addSingletonFactory<CrashlyticsInterface> {
|
||||
ani.dantotsu.connections.crashlytics.CrashlyticsFactory.createCrashlytics()
|
||||
}
|
||||
|
||||
addSingletonFactory { MangaCache() }
|
||||
|
||||
ContextCompat.getMainExecutor(app).execute {
|
||||
|
||||
@@ -35,8 +35,6 @@ object Anilist {
|
||||
|
||||
var rateLimitReset: Long = 0
|
||||
|
||||
var initialized = false
|
||||
|
||||
val sortBy = listOf(
|
||||
"SCORE_DESC",
|
||||
"POPULARITY_DESC",
|
||||
@@ -176,7 +174,7 @@ object Anilist {
|
||||
"variables" to variables
|
||||
)
|
||||
val headers = mutableMapOf(
|
||||
"Content-Type" to "application/json; charset=utf-8",
|
||||
"Content-Type" to "application/json",
|
||||
"Accept" to "application/json"
|
||||
)
|
||||
|
||||
@@ -204,6 +202,7 @@ object Anilist {
|
||||
if (!json.text.startsWith("{")) {
|
||||
throw Exception(currContext()?.getString(R.string.anilist_down))
|
||||
}
|
||||
if (show) Logger.log("Anilist Response: ${json.text}")
|
||||
json.parsed()
|
||||
} else null
|
||||
} catch (e: Exception) {
|
||||
|
||||
@@ -2,10 +2,6 @@ package ani.dantotsu.connections.anilist
|
||||
|
||||
import ani.dantotsu.connections.anilist.Anilist.executeQuery
|
||||
import ani.dantotsu.connections.anilist.api.FuzzyDate
|
||||
import ani.dantotsu.connections.anilist.api.Query
|
||||
import ani.dantotsu.currContext
|
||||
import com.google.gson.Gson
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
class AnilistMutations {
|
||||
@@ -73,54 +69,4 @@ class AnilistMutations {
|
||||
val variables = """{"id":"$listId"}"""
|
||||
executeQuery<JsonObject>(query, variables)
|
||||
}
|
||||
|
||||
|
||||
suspend fun rateReview(reviewId: Int, rating: String): Query.RateReviewResponse? {
|
||||
val query = "mutation{RateReview(reviewId:$reviewId,rating:$rating){id mediaId mediaType summary body(asHtml:true)rating ratingAmount userRating score private siteUrl createdAt updatedAt user{id name bannerImage avatar{medium large}}}}"
|
||||
return executeQuery<Query.RateReviewResponse>(query)
|
||||
}
|
||||
|
||||
suspend fun postActivity(text:String): String {
|
||||
val encodedText = text.stringSanitizer()
|
||||
val query = "mutation{SaveTextActivity(text:$encodedText){siteUrl}}"
|
||||
val result = executeQuery<JsonObject>(query)
|
||||
val errors = result?.get("errors")
|
||||
return errors?.toString()
|
||||
?: (currContext()?.getString(ani.dantotsu.R.string.success) ?: "Success")
|
||||
}
|
||||
|
||||
suspend fun postReview(summary: String, body: String, mediaId: Int, score: Int): String {
|
||||
val encodedSummary = summary.stringSanitizer()
|
||||
val encodedBody = body.stringSanitizer()
|
||||
val query = "mutation{SaveReview(mediaId:$mediaId,summary:$encodedSummary,body:$encodedBody,score:$score){siteUrl}}"
|
||||
val result = executeQuery<JsonObject>(query)
|
||||
val errors = result?.get("errors")
|
||||
return errors?.toString()
|
||||
?: (currContext()?.getString(ani.dantotsu.R.string.success) ?: "Success")
|
||||
}
|
||||
|
||||
suspend fun postReply(activityId: Int, text: String): String {
|
||||
val encodedText = text.stringSanitizer()
|
||||
val query = "mutation{SaveActivityReply(activityId:$activityId,text:$encodedText){id}}"
|
||||
val result = executeQuery<JsonObject>(query)
|
||||
val errors = result?.get("errors")
|
||||
return errors?.toString()
|
||||
?: (currContext()?.getString(ani.dantotsu.R.string.success) ?: "Success")
|
||||
}
|
||||
|
||||
private fun String.stringSanitizer(): String {
|
||||
val sb = StringBuilder()
|
||||
var i = 0
|
||||
while (i < this.length) {
|
||||
val codePoint = this.codePointAt(i)
|
||||
if (codePoint > 0xFFFF) {
|
||||
sb.append("&#").append(codePoint).append(";")
|
||||
i += 2
|
||||
} else {
|
||||
sb.append(this[i])
|
||||
i++
|
||||
}
|
||||
}
|
||||
return Gson().toJson(sb.toString())
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import ani.dantotsu.connections.anilist.api.FuzzyDate
|
||||
import ani.dantotsu.connections.anilist.api.NotificationResponse
|
||||
import ani.dantotsu.connections.anilist.api.Page
|
||||
import ani.dantotsu.connections.anilist.api.Query
|
||||
import ani.dantotsu.connections.anilist.api.ReplyResponse
|
||||
import ani.dantotsu.connections.anilist.api.ToggleLike
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.isOnline
|
||||
@@ -25,6 +24,7 @@ import ani.dantotsu.profile.User
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.util.Logger
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.runBlocking
|
||||
@@ -33,7 +33,6 @@ import java.io.ByteArrayOutputStream
|
||||
import java.io.ObjectInputStream
|
||||
import java.io.ObjectOutputStream
|
||||
import java.io.Serializable
|
||||
import java.util.Calendar
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
class AnilistQueries {
|
||||
@@ -58,7 +57,6 @@ class AnilistQueries {
|
||||
Anilist.unreadNotificationCount = user.unreadNotificationCount ?: 0
|
||||
val unread = PrefManager.getVal<Int>(PrefName.UnreadCommentNotifications)
|
||||
Anilist.unreadNotificationCount += unread
|
||||
Anilist.initialized = true
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -75,10 +73,10 @@ class AnilistQueries {
|
||||
media.cameFromContinue = false
|
||||
|
||||
val query =
|
||||
"""{Media(id:${media.id}){id favourites popularity episodes chapters mediaListEntry{id status score(format:POINT_100)progress private notes repeat customLists updatedAt startedAt{year month day}completedAt{year month day}}reviews(perPage:3, sort:SCORE_DESC){nodes{id mediaId mediaType summary body(asHtml:true) rating ratingAmount userRating score private siteUrl createdAt updatedAt user{id name bannerImage avatar{medium large}}}}isFavourite siteUrl idMal nextAiringEpisode{episode airingAt}source countryOfOrigin format duration season seasonYear startDate{year month day}endDate{year month day}genres studios(isMain:true){nodes{id name siteUrl}}description trailer{site id}synonyms tags{name rank isMediaSpoiler}characters(sort:[ROLE,FAVOURITES_DESC],perPage:25,page:1){edges{role voiceActors { id name { first middle last full native userPreferred } image { large medium } languageV2 } node{id image{medium}name{userPreferred}isFavourite}}}relations{edges{relationType(version:2)node{id idMal mediaListEntry{progress private score(format:POINT_100)status}episodes chapters nextAiringEpisode{episode}popularity meanScore isAdult isFavourite format title{english romaji userPreferred}type status(version:2)bannerImage coverImage{large}}}}staffPreview:staff(perPage:8,sort:[RELEVANCE,ID]){edges{role node{id image{large medium}name{userPreferred}}}}recommendations(sort:RATING_DESC){nodes{mediaRecommendation{id idMal mediaListEntry{progress private score(format:POINT_100)status}episodes chapters nextAiringEpisode{episode}meanScore isAdult isFavourite format title{english romaji userPreferred}type status(version:2)bannerImage coverImage{large}}}}externalLinks{url site}}Page(page:1){pageInfo{total perPage currentPage lastPage hasNextPage}mediaList(isFollowing:true,sort:[STATUS],mediaId:${media.id}){id status score(format: POINT_100) progress progressVolumes user{id name avatar{large medium}}}}}"""
|
||||
"""{Media(id:${media.id}){id favourites popularity episodes chapters mediaListEntry{id status score(format:POINT_100)progress private notes repeat customLists updatedAt startedAt{year month day}completedAt{year month day}}isFavourite siteUrl idMal nextAiringEpisode{episode airingAt}source countryOfOrigin format duration season seasonYear startDate{year month day}endDate{year month day}genres studios(isMain:true){nodes{id name siteUrl}}description trailer{site id}synonyms tags{name rank isMediaSpoiler}characters(sort:[ROLE,FAVOURITES_DESC],perPage:25,page:1){edges{role voiceActors { id name { first middle last full native userPreferred } image { large medium } languageV2 } node{id image{medium}name{userPreferred}isFavourite}}}relations{edges{relationType(version:2)node{id idMal mediaListEntry{progress private score(format:POINT_100)status}episodes chapters nextAiringEpisode{episode}popularity meanScore isAdult isFavourite format title{english romaji userPreferred}type status(version:2)bannerImage coverImage{large}}}}staffPreview:staff(perPage:8,sort:[RELEVANCE,ID]){edges{role node{id image{large medium}name{userPreferred}}}}recommendations(sort:RATING_DESC){nodes{mediaRecommendation{id idMal mediaListEntry{progress private score(format:POINT_100)status}episodes chapters nextAiringEpisode{episode}meanScore isAdult isFavourite format title{english romaji userPreferred}type status(version:2)bannerImage coverImage{large}}}}externalLinks{url site}}Page(page:1){pageInfo{total perPage currentPage lastPage hasNextPage}mediaList(isFollowing:true,sort:[STATUS],mediaId:${media.id}){id status score(format: POINT_100) progress progressVolumes user{id name avatar{large medium}}}}}"""
|
||||
runBlocking {
|
||||
val anilist = async {
|
||||
var response = executeQuery<Query.Media>(query, force = true)
|
||||
var response = executeQuery<Query.Media>(query, force = true, show = true)
|
||||
if (response != null) {
|
||||
fun parse() {
|
||||
val fetchedMedia = response?.data?.media ?: return
|
||||
@@ -211,9 +209,6 @@ class AnilistQueries {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fetchedMedia.reviews?.nodes != null){
|
||||
media.review = fetchedMedia.reviews!!.nodes as ArrayList<Query.Review>
|
||||
}
|
||||
if (user?.mediaList?.isNotEmpty() == true) {
|
||||
media.users = user.mediaList?.mapNotNull {
|
||||
it.user?.let { user ->
|
||||
@@ -376,11 +371,70 @@ class AnilistQueries {
|
||||
}
|
||||
return media
|
||||
}
|
||||
|
||||
suspend fun continueMedia(type: String, planned: Boolean = false): ArrayList<Media> {
|
||||
val returnArray = arrayListOf<Media>()
|
||||
val map = mutableMapOf<Int, Media>()
|
||||
val query = if (planned) {
|
||||
"""{ planned: ${continueMediaQuery(type, "PLANNING")} }"""
|
||||
} else {
|
||||
"""{
|
||||
current: ${continueMediaQuery(type, "CURRENT")},
|
||||
repeating: ${continueMediaQuery(type, "REPEATING")}
|
||||
}"""
|
||||
}
|
||||
|
||||
val response = executeQuery<Query.CombinedMediaListResponse>(query)
|
||||
if (planned) {
|
||||
response?.data?.planned?.lists?.forEach { li ->
|
||||
li.entries?.reversed()?.forEach {
|
||||
val m = Media(it)
|
||||
m.cameFromContinue = true
|
||||
map[m.id] = m
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response?.data?.current?.lists?.forEach { li ->
|
||||
li.entries?.reversed()?.forEach {
|
||||
val m = Media(it)
|
||||
m.cameFromContinue = true
|
||||
map[m.id] = m
|
||||
}
|
||||
}
|
||||
response?.data?.repeating?.lists?.forEach { li ->
|
||||
li.entries?.reversed()?.forEach {
|
||||
val m = Media(it)
|
||||
m.cameFromContinue = true
|
||||
map[m.id] = m
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type != "ANIME") {
|
||||
returnArray.addAll(map.values)
|
||||
return returnArray
|
||||
}
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val list = PrefManager.getNullableCustomVal(
|
||||
"continueAnimeList",
|
||||
listOf<Int>(),
|
||||
List::class.java
|
||||
) as List<Int>
|
||||
if (list.isNotEmpty()) {
|
||||
list.reversed().forEach {
|
||||
if (map.containsKey(it)) returnArray.add(map[it]!!)
|
||||
}
|
||||
for (i in map) {
|
||||
if (i.value !in returnArray) returnArray.add(i.value)
|
||||
}
|
||||
} else returnArray.addAll(map.values)
|
||||
return returnArray
|
||||
}
|
||||
|
||||
private fun continueMediaQuery(type: String, status: String): String {
|
||||
return """ MediaListCollection(userId: ${Anilist.userid}, type: $type, status: $status , sort: UPDATED_TIME ) { lists { entries { progress private score(format:POINT_100) status media { id idMal type isAdult status chapters episodes nextAiringEpisode {episode} meanScore isFavourite format bannerImage coverImage{large} title { english romaji userPreferred } } } } } """
|
||||
}
|
||||
|
||||
private suspend fun favMedia(anime: Boolean, id: Int? = Anilist.userid): ArrayList<Media> {
|
||||
suspend fun favMedia(anime: Boolean, id: Int? = Anilist.userid): ArrayList<Media> {
|
||||
var hasNextPage = true
|
||||
var page = 0
|
||||
|
||||
@@ -408,6 +462,41 @@ class AnilistQueries {
|
||||
return """User(id:${id}){id favourites{${if (anime) "anime" else "manga"}(page:$page){pageInfo{hasNextPage}edges{favouriteOrder node{id idMal isAdult mediaListEntry{ progress private score(format:POINT_100) status } chapters isFavourite format episodes nextAiringEpisode{episode}meanScore isFavourite format startDate{year month day} title{english romaji userPreferred}type status(version:2)bannerImage coverImage{large}}}}}}"""
|
||||
}
|
||||
|
||||
suspend fun recommendations(): ArrayList<Media> {
|
||||
val response = executeQuery<Query.Page>("""{${recommendationQuery()}}""")
|
||||
val map = mutableMapOf<Int, Media>()
|
||||
response?.data?.page?.apply {
|
||||
recommendations?.onEach {
|
||||
val json = it.mediaRecommendation
|
||||
if (json != null) {
|
||||
val m = Media(json)
|
||||
m.relation = json.type?.toString()
|
||||
map[m.id] = m
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val types = arrayOf("ANIME", "MANGA")
|
||||
suspend fun repeat(type: String) {
|
||||
val res =
|
||||
executeQuery<Query.MediaListCollection>("""{${recommendationPlannedQuery(type)}}""")
|
||||
res?.data?.mediaListCollection?.lists?.forEach { li ->
|
||||
li.entries?.forEach {
|
||||
val m = Media(it)
|
||||
if (m.status == "RELEASING" || m.status == "FINISHED") {
|
||||
m.relation = it.media?.type?.toString()
|
||||
map[m.id] = m
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
types.forEach { repeat(it) }
|
||||
|
||||
val list = ArrayList(map.values.toList())
|
||||
list.sortByDescending { it.meanScore }
|
||||
return list
|
||||
}
|
||||
|
||||
private fun recommendationQuery(): String {
|
||||
return """ Page(page: 1, perPage:30) { pageInfo { total currentPage hasNextPage } recommendations(sort: RATING_DESC, onList: true) { rating userRating mediaRecommendation { id idMal isAdult mediaListEntry { progress private score(format:POINT_100) status } chapters isFavourite format episodes nextAiringEpisode {episode} popularity meanScore isFavourite format title {english romaji userPreferred } type status(version: 2) bannerImage coverImage { large } } } } """
|
||||
}
|
||||
@@ -416,11 +505,9 @@ class AnilistQueries {
|
||||
return """ MediaListCollection(userId: ${Anilist.userid}, type: $type, status: PLANNING${if (type == "ANIME") ", sort: MEDIA_POPULARITY_DESC" else ""} ) { lists { entries { media { id mediaListEntry { progress private score(format:POINT_100) status } idMal type isAdult popularity status(version: 2) chapters episodes nextAiringEpisode {episode} meanScore isFavourite format bannerImage coverImage{large} title { english romaji userPreferred } } } } }"""
|
||||
}
|
||||
|
||||
suspend fun initHomePage(): Map<String, ArrayList<*>> {
|
||||
val removeList = PrefManager.getCustomVal("removeList", setOf<Int>())
|
||||
val removedMedia = ArrayList<Media>()
|
||||
suspend fun initHomePage(): Map<String, ArrayList<Media>> {
|
||||
val toShow: List<Boolean> =
|
||||
PrefManager.getVal(PrefName.HomeLayout) // anime continue, anime fav, anime planned, manga continue, manga fav, manga planned, recommendations
|
||||
PrefManager.getVal(PrefName.HomeLayoutShow) // anime continue, anime fav, anime planned, manga continue, manga fav, manga planned, recommendations
|
||||
var query = """{"""
|
||||
if (toShow.getOrNull(0) == true) query += """currentAnime: ${
|
||||
continueMediaQuery(
|
||||
@@ -453,11 +540,11 @@ class AnilistQueries {
|
||||
"ANIME"
|
||||
)
|
||||
}, recommendationPlannedQueryManga: ${recommendationPlannedQuery("MANGA")}"""
|
||||
if (toShow.getOrNull(7) == true) query += "Page1:${status(1)}Page2:${status(2)}"
|
||||
query += """}""".trimEnd(',')
|
||||
|
||||
val response = executeQuery<Query.HomePageMedia>(query, show = true)
|
||||
val returnMap = mutableMapOf<String, ArrayList<*>>()
|
||||
Logger.log(response.toString())
|
||||
val returnMap = mutableMapOf<String, ArrayList<Media>>()
|
||||
fun current(type: String) {
|
||||
val subMap = mutableMapOf<Int, Media>()
|
||||
val returnArray = arrayListOf<Media>()
|
||||
@@ -468,24 +555,15 @@ class AnilistQueries {
|
||||
current?.lists?.forEach { li ->
|
||||
li.entries?.reversed()?.forEach {
|
||||
val m = Media(it)
|
||||
if (m.id !in removeList) {
|
||||
m.cameFromContinue = true
|
||||
subMap[m.id] = m
|
||||
} else {
|
||||
removedMedia.add(m)
|
||||
}
|
||||
m.cameFromContinue = true
|
||||
subMap[m.id] = m
|
||||
}
|
||||
}
|
||||
|
||||
repeating?.lists?.forEach { li ->
|
||||
li.entries?.reversed()?.forEach {
|
||||
val m = Media(it)
|
||||
if (m.id !in removeList) {
|
||||
m.cameFromContinue = true
|
||||
subMap[m.id] = m
|
||||
} else {
|
||||
removedMedia.add(m)
|
||||
}
|
||||
m.cameFromContinue = true
|
||||
subMap[m.id] = m
|
||||
}
|
||||
}
|
||||
if (type != "Anime") {
|
||||
@@ -519,12 +597,8 @@ class AnilistQueries {
|
||||
current?.lists?.forEach { li ->
|
||||
li.entries?.reversed()?.forEach {
|
||||
val m = Media(it)
|
||||
if (m.id !in removeList) {
|
||||
m.cameFromContinue = true
|
||||
subMap[m.id] = m
|
||||
} else {
|
||||
removedMedia.add(m)
|
||||
}
|
||||
m.cameFromContinue = true
|
||||
subMap[m.id] = m
|
||||
}
|
||||
}
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@@ -551,12 +625,7 @@ class AnilistQueries {
|
||||
val returnArray = arrayListOf<Media>()
|
||||
apiMediaList?.edges?.forEach {
|
||||
it.node?.let { i ->
|
||||
val m = Media(i).apply { isFav = true }
|
||||
if (m.id !in removeList) {
|
||||
returnArray.add(m)
|
||||
} else {
|
||||
removedMedia.add(m)
|
||||
}
|
||||
returnArray.add(Media(i).apply { isFav = true })
|
||||
}
|
||||
}
|
||||
returnMap["favorite$type"] = returnArray
|
||||
@@ -618,47 +687,6 @@ class AnilistQueries {
|
||||
list.sortByDescending { it.meanScore }
|
||||
returnMap["recommendations"] = list
|
||||
}
|
||||
if (toShow.getOrNull(7) == true) {
|
||||
val list = mutableListOf<User>()
|
||||
val threeDaysAgo = Calendar.getInstance().apply {
|
||||
add(Calendar.DAY_OF_MONTH, -3)
|
||||
}.timeInMillis
|
||||
if (response?.data?.page1 != null && response.data.page2 != null) {
|
||||
val activities = listOf(
|
||||
response.data.page1.activities,
|
||||
response.data.page2.activities
|
||||
).asSequence().flatten()
|
||||
.filter { it.typename != "MessageActivity" }
|
||||
.filter { if (Anilist.adult) true else it.media?.isAdult == false }
|
||||
.filter { it.createdAt * 1000L > threeDaysAgo }.toList()
|
||||
.sortedByDescending { it.createdAt }
|
||||
val anilistActivities = mutableListOf<User>()
|
||||
val groupedActivities = activities.groupBy { it.userId }
|
||||
|
||||
groupedActivities.forEach { (_, userActivities) ->
|
||||
val user = userActivities.firstOrNull()?.user
|
||||
if (user != null) {
|
||||
val userToAdd = User(
|
||||
user.id,
|
||||
user.name ?: "",
|
||||
user.avatar?.medium,
|
||||
user.bannerImage,
|
||||
activity = userActivities.sortedBy { it.createdAt }.toList()
|
||||
)
|
||||
if (user.id == Anilist.userid) {
|
||||
anilistActivities.add(0, userToAdd)
|
||||
} else {
|
||||
list.add(userToAdd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
list.addAll(0, anilistActivities)
|
||||
returnMap["status"] = ArrayList(list)
|
||||
}
|
||||
returnMap["hidden"] = removedMedia.distinctBy { it.id } as ArrayList<Media>
|
||||
}
|
||||
return returnMap
|
||||
}
|
||||
|
||||
@@ -1091,11 +1119,11 @@ query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult:
|
||||
} else null
|
||||
else null
|
||||
}
|
||||
}?.toCollection(ArrayList()) ?: arrayListOf()
|
||||
} as ArrayList<Media>
|
||||
|
||||
list["trendingMovies"] = trendingMovies?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf()
|
||||
list["topRated"] = topRated?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf()
|
||||
list["mostFav"] = mostFav?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf()
|
||||
list["trendingMovies"] = trendingMovies?.media?.map { Media(it) } as ArrayList<Media>
|
||||
list["topRated"] = topRated?.media?.map { Media(it) } as ArrayList<Media>
|
||||
list["mostFav"] = mostFav?.media?.map { Media(it) } as ArrayList<Media>
|
||||
|
||||
list["recentUpdates"]?.addAll(recentUpdates2?.airingSchedules?.mapNotNull { i ->
|
||||
i.media?.let {
|
||||
@@ -1112,10 +1140,10 @@ query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult:
|
||||
} else null
|
||||
else null
|
||||
}
|
||||
}?.toCollection(ArrayList()) ?: arrayListOf())
|
||||
list["trendingMovies"]?.addAll(trendingMovies2?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf())
|
||||
list["topRated"]?.addAll(topRated2?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf())
|
||||
list["mostFav"]?.addAll(mostFav2?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf())
|
||||
} as ArrayList<Media>)
|
||||
list["trendingMovies"]?.addAll(trendingMovies2?.media?.map { Media(it) } as ArrayList<Media>)
|
||||
list["topRated"]?.addAll(topRated2?.media?.map { Media(it) } as ArrayList<Media>)
|
||||
list["mostFav"]?.addAll(mostFav2?.media?.map { Media(it) } as ArrayList<Media>)
|
||||
}
|
||||
return list
|
||||
}
|
||||
@@ -1164,20 +1192,19 @@ query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult:
|
||||
}
|
||||
|
||||
executeQuery<Query.MangaList>(query(), force = true)?.data?.apply {
|
||||
list["trendingManga"] = trendingManga?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf()
|
||||
list["trendingManhwa"] = trendingManhwa?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf()
|
||||
list["trendingNovel"] = trendingNovel?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf()
|
||||
list["topRated"] = topRated?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf()
|
||||
list["mostFav"] = mostFav?.media?.map { Media(it) }?.toCollection(ArrayList()) ?: arrayListOf()
|
||||
list["trendingManga"] = trendingManga?.media?.map { Media(it) } as ArrayList<Media>
|
||||
list["trendingManhwa"] = trendingManhwa?.media?.map { Media(it) } as ArrayList<Media>
|
||||
list["trendingNovel"] = trendingNovel?.media?.map { Media(it) } as ArrayList<Media>
|
||||
list["topRated"] = topRated?.media?.map { Media(it) } as ArrayList<Media>
|
||||
list["mostFav"] = mostFav?.media?.map { Media(it) } as ArrayList<Media>
|
||||
list["trendingManga"]?.addAll(trendingManga2?.media?.map { Media(it) } as ArrayList<Media>)
|
||||
list["trendingManhwa"]?.addAll(trendingManhwa2?.media?.map { Media(it) } as ArrayList<Media>)
|
||||
list["trendingNovel"]?.addAll(trendingNovel2?.media?.map { Media(it) } as ArrayList<Media>)
|
||||
list["topRated"]?.addAll(topRated2?.media?.map { Media(it) } as ArrayList<Media>)
|
||||
list["mostFav"]?.addAll(mostFav2?.media?.map { Media(it) } as ArrayList<Media>)
|
||||
|
||||
list["trendingManga"]?.addAll(trendingManga2?.media?.map { Media(it) }?.toList() ?: arrayListOf())
|
||||
list["trendingManhwa"]?.addAll(trendingManhwa2?.media?.map { Media(it) }?.toList() ?: arrayListOf())
|
||||
list["trendingNovel"]?.addAll(trendingNovel2?.media?.map { Media(it) }?.toList() ?: arrayListOf())
|
||||
list["topRated"]?.addAll(topRated2?.media?.map { Media(it) }?.toList() ?: arrayListOf())
|
||||
list["mostFav"]?.addAll(mostFav2?.media?.map { Media(it) }?.toList() ?: arrayListOf())
|
||||
}
|
||||
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
@@ -1509,13 +1536,6 @@ Page(page:$page,perPage:50) {
|
||||
return author
|
||||
}
|
||||
|
||||
suspend fun getReviews(mediaId: Int, page: Int = 1, sort: String = "SCORE_DESC"): Query.ReviewsResponse? {
|
||||
return executeQuery<Query.ReviewsResponse>(
|
||||
"""{Page(page:$page,perPage:10){pageInfo{currentPage,hasNextPage,total}reviews(mediaId:$mediaId,sort:$sort){id,mediaId,mediaType,summary,body(asHtml:true)rating,ratingAmount,userRating,score,private,siteUrl,createdAt,updatedAt,user{id,name,bannerImage avatar{medium,large}}}}}""",
|
||||
force = true
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun toggleFollow(id: Int): Query.ToggleFollow? {
|
||||
return executeQuery<Query.ToggleFollow>(
|
||||
"""mutation{ToggleFollow(userId:$id){id, isFollowing, isFollower}}"""
|
||||
@@ -1540,7 +1560,7 @@ Page(page:$page,perPage:50) {
|
||||
return getUserProfile(id)
|
||||
}
|
||||
|
||||
private suspend fun getUserId(username: String): Int? {
|
||||
suspend fun getUserId(username: String): Int? {
|
||||
return executeQuery<Query.User>(
|
||||
"""{User(name:"$username"){id}}""",
|
||||
force = true
|
||||
@@ -1555,8 +1575,8 @@ Page(page:$page,perPage:50) {
|
||||
)
|
||||
}
|
||||
|
||||
private fun userFavMediaQuery(anime: Boolean, id: Int): String {
|
||||
return """User(id:${id}){id favourites{${if (anime) "anime" else "manga"}(page:1){pageInfo{hasNextPage}edges{favouriteOrder node{id idMal isAdult mediaListEntry{ progress private score(format:POINT_100) status } chapters isFavourite format episodes nextAiringEpisode{episode}meanScore isFavourite format startDate{year month day} title{english romaji userPreferred}type status(version:2)bannerImage coverImage{large}}}}}}"""
|
||||
private fun userFavMediaQuery(anime: Boolean, page: Int, id: Int): String {
|
||||
return """User(id:${id}){id favourites{${if (anime) "anime" else "manga"}(page:$page){pageInfo{hasNextPage}edges{favouriteOrder node{id idMal isAdult mediaListEntry{ progress private score(format:POINT_100) status } chapters isFavourite format episodes nextAiringEpisode{episode}meanScore isFavourite format startDate{year month day} title{english romaji userPreferred}type status(version:2)bannerImage coverImage{large}}}}}}"""
|
||||
}
|
||||
|
||||
suspend fun userFollowing(id: Int): Query.Following? {
|
||||
@@ -1576,8 +1596,8 @@ Page(page:$page,perPage:50) {
|
||||
suspend fun initProfilePage(id: Int): Query.ProfilePageMedia? {
|
||||
return executeQuery<Query.ProfilePageMedia>(
|
||||
"""{
|
||||
favoriteAnime:${userFavMediaQuery(true, id)}
|
||||
favoriteManga:${userFavMediaQuery(false, id)}
|
||||
favoriteAnime:${userFavMediaQuery(true, 1, id)}
|
||||
favoriteManga:${userFavMediaQuery(false, 1, id)}
|
||||
}""".trimIndent(), force = true
|
||||
)
|
||||
}
|
||||
@@ -1611,25 +1631,13 @@ Page(page:$page,perPage:50) {
|
||||
val filter = if (activityId != null) "id:$activityId,"
|
||||
else if (userId != null) "userId:$userId,"
|
||||
else if (global) "isFollowing:false,hasRepliesOrTypeText:true,"
|
||||
else "isFollowing:true,"
|
||||
else "isFollowing:true,type_not:MESSAGE,"
|
||||
return executeQuery<FeedResponse>(
|
||||
"""{Page(page:$page,perPage:$ITEMS_PER_PAGE){activities(${filter}sort:ID_DESC){__typename ... on TextActivity{id userId type replyCount text(asHtml:true)siteUrl isLocked isSubscribed likeCount isLiked isPinned createdAt user{id name bannerImage avatar{medium large}}replies{id userId activityId text(asHtml:true)likeCount isLiked createdAt user{id name bannerImage avatar{medium large}}likes{id name bannerImage avatar{medium large}}}likes{id name bannerImage avatar{medium large}}}... on ListActivity{id userId type replyCount status progress siteUrl isLocked isSubscribed likeCount isLiked isPinned createdAt user{id name bannerImage avatar{medium large}}media{id title{english romaji native userPreferred}bannerImage coverImage{medium large}isAdult}replies{id userId activityId text(asHtml:true)likeCount isLiked createdAt user{id name bannerImage avatar{medium large}}likes{id name bannerImage avatar{medium large}}}likes{id name bannerImage avatar{medium large}}}... on MessageActivity{id recipientId messengerId type replyCount likeCount message(asHtml:true)isLocked isSubscribed isLiked isPrivate siteUrl createdAt recipient{id name bannerImage avatar{medium large}}messenger{id name bannerImage avatar{medium large}}replies{id userId activityId text(asHtml:true)likeCount isLiked createdAt user{id name bannerImage avatar{medium large}}likes{id name bannerImage avatar{medium large}}}likes{id name bannerImage avatar{medium large}}}}}}""",
|
||||
"""{Page(page:$page,perPage:$ITEMS_PER_PAGE){activities(${filter}sort:ID_DESC){__typename ... on TextActivity{id userId type replyCount text(asHtml:true)siteUrl isLocked isSubscribed likeCount isLiked isPinned createdAt user{id name bannerImage avatar{medium large}}replies{id userId activityId text(asHtml:true)likeCount isLiked createdAt user{id name bannerImage avatar{medium large}}likes{id name bannerImage avatar{medium large}}}likes{id name bannerImage avatar{medium large}}}... on ListActivity{id userId type replyCount status progress siteUrl isLocked isSubscribed likeCount isLiked isPinned createdAt user{id name bannerImage avatar{medium large}}media{id title{english romaji native userPreferred}bannerImage coverImage{medium large}}replies{id userId activityId text(asHtml:true)likeCount isLiked createdAt user{id name bannerImage avatar{medium large}}likes{id name bannerImage avatar{medium large}}}likes{id name bannerImage avatar{medium large}}}... on MessageActivity{id recipientId messengerId type replyCount likeCount message(asHtml:true)isLocked isSubscribed isLiked isPrivate siteUrl createdAt recipient{id name bannerImage avatar{medium large}}messenger{id name bannerImage avatar{medium large}}replies{id userId activityId text(asHtml:true)likeCount isLiked createdAt user{id name bannerImage avatar{medium large}}likes{id name bannerImage avatar{medium large}}}likes{id name bannerImage avatar{medium large}}}}}}""",
|
||||
force = true
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun getReplies(
|
||||
activityId: Int,
|
||||
page: Int = 1
|
||||
) : ReplyResponse? {
|
||||
val query = """{Page(page:$page,perPage:50){activityReplies(activityId:$activityId){id userId activityId text(asHtml:true)likeCount isLiked createdAt user{id name bannerImage avatar{medium large}}likes{id name bannerImage avatar{medium large}}}}}"""
|
||||
return executeQuery(query, force = true)
|
||||
}
|
||||
|
||||
private fun status(page: Int = 1): String {
|
||||
return """Page(page:$page,perPage:50){activities(isFollowing: true,sort:ID_DESC){__typename ... on TextActivity{id userId type replyCount text(asHtml:true)siteUrl isLocked isSubscribed replyCount likeCount isLiked createdAt user{id name bannerImage avatar{medium large}}likes{id name bannerImage avatar{medium large}}}... on ListActivity{id userId type replyCount status progress siteUrl isLocked isSubscribed replyCount likeCount isLiked isPinned createdAt user{id name bannerImage avatar{medium large}}media{id isAdult title{english romaji native userPreferred}bannerImage coverImage{extraLarge medium large}}likes{id name bannerImage avatar{medium large}}}... on MessageActivity{id type createdAt}}}"""
|
||||
}
|
||||
|
||||
suspend fun getUpcomingAnime(id: String): List<Media> {
|
||||
val res = executeQuery<Query.MediaListCollection>(
|
||||
"""{MediaListCollection(userId:$id,type:ANIME){lists{name entries{media{id,isFavourite,title{userPreferred,romaji}coverImage{medium}nextAiringEpisode{timeUntilAiring}}}}}}""",
|
||||
|
||||
@@ -5,34 +5,46 @@ import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import ani.dantotsu.BuildConfig
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.discord.Discord
|
||||
import ani.dantotsu.connections.mal.MAL
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.others.AppUpdater
|
||||
import ani.dantotsu.profile.User
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.tryWithSuspend
|
||||
import ani.dantotsu.util.Logger
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
suspend fun getUserId(context: Context, block: () -> Unit) {
|
||||
if (!Anilist.initialized) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val token = PrefManager.getVal(PrefName.DiscordToken, null as String?)
|
||||
val userid = PrefManager.getVal(PrefName.DiscordId, null as String?)
|
||||
if (userid == null && token != null) {
|
||||
/*if (!Discord.getUserData())
|
||||
snackString(context.getString(R.string.error_loading_discord_user_data))*/
|
||||
//TODO: Discord.getUserData()
|
||||
}
|
||||
}
|
||||
|
||||
val anilist = if (Anilist.userid == null && Anilist.token != null) {
|
||||
if (Anilist.query.getUserData()) {
|
||||
tryWithSuspend {
|
||||
if (MAL.token != null && !MAL.query.getUserData())
|
||||
snackString(context.getString(R.string.error_loading_mal_user_data))
|
||||
}
|
||||
true
|
||||
} else {
|
||||
snackString(context.getString(R.string.error_loading_anilist_user_data))
|
||||
false
|
||||
}
|
||||
}
|
||||
block.invoke()
|
||||
} else true
|
||||
|
||||
if (anilist) block.invoke()
|
||||
}
|
||||
|
||||
class AnilistHomeViewModel : ViewModel() {
|
||||
@@ -77,28 +89,16 @@ class AnilistHomeViewModel : ViewModel() {
|
||||
|
||||
fun getRecommendation(): LiveData<ArrayList<Media>> = recommendation
|
||||
|
||||
private val userStatus: MutableLiveData<ArrayList<User>> =
|
||||
MutableLiveData<ArrayList<User>>(null)
|
||||
|
||||
fun getUserStatus(): LiveData<ArrayList<User>> = userStatus
|
||||
|
||||
private val hidden: MutableLiveData<ArrayList<Media>> =
|
||||
MutableLiveData<ArrayList<Media>>(null)
|
||||
|
||||
fun getHidden(): LiveData<ArrayList<Media>> = hidden
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun initHomePage() {
|
||||
val res = Anilist.query.initHomePage()
|
||||
res["currentAnime"]?.let { animeContinue.postValue(it as ArrayList<Media>?) }
|
||||
res["favoriteAnime"]?.let { animeFav.postValue(it as ArrayList<Media>?) }
|
||||
res["plannedAnime"]?.let { animePlanned.postValue(it as ArrayList<Media>?) }
|
||||
res["currentManga"]?.let { mangaContinue.postValue(it as ArrayList<Media>?) }
|
||||
res["favoriteManga"]?.let { mangaFav.postValue(it as ArrayList<Media>?) }
|
||||
res["plannedManga"]?.let { mangaPlanned.postValue(it as ArrayList<Media>?) }
|
||||
res["recommendations"]?.let { recommendation.postValue(it as ArrayList<Media>?) }
|
||||
res["hidden"]?.let { hidden.postValue(it as ArrayList<Media>?) }
|
||||
res["status"]?.let { userStatus.postValue(it as ArrayList<User>?) }
|
||||
Logger.log("AnilistHomeViewModel : res=$res")
|
||||
res["currentAnime"]?.let { animeContinue.postValue(it) }
|
||||
res["favoriteAnime"]?.let { animeFav.postValue(it) }
|
||||
res["plannedAnime"]?.let { animePlanned.postValue(it) }
|
||||
res["currentManga"]?.let { mangaContinue.postValue(it) }
|
||||
res["favoriteManga"]?.let { mangaFav.postValue(it) }
|
||||
res["plannedManga"]?.let { mangaPlanned.postValue(it) }
|
||||
res["recommendations"]?.let { recommendation.postValue(it) }
|
||||
}
|
||||
|
||||
suspend fun loadMain(context: FragmentActivity) {
|
||||
@@ -106,15 +106,9 @@ class AnilistHomeViewModel : ViewModel() {
|
||||
MAL.getSavedToken()
|
||||
Discord.getSavedToken()
|
||||
if (!BuildConfig.FLAVOR.contains("fdroid")) {
|
||||
if (PrefManager.getVal(PrefName.CheckUpdate))
|
||||
context.lifecycleScope.launch(Dispatchers.IO) {
|
||||
AppUpdater.check(context, false)
|
||||
}
|
||||
}
|
||||
val ret = Anilist.query.getGenresAndTags()
|
||||
withContext(Dispatchers.Main) {
|
||||
genres.value = ret
|
||||
if (PrefManager.getVal(PrefName.CheckUpdate)) AppUpdater.check(context)
|
||||
}
|
||||
genres.postValue(Anilist.query.getGenresAndTags())
|
||||
}
|
||||
|
||||
val empty = MutableLiveData<Boolean>(null)
|
||||
|
||||
@@ -138,8 +138,6 @@ class Query {
|
||||
@SerialName("recommendationQuery") val recommendationQuery: ani.dantotsu.connections.anilist.api.Page?,
|
||||
@SerialName("recommendationPlannedQueryAnime") val recommendationPlannedQueryAnime: ani.dantotsu.connections.anilist.api.MediaListCollection?,
|
||||
@SerialName("recommendationPlannedQueryManga") val recommendationPlannedQueryManga: ani.dantotsu.connections.anilist.api.MediaListCollection?,
|
||||
@SerialName("Page1") val page1: ActivityPage?,
|
||||
@SerialName("Page2") val page2: ActivityPage?
|
||||
)
|
||||
}
|
||||
|
||||
@@ -299,70 +297,6 @@ class Query {
|
||||
val following: List<ani.dantotsu.connections.anilist.api.User>?
|
||||
) : java.io.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ReviewsResponse(
|
||||
@SerialName("data")
|
||||
val data: Data
|
||||
) : java.io.Serializable {
|
||||
@Serializable
|
||||
data class Data(
|
||||
@SerialName("Page")
|
||||
val page: ReviewPage?
|
||||
) : java.io.Serializable
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class ReviewPage(
|
||||
@SerialName("pageInfo")
|
||||
val pageInfo: PageInfo,
|
||||
@SerialName("reviews")
|
||||
val reviews: List<Review>?
|
||||
) : java.io.Serializable
|
||||
|
||||
@Serializable
|
||||
data class RateReviewResponse(
|
||||
@SerialName("data")
|
||||
val data: Data
|
||||
) : java.io.Serializable {
|
||||
@Serializable
|
||||
data class Data(
|
||||
@SerialName("RateReview")
|
||||
val rateReview: Review
|
||||
) : java.io.Serializable
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class Review(
|
||||
@SerialName("id")
|
||||
val id: Int,
|
||||
@SerialName("mediaId")
|
||||
val mediaId: Int,
|
||||
@SerialName("mediaType")
|
||||
val mediaType: String,
|
||||
@SerialName("summary")
|
||||
val summary: String,
|
||||
@SerialName("body")
|
||||
val body: String,
|
||||
@SerialName("rating")
|
||||
var rating: Int,
|
||||
@SerialName("ratingAmount")
|
||||
var ratingAmount: Int,
|
||||
@SerialName("userRating")
|
||||
var userRating: String,
|
||||
@SerialName("score")
|
||||
val score: Int,
|
||||
@SerialName("private")
|
||||
val private: Boolean,
|
||||
@SerialName("siteUrl")
|
||||
val siteUrl: String,
|
||||
@SerialName("createdAt")
|
||||
val createdAt: Int,
|
||||
@SerialName("updatedAt")
|
||||
val updatedAt: Int?,
|
||||
@SerialName("user")
|
||||
val user: ani.dantotsu.connections.anilist.api.User?,
|
||||
) : java.io.Serializable
|
||||
|
||||
@Serializable
|
||||
data class UserProfile(
|
||||
@SerialName("id")
|
||||
|
||||
@@ -14,6 +14,7 @@ data class FeedResponse(
|
||||
val page: ActivityPage
|
||||
) : java.io.Serializable
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class ActivityPage(
|
||||
@SerialName("activities")
|
||||
@@ -35,7 +36,7 @@ data class Activity(
|
||||
@SerialName("type")
|
||||
val type: String,
|
||||
@SerialName("replyCount")
|
||||
val replyCount: Int = 0,
|
||||
val replyCount: Int,
|
||||
@SerialName("status")
|
||||
val status: String?,
|
||||
@SerialName("progress")
|
||||
@@ -47,9 +48,9 @@ data class Activity(
|
||||
@SerialName("siteUrl")
|
||||
val siteUrl: String?,
|
||||
@SerialName("isLocked")
|
||||
val isLocked: Boolean?,
|
||||
val isLocked: Boolean,
|
||||
@SerialName("isSubscribed")
|
||||
val isSubscribed: Boolean?,
|
||||
val isSubscribed: Boolean,
|
||||
@SerialName("likeCount")
|
||||
var likeCount: Int?,
|
||||
@SerialName("isLiked")
|
||||
@@ -74,24 +75,6 @@ data class Activity(
|
||||
val likes: List<User>?,
|
||||
) : java.io.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ReplyResponse(
|
||||
@SerialName("data")
|
||||
val data: Data
|
||||
) : java.io.Serializable {
|
||||
@Serializable
|
||||
data class Data(
|
||||
@SerialName("Page")
|
||||
val page: ReplyPage
|
||||
) : java.io.Serializable
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class ReplyPage(
|
||||
@SerialName("activityReplies")
|
||||
val activityReplies: List<ActivityReply>
|
||||
) : java.io.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ActivityReply(
|
||||
@SerialName("id")
|
||||
@@ -101,9 +84,9 @@ data class ActivityReply(
|
||||
@SerialName("text")
|
||||
val text: String,
|
||||
@SerialName("likeCount")
|
||||
var likeCount: Int,
|
||||
val likeCount: Int,
|
||||
@SerialName("isLiked")
|
||||
var isLiked: Boolean,
|
||||
val isLiked: Boolean,
|
||||
@SerialName("createdAt")
|
||||
val createdAt: Int,
|
||||
@SerialName("user")
|
||||
|
||||
@@ -152,7 +152,7 @@ data class Media(
|
||||
@SerialName("mediaListEntry") var mediaListEntry: MediaList?,
|
||||
|
||||
// User reviews of the media
|
||||
@SerialName("reviews") var reviews: ReviewConnection?,
|
||||
// @SerialName("reviews") var reviews: ReviewConnection?,
|
||||
|
||||
// User recommendations for similar media
|
||||
@SerialName("recommendations") var recommendations: RecommendationConnection?,
|
||||
@@ -174,7 +174,7 @@ data class Media(
|
||||
|
||||
// Notes for site moderators
|
||||
@SerialName("modNotes") var modNotes: String?,
|
||||
) : java.io.Serializable
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class MediaTitle(
|
||||
@@ -189,7 +189,7 @@ data class MediaTitle(
|
||||
|
||||
// The currently authenticated users preferred title language. Default romaji for non-authenticated
|
||||
@SerialName("userPreferred") var userPreferred: String,
|
||||
): java.io.Serializable
|
||||
)
|
||||
|
||||
@Serializable
|
||||
enum class MediaType {
|
||||
@@ -205,17 +205,15 @@ enum class MediaStatus {
|
||||
FINISHED, RELEASING, NOT_YET_RELEASED, CANCELLED, HIATUS;
|
||||
|
||||
override fun toString(): String {
|
||||
currContext()?.let {
|
||||
return when (super.toString()) {
|
||||
"FINISHED" -> it.getString(R.string.status_finished)
|
||||
"RELEASING" -> it.getString(R.string.status_releasing)
|
||||
"NOT_YET_RELEASED" -> it.getString(R.string.status_not_yet_released)
|
||||
"CANCELLED" -> it.getString(R.string.status_cancelled)
|
||||
"HIATUS" -> it.getString(R.string.status_hiatus)
|
||||
else -> ""
|
||||
}
|
||||
return when (super.toString()) {
|
||||
"FINISHED" -> currContext()!!.getString(R.string.status_finished)
|
||||
"RELEASING" -> currContext()!!.getString(R.string.status_releasing)
|
||||
"NOT_YET_RELEASED" -> currContext()!!.getString(R.string.status_not_yet_released)
|
||||
"CANCELLED" -> currContext()!!.getString(R.string.status_cancelled)
|
||||
"HIATUS" -> currContext()!!.getString(R.string.status_hiatus)
|
||||
else -> ""
|
||||
}
|
||||
return super.toString().replace("_", " ")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,20 +445,17 @@ enum class MediaRelation {
|
||||
ADAPTATION, PREQUEL, SEQUEL, PARENT, SIDE_STORY, CHARACTER, SUMMARY, ALTERNATIVE, SPIN_OFF, OTHER, SOURCE, COMPILATION, CONTAINS;
|
||||
|
||||
override fun toString(): String {
|
||||
currContext()?.let {
|
||||
return when (super.toString()) {
|
||||
"ADAPTATION" -> it.getString(R.string.type_adaptation)
|
||||
"PARENT" -> it.getString(R.string.type_parent)
|
||||
"CHARACTER" -> it.getString(R.string.type_character)
|
||||
"SUMMARY" -> it.getString(R.string.type_summary)
|
||||
"ALTERNATIVE" -> it.getString(R.string.type_alternative)
|
||||
"OTHER" -> it.getString(R.string.type_other)
|
||||
"SOURCE" -> it.getString(R.string.type_source)
|
||||
"CONTAINS" -> it.getString(R.string.type_contains)
|
||||
else -> super.toString().replace("_", " ")
|
||||
}
|
||||
return when (super.toString()) {
|
||||
"ADAPTATION" -> currContext()!!.getString(R.string.type_adaptation)
|
||||
"PARENT" -> currContext()!!.getString(R.string.type_parent)
|
||||
"CHARACTER" -> currContext()!!.getString(R.string.type_character)
|
||||
"SUMMARY" -> currContext()!!.getString(R.string.type_summary)
|
||||
"ALTERNATIVE" -> currContext()!!.getString(R.string.type_alternative)
|
||||
"OTHER" -> currContext()!!.getString(R.string.type_other)
|
||||
"SOURCE" -> currContext()!!.getString(R.string.type_source)
|
||||
"CONTAINS" -> currContext()!!.getString(R.string.type_contains)
|
||||
else -> super.toString().replace("_", " ")
|
||||
}
|
||||
return super.toString().replace("_", " ")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,9 +532,4 @@ data class MediaListGroup(
|
||||
@SerialName("isSplitCompletedList") var isSplitCompletedList: Boolean?,
|
||||
|
||||
@SerialName("status") var status: MediaListStatus?,
|
||||
) : java.io.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ReviewConnection(
|
||||
@SerialName("nodes") var nodes: List<Query.Review>?,
|
||||
)
|
||||
) : java.io.Serializable
|
||||
@@ -2,7 +2,6 @@ package ani.dantotsu.connections.anilist.api
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import java.util.Locale
|
||||
|
||||
enum class NotificationType(val value: String) {
|
||||
ACTIVITY_MESSAGE("ACTIVITY_MESSAGE"),
|
||||
@@ -25,20 +24,6 @@ enum class NotificationType(val value: String) {
|
||||
|
||||
//custom
|
||||
COMMENT_REPLY("COMMENT_REPLY"),
|
||||
COMMENT_WARNING("COMMENT_WARNING"),
|
||||
DANTOTSU_UPDATE("DANTOTSU_UPDATE"),
|
||||
SUBSCRIPTION("SUBSCRIPTION");
|
||||
|
||||
fun toFormattedString(): String {
|
||||
return this.value.replace("_", " ").lowercase(Locale.ROOT)
|
||||
.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.ROOT) else it.toString() }
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun String.fromFormattedString(): String {
|
||||
return this.replace(" ", "_").uppercase(Locale.ROOT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
@@ -111,8 +96,6 @@ data class Notification(
|
||||
val thread: Thread? = null,
|
||||
@SerialName("comment")
|
||||
val comment: ThreadComment? = null,
|
||||
val image: String? = null,
|
||||
val banner: String? = null,
|
||||
) : java.io.Serializable
|
||||
|
||||
@Serializable
|
||||
|
||||
@@ -69,7 +69,7 @@ data class User(
|
||||
// The user's previously used names.
|
||||
// @SerialName("previousNames") var previousNames: List<UserPreviousName>?,
|
||||
|
||||
): java.io.Serializable
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class UserOptions(
|
||||
|
||||
@@ -40,12 +40,7 @@ class MangaUpdates {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
val res = try {
|
||||
client.post(apiUrl, json = query).parsed<MangaUpdatesResponse>()
|
||||
} catch (e: Exception) {
|
||||
Logger.log(e.toString())
|
||||
return@tryWithSuspend null
|
||||
}
|
||||
val res = client.post(apiUrl, json = query).parsed<MangaUpdatesResponse>()
|
||||
coroutineScope {
|
||||
res.results?.map {
|
||||
async(Dispatchers.IO) {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package ani.dantotsu.connections.comments
|
||||
|
||||
import android.content.Context
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.isOnline
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.util.Logger
|
||||
import com.lagradost.nicehttp.NiceResponse
|
||||
import com.lagradost.nicehttp.Requests
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
@@ -27,8 +24,7 @@ import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
object CommentsAPI {
|
||||
private const val ADDRESS: String = "https://api.dantotsu.app"
|
||||
private var isOnline: Boolean = true
|
||||
private const val ADDRESS: String = "https://1224665.xyz:443"
|
||||
var authToken: String? = null
|
||||
var userId: String? = null
|
||||
var isBanned: Boolean = false
|
||||
@@ -53,8 +49,7 @@ object CommentsAPI {
|
||||
val json = try {
|
||||
request.get(url)
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to fetch comments")
|
||||
snackString("Failed to fetch comments")
|
||||
return null
|
||||
}
|
||||
if (!json.text.startsWith("{")) return null
|
||||
@@ -76,8 +71,7 @@ object CommentsAPI {
|
||||
val json = try {
|
||||
request.get(url)
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to fetch comments")
|
||||
snackString("Failed to fetch comments")
|
||||
return null
|
||||
}
|
||||
if (!json.text.startsWith("{")) return null
|
||||
@@ -99,8 +93,7 @@ object CommentsAPI {
|
||||
val json = try {
|
||||
request.get(url)
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to fetch comment")
|
||||
snackString("Failed to fetch comment")
|
||||
return null
|
||||
}
|
||||
if (!json.text.startsWith("{")) return null
|
||||
@@ -122,8 +115,7 @@ object CommentsAPI {
|
||||
val json = try {
|
||||
request.post(url)
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to vote")
|
||||
snackString("Failed to vote")
|
||||
return false
|
||||
}
|
||||
val res = json.code == 200
|
||||
@@ -149,8 +141,7 @@ object CommentsAPI {
|
||||
val json = try {
|
||||
request.post(url, requestBody = body.build())
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to comment")
|
||||
snackString("Failed to comment")
|
||||
return null
|
||||
}
|
||||
val res = json.code == 200
|
||||
@@ -161,8 +152,7 @@ object CommentsAPI {
|
||||
val parsed = try {
|
||||
Json.decodeFromString<ReturnedComment>(json.text)
|
||||
} catch (e: Exception) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to parse comment")
|
||||
snackString("Failed to parse comment")
|
||||
return null
|
||||
}
|
||||
return Comment(
|
||||
@@ -189,8 +179,7 @@ object CommentsAPI {
|
||||
val json = try {
|
||||
request.delete(url)
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to delete comment")
|
||||
snackString("Failed to delete comment")
|
||||
return false
|
||||
}
|
||||
val res = json.code == 200
|
||||
@@ -209,8 +198,7 @@ object CommentsAPI {
|
||||
val json = try {
|
||||
request.put(url, requestBody = body)
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to edit comment")
|
||||
snackString("Failed to edit comment")
|
||||
return false
|
||||
}
|
||||
val res = json.code == 200
|
||||
@@ -226,8 +214,7 @@ object CommentsAPI {
|
||||
val json = try {
|
||||
request.post(url)
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to ban user")
|
||||
snackString("Failed to ban user")
|
||||
return false
|
||||
}
|
||||
val res = json.code == 200
|
||||
@@ -254,8 +241,7 @@ object CommentsAPI {
|
||||
val json = try {
|
||||
request.post(url, requestBody = body)
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to report comment")
|
||||
snackString("Failed to report comment")
|
||||
return false
|
||||
}
|
||||
val res = json.code == 200
|
||||
@@ -310,8 +296,7 @@ object CommentsAPI {
|
||||
return null
|
||||
}
|
||||
|
||||
suspend fun fetchAuthToken(context: Context, client: OkHttpClient? = null) {
|
||||
isOnline = isOnline(context)
|
||||
suspend fun fetchAuthToken(client: OkHttpClient? = null) {
|
||||
if (authToken != null) return
|
||||
val MAX_RETRIES = 5
|
||||
val tokenLifetime: Long = 1000 * 60 * 60 * 24 * 6 // 6 days
|
||||
@@ -340,8 +325,7 @@ object CommentsAPI {
|
||||
val parsed = try {
|
||||
Json.decodeFromString<AuthResponse>(json.text)
|
||||
} catch (e: Exception) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to login to comments API: ${e.printStackTrace()}")
|
||||
snackString("Failed to login to comments API: ${e.printStackTrace()}")
|
||||
return
|
||||
}
|
||||
PrefManager.setVal(PrefName.CommentAuthResponse, parsed)
|
||||
@@ -361,18 +345,12 @@ object CommentsAPI {
|
||||
return
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Logger.log(e)
|
||||
errorMessage("Failed to login to comments API")
|
||||
snackString("Failed to login to comments API")
|
||||
return
|
||||
}
|
||||
kotlinx.coroutines.delay(60000)
|
||||
}
|
||||
errorMessage("Failed to login after multiple attempts")
|
||||
}
|
||||
|
||||
private fun errorMessage(reason: String) {
|
||||
Logger.log(reason)
|
||||
if (isOnline) snackString(reason)
|
||||
snackString("Failed to login after multiple attempts")
|
||||
}
|
||||
|
||||
fun logout() {
|
||||
|
||||
@@ -84,15 +84,15 @@ class Contributors {
|
||||
"https://anilist.co/user/6244220"
|
||||
),
|
||||
Developer(
|
||||
"Ziadsenior",
|
||||
"Zaidsenior",
|
||||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6049773-8cjYeUOFUguv.jpg",
|
||||
"Comment Moderator and Arabic Translator",
|
||||
"Comment Moderator",
|
||||
"https://anilist.co/user/6049773"
|
||||
),
|
||||
Developer(
|
||||
"hastsu",
|
||||
"https://cdn.discordapp.com/avatars/602422545077108749/20b4a6efa4314550e4ed51cdbe4fef3d.webp?size=160",
|
||||
"Comment Moderator and Arabic Translator",
|
||||
"Comment Moderator",
|
||||
"https://anilist.co/user/6183359"
|
||||
),
|
||||
)
|
||||
|
||||
54
app/src/main/java/ani/dantotsu/connections/github/Forks.kt
Normal file
54
app/src/main/java/ani/dantotsu/connections/github/Forks.kt
Normal file
@@ -0,0 +1,54 @@
|
||||
package ani.dantotsu.connections.github
|
||||
|
||||
import ani.dantotsu.Mapper
|
||||
import ani.dantotsu.client
|
||||
import ani.dantotsu.settings.Developer
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonArray
|
||||
import kotlinx.serialization.json.decodeFromJsonElement
|
||||
|
||||
class Forks {
|
||||
|
||||
fun getForks(): Array<Developer> {
|
||||
var forks = arrayOf<Developer>()
|
||||
runBlocking(Dispatchers.IO) {
|
||||
val res =
|
||||
client.get("https://api.github.com/repos/rebelonion/Dantotsu/forks?sort=stargazers")
|
||||
.parsed<JsonArray>().map {
|
||||
Mapper.json.decodeFromJsonElement<GithubResponse>(it)
|
||||
}
|
||||
res.forEach {
|
||||
forks = forks.plus(
|
||||
Developer(
|
||||
it.name,
|
||||
it.owner.avatarUrl,
|
||||
it.owner.login,
|
||||
it.htmlUrl
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
return forks
|
||||
}
|
||||
|
||||
|
||||
@Serializable
|
||||
data class GithubResponse(
|
||||
@SerialName("name")
|
||||
val name: String,
|
||||
val owner: Owner,
|
||||
@SerialName("html_url")
|
||||
val htmlUrl: String,
|
||||
) {
|
||||
@Serializable
|
||||
data class Owner(
|
||||
@SerialName("login")
|
||||
val login: String,
|
||||
@SerialName("avatar_url")
|
||||
val avatarUrl: String
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,384 +0,0 @@
|
||||
package ani.dantotsu.download
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.os.Environment
|
||||
import android.widget.Toast
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.crashlytics.CrashlyticsInterface
|
||||
import ani.dantotsu.currActivity
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.download.anime.OfflineAnimeModel
|
||||
import ani.dantotsu.download.manga.OfflineMangaModel
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaNameAdapter
|
||||
import ani.dantotsu.media.MediaType
|
||||
import ani.dantotsu.parsers.Episode
|
||||
import ani.dantotsu.parsers.MangaChapter
|
||||
import ani.dantotsu.parsers.MangaImage
|
||||
import ani.dantotsu.parsers.Subtitle
|
||||
import ani.dantotsu.parsers.SubtitleType
|
||||
import ani.dantotsu.util.Logger
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.InstanceCreator
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnimeImpl
|
||||
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
||||
import eu.kanade.tachiyomi.animesource.model.SEpisodeImpl
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SChapterImpl
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.io.File
|
||||
import java.util.Locale
|
||||
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
class DownloadCompat {
|
||||
companion object {
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
fun loadMediaCompat(downloadedType: DownloadedType): Media? {
|
||||
val type = when (downloadedType.type) {
|
||||
MediaType.MANGA -> "Manga"
|
||||
MediaType.ANIME -> "Anime"
|
||||
else -> "Novel"
|
||||
}
|
||||
val directory = File(
|
||||
currContext()?.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"Dantotsu/$type/${downloadedType.titleName}"
|
||||
)
|
||||
//load media.json and convert to media class with gson
|
||||
return try {
|
||||
val gson = GsonBuilder()
|
||||
.registerTypeAdapter(SChapter::class.java, InstanceCreator<SChapter> {
|
||||
SChapterImpl() // Provide an instance of SChapterImpl
|
||||
})
|
||||
.registerTypeAdapter(SAnime::class.java, InstanceCreator<SAnime> {
|
||||
SAnimeImpl() // Provide an instance of SAnimeImpl
|
||||
})
|
||||
.registerTypeAdapter(SEpisode::class.java, InstanceCreator<SEpisode> {
|
||||
SEpisodeImpl() // Provide an instance of SEpisodeImpl
|
||||
})
|
||||
.create()
|
||||
val media = File(directory, "media.json")
|
||||
val mediaJson = media.readText()
|
||||
gson.fromJson(mediaJson, Media::class.java)
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error loading media.json: ${e.message}")
|
||||
Logger.log(e)
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
fun loadOfflineAnimeModelCompat(downloadedType: DownloadedType): OfflineAnimeModel {
|
||||
val type = when (downloadedType.type) {
|
||||
MediaType.MANGA -> "Manga"
|
||||
MediaType.ANIME -> "Anime"
|
||||
else -> "Novel"
|
||||
}
|
||||
val directory = File(
|
||||
currContext()?.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"Dantotsu/$type/${downloadedType.titleName}"
|
||||
)
|
||||
//load media.json and convert to media class with gson
|
||||
try {
|
||||
val mediaModel = loadMediaCompat(downloadedType)!!
|
||||
val cover = File(directory, "cover.jpg")
|
||||
val coverUri: Uri? = if (cover.exists()) {
|
||||
Uri.fromFile(cover)
|
||||
} else null
|
||||
val banner = File(directory, "banner.jpg")
|
||||
val bannerUri: Uri? = if (banner.exists()) {
|
||||
Uri.fromFile(banner)
|
||||
} else null
|
||||
val title = mediaModel.mainName()
|
||||
val score = ((if (mediaModel.userScore == 0) (mediaModel.meanScore
|
||||
?: 0) else mediaModel.userScore) / 10.0).toString()
|
||||
val isOngoing =
|
||||
mediaModel.status == currActivity()!!.getString(R.string.status_releasing)
|
||||
val isUserScored = mediaModel.userScore != 0
|
||||
val watchedEpisodes = (mediaModel.userProgress ?: "~").toString()
|
||||
val totalEpisode =
|
||||
if (mediaModel.anime?.nextAiringEpisode != null) (mediaModel.anime.nextAiringEpisode.toString() + " | " + (mediaModel.anime.totalEpisodes
|
||||
?: "~").toString()) else (mediaModel.anime?.totalEpisodes ?: "~").toString()
|
||||
val chapters = " Chapters"
|
||||
val totalEpisodesList =
|
||||
if (mediaModel.anime?.nextAiringEpisode != null) (mediaModel.anime.nextAiringEpisode.toString()) else (mediaModel.anime?.totalEpisodes
|
||||
?: "~").toString()
|
||||
return OfflineAnimeModel(
|
||||
title,
|
||||
score,
|
||||
totalEpisode,
|
||||
totalEpisodesList,
|
||||
watchedEpisodes,
|
||||
type,
|
||||
chapters,
|
||||
isOngoing,
|
||||
isUserScored,
|
||||
coverUri,
|
||||
bannerUri
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error loading media.json: ${e.message}")
|
||||
Logger.log(e)
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
return OfflineAnimeModel(
|
||||
"unknown",
|
||||
"0",
|
||||
"??",
|
||||
"??",
|
||||
"??",
|
||||
"movie",
|
||||
"hmm",
|
||||
isOngoing = false,
|
||||
isUserScored = false,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
fun loadOfflineMangaModelCompat(downloadedType: DownloadedType): OfflineMangaModel {
|
||||
val type = when (downloadedType.type) {
|
||||
MediaType.MANGA -> "Manga"
|
||||
MediaType.ANIME -> "Anime"
|
||||
else -> "Novel"
|
||||
}
|
||||
val directory = File(
|
||||
currContext()?.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"Dantotsu/$type/${downloadedType.titleName}"
|
||||
)
|
||||
//load media.json and convert to media class with gson
|
||||
try {
|
||||
val mediaModel = loadMediaCompat(downloadedType)!!
|
||||
val cover = File(directory, "cover.jpg")
|
||||
val coverUri: Uri? = if (cover.exists()) {
|
||||
Uri.fromFile(cover)
|
||||
} else null
|
||||
val banner = File(directory, "banner.jpg")
|
||||
val bannerUri: Uri? = if (banner.exists()) {
|
||||
Uri.fromFile(banner)
|
||||
} else null
|
||||
val title = mediaModel.mainName()
|
||||
val score = ((if (mediaModel.userScore == 0) (mediaModel.meanScore
|
||||
?: 0) else mediaModel.userScore) / 10.0).toString()
|
||||
val isOngoing =
|
||||
mediaModel.status == currActivity()!!.getString(R.string.status_releasing)
|
||||
val isUserScored = mediaModel.userScore != 0
|
||||
val readchapter = (mediaModel.userProgress ?: "~").toString()
|
||||
val totalchapter = "${mediaModel.manga?.totalChapters ?: "??"}"
|
||||
val chapters = " Chapters"
|
||||
return OfflineMangaModel(
|
||||
title,
|
||||
score,
|
||||
totalchapter,
|
||||
readchapter,
|
||||
type,
|
||||
chapters,
|
||||
isOngoing,
|
||||
isUserScored,
|
||||
coverUri,
|
||||
bannerUri
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error loading media.json: ${e.message}")
|
||||
Logger.log(e)
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
return OfflineMangaModel(
|
||||
"unknown",
|
||||
"0",
|
||||
"??",
|
||||
"??",
|
||||
"movie",
|
||||
"hmm",
|
||||
isOngoing = false,
|
||||
isUserScored = false,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
suspend fun loadEpisodesCompat(
|
||||
animeLink: String,
|
||||
extra: Map<String, String>?,
|
||||
sAnime: SAnime
|
||||
): List<Episode> {
|
||||
|
||||
val directory = File(
|
||||
currContext()?.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"${animeLocation}/$animeLink"
|
||||
)
|
||||
//get all of the folder names and add them to the list
|
||||
val episodes = mutableListOf<Episode>()
|
||||
if (directory.exists()) {
|
||||
directory.listFiles()?.forEach {
|
||||
//put the title and episdode number in the extra data
|
||||
val extraData = mutableMapOf<String, String>()
|
||||
extraData["title"] = animeLink
|
||||
extraData["episode"] = it.name
|
||||
if (it.isDirectory) {
|
||||
val episode = Episode(
|
||||
it.name,
|
||||
"$animeLink - ${it.name}",
|
||||
it.name,
|
||||
null,
|
||||
null,
|
||||
extra = extraData,
|
||||
sEpisode = SEpisodeImpl()
|
||||
)
|
||||
episodes.add(episode)
|
||||
}
|
||||
}
|
||||
episodes.sortBy { MediaNameAdapter.findEpisodeNumber(it.number) }
|
||||
return episodes
|
||||
}
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
suspend fun loadChaptersCompat(
|
||||
mangaLink: String,
|
||||
extra: Map<String, String>?,
|
||||
sManga: SManga
|
||||
): List<MangaChapter> {
|
||||
val directory = File(
|
||||
currContext()?.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"Dantotsu/Manga/$mangaLink"
|
||||
)
|
||||
//get all of the folder names and add them to the list
|
||||
val chapters = mutableListOf<MangaChapter>()
|
||||
if (directory.exists()) {
|
||||
directory.listFiles()?.forEach {
|
||||
if (it.isDirectory) {
|
||||
val chapter = MangaChapter(
|
||||
it.name,
|
||||
"$mangaLink/${it.name}",
|
||||
it.name,
|
||||
null,
|
||||
null,
|
||||
SChapter.create()
|
||||
)
|
||||
chapters.add(chapter)
|
||||
}
|
||||
}
|
||||
chapters.sortBy { MediaNameAdapter.findChapterNumber(it.number) }
|
||||
return chapters
|
||||
}
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
suspend fun loadImagesCompat(chapterLink: String, sChapter: SChapter): List<MangaImage> {
|
||||
val directory = File(
|
||||
currContext()?.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"Dantotsu/Manga/$chapterLink"
|
||||
)
|
||||
val images = mutableListOf<MangaImage>()
|
||||
val imageNumberRegex = Regex("""(\d+)\.jpg$""")
|
||||
if (directory.exists()) {
|
||||
directory.listFiles()?.forEach {
|
||||
if (it.isFile) {
|
||||
val image = MangaImage(it.absolutePath, false, null)
|
||||
images.add(image)
|
||||
}
|
||||
}
|
||||
images.sortBy { image ->
|
||||
val matchResult = imageNumberRegex.find(image.url.url)
|
||||
matchResult?.groups?.get(1)?.value?.toIntOrNull() ?: Int.MAX_VALUE
|
||||
}
|
||||
for (image in images) {
|
||||
Logger.log("imageNumber: ${image.url.url}")
|
||||
}
|
||||
return images
|
||||
}
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
fun loadSubtitleCompat(title: String, episode: String): List<Subtitle>? {
|
||||
currContext()?.let {
|
||||
File(
|
||||
it.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"$animeLocation/$title/$episode"
|
||||
).listFiles()?.forEach {
|
||||
if (it.name.contains("subtitle")) {
|
||||
return listOf(
|
||||
Subtitle(
|
||||
"Downloaded Subtitle",
|
||||
Uri.fromFile(it).toString(),
|
||||
determineSubtitletype(it.absolutePath)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun determineSubtitletype(url: String): SubtitleType {
|
||||
return when {
|
||||
url.lowercase(Locale.ROOT).endsWith("ass") -> SubtitleType.ASS
|
||||
url.lowercase(Locale.ROOT).endsWith("vtt") -> SubtitleType.VTT
|
||||
else -> SubtitleType.SRT
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
fun removeMediaCompat(context: Context, title: String, type: MediaType) {
|
||||
val subDirectory = if (type == MediaType.MANGA) {
|
||||
"Manga"
|
||||
} else if (type == MediaType.ANIME) {
|
||||
"Anime"
|
||||
} else {
|
||||
"Novel"
|
||||
}
|
||||
val directory = File(
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"Dantotsu/$subDirectory/$title"
|
||||
)
|
||||
if (directory.exists()) {
|
||||
directory.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("external storage is deprecated, use SAF instead")
|
||||
fun removeDownloadCompat(context: Context, downloadedType: DownloadedType, toast: Boolean) {
|
||||
val directory = if (downloadedType.type == MediaType.MANGA) {
|
||||
File(
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"Dantotsu/Manga/${downloadedType.titleName}/${downloadedType.chapterName}"
|
||||
)
|
||||
} else if (downloadedType.type == MediaType.ANIME) {
|
||||
File(
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"Dantotsu/Anime/${downloadedType.titleName}/${downloadedType.chapterName}"
|
||||
)
|
||||
} else {
|
||||
File(
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"Dantotsu/Novel/${downloadedType.titleName}/${downloadedType.chapterName}"
|
||||
)
|
||||
}
|
||||
|
||||
// Check if the directory exists and delete it recursively
|
||||
if (directory.exists()) {
|
||||
val deleted = directory.deleteRecursively()
|
||||
if (toast) {
|
||||
if (deleted) {
|
||||
Toast.makeText(context, "Successfully deleted", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
Toast.makeText(context, "Failed to delete directory", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val animeLocation = "Dantotsu/Anime"
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package ani.dantotsu.download
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import androidx.documentfile.provider.DocumentFile
|
||||
import ani.dantotsu.download.DownloadCompat.Companion.removeDownloadCompat
|
||||
import ani.dantotsu.download.DownloadCompat.Companion.removeMediaCompat
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaType
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
@@ -60,7 +58,6 @@ class DownloadsManager(private val context: Context) {
|
||||
toast: Boolean = true,
|
||||
onFinished: () -> Unit
|
||||
) {
|
||||
removeDownloadCompat(context, downloadedType, toast)
|
||||
downloadsList.remove(downloadedType)
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
removeDirectory(downloadedType, toast)
|
||||
@@ -72,7 +69,6 @@ class DownloadsManager(private val context: Context) {
|
||||
}
|
||||
|
||||
fun removeMedia(title: String, type: MediaType) {
|
||||
removeMediaCompat(context, title, type)
|
||||
val baseDirectory = getBaseDirectory(context, type)
|
||||
val directory = baseDirectory?.findFolder(title)
|
||||
if (directory?.exists() == true) {
|
||||
@@ -88,15 +84,15 @@ class DownloadsManager(private val context: Context) {
|
||||
}
|
||||
when (type) {
|
||||
MediaType.MANGA -> {
|
||||
downloadsList.removeAll { it.titleName == title && it.type == MediaType.MANGA }
|
||||
downloadsList.removeAll { it.title == title && it.type == MediaType.MANGA }
|
||||
}
|
||||
|
||||
MediaType.ANIME -> {
|
||||
downloadsList.removeAll { it.titleName == title && it.type == MediaType.ANIME }
|
||||
downloadsList.removeAll { it.title == title && it.type == MediaType.ANIME }
|
||||
}
|
||||
|
||||
MediaType.NOVEL -> {
|
||||
downloadsList.removeAll { it.titleName == title && it.type == MediaType.NOVEL }
|
||||
downloadsList.removeAll { it.title == title && it.type == MediaType.NOVEL }
|
||||
}
|
||||
}
|
||||
saveDownloads()
|
||||
@@ -119,7 +115,7 @@ class DownloadsManager(private val context: Context) {
|
||||
if (directory?.exists() == true && directory.isDirectory) {
|
||||
val files = directory.listFiles()
|
||||
for (file in files) {
|
||||
if (!downloadsSubLists.any { it.titleName == file.name }) {
|
||||
if (!downloadsSubLists.any { it.title == file.name }) {
|
||||
file.deleteRecursively(context, false)
|
||||
}
|
||||
}
|
||||
@@ -128,8 +124,8 @@ class DownloadsManager(private val context: Context) {
|
||||
val iterator = downloadsList.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val download = iterator.next()
|
||||
val downloadDir = directory?.findFolder(download.titleName)
|
||||
if ((downloadDir?.exists() == false && download.type == type) || download.titleName.isBlank()) {
|
||||
val downloadDir = directory?.findFolder(download.title)
|
||||
if ((downloadDir?.exists() == false && download.type == type) || download.title.isBlank()) {
|
||||
iterator.remove()
|
||||
}
|
||||
}
|
||||
@@ -141,18 +137,13 @@ class DownloadsManager(private val context: Context) {
|
||||
newUri: Uri,
|
||||
finished: (Boolean, String) -> Unit
|
||||
) {
|
||||
if (oldUri == newUri) {
|
||||
Logger.log("Source and destination are the same")
|
||||
finished(false, "Source and destination are the same")
|
||||
return
|
||||
}
|
||||
if (oldUri == Uri.EMPTY) {
|
||||
Logger.log("Old Uri is empty")
|
||||
finished(true, "Old Uri is empty")
|
||||
return
|
||||
}
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
try {
|
||||
try {
|
||||
if (oldUri == newUri) {
|
||||
finished(false, "Source and destination are the same")
|
||||
return
|
||||
}
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
|
||||
val oldBase =
|
||||
DocumentFile.fromTreeUri(context, oldUri) ?: throw Exception("Old base is null")
|
||||
val newBase =
|
||||
@@ -204,17 +195,13 @@ class DownloadsManager(private val context: Context) {
|
||||
finished(true, "Successfully moved downloads")
|
||||
super.onCompleted(result)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} catch (e: Exception) {
|
||||
snackString("Error: ${e.message}")
|
||||
Logger.log("Failed to move downloads: ${e.message}")
|
||||
Logger.log(e)
|
||||
Logger.log("oldUri: $oldUri, newUri: $newUri")
|
||||
finished(false, "Failed to move downloads: ${e.message}")
|
||||
return@launch
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
snackString("Error: ${e.message}")
|
||||
finished(false, "Failed to move downloads: ${e.message}")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,17 +211,16 @@ class DownloadsManager(private val context: Context) {
|
||||
|
||||
fun queryDownload(title: String, chapter: String, type: MediaType? = null): Boolean {
|
||||
return if (type == null) {
|
||||
downloadsList.any { it.titleName == title && it.chapterName == chapter }
|
||||
downloadsList.any { it.title == title && it.chapter == chapter }
|
||||
} else {
|
||||
downloadsList.any { it.titleName == title && it.chapterName == chapter && it.type == type }
|
||||
downloadsList.any { it.title == title && it.chapter == chapter && it.type == type }
|
||||
}
|
||||
}
|
||||
|
||||
private fun removeDirectory(downloadedType: DownloadedType, toast: Boolean) {
|
||||
val baseDirectory = getBaseDirectory(context, downloadedType.type)
|
||||
val directory =
|
||||
baseDirectory?.findFolder(downloadedType.titleName)
|
||||
?.findFolder(downloadedType.chapterName)
|
||||
baseDirectory?.findFolder(downloadedType.title)?.findFolder(downloadedType.chapter)
|
||||
downloadsList.remove(downloadedType)
|
||||
// Check if the directory exists and delete it recursively
|
||||
if (directory?.exists() == true) {
|
||||
@@ -378,21 +364,15 @@ class DownloadsManager(private val context: Context) {
|
||||
}
|
||||
|
||||
private const val RESERVED_CHARS = "|\\?*<\":>+[]/'"
|
||||
fun String?.findValidName(): String {
|
||||
return this?.replace("/","_")?.filterNot { RESERVED_CHARS.contains(it) } ?: ""
|
||||
private fun String?.findValidName(): String {
|
||||
return this?.filterNot { RESERVED_CHARS.contains(it) } ?: ""
|
||||
}
|
||||
|
||||
data class DownloadedType(
|
||||
private val pTitle: String?,
|
||||
private val pChapter: String?,
|
||||
val type: MediaType,
|
||||
@Deprecated("use pTitle instead")
|
||||
private val title: String? = null,
|
||||
@Deprecated("use pChapter instead")
|
||||
private val chapter: String? = null
|
||||
val pTitle: String, val pChapter: String, val type: MediaType
|
||||
) : Serializable {
|
||||
val titleName: String
|
||||
get() = title ?: pTitle.findValidName()
|
||||
val chapterName: String
|
||||
get() = chapter ?: pChapter.findValidName()
|
||||
val title: String
|
||||
get() = pTitle.findValidName()
|
||||
val chapter: String
|
||||
get() = pChapter.findValidName()
|
||||
}
|
||||
|
||||
@@ -26,10 +26,11 @@ import ani.dantotsu.download.DownloadedType
|
||||
import ani.dantotsu.download.DownloadsManager
|
||||
import ani.dantotsu.download.DownloadsManager.Companion.getSubDirectory
|
||||
import ani.dantotsu.download.anime.AnimeDownloaderService.AnimeDownloadTask.Companion.getTaskName
|
||||
import ani.dantotsu.download.findValidName
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaType
|
||||
import ani.dantotsu.media.SubtitleDownloader
|
||||
import ani.dantotsu.media.anime.AnimeWatchFragment
|
||||
import ani.dantotsu.parsers.Subtitle
|
||||
import ani.dantotsu.parsers.Video
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.snackString
|
||||
@@ -225,43 +226,40 @@ class AnimeDownloaderService : Service() {
|
||||
task.episode
|
||||
) ?: throw Exception("Failed to create output directory")
|
||||
|
||||
val extension = ffExtension!!.getFileExtension()
|
||||
outputDir.findFile("${task.getTaskName().findValidName()}.${extension.first}")?.delete()
|
||||
|
||||
val outputFile =
|
||||
outputDir.createFile(extension.second, "${task.getTaskName()}.${extension.first}")
|
||||
?: throw Exception("Failed to create output file")
|
||||
outputDir.findFile("${task.getTaskName()}.mp4")?.delete()
|
||||
val outputFile = outputDir.createFile("video/mp4", "${task.getTaskName()}.mp4")
|
||||
?: throw Exception("Failed to create output file")
|
||||
|
||||
var percent = 0
|
||||
var totalLength = 0.0
|
||||
val path = ffExtension.setDownloadPath(
|
||||
val path = ffExtension!!.setDownloadPath(
|
||||
this@AnimeDownloaderService,
|
||||
outputFile.uri
|
||||
)
|
||||
if (!task.video.file.headers.containsKey("User-Agent")
|
||||
&& !task.video.file.headers.containsKey("user-agent")
|
||||
) {
|
||||
val newHeaders = task.video.file.headers.toMutableMap()
|
||||
newHeaders["User-Agent"] = defaultHeaders["User-Agent"]!!
|
||||
task.video.file.headers = newHeaders
|
||||
val headersStringBuilder = StringBuilder()
|
||||
task.video.file.headers.forEach {
|
||||
headersStringBuilder.append("\"${it.key}: ${it.value}\"\'\r\n\'")
|
||||
}
|
||||
|
||||
if (!task.video.file.headers.containsKey("User-Agent")) { //headers should never be empty now
|
||||
headersStringBuilder.append("\"").append("User-Agent: ")
|
||||
.append(defaultHeaders["User-Agent"]).append("\"\'\r\n\'")
|
||||
}
|
||||
val probeRequest =
|
||||
"-headers $headersStringBuilder -i ${task.video.file.url} -show_entries format=duration -v quiet -of csv=\"p=0\""
|
||||
ffExtension.executeFFProbe(
|
||||
task.video.file.url,
|
||||
task.video.file.headers
|
||||
probeRequest
|
||||
) {
|
||||
if (it.toDoubleOrNull() != null) {
|
||||
totalLength = it.toDouble()
|
||||
}
|
||||
}
|
||||
|
||||
val headers = headersStringBuilder.toString()
|
||||
var request = "-headers $headers "
|
||||
request += "-i ${task.video.file.url} -c copy -bsf:a aac_adtstoasc -tls_verify 0 $path -v trace"
|
||||
Logger.log("Request: $request")
|
||||
val ffTask =
|
||||
ffExtension.executeFFMpeg(
|
||||
task.video.file.url,
|
||||
path,
|
||||
task.video.file.headers,
|
||||
task.subtitle,
|
||||
task.audio,
|
||||
) {
|
||||
ffExtension.executeFFMpeg(request) {
|
||||
// CALLED WHEN SESSION GENERATES STATISTICS
|
||||
val timeInMilliseconds = it
|
||||
if (timeInMilliseconds > 0 && totalLength > 0) {
|
||||
@@ -274,6 +272,17 @@ class AnimeDownloaderService : Service() {
|
||||
ffTask
|
||||
|
||||
saveMediaInfo(task)
|
||||
task.subtitle?.let {
|
||||
SubtitleDownloader.downloadSubtitle(
|
||||
this@AnimeDownloaderService,
|
||||
it.file.url,
|
||||
DownloadedType(
|
||||
task.title,
|
||||
task.episode,
|
||||
MediaType.ANIME,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// periodically check if the download is complete
|
||||
while (ffExtension.getState(ffTask) != "COMPLETED") {
|
||||
@@ -341,9 +350,8 @@ class AnimeDownloaderService : Service() {
|
||||
DownloadedType(
|
||||
task.title,
|
||||
task.episode,
|
||||
MediaType.ANIME
|
||||
),
|
||||
false
|
||||
MediaType.ANIME,
|
||||
)
|
||||
) {}
|
||||
Injekt.get<CrashlyticsInterface>().logException(
|
||||
Exception(
|
||||
@@ -548,8 +556,7 @@ class AnimeDownloaderService : Service() {
|
||||
val title: String,
|
||||
val episode: String,
|
||||
val video: Video,
|
||||
val subtitle: List<Pair<String, String>> = emptyList(),
|
||||
val audio: List<Pair<String, String>> = emptyList(),
|
||||
val subtitle: Subtitle? = null,
|
||||
val sourceMedia: Media? = null,
|
||||
val episodeImage: String? = null,
|
||||
val retries: Int = 2,
|
||||
|
||||
@@ -58,8 +58,7 @@ class OfflineAnimeAdapter(
|
||||
if (style == 0) {
|
||||
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
|
||||
val episodes = view.findViewById<TextView>(R.id.itemTotal)
|
||||
val text = " ${context.getString(R.string.episodes)}"
|
||||
episodes.text = text
|
||||
episodes.text = context.getString(R.string.episodes)
|
||||
bannerView.setImageURI(item.banner ?: item.image)
|
||||
totalEpisodes.text = item.totalEpisodeList
|
||||
} else if (style == 1) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -30,13 +31,9 @@ import ani.dantotsu.bottomBar
|
||||
import ani.dantotsu.connections.crashlytics.CrashlyticsInterface
|
||||
import ani.dantotsu.currActivity
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.download.DownloadCompat.Companion.loadMediaCompat
|
||||
import ani.dantotsu.download.DownloadCompat.Companion.loadOfflineAnimeModelCompat
|
||||
import ani.dantotsu.download.DownloadedType
|
||||
import ani.dantotsu.download.DownloadsManager
|
||||
import ani.dantotsu.download.DownloadsManager.Companion.compareName
|
||||
import ani.dantotsu.download.findValidName
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaDetailsActivity
|
||||
@@ -91,7 +88,9 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||
textInputLayout.boxBackgroundColor = semiTransparentColor
|
||||
val materialCardView = view.findViewById<MaterialCardView>(R.id.offlineMangaAvatarContainer)
|
||||
materialCardView.setCardBackgroundColor(semiTransparentColor)
|
||||
val color = requireContext().getThemeColor(android.R.attr.windowBackground)
|
||||
val typedValue = TypedValue()
|
||||
requireContext().theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
|
||||
val color = typedValue.data
|
||||
|
||||
val animeUserAvatar = view.findViewById<ShapeableImageView>(R.id.offlineMangaUserAvatar)
|
||||
animeUserAvatar.setSafeOnClickListener {
|
||||
@@ -176,7 +175,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||
// Get the OfflineAnimeModel that was clicked
|
||||
val item = adapter.getItem(position) as OfflineAnimeModel
|
||||
val media =
|
||||
downloadManager.animeDownloadedTypes.firstOrNull { it.titleName.compareName(item.title) }
|
||||
downloadManager.animeDownloadedTypes.firstOrNull { it.title.compareName(item.title) }
|
||||
media?.let {
|
||||
lifecycleScope.launch {
|
||||
val mediaModel = getMedia(it)
|
||||
@@ -288,13 +287,12 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||
}
|
||||
downloadsJob = Job()
|
||||
CoroutineScope(Dispatchers.IO + downloadsJob).launch {
|
||||
val animeTitles = downloadManager.animeDownloadedTypes.map { it.titleName.findValidName() }.distinct()
|
||||
val animeTitles = downloadManager.animeDownloadedTypes.map { it.title }.distinct()
|
||||
val newAnimeDownloads = mutableListOf<OfflineAnimeModel>()
|
||||
for (title in animeTitles) {
|
||||
val tDownloads = downloadManager.animeDownloadedTypes.filter { it.titleName.findValidName() == title }
|
||||
val download = tDownloads.firstOrNull() ?: continue
|
||||
val tDownloads = downloadManager.animeDownloadedTypes.filter { it.title == title }
|
||||
val download = tDownloads.first()
|
||||
val offlineAnimeModel = loadOfflineAnimeModel(download)
|
||||
if (offlineAnimeModel.title == "unknown") offlineAnimeModel.title = title
|
||||
newAnimeDownloads += offlineAnimeModel
|
||||
}
|
||||
downloads = newAnimeDownloads
|
||||
@@ -315,7 +313,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||
return try {
|
||||
val directory = DownloadsManager.getSubDirectory(
|
||||
context ?: currContext()!!, downloadedType.type,
|
||||
false, downloadedType.titleName
|
||||
false, downloadedType.title
|
||||
)
|
||||
val gson = GsonBuilder()
|
||||
.registerTypeAdapter(SChapter::class.java, InstanceCreator<SChapter> {
|
||||
@@ -329,7 +327,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||
})
|
||||
.create()
|
||||
val media = directory?.findFile("media.json")
|
||||
?: return loadMediaCompat(downloadedType)
|
||||
?: return null
|
||||
val mediaJson =
|
||||
media.openInputStream(context ?: currContext()!!)?.bufferedReader().use {
|
||||
it?.readText()
|
||||
@@ -354,7 +352,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||
try {
|
||||
val directory = DownloadsManager.getSubDirectory(
|
||||
context ?: currContext()!!, downloadedType.type,
|
||||
false, downloadedType.titleName
|
||||
false, downloadedType.title
|
||||
)
|
||||
val mediaModel = getMedia(downloadedType)!!
|
||||
val cover = directory?.findFile("cover.jpg")
|
||||
@@ -365,7 +363,6 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||
val bannerUri: Uri? = if (banner?.exists() == true) {
|
||||
banner.uri
|
||||
} else null
|
||||
if (coverUri == null && bannerUri == null) throw Exception("No cover or banner found, probably compat")
|
||||
val title = mediaModel.mainName()
|
||||
val score = ((if (mediaModel.userScore == 0) (mediaModel.meanScore
|
||||
?: 0) else mediaModel.userScore) / 10.0).toString()
|
||||
@@ -394,26 +391,22 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||
bannerUri
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
return try {
|
||||
loadOfflineAnimeModelCompat(downloadedType)
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error loading media.json: ${e.message}")
|
||||
Logger.log(e)
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
OfflineAnimeModel(
|
||||
"unknown",
|
||||
"0",
|
||||
"??",
|
||||
"??",
|
||||
"??",
|
||||
"movie",
|
||||
"hmm",
|
||||
isOngoing = false,
|
||||
isUserScored = false,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
Logger.log("Error loading media.json: ${e.message}")
|
||||
Logger.log(e)
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
return OfflineAnimeModel(
|
||||
"unknown",
|
||||
"0",
|
||||
"??",
|
||||
"??",
|
||||
"??",
|
||||
"movie",
|
||||
"hmm",
|
||||
isOngoing = false,
|
||||
isUserScored = false,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package ani.dantotsu.download.anime
|
||||
import android.net.Uri
|
||||
|
||||
data class OfflineAnimeModel(
|
||||
var title: String,
|
||||
val title: String,
|
||||
val score: String,
|
||||
val totalEpisode: String,
|
||||
val totalEpisodeList: String,
|
||||
|
||||
@@ -57,8 +57,7 @@ class OfflineMangaAdapter(
|
||||
if (style == 0) {
|
||||
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
|
||||
val chapters = view.findViewById<TextView>(R.id.itemTotal)
|
||||
val text = " ${context.getString(R.string.chapters)}"
|
||||
chapters.text = text
|
||||
chapters.text = context.getString(R.string.chapters)
|
||||
bannerView.setImageURI(item.banner ?: item.image)
|
||||
totalChapter.text = item.totalChapter
|
||||
} else if (style == 1) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -27,14 +28,10 @@ import ani.dantotsu.bottomBar
|
||||
import ani.dantotsu.connections.crashlytics.CrashlyticsInterface
|
||||
import ani.dantotsu.currActivity
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.download.DownloadCompat
|
||||
import ani.dantotsu.download.DownloadCompat.Companion.loadOfflineMangaModelCompat
|
||||
import ani.dantotsu.download.DownloadedType
|
||||
import ani.dantotsu.download.DownloadsManager
|
||||
import ani.dantotsu.download.DownloadsManager.Companion.compareName
|
||||
import ani.dantotsu.download.DownloadsManager.Companion.getSubDirectory
|
||||
import ani.dantotsu.download.findValidName
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaDetailsActivity
|
||||
@@ -85,7 +82,9 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||
textInputLayout.boxBackgroundColor = semiTransparentColor
|
||||
val materialCardView = view.findViewById<MaterialCardView>(R.id.offlineMangaAvatarContainer)
|
||||
materialCardView.setCardBackgroundColor(semiTransparentColor)
|
||||
val color = requireContext().getThemeColor(android.R.attr.windowBackground)
|
||||
val typedValue = TypedValue()
|
||||
requireContext().theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
|
||||
val color = typedValue.data
|
||||
|
||||
val animeUserAvatar = view.findViewById<ShapeableImageView>(R.id.offlineMangaUserAvatar)
|
||||
animeUserAvatar.setSafeOnClickListener {
|
||||
@@ -170,8 +169,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||
// Get the OfflineMangaModel that was clicked
|
||||
val item = adapter.getItem(position) as OfflineMangaModel
|
||||
val media =
|
||||
downloadManager.mangaDownloadedTypes.firstOrNull { it.titleName.compareName(item.title) }
|
||||
?: downloadManager.novelDownloadedTypes.firstOrNull { it.titleName.compareName(item.title) }
|
||||
downloadManager.mangaDownloadedTypes.firstOrNull { it.title.compareName(item.title) }
|
||||
?: downloadManager.novelDownloadedTypes.firstOrNull { it.title.compareName(item.title) }
|
||||
media?.let {
|
||||
lifecycleScope.launch {
|
||||
ContextCompat.startActivity(
|
||||
@@ -191,7 +190,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||
// Get the OfflineMangaModel that was clicked
|
||||
val item = adapter.getItem(position) as OfflineMangaModel
|
||||
val type: MediaType =
|
||||
if (downloadManager.mangaDownloadedTypes.any { it.titleName == item.title }) {
|
||||
if (downloadManager.mangaDownloadedTypes.any { it.title == item.title }) {
|
||||
MediaType.MANGA
|
||||
} else {
|
||||
MediaType.NOVEL
|
||||
@@ -279,20 +278,20 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||
downloads = listOf()
|
||||
downloadsJob = Job()
|
||||
CoroutineScope(Dispatchers.IO + downloadsJob).launch {
|
||||
val mangaTitles = downloadManager.mangaDownloadedTypes.map { it.titleName.findValidName() }.distinct()
|
||||
val mangaTitles = downloadManager.mangaDownloadedTypes.map { it.title }.distinct()
|
||||
val newMangaDownloads = mutableListOf<OfflineMangaModel>()
|
||||
for (title in mangaTitles) {
|
||||
val tDownloads = downloadManager.mangaDownloadedTypes.filter { it.titleName.findValidName() == title }
|
||||
val download = tDownloads.firstOrNull() ?: continue
|
||||
val tDownloads = downloadManager.mangaDownloadedTypes.filter { it.title == title }
|
||||
val download = tDownloads.first()
|
||||
val offlineMangaModel = loadOfflineMangaModel(download)
|
||||
newMangaDownloads += offlineMangaModel
|
||||
}
|
||||
downloads = newMangaDownloads
|
||||
val novelTitles = downloadManager.novelDownloadedTypes.map { it.titleName }.distinct()
|
||||
val novelTitles = downloadManager.novelDownloadedTypes.map { it.title }.distinct()
|
||||
val newNovelDownloads = mutableListOf<OfflineMangaModel>()
|
||||
for (title in novelTitles) {
|
||||
val tDownloads = downloadManager.novelDownloadedTypes.filter { it.titleName.findValidName() == title }
|
||||
val download = tDownloads.firstOrNull() ?: continue
|
||||
val tDownloads = downloadManager.novelDownloadedTypes.filter { it.title == title }
|
||||
val download = tDownloads.first()
|
||||
val offlineMangaModel = loadOfflineMangaModel(download)
|
||||
newNovelDownloads += offlineMangaModel
|
||||
}
|
||||
@@ -316,7 +315,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||
return try {
|
||||
val directory = getSubDirectory(
|
||||
context ?: currContext()!!, downloadedType.type,
|
||||
false, downloadedType.titleName
|
||||
false, downloadedType.title
|
||||
)
|
||||
val gson = GsonBuilder()
|
||||
.registerTypeAdapter(SChapter::class.java, InstanceCreator<SChapter> {
|
||||
@@ -324,7 +323,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||
})
|
||||
.create()
|
||||
val media = directory?.findFile("media.json")
|
||||
?: return DownloadCompat.loadMediaCompat(downloadedType)
|
||||
?: return null
|
||||
val mediaJson =
|
||||
media.openInputStream(context ?: currContext()!!)?.bufferedReader().use {
|
||||
it?.readText()
|
||||
@@ -344,7 +343,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||
try {
|
||||
val directory = getSubDirectory(
|
||||
context ?: currContext()!!, downloadedType.type,
|
||||
false, downloadedType.titleName
|
||||
false, downloadedType.title
|
||||
)
|
||||
val mediaModel = getMedia(downloadedType)!!
|
||||
val cover = directory?.findFile("cover.jpg")
|
||||
@@ -355,7 +354,6 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||
val bannerUri: Uri? = if (banner?.exists() == true) {
|
||||
banner.uri
|
||||
} else null
|
||||
if (coverUri == null && bannerUri == null) throw Exception("No cover or banner found, probably compat")
|
||||
val title = mediaModel.mainName()
|
||||
val score = ((if (mediaModel.userScore == 0) (mediaModel.meanScore
|
||||
?: 0) else mediaModel.userScore) / 10.0).toString()
|
||||
@@ -378,25 +376,21 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||
bannerUri
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
return try {
|
||||
loadOfflineMangaModelCompat(downloadedType)
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error loading media.json: ${e.message}")
|
||||
Logger.log(e)
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
return OfflineMangaModel(
|
||||
"unknown",
|
||||
"0",
|
||||
"??",
|
||||
"??",
|
||||
"movie",
|
||||
"hmm",
|
||||
isOngoing = false,
|
||||
isUserScored = false,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
Logger.log("Error loading media.json: ${e.message}")
|
||||
Logger.log(e)
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
return OfflineMangaModel(
|
||||
"unknown",
|
||||
"0",
|
||||
"??",
|
||||
"??",
|
||||
"movie",
|
||||
"hmm",
|
||||
isOngoing = false,
|
||||
isUserScored = false,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,17 +12,7 @@ import androidx.annotation.OptIn
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.database.StandaloneDatabaseProvider
|
||||
import androidx.media3.datasource.DataSource
|
||||
import androidx.media3.datasource.HttpDataSource
|
||||
import androidx.media3.datasource.cache.NoOpCacheEvictor
|
||||
import androidx.media3.datasource.cache.SimpleCache
|
||||
import androidx.media3.datasource.okhttp.OkHttpDataSource
|
||||
import androidx.media3.exoplayer.offline.Download
|
||||
import androidx.media3.exoplayer.offline.DownloadManager
|
||||
import androidx.media3.exoplayer.scheduler.Requirements
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.defaultHeaders
|
||||
import ani.dantotsu.download.DownloadedType
|
||||
import ani.dantotsu.download.DownloadsManager
|
||||
import ani.dantotsu.download.anime.AnimeDownloaderService
|
||||
@@ -32,12 +22,8 @@ import ani.dantotsu.media.MediaType
|
||||
import ani.dantotsu.parsers.Subtitle
|
||||
import ani.dantotsu.parsers.Video
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.util.Logger
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.io.File
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
object Helper {
|
||||
@@ -47,8 +33,7 @@ object Helper {
|
||||
title: String,
|
||||
episode: String,
|
||||
video: Video,
|
||||
subtitle: List<Pair<String, String>> = emptyList(),
|
||||
audio: List<Pair<String, String>> = emptyList(),
|
||||
subtitle: Subtitle? = null,
|
||||
sourceMedia: Media? = null,
|
||||
episodeImage: String? = null
|
||||
) {
|
||||
@@ -67,7 +52,6 @@ object Helper {
|
||||
episode,
|
||||
video,
|
||||
subtitle,
|
||||
audio,
|
||||
sourceMedia,
|
||||
episodeImage
|
||||
)
|
||||
@@ -120,92 +104,4 @@ object Helper {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
@UnstableApi
|
||||
@Deprecated("exoplayer download manager is no longer used")
|
||||
fun downloadManager(context: Context): DownloadManager {
|
||||
return download ?: let {
|
||||
val database = Injekt.get<StandaloneDatabaseProvider>()
|
||||
val downloadDirectory = File(getDownloadDirectory(context), DOWNLOAD_CONTENT_DIRECTORY)
|
||||
val dataSourceFactory = DataSource.Factory {
|
||||
//val dataSource: HttpDataSource = OkHttpDataSource.Factory(okHttpClient).createDataSource()
|
||||
val networkHelper = Injekt.get<NetworkHelper>()
|
||||
val okHttpClient = networkHelper.client
|
||||
val dataSource: HttpDataSource =
|
||||
OkHttpDataSource.Factory(okHttpClient).createDataSource()
|
||||
defaultHeaders.forEach {
|
||||
dataSource.setRequestProperty(it.key, it.value)
|
||||
}
|
||||
dataSource
|
||||
}
|
||||
val threadPoolSize = Runtime.getRuntime().availableProcessors()
|
||||
val executorService = Executors.newFixedThreadPool(threadPoolSize)
|
||||
val downloadManager = DownloadManager(
|
||||
context,
|
||||
database,
|
||||
getSimpleCache(context),
|
||||
dataSourceFactory,
|
||||
executorService
|
||||
).apply {
|
||||
requirements =
|
||||
Requirements(Requirements.NETWORK or Requirements.DEVICE_STORAGE_NOT_LOW)
|
||||
maxParallelDownloads = 3
|
||||
}
|
||||
downloadManager.addListener( //for testing
|
||||
object : DownloadManager.Listener {
|
||||
override fun onDownloadChanged(
|
||||
downloadManager: DownloadManager,
|
||||
download: Download,
|
||||
finalException: Exception?
|
||||
) {
|
||||
if (download.state == Download.STATE_COMPLETED) {
|
||||
Logger.log("Download Completed")
|
||||
} else if (download.state == Download.STATE_FAILED) {
|
||||
Logger.log("Download Failed")
|
||||
} else if (download.state == Download.STATE_STOPPED) {
|
||||
Logger.log("Download Stopped")
|
||||
} else if (download.state == Download.STATE_QUEUED) {
|
||||
Logger.log("Download Queued")
|
||||
} else if (download.state == Download.STATE_DOWNLOADING) {
|
||||
Logger.log("Download Downloading")
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
downloadManager
|
||||
}
|
||||
}
|
||||
@Deprecated("exoplayer download manager is no longer used")
|
||||
@OptIn(UnstableApi::class)
|
||||
fun getSimpleCache(context: Context): SimpleCache {
|
||||
return if (simpleCache == null) {
|
||||
val downloadDirectory = File(getDownloadDirectory(context), DOWNLOAD_CONTENT_DIRECTORY)
|
||||
val database = Injekt.get<StandaloneDatabaseProvider>()
|
||||
simpleCache = SimpleCache(downloadDirectory, NoOpCacheEvictor(), database)
|
||||
simpleCache!!
|
||||
} else {
|
||||
simpleCache!!
|
||||
}
|
||||
}
|
||||
@Synchronized
|
||||
@Deprecated("exoplayer download manager is no longer used")
|
||||
private fun getDownloadDirectory(context: Context): File {
|
||||
if (downloadDirectory == null) {
|
||||
downloadDirectory = context.getExternalFilesDir(null)
|
||||
if (downloadDirectory == null) {
|
||||
downloadDirectory = context.filesDir
|
||||
}
|
||||
}
|
||||
return downloadDirectory!!
|
||||
}
|
||||
@Deprecated("exoplayer download manager is no longer used")
|
||||
private var download: DownloadManager? = null
|
||||
@Deprecated("exoplayer download manager is no longer used")
|
||||
private const val DOWNLOAD_CONTENT_DIRECTORY = "Anime_Downloads"
|
||||
@Deprecated("exoplayer download manager is no longer used")
|
||||
private var simpleCache: SimpleCache? = null
|
||||
@Deprecated("exoplayer download manager is no longer used")
|
||||
private var downloadDirectory: File? = null
|
||||
}
|
||||
@@ -36,7 +36,6 @@ import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -205,22 +204,22 @@ class AnimeFragment : Fragment() {
|
||||
if (i) {
|
||||
model.getUpdated().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
animePageAdapter.updateRecent(MediaAdaptor(0, it, requireActivity()), it)
|
||||
animePageAdapter.updateRecent(MediaAdaptor(0, it, requireActivity()))
|
||||
}
|
||||
}
|
||||
model.getMovies().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
animePageAdapter.updateMovies(MediaAdaptor(0, it, requireActivity()), it)
|
||||
animePageAdapter.updateMovies(MediaAdaptor(0, it, requireActivity()))
|
||||
}
|
||||
}
|
||||
model.getTopRated().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
animePageAdapter.updateTopRated(MediaAdaptor(0, it, requireActivity()), it)
|
||||
animePageAdapter.updateTopRated(MediaAdaptor(0, it, requireActivity()))
|
||||
}
|
||||
}
|
||||
model.getMostFav().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
animePageAdapter.updateMostFav(MediaAdaptor(0, it, requireActivity()), it)
|
||||
animePageAdapter.updateMostFav(MediaAdaptor(0, it, requireActivity()))
|
||||
}
|
||||
}
|
||||
if (animePageAdapter.trendingViewPager != null) {
|
||||
@@ -269,25 +268,13 @@ class AnimeFragment : Fragment() {
|
||||
true
|
||||
}
|
||||
|
||||
var running = false
|
||||
val live = Refresh.activity.getOrPut(this.hashCode()) { MutableLiveData(false) }
|
||||
live.observe(viewLifecycleOwner) {
|
||||
if (it && !running) {
|
||||
running = true
|
||||
if (it) {
|
||||
scope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
Anilist.userid = PrefManager.getNullableVal<String>(PrefName.AnilistUserId, null)
|
||||
?.toIntOrNull()
|
||||
if (Anilist.userid == null) {
|
||||
getUserId(requireContext()) {
|
||||
load()
|
||||
}
|
||||
} else {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
getUserId(requireContext()) {
|
||||
load()
|
||||
}
|
||||
}
|
||||
getUserId(requireContext()) {
|
||||
load()
|
||||
}
|
||||
model.loaded = true
|
||||
model.loadTrending(1)
|
||||
@@ -300,7 +287,6 @@ class AnimeFragment : Fragment() {
|
||||
}
|
||||
live.postValue(false)
|
||||
_binding?.animeRefresh?.isRefreshing = false
|
||||
running = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package ani.dantotsu.home
|
||||
import android.content.Intent
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.TypedValue
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -13,7 +14,6 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@@ -24,14 +24,10 @@ import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.databinding.ItemAnimePageBinding
|
||||
import ani.dantotsu.databinding.LayoutTrendingBinding
|
||||
import ani.dantotsu.getAppString
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.media.CalendarActivity
|
||||
import ani.dantotsu.media.GenreActivity
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaAdaptor
|
||||
import ani.dantotsu.media.MediaListViewActivity
|
||||
import ani.dantotsu.media.SearchActivity
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.px
|
||||
@@ -71,7 +67,10 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||
val materialCardView =
|
||||
holder.itemView.findViewById<MaterialCardView>(R.id.userAvatarContainer)
|
||||
materialCardView.setCardBackgroundColor(semiTransparentColor)
|
||||
val color = binding.root.context.getThemeColor(android.R.attr.windowBackground)
|
||||
val typedValue = TypedValue()
|
||||
currContext()?.theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
|
||||
val color = typedValue.data
|
||||
|
||||
textInputLayout.boxBackgroundColor = (color and 0x00FFFFFF) or 0x28000000
|
||||
materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000)
|
||||
|
||||
@@ -197,16 +196,13 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
|
||||
fun updateRecent(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
fun updateRecent(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
animeUpdatedRecyclerView,
|
||||
animeUpdatedProgressBar,
|
||||
animeRecently,
|
||||
animeRecentlyMore,
|
||||
getAppString(R.string.updated),
|
||||
media
|
||||
animeRecently
|
||||
)
|
||||
animePopular.visibility = View.VISIBLE
|
||||
animePopular.startAnimation(setSlideUp())
|
||||
@@ -217,49 +213,40 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||
|
||||
}
|
||||
|
||||
fun updateMovies(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
fun updateMovies(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
animeMoviesRecyclerView,
|
||||
animeMoviesProgressBar,
|
||||
animeMovies,
|
||||
animeMoviesMore,
|
||||
getAppString(R.string.trending_movies),
|
||||
media
|
||||
animeMovies
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateTopRated(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
fun updateTopRated(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
animeTopRatedRecyclerView,
|
||||
animeTopRatedProgressBar,
|
||||
animeTopRated,
|
||||
animeTopRatedMore,
|
||||
getAppString(R.string.top_rated),
|
||||
media
|
||||
animeTopRated
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateMostFav(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
fun updateMostFav(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
animeMostFavRecyclerView,
|
||||
animeMostFavProgressBar,
|
||||
animeMostFav,
|
||||
animeMostFavMore,
|
||||
getAppString(R.string.most_favourite),
|
||||
media
|
||||
animeMostFav
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun init(adaptor: MediaAdaptor, recyclerView: RecyclerView, progress: View, title: View , more: View , string: String, media : MutableList<Media>) {
|
||||
fun init(adaptor: MediaAdaptor, recyclerView: RecyclerView, progress: View, title: View) {
|
||||
progress.visibility = View.GONE
|
||||
recyclerView.adapter = adaptor
|
||||
recyclerView.layoutManager =
|
||||
@@ -268,19 +255,9 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
MediaListViewActivity.passedMedia = media.toCollection(ArrayList())
|
||||
more.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
it.context, Intent(it.context, MediaListViewActivity::class.java)
|
||||
.putExtra("title", string),
|
||||
null
|
||||
)
|
||||
}
|
||||
recyclerView.visibility = View.VISIBLE
|
||||
title.visibility = View.VISIBLE
|
||||
more.visibility = View.VISIBLE
|
||||
title.startAnimation(setSlideUp())
|
||||
more.startAnimation(setSlideUp())
|
||||
recyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
|
||||
@@ -30,11 +30,9 @@ import ani.dantotsu.connections.anilist.AnilistHomeViewModel
|
||||
import ani.dantotsu.connections.anilist.getUserId
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.databinding.FragmentHomeBinding
|
||||
import ani.dantotsu.home.status.UserStatusAdapter
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaAdaptor
|
||||
import ani.dantotsu.media.MediaListViewActivity
|
||||
import ani.dantotsu.media.user.ListActivity
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
@@ -43,14 +41,12 @@ import ani.dantotsu.setSlideIn
|
||||
import ani.dantotsu.setSlideUp
|
||||
import ani.dantotsu.settings.SettingsDialogFragment
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefManager.asLiveBool
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.util.Logger
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
@@ -59,6 +55,7 @@ import kotlin.math.min
|
||||
class HomeFragment : Fragment() {
|
||||
private var _binding: FragmentHomeBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
@@ -77,9 +74,7 @@ class HomeFragment : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
val scope = lifecycleScope
|
||||
Logger.log("HomeFragment")
|
||||
fun load() {
|
||||
Logger.log("Loading HomeFragment")
|
||||
if (activity != null && _binding != null) lifecycleScope.launch(Dispatchers.Main) {
|
||||
binding.homeUserName.text = Anilist.username
|
||||
binding.homeUserEpisodesWatched.text = Anilist.episodesWatched.toString()
|
||||
@@ -210,16 +205,13 @@ class HomeFragment : Fragment() {
|
||||
recyclerView: RecyclerView,
|
||||
progress: View,
|
||||
empty: View,
|
||||
title: View,
|
||||
more: View,
|
||||
string: String
|
||||
title: View
|
||||
) {
|
||||
container.visibility = View.VISIBLE
|
||||
progress.visibility = View.VISIBLE
|
||||
recyclerView.visibility = View.GONE
|
||||
empty.visibility = View.GONE
|
||||
title.visibility = View.INVISIBLE
|
||||
more.visibility = View.INVISIBLE
|
||||
|
||||
mode.observe(viewLifecycleOwner) {
|
||||
recyclerView.visibility = View.GONE
|
||||
@@ -232,14 +224,6 @@ class HomeFragment : Fragment() {
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
more.setOnClickListener { i ->
|
||||
MediaListViewActivity.passedMedia = it
|
||||
ContextCompat.startActivity(
|
||||
i.context, Intent(i.context, MediaListViewActivity::class.java)
|
||||
.putExtra("title", string),
|
||||
null
|
||||
)
|
||||
}
|
||||
recyclerView.visibility = View.VISIBLE
|
||||
recyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
@@ -247,9 +231,7 @@ class HomeFragment : Fragment() {
|
||||
} else {
|
||||
empty.visibility = View.VISIBLE
|
||||
}
|
||||
more.visibility = View.VISIBLE
|
||||
title.visibility = View.VISIBLE
|
||||
more.startAnimation(setSlideUp())
|
||||
title.startAnimation(setSlideUp())
|
||||
progress.visibility = View.GONE
|
||||
}
|
||||
@@ -264,9 +246,7 @@ class HomeFragment : Fragment() {
|
||||
binding.homeWatchingRecyclerView,
|
||||
binding.homeWatchingProgressBar,
|
||||
binding.homeWatchingEmpty,
|
||||
binding.homeContinueWatch,
|
||||
binding.homeContinueWatchMore,
|
||||
getString(R.string.continue_watching)
|
||||
binding.homeContinueWatch
|
||||
)
|
||||
binding.homeWatchingBrowseButton.setOnClickListener {
|
||||
bottomBar.selectTabAt(0)
|
||||
@@ -278,9 +258,7 @@ class HomeFragment : Fragment() {
|
||||
binding.homeFavAnimeRecyclerView,
|
||||
binding.homeFavAnimeProgressBar,
|
||||
binding.homeFavAnimeEmpty,
|
||||
binding.homeFavAnime,
|
||||
binding.homeFavAnimeMore,
|
||||
getString(R.string.fav_anime)
|
||||
binding.homeFavAnime
|
||||
)
|
||||
|
||||
initRecyclerView(
|
||||
@@ -289,9 +267,7 @@ class HomeFragment : Fragment() {
|
||||
binding.homePlannedAnimeRecyclerView,
|
||||
binding.homePlannedAnimeProgressBar,
|
||||
binding.homePlannedAnimeEmpty,
|
||||
binding.homePlannedAnime,
|
||||
binding.homePlannedAnimeMore,
|
||||
getString(R.string.planned_anime)
|
||||
binding.homePlannedAnime
|
||||
)
|
||||
binding.homePlannedAnimeBrowseButton.setOnClickListener {
|
||||
bottomBar.selectTabAt(0)
|
||||
@@ -303,9 +279,7 @@ class HomeFragment : Fragment() {
|
||||
binding.homeReadingRecyclerView,
|
||||
binding.homeReadingProgressBar,
|
||||
binding.homeReadingEmpty,
|
||||
binding.homeContinueRead,
|
||||
binding.homeContinueReadMore,
|
||||
getString(R.string.continue_reading)
|
||||
binding.homeContinueRead
|
||||
)
|
||||
binding.homeReadingBrowseButton.setOnClickListener {
|
||||
bottomBar.selectTabAt(2)
|
||||
@@ -317,9 +291,7 @@ class HomeFragment : Fragment() {
|
||||
binding.homeFavMangaRecyclerView,
|
||||
binding.homeFavMangaProgressBar,
|
||||
binding.homeFavMangaEmpty,
|
||||
binding.homeFavManga,
|
||||
binding.homeFavMangaMore,
|
||||
getString(R.string.fav_manga)
|
||||
binding.homeFavManga
|
||||
)
|
||||
|
||||
initRecyclerView(
|
||||
@@ -328,9 +300,7 @@ class HomeFragment : Fragment() {
|
||||
binding.homePlannedMangaRecyclerView,
|
||||
binding.homePlannedMangaProgressBar,
|
||||
binding.homePlannedMangaEmpty,
|
||||
binding.homePlannedManga,
|
||||
binding.homePlannedMangaMore,
|
||||
getString(R.string.planned_manga)
|
||||
binding.homePlannedManga
|
||||
)
|
||||
binding.homePlannedMangaBrowseButton.setOnClickListener {
|
||||
bottomBar.selectTabAt(2)
|
||||
@@ -342,87 +312,12 @@ class HomeFragment : Fragment() {
|
||||
binding.homeRecommendedRecyclerView,
|
||||
binding.homeRecommendedProgressBar,
|
||||
binding.homeRecommendedEmpty,
|
||||
binding.homeRecommended,
|
||||
binding.homeRecommendedMore,
|
||||
getString(R.string.recommended)
|
||||
binding.homeRecommended
|
||||
)
|
||||
binding.homeUserStatusContainer.visibility = View.VISIBLE
|
||||
binding.homeUserStatusProgressBar.visibility = View.VISIBLE
|
||||
binding.homeUserStatusRecyclerView.visibility = View.GONE
|
||||
model.getUserStatus().observe(viewLifecycleOwner) {
|
||||
binding.homeUserStatusRecyclerView.visibility = View.GONE
|
||||
if (it != null) {
|
||||
if (it.isNotEmpty()) {
|
||||
PrefManager.getLiveVal(PrefName.RefreshStatus, false).apply {
|
||||
asLiveBool()
|
||||
observe(viewLifecycleOwner) { _ ->
|
||||
binding.homeUserStatusRecyclerView.adapter = UserStatusAdapter(it)
|
||||
}
|
||||
}
|
||||
binding.homeUserStatusRecyclerView.layoutManager = LinearLayoutManager(
|
||||
requireContext(),
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
binding.homeUserStatusRecyclerView.visibility = View.VISIBLE
|
||||
binding.homeUserStatusRecyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
|
||||
} else {
|
||||
binding.homeUserStatusContainer.visibility = View.GONE
|
||||
}
|
||||
binding.homeUserStatusProgressBar.visibility = View.GONE
|
||||
}
|
||||
|
||||
}
|
||||
binding.homeHiddenItemsContainer.visibility = View.GONE
|
||||
model.getHidden().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
if (it.isNotEmpty()) {
|
||||
binding.homeHiddenItemsRecyclerView.adapter =
|
||||
MediaAdaptor(0, it, requireActivity())
|
||||
binding.homeHiddenItemsRecyclerView.layoutManager = LinearLayoutManager(
|
||||
requireContext(),
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
binding.homeContinueWatch.setOnLongClickListener {
|
||||
binding.homeHiddenItemsContainer.visibility = View.VISIBLE
|
||||
binding.homeHiddenItemsRecyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
true
|
||||
}
|
||||
binding.homeHiddenItemsMore.setSafeOnClickListener { _ ->
|
||||
MediaListViewActivity.passedMedia = it
|
||||
ContextCompat.startActivity(
|
||||
requireActivity(),
|
||||
Intent(requireActivity(), MediaListViewActivity::class.java)
|
||||
.putExtra("title", getString(R.string.hidden)),
|
||||
null
|
||||
)
|
||||
}
|
||||
binding.homeHiddenItemsTitle.setOnLongClickListener {
|
||||
binding.homeHiddenItemsContainer.visibility = View.GONE
|
||||
true
|
||||
}
|
||||
} else {
|
||||
binding.homeContinueWatch.setOnLongClickListener {
|
||||
snackString(getString(R.string.no_hidden_items))
|
||||
true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
binding.homeContinueWatch.setOnLongClickListener {
|
||||
snackString(getString(R.string.no_hidden_items))
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.homeUserAvatarContainer.startAnimation(setSlideUp())
|
||||
|
||||
model.empty.observe(viewLifecycleOwner)
|
||||
{
|
||||
model.empty.observe(viewLifecycleOwner) {
|
||||
binding.homeDantotsuContainer.visibility = if (it == true) View.VISIBLE else View.GONE
|
||||
(binding.homeDantotsuIcon.drawable as Animatable).start()
|
||||
binding.homeDantotsuContainer.startAnimation(setSlideUp())
|
||||
@@ -439,8 +334,7 @@ class HomeFragment : Fragment() {
|
||||
"MangaContinue",
|
||||
"MangaFav",
|
||||
"MangaPlanned",
|
||||
"Recommendation",
|
||||
"UserStatus",
|
||||
"Recommendation"
|
||||
)
|
||||
|
||||
val containers = arrayOf(
|
||||
@@ -450,41 +344,26 @@ class HomeFragment : Fragment() {
|
||||
binding.homeContinueReadingContainer,
|
||||
binding.homeFavMangaContainer,
|
||||
binding.homePlannedMangaContainer,
|
||||
binding.homeRecommendedContainer,
|
||||
binding.homeUserStatusContainer,
|
||||
binding.homeRecommendedContainer
|
||||
)
|
||||
|
||||
var running = false
|
||||
val live = Refresh.activity.getOrPut(1) { MutableLiveData(true) }
|
||||
live.observe(viewLifecycleOwner)
|
||||
{
|
||||
if (!running && it) {
|
||||
running = true
|
||||
val live = Refresh.activity.getOrPut(1) { MutableLiveData(false) }
|
||||
live.observe(viewLifecycleOwner) {
|
||||
if (it) {
|
||||
scope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
//Get userData First
|
||||
Anilist.userid =
|
||||
PrefManager.getNullableVal<String>(PrefName.AnilistUserId, null)
|
||||
?.toIntOrNull()
|
||||
if (Anilist.userid == null) {
|
||||
getUserId(requireContext()) {
|
||||
load()
|
||||
}
|
||||
} else {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
getUserId(requireContext()) {
|
||||
load()
|
||||
}
|
||||
}
|
||||
getUserId(requireContext()) {
|
||||
load()
|
||||
}
|
||||
model.loaded = true
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
model.setListImages()
|
||||
}
|
||||
model.setListImages()
|
||||
var empty = true
|
||||
val homeLayoutShow: List<Boolean> =
|
||||
PrefManager.getVal(PrefName.HomeLayout)
|
||||
model.initHomePage()
|
||||
PrefManager.getVal(PrefName.HomeLayoutShow)
|
||||
runBlocking {
|
||||
model.initHomePage()
|
||||
}
|
||||
(array.indices).forEach { i ->
|
||||
if (homeLayoutShow.elementAt(i)) {
|
||||
empty = false
|
||||
@@ -496,11 +375,8 @@ class HomeFragment : Fragment() {
|
||||
}
|
||||
live.postValue(false)
|
||||
_binding?.homeRefresh?.isRefreshing = false
|
||||
running = false
|
||||
}
|
||||
binding.homeHiddenItemsContainer.visibility = View.GONE
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -163,12 +162,12 @@ class MangaFragment : Fragment() {
|
||||
if (i == true) {
|
||||
model.getPopularNovel().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
mangaPageAdapter.updateNovel(MediaAdaptor(0, it, requireActivity()), it)
|
||||
mangaPageAdapter.updateNovel(MediaAdaptor(0, it, requireActivity()))
|
||||
}
|
||||
}
|
||||
model.getPopularManga().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
mangaPageAdapter.updateTrendingManga(MediaAdaptor(0, it, requireActivity()), it)
|
||||
mangaPageAdapter.updateTrendingManga(MediaAdaptor(0, it, requireActivity()))
|
||||
}
|
||||
}
|
||||
model.getPopularManhwa().observe(viewLifecycleOwner) {
|
||||
@@ -178,18 +177,18 @@ class MangaFragment : Fragment() {
|
||||
0,
|
||||
it,
|
||||
requireActivity()
|
||||
), it
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
model.getTopRated().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
mangaPageAdapter.updateTopRated(MediaAdaptor(0, it, requireActivity()), it)
|
||||
mangaPageAdapter.updateTopRated(MediaAdaptor(0, it, requireActivity()))
|
||||
}
|
||||
}
|
||||
model.getMostFav().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
mangaPageAdapter.updateMostFav(MediaAdaptor(0, it, requireActivity()), it)
|
||||
mangaPageAdapter.updateMostFav(MediaAdaptor(0, it, requireActivity()))
|
||||
}
|
||||
}
|
||||
if (mangaPageAdapter.trendingViewPager != null) {
|
||||
@@ -254,25 +253,13 @@ class MangaFragment : Fragment() {
|
||||
mangaPageAdapter.updateAvatar()
|
||||
}
|
||||
|
||||
var running = false
|
||||
val live = Refresh.activity.getOrPut(this.hashCode()) { MutableLiveData(true) }
|
||||
val live = Refresh.activity.getOrPut(this.hashCode()) { MutableLiveData(false) }
|
||||
live.observe(viewLifecycleOwner) {
|
||||
if (!running && it) {
|
||||
running = true
|
||||
if (it) {
|
||||
scope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
Anilist.userid = PrefManager.getNullableVal<String>(PrefName.AnilistUserId, null)
|
||||
?.toIntOrNull()
|
||||
if (Anilist.userid == null) {
|
||||
getUserId(requireContext()) {
|
||||
load()
|
||||
}
|
||||
} else {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
getUserId(requireContext()) {
|
||||
load()
|
||||
}
|
||||
}
|
||||
getUserId(requireContext()) {
|
||||
load()
|
||||
}
|
||||
model.loaded = true
|
||||
model.loadTrending()
|
||||
@@ -285,7 +272,6 @@ class MangaFragment : Fragment() {
|
||||
}
|
||||
live.postValue(false)
|
||||
_binding?.mangaRefresh?.isRefreshing = false
|
||||
running = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package ani.dantotsu.home
|
||||
import android.content.Intent
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.TypedValue
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -20,15 +21,12 @@ import androidx.viewpager2.widget.ViewPager2
|
||||
import ani.dantotsu.MediaPageTransformer
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.databinding.ItemMangaPageBinding
|
||||
import ani.dantotsu.databinding.LayoutTrendingBinding
|
||||
import ani.dantotsu.getAppString
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.media.GenreActivity
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaAdaptor
|
||||
import ani.dantotsu.media.MediaListViewActivity
|
||||
import ani.dantotsu.media.SearchActivity
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.px
|
||||
@@ -68,7 +66,10 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||
val materialCardView =
|
||||
holder.itemView.findViewById<MaterialCardView>(R.id.userAvatarContainer)
|
||||
materialCardView.setCardBackgroundColor(semiTransparentColor)
|
||||
val color = binding.root.context.getThemeColor(android.R.attr.windowBackground)
|
||||
val typedValue = TypedValue()
|
||||
currContext()?.theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
|
||||
val color = typedValue.data
|
||||
|
||||
textInputLayout.boxBackgroundColor = (color and 0x00FFFFFF) or 0x28000000
|
||||
materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000)
|
||||
|
||||
@@ -181,87 +182,65 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||
|
||||
}
|
||||
|
||||
fun updateTrendingManga(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
fun updateTrendingManga(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaTrendingMangaRecyclerView,
|
||||
mangaTrendingMangaProgressBar,
|
||||
mangaTrendingManga,
|
||||
mangaTrendingMangaMore,
|
||||
getAppString(R.string.trending_manga),
|
||||
media
|
||||
mangaTrendingManga
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateTrendingManhwa(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
fun updateTrendingManhwa(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaTrendingManhwaRecyclerView,
|
||||
mangaTrendingManhwaProgressBar,
|
||||
mangaTrendingManhwa,
|
||||
mangaTrendingManhwaMore,
|
||||
getAppString(R.string.trending_manhwa),
|
||||
media
|
||||
mangaTrendingManhwa
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateNovel(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
fun updateNovel(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaNovelRecyclerView,
|
||||
mangaNovelProgressBar,
|
||||
mangaNovel,
|
||||
mangaNovelMore,
|
||||
getAppString(R.string.trending_novel),
|
||||
media
|
||||
mangaNovel
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun updateTopRated(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
fun updateTopRated(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaTopRatedRecyclerView,
|
||||
mangaTopRatedProgressBar,
|
||||
mangaTopRated,
|
||||
mangaTopRatedMore,
|
||||
getAppString(R.string.top_rated),
|
||||
media
|
||||
mangaTopRated
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateMostFav(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
fun updateMostFav(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaMostFavRecyclerView,
|
||||
mangaMostFavProgressBar,
|
||||
mangaMostFav,
|
||||
mangaMostFavMore,
|
||||
getAppString(R.string.most_favourite),
|
||||
media
|
||||
mangaMostFav
|
||||
)
|
||||
mangaPopular.visibility = View.VISIBLE
|
||||
mangaPopular.startAnimation(setSlideUp())
|
||||
}
|
||||
}
|
||||
|
||||
fun init(
|
||||
adaptor: MediaAdaptor,
|
||||
recyclerView: RecyclerView,
|
||||
progress: View,
|
||||
title: View ,
|
||||
more: View ,
|
||||
string: String,
|
||||
media : MutableList<Media>
|
||||
) {
|
||||
fun init(adaptor: MediaAdaptor, recyclerView: RecyclerView, progress: View, title: View) {
|
||||
progress.visibility = View.GONE
|
||||
recyclerView.adapter = adaptor
|
||||
recyclerView.layoutManager =
|
||||
@@ -270,19 +249,9 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
more.setOnClickListener {
|
||||
MediaListViewActivity.passedMedia = media.toCollection(ArrayList())
|
||||
ContextCompat.startActivity(
|
||||
it.context, Intent(it.context, MediaListViewActivity::class.java)
|
||||
.putExtra("title", string),
|
||||
null
|
||||
)
|
||||
}
|
||||
recyclerView.visibility = View.VISIBLE
|
||||
title.visibility = View.VISIBLE
|
||||
more.visibility = View.VISIBLE
|
||||
title.startAnimation(setSlideUp())
|
||||
more.startAnimation(setSlideUp())
|
||||
recyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
package ani.dantotsu.home.status
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Path
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import ani.dantotsu.getThemeColor
|
||||
|
||||
class CircleView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
|
||||
private var parts: Int = 3
|
||||
private var gapAngle: Float = 12f
|
||||
private val path = Path()
|
||||
private var isUser = false
|
||||
private var booleanList = listOf<Boolean>()
|
||||
private val paint: Paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
style = Paint.Style.STROKE
|
||||
strokeWidth = 6f
|
||||
strokeCap = Paint.Cap.ROUND
|
||||
}
|
||||
|
||||
@SuppressLint("DrawAllocation")
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
val centerX = width / 2f
|
||||
val centerY = height / 2f
|
||||
val radius = centerX.coerceAtMost(centerY) - paint.strokeWidth / 2
|
||||
|
||||
val totalGapAngle = gapAngle * (parts)
|
||||
val totalAngle = 360f - totalGapAngle
|
||||
|
||||
|
||||
val primaryColor = context.getThemeColor(com.google.android.material.R.attr.colorPrimary)
|
||||
val secondColor = context.getThemeColor(com.google.android.material.R.attr.colorOnPrimary)
|
||||
|
||||
fun setColor(int: Int) {
|
||||
paint.color = if (int < booleanList.size && booleanList[int]) {
|
||||
Color.GRAY
|
||||
} else {
|
||||
if (isUser) secondColor else primaryColor
|
||||
}
|
||||
canvas.drawPath(path, paint)
|
||||
}
|
||||
|
||||
if (parts == 1) {
|
||||
path.addArc(
|
||||
centerX - radius,
|
||||
centerY - radius,
|
||||
centerX + radius,
|
||||
centerY + radius,
|
||||
0f,
|
||||
360f
|
||||
)
|
||||
setColor(0)
|
||||
} else {
|
||||
val effectiveAngle = totalAngle / parts
|
||||
for (i in 0 until parts) {
|
||||
val startAngle = i * (effectiveAngle + gapAngle) -90f
|
||||
path.reset()
|
||||
path.addArc(
|
||||
centerX - radius,
|
||||
centerY - radius,
|
||||
centerX + radius,
|
||||
centerY + radius,
|
||||
startAngle,
|
||||
effectiveAngle
|
||||
)
|
||||
setColor(i)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setParts(parts: Int, list : List<Boolean> = mutableListOf(), isUser: Boolean) {
|
||||
this.parts = parts
|
||||
this.booleanList = list
|
||||
this.isUser = isUser
|
||||
invalidate()
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package ani.dantotsu.home.status
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import ani.dantotsu.BottomSheetDialogFragment
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.api.ActivityReply
|
||||
import ani.dantotsu.databinding.BottomSheetRecyclerBinding
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.profile.activity.ActivityReplyItem
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.util.MarkdownCreatorActivity
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class RepliesBottomDialog : BottomSheetDialogFragment() {
|
||||
private var _binding: BottomSheetRecyclerBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
private val adapter: GroupieAdapter = GroupieAdapter()
|
||||
private val replies: MutableList<ActivityReply> = mutableListOf()
|
||||
private var activityId: Int = -1
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
_binding = BottomSheetRecyclerBinding.inflate(inflater, container, false)
|
||||
return _binding?.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
binding.repliesRecyclerView.adapter = adapter
|
||||
binding.repliesRecyclerView.layoutManager = LinearLayoutManager(
|
||||
context,
|
||||
LinearLayoutManager.VERTICAL,
|
||||
false
|
||||
)
|
||||
val context = requireContext()
|
||||
binding.replyButton.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
context,
|
||||
Intent(context, MarkdownCreatorActivity::class.java)
|
||||
.putExtra("type", "replyActivity")
|
||||
.putExtra("parentId", activityId),
|
||||
null
|
||||
)
|
||||
}
|
||||
activityId = requireArguments().getInt("activityId")
|
||||
loading(true)
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val response = Anilist.query.getReplies(activityId)
|
||||
withContext(Dispatchers.Main) {
|
||||
loading(false)
|
||||
if (response != null) {
|
||||
replies.clear()
|
||||
replies.addAll(response.data.page.activityReplies)
|
||||
adapter.update(
|
||||
replies.map {
|
||||
ActivityReplyItem(
|
||||
it,
|
||||
requireActivity(),
|
||||
clickCallback = { int, _ ->
|
||||
onClick(int)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
snackString("Failed to load replies")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun onClick(int: Int) {
|
||||
ContextCompat.startActivity(
|
||||
requireContext(),
|
||||
Intent(requireContext(), ProfileActivity::class.java).putExtra("userId", int),
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
private fun loading(load: Boolean) {
|
||||
binding.repliesRefresh.isVisible = load
|
||||
binding.repliesRecyclerView.isVisible = !load
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
_binding = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(activityId: Int): RepliesBottomDialog {
|
||||
return RepliesBottomDialog().apply {
|
||||
arguments = Bundle().apply {
|
||||
putInt("activityId", activityId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package ani.dantotsu.home.status
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.api.Activity
|
||||
import ani.dantotsu.databinding.ActivityStatusBinding
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.home.status.listener.StoriesCallback
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.profile.User
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.statusBarHeight
|
||||
|
||||
class StatusActivity : AppCompatActivity(), StoriesCallback {
|
||||
private lateinit var activity: ArrayList<User>
|
||||
private lateinit var binding: ActivityStatusBinding
|
||||
private var position: Int = -1
|
||||
private lateinit var slideInLeft: Animation
|
||||
private lateinit var slideOutRight: Animation
|
||||
private lateinit var slideOutLeft: Animation
|
||||
private lateinit var slideInRight: Animation
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
ThemeManager(this).applyTheme()
|
||||
initActivity(this)
|
||||
binding = ActivityStatusBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
activity = user
|
||||
position = intent.getIntExtra("position", -1)
|
||||
binding.root.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin = statusBarHeight
|
||||
bottomMargin = navBarHeight
|
||||
}
|
||||
slideInLeft = AnimationUtils.loadAnimation(this, R.anim.slide_in_left)
|
||||
slideOutRight = AnimationUtils.loadAnimation(this, R.anim.slide_out_right)
|
||||
slideOutLeft = AnimationUtils.loadAnimation(this, R.anim.slide_out_left)
|
||||
slideInRight = AnimationUtils.loadAnimation(this, R.anim.slide_in_right)
|
||||
|
||||
val key = "activities"
|
||||
val watchedActivity = PrefManager.getCustomVal<Set<Int>>(key, setOf())
|
||||
val startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
|
||||
val startIndex = if ( startFrom > 0) startFrom else 0
|
||||
binding.stories.setStoriesList(activity[position].activity, this, startIndex + 1)
|
||||
|
||||
|
||||
}
|
||||
private fun findFirstNonMatch(watchedActivity: Set<Int>, activity: List<Activity>): Int {
|
||||
for (activityItem in activity) {
|
||||
if (activityItem.id !in watchedActivity) {
|
||||
return activity.indexOf(activityItem)
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
binding.stories.pause()
|
||||
}
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
binding.stories.resume()
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
if (hasFocus) {
|
||||
binding.stories.resume()
|
||||
} else {
|
||||
binding.stories.pause()
|
||||
}
|
||||
}
|
||||
override fun onStoriesEnd() {
|
||||
position += 1
|
||||
if (position < activity.size) {
|
||||
val key = "activities"
|
||||
val watchedActivity = PrefManager.getCustomVal<Set<Int>>(key, setOf())
|
||||
val startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
|
||||
val startIndex= if ( startFrom > 0) startFrom else 0
|
||||
binding.stories.startAnimation(slideOutLeft)
|
||||
binding.stories.setStoriesList(activity[position].activity, this, startIndex + 1)
|
||||
binding.stories.startAnimation(slideInRight)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStoriesStart() {
|
||||
position -= 1
|
||||
if (position >= 0) {
|
||||
val key = "activities"
|
||||
val watchedActivity = PrefManager.getCustomVal<Set<Int>>(key, setOf())
|
||||
val startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
|
||||
val startIndex = if ( startFrom > 0) startFrom else 0
|
||||
binding.stories.startAnimation(slideOutRight)
|
||||
binding.stories.setStoriesList(activity[position].activity, this, startIndex + 1)
|
||||
binding.stories.startAnimation(slideInLeft)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
companion object {
|
||||
var user: ArrayList<User> = arrayListOf()
|
||||
}
|
||||
}
|
||||
@@ -1,505 +0,0 @@
|
||||
package ani.dantotsu.home.status
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.widget.ProgressBar
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.constraintlayout.widget.ConstraintSet
|
||||
import androidx.core.app.ActivityOptionsCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.blurImage
|
||||
import ani.dantotsu.buildMarkwon
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.api.Activity
|
||||
import ani.dantotsu.databinding.FragmentStatusBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.home.status.listener.StoriesCallback
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.media.MediaDetailsActivity
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.profile.User
|
||||
import ani.dantotsu.profile.UsersDialogFragment
|
||||
import ani.dantotsu.profile.activity.ActivityItemBuilder
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.util.AniMarkdown
|
||||
import ani.dantotsu.util.Logger
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
import kotlin.math.abs
|
||||
|
||||
|
||||
class Stories @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), View.OnTouchListener {
|
||||
private lateinit var activity: FragmentActivity
|
||||
private lateinit var binding: FragmentStatusBinding
|
||||
private lateinit var activityList: List<Activity>
|
||||
private lateinit var storiesListener: StoriesCallback
|
||||
private var userClicked: Boolean = false
|
||||
private var storyIndex: Int = 1
|
||||
private var primaryColor: Int = 0
|
||||
private var onPrimaryColor: Int = 0
|
||||
private var storyDuration: Int = 6
|
||||
private val timer: StoryTimer = StoryTimer(secondsToMillis(storyDuration))
|
||||
|
||||
init {
|
||||
initLayout()
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
fun initLayout() {
|
||||
val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||
binding = FragmentStatusBinding.inflate(inflater, this, false)
|
||||
addView(binding.root)
|
||||
|
||||
primaryColor = context.getThemeColor(com.google.android.material.R.attr.colorPrimary)
|
||||
onPrimaryColor = context.getThemeColor(com.google.android.material.R.attr.colorOnPrimary)
|
||||
|
||||
if (context is StoriesCallback) storiesListener = context as StoriesCallback
|
||||
|
||||
binding.leftTouchPanel.setOnTouchListener(this)
|
||||
binding.rightTouchPanel.setOnTouchListener(this)
|
||||
}
|
||||
|
||||
|
||||
fun setStoriesList(
|
||||
activityList: List<Activity>, activity: FragmentActivity, startIndex: Int = 1
|
||||
) {
|
||||
this.activityList = activityList
|
||||
this.activity = activity
|
||||
this.storyIndex = startIndex
|
||||
addLoadingViews(activityList)
|
||||
}
|
||||
|
||||
private fun addLoadingViews(storiesList: List<Activity>) {
|
||||
var idCounter = 1
|
||||
for (story in storiesList) {
|
||||
binding.progressBarContainer.removeView(findViewWithTag<ProgressBar>("story${idCounter}"))
|
||||
val progressBar = ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal)
|
||||
progressBar.visibility = View.VISIBLE
|
||||
progressBar.id = idCounter
|
||||
progressBar.tag = "story${idCounter++}"
|
||||
progressBar.progressBackgroundTintList = ColorStateList.valueOf(primaryColor)
|
||||
progressBar.progressTintList = ColorStateList.valueOf(onPrimaryColor)
|
||||
val params = LayoutParams(0, LayoutParams.WRAP_CONTENT)
|
||||
params.marginEnd = 5
|
||||
params.marginStart = 5
|
||||
binding.progressBarContainer.addView(progressBar, params)
|
||||
}
|
||||
|
||||
val constraintSet = ConstraintSet()
|
||||
constraintSet.clone(binding.progressBarContainer)
|
||||
|
||||
var counter = storiesList.size
|
||||
for (story in storiesList) {
|
||||
val progressBar = findViewWithTag<ProgressBar>("story${counter}")
|
||||
if (progressBar != null) {
|
||||
if (storiesList.size > 1) {
|
||||
when (counter) {
|
||||
storiesList.size -> {
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.END,
|
||||
LayoutParams.PARENT_ID,
|
||||
ConstraintSet.END
|
||||
)
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.TOP,
|
||||
LayoutParams.PARENT_ID,
|
||||
ConstraintSet.TOP
|
||||
)
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.START,
|
||||
getId("story${counter - 1}"),
|
||||
ConstraintSet.END
|
||||
)
|
||||
}
|
||||
|
||||
1 -> {
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.TOP,
|
||||
LayoutParams.PARENT_ID,
|
||||
ConstraintSet.TOP
|
||||
)
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.START,
|
||||
LayoutParams.PARENT_ID,
|
||||
ConstraintSet.START
|
||||
)
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.END,
|
||||
getId("story${counter + 1}"),
|
||||
ConstraintSet.START
|
||||
)
|
||||
}
|
||||
|
||||
else -> {
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.TOP,
|
||||
LayoutParams.PARENT_ID,
|
||||
ConstraintSet.TOP
|
||||
)
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.START,
|
||||
getId("story${counter - 1}"),
|
||||
ConstraintSet.END
|
||||
)
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.END,
|
||||
getId("story${counter + 1}"),
|
||||
ConstraintSet.START
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.END,
|
||||
LayoutParams.PARENT_ID,
|
||||
ConstraintSet.END
|
||||
)
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.TOP,
|
||||
LayoutParams.PARENT_ID,
|
||||
ConstraintSet.TOP
|
||||
)
|
||||
constraintSet.connect(
|
||||
getId("story${counter}"),
|
||||
ConstraintSet.START,
|
||||
LayoutParams.PARENT_ID,
|
||||
ConstraintSet.START
|
||||
)
|
||||
}
|
||||
}
|
||||
counter--
|
||||
}
|
||||
constraintSet.applyTo(binding.progressBarContainer)
|
||||
startShowContent()
|
||||
}
|
||||
|
||||
private fun startShowContent() {
|
||||
showStory()
|
||||
}
|
||||
|
||||
private fun showStory() {
|
||||
if (storyIndex > 1) {
|
||||
completeProgressBar(storyIndex - 1)
|
||||
}
|
||||
val progressBar = findViewWithTag<ProgressBar>("story${storyIndex}")
|
||||
binding.androidStoriesLoadingView.visibility = View.VISIBLE
|
||||
timer.setOnTimerCompletedListener {
|
||||
Logger.log("onAnimationEnd: $storyIndex")
|
||||
if (storyIndex - 1 <= activityList.size) {
|
||||
Logger.log("userNotClicked: $storyIndex")
|
||||
if (storyIndex < activityList.size) {
|
||||
storyIndex += 1
|
||||
showStory()
|
||||
} else {
|
||||
// on stories end
|
||||
binding.androidStoriesLoadingView.visibility = View.GONE
|
||||
onStoriesCompleted()
|
||||
}
|
||||
} else {
|
||||
// on stories end
|
||||
binding.androidStoriesLoadingView.visibility = View.GONE
|
||||
onStoriesCompleted()
|
||||
}
|
||||
}
|
||||
timer.setOnPercentTickListener {
|
||||
progressBar.progress = it
|
||||
}
|
||||
loadStory(activityList[storyIndex - 1])
|
||||
}
|
||||
|
||||
private fun getId(tag: String): Int {
|
||||
return findViewWithTag<ProgressBar>(tag).id
|
||||
}
|
||||
|
||||
private fun secondsToMillis(seconds: Int): Long {
|
||||
return (seconds.toLong()).times(1000)
|
||||
}
|
||||
|
||||
private fun resetProgressBar(storyIndex: Int) {
|
||||
for (i in storyIndex until activityList.size + 1) {
|
||||
val progressBar = findViewWithTag<ProgressBar>("story${i}")
|
||||
progressBar?.let {
|
||||
it.progress = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun completeProgressBar(storyIndex: Int) {
|
||||
for (i in 1 until storyIndex + 1) {
|
||||
val progressBar = findViewWithTag<ProgressBar>("story${i}")
|
||||
progressBar?.let {
|
||||
it.progress = 100
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private var startClickTime = 0L
|
||||
private var startX = 0f
|
||||
private var startY = 0f
|
||||
private var isLongPress = false
|
||||
private val swipeThreshold = 100
|
||||
override fun onTouch(view: View?, event: MotionEvent?): Boolean {
|
||||
val maxClickDuration = 200
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
startX = event.x
|
||||
startY = event.y
|
||||
startClickTime = Calendar.getInstance().timeInMillis
|
||||
pause()
|
||||
isLongPress = false
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
val deltaX = event.x - startX
|
||||
val deltaY = event.y - startY
|
||||
if (!isLongPress && (abs(deltaX) > swipeThreshold || abs(deltaY) > swipeThreshold)) {
|
||||
isLongPress = true
|
||||
}
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_UP -> {
|
||||
val clickDuration = Calendar.getInstance().timeInMillis - startClickTime
|
||||
if (clickDuration < maxClickDuration && !isLongPress) {
|
||||
when (view?.id) {
|
||||
R.id.leftTouchPanel -> leftPanelTouch()
|
||||
R.id.rightTouchPanel -> rightPanelTouch()
|
||||
}
|
||||
} else {
|
||||
resume()
|
||||
}
|
||||
val deltaX = event.x - startX
|
||||
if (abs(deltaX) > swipeThreshold) {
|
||||
if (deltaX > 0) onStoriesPrevious()
|
||||
else onStoriesCompleted()
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private fun rightPanelTouch() {
|
||||
Logger.log("rightPanelTouch: $storyIndex")
|
||||
if (storyIndex == activityList.size) {
|
||||
completeProgressBar(storyIndex)
|
||||
onStoriesCompleted()
|
||||
return
|
||||
}
|
||||
userClicked = true
|
||||
timer.cancel()
|
||||
if (storyIndex <= activityList.size) storyIndex += 1
|
||||
showStory()
|
||||
}
|
||||
|
||||
private fun leftPanelTouch() {
|
||||
Logger.log("leftPanelTouch: $storyIndex")
|
||||
if (storyIndex == 1) {
|
||||
onStoriesPrevious()
|
||||
return
|
||||
}
|
||||
userClicked = true
|
||||
timer.cancel()
|
||||
resetProgressBar(storyIndex)
|
||||
if (storyIndex > 1) storyIndex -= 1
|
||||
showStory()
|
||||
}
|
||||
|
||||
private fun onStoriesCompleted() {
|
||||
Logger.log("onStoriesCompleted")
|
||||
if (::storiesListener.isInitialized) {
|
||||
storyIndex = 1
|
||||
storiesListener.onStoriesEnd()
|
||||
resetProgressBar(storyIndex)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onStoriesPrevious() {
|
||||
if (::storiesListener.isInitialized) {
|
||||
storyIndex = 1
|
||||
storiesListener.onStoriesStart()
|
||||
resetProgressBar(storyIndex)
|
||||
}
|
||||
}
|
||||
|
||||
fun pause() {
|
||||
timer.pause()
|
||||
}
|
||||
|
||||
fun resume() {
|
||||
timer.resume()
|
||||
}
|
||||
|
||||
private fun loadStory(story: Activity) {
|
||||
val key = "activities"
|
||||
val set = PrefManager.getCustomVal<Set<Int>>(key, setOf()).plus((story.id))
|
||||
val newList = set.sorted().takeLast(200).toSet()
|
||||
PrefManager.setCustomVal(key, newList)
|
||||
binding.statusUserAvatar.loadImage(story.user?.avatar?.large)
|
||||
binding.statusUserName.text = story.user?.name
|
||||
binding.statusUserTime.text = ActivityItemBuilder.getDateTime(story.createdAt)
|
||||
binding.statusUserContainer.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
context,
|
||||
Intent(context, ProfileActivity::class.java).putExtra("userId", story.userId),
|
||||
null
|
||||
)
|
||||
}
|
||||
fun visible(isList: Boolean) {
|
||||
binding.textActivity.isVisible = !isList
|
||||
binding.textActivityContainer.isVisible = !isList
|
||||
binding.infoText.isVisible = isList
|
||||
binding.coverImage.isVisible = isList
|
||||
binding.infoText.visibility = if (isList) View.VISIBLE else View.INVISIBLE
|
||||
binding.infoText.text = ""
|
||||
binding.contentImageViewKen.isVisible = isList
|
||||
binding.contentImageView.isVisible = isList
|
||||
}
|
||||
|
||||
when (story.typename) {
|
||||
"ListActivity" -> {
|
||||
visible(true)
|
||||
val text = "${
|
||||
story.status?.replaceFirstChar {
|
||||
if (it.isLowerCase()) {
|
||||
it.titlecase(Locale.ROOT)
|
||||
} else {
|
||||
it.toString()
|
||||
}
|
||||
}
|
||||
} ${story.progress ?: story.media?.title?.userPreferred} " +
|
||||
if (
|
||||
story.status?.contains("completed") == false &&
|
||||
!story.status.contains("plans") &&
|
||||
!story.status.contains("repeating")
|
||||
) {
|
||||
"of ${story.media?.title?.userPreferred}"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
binding.infoText.text = text
|
||||
val bannerAnimations: Boolean = PrefManager.getVal(PrefName.BannerAnimations)
|
||||
blurImage(
|
||||
if (bannerAnimations) binding.contentImageViewKen else binding.contentImageView,
|
||||
story.media?.bannerImage ?: story.media?.coverImage?.extraLarge
|
||||
)
|
||||
binding.coverImage.loadImage(story.media?.coverImage?.extraLarge)
|
||||
binding.coverImage.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
context,
|
||||
Intent(context, MediaDetailsActivity::class.java).putExtra(
|
||||
"mediaId",
|
||||
story.media?.id
|
||||
),
|
||||
ActivityOptionsCompat.makeSceneTransitionAnimation(
|
||||
activity,
|
||||
binding.coverImage,
|
||||
ViewCompat.getTransitionName(binding.coverImage)!!
|
||||
).toBundle()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"TextActivity" -> {
|
||||
visible(false)
|
||||
if (!(context as android.app.Activity).isDestroyed) {
|
||||
val markwon = buildMarkwon(context, false)
|
||||
markwon.setMarkdown(
|
||||
binding.textActivity, AniMarkdown.getBasicAniHTML(story.text ?: "")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"MessageActivity" -> {
|
||||
visible(false)
|
||||
if (!(context as android.app.Activity).isDestroyed) {
|
||||
val markwon = buildMarkwon(context, false)
|
||||
markwon.setMarkdown(
|
||||
binding.textActivity, AniMarkdown.getBasicAniHTML(story.message ?: "")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
val userList = arrayListOf<User>()
|
||||
story.likes?.forEach { i ->
|
||||
userList.add(User(i.id, i.name.toString(), i.avatar?.medium, i.bannerImage))
|
||||
}
|
||||
val likeColor = ContextCompat.getColor(context, R.color.yt_red)
|
||||
val notLikeColor = ContextCompat.getColor(context, R.color.bg_opp)
|
||||
binding.activityRepliesContainer.setOnClickListener {
|
||||
RepliesBottomDialog.newInstance(story.id)
|
||||
.show(activity.supportFragmentManager, "replies")
|
||||
}
|
||||
binding.activityLike.setColorFilter(if (story.isLiked == true) likeColor else notLikeColor)
|
||||
binding.replyCount.text = story.replyCount.toString()
|
||||
binding.activityLikeCount.text = story.likeCount.toString()
|
||||
binding.activityReplies.setColorFilter(ContextCompat.getColor(context, R.color.bg_opp))
|
||||
binding.activityLikeContainer.setOnClickListener {
|
||||
like()
|
||||
}
|
||||
binding.activityLikeContainer.setOnLongClickListener {
|
||||
val context = activity
|
||||
UsersDialogFragment().apply {
|
||||
userList(userList)
|
||||
show(context.supportFragmentManager, "dialog")
|
||||
}
|
||||
true
|
||||
}
|
||||
binding.androidStoriesLoadingView.visibility = View.GONE
|
||||
timer.start()
|
||||
}
|
||||
|
||||
fun like() {
|
||||
val story = activityList[storyIndex - 1]
|
||||
val likeColor = ContextCompat.getColor(context, R.color.yt_red)
|
||||
val notLikeColor = ContextCompat.getColor(context, R.color.bg_opp)
|
||||
val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
||||
scope.launch {
|
||||
val res = Anilist.query.toggleLike(story.id, "ACTIVITY")
|
||||
withContext(Dispatchers.Main) {
|
||||
if (res != null) {
|
||||
if (story.isLiked == true) {
|
||||
story.likeCount = story.likeCount?.minus(1)
|
||||
} else {
|
||||
story.likeCount = story.likeCount?.plus(1)
|
||||
}
|
||||
binding.activityLikeCount.text = (story.likeCount ?: 0).toString()
|
||||
story.isLiked = !story.isLiked!!
|
||||
binding.activityLike.setColorFilter(if (story.isLiked == true) likeColor else notLikeColor)
|
||||
|
||||
} else {
|
||||
snackString("Failed to like activity")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package ani.dantotsu.home.status
|
||||
|
||||
import android.os.CountDownTimer
|
||||
|
||||
class StoryTimer(
|
||||
private val updateInterval: Long
|
||||
) {
|
||||
private lateinit var timer: CountDownTimer
|
||||
private var prevVal = 0
|
||||
private var pauseLength = 0L
|
||||
var onTimerCompleted: () -> Unit = {}
|
||||
var percentTick: (Int) -> Unit = {}
|
||||
var timeLeft: Long = 0
|
||||
private set
|
||||
|
||||
fun start(durationInMillis: Long = updateInterval) {
|
||||
cancel()
|
||||
timer = object : CountDownTimer(durationInMillis, 1) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
timeLeft = millisUntilFinished
|
||||
val percent =
|
||||
((pauseLength + durationInMillis - millisUntilFinished) * 100 / (pauseLength + durationInMillis)).toInt()
|
||||
if (percent != prevVal) {
|
||||
percentTick.invoke(percent)
|
||||
prevVal = percent
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
onTimerCompleted.invoke()
|
||||
pauseLength = 0
|
||||
}
|
||||
}
|
||||
timer.start()
|
||||
}
|
||||
|
||||
fun cancel() {
|
||||
if (::timer.isInitialized) {
|
||||
timer.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
fun pause() {
|
||||
if (::timer.isInitialized) {
|
||||
timer.cancel()
|
||||
pauseLength = updateInterval - timeLeft
|
||||
}
|
||||
}
|
||||
|
||||
fun resume() {
|
||||
if (::timer.isInitialized && timeLeft > 0) {
|
||||
start(timeLeft)
|
||||
timer.start()
|
||||
}
|
||||
}
|
||||
|
||||
fun setOnTimerCompletedListener(onTimerCompleted: () -> Unit) {
|
||||
this.onTimerCompleted = onTimerCompleted
|
||||
}
|
||||
|
||||
fun setOnPercentTickListener(percentTick: (Int) -> Unit) {
|
||||
this.percentTick = percentTick
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package ani.dantotsu.home.status
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.databinding.ItemUserStatusBinding
|
||||
import ani.dantotsu.getAppString
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.profile.User
|
||||
import ani.dantotsu.setAnimation
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
|
||||
class UserStatusAdapter(private val user: ArrayList<User>) :
|
||||
RecyclerView.Adapter<UserStatusAdapter.UsersViewHolder>() {
|
||||
|
||||
inner class UsersViewHolder(val binding: ItemUserStatusBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
init {
|
||||
itemView.setOnClickListener {
|
||||
StatusActivity.user = user
|
||||
ContextCompat.startActivity(
|
||||
itemView.context,
|
||||
Intent(
|
||||
itemView.context,
|
||||
StatusActivity::class.java
|
||||
).putExtra("position", bindingAdapterPosition),
|
||||
null
|
||||
)
|
||||
}
|
||||
itemView.setOnLongClickListener {
|
||||
ContextCompat.startActivity(
|
||||
itemView.context,
|
||||
Intent(
|
||||
itemView.context,
|
||||
ProfileActivity::class.java
|
||||
).putExtra("userId", user[bindingAdapterPosition].id),
|
||||
null
|
||||
)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): UsersViewHolder {
|
||||
return UsersViewHolder(
|
||||
ItemUserStatusBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: UsersViewHolder, position: Int) {
|
||||
val b = holder.binding
|
||||
setAnimation(b.root.context, b.root)
|
||||
val user = user[position]
|
||||
b.profileUserAvatar.loadImage(user.pfp)
|
||||
b.profileUserName.text = if (Anilist.userid == user.id) getAppString(R.string.your_story) else user.name
|
||||
val watchedActivity = PrefManager.getCustomVal<Set<Int>>("activities", setOf())
|
||||
val booleanList = user.activity.map { watchedActivity.contains(it.id) }
|
||||
b.profileUserStatusIndicator.setParts(user.activity.size, booleanList, user.id == Anilist.userid)
|
||||
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = user.size
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package ani.dantotsu.home.status.listener
|
||||
|
||||
interface StoriesCallback {
|
||||
fun onStoriesEnd()
|
||||
fun onStoriesStart()
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package ani.dantotsu.media
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
@@ -13,7 +14,6 @@ import androidx.lifecycle.lifecycleScope
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.Refresh
|
||||
import ani.dantotsu.databinding.ActivityListBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.hideSystemBarsExtendView
|
||||
import ani.dantotsu.media.user.ListViewPagerAdapter
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
@@ -39,10 +39,15 @@ class CalendarActivity : AppCompatActivity() {
|
||||
binding = ActivityListBinding.inflate(layoutInflater)
|
||||
|
||||
|
||||
|
||||
val primaryColor = getThemeColor(com.google.android.material.R.attr.colorSurface)
|
||||
val primaryTextColor = getThemeColor(com.google.android.material.R.attr.colorPrimary)
|
||||
val secondaryTextColor = getThemeColor(com.google.android.material.R.attr.colorOutline)
|
||||
val typedValue = TypedValue()
|
||||
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
|
||||
val primaryColor = typedValue.data
|
||||
val typedValue3 = TypedValue()
|
||||
theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue3, true)
|
||||
val primaryTextColor = typedValue3.data
|
||||
val typedValue4 = TypedValue()
|
||||
theme.resolveAttribute(com.google.android.material.R.attr.colorOutline, typedValue4, true)
|
||||
val secondaryTextColor = typedValue4.data
|
||||
|
||||
window.statusBarColor = primaryColor
|
||||
window.navigationBarColor = primaryColor
|
||||
@@ -69,7 +74,6 @@ class CalendarActivity : AppCompatActivity() {
|
||||
binding.listTitle.setText(R.string.release_calendar)
|
||||
binding.listSort.visibility = View.GONE
|
||||
binding.random.visibility = View.GONE
|
||||
binding.search.visibility = View.GONE
|
||||
binding.listTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||
this@CalendarActivity.selectedTabIdx = tab?.position ?: 1
|
||||
|
||||
@@ -5,7 +5,6 @@ import ani.dantotsu.connections.anilist.api.FuzzyDate
|
||||
import ani.dantotsu.connections.anilist.api.MediaEdge
|
||||
import ani.dantotsu.connections.anilist.api.MediaList
|
||||
import ani.dantotsu.connections.anilist.api.MediaType
|
||||
import ani.dantotsu.connections.anilist.api.Query
|
||||
import ani.dantotsu.media.anime.Anime
|
||||
import ani.dantotsu.media.manga.Manga
|
||||
import ani.dantotsu.profile.User
|
||||
@@ -63,7 +62,6 @@ data class Media(
|
||||
var timeUntilAiring: Long? = null,
|
||||
|
||||
var characters: ArrayList<Character>? = null,
|
||||
var review: ArrayList<Query.Review>? = null,
|
||||
var staff: ArrayList<Author>? = null,
|
||||
var prequel: Media? = null,
|
||||
var sequel: Media? = null,
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.util.TypedValue
|
||||
import android.view.GestureDetector
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
@@ -37,7 +38,6 @@ import ani.dantotsu.blurImage
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.copyToClipboard
|
||||
import ani.dantotsu.databinding.ActivityMediaBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.media.anime.AnimeWatchFragment
|
||||
@@ -172,7 +172,7 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||
|
||||
binding.mediaCoverImage.loadImage(media.cover)
|
||||
binding.mediaCoverImage.setOnLongClickListener {
|
||||
val coverTitle = getString(R.string.cover, media.userPreferredName)
|
||||
val coverTitle = "${media.userPreferredName}[Cover]"
|
||||
ImageViewDialog.newInstance(
|
||||
this,
|
||||
coverTitle,
|
||||
@@ -192,7 +192,7 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||
}
|
||||
|
||||
override fun onLongClick(event: MotionEvent) {
|
||||
val bannerTitle = getString(R.string.banner, media.userPreferredName)
|
||||
val bannerTitle = "${media.userPreferredName}[Banner]"
|
||||
ImageViewDialog.newInstance(
|
||||
this@MediaDetailsActivity,
|
||||
bannerTitle,
|
||||
@@ -250,12 +250,22 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||
@SuppressLint("ResourceType")
|
||||
fun total() {
|
||||
val text = SpannableStringBuilder().apply {
|
||||
|
||||
val white = this@MediaDetailsActivity.getThemeColor(com.google.android.material.R.attr.colorOnBackground)
|
||||
val mediaTypedValue = TypedValue()
|
||||
this@MediaDetailsActivity.theme.resolveAttribute(
|
||||
com.google.android.material.R.attr.colorOnBackground,
|
||||
mediaTypedValue,
|
||||
true
|
||||
)
|
||||
val white = mediaTypedValue.data
|
||||
if (media.userStatus != null) {
|
||||
append(if (media.anime != null) getString(R.string.watched_num) else getString(R.string.read_num))
|
||||
val colorSecondary = getThemeColor(com.google.android.material.R.attr.colorSecondary)
|
||||
bold { color(colorSecondary) { append("${media.userProgress}") } }
|
||||
val typedValue = TypedValue()
|
||||
theme.resolveAttribute(
|
||||
com.google.android.material.R.attr.colorSecondary,
|
||||
typedValue,
|
||||
true
|
||||
)
|
||||
bold { color(typedValue.data) { append("${media.userProgress}") } }
|
||||
append(
|
||||
if (media.anime != null) getString(R.string.episodes_out_of) else getString(
|
||||
R.string.chapters_out_of
|
||||
|
||||
@@ -34,18 +34,16 @@ import ani.dantotsu.databinding.ItemChipBinding
|
||||
import ani.dantotsu.databinding.ItemQuelsBinding
|
||||
import ani.dantotsu.databinding.ItemTitleChipgroupBinding
|
||||
import ani.dantotsu.databinding.ItemTitleRecyclerBinding
|
||||
import ani.dantotsu.databinding.ItemTitleSearchBinding
|
||||
import ani.dantotsu.databinding.ItemTitleTextBinding
|
||||
import ani.dantotsu.databinding.ItemTitleTrailerBinding
|
||||
import ani.dantotsu.displayTimer
|
||||
import ani.dantotsu.isOnline
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.profile.User
|
||||
import ani.dantotsu.px
|
||||
import ani.dantotsu.setSafeOnClickListener
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import io.noties.markwon.Markwon
|
||||
import io.noties.markwon.SoftBreakAddsNewLinePlugin
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -81,8 +79,7 @@ class MediaInfoFragment : Fragment() {
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
val model: MediaDetailsViewModel by activityViewModels()
|
||||
val offline: Boolean =
|
||||
PrefManager.getVal(PrefName.OfflineMode) || !isOnline(requireContext())
|
||||
val offline: Boolean = PrefManager.getVal(PrefName.OfflineMode)
|
||||
binding.mediaInfoProgressBar.isGone = loaded
|
||||
binding.mediaInfoContainer.isVisible = loaded
|
||||
binding.mediaInfoContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> { bottomMargin += 128f.px + navBarHeight }
|
||||
@@ -252,41 +249,7 @@ class MediaInfoFragment : Fragment() {
|
||||
}
|
||||
parent.addView(bind.root)
|
||||
}
|
||||
if (!media.users.isNullOrEmpty() && !offline) {
|
||||
val users: ArrayList<User> = media.users ?: arrayListOf()
|
||||
if (Anilist.token != null && media.userStatus != null) {
|
||||
users.add(
|
||||
0,
|
||||
User(
|
||||
id = Anilist.userid!!,
|
||||
name = getString(R.string.you),
|
||||
pfp = Anilist.avatar,
|
||||
banner = "",
|
||||
status = media.userStatus,
|
||||
score = media.userScore.toFloat(),
|
||||
progress = media.userProgress,
|
||||
totalEpisodes = media.anime?.totalEpisodes
|
||||
?: media.manga?.totalChapters,
|
||||
nextAiringEpisode = media.anime?.nextAiringEpisode
|
||||
)
|
||||
)
|
||||
}
|
||||
ItemTitleRecyclerBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
parent,
|
||||
false
|
||||
).apply {
|
||||
itemTitle.visibility = View.GONE
|
||||
itemRecycler.adapter =
|
||||
MediaSocialAdapter(users, type, requireActivity())
|
||||
itemRecycler.layoutManager = LinearLayoutManager(
|
||||
requireContext(),
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
parent.addView(root)
|
||||
}
|
||||
}
|
||||
|
||||
if (media.trailer != null && !offline) {
|
||||
@Suppress("DEPRECATION")
|
||||
class MyChrome : WebChromeClient() {
|
||||
@@ -520,26 +483,24 @@ class MediaInfoFragment : Fragment() {
|
||||
}
|
||||
parent.addView(root)
|
||||
}
|
||||
}
|
||||
|
||||
if (!media.review.isNullOrEmpty()) {
|
||||
ItemTitleRecyclerBinding.inflate(
|
||||
ItemTitleSearchBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
parent,
|
||||
false
|
||||
).apply {
|
||||
val adapter = GroupieAdapter()
|
||||
media.review!!.forEach { adapter.add(ReviewAdapter(it)) }
|
||||
itemTitle.setText(R.string.reviews)
|
||||
itemRecycler.adapter = adapter
|
||||
itemRecycler.layoutManager = LinearLayoutManager(requireContext())
|
||||
itemMore.visibility = View.VISIBLE
|
||||
itemMore.setSafeOnClickListener {
|
||||
startActivity(
|
||||
Intent(requireContext(), ReviewActivity::class.java)
|
||||
.putExtra("mediaId", media.id)
|
||||
)
|
||||
|
||||
titleSearchImage.loadImage(media.banner ?: media.cover)
|
||||
titleSearchText.text =
|
||||
getString(R.string.search_title, media.mainName())
|
||||
titleSearchCard.setSafeOnClickListener {
|
||||
val query = Intent(requireContext(), SearchActivity::class.java)
|
||||
.putExtra("type", "ANIME")
|
||||
.putExtra("query", media.mainName())
|
||||
.putExtra("search", true)
|
||||
ContextCompat.startActivity(requireContext(), query, null)
|
||||
}
|
||||
|
||||
parent.addView(root)
|
||||
}
|
||||
}
|
||||
@@ -611,6 +572,23 @@ class MediaInfoFragment : Fragment() {
|
||||
parent.addView(root)
|
||||
}
|
||||
}
|
||||
if (!media.users.isNullOrEmpty() && !offline) {
|
||||
ItemTitleRecyclerBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
parent,
|
||||
false
|
||||
).apply {
|
||||
itemTitle.setText(R.string.social)
|
||||
itemRecycler.adapter =
|
||||
MediaSocialAdapter(media.users!!)
|
||||
itemRecycler.layoutManager = LinearLayoutManager(
|
||||
requireContext(),
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
parent.addView(root)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import ani.dantotsu.connections.anilist.api.FuzzyDate
|
||||
import ani.dantotsu.connections.mal.MAL
|
||||
import ani.dantotsu.databinding.BottomSheetMediaListBinding
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.tryWith
|
||||
import com.google.android.material.materialswitch.MaterialSwitch
|
||||
@@ -188,12 +187,7 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
|
||||
binding.mediaListPrivate.setOnCheckedChangeListener { _, checked ->
|
||||
media?.isListPrivate = checked
|
||||
}
|
||||
val removeList = PrefManager.getCustomVal("removeList", setOf<Int>())
|
||||
var remove: Boolean? = null
|
||||
binding.mediaListShow.isChecked = media?.id in removeList
|
||||
binding.mediaListShow.setOnCheckedChangeListener { _, checked ->
|
||||
remove = checked
|
||||
}
|
||||
|
||||
media?.userRepeat?.apply {
|
||||
binding.mediaListRewatch.setText(this.toString())
|
||||
}
|
||||
@@ -259,11 +253,6 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
|
||||
)
|
||||
}
|
||||
}
|
||||
if (remove == true) {
|
||||
PrefManager.setCustomVal("removeList", removeList.plus(media!!.id))
|
||||
} else if (remove == false) {
|
||||
PrefManager.setCustomVal("removeList", removeList.minus(media!!.id))
|
||||
}
|
||||
Refresh.all()
|
||||
snackString(getString(R.string.list_updated))
|
||||
dismissAllowingStateLoss()
|
||||
@@ -286,7 +275,6 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
PrefManager.setCustomVal("removeList", removeList.minus(media?.id))
|
||||
}
|
||||
if (id != null) {
|
||||
Refresh.all()
|
||||
|
||||
@@ -18,7 +18,6 @@ import ani.dantotsu.connections.mal.MAL
|
||||
import ani.dantotsu.databinding.BottomSheetMediaListSmallBinding
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.others.getSerialized
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.snackString
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -171,12 +170,7 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
|
||||
binding.mediaListPrivate.setOnCheckedChangeListener { _, checked ->
|
||||
media.isListPrivate = checked
|
||||
}
|
||||
val removeList = PrefManager.getCustomVal("removeList", setOf<Int>())
|
||||
var remove: Boolean? = null
|
||||
binding.mediaListShow.isChecked = media.id in removeList
|
||||
binding.mediaListShow.setOnCheckedChangeListener { _, checked ->
|
||||
remove = checked
|
||||
}
|
||||
|
||||
binding.mediaListSave.setOnClickListener {
|
||||
scope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
@@ -204,11 +198,6 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
|
||||
)
|
||||
}
|
||||
}
|
||||
if (remove == true) {
|
||||
PrefManager.setCustomVal("removeList", removeList.plus(media.id))
|
||||
} else if (remove == false) {
|
||||
PrefManager.setCustomVal("removeList", removeList.minus(media.id))
|
||||
}
|
||||
Refresh.all()
|
||||
snackString(getString(R.string.list_updated))
|
||||
dismissAllowingStateLoss()
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
package ani.dantotsu.media
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.ActivityMediaListViewBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.hideSystemBarsExtendView
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.others.getSerialized
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import java.util.ArrayList
|
||||
|
||||
class MediaListViewActivity: AppCompatActivity() {
|
||||
private lateinit var binding: ActivityMediaListViewBinding
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityMediaListViewBinding.inflate(layoutInflater)
|
||||
ThemeManager(this).applyTheme()
|
||||
initActivity(this)
|
||||
if (!PrefManager.getVal<Boolean>(PrefName.ImmersiveMode)) {
|
||||
this.window.statusBarColor =
|
||||
ContextCompat.getColor(this, R.color.nav_bg_inv)
|
||||
binding.root.fitsSystemWindows = true
|
||||
|
||||
} else {
|
||||
binding.root.fitsSystemWindows = false
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
hideSystemBarsExtendView()
|
||||
binding.settingsContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin = statusBarHeight
|
||||
}
|
||||
}
|
||||
|
||||
setContentView(binding.root)
|
||||
|
||||
val primaryColor = getThemeColor(com.google.android.material.R.attr.colorSurface)
|
||||
val primaryTextColor = getThemeColor(com.google.android.material.R.attr.colorPrimary)
|
||||
val secondaryTextColor = getThemeColor(com.google.android.material.R.attr.colorOutline)
|
||||
|
||||
window.statusBarColor = primaryColor
|
||||
window.navigationBarColor = primaryColor
|
||||
binding.listAppBar.setBackgroundColor(primaryColor)
|
||||
binding.listTitle.setTextColor(primaryTextColor)
|
||||
val screenWidth = resources.displayMetrics.run { widthPixels / density }
|
||||
val mediaList = passedMedia ?: intent.getSerialized("media") as? ArrayList<Media> ?: ArrayList()
|
||||
if (passedMedia != null) passedMedia = null
|
||||
val view = PrefManager.getCustomVal("mediaView", 0)
|
||||
var mediaView: View = when (view) {
|
||||
1 -> binding.mediaList
|
||||
0 -> binding.mediaGrid
|
||||
else -> binding.mediaGrid
|
||||
}
|
||||
mediaView.alpha = 1f
|
||||
fun changeView(mode: Int, current: View) {
|
||||
mediaView.alpha = 0.33f
|
||||
mediaView = current
|
||||
current.alpha = 1f
|
||||
PrefManager.setCustomVal("mediaView", mode)
|
||||
binding.mediaRecyclerView.adapter = MediaAdaptor(mode, mediaList, this)
|
||||
binding.mediaRecyclerView.layoutManager = GridLayoutManager(
|
||||
this,
|
||||
if (mode == 1) 1 else (screenWidth / 120f).toInt()
|
||||
)
|
||||
}
|
||||
binding.mediaList.setOnClickListener {
|
||||
changeView(1, binding.mediaList)
|
||||
}
|
||||
binding.mediaGrid.setOnClickListener {
|
||||
changeView(0, binding.mediaGrid)
|
||||
}
|
||||
val text = "${intent.getStringExtra("title")} (${mediaList.count()})"
|
||||
binding.listTitle.text = text
|
||||
binding.mediaRecyclerView.adapter = MediaAdaptor(view, mediaList, this)
|
||||
binding.mediaRecyclerView.layoutManager = GridLayoutManager(
|
||||
this,
|
||||
if (view == 1) 1 else (screenWidth / 120f).toInt()
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
var passedMedia: ArrayList<Media>? = null
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ object MediaNameAdapter {
|
||||
return if (seasonMatcher.find()) {
|
||||
seasonMatcher.group(2)?.toInt()
|
||||
} else {
|
||||
text.toIntOrNull()
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ object MediaNameAdapter {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
text.toFloatOrNull()
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ object MediaNameAdapter {
|
||||
if (failedChapterNumberMatcher.find()) {
|
||||
failedChapterNumberMatcher.group(1)?.toFloat()
|
||||
} else {
|
||||
text.toFloatOrNull()
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,27 @@
|
||||
package ani.dantotsu.media
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.ItemFollowerGridBinding
|
||||
import ani.dantotsu.getAppString
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.others.ImageViewDialog
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.profile.User
|
||||
import ani.dantotsu.setAnimation
|
||||
|
||||
class MediaSocialAdapter(
|
||||
val user: ArrayList<User>,
|
||||
val type: String,
|
||||
val activity: FragmentActivity
|
||||
) : RecyclerView.Adapter<MediaSocialAdapter.FollowerGridViewHolder>() {
|
||||
class MediaSocialAdapter(private val user: ArrayList<User>) :
|
||||
RecyclerView.Adapter<MediaSocialAdapter.DeveloperViewHolder>() {
|
||||
|
||||
inner class FollowerGridViewHolder(val binding: ItemFollowerGridBinding) :
|
||||
inner class DeveloperViewHolder(val binding: ItemFollowerGridBinding) :
|
||||
RecyclerView.ViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FollowerGridViewHolder {
|
||||
return FollowerGridViewHolder(
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DeveloperViewHolder {
|
||||
return DeveloperViewHolder(
|
||||
ItemFollowerGridBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
@@ -35,8 +30,8 @@ class MediaSocialAdapter(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
override fun onBindViewHolder(holder: FollowerGridViewHolder, position: Int) {
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBindViewHolder(holder: DeveloperViewHolder, position: Int) {
|
||||
holder.binding.apply {
|
||||
val user = user[position]
|
||||
val score = user.score?.div(10.0) ?: 0.0
|
||||
@@ -44,14 +39,14 @@ class MediaSocialAdapter(
|
||||
profileUserName.text = user.name
|
||||
profileInfo.apply {
|
||||
text = when (user.status) {
|
||||
"CURRENT" -> if (type == "ANIME") getAppString(R.string.watching) else getAppString(R.string.reading)
|
||||
"CURRENT" -> "WATCHING"
|
||||
else -> user.status ?: ""
|
||||
}
|
||||
visibility = View.VISIBLE
|
||||
}
|
||||
profileCompactUserProgress.text = user.progress.toString()
|
||||
profileCompactScore.text = score.toString()
|
||||
" | ${user.totalEpisodes ?: "~"}".also { profileCompactTotal.text = it }
|
||||
profileCompactTotal.text = " | ${user.totalEpisodes ?: "~"}"
|
||||
profileUserAvatar.loadImage(user.pfp)
|
||||
|
||||
val scoreDrawable = if (score == 0.0) R.drawable.score else R.drawable.user_score
|
||||
@@ -63,17 +58,10 @@ class MediaSocialAdapter(
|
||||
profileCompactProgressContainer.visibility = View.VISIBLE
|
||||
|
||||
profileUserAvatar.setOnClickListener {
|
||||
ContextCompat.startActivity(root.context,
|
||||
Intent(root.context, ProfileActivity::class.java)
|
||||
.putExtra("userId", user.id),
|
||||
null)
|
||||
}
|
||||
profileUserAvatarContainer.setOnLongClickListener {
|
||||
ImageViewDialog.newInstance(
|
||||
activity,
|
||||
activity.getString(R.string.avatar, user.name),
|
||||
user.pfp
|
||||
)
|
||||
val intent = Intent(root.context, ProfileActivity::class.java).apply {
|
||||
putExtra("userId", user.id)
|
||||
}
|
||||
ContextCompat.startActivity(root.context, intent, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
package ani.dantotsu.media
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.api.Query
|
||||
import ani.dantotsu.databinding.ActivityFollowBinding
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.util.MarkdownCreatorActivity
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class ReviewActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityFollowBinding
|
||||
val adapter = GroupieAdapter()
|
||||
private val reviews = mutableListOf<Query.Review>()
|
||||
var mediaId = 0
|
||||
private var currentPage: Int = 1
|
||||
private var hasNextPage: Boolean = true
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
ThemeManager(this).applyTheme()
|
||||
initActivity(this)
|
||||
binding = ActivityFollowBinding.inflate(layoutInflater)
|
||||
binding.listToolbar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin = statusBarHeight
|
||||
}
|
||||
binding.listFrameLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin = navBarHeight
|
||||
}
|
||||
setContentView(binding.root)
|
||||
mediaId = intent.getIntExtra("mediaId", -1)
|
||||
if (mediaId == -1) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
binding.followerGrid.visibility = View.GONE
|
||||
binding.followerList.visibility = View.GONE
|
||||
binding.followFilterButton.setImageResource(R.drawable.ic_add)
|
||||
binding.followFilterButton.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
this,
|
||||
Intent(this, MarkdownCreatorActivity::class.java)
|
||||
.putExtra("type", "review"),
|
||||
null
|
||||
)
|
||||
}
|
||||
binding.followFilterButton.visibility = View.GONE
|
||||
binding.listTitle.text = getString(R.string.reviews)
|
||||
binding.listRecyclerView.adapter = adapter
|
||||
binding.listRecyclerView.layoutManager = LinearLayoutManager(
|
||||
this,
|
||||
LinearLayoutManager.VERTICAL,
|
||||
false
|
||||
)
|
||||
binding.listProgressBar.visibility = View.VISIBLE
|
||||
binding.listBack.setOnClickListener { onBackPressedDispatcher.onBackPressed() }
|
||||
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val response = Anilist.query.getReviews(mediaId)?.data?.page
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.listProgressBar.visibility = View.GONE
|
||||
binding.listRecyclerView.setOnTouchListener { _, event ->
|
||||
if (event?.action == MotionEvent.ACTION_UP) {
|
||||
if (hasNextPage && !binding.listRecyclerView.canScrollVertically(1) && !binding.followRefresh.isVisible
|
||||
&& binding.listRecyclerView.adapter!!.itemCount != 0 &&
|
||||
(binding.listRecyclerView.layoutManager as LinearLayoutManager).findLastVisibleItemPosition() == (binding.listRecyclerView.adapter!!.itemCount - 1)
|
||||
) {
|
||||
binding.followRefresh.visibility = ViewGroup.VISIBLE
|
||||
loadPage(++currentPage) {
|
||||
binding.followRefresh.visibility = ViewGroup.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
currentPage = response?.pageInfo?.currentPage ?: 1
|
||||
hasNextPage = response?.pageInfo?.hasNextPage ?: false
|
||||
response?.reviews?.let {
|
||||
reviews.addAll(it)
|
||||
fillList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadPage(page: Int, callback: () -> Unit) {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val response = Anilist.query.getReviews(mediaId, page)
|
||||
currentPage = response?.data?.page?.pageInfo?.currentPage ?: 1
|
||||
hasNextPage = response?.data?.page?.pageInfo?.hasNextPage ?: false
|
||||
withContext(Dispatchers.Main) {
|
||||
response?.data?.page?.reviews?.let {
|
||||
reviews.addAll(it)
|
||||
fillList()
|
||||
}
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun fillList() {
|
||||
adapter.clear()
|
||||
reviews.forEach {
|
||||
adapter.add(ReviewAdapter(it))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
package ani.dantotsu.media
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.core.app.ActivityOptionsCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.util.Pair
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.api.Query
|
||||
import ani.dantotsu.databinding.ItemReviewsBinding
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.openImage
|
||||
import ani.dantotsu.others.ImageViewDialog
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.profile.activity.ActivityItemBuilder
|
||||
import ani.dantotsu.toast
|
||||
import com.xwray.groupie.viewbinding.BindableItem
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class ReviewAdapter(
|
||||
private var review: Query.Review,
|
||||
) : BindableItem<ItemReviewsBinding>() {
|
||||
private lateinit var binding: ItemReviewsBinding
|
||||
|
||||
override fun bind(viewBinding: ItemReviewsBinding, position: Int) {
|
||||
binding = viewBinding
|
||||
val context = binding.root.context
|
||||
binding.reviewUserName.text = review.user?.name
|
||||
binding.reviewUserAvatar.loadImage(review.user?.avatar?.medium)
|
||||
binding.reviewText.text = review.summary
|
||||
binding.reviewPostTime.text = ActivityItemBuilder.getDateTime(review.createdAt)
|
||||
val text = "[${review.score/ 10.0f}]"
|
||||
binding.reviewTag.text = text
|
||||
binding.root.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
context,
|
||||
Intent(context, ReviewViewActivity::class.java)
|
||||
.putExtra("review", review),
|
||||
null
|
||||
)
|
||||
}
|
||||
binding.reviewUserName.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
context,
|
||||
Intent(context, ProfileActivity::class.java)
|
||||
.putExtra("userId", review.user?.id),
|
||||
null
|
||||
)
|
||||
}
|
||||
binding.reviewUserAvatar.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
context,
|
||||
Intent(context, ProfileActivity::class.java)
|
||||
.putExtra("userId", review.user?.id),
|
||||
null
|
||||
)
|
||||
}
|
||||
binding.reviewUserAvatar.openImage(
|
||||
context.getString(
|
||||
R.string.avatar,
|
||||
review.user?.name
|
||||
),
|
||||
review.user?.avatar?.medium ?: ""
|
||||
)
|
||||
userVote(review.userRating)
|
||||
enableVote()
|
||||
binding.reviewTotalVotes.text = review.rating.toString()
|
||||
}
|
||||
|
||||
override fun getLayout(): Int {
|
||||
return R.layout.item_reviews
|
||||
}
|
||||
|
||||
override fun initializeViewBinding(view: View): ItemReviewsBinding {
|
||||
return ItemReviewsBinding.bind(view)
|
||||
}
|
||||
private fun userVote(type: String) {
|
||||
when (type) {
|
||||
"NO_VOTE" -> {
|
||||
binding.reviewUpVote.setImageResource(R.drawable.ic_round_upvote_inactive_24)
|
||||
binding.reviewDownVote.setImageResource(R.drawable.ic_round_upvote_inactive_24)
|
||||
binding.reviewUpVote.alpha = 0.6f
|
||||
binding.reviewDownVote.alpha = 0.6f
|
||||
}
|
||||
|
||||
"UP_VOTE" -> {
|
||||
binding.reviewUpVote.setImageResource(R.drawable.ic_round_upvote_active_24)
|
||||
binding.reviewDownVote.setImageResource(R.drawable.ic_round_upvote_inactive_24)
|
||||
binding.reviewUpVote.alpha = 1f
|
||||
binding.reviewDownVote.alpha = 0.6f
|
||||
}
|
||||
|
||||
"DOWN_VOTE" -> {
|
||||
binding.reviewUpVote.setImageResource(R.drawable.ic_round_upvote_inactive_24)
|
||||
binding.reviewDownVote.setImageResource(R.drawable.ic_round_upvote_active_24)
|
||||
binding.reviewDownVote.alpha = 1f
|
||||
binding.reviewUpVote.alpha = 0.6f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun rateReview(rating: String) {
|
||||
disableVote()
|
||||
val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
||||
scope.launch {
|
||||
val result = Anilist.mutation.rateReview(review.id, rating)
|
||||
if (result != null) {
|
||||
withContext(Dispatchers.Main) {
|
||||
val res = result.data.rateReview
|
||||
review.rating = res.rating
|
||||
review.ratingAmount = res.ratingAmount
|
||||
review.userRating = res.userRating
|
||||
userVote(review.userRating)
|
||||
binding.reviewTotalVotes.text = review.rating.toString()
|
||||
userVote(review.userRating)
|
||||
enableVote()
|
||||
}
|
||||
} else {
|
||||
withContext(Dispatchers.Main) {
|
||||
toast(
|
||||
binding.root.context.getString(R.string.error_message, "response is null")
|
||||
)
|
||||
enableVote()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun disableVote() {
|
||||
binding.reviewUpVote.setOnClickListener(null)
|
||||
binding.reviewDownVote.setOnClickListener(null)
|
||||
binding.reviewUpVote.isEnabled = false
|
||||
binding.reviewDownVote.isEnabled = false
|
||||
}
|
||||
|
||||
private fun enableVote() {
|
||||
binding.reviewUpVote.setOnClickListener {
|
||||
if (review.userRating == "UP_VOTE") {
|
||||
rateReview("NO_VOTE")
|
||||
} else {
|
||||
rateReview("UP_VOTE")
|
||||
}
|
||||
disableVote()
|
||||
}
|
||||
binding.reviewDownVote.setOnClickListener {
|
||||
if (review.userRating == "DOWN_VOTE") {
|
||||
rateReview("NO_VOTE")
|
||||
} else {
|
||||
rateReview("DOWN_VOTE")
|
||||
}
|
||||
disableVote()
|
||||
}
|
||||
binding.reviewUpVote.isEnabled = true
|
||||
binding.reviewDownVote.isEnabled = true
|
||||
}
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
package ani.dantotsu.media
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebResourceRequest
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.api.Query
|
||||
import ani.dantotsu.databinding.ActivityReviewViewBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.openImage
|
||||
import ani.dantotsu.others.ImageViewDialog
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.profile.activity.ActivityItemBuilder
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.util.AniMarkdown
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class ReviewViewActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityReviewViewBinding
|
||||
private lateinit var review: Query.Review
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
ThemeManager(this).applyTheme()
|
||||
initActivity(this)
|
||||
binding = ActivityReviewViewBinding.inflate(layoutInflater)
|
||||
binding.userContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin = statusBarHeight
|
||||
}
|
||||
binding.reviewContent.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin += navBarHeight
|
||||
}
|
||||
setContentView(binding.root)
|
||||
review = intent.getSerializableExtra("review") as Query.Review
|
||||
binding.userName.text = review.user?.name
|
||||
binding.userAvatar.loadImage(review.user?.avatar?.medium)
|
||||
binding.userTime.text = ActivityItemBuilder.getDateTime(review.createdAt)
|
||||
binding.userContainer.setOnClickListener {
|
||||
startActivity(Intent(this, ProfileActivity::class.java)
|
||||
.putExtra("userId", review.user?.id)
|
||||
)
|
||||
}
|
||||
binding.userAvatar.openImage(
|
||||
binding.root.context.getString(R.string.avatar, review.user?.name),
|
||||
review.user?.avatar?.medium ?: ""
|
||||
)
|
||||
binding.userAvatar.setOnClickListener {
|
||||
startActivity(Intent(this, ProfileActivity::class.java)
|
||||
.putExtra("userId", review.user?.id)
|
||||
)
|
||||
}
|
||||
binding.profileUserBio.settings.loadWithOverviewMode = true
|
||||
binding.profileUserBio.settings.useWideViewPort = true
|
||||
binding.profileUserBio.setInitialScale(1)
|
||||
val styledHtml = AniMarkdown.getFullAniHTML(
|
||||
review.body,
|
||||
ContextCompat.getColor(this, R.color.bg_opp)
|
||||
)
|
||||
binding.profileUserBio.loadDataWithBaseURL(
|
||||
null,
|
||||
styledHtml,
|
||||
"text/html",
|
||||
"utf-8",
|
||||
null
|
||||
)
|
||||
binding.profileUserBio.setBackgroundColor(
|
||||
ContextCompat.getColor(
|
||||
this,
|
||||
android.R.color.transparent
|
||||
)
|
||||
)
|
||||
binding.profileUserBio.setLayerType(View.LAYER_TYPE_HARDWARE, null)
|
||||
binding.profileUserBio.webViewClient = object : WebViewClient() {
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
binding.profileUserBio.setBackgroundColor(
|
||||
ContextCompat.getColor(
|
||||
this@ReviewViewActivity,
|
||||
android.R.color.transparent
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun shouldOverrideUrlLoading(
|
||||
view: WebView?,
|
||||
request: WebResourceRequest?
|
||||
): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
||||
userVote(review.userRating)
|
||||
enableVote()
|
||||
binding.voteCount.text = review.rating.toString()
|
||||
binding.voteText.text = getString(
|
||||
R.string.vote_out_of_total,
|
||||
review.rating.toString(),
|
||||
review.ratingAmount.toString()
|
||||
)
|
||||
}
|
||||
|
||||
private fun userVote(type: String) {
|
||||
val selectedColor = getThemeColor(com.google.android.material.R.attr.colorPrimary)
|
||||
val unselectedColor = getThemeColor(androidx.appcompat.R.attr.colorControlNormal)
|
||||
when (type) {
|
||||
"NO_VOTE" -> {
|
||||
binding.upvote.setColorFilter(unselectedColor)
|
||||
binding.downvote.setColorFilter(unselectedColor)
|
||||
}
|
||||
|
||||
"UP_VOTE" -> {
|
||||
binding.upvote.setColorFilter(selectedColor)
|
||||
binding.downvote.setColorFilter(unselectedColor)
|
||||
}
|
||||
|
||||
"DOWN_VOTE" -> {
|
||||
binding.upvote.setColorFilter(unselectedColor)
|
||||
binding.downvote.setColorFilter(selectedColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun rateReview(rating: String) {
|
||||
disableVote()
|
||||
lifecycleScope.launch {
|
||||
val result = Anilist.mutation.rateReview(review.id, rating)
|
||||
if (result != null) {
|
||||
withContext(Dispatchers.Main) {
|
||||
val res = result.data.rateReview
|
||||
review.rating = res.rating
|
||||
review.ratingAmount = res.ratingAmount
|
||||
review.userRating = res.userRating
|
||||
userVote(review.userRating)
|
||||
binding.voteCount.text = review.rating.toString()
|
||||
binding.voteText.text = getString(
|
||||
R.string.vote_out_of_total,
|
||||
review.rating.toString(),
|
||||
review.ratingAmount.toString()
|
||||
)
|
||||
userVote(review.userRating)
|
||||
enableVote()
|
||||
}
|
||||
} else {
|
||||
withContext(Dispatchers.Main) {
|
||||
toast(
|
||||
getString(R.string.error_message, "response is null")
|
||||
)
|
||||
enableVote()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun disableVote() {
|
||||
binding.upvote.setOnClickListener(null)
|
||||
binding.downvote.setOnClickListener(null)
|
||||
binding.upvote.isEnabled = false
|
||||
binding.downvote.isEnabled = false
|
||||
}
|
||||
|
||||
private fun enableVote() {
|
||||
binding.upvote.setOnClickListener {
|
||||
if (review.userRating == "UP_VOTE") {
|
||||
rateReview("NO_VOTE")
|
||||
} else {
|
||||
rateReview("UP_VOTE")
|
||||
}
|
||||
disableVote()
|
||||
}
|
||||
binding.downvote.setOnClickListener {
|
||||
if (review.userRating == "DOWN_VOTE") {
|
||||
rateReview("NO_VOTE")
|
||||
} else {
|
||||
rateReview("DOWN_VOTE")
|
||||
}
|
||||
disableVote()
|
||||
}
|
||||
binding.upvote.isEnabled = true
|
||||
binding.downvote.isEnabled = true
|
||||
}
|
||||
}
|
||||
@@ -177,9 +177,6 @@ class SearchAdapter(private val activity: SearchActivity, private val type: Stri
|
||||
popupMenu.show()
|
||||
true
|
||||
}
|
||||
if (activity.result.type != "ANIME") {
|
||||
binding.searchByImage.visibility = View.GONE
|
||||
}
|
||||
binding.searchByImage.setOnClickListener {
|
||||
activity.startActivity(Intent(activity, ImageSearchActivity::class.java))
|
||||
}
|
||||
@@ -308,21 +305,20 @@ class SearchAdapter(private val activity: SearchActivity, private val type: Stri
|
||||
private fun fadeInAnimation(): Animation {
|
||||
return AlphaAnimation(0f, 1f).apply {
|
||||
duration = 150
|
||||
fillAfter = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun fadeOutAnimation(): Animation {
|
||||
return AlphaAnimation(1f, 0f).apply {
|
||||
duration = 150
|
||||
fillAfter = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun addHistory() {
|
||||
if (::searchHistoryAdapter.isInitialized &&
|
||||
binding.searchBarText.text.toString().isNotBlank()
|
||||
)
|
||||
searchHistoryAdapter.add(binding.searchBarText.text.toString())
|
||||
searchHistoryAdapter.add(binding.searchBarText.text.toString())
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = 1
|
||||
|
||||
@@ -5,7 +5,6 @@ import ani.dantotsu.download.DownloadedType
|
||||
import ani.dantotsu.download.DownloadsManager
|
||||
import ani.dantotsu.parsers.SubtitleType
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.util.Logger
|
||||
import com.anggrayudi.storage.file.openOutputStream
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -20,38 +19,32 @@ class SubtitleDownloader {
|
||||
//doesn't really download the subtitles -\_(o_o)_/-
|
||||
suspend fun loadSubtitleType(url: String): SubtitleType =
|
||||
withContext(Dispatchers.IO) {
|
||||
return@withContext try {
|
||||
// Initialize the NetworkHelper instance. Replace this line based on how you usually initialize it
|
||||
val networkHelper = Injekt.get<NetworkHelper>()
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
.build()
|
||||
// Initialize the NetworkHelper instance. Replace this line based on how you usually initialize it
|
||||
val networkHelper = Injekt.get<NetworkHelper>()
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
.build()
|
||||
|
||||
val response = networkHelper.client.newCall(request).execute()
|
||||
val response = networkHelper.client.newCall(request).execute()
|
||||
|
||||
// Check if response is successful
|
||||
if (response.isSuccessful) {
|
||||
val responseBody = response.body.string()
|
||||
// Check if response is successful
|
||||
if (response.isSuccessful) {
|
||||
val responseBody = response.body.string()
|
||||
|
||||
|
||||
val subtitleType = when {
|
||||
responseBody.contains("[Script Info]") -> SubtitleType.ASS
|
||||
responseBody.contains("WEBVTT") -> SubtitleType.VTT
|
||||
else -> SubtitleType.SRT
|
||||
}
|
||||
|
||||
subtitleType
|
||||
} else {
|
||||
SubtitleType.UNKNOWN
|
||||
val subtitleType = when {
|
||||
responseBody.contains("[Script Info]") -> SubtitleType.ASS
|
||||
responseBody.contains("WEBVTT") -> SubtitleType.VTT
|
||||
else -> SubtitleType.SRT
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.log(e)
|
||||
SubtitleType.UNKNOWN
|
||||
|
||||
return@withContext subtitleType
|
||||
} else {
|
||||
return@withContext SubtitleType.UNKNOWN
|
||||
}
|
||||
}
|
||||
|
||||
//actually downloads lol
|
||||
@Deprecated("handled externally")
|
||||
suspend fun downloadSubtitle(
|
||||
context: Context,
|
||||
url: String,
|
||||
@@ -62,8 +55,8 @@ class SubtitleDownloader {
|
||||
context,
|
||||
downloadedType.type,
|
||||
false,
|
||||
downloadedType.titleName,
|
||||
downloadedType.chapterName
|
||||
downloadedType.title,
|
||||
downloadedType.chapter
|
||||
) ?: throw Exception("Could not create directory")
|
||||
val type = loadSubtitleType(url)
|
||||
directory.findFile("subtitle.${type}")?.delete()
|
||||
|
||||
@@ -489,7 +489,7 @@ class AnimeWatchAdapter(
|
||||
val adapter = ArrayAdapter(
|
||||
fragment.requireContext(),
|
||||
R.layout.item_dropdown,
|
||||
parser.extension.sources.map { LanguageMapper.getLanguageName(it.lang) }
|
||||
parser.extension.sources.map { LanguageMapper.mapLanguageCodeToName(it.lang) }
|
||||
)
|
||||
val items = adapter.count
|
||||
|
||||
|
||||
@@ -30,14 +30,11 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import ani.dantotsu.FileUrl
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.addons.download.DownloadAddonManager
|
||||
import ani.dantotsu.databinding.FragmentAnimeWatchBinding
|
||||
import ani.dantotsu.download.DownloadedType
|
||||
import ani.dantotsu.download.DownloadsManager
|
||||
import ani.dantotsu.download.DownloadsManager.Companion.compareName
|
||||
import ani.dantotsu.download.DownloadsManager.Companion.getSubDirectory
|
||||
import ani.dantotsu.download.anime.AnimeDownloaderService
|
||||
import ani.dantotsu.download.findValidName
|
||||
import ani.dantotsu.dp
|
||||
import ani.dantotsu.isOnline
|
||||
import ani.dantotsu.media.Media
|
||||
@@ -57,20 +54,15 @@ import ani.dantotsu.settings.extensionprefs.AnimeSourcePreferencesFragment
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.util.Logger
|
||||
import ani.dantotsu.util.StoragePermissions.Companion.accessAlertDialog
|
||||
import ani.dantotsu.util.StoragePermissions.Companion.hasDirAccess
|
||||
import com.anggrayudi.storage.file.extension
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||
import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.launch
|
||||
import tachiyomi.core.util.lang.launchIO
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import kotlin.math.ceil
|
||||
@@ -379,7 +371,7 @@ class AnimeWatchFragment : Fragment() {
|
||||
var selectedSetting = allSettings[0]
|
||||
if (allSettings.size > 1) {
|
||||
val names =
|
||||
allSettings.map { LanguageMapper.getLanguageName(it.lang) }.toTypedArray()
|
||||
allSettings.map { LanguageMapper.mapLanguageCodeToName(it.lang) }.toTypedArray()
|
||||
val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup)
|
||||
.setTitle("Select a Source")
|
||||
.setSingleChoiceItems(names, -1) { dialog, which ->
|
||||
@@ -500,89 +492,6 @@ class AnimeWatchFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
@kotlin.OptIn(DelicateCoroutinesApi::class)
|
||||
fun fixDownload(i: String) {
|
||||
toast(R.string.running_fixes)
|
||||
launchIO {
|
||||
try {
|
||||
val context = context ?: throw Exception("Context is null")
|
||||
val directory =
|
||||
getSubDirectory(context, MediaType.ANIME, false, media.mainName(), i)
|
||||
?: throw Exception("Directory is null")
|
||||
val files = directory.listFiles()
|
||||
val videoFiles = files.filter { it.extension == "mp4" || it.extension == "mkv" }
|
||||
if (videoFiles.size != 1) {
|
||||
val biggest =
|
||||
videoFiles.filter { it.length() > 1000 }.maxByOrNull { it.length() }
|
||||
?: throw Exception("No video files found")
|
||||
val newName =
|
||||
AnimeDownloaderService.AnimeDownloadTask.getTaskName(media.mainName(), i)
|
||||
.findValidName() + "." + biggest.extension
|
||||
videoFiles.forEach {
|
||||
if (it != biggest) {
|
||||
it.delete()
|
||||
}
|
||||
}
|
||||
if (newName != biggest.name) {
|
||||
biggest.renameTo(newName)
|
||||
}
|
||||
toast(context.getString(R.string.success) + " (1)")
|
||||
} else {
|
||||
val ffExtension = Injekt.get<DownloadAddonManager>().extension?.extension!!
|
||||
val extension = ffExtension.getFileExtension()
|
||||
val tempFile =
|
||||
directory.createFile(extension.second, "temp.${extension.first}")
|
||||
?: throw Exception("Temp file is null")
|
||||
val tempPath = ffExtension.setDownloadPath(
|
||||
context,
|
||||
tempFile.uri
|
||||
)
|
||||
val videoPath = ffExtension.getReadPath(
|
||||
context,
|
||||
videoFiles[0].uri
|
||||
)
|
||||
|
||||
val id = ffExtension.customFFMpeg(
|
||||
"1", listOf(videoPath, tempPath)
|
||||
) { log ->
|
||||
Logger.log(log)
|
||||
}
|
||||
val timeOut = System.currentTimeMillis() + 1000 * 60 * 10
|
||||
while (ffExtension.getState(id) != "COMPLETED") {
|
||||
if (ffExtension.getState(id) == "FAILED") {
|
||||
Logger.log("Failed to fix download")
|
||||
ffExtension.getStackTrace(id)?.let {
|
||||
Logger.log(it)
|
||||
}
|
||||
toast(R.string.failed_to_fix)
|
||||
return@launchIO
|
||||
}
|
||||
if (System.currentTimeMillis() > timeOut) {
|
||||
Logger.log("Failed to fix download: Timeout")
|
||||
toast(R.string.failed_to_fix)
|
||||
return@launchIO
|
||||
}
|
||||
}
|
||||
if (ffExtension.hadError(id)) {
|
||||
Logger.log("Failed to fix download: ${ffExtension.getStackTrace(id)}")
|
||||
toast(R.string.failed_to_fix)
|
||||
return@launchIO
|
||||
}
|
||||
val name = videoFiles[0].name
|
||||
if (videoFiles[0].delete().not()) {
|
||||
toast(R.string.delete_fail)
|
||||
return@launchIO
|
||||
}
|
||||
tempFile.renameTo(name!!)
|
||||
toast(context.getString(R.string.success) + " (2)")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
toast(getString(R.string.error_msg, e.message))
|
||||
Logger.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val downloadStatusReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (!this@AnimeWatchFragment::episodeAdapter.isInitialized) return
|
||||
@@ -644,8 +553,8 @@ class AnimeWatchFragment : Fragment() {
|
||||
episodeAdapter.updateType(style ?: PrefManager.getVal(PrefName.AnimeDefaultView))
|
||||
episodeAdapter.notifyItemRangeInserted(0, arr.size)
|
||||
for (download in downloadManager.animeDownloadedTypes) {
|
||||
if (media.compareName(download.titleName)) {
|
||||
episodeAdapter.stopDownload(download.chapterName)
|
||||
if (media.compareName(download.title)) {
|
||||
episodeAdapter.stopDownload(download.chapter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,16 +334,6 @@ class EpisodeAdapter(
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.itemDownload.setOnLongClickListener {
|
||||
if (0 <= bindingAdapterPosition && bindingAdapterPosition < arr.size) {
|
||||
val episodeNumber = arr[bindingAdapterPosition].number
|
||||
if (downloadedEpisodes.contains(episodeNumber)) {
|
||||
fragment.fixDownload(episodeNumber)
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
binding.itemEpisodeDesc.setOnClickListener {
|
||||
if (binding.itemEpisodeDesc.maxLines == 3)
|
||||
binding.itemEpisodeDesc.maxLines = 100
|
||||
|
||||
@@ -82,9 +82,7 @@ import androidx.media3.datasource.cache.CacheDataSource
|
||||
import androidx.media3.datasource.okhttp.OkHttpDataSource
|
||||
import androidx.media3.exoplayer.DefaultLoadControl
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.exoplayer.hls.HlsMediaSource
|
||||
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
|
||||
import androidx.media3.exoplayer.source.MergingMediaSource
|
||||
import androidx.media3.exoplayer.trackselection.DefaultTrackSelector
|
||||
import androidx.media3.exoplayer.util.EventLogger
|
||||
import androidx.media3.session.MediaSession
|
||||
@@ -101,7 +99,6 @@ import androidx.mediarouter.app.MediaRouteButton
|
||||
import ani.dantotsu.GesturesListener
|
||||
import ani.dantotsu.NoPaddingArrayAdapter
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.addons.download.DownloadAddonManager
|
||||
import ani.dantotsu.brightnessConverter
|
||||
import ani.dantotsu.circularReveal
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
@@ -114,7 +111,6 @@ import ani.dantotsu.connections.updateProgress
|
||||
import ani.dantotsu.databinding.ActivityExoplayerBinding
|
||||
import ani.dantotsu.defaultHeaders
|
||||
import ani.dantotsu.download.DownloadsManager.Companion.getSubDirectory
|
||||
import ani.dantotsu.download.video.Helper
|
||||
import ani.dantotsu.dp
|
||||
import ani.dantotsu.getCurrentBrightnessValue
|
||||
import ani.dantotsu.hideSystemBars
|
||||
@@ -129,7 +125,6 @@ import ani.dantotsu.media.SubtitleDownloader
|
||||
import ani.dantotsu.okHttpClient
|
||||
import ani.dantotsu.others.AniSkip
|
||||
import ani.dantotsu.others.AniSkip.getType
|
||||
import ani.dantotsu.others.LanguageMapper
|
||||
import ani.dantotsu.others.ResettableTimer
|
||||
import ani.dantotsu.others.getSerialized
|
||||
import ani.dantotsu.parsers.AnimeSources
|
||||
@@ -149,7 +144,6 @@ import ani.dantotsu.toPx
|
||||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.tryWithSuspend
|
||||
import ani.dantotsu.util.Logger
|
||||
import com.anggrayudi.storage.file.extension
|
||||
import com.bumptech.glide.Glide
|
||||
import com.google.android.gms.cast.framework.CastButtonFactory
|
||||
import com.google.android.gms.cast.framework.CastContext
|
||||
@@ -194,7 +188,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||
private lateinit var cacheFactory: CacheDataSource.Factory
|
||||
private lateinit var playbackParameters: PlaybackParameters
|
||||
private lateinit var mediaItem: MediaItem
|
||||
private lateinit var mediaSource: MergingMediaSource
|
||||
private var mediaSession: MediaSession? = null
|
||||
|
||||
private lateinit var binding: ActivityExoplayerBinding
|
||||
@@ -228,7 +221,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||
|
||||
private var downloadId: String? = null
|
||||
private var hasExtSubtitles = false
|
||||
private var audioLanguages = mutableListOf<Pair<String,String>>()
|
||||
|
||||
companion object {
|
||||
var initialized = false
|
||||
@@ -1489,44 +1481,26 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||
val downloadedMediaItem = if (ext.server.offline) {
|
||||
val titleName = ext.server.name.split("/").first()
|
||||
val episodeName = ext.server.name.split("/").last()
|
||||
downloadId = PrefManager.getAnimeDownloadPreferences()
|
||||
.getString("$titleName - $episodeName", null)
|
||||
?: PrefManager.getAnimeDownloadPreferences()
|
||||
.getString(ext.server.name, null)
|
||||
val exoItem = if (downloadId != null) {
|
||||
Helper.downloadManager(this)
|
||||
.downloadIndex.getDownload(downloadId!!)?.request?.toMediaItem()
|
||||
} else null
|
||||
if (exoItem != null) {
|
||||
exoItem
|
||||
} else {
|
||||
|
||||
val directory =
|
||||
getSubDirectory(this, MediaType.ANIME, false, titleName, episodeName)
|
||||
if (directory != null) {
|
||||
val files = directory.listFiles()
|
||||
println(files)
|
||||
val docFile = directory.listFiles().firstOrNull {
|
||||
it.name?.endsWith(".mp4") == true || it.name?.endsWith(".mkv") == true
|
||||
|| it.name?.endsWith(".${Injekt.get<DownloadAddonManager>().extension?.extension?.getFileExtension()?.first ?: "ts"}") == true
|
||||
}
|
||||
if (docFile != null) {
|
||||
val uri = docFile.uri
|
||||
val downloadedMimeType = when (docFile.extension) {
|
||||
"mp4" -> MimeTypes.APPLICATION_MP4
|
||||
"mkv" -> MimeTypes.APPLICATION_MATROSKA
|
||||
else -> MimeTypes.APPLICATION_MP4
|
||||
}
|
||||
MediaItem.Builder().setUri(uri).setMimeType(downloadedMimeType).build()
|
||||
} else {
|
||||
snackString("File not found")
|
||||
null
|
||||
}
|
||||
val directory = getSubDirectory(this, MediaType.ANIME, false, titleName, episodeName)
|
||||
if (directory != null) {
|
||||
val files = directory.listFiles()
|
||||
println(files)
|
||||
val docFile = directory.listFiles().firstOrNull {
|
||||
it.name?.endsWith(".mp4") == true || it.name?.endsWith(".mkv") == true
|
||||
}
|
||||
if (docFile != null) {
|
||||
val uri = docFile.uri
|
||||
MediaItem.Builder().setUri(uri).setMimeType(mimeType).build()
|
||||
} else {
|
||||
snackString("Directory not found")
|
||||
snackString("File not found")
|
||||
null
|
||||
}
|
||||
} else {
|
||||
snackString("Directory not found")
|
||||
null
|
||||
}
|
||||
|
||||
} else null
|
||||
|
||||
mediaItem = if (downloadedMediaItem == null) {
|
||||
@@ -1547,33 +1521,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||
}
|
||||
}
|
||||
|
||||
val audioMediaItem = mutableListOf<MediaItem>()
|
||||
audioLanguages.clear()
|
||||
ext.audioTracks.forEach {
|
||||
var code = LanguageMapper.getLanguageCode(it.lang)
|
||||
if (code == "all") code = "un"
|
||||
audioLanguages.add(Pair(it.lang, code))
|
||||
audioMediaItem.add(
|
||||
MediaItem.Builder()
|
||||
.setUri(it.url)
|
||||
.setMimeType(MimeTypes.AUDIO_UNKNOWN)
|
||||
.setTag(code)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
val audioSources = audioMediaItem.map { mediaItem ->
|
||||
if (mediaItem.localConfiguration?.uri.toString().contains(".m3u8")) {
|
||||
HlsMediaSource.Factory(cacheFactory).createMediaSource(mediaItem)
|
||||
} else {
|
||||
DefaultMediaSourceFactory(cacheFactory).createMediaSource(mediaItem)
|
||||
}
|
||||
}.toTypedArray()
|
||||
val videoMediaSource = DefaultMediaSourceFactory(cacheFactory)
|
||||
.createMediaSource(mediaItem)
|
||||
mediaSource = MergingMediaSource(videoMediaSource, *audioSources)
|
||||
|
||||
|
||||
//Source
|
||||
exoSource.setOnClickListener {
|
||||
sourceClick()
|
||||
@@ -1626,7 +1573,14 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||
}
|
||||
}.show()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
} else buildExoplayer()
|
||||
}
|
||||
if (!this::exoPlayer.isInitialized) buildExoplayer()
|
||||
|
||||
val isDisabled = (subtitle == null && hasExtSubtitles)
|
||||
exoPlayer.trackSelectionParameters = exoPlayer.trackSelectionParameters
|
||||
.buildUpon()
|
||||
.setTrackTypeDisabled(TRACK_TYPE_TEXT, isDisabled)
|
||||
.build()
|
||||
}
|
||||
|
||||
private fun buildExoplayer() {
|
||||
@@ -1649,7 +1603,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||
.build().apply {
|
||||
playWhenReady = true
|
||||
this.playbackParameters = this@ExoplayerView.playbackParameters
|
||||
setMediaSource(mediaSource)
|
||||
setMediaItem(mediaItem)
|
||||
prepare()
|
||||
PrefManager.getCustomVal(
|
||||
"${media.id}_${media.anime!!.selectedEpisode}_max",
|
||||
@@ -1677,12 +1631,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||
if (!hasExtSubtitles && !PrefManager.getVal<Boolean>(PrefName.Subtitles)) {
|
||||
onSetTrackGroupOverride(dummyTrack, TRACK_TYPE_TEXT)
|
||||
}
|
||||
|
||||
val isDisabled = (subtitle == null && hasExtSubtitles)
|
||||
exoPlayer.trackSelectionParameters = exoPlayer.trackSelectionParameters
|
||||
.buildUpon()
|
||||
.setTrackTypeDisabled(TRACK_TYPE_TEXT, isDisabled)
|
||||
.build()
|
||||
}
|
||||
|
||||
private fun releasePlayer() {
|
||||
@@ -1987,7 +1935,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||
}
|
||||
exoAudioTrack.isVisible = audioTracks.size > 1
|
||||
exoAudioTrack.setOnClickListener {
|
||||
TrackGroupDialogFragment(this, audioTracks, TRACK_TYPE_AUDIO, audioLanguages)
|
||||
TrackGroupDialogFragment(this, audioTracks, TRACK_TYPE_AUDIO)
|
||||
.show(supportFragmentManager, "dialog")
|
||||
}
|
||||
if (!hasExtSubtitles) {
|
||||
@@ -2094,7 +2042,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeIntentLaunch")
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
finishAndRemoveTask()
|
||||
startActivity(intent)
|
||||
|
||||
@@ -10,12 +10,12 @@ import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.result.ActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.fragment.app.activityViewModels
|
||||
@@ -24,18 +24,15 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import ani.dantotsu.BottomSheetDialogFragment
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.addons.download.DownloadAddonManager
|
||||
import ani.dantotsu.addons.torrent.TorrentAddonManager
|
||||
import ani.dantotsu.connections.crashlytics.CrashlyticsInterface
|
||||
import ani.dantotsu.copyToClipboard
|
||||
import ani.dantotsu.currActivity
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.databinding.BottomSheetSelectorBinding
|
||||
import ani.dantotsu.databinding.ItemStreamBinding
|
||||
import ani.dantotsu.databinding.ItemUrlBinding
|
||||
import ani.dantotsu.download.DownloadedType
|
||||
import ani.dantotsu.download.video.Helper
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.hideSystemBars
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaDetailsViewModel
|
||||
@@ -48,14 +45,11 @@ import ani.dantotsu.parsers.Video
|
||||
import ani.dantotsu.parsers.VideoExtractor
|
||||
import ani.dantotsu.parsers.VideoType
|
||||
import ani.dantotsu.setSafeOnClickListener
|
||||
import ani.dantotsu.settings.SettingsAddonActivity
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.tryWith
|
||||
import ani.dantotsu.util.Logger
|
||||
import ani.dantotsu.util.customAlertDialog
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -99,8 +93,10 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||
_binding = BottomSheetSelectorBinding.inflate(inflater, container, false)
|
||||
val window = dialog?.window
|
||||
window?.statusBarColor = Color.TRANSPARENT
|
||||
window?.navigationBarColor =
|
||||
requireContext().getThemeColor(com.google.android.material.R.attr.colorSurface)
|
||||
val typedValue = TypedValue()
|
||||
val theme = requireContext().theme
|
||||
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
|
||||
window?.navigationBarColor = typedValue.data
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -276,40 +272,33 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||
if (torrentExtension.isAvailable()) {
|
||||
val activity = currActivity() ?: requireActivity()
|
||||
launchIO {
|
||||
try {
|
||||
val extension = torrentExtension.extension!!.extension
|
||||
torrentExtension.torrentHash?.let {
|
||||
extension.removeTorrent(it)
|
||||
}
|
||||
val index = if (url.contains("index=")) {
|
||||
url.substringAfter("index=").toIntOrNull() ?: 0
|
||||
} else 0
|
||||
Logger.log("Sending: ${url}, ${video.quality}, $index")
|
||||
val currentTorrent = extension.addTorrent(
|
||||
url, video.quality.toString(), "", "", false
|
||||
)
|
||||
torrentExtension.torrentHash = currentTorrent.hash
|
||||
video.file.url = extension.getLink(currentTorrent, index)
|
||||
Logger.log("Received: ${video.file.url}")
|
||||
if (launch == true) {
|
||||
Intent(activity, ExoplayerView::class.java).apply {
|
||||
ExoplayerView.media = media
|
||||
ExoplayerView.initialized = true
|
||||
startActivity(this)
|
||||
}
|
||||
} else {
|
||||
model.setEpisode(
|
||||
media.anime!!.episodes!![media.anime.selectedEpisode!!]!!,
|
||||
"startExo no launch"
|
||||
)
|
||||
}
|
||||
dismiss()
|
||||
} catch (e: Exception) {
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
Logger.log(e)
|
||||
toast("Error starting video: ${e.message}")
|
||||
dismiss()
|
||||
val extension = torrentExtension.extension!!.extension
|
||||
torrentExtension.torrentHash?.let {
|
||||
extension.removeTorrent(it)
|
||||
}
|
||||
val index = if (url.contains("index=")) {
|
||||
url.substringAfter("index=").toIntOrNull() ?: 0
|
||||
} else 0
|
||||
Logger.log("Sending: ${url}, ${video.quality}, $index")
|
||||
val currentTorrent = extension.addTorrent(
|
||||
url, video.quality.toString(), "", "", false
|
||||
)
|
||||
torrentExtension.torrentHash = currentTorrent.hash
|
||||
video.file.url = extension.getLink(currentTorrent, index)
|
||||
Logger.log("Received: ${video.file.url}")
|
||||
if (launch == true) {
|
||||
Intent(activity, ExoplayerView::class.java).apply {
|
||||
ExoplayerView.media = media
|
||||
ExoplayerView.initialized = true
|
||||
startActivity(this)
|
||||
}
|
||||
} else {
|
||||
model.setEpisode(
|
||||
media.anime!!.episodes!![media.anime.selectedEpisode!!]!!,
|
||||
"startExo no launch"
|
||||
)
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -340,7 +329,7 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||
}
|
||||
|
||||
dismiss()
|
||||
if (launch!!) {
|
||||
if (launch!! || model.watchSources!!.isDownloadedSource(media.selected!!.sourceIndex)) {
|
||||
stopAddingToList()
|
||||
val intent = Intent(activity, ExoplayerView::class.java)
|
||||
ExoplayerView.media = media
|
||||
@@ -398,7 +387,7 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||
}
|
||||
|
||||
fun performClick(position: Int) {
|
||||
try {
|
||||
try { //bandaid fix for crash
|
||||
val extractor = links[position]
|
||||
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]?.selectedExtractor =
|
||||
extractor.server.name
|
||||
@@ -445,14 +434,14 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||
val subtitleNames = subtitles.map { it.language }
|
||||
var subtitleToDownload: Subtitle? = null
|
||||
val alertDialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.download_subtitle)
|
||||
.setTitle("Download Subtitle")
|
||||
.setSingleChoiceItems(
|
||||
subtitleNames.toTypedArray(),
|
||||
-1
|
||||
) { _, which ->
|
||||
subtitleToDownload = subtitles[which]
|
||||
}
|
||||
.setPositiveButton(R.string.download) { dialog, _ ->
|
||||
.setPositiveButton("Download") { dialog, _ ->
|
||||
scope.launch {
|
||||
if (subtitleToDownload != null) {
|
||||
SubtitleDownloader.downloadSubtitle(
|
||||
@@ -468,13 +457,13 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||
}
|
||||
dialog.dismiss()
|
||||
}
|
||||
.setNegativeButton(R.string.cancel) { dialog, _ ->
|
||||
.setNegativeButton("Cancel") { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
.show()
|
||||
alertDialog.window?.setDimAmount(0.8f)
|
||||
} else {
|
||||
snackString(R.string.no_subtitles_available)
|
||||
snackString("No Subtitles Available")
|
||||
}
|
||||
}
|
||||
binding.urlDownload.setSafeOnClickListener {
|
||||
@@ -489,154 +478,106 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||
media!!.userPreferredName
|
||||
)
|
||||
} else {
|
||||
val downloadAddonManager: DownloadAddonManager = Injekt.get()
|
||||
if (!downloadAddonManager.isAvailable()){
|
||||
val context = currContext() ?: requireContext()
|
||||
context.customAlertDialog().apply {
|
||||
setTitle(R.string.download_addon_not_installed)
|
||||
setMessage(R.string.would_you_like_to_install)
|
||||
setPosButton(R.string.yes) {
|
||||
ContextCompat.startActivity(
|
||||
context,
|
||||
Intent(context, SettingsAddonActivity::class.java),
|
||||
null
|
||||
)
|
||||
}
|
||||
setNegButton(R.string.no) {
|
||||
return@setNegButton
|
||||
}
|
||||
show()
|
||||
}
|
||||
dismiss()
|
||||
return@setSafeOnClickListener
|
||||
}
|
||||
val episode =
|
||||
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!
|
||||
val episode = media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!
|
||||
val selectedVideo =
|
||||
if (extractor.videos.size > episode.selectedVideo) extractor.videos[episode.selectedVideo] else null
|
||||
val subtitleNames = subtitles.map { it.language }
|
||||
var selectedSubtitles: MutableList<Pair<String, String>> = mutableListOf()
|
||||
var selectedAudioTracks: MutableList<Pair<String, String>> = mutableListOf()
|
||||
var subtitleToDownload: Subtitle? = null
|
||||
val activity = currActivity() ?: requireActivity()
|
||||
selectedVideo?.file?.url?.let { url ->
|
||||
if (url.startsWith("magnet:") || url.endsWith(".torrent")) {
|
||||
val torrentExtension = Injekt.get<TorrentAddonManager>()
|
||||
if (!torrentExtension.isAvailable()) {
|
||||
toast(R.string.torrent_addon_not_available)
|
||||
snackString("Torrent Extension not available")
|
||||
return@setSafeOnClickListener
|
||||
}
|
||||
runBlocking {
|
||||
try {
|
||||
withContext(Dispatchers.IO) {
|
||||
val extension = torrentExtension.extension!!.extension
|
||||
torrentExtension.torrentHash?.let {
|
||||
extension.removeTorrent(it)
|
||||
}
|
||||
val index = if (url.contains("index=")) {
|
||||
url.substringAfter("index=").toIntOrNull() ?: 0
|
||||
} else 0
|
||||
Logger.log("Sending: ${url}, ${selectedVideo.quality}, $index")
|
||||
val currentTorrent = extension.addTorrent(
|
||||
url, selectedVideo.quality.toString(), "", "", false
|
||||
)
|
||||
torrentExtension.torrentHash = currentTorrent.hash
|
||||
selectedVideo.file.url =
|
||||
extension.getLink(currentTorrent, index)
|
||||
Logger.log("Received: ${selectedVideo.file.url}")
|
||||
withContext(Dispatchers.IO) {
|
||||
val extension = torrentExtension.extension!!.extension
|
||||
torrentExtension.torrentHash?.let {
|
||||
extension.removeTorrent(it)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
Logger.log(e)
|
||||
toast("Error starting video: ${e.message}")
|
||||
return@runBlocking
|
||||
val index = if (url.contains("index=")) {
|
||||
url.substringAfter("index=").toIntOrNull() ?: 0
|
||||
} else 0
|
||||
Logger.log("Sending: ${url}, ${selectedVideo.quality}, $index")
|
||||
val currentTorrent = extension.addTorrent(
|
||||
url, selectedVideo.quality.toString(), "", "", false
|
||||
)
|
||||
torrentExtension.torrentHash = currentTorrent.hash
|
||||
selectedVideo.file.url =
|
||||
extension.getLink(currentTorrent, index)
|
||||
Logger.log("Received: ${selectedVideo.file.url}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val currContext = currContext() ?: requireContext()
|
||||
fun go() {
|
||||
if (selectedVideo != null) {
|
||||
Helper.startAnimeDownloadService(
|
||||
activity,
|
||||
media!!.mainName(),
|
||||
episode.number,
|
||||
selectedVideo,
|
||||
selectedSubtitles,
|
||||
selectedAudioTracks,
|
||||
media,
|
||||
episode.thumb?.url ?: media!!.banner ?: media!!.cover
|
||||
)
|
||||
broadcastDownloadStarted(episode.number, activity)
|
||||
} else {
|
||||
snackString(R.string.no_video_selected)
|
||||
}
|
||||
}
|
||||
fun checkAudioTracks() {
|
||||
val audioTracks = extractor.audioTracks.map { it.lang }
|
||||
if (audioTracks.isNotEmpty()) {
|
||||
val audioNamesArray = audioTracks.toTypedArray()
|
||||
val checkedItems = BooleanArray(audioNamesArray.size) { false }
|
||||
val alertDialog = AlertDialog.Builder(currContext, R.style.MyPopup)
|
||||
.setTitle(R.string.download_audio_tracks)
|
||||
.setMultiChoiceItems(audioNamesArray, checkedItems) { _, which, isChecked ->
|
||||
val audioPair = Pair(extractor.audioTracks[which].url, extractor.audioTracks[which].lang)
|
||||
if (isChecked) {
|
||||
selectedAudioTracks.add(audioPair)
|
||||
} else {
|
||||
selectedAudioTracks.remove(audioPair)
|
||||
}
|
||||
}
|
||||
.setPositiveButton(R.string.download) { _, _ ->
|
||||
dialog?.dismiss()
|
||||
go()
|
||||
}
|
||||
.setNegativeButton(R.string.skip) { dialog, _ ->
|
||||
selectedAudioTracks = mutableListOf()
|
||||
go()
|
||||
dialog.dismiss()
|
||||
}
|
||||
.setNeutralButton(R.string.cancel) { dialog, _ ->
|
||||
selectedAudioTracks = mutableListOf()
|
||||
dialog.dismiss()
|
||||
}
|
||||
.show()
|
||||
alertDialog.window?.setDimAmount(0.8f)
|
||||
} else {
|
||||
go()
|
||||
}
|
||||
}
|
||||
if (subtitles.isNotEmpty()) {
|
||||
val subtitleNamesArray = subtitleNames.toTypedArray()
|
||||
val checkedItems = BooleanArray(subtitleNamesArray.size) { false }
|
||||
|
||||
val alertDialog = AlertDialog.Builder(currContext, R.style.MyPopup)
|
||||
.setTitle(R.string.download_subtitle)
|
||||
.setMultiChoiceItems(subtitleNamesArray, checkedItems) { _, which, isChecked ->
|
||||
val subtitlePair = Pair(subtitles[which].file.url, subtitles[which].language)
|
||||
if (isChecked) {
|
||||
selectedSubtitles.add(subtitlePair)
|
||||
val alertDialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle("Download Subtitle")
|
||||
.setSingleChoiceItems(
|
||||
subtitleNames.toTypedArray(),
|
||||
-1
|
||||
) { _, which ->
|
||||
subtitleToDownload = subtitles[which]
|
||||
}
|
||||
.setPositiveButton("Download") { _, _ ->
|
||||
dialog?.dismiss()
|
||||
if (selectedVideo != null) {
|
||||
Helper.startAnimeDownloadService(
|
||||
activity,
|
||||
media!!.mainName(),
|
||||
episode.number,
|
||||
selectedVideo,
|
||||
subtitleToDownload,
|
||||
media,
|
||||
episode.thumb?.url ?: media!!.banner ?: media!!.cover
|
||||
)
|
||||
broadcastDownloadStarted(episode.number, activity)
|
||||
} else {
|
||||
selectedSubtitles.remove(subtitlePair)
|
||||
snackString("No Video Selected")
|
||||
}
|
||||
}
|
||||
.setPositiveButton(R.string.download) { _, _ ->
|
||||
dialog?.dismiss()
|
||||
checkAudioTracks()
|
||||
}
|
||||
.setNegativeButton(R.string.skip) { dialog, _ ->
|
||||
selectedSubtitles = mutableListOf()
|
||||
checkAudioTracks()
|
||||
.setNegativeButton("Skip") { dialog, _ ->
|
||||
subtitleToDownload = null
|
||||
if (selectedVideo != null) {
|
||||
Helper.startAnimeDownloadService(
|
||||
currActivity()!!,
|
||||
media!!.mainName(),
|
||||
episode.number,
|
||||
selectedVideo,
|
||||
subtitleToDownload,
|
||||
media,
|
||||
episode.thumb?.url ?: media!!.banner ?: media!!.cover
|
||||
)
|
||||
broadcastDownloadStarted(episode.number, activity)
|
||||
} else {
|
||||
snackString("No Video Selected")
|
||||
}
|
||||
dialog.dismiss()
|
||||
}
|
||||
.setNeutralButton(R.string.cancel) { dialog, _ ->
|
||||
selectedSubtitles = mutableListOf()
|
||||
.setNeutralButton("Cancel") { dialog, _ ->
|
||||
subtitleToDownload = null
|
||||
dialog.dismiss()
|
||||
}
|
||||
.show()
|
||||
alertDialog.window?.setDimAmount(0.8f)
|
||||
|
||||
} else {
|
||||
checkAudioTracks()
|
||||
if (selectedVideo != null) {
|
||||
Helper.startAnimeDownloadService(
|
||||
requireActivity(),
|
||||
media!!.mainName(),
|
||||
episode.number,
|
||||
selectedVideo,
|
||||
subtitleToDownload,
|
||||
media,
|
||||
episode.thumb?.url ?: media!!.banner ?: media!!.cover
|
||||
)
|
||||
broadcastDownloadStarted(episode.number, activity)
|
||||
} else {
|
||||
snackString("No Video Selected")
|
||||
}
|
||||
}
|
||||
}
|
||||
dismiss()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package ani.dantotsu.media.anime
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -20,13 +19,19 @@ import java.util.Locale
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
class TrackGroupDialogFragment(
|
||||
private var instance: ExoplayerView,
|
||||
private var trackGroups: ArrayList<Tracks.Group>,
|
||||
private var type: @TrackType Int,
|
||||
private var overrideTrackNames: List<Pair<String, String>>? = null
|
||||
instance: ExoplayerView, trackGroups: ArrayList<Tracks.Group>, type: @TrackType Int
|
||||
) : BottomSheetDialogFragment() {
|
||||
private var _binding: BottomSheetSubtitlesBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
private var instance: ExoplayerView
|
||||
private var trackGroups: ArrayList<Tracks.Group>
|
||||
private var type: @TrackType Int
|
||||
|
||||
init {
|
||||
this.instance = instance
|
||||
this.trackGroups = trackGroups
|
||||
this.type = type
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
@@ -58,16 +63,11 @@ class TrackGroupDialogFragment(
|
||||
)
|
||||
)
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@OptIn(UnstableApi::class)
|
||||
override fun onBindViewHolder(holder: StreamViewHolder, position: Int) {
|
||||
val binding = holder.binding
|
||||
trackGroups[position].let { trackGroup ->
|
||||
if (overrideTrackNames?.getOrNull(position - (trackGroups.size - (overrideTrackNames?.size?:0))) != null) {
|
||||
val pair = overrideTrackNames!![position - (trackGroups.size - overrideTrackNames!!.size)]
|
||||
binding.subtitleTitle.text =
|
||||
"[${pair.second}] ${pair.first}"
|
||||
} else when (val language = trackGroup.getTrackFormat(0).language?.lowercase()) {
|
||||
when (val language = trackGroup.getTrackFormat(0).language?.lowercase()) {
|
||||
null -> {
|
||||
binding.subtitleTitle.text =
|
||||
getString(R.string.unknown_track, "Track $position")
|
||||
@@ -94,6 +94,7 @@ class TrackGroupDialogFragment(
|
||||
}
|
||||
binding.subtitleTitle.text = locale?.let {
|
||||
"[${it.language}] ${it.displayName}"
|
||||
|
||||
} ?: getString(R.string.unknown_track, language)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import ani.dantotsu.copyToClipboard
|
||||
import ani.dantotsu.databinding.ItemCommentsBinding
|
||||
import ani.dantotsu.getAppString
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.openImage
|
||||
import ani.dantotsu.others.ImageViewDialog
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.setAnimation
|
||||
@@ -61,208 +60,211 @@ class CommentItem(
|
||||
override fun bind(viewBinding: ItemCommentsBinding, position: Int) {
|
||||
binding = viewBinding
|
||||
setAnimation(binding.root.context, binding.root)
|
||||
val item = this
|
||||
viewBinding.apply {
|
||||
commentRepliesList.layoutManager =
|
||||
LinearLayoutManager(commentsFragment.activity)
|
||||
commentRepliesList.adapter = adapter
|
||||
val isUserComment = CommentsAPI.userId == comment.userId
|
||||
val levelColor = getAvatarColor(comment.totalVotes, backgroundColor)
|
||||
markwon.setMarkdown(commentText, comment.content)
|
||||
commentEdit.visibility = if (isUserComment) View.VISIBLE else View.GONE
|
||||
if (comment.tag == null) {
|
||||
commentUserTagLayout.visibility = View.GONE
|
||||
} else {
|
||||
commentUserTagLayout.visibility = View.VISIBLE
|
||||
commentUserTag.text = comment.tag.toString()
|
||||
}
|
||||
replying(isReplying) //sets default text
|
||||
editing(isEditing)
|
||||
if ((comment.replyCount ?: 0) > 0) {
|
||||
commentTotalReplies.visibility = View.VISIBLE
|
||||
commentRepliesDivider.visibility = View.VISIBLE
|
||||
commentTotalReplies.context.run {
|
||||
commentTotalReplies.text = if (repliesVisible)
|
||||
getString(R.string.hide_replies)
|
||||
else
|
||||
if (comment.replyCount == 1)
|
||||
getString(R.string.view_reply)
|
||||
else
|
||||
getString(R.string.view_replies_count, comment.replyCount)
|
||||
}
|
||||
} else {
|
||||
commentTotalReplies.visibility = View.GONE
|
||||
commentRepliesDivider.visibility = View.GONE
|
||||
}
|
||||
commentReply.visibility = View.VISIBLE
|
||||
commentTotalReplies.setOnClickListener {
|
||||
if (repliesVisible) {
|
||||
repliesSection.clear()
|
||||
removeSubCommentIds()
|
||||
commentTotalReplies.context.run {
|
||||
commentTotalReplies.text = if (comment.replyCount == 1)
|
||||
getString(R.string.view_reply)
|
||||
else
|
||||
getString(R.string.view_replies_count, comment.replyCount)
|
||||
}
|
||||
repliesVisible = false
|
||||
} else {
|
||||
commentTotalReplies.setText(R.string.hide_replies)
|
||||
repliesSection.clear()
|
||||
commentsFragment.viewReplyCallback(item)
|
||||
repliesVisible = true
|
||||
}
|
||||
}
|
||||
|
||||
commentUserName.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
commentsFragment.activity,
|
||||
Intent(commentsFragment.activity, ProfileActivity::class.java)
|
||||
.putExtra("userId", comment.userId.toInt()),
|
||||
null
|
||||
)
|
||||
}
|
||||
commentUserAvatar.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
commentsFragment.activity,
|
||||
Intent(commentsFragment.activity, ProfileActivity::class.java)
|
||||
.putExtra("userId", comment.userId.toInt()),
|
||||
null
|
||||
)
|
||||
}
|
||||
commentText.setOnLongClickListener {
|
||||
copyToClipboard(comment.content)
|
||||
true
|
||||
}
|
||||
|
||||
commentEdit.setOnClickListener {
|
||||
editing(!isEditing)
|
||||
commentsFragment.editCallback(item)
|
||||
}
|
||||
commentReply.setOnClickListener {
|
||||
replying(!isReplying)
|
||||
commentsFragment.replyTo(item, comment.username)
|
||||
commentsFragment.replyCallback(item)
|
||||
}
|
||||
modBadge.visibility = if (comment.isMod == true) View.VISIBLE else View.GONE
|
||||
adminBadge.visibility =
|
||||
if (comment.isAdmin == true) View.VISIBLE else View.GONE
|
||||
commentInfo.setOnClickListener {
|
||||
val popup = PopupMenu(commentsFragment.requireContext(), commentInfo)
|
||||
popup.menuInflater.inflate(R.menu.profile_details_menu, popup.menu)
|
||||
popup.menu.findItem(R.id.commentDelete)?.isVisible =
|
||||
isUserComment || CommentsAPI.isAdmin || CommentsAPI.isMod
|
||||
popup.menu.findItem(R.id.commentBanUser)?.isVisible =
|
||||
(CommentsAPI.isAdmin || CommentsAPI.isMod) && !isUserComment
|
||||
popup.menu.findItem(R.id.commentReport)?.isVisible = !isUserComment
|
||||
popup.setOnMenuItemClickListener { item ->
|
||||
when (item.itemId) {
|
||||
R.id.commentReport -> {
|
||||
dialogBuilder(
|
||||
getAppString(R.string.report_comment),
|
||||
getAppString(R.string.report_comment_confirm)
|
||||
) {
|
||||
CoroutineScope(Dispatchers.Main + SupervisorJob()).launch {
|
||||
val success = CommentsAPI.reportComment(
|
||||
comment.commentId,
|
||||
comment.username,
|
||||
commentsFragment.mediaName,
|
||||
comment.userId
|
||||
)
|
||||
if (success) {
|
||||
snackString(R.string.comment_reported)
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
R.id.commentDelete -> {
|
||||
dialogBuilder(
|
||||
getAppString(R.string.delete_comment),
|
||||
getAppString(R.string.delete_comment_confirm)
|
||||
) {
|
||||
CoroutineScope(Dispatchers.Main + SupervisorJob()).launch {
|
||||
val success = CommentsAPI.deleteComment(comment.commentId)
|
||||
if (success) {
|
||||
snackString(R.string.comment_deleted)
|
||||
parentSection.remove(this@CommentItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
R.id.commentBanUser -> {
|
||||
dialogBuilder(
|
||||
getAppString(R.string.ban_user),
|
||||
getAppString(R.string.ban_user_confirm)
|
||||
) {
|
||||
CoroutineScope(Dispatchers.Main + SupervisorJob()).launch {
|
||||
val success = CommentsAPI.banUser(comment.userId)
|
||||
if (success) {
|
||||
snackString(R.string.user_banned)
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
popup.show()
|
||||
}
|
||||
//fill the icon if the user has liked the comment
|
||||
setVoteButtons(viewBinding)
|
||||
commentUpVote.setOnClickListener {
|
||||
val voteType = if (comment.userVoteType == 1) 0 else 1
|
||||
val previousVoteType = comment.userVoteType
|
||||
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
||||
scope.launch {
|
||||
val success = CommentsAPI.vote(comment.commentId, voteType)
|
||||
if (success) {
|
||||
comment.userVoteType = voteType
|
||||
|
||||
if (previousVoteType == -1) {
|
||||
comment.downvotes -= 1
|
||||
}
|
||||
comment.upvotes += if (voteType == 1) 1 else -1
|
||||
notifyChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
commentDownVote.setOnClickListener {
|
||||
val voteType = if (comment.userVoteType == -1) 0 else -1
|
||||
val previousVoteType = comment.userVoteType
|
||||
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
||||
scope.launch {
|
||||
val success = CommentsAPI.vote(comment.commentId, voteType)
|
||||
if (success) {
|
||||
comment.userVoteType = voteType
|
||||
if (previousVoteType == 1) {
|
||||
comment.upvotes -= 1
|
||||
}
|
||||
comment.downvotes += if (voteType == -1) 1 else -1
|
||||
notifyChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
commentTotalVotes.text = (comment.upvotes - comment.downvotes).toString()
|
||||
commentUserAvatar.openImage(
|
||||
commentsFragment.activity.getString(R.string.avatar, comment.username),
|
||||
comment.profilePictureUrl ?: ""
|
||||
)
|
||||
comment.profilePictureUrl?.let { commentUserAvatar.loadImage(it) }
|
||||
commentUserName.text = comment.username
|
||||
val userColor = "[${levelColor.second}]"
|
||||
commentUserLevel.text = userColor
|
||||
commentUserLevel.setTextColor(levelColor.first)
|
||||
commentUserTime.text = formatTimestamp(comment.timestamp)
|
||||
viewBinding.commentRepliesList.layoutManager =
|
||||
LinearLayoutManager(commentsFragment.activity)
|
||||
viewBinding.commentRepliesList.adapter = adapter
|
||||
val isUserComment = CommentsAPI.userId == comment.userId
|
||||
val levelColor = getAvatarColor(comment.totalVotes, backgroundColor)
|
||||
markwon.setMarkdown(viewBinding.commentText, comment.content)
|
||||
viewBinding.commentEdit.visibility = if (isUserComment) View.VISIBLE else View.GONE
|
||||
if (comment.tag == null) {
|
||||
viewBinding.commentUserTagLayout.visibility = View.GONE
|
||||
} else {
|
||||
viewBinding.commentUserTagLayout.visibility = View.VISIBLE
|
||||
viewBinding.commentUserTag.text = comment.tag.toString()
|
||||
}
|
||||
replying(isReplying) //sets default text
|
||||
editing(isEditing)
|
||||
if ((comment.replyCount ?: 0) > 0) {
|
||||
viewBinding.commentTotalReplies.visibility = View.VISIBLE
|
||||
viewBinding.commentRepliesDivider.visibility = View.VISIBLE
|
||||
viewBinding.commentTotalReplies.context.run {
|
||||
viewBinding.commentTotalReplies.text = if (repliesVisible)
|
||||
getString(R.string.hide_replies)
|
||||
else
|
||||
if (comment.replyCount == 1)
|
||||
getString(R.string.view_reply)
|
||||
else
|
||||
getString(R.string.view_replies_count, comment.replyCount)
|
||||
}
|
||||
} else {
|
||||
viewBinding.commentTotalReplies.visibility = View.GONE
|
||||
viewBinding.commentRepliesDivider.visibility = View.GONE
|
||||
}
|
||||
viewBinding.commentReply.visibility = View.VISIBLE
|
||||
viewBinding.commentTotalReplies.setOnClickListener {
|
||||
if (repliesVisible) {
|
||||
repliesSection.clear()
|
||||
removeSubCommentIds()
|
||||
viewBinding.commentTotalReplies.context.run {
|
||||
viewBinding.commentTotalReplies.text = if (comment.replyCount == 1)
|
||||
getString(R.string.view_reply)
|
||||
else
|
||||
getString(R.string.view_replies_count, comment.replyCount)
|
||||
}
|
||||
repliesVisible = false
|
||||
} else {
|
||||
viewBinding.commentTotalReplies.setText(R.string.hide_replies)
|
||||
repliesSection.clear()
|
||||
commentsFragment.viewReplyCallback(this)
|
||||
repliesVisible = true
|
||||
}
|
||||
}
|
||||
|
||||
viewBinding.commentUserName.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
commentsFragment.activity,
|
||||
Intent(commentsFragment.activity, ProfileActivity::class.java)
|
||||
.putExtra("userId", comment.userId.toInt())
|
||||
.putExtra("userLVL", "[${levelColor.second}]"),
|
||||
null
|
||||
)
|
||||
}
|
||||
viewBinding.commentUserAvatar.setOnClickListener {
|
||||
ContextCompat.startActivity(
|
||||
commentsFragment.activity,
|
||||
Intent(commentsFragment.activity, ProfileActivity::class.java)
|
||||
.putExtra("userId", comment.userId.toInt())
|
||||
.putExtra("userLVL", "[${levelColor.second}]"),
|
||||
null
|
||||
)
|
||||
}
|
||||
viewBinding.commentText.setOnLongClickListener {
|
||||
copyToClipboard(comment.content)
|
||||
true
|
||||
}
|
||||
|
||||
viewBinding.commentEdit.setOnClickListener {
|
||||
editing(!isEditing)
|
||||
commentsFragment.editCallback(this)
|
||||
}
|
||||
viewBinding.commentReply.setOnClickListener {
|
||||
replying(!isReplying)
|
||||
commentsFragment.replyTo(this, comment.username)
|
||||
commentsFragment.replyCallback(this)
|
||||
}
|
||||
viewBinding.modBadge.visibility = if (comment.isMod == true) View.VISIBLE else View.GONE
|
||||
viewBinding.adminBadge.visibility = if (comment.isAdmin == true) View.VISIBLE else View.GONE
|
||||
viewBinding.commentInfo.setOnClickListener {
|
||||
val popup = PopupMenu(commentsFragment.requireContext(), viewBinding.commentInfo)
|
||||
popup.menuInflater.inflate(R.menu.profile_details_menu, popup.menu)
|
||||
popup.menu.findItem(R.id.commentDelete)?.isVisible =
|
||||
isUserComment || CommentsAPI.isAdmin || CommentsAPI.isMod
|
||||
popup.menu.findItem(R.id.commentBanUser)?.isVisible =
|
||||
(CommentsAPI.isAdmin || CommentsAPI.isMod) && !isUserComment
|
||||
popup.menu.findItem(R.id.commentReport)?.isVisible = !isUserComment
|
||||
popup.setOnMenuItemClickListener { item ->
|
||||
when (item.itemId) {
|
||||
R.id.commentReport -> {
|
||||
dialogBuilder(
|
||||
getAppString(R.string.report_comment),
|
||||
getAppString(R.string.report_comment_confirm)
|
||||
) {
|
||||
CoroutineScope(Dispatchers.Main + SupervisorJob()).launch {
|
||||
val success = CommentsAPI.reportComment(
|
||||
comment.commentId,
|
||||
comment.username,
|
||||
commentsFragment.mediaName,
|
||||
comment.userId
|
||||
)
|
||||
if (success) {
|
||||
snackString(R.string.comment_reported)
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
R.id.commentDelete -> {
|
||||
dialogBuilder(
|
||||
getAppString(R.string.delete_comment),
|
||||
getAppString(R.string.delete_comment_confirm)
|
||||
) {
|
||||
CoroutineScope(Dispatchers.Main + SupervisorJob()).launch {
|
||||
val success = CommentsAPI.deleteComment(comment.commentId)
|
||||
if (success) {
|
||||
snackString(R.string.comment_deleted)
|
||||
parentSection.remove(this@CommentItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
R.id.commentBanUser -> {
|
||||
dialogBuilder(
|
||||
getAppString(R.string.ban_user),
|
||||
getAppString(R.string.ban_user_confirm)
|
||||
) {
|
||||
CoroutineScope(Dispatchers.Main + SupervisorJob()).launch {
|
||||
val success = CommentsAPI.banUser(comment.userId)
|
||||
if (success) {
|
||||
snackString(R.string.user_banned)
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
popup.show()
|
||||
}
|
||||
//fill the icon if the user has liked the comment
|
||||
setVoteButtons(viewBinding)
|
||||
viewBinding.commentUpVote.setOnClickListener {
|
||||
val voteType = if (comment.userVoteType == 1) 0 else 1
|
||||
val previousVoteType = comment.userVoteType
|
||||
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
||||
scope.launch {
|
||||
val success = CommentsAPI.vote(comment.commentId, voteType)
|
||||
if (success) {
|
||||
comment.userVoteType = voteType
|
||||
|
||||
if (previousVoteType == -1) {
|
||||
comment.downvotes -= 1
|
||||
}
|
||||
comment.upvotes += if (voteType == 1) 1 else -1
|
||||
|
||||
notifyChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewBinding.commentDownVote.setOnClickListener {
|
||||
val voteType = if (comment.userVoteType == -1) 0 else -1
|
||||
val previousVoteType = comment.userVoteType
|
||||
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
||||
scope.launch {
|
||||
val success = CommentsAPI.vote(comment.commentId, voteType)
|
||||
if (success) {
|
||||
comment.userVoteType = voteType
|
||||
|
||||
if (previousVoteType == 1) {
|
||||
comment.upvotes -= 1
|
||||
}
|
||||
comment.downvotes += if (voteType == -1) 1 else -1
|
||||
notifyChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
viewBinding.commentTotalVotes.text = (comment.upvotes - comment.downvotes).toString()
|
||||
viewBinding.commentUserAvatar.setOnLongClickListener {
|
||||
ImageViewDialog.newInstance(
|
||||
commentsFragment.activity,
|
||||
"${comment.username}'s [Cover]",
|
||||
comment.profilePictureUrl
|
||||
)
|
||||
}
|
||||
comment.profilePictureUrl?.let { viewBinding.commentUserAvatar.loadImage(it) }
|
||||
viewBinding.commentUserName.text = comment.username
|
||||
val userColor = "[${levelColor.second}]"
|
||||
viewBinding.commentUserLevel.text = userColor
|
||||
viewBinding.commentUserLevel.setTextColor(levelColor.first)
|
||||
viewBinding.commentUserTime.text = formatTimestamp(comment.timestamp)
|
||||
}
|
||||
|
||||
override fun getLayout(): Int {
|
||||
|
||||
@@ -121,6 +121,7 @@ class CommentsFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
toast("Not logged in")
|
||||
activity.binding.commentMessageContainer.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ani.dantotsu.media.manga
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -16,7 +17,6 @@ import ani.dantotsu.databinding.ItemEpisodeCompactBinding
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaNameAdapter
|
||||
import ani.dantotsu.setAnimation
|
||||
import ani.dantotsu.util.customAlertDialog
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -145,6 +145,8 @@ class MangaChapterAdapter(
|
||||
inner class ChapterListViewHolder(val binding: ItemChapterListBinding) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
private val activeCoroutines = mutableSetOf<String>()
|
||||
private val typedValue1 = TypedValue()
|
||||
private val typedValue2 = TypedValue()
|
||||
fun bind(chapterNumber: String, progress: String?) {
|
||||
if (progress != null) {
|
||||
binding.itemChapterTitle.visibility = View.VISIBLE
|
||||
@@ -199,6 +201,17 @@ class MangaChapterAdapter(
|
||||
}
|
||||
|
||||
init {
|
||||
val theme = currContext()?.theme
|
||||
theme?.resolveAttribute(
|
||||
com.google.android.material.R.attr.colorError,
|
||||
typedValue1,
|
||||
true
|
||||
)
|
||||
theme?.resolveAttribute(
|
||||
com.google.android.material.R.attr.colorPrimary,
|
||||
typedValue2,
|
||||
true
|
||||
)
|
||||
itemView.setOnClickListener {
|
||||
if (0 <= bindingAdapterPosition && bindingAdapterPosition < arr.size)
|
||||
fragment.onMangaChapterClick(arr[bindingAdapterPosition].number)
|
||||
@@ -210,15 +223,16 @@ class MangaChapterAdapter(
|
||||
fragment.onMangaChapterStopDownloadClick(chapterNumber)
|
||||
return@setOnClickListener
|
||||
} else if (downloadedChapters.contains(chapterNumber)) {
|
||||
it.context.customAlertDialog().apply {
|
||||
setTitle("Delete Chapter")
|
||||
setMessage("Are you sure you want to delete ${chapterNumber}?")
|
||||
setPosButton(R.string.delete) {
|
||||
fragment.onMangaChapterRemoveDownloadClick(chapterNumber)
|
||||
}
|
||||
setNegButton(R.string.cancel)
|
||||
show()
|
||||
val builder = AlertDialog.Builder(currContext(), R.style.MyPopup)
|
||||
builder.setTitle("Delete Chapter")
|
||||
builder.setMessage("Are you sure you want to delete ${chapterNumber}?")
|
||||
builder.setPositiveButton("Yes") { _, _ ->
|
||||
fragment.onMangaChapterRemoveDownloadClick(chapterNumber)
|
||||
}
|
||||
builder.setNegativeButton("No") { _, _ ->
|
||||
}
|
||||
val dialog = builder.show()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
return@setOnClickListener
|
||||
} else {
|
||||
fragment.onMangaChapterDownloadClick(chapterNumber)
|
||||
@@ -228,20 +242,20 @@ class MangaChapterAdapter(
|
||||
}
|
||||
binding.itemDownload.setOnLongClickListener {
|
||||
//Alert dialog asking for the number of chapters to download
|
||||
it.context.customAlertDialog().apply {
|
||||
setTitle("Multi Chapter Downloader")
|
||||
setMessage("Enter the number of chapters to download")
|
||||
val input = NumberPicker(currContext())
|
||||
input.minValue = 1
|
||||
input.maxValue = itemCount - bindingAdapterPosition
|
||||
input.value = 1
|
||||
setCustomView(input)
|
||||
setPosButton("OK") {
|
||||
downloadNChaptersFrom(bindingAdapterPosition, input.value)
|
||||
}
|
||||
setNegButton("Cancel")
|
||||
show()
|
||||
val alertDialog = AlertDialog.Builder(currContext(), R.style.MyPopup)
|
||||
alertDialog.setTitle("Multi Chapter Downloader")
|
||||
alertDialog.setMessage("Enter the number of chapters to download")
|
||||
val input = NumberPicker(currContext())
|
||||
input.minValue = 1
|
||||
input.maxValue = itemCount - bindingAdapterPosition
|
||||
input.value = 1
|
||||
alertDialog.setView(input)
|
||||
alertDialog.setPositiveButton("OK") { _, _ ->
|
||||
downloadNChaptersFrom(bindingAdapterPosition, input.value)
|
||||
}
|
||||
alertDialog.setNegativeButton("Cancel") { dialog, _ -> dialog.cancel() }
|
||||
val dialog = alertDialog.show()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
@@ -102,9 +102,6 @@ class MangaReadAdapter(
|
||||
showUserTextListener = { MainScope().launch { binding.animeSourceTitle.text = it } }
|
||||
}
|
||||
}
|
||||
media.selected?.scanlators?.let {
|
||||
hiddenScanlators.addAll(it)
|
||||
}
|
||||
binding.animeSource.setAdapter(
|
||||
ArrayAdapter(
|
||||
fragment.requireContext(),
|
||||
@@ -130,7 +127,7 @@ class MangaReadAdapter(
|
||||
// Check if 'extension' and 'selected' properties exist and are accessible
|
||||
(mangaReadSources[source] as? DynamicMangaParser)?.let { ext ->
|
||||
ext.sourceLanguage = i
|
||||
fragment.onLangChange(i, ext.saveName)
|
||||
fragment.onLangChange(i)
|
||||
fragment.onSourceChange(media.selected!!.sourceIndex).apply {
|
||||
binding.animeSourceTitle.text = showUserText
|
||||
showUserTextListener =
|
||||
@@ -548,7 +545,7 @@ class MangaReadAdapter(
|
||||
val adapter = ArrayAdapter(
|
||||
fragment.requireContext(),
|
||||
R.layout.item_dropdown,
|
||||
parser.extension.sources.map { LanguageMapper.getLanguageName(it.lang) }
|
||||
parser.extension.sources.map { LanguageMapper.mapLanguageCodeToName(it.lang) }
|
||||
)
|
||||
val items = adapter.count
|
||||
binding?.animeSourceLanguageContainer?.isVisible = items > 1
|
||||
|
||||
@@ -194,8 +194,8 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
||||
)
|
||||
|
||||
for (download in downloadManager.mangaDownloadedTypes) {
|
||||
if (media.compareName(download.titleName)) {
|
||||
chapterAdapter.stopDownload(download.chapterName)
|
||||
if (media.compareName(download.title)) {
|
||||
chapterAdapter.stopDownload(download.chapter)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,12 +321,11 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
||||
return model.mangaReadSources?.get(i)!!
|
||||
}
|
||||
|
||||
fun onLangChange(i: Int, saveName: String) {
|
||||
fun onLangChange(i: Int) {
|
||||
val selected = model.loadSelected(media)
|
||||
selected.langIndex = i
|
||||
model.saveSelected(media.id, selected)
|
||||
media.selected = selected
|
||||
PrefManager.removeCustomVal("${saveName}_${media.id}")
|
||||
}
|
||||
|
||||
fun onScanlatorChange(list: List<String>) {
|
||||
@@ -385,7 +384,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
||||
var selectedSetting = allSettings[0]
|
||||
if (allSettings.size > 1) {
|
||||
val names =
|
||||
allSettings.map { LanguageMapper.getLanguageName(it.lang) }.toTypedArray()
|
||||
allSettings.map { LanguageMapper.mapLanguageCodeToName(it.lang) }.toTypedArray()
|
||||
val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup)
|
||||
.setTitle("Select a Source")
|
||||
.setSingleChoiceItems(names, -1) { dialog, which ->
|
||||
|
||||
@@ -3,6 +3,7 @@ package ani.dantotsu.media.manga.mangareader
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -13,7 +14,6 @@ import ani.dantotsu.BottomSheetDialogFragment
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.currActivity
|
||||
import ani.dantotsu.databinding.BottomSheetSelectorBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.media.MediaDetailsViewModel
|
||||
import ani.dantotsu.media.MediaSingleton
|
||||
import ani.dantotsu.media.manga.MangaChapter
|
||||
@@ -78,7 +78,10 @@ class ChapterLoaderDialog : BottomSheetDialogFragment() {
|
||||
_binding = BottomSheetSelectorBinding.inflate(inflater, container, false)
|
||||
val window = dialog?.window
|
||||
window?.statusBarColor = Color.TRANSPARENT
|
||||
window?.navigationBarColor = requireContext().getThemeColor(com.google.android.material.R.attr.colorSurface)
|
||||
val typedValue = TypedValue()
|
||||
val theme = requireContext().theme
|
||||
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
|
||||
window?.navigationBarColor = typedValue.data
|
||||
return binding.root
|
||||
}
|
||||
|
||||
|
||||
@@ -187,10 +187,6 @@ class MangaReaderActivity : AppCompatActivity() {
|
||||
defaultSettings = loadReaderSettings("reader_settings") ?: defaultSettings
|
||||
|
||||
onBackPressedDispatcher.addCallback(this) {
|
||||
if (!::media.isInitialized) {
|
||||
finish()
|
||||
return@addCallback
|
||||
}
|
||||
val chapter = (MediaNameAdapter.findChapterNumber(media.manga!!.selectedChapter!!)
|
||||
?.minus(1L) ?: 0).toString()
|
||||
if (chapter == "0.0" && PrefManager.getVal(PrefName.ChapterZeroReader)
|
||||
|
||||
@@ -117,10 +117,9 @@ class NovelReadFragment : Fragment(),
|
||||
context ?: currContext()!!,
|
||||
MediaType.NOVEL,
|
||||
false,
|
||||
media.mainName(),
|
||||
novel.name
|
||||
)
|
||||
val file = directory?.findFile("0.epub")
|
||||
val file = directory?.findFile(novel.name)
|
||||
if (file?.exists() == false) return false
|
||||
val fileUri = file?.uri ?: return false
|
||||
val intent = Intent(context, NovelReaderActivity::class.java).apply {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ani.dantotsu.media.novel
|
||||
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
@@ -7,8 +8,6 @@ import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.ItemNovelResponseBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.parsers.ShowResponse
|
||||
import ani.dantotsu.setAnimation
|
||||
import ani.dantotsu.snackString
|
||||
@@ -38,9 +37,19 @@ class NovelResponseAdapter(
|
||||
val binding = holder.binding
|
||||
val novel = list[position]
|
||||
setAnimation(fragment.requireContext(), holder.binding.root)
|
||||
binding.itemEpisodeImage.loadImage(novel.coverUrl, 400, 0)
|
||||
|
||||
val color =fragment.requireContext().getThemeColor(com.google.android.material.R.attr.colorOnBackground)
|
||||
val cover = GlideUrl(novel.coverUrl.url) { novel.coverUrl.headers }
|
||||
Glide.with(binding.itemEpisodeImage).load(cover).override(400, 0)
|
||||
.into(binding.itemEpisodeImage)
|
||||
|
||||
val typedValue = TypedValue()
|
||||
fragment.requireContext().theme?.resolveAttribute(
|
||||
com.google.android.material.R.attr.colorOnBackground,
|
||||
typedValue,
|
||||
true
|
||||
)
|
||||
val color = typedValue.data
|
||||
|
||||
binding.itemEpisodeTitle.text = novel.name
|
||||
binding.itemEpisodeFiller.text =
|
||||
if (downloadedCheckCallback.downloadedCheck(novel)) {
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
package ani.dantotsu.media.user
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.Refresh
|
||||
import ani.dantotsu.databinding.ActivityListBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.hideSystemBarsExtendView
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
@@ -29,7 +26,6 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
|
||||
class ListActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityListBinding
|
||||
private val scope = lifecycleScope
|
||||
@@ -41,9 +37,15 @@ class ListActivity : AppCompatActivity() {
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivityListBinding.inflate(layoutInflater)
|
||||
|
||||
val primaryColor = getThemeColor(com.google.android.material.R.attr.colorSurface)
|
||||
val primaryTextColor = getThemeColor(com.google.android.material.R.attr.colorPrimary)
|
||||
val secondaryTextColor = getThemeColor(com.google.android.material.R.attr.colorOutline)
|
||||
val typedValue = TypedValue()
|
||||
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
|
||||
val primaryColor = typedValue.data
|
||||
val typedValue3 = TypedValue()
|
||||
theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue3, true)
|
||||
val primaryTextColor = typedValue3.data
|
||||
val typedValue4 = TypedValue()
|
||||
theme.resolveAttribute(com.google.android.material.R.attr.colorOutline, typedValue4, true)
|
||||
val secondaryTextColor = typedValue4.data
|
||||
|
||||
window.statusBarColor = primaryColor
|
||||
window.navigationBarColor = primaryColor
|
||||
@@ -181,28 +183,5 @@ class ListActivity : AppCompatActivity() {
|
||||
supportFragmentManager.findFragmentByTag("f" + currentTab?.position.toString()) as? ListFragment
|
||||
currentFragment?.randomOptionClick()
|
||||
}
|
||||
|
||||
binding.search.setOnClickListener {
|
||||
toggleSearchView(binding.searchView.isVisible)
|
||||
if (!binding.searchView.isVisible) {
|
||||
model.unfilterLists()
|
||||
}
|
||||
}
|
||||
|
||||
binding.searchViewText.addTextChangedListener {
|
||||
model.searchLists(binding.searchViewText.text.toString())
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleSearchView(isVisible: Boolean) {
|
||||
if (isVisible) {
|
||||
binding.searchView.visibility = View.GONE
|
||||
binding.searchViewText.text.clear()
|
||||
} else {
|
||||
binding.searchView.visibility = View.VISIBLE
|
||||
binding.searchViewText.requestFocus()
|
||||
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.showSoftInput(binding.searchViewText, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,30 +38,4 @@ class ListViewModel : ViewModel() {
|
||||
lists.postValue(filteredLists)
|
||||
}
|
||||
|
||||
fun searchLists(search: String) {
|
||||
if (search.isEmpty()) {
|
||||
lists.postValue(unfilteredLists.value)
|
||||
return
|
||||
}
|
||||
val currentLists = unfilteredLists.value ?: return
|
||||
val filteredLists = currentLists.mapValues { entry ->
|
||||
entry.value.filter { media ->
|
||||
media.name?.contains(
|
||||
search,
|
||||
ignoreCase = true
|
||||
) == true || media.synonyms.any { it.contains(search, ignoreCase = true) } ||
|
||||
media.nameRomaji.contains(
|
||||
search,
|
||||
ignoreCase = true
|
||||
)
|
||||
} as ArrayList<Media>
|
||||
}.toMutableMap()
|
||||
|
||||
lists.postValue(filteredLists)
|
||||
}
|
||||
|
||||
fun unfilterLists() {
|
||||
lists.postValue(unfilteredLists.value)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,6 +36,28 @@ interface TaskScheduler {
|
||||
}
|
||||
}
|
||||
|
||||
fun scheduleSingleWork(context: Context) {
|
||||
val workManager = androidx.work.WorkManager.getInstance(context)
|
||||
workManager.enqueueUniqueWork(
|
||||
CommentNotificationWorker.WORK_NAME,
|
||||
androidx.work.ExistingWorkPolicy.REPLACE,
|
||||
androidx.work.OneTimeWorkRequest.Builder(CommentNotificationWorker::class.java)
|
||||
.build()
|
||||
)
|
||||
workManager.enqueueUniqueWork(
|
||||
AnilistNotificationWorker.WORK_NAME,
|
||||
androidx.work.ExistingWorkPolicy.REPLACE,
|
||||
androidx.work.OneTimeWorkRequest.Builder(AnilistNotificationWorker::class.java)
|
||||
.build()
|
||||
)
|
||||
workManager.enqueueUniqueWork(
|
||||
SubscriptionNotificationWorker.WORK_NAME,
|
||||
androidx.work.ExistingWorkPolicy.REPLACE,
|
||||
androidx.work.OneTimeWorkRequest.Builder(SubscriptionNotificationWorker::class.java)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun create(context: Context, useAlarmManager: Boolean): TaskScheduler {
|
||||
return if (useAlarmManager) {
|
||||
@@ -44,28 +66,6 @@ interface TaskScheduler {
|
||||
WorkManagerScheduler(context)
|
||||
}
|
||||
}
|
||||
|
||||
fun scheduleSingleWork(context: Context) {
|
||||
val workManager = androidx.work.WorkManager.getInstance(context)
|
||||
workManager.enqueueUniqueWork(
|
||||
CommentNotificationWorker.WORK_NAME + "_single",
|
||||
androidx.work.ExistingWorkPolicy.REPLACE,
|
||||
androidx.work.OneTimeWorkRequest.Builder(CommentNotificationWorker::class.java)
|
||||
.build()
|
||||
)
|
||||
workManager.enqueueUniqueWork(
|
||||
AnilistNotificationWorker.WORK_NAME + "_single",
|
||||
androidx.work.ExistingWorkPolicy.REPLACE,
|
||||
androidx.work.OneTimeWorkRequest.Builder(AnilistNotificationWorker::class.java)
|
||||
.build()
|
||||
)
|
||||
workManager.enqueueUniqueWork(
|
||||
SubscriptionNotificationWorker.WORK_NAME + "_single",
|
||||
androidx.work.ExistingWorkPolicy.REPLACE,
|
||||
androidx.work.OneTimeWorkRequest.Builder(SubscriptionNotificationWorker::class.java)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
enum class TaskType {
|
||||
|
||||
@@ -30,7 +30,7 @@ class CommentNotificationTask : Task {
|
||||
withContext(Dispatchers.IO) {
|
||||
PrefManager.init(context) //make sure prefs are initialized
|
||||
val client = OkHttpClient()
|
||||
CommentsAPI.fetchAuthToken(context, client)
|
||||
CommentsAPI.fetchAuthToken(client)
|
||||
val notificationResponse = CommentsAPI.getNotifications(client)
|
||||
var notifications = notificationResponse?.notifications?.toMutableList()
|
||||
//if we have at least one reply notification, we need to fetch the media titles
|
||||
@@ -64,7 +64,7 @@ class CommentNotificationTask : Task {
|
||||
val type: CommentNotificationWorker.NotificationType = when (it.type) {
|
||||
1 -> CommentNotificationWorker.NotificationType.COMMENT_REPLY
|
||||
2 -> CommentNotificationWorker.NotificationType.COMMENT_WARNING
|
||||
3 -> CommentNotificationWorker.NotificationType.DANTOTSU_UPDATE
|
||||
3 -> CommentNotificationWorker.NotificationType.APP_GLOBAL
|
||||
420 -> CommentNotificationWorker.NotificationType.NO_NOTIFICATION
|
||||
else -> CommentNotificationWorker.NotificationType.UNKNOWN
|
||||
}
|
||||
@@ -76,7 +76,6 @@ class CommentNotificationTask : Task {
|
||||
val commentStore = CommentStore(
|
||||
title,
|
||||
message,
|
||||
CommentNotificationWorker.NotificationType.COMMENT_WARNING,
|
||||
it.mediaId,
|
||||
it.commentId
|
||||
)
|
||||
@@ -102,7 +101,6 @@ class CommentNotificationTask : Task {
|
||||
val commentStore = CommentStore(
|
||||
title,
|
||||
message,
|
||||
CommentNotificationWorker.NotificationType.COMMENT_REPLY,
|
||||
it.mediaId,
|
||||
it.commentId
|
||||
)
|
||||
@@ -120,14 +118,13 @@ class CommentNotificationTask : Task {
|
||||
)
|
||||
}
|
||||
|
||||
CommentNotificationWorker.NotificationType.DANTOTSU_UPDATE -> {
|
||||
CommentNotificationWorker.NotificationType.APP_GLOBAL -> {
|
||||
val title = "Update from Dantotsu"
|
||||
val message = it.content ?: "New feature available"
|
||||
|
||||
val commentStore = CommentStore(
|
||||
title,
|
||||
message,
|
||||
CommentNotificationWorker.NotificationType.DANTOTSU_UPDATE,
|
||||
null,
|
||||
null
|
||||
)
|
||||
@@ -135,7 +132,7 @@ class CommentNotificationTask : Task {
|
||||
|
||||
createNotification(
|
||||
context,
|
||||
CommentNotificationWorker.NotificationType.DANTOTSU_UPDATE,
|
||||
CommentNotificationWorker.NotificationType.APP_GLOBAL,
|
||||
message,
|
||||
title,
|
||||
0,
|
||||
@@ -188,7 +185,7 @@ class CommentNotificationTask : Task {
|
||||
null
|
||||
) ?: listOf()
|
||||
val newStore = notificationStore.toMutableList()
|
||||
if (newStore.size > 30) {
|
||||
if (newStore.size > 10) {
|
||||
newStore.remove(newStore.minByOrNull { it.time })
|
||||
}
|
||||
if (newStore.any { it.content == notification.content }) {
|
||||
@@ -268,7 +265,7 @@ class CommentNotificationTask : Task {
|
||||
builder.build()
|
||||
}
|
||||
|
||||
CommentNotificationWorker.NotificationType.DANTOTSU_UPDATE -> {
|
||||
CommentNotificationWorker.NotificationType.APP_GLOBAL -> {
|
||||
val intent = Intent(context, MainActivity::class.java).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class CommentNotificationWorker(appContext: Context, workerParams: WorkerParamet
|
||||
enum class NotificationType(val id: String) {
|
||||
COMMENT_REPLY(Notifications.CHANNEL_COMMENTS),
|
||||
COMMENT_WARNING(Notifications.CHANNEL_COMMENT_WARING),
|
||||
DANTOTSU_UPDATE(Notifications.CHANNEL_APP_GLOBAL),
|
||||
APP_GLOBAL(Notifications.CHANNEL_APP_GLOBAL),
|
||||
NO_NOTIFICATION("no_notification"),
|
||||
UNKNOWN("unknown")
|
||||
}
|
||||
|
||||
@@ -3,16 +3,18 @@ package ani.dantotsu.notifications.comment
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
@Suppress("INAPPROPRIATE_CONST_NAME")
|
||||
@Serializable
|
||||
data class CommentStore(
|
||||
val title: String,
|
||||
val content: String,
|
||||
val type: CommentNotificationWorker.NotificationType,
|
||||
val mediaId: Int? = null,
|
||||
val commentId: Int? = null,
|
||||
val time: Long = System.currentTimeMillis(),
|
||||
) : java.io.Serializable {
|
||||
companion object {
|
||||
private const val serialVersionUID = 2L
|
||||
|
||||
@Suppress("INAPPROPRIATE_CONST_NAME")
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
@@ -5,18 +5,14 @@ import ani.dantotsu.currContext
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaNameAdapter
|
||||
import ani.dantotsu.media.Selected
|
||||
import ani.dantotsu.media.emptyMedia
|
||||
import ani.dantotsu.parsers.AnimeParser
|
||||
import ani.dantotsu.parsers.AnimeSources
|
||||
import ani.dantotsu.parsers.BaseParser
|
||||
import ani.dantotsu.parsers.Episode
|
||||
import ani.dantotsu.parsers.MangaChapter
|
||||
import ani.dantotsu.parsers.MangaParser
|
||||
import ani.dantotsu.parsers.MangaSources
|
||||
import ani.dantotsu.parsers.ShowResponse
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.tryWithSuspend
|
||||
import ani.dantotsu.util.Logger
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
@@ -27,7 +23,7 @@ class SubscriptionHelper {
|
||||
mediaId: Int
|
||||
): Selected {
|
||||
val data =
|
||||
PrefManager.getNullableCustomVal("Selected-${mediaId}", null, Selected::class.java)
|
||||
PrefManager.getNullableCustomVal("${mediaId}-select", null, Selected::class.java)
|
||||
?: Selected().let {
|
||||
it.sourceIndex = 0
|
||||
it.preferDub = PrefManager.getVal(PrefName.SettingsPreferDub)
|
||||
@@ -37,16 +33,13 @@ class SubscriptionHelper {
|
||||
}
|
||||
|
||||
private fun saveSelected(mediaId: Int, data: Selected) {
|
||||
PrefManager.setCustomVal("Selected-${mediaId}", data)
|
||||
PrefManager.setCustomVal("${mediaId}-select", data)
|
||||
}
|
||||
|
||||
fun getAnimeParser(id: Int): AnimeParser {
|
||||
val sources = AnimeSources
|
||||
Logger.log("getAnimeParser size: ${sources.list.size}")
|
||||
val selected = loadSelected(id)
|
||||
if (selected.sourceIndex >= sources.list.size) {
|
||||
selected.sourceIndex = 0
|
||||
}
|
||||
val parser = sources[selected.sourceIndex]
|
||||
parser.selectDub = selected.preferDub
|
||||
return parser
|
||||
@@ -54,18 +47,16 @@ class SubscriptionHelper {
|
||||
|
||||
suspend fun getEpisode(
|
||||
parser: AnimeParser,
|
||||
subscribeMedia: SubscribeMedia
|
||||
id: Int
|
||||
): Episode? {
|
||||
|
||||
val selected = loadSelected(subscribeMedia.id)
|
||||
val selected = loadSelected(id)
|
||||
val ep = withTimeoutOrNull(10 * 1000) {
|
||||
tryWithSuspend {
|
||||
val show = parser.loadSavedShowResponse(subscribeMedia.id)
|
||||
?: forceLoadShowResponse(subscribeMedia, selected, parser)
|
||||
?: throw Exception(
|
||||
val show = parser.loadSavedShowResponse(id) ?: throw Exception(
|
||||
currContext()?.getString(
|
||||
R.string.failed_to_load_data,
|
||||
subscribeMedia.id
|
||||
id
|
||||
)
|
||||
)
|
||||
show.sAnime?.let {
|
||||
@@ -79,33 +70,27 @@ class SubscriptionHelper {
|
||||
|
||||
return ep?.apply {
|
||||
selected.latest = number.toFloat()
|
||||
saveSelected(subscribeMedia.id, selected)
|
||||
saveSelected(id, selected)
|
||||
}
|
||||
}
|
||||
|
||||
fun getMangaParser(id: Int): MangaParser {
|
||||
val sources = MangaSources
|
||||
Logger.log("getMangaParser size: ${sources.list.size}")
|
||||
val selected = loadSelected(id)
|
||||
if (selected.sourceIndex >= sources.list.size) {
|
||||
selected.sourceIndex = 0
|
||||
}
|
||||
return sources[selected.sourceIndex]
|
||||
}
|
||||
|
||||
suspend fun getChapter(
|
||||
parser: MangaParser,
|
||||
subscribeMedia: SubscribeMedia
|
||||
id: Int
|
||||
): MangaChapter? {
|
||||
val selected = loadSelected(subscribeMedia.id)
|
||||
val selected = loadSelected(id)
|
||||
val chp = withTimeoutOrNull(10 * 1000) {
|
||||
tryWithSuspend {
|
||||
val show = parser.loadSavedShowResponse(subscribeMedia.id)
|
||||
?: forceLoadShowResponse(subscribeMedia, selected, parser)
|
||||
?: throw Exception(
|
||||
val show = parser.loadSavedShowResponse(id) ?: throw Exception(
|
||||
currContext()?.getString(
|
||||
R.string.failed_to_load_data,
|
||||
subscribeMedia.id
|
||||
id
|
||||
)
|
||||
)
|
||||
show.sManga?.let {
|
||||
@@ -119,40 +104,17 @@ class SubscriptionHelper {
|
||||
|
||||
return chp?.apply {
|
||||
selected.latest = MediaNameAdapter.findChapterNumber(number) ?: 0f
|
||||
saveSelected(subscribeMedia.id, selected)
|
||||
saveSelected(id, selected)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun forceLoadShowResponse(subscribeMedia: SubscribeMedia, selected: Selected, parser: BaseParser): ShowResponse? {
|
||||
val tempMedia = Media(
|
||||
id = subscribeMedia.id,
|
||||
name = null,
|
||||
nameRomaji = subscribeMedia.name,
|
||||
userPreferredName = subscribeMedia.name,
|
||||
isAdult = subscribeMedia.isAdult,
|
||||
isFav = false,
|
||||
isListPrivate = false,
|
||||
userScore = 0,
|
||||
userRepeat = 0,
|
||||
format = null,
|
||||
selected = selected
|
||||
)
|
||||
parser.autoSearch(tempMedia)
|
||||
return parser.loadSavedShowResponse(subscribeMedia.id)
|
||||
}
|
||||
|
||||
data class SubscribeMedia(
|
||||
val isAnime: Boolean,
|
||||
val isAdult: Boolean,
|
||||
val id: Int,
|
||||
val name: String,
|
||||
val image: String?,
|
||||
val banner: String? = null
|
||||
) : java.io.Serializable {
|
||||
companion object {
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
val image: String?
|
||||
) : java.io.Serializable
|
||||
|
||||
private const val SUBSCRIPTIONS = "subscriptions"
|
||||
|
||||
@@ -165,19 +127,6 @@ class SubscriptionHelper {
|
||||
) as? Map<Int, SubscribeMedia>)
|
||||
?: mapOf<Int, SubscribeMedia>().also { PrefManager.setCustomVal(SUBSCRIPTIONS, it) }
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun deleteSubscription(id: Int, showSnack: Boolean = false) {
|
||||
val data = PrefManager.getNullableCustomVal(
|
||||
SUBSCRIPTIONS,
|
||||
null,
|
||||
Map::class.java
|
||||
) as? MutableMap<Int, SubscribeMedia>
|
||||
?: mutableMapOf()
|
||||
data.remove(id)
|
||||
PrefManager.setCustomVal(SUBSCRIPTIONS, data)
|
||||
if (showSnack) toast(R.string.subscription_deleted)
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun saveSubscription(media: Media, subscribed: Boolean) {
|
||||
val data = PrefManager.getNullableCustomVal(
|
||||
@@ -193,8 +142,7 @@ class SubscriptionHelper {
|
||||
media.isAdult,
|
||||
media.id,
|
||||
media.userPreferredName,
|
||||
media.cover,
|
||||
media.banner
|
||||
media.cover
|
||||
)
|
||||
data[media.id] = new
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class SubscriptionNotificationTask : Task {
|
||||
val ep: Episode? =
|
||||
SubscriptionHelper.getEpisode(
|
||||
parser,
|
||||
media
|
||||
media.id
|
||||
)
|
||||
if (ep != null) context.getString(R.string.episode) + "${ep.number}${
|
||||
if (ep.title != null) " : ${ep.title}" else ""
|
||||
@@ -113,22 +113,11 @@ class SubscriptionNotificationTask : Task {
|
||||
val ep: MangaChapter? =
|
||||
SubscriptionHelper.getChapter(
|
||||
parser,
|
||||
media
|
||||
media.id
|
||||
)
|
||||
if (ep != null) ep.number + " " + context.getString(R.string.just_released) to null
|
||||
else null
|
||||
} ?: return@map
|
||||
addSubscriptionToStore(
|
||||
SubscriptionStore(
|
||||
media.name,
|
||||
text.first,
|
||||
media.id,
|
||||
image = media.image,
|
||||
banner = media.banner
|
||||
)
|
||||
)
|
||||
PrefManager.setVal(PrefName.UnreadCommentNotifications,
|
||||
PrefManager.getVal<Int>(PrefName.UnreadCommentNotifications) + 1)
|
||||
val notification = createNotification(
|
||||
context.applicationContext,
|
||||
media,
|
||||
@@ -230,21 +219,4 @@ class SubscriptionNotificationTask : Task {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun addSubscriptionToStore(notification: SubscriptionStore) {
|
||||
val notificationStore = PrefManager.getNullableVal<List<SubscriptionStore>>(
|
||||
PrefName.SubscriptionNotificationStore,
|
||||
null
|
||||
) ?: listOf()
|
||||
val newStore = notificationStore.toMutableList()
|
||||
if (newStore.size >= 100) {
|
||||
newStore.remove(newStore.minByOrNull { it.time })
|
||||
}
|
||||
if (newStore.any { it.title == notification.title && it.content == notification.content}) {
|
||||
return
|
||||
}
|
||||
|
||||
newStore.add(notification)
|
||||
PrefManager.setVal(PrefName.SubscriptionNotificationStore, newStore)
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package ani.dantotsu.notifications.subscription
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class SubscriptionStore(
|
||||
val title: String,
|
||||
val content: String,
|
||||
val mediaId: Int,
|
||||
val type: String = "SUBSCRIPTION",
|
||||
val time: Long = System.currentTimeMillis(),
|
||||
val image: String? = "",
|
||||
val banner: String? = "",
|
||||
) : java.io.Serializable {
|
||||
companion object {
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.fragment.app.Fragment
|
||||
import ani.dantotsu.R
|
||||
@@ -31,15 +30,10 @@ class OfflineFragment : Fragment() {
|
||||
offline = PrefManager.getVal(PrefName.OfflineMode)
|
||||
binding.noInternet.text =
|
||||
if (offline) "Offline Mode" else getString(R.string.no_internet)
|
||||
binding.refreshButton.text = if (offline) "Go Online" else getString(R.string.refresh)
|
||||
binding.refreshButton.visibility = if (offline) View.GONE else View.VISIBLE
|
||||
binding.refreshButton.setOnClickListener {
|
||||
if (offline && isOnline(requireContext())) {
|
||||
PrefManager.setVal(PrefName.OfflineMode, false)
|
||||
if (isOnline(requireContext())) {
|
||||
startMainActivity(requireActivity())
|
||||
} else {
|
||||
if (isOnline(requireContext()) ) {
|
||||
startMainActivity(requireActivity())
|
||||
}
|
||||
}
|
||||
}
|
||||
return binding.root
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
package ani.dantotsu.others
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.ActivityCrashBinding
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import java.io.File
|
||||
|
||||
|
||||
class CrashActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityCrashBinding
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
ThemeManager(this).applyTheme()
|
||||
initActivity(this)
|
||||
binding = ActivityCrashBinding.inflate(layoutInflater)
|
||||
|
||||
setContentView(binding.root)
|
||||
binding.root.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin = statusBarHeight
|
||||
bottomMargin = navBarHeight
|
||||
}
|
||||
val stackTrace = intent.getStringExtra("stackTrace") ?: "No stack trace available"
|
||||
|
||||
binding.crashReportView.setText(stackTrace)
|
||||
binding.crashReportView.setOnKeyListener(View.OnKeyListener { _, _, _ ->
|
||||
true // Blocks input from hardware keyboards.
|
||||
})
|
||||
|
||||
binding.copyButton.setOnClickListener {
|
||||
copyToClipboard("Crash log", stackTrace)
|
||||
}
|
||||
|
||||
binding.shareAsTextFileButton.setOnClickListener {
|
||||
shareAsTextFile(stackTrace)
|
||||
}
|
||||
}
|
||||
|
||||
private fun shareAsTextFile(stackTrace: String) {
|
||||
val file = File(cacheDir, "crash_log.txt")
|
||||
file.writeText(stackTrace)
|
||||
val uri = FileProvider.getUriForFile(this, "${packageName}.provider", file)
|
||||
val intent = Intent(Intent.ACTION_SEND).apply {
|
||||
type = "text/plain"
|
||||
putExtra(Intent.EXTRA_STREAM, uri)
|
||||
}
|
||||
startActivity(Intent.createChooser(intent, getString(R.string.share)))
|
||||
}
|
||||
}
|
||||
@@ -1,149 +1,124 @@
|
||||
package ani.dantotsu.others
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
class LanguageMapper {
|
||||
companion object {
|
||||
|
||||
private val codeMap: Map<String, String> = mapOf(
|
||||
"all" to "Multi",
|
||||
"af" to "Afrikaans",
|
||||
"am" to "Amharic",
|
||||
"ar" to "Arabic",
|
||||
"as" to "Assamese",
|
||||
"az" to "Azerbaijani",
|
||||
"be" to "Belarusian",
|
||||
"bg" to "Bulgarian",
|
||||
"bn" to "Bengali",
|
||||
"bs" to "Bosnian",
|
||||
"ca" to "Catalan",
|
||||
"ceb" to "Cebuano",
|
||||
"cs" to "Czech",
|
||||
"da" to "Danish",
|
||||
"de" to "German",
|
||||
"el" to "Greek",
|
||||
"en" to "English",
|
||||
"en-Us" to "English (United States)",
|
||||
"eo" to "Esperanto",
|
||||
"es" to "Spanish",
|
||||
"es-419" to "Spanish (Latin America)",
|
||||
"es-ES" to "Spanish (Spain)",
|
||||
"et" to "Estonian",
|
||||
"eu" to "Basque",
|
||||
"fa" to "Persian",
|
||||
"fi" to "Finnish",
|
||||
"fil" to "Filipino",
|
||||
"fo" to "Faroese",
|
||||
"fr" to "French",
|
||||
"ga" to "Irish",
|
||||
"gn" to "Guarani",
|
||||
"gu" to "Gujarati",
|
||||
"ha" to "Hausa",
|
||||
"he" to "Hebrew",
|
||||
"hi" to "Hindi",
|
||||
"hr" to "Croatian",
|
||||
"ht" to "Haitian Creole",
|
||||
"hu" to "Hungarian",
|
||||
"hy" to "Armenian",
|
||||
"id" to "Indonesian",
|
||||
"ig" to "Igbo",
|
||||
"is" to "Icelandic",
|
||||
"it" to "Italian",
|
||||
"ja" to "Japanese",
|
||||
"jv" to "Javanese",
|
||||
"ka" to "Georgian",
|
||||
"kk" to "Kazakh",
|
||||
"km" to "Khmer",
|
||||
"kn" to "Kannada",
|
||||
"ko" to "Korean",
|
||||
"ku" to "Kurdish",
|
||||
"ky" to "Kyrgyz",
|
||||
"la" to "Latin",
|
||||
"lb" to "Luxembourgish",
|
||||
"lo" to "Lao",
|
||||
"lt" to "Lithuanian",
|
||||
"lv" to "Latvian",
|
||||
"mg" to "Malagasy",
|
||||
"mi" to "Maori",
|
||||
"mk" to "Macedonian",
|
||||
"ml" to "Malayalam",
|
||||
"mn" to "Mongolian",
|
||||
"mo" to "Moldovan",
|
||||
"mr" to "Marathi",
|
||||
"ms" to "Malay",
|
||||
"mt" to "Maltese",
|
||||
"my" to "Burmese",
|
||||
"ne" to "Nepali",
|
||||
"nl" to "Dutch",
|
||||
"no" to "Norwegian",
|
||||
"ny" to "Chichewa",
|
||||
"pl" to "Polish",
|
||||
"pt" to "Portuguese",
|
||||
"pt-BR" to "Portuguese (Brazil)",
|
||||
"pt-PT" to "Portuguese (Portugal)",
|
||||
"ps" to "Pashto",
|
||||
"ro" to "Romanian",
|
||||
"rm" to "Romansh",
|
||||
"ru" to "Russian",
|
||||
"sd" to "Sindhi",
|
||||
"sh" to "Serbo-Croatian",
|
||||
"si" to "Sinhala",
|
||||
"sk" to "Slovak",
|
||||
"sl" to "Slovenian",
|
||||
"sm" to "Samoan",
|
||||
"sn" to "Shona",
|
||||
"so" to "Somali",
|
||||
"sq" to "Albanian",
|
||||
"sr" to "Serbian",
|
||||
"st" to "Southern Sotho",
|
||||
"sv" to "Swedish",
|
||||
"sw" to "Swahili",
|
||||
"ta" to "Tamil",
|
||||
"te" to "Telugu",
|
||||
"tg" to "Tajik",
|
||||
"th" to "Thai",
|
||||
"ti" to "Tigrinya",
|
||||
"tk" to "Turkmen",
|
||||
"tl" to "Tagalog",
|
||||
"to" to "Tongan",
|
||||
"tr" to "Turkish",
|
||||
"uk" to "Ukrainian",
|
||||
"ur" to "Urdu",
|
||||
"uz" to "Uzbek",
|
||||
"vi" to "Vietnamese",
|
||||
"yo" to "Yoruba",
|
||||
"zh" to "Chinese",
|
||||
"zh-Hans" to "Chinese (Simplified)",
|
||||
"zh-Hant" to "Chinese (Traditional)",
|
||||
"zh-Habt" to "Chinese (Hakka)",
|
||||
"zu" to "Zulu"
|
||||
)
|
||||
|
||||
fun getLanguageName(code: String): String {
|
||||
return if (code.contains("-")) {
|
||||
try {
|
||||
val parts = code.split("-")
|
||||
Locale(parts[0], parts[1]).displayName
|
||||
} catch (ignored: Exception) {
|
||||
code
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (code == "all") {
|
||||
return codeMap[code] ?: code
|
||||
}
|
||||
Locale(code).displayName
|
||||
} catch (ignored: Exception) {
|
||||
code
|
||||
}
|
||||
fun mapLanguageCodeToName(code: String): String {
|
||||
return when (code) {
|
||||
"all" -> "Multi"
|
||||
"af" -> "Afrikaans"
|
||||
"am" -> "Amharic"
|
||||
"ar" -> "Arabic"
|
||||
"as" -> "Assamese"
|
||||
"az" -> "Azerbaijani"
|
||||
"be" -> "Belarusian"
|
||||
"bg" -> "Bulgarian"
|
||||
"bn" -> "Bengali"
|
||||
"bs" -> "Bosnian"
|
||||
"ca" -> "Catalan"
|
||||
"ceb" -> "Cebuano"
|
||||
"cs" -> "Czech"
|
||||
"da" -> "Danish"
|
||||
"de" -> "German"
|
||||
"el" -> "Greek"
|
||||
"en" -> "English"
|
||||
"en-Us" -> "English (United States)"
|
||||
"eo" -> "Esperanto"
|
||||
"es" -> "Spanish"
|
||||
"es-419" -> "Spanish (Latin America)"
|
||||
"et" -> "Estonian"
|
||||
"eu" -> "Basque"
|
||||
"fa" -> "Persian"
|
||||
"fi" -> "Finnish"
|
||||
"fil" -> "Filipino"
|
||||
"fo" -> "Faroese"
|
||||
"fr" -> "French"
|
||||
"ga" -> "Irish"
|
||||
"gn" -> "Guarani"
|
||||
"gu" -> "Gujarati"
|
||||
"ha" -> "Hausa"
|
||||
"he" -> "Hebrew"
|
||||
"hi" -> "Hindi"
|
||||
"hr" -> "Croatian"
|
||||
"ht" -> "Haitian Creole"
|
||||
"hu" -> "Hungarian"
|
||||
"hy" -> "Armenian"
|
||||
"id" -> "Indonesian"
|
||||
"ig" -> "Igbo"
|
||||
"is" -> "Icelandic"
|
||||
"it" -> "Italian"
|
||||
"ja" -> "Japanese"
|
||||
"jv" -> "Javanese"
|
||||
"ka" -> "Georgian"
|
||||
"kk" -> "Kazakh"
|
||||
"km" -> "Khmer"
|
||||
"kn" -> "Kannada"
|
||||
"ko" -> "Korean"
|
||||
"ku" -> "Kurdish"
|
||||
"ky" -> "Kyrgyz"
|
||||
"la" -> "Latin"
|
||||
"lb" -> "Luxembourgish"
|
||||
"lo" -> "Lao"
|
||||
"lt" -> "Lithuanian"
|
||||
"lv" -> "Latvian"
|
||||
"mg" -> "Malagasy"
|
||||
"mi" -> "Maori"
|
||||
"mk" -> "Macedonian"
|
||||
"ml" -> "Malayalam"
|
||||
"mn" -> "Mongolian"
|
||||
"mo" -> "Moldovan"
|
||||
"mr" -> "Marathi"
|
||||
"ms" -> "Malay"
|
||||
"mt" -> "Maltese"
|
||||
"my" -> "Burmese"
|
||||
"ne" -> "Nepali"
|
||||
"nl" -> "Dutch"
|
||||
"no" -> "Norwegian"
|
||||
"ny" -> "Chichewa"
|
||||
"pl" -> "Polish"
|
||||
"pt" -> "Portuguese"
|
||||
"pt-BR" -> "Portuguese (Brazil)"
|
||||
"pt-PT" -> "Portuguese (Portugal)"
|
||||
"ps" -> "Pashto"
|
||||
"ro" -> "Romanian"
|
||||
"rm" -> "Romansh"
|
||||
"ru" -> "Russian"
|
||||
"sd" -> "Sindhi"
|
||||
"sh" -> "Serbo-Croatian"
|
||||
"si" -> "Sinhala"
|
||||
"sk" -> "Slovak"
|
||||
"sl" -> "Slovenian"
|
||||
"sm" -> "Samoan"
|
||||
"sn" -> "Shona"
|
||||
"so" -> "Somali"
|
||||
"sq" -> "Albanian"
|
||||
"sr" -> "Serbian"
|
||||
"st" -> "Southern Sotho"
|
||||
"sv" -> "Swedish"
|
||||
"sw" -> "Swahili"
|
||||
"ta" -> "Tamil"
|
||||
"te" -> "Telugu"
|
||||
"tg" -> "Tajik"
|
||||
"th" -> "Thai"
|
||||
"ti" -> "Tigrinya"
|
||||
"tk" -> "Turkmen"
|
||||
"tl" -> "Tagalog"
|
||||
"to" -> "Tongan"
|
||||
"tr" -> "Turkish"
|
||||
"uk" -> "Ukrainian"
|
||||
"ur" -> "Urdu"
|
||||
"uz" -> "Uzbek"
|
||||
"vi" -> "Vietnamese"
|
||||
"yo" -> "Yoruba"
|
||||
"zh" -> "Chinese"
|
||||
"zh-Hans" -> "Chinese (Simplified)"
|
||||
"zh-Hant" -> "Chinese (Traditional)"
|
||||
"zh-Habt" -> "Chinese (Hakka)"
|
||||
"zu" -> "Zulu"
|
||||
else -> code
|
||||
}
|
||||
}
|
||||
|
||||
fun getLanguageCode(language: String): String {
|
||||
return codeMap.filterValues { it.lowercase() == language.lowercase() }.keys.firstOrNull()
|
||||
?: "all"
|
||||
}
|
||||
|
||||
enum class Language(val code: String) {
|
||||
ALL("all"),
|
||||
ARABIC("ar"),
|
||||
|
||||
@@ -12,13 +12,9 @@ import io.noties.markwon.AbstractMarkwonPlugin
|
||||
import io.noties.markwon.utils.ColorUtils
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class SpoilerPlugin(private val anilist: Boolean = false) : AbstractMarkwonPlugin() {
|
||||
class SpoilerPlugin : AbstractMarkwonPlugin() {
|
||||
override fun beforeSetText(textView: TextView, markdown: Spanned) {
|
||||
if (anilist) {
|
||||
applySpoilerSpans(markdown as Spannable, ARE)
|
||||
} else {
|
||||
applySpoilerSpans(markdown as Spannable)
|
||||
}
|
||||
applySpoilerSpans(markdown as Spannable)
|
||||
}
|
||||
|
||||
private class RedditSpoilerSpan : CharacterStyle() {
|
||||
@@ -49,10 +45,9 @@ class SpoilerPlugin(private val anilist: Boolean = false) : AbstractMarkwonPlugi
|
||||
|
||||
companion object {
|
||||
private val RE = Pattern.compile("\\|\\|.+?\\|\\|")
|
||||
private val ARE = Pattern.compile("~!.+?!~")
|
||||
private fun applySpoilerSpans(spannable: Spannable, regex: Pattern = RE) {
|
||||
private fun applySpoilerSpans(spannable: Spannable) {
|
||||
val text = spannable.toString()
|
||||
val matcher = regex.matcher(text)
|
||||
val matcher = RE.matcher(text)
|
||||
while (matcher.find()) {
|
||||
val spoilerSpan = RedditSpoilerSpan()
|
||||
val clickableSpan: ClickableSpan = object : ClickableSpan() {
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
package ani.dantotsu.others.calc
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.doOnAttach
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import ani.dantotsu.MainActivity
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.ActivityCalcBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.util.NumberConverter.Companion.toBinary
|
||||
import ani.dantotsu.util.NumberConverter.Companion.toHex
|
||||
|
||||
class CalcActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityCalcBinding
|
||||
private lateinit var code: String
|
||||
private val stack = CalcStack()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivityCalcBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
binding.root.doOnAttach {
|
||||
initActivity(this)
|
||||
binding.displayContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin += statusBarHeight
|
||||
}
|
||||
binding.buttonContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin += navBarHeight
|
||||
}
|
||||
}
|
||||
code = intent.getStringExtra("code") ?: "0"
|
||||
|
||||
binding.apply {
|
||||
button0.setOnClickListener { stack.add('0'); updateDisplay() }
|
||||
button1.setOnClickListener { stack.add('1'); updateDisplay() }
|
||||
button2.setOnClickListener { stack.add('2'); updateDisplay() }
|
||||
button3.setOnClickListener { stack.add('3'); updateDisplay() }
|
||||
button4.setOnClickListener { stack.add('4'); updateDisplay() }
|
||||
button5.setOnClickListener { stack.add('5'); updateDisplay() }
|
||||
button6.setOnClickListener { stack.add('6'); updateDisplay() }
|
||||
button7.setOnClickListener { stack.add('7'); updateDisplay() }
|
||||
button8.setOnClickListener { stack.add('8'); updateDisplay() }
|
||||
button9.setOnClickListener { stack.add('9'); updateDisplay() }
|
||||
buttonDot.setOnClickListener { stack.add('.'); updateDisplay() }
|
||||
buttonAdd.setOnClickListener { stack.add('+'); updateDisplay() }
|
||||
buttonSubtract.setOnClickListener { stack.add('-'); updateDisplay() }
|
||||
buttonMultiply.setOnClickListener { stack.add('*'); updateDisplay() }
|
||||
buttonDivide.setOnClickListener { stack.add('/'); updateDisplay() }
|
||||
buttonEquals.setOnClickListener {
|
||||
try {
|
||||
val ans = stack.evaluate()
|
||||
updateDisplay()
|
||||
binding.displayBinary.text = ans.toBinary()
|
||||
binding.displayHex.text = ans.toHex()
|
||||
} catch (e: Exception) {
|
||||
display.text = getString(R.string.error)
|
||||
}
|
||||
}
|
||||
buttonClear.setOnClickListener {
|
||||
stack.clear()
|
||||
binding.displayBinary.text = ""
|
||||
binding.displayHex.text = ""
|
||||
binding.display.text = "0"
|
||||
}
|
||||
buttonBackspace.setOnClickListener {
|
||||
stack.remove()
|
||||
updateDisplay()
|
||||
}
|
||||
display.text = "0"
|
||||
}
|
||||
}
|
||||
|
||||
private fun success() {
|
||||
hasPermission = true
|
||||
ContextCompat.startActivity(
|
||||
this,
|
||||
Intent(this, MainActivity::class.java)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK),
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
private fun updateDisplay() {
|
||||
if (stack.getExpression().isEmpty()) {
|
||||
binding.display.text = "0"
|
||||
return
|
||||
}
|
||||
val expression = stack.getExpression().replace("*", "×").replace("/", "÷")
|
||||
val spannable = SpannableString(expression)
|
||||
|
||||
val operators = arrayOf('+', '-', '×', '÷')
|
||||
|
||||
expression.forEachIndexed { index, char ->
|
||||
if (char in operators) {
|
||||
val color = getThemeColor(com.google.android.material.R.attr.colorSecondary)
|
||||
spannable.setSpan(
|
||||
ForegroundColorSpan(color),
|
||||
index,
|
||||
index + 1,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
}
|
||||
}
|
||||
binding.display.text = spannable
|
||||
val text = binding.display.text.toString()
|
||||
if (text == code) {
|
||||
success()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
var hasPermission = false
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package ani.dantotsu.others.calc
|
||||
|
||||
import java.util.Stack
|
||||
|
||||
class CalcStack {
|
||||
private var expression: String = ""
|
||||
private val maxExpressionLength = 256
|
||||
|
||||
fun evaluate(): Double {
|
||||
val ops = Stack<Char>()
|
||||
val values = Stack<Double>()
|
||||
|
||||
var i = 0
|
||||
while (i < expression.length) {
|
||||
when {
|
||||
expression[i] == ' ' -> i++
|
||||
expression[i].isDigit() || expression[i] == '.' -> {
|
||||
var value = 0.0
|
||||
var isDecimal = false
|
||||
var decimalFactor = 0.1
|
||||
while (i < expression.length && (expression[i].isDigit() || expression[i] == '.' && !isDecimal)) {
|
||||
if (expression[i] == '.') {
|
||||
isDecimal = true
|
||||
} else if (!isDecimal) {
|
||||
value = value * 10 + (expression[i] - '0')
|
||||
} else {
|
||||
value += (expression[i] - '0') * decimalFactor
|
||||
decimalFactor *= 0.1
|
||||
}
|
||||
i++
|
||||
}
|
||||
values.push(value)
|
||||
i-- // to compensate the additional i++ in the loop
|
||||
}
|
||||
|
||||
else -> {
|
||||
while (!ops.isEmpty() && precedence(ops.peek()) >= precedence(expression[i])) {
|
||||
val val2 = values.pop()
|
||||
val val1 = values.pop()
|
||||
val op = ops.pop()
|
||||
values.push(applyOp(val1, val2, op))
|
||||
}
|
||||
ops.push(expression[i])
|
||||
}
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
while (!ops.isEmpty()) {
|
||||
val val2 = values.pop()
|
||||
val val1 = values.pop()
|
||||
val op = ops.pop()
|
||||
values.push(applyOp(val1, val2, op))
|
||||
}
|
||||
|
||||
|
||||
val ans = values.pop()
|
||||
expression = ans.toString()
|
||||
return ans
|
||||
}
|
||||
|
||||
fun add(c: Char) {
|
||||
if (expression.length >= maxExpressionLength) return
|
||||
expression += c
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
expression = ""
|
||||
}
|
||||
|
||||
fun remove() {
|
||||
if (expression.isNotEmpty()) {
|
||||
expression = expression.substring(0, expression.length - 1)
|
||||
}
|
||||
}
|
||||
|
||||
fun getExpression(): String {
|
||||
return expression
|
||||
}
|
||||
|
||||
|
||||
private fun precedence(op: Char): Int {
|
||||
return when (op) {
|
||||
'+', '-' -> 1
|
||||
'*', '/' -> 2
|
||||
else -> -1
|
||||
}
|
||||
}
|
||||
|
||||
private fun applyOp(a: Double, b: Double, op: Char): Double {
|
||||
return when (op) {
|
||||
'+' -> a + b
|
||||
'-' -> a - b
|
||||
'*' -> a * b
|
||||
'/' -> {
|
||||
if (b == 0.0) throw UnsupportedOperationException("Cannot divide by zero.")
|
||||
a / b
|
||||
}
|
||||
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,7 @@ class ImageSearchViewModel : ViewModel() {
|
||||
)
|
||||
.build()
|
||||
|
||||
val res = try {
|
||||
client.post(url, requestBody = requestBody).parsed<SearchResult>()
|
||||
} catch (e: Exception) {
|
||||
SearchResult(error = e.message)
|
||||
}
|
||||
val res = client.post(url, requestBody = requestBody).parsed<SearchResult>()
|
||||
searchResultLiveData.postValue(res)
|
||||
}
|
||||
|
||||
|
||||
@@ -53,11 +53,8 @@ class DynamicAnimeParser(extension: AnimeExtension.Installed) : AnimeParser() {
|
||||
|
||||
override val name = extension.name
|
||||
override val saveName = extension.name
|
||||
override val hostUrl =
|
||||
(extension.sources.first() as? AnimeHttpSource)?.baseUrl ?: extension.sources.first().name
|
||||
override val hostUrl = extension.sources.first().name
|
||||
override val isNSFW = extension.isNsfw
|
||||
override val icon = extension.icon
|
||||
|
||||
override var selectDub: Boolean
|
||||
get() = getDub()
|
||||
set(value) {
|
||||
@@ -327,10 +324,8 @@ class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() {
|
||||
|
||||
override val name = extension.name
|
||||
override val saveName = extension.name
|
||||
override val hostUrl =
|
||||
(extension.sources.first() as? HttpSource)?.baseUrl ?: extension.sources.first().name
|
||||
override val hostUrl = extension.sources.first().name
|
||||
override val isNSFW = extension.isNsfw
|
||||
override val icon = extension.icon
|
||||
|
||||
override suspend fun loadChapters(
|
||||
mangaLink: String,
|
||||
@@ -516,10 +511,9 @@ class VideoServerPassthrough(private val videoServer: VideoServer) : VideoExtrac
|
||||
override suspend fun extract(): VideoContainer {
|
||||
val vidList = listOfNotNull(videoServer.video?.let { aniVideoToSaiVideo(it) })
|
||||
val subList = videoServer.video?.subtitleTracks?.map { trackToSubtitle(it) } ?: emptyList()
|
||||
val audioList = videoServer.video?.audioTracks ?: emptyList()
|
||||
|
||||
return if (vidList.isNotEmpty()) {
|
||||
VideoContainer(vidList, subList, audioList)
|
||||
VideoContainer(vidList, subList)
|
||||
} else {
|
||||
throw Exception("No videos found")
|
||||
}
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
package ani.dantotsu.parsers
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
import ani.dantotsu.FileUrl
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.okHttpClient
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.util.Logger
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import me.xdrop.fuzzywuzzy.FuzzySearch
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import java.io.Serializable
|
||||
import java.net.URLDecoder
|
||||
import java.net.URLEncoder
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
|
||||
abstract class BaseParser {
|
||||
@@ -46,11 +41,6 @@ abstract class BaseParser {
|
||||
* **/
|
||||
open val language = "English"
|
||||
|
||||
/**
|
||||
* Icon of the site, can be null
|
||||
*/
|
||||
open val icon: Drawable? = null
|
||||
|
||||
/**
|
||||
* Search for Anime/Manga/Novel, returns a List of Responses
|
||||
*
|
||||
@@ -64,11 +54,6 @@ abstract class BaseParser {
|
||||
* Isn't necessary to override, but recommended, if you want to improve auto search results
|
||||
* **/
|
||||
open suspend fun autoSearch(mediaObj: Media): ShowResponse? {
|
||||
(this as? DynamicMangaParser)?.let { ext ->
|
||||
mediaObj.selected?.langIndex?.let {
|
||||
ext.sourceLanguage = it
|
||||
}
|
||||
}
|
||||
var response: ShowResponse? = loadSavedShowResponse(mediaObj.id)
|
||||
if (response != null && this !is OfflineMangaParser && this !is OfflineAnimeParser) {
|
||||
saveShowResponse(mediaObj.id, response, true)
|
||||
@@ -143,40 +128,10 @@ abstract class BaseParser {
|
||||
return response
|
||||
}
|
||||
|
||||
/**
|
||||
* ping the site to check if it's working or not.
|
||||
* @return Triple<Int, Int?, String> : First Int is the status code, Second Int is the response time in milliseconds, Third String is the response message.
|
||||
*/
|
||||
fun ping(): Triple<Int, Int?, String> {
|
||||
val client = OkHttpClient()
|
||||
var statusCode = 0
|
||||
var responseTime: Int? = null
|
||||
var responseMessage = ""
|
||||
println("Pinging $name at $hostUrl")
|
||||
try {
|
||||
val request = Request.Builder()
|
||||
.url(hostUrl)
|
||||
.build()
|
||||
responseTime = measureTimeMillis {
|
||||
client.newCall(request).execute().use { response ->
|
||||
statusCode = response.code
|
||||
responseMessage = response.message.ifEmpty { "None" }
|
||||
}
|
||||
}.toInt()
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Failed to ping $name")
|
||||
statusCode = -1
|
||||
responseMessage = if (e.message.isNullOrEmpty()) "None" else e.message!!
|
||||
Logger.log(e)
|
||||
}
|
||||
return Triple(statusCode, responseTime, responseMessage)
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get an existing Search Response which was selected by the user.
|
||||
* @param mediaId : The mediaId of the Media object.
|
||||
* @return ShowResponse? : The ShowResponse object if found, else null.
|
||||
*/
|
||||
* **/
|
||||
open suspend fun loadSavedShowResponse(mediaId: Int): ShowResponse? {
|
||||
checkIfVariablesAreEmpty()
|
||||
return PrefManager.getNullableCustomVal(
|
||||
@@ -188,10 +143,7 @@ abstract class BaseParser {
|
||||
|
||||
/**
|
||||
* Used to save Shows Response using `saveName`.
|
||||
* @param mediaId : The mediaId of the Media object.
|
||||
* @param response : The ShowResponse object to save.
|
||||
* @param selected : Boolean : If the ShowResponse was selected by the user or not.
|
||||
*/
|
||||
* **/
|
||||
open fun saveShowResponse(mediaId: Int, response: ShowResponse?, selected: Boolean = false) {
|
||||
if (response != null) {
|
||||
checkIfVariablesAreEmpty()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user