1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2025-09-09 18:29:47 +02:00

Compare commits

...

278 commits

Author SHA1 Message Date
Gregor Santner
774c5bec59 Merge dandelion news and FAQ content all into markdown files in the dandelion repository 2023-02-11 03:07:41 +01:00
Gregor Santner
c65aab3840 Update translations, project info 2023-01-28 17:21:07 +01:00
Gregor Santner
c2bea7bec0 Crowdin add Estonian, Update translations (PR #297) 2022-12-08 14:16:52 +01:00
Gregor Santner
36bd1af0b9 Translations: Add bulgarian 2022-07-13 01:51:31 +02:00
Gregor Santner
67b0bbbfd2
Update translations (PR #294) 2022-05-28 19:03:18 +00:00
Gregor Santner
b80cc3ab04 Add croatian & thai language to translation system 2022-05-28 20:55:42 +02:00
Gregor Santner
37f586912f
Change link to domain podupti.me -> diaspora.fediverse.observer, closes #295, by @gsantner 2021-10-09 20:17:11 +02:00
Gregor Santner
de378b8adc Add language Odia/Oriya (India), Update translations (#293) 2021-10-02 13:04:29 +02:00
Gregor Santner
8161353de7
New Crowdin updates (#292) 2021-09-09 22:46:37 +02:00
Gregor Santner
c42b4995b3 Update crowdin config 2021-09-09 22:43:58 +02:00
Gregor Santner
5a5d1d66b3 Update CHANGELOG 2021-08-01 14:31:44 +02:00
Gregor Santner
ceb0002546 Update translations (PR #286) 2021-08-01 14:12:24 +02:00
James Addison
0cf003ea38
Update README screenshot references (PR #291) 2021-08-01 13:38:59 +02:00
Gregor Santner
904f2af20a
Update gs/opoc utilities 2021-08-01 13:30:21 +02:00
Gregor Santner
d923630b42
Update README badges, remove IRC 2021-05-19 20:48:50 +02:00
Gregor Santner
a76a463cd4
Add language Esperanto, by @gsantner 2021-03-13 14:25:09 +01:00
Gregor Santner
c9c10a6fd4
Add language Sinhala (Sri Lanka) 2021-02-28 22:09:03 +01:00
Gregor Santner
e5866ffb2b
Update opoc 2021-01-18 21:32:50 +01:00
Gregor Santner
97d9bf434e
Various additions & improvements to opoc utils 2021-01-12 20:23:10 +01:00
Gregor Santner
f1464b5f8f
ci add comment for cleanup as github has no delete-all button 2020-12-23 14:45:38 +01:00
Gregor Santner
369abf14a5
CI/CD: Remove special junit/lint jobs 2020-12-22 03:39:33 +01:00
Gregor Santner
ceb98c4258
gh actions pull_request action 2020-12-21 23:50:58 +01:00
Gregor Santner
4ebd393250
Update v1.3.5 (translations/libs only) 2020-12-09 12:08:05 +01:00
Gregor Santner
f3b3c6a160
disable AndroidSupportMeWrapper 2020-12-09 11:59:36 +01:00
Gregor Santner
ff62aa5a07 Add Makefile; CI: Remove Circle/Travis, add GitHub Actions 2020-12-09 01:07:24 +01:00
Gregor Santner
6fbd399a4b
Update gsantner/opoc libs/utils 2020-12-09 00:57:31 +01:00
Gregor Santner
fa7e37ccba
Remove Travis CI - Open Source love is gone 2020-12-08 08:41:38 +01:00
Gregor Santner
20d75acd39
New Crowdin updates (#276) 2020-12-05 22:08:40 +01:00
Gregor Santner
7b1897b2e0 crowdin: Add macedonian 2020-11-13 21:56:27 +01:00
Gregor Santner
93aadae64b
[ci skip] Crowdin translation bot: New translations for Swedish (#272) 2020-09-24 23:18:12 +02:00
Gregor Santner
a7dd4a6166
New Crowdin translations (#267) 2020-05-29 21:27:09 +00:00
Gregor Santner
cf1f0100ba
Update crowdin bot commit message template 2020-05-29 23:22:35 +02:00
Gregor Santner
875f613cd9
Update supportme link to https 2020-04-20 02:01:40 +02:00
Gregor Santner
ea1ee6bc40 Update opoc 2020-03-29 19:53:32 +02:00
Gregor Santner
a66d7bf3b2 New Crowdin translations (#264) 2020-03-29 19:33:19 +02:00
Gregor Santner
c5849d7d6a Release v1.3.4 2020-02-09 13:12:59 +01:00
Gregor Santner
cc16b84011 Add seconds to 'save picture' date format, closes #262 2020-02-09 13:12:07 +01:00
Gregor Santner
0f6b1c3ec3
Update opoc 2020-02-09 12:49:26 +01:00
Gregor Santner
a686fea141 Bump junit from 4.12 to 4.13 (#261); New Crowdin translations (#260, #263) 2020-02-09 12:46:29 +01:00
Gregor Santner
f9951f3b16 Release v1.3.3 2019-12-23 21:21:10 +01:00
Gregor Santner
073a688db9
New Crowdin translations (#259) 2019-12-23 20:18:54 +00:00
Gregor Santner
1f3cde9326
Add albanian / Tamil 2019-12-23 21:11:39 +01:00
Gregor Santner
8326c2196c
Update tools 2019-12-06 22:02:24 +01:00
Gregor Santner
7361d4bc3f
Update opoc
Update shared helper utilities of my projects to latest state
2019-11-20 00:34:10 +01:00
Gregor Santner
1948c28cff
Crowdin: Update language mapping 2019-11-04 14:18:40 +01:00
Gregor Santner
d1be7f5215 Bump gradle from 3.5.0 to 3.5.1 (#254) 2019-10-04 01:38:43 +02:00
Gregor Santner
8d019b6c3b
New Crowdin translations (#253) 2019-09-22 13:55:33 +00:00
Gregor Santner
0708fcb02b
Update list of languages for crowdin 2019-09-22 13:35:33 +02:00
Gregor Santner
c5e3a42005
Update opoc 2019-09-07 21:54:08 +02:00
Gregor Santner
8c3c7da2ab
Release v1.3.2 2019-08-25 14:19:19 +02:00
Gregor Santner
3bc6afad03
Fix getDateOfDaysAgo 2019-08-25 14:07:07 +02:00
Gregor Santner
194fbf6927 Rename test flavor to atest (so it's default dev flavor when starting android studio) 2019-08-24 14:54:25 +02:00
dependabot-preview[bot]
6d45620181 Bump gradle from 3.4.2 to 3.5.0 (#250) 2019-08-21 12:22:56 +00:00
Gregor Santner
c9d3693515
New Crowdin translations (#245) 2019-07-26 01:28:14 +00:00
Gregor Santner
a618da97d8
Update opoc 2019-07-26 03:19:28 +02:00
imgbot[bot]
3ec8ab89c6 [ImgBot] Optimize images (#247)
*Total -- 1,011.84kb -> 914.41kb (9.63%)

/app/src/flavorTest/res/drawable-ldpi/ic_launcher.png -- 1.50kb -> 1.24kb (17.35%)
/app/src/main/res/drawable-ldpi/ic_launcher.png -- 1.67kb -> 1.40kb (16.03%)
/metadata/en-US/promoGraphic.png -- 3.58kb -> 3.04kb (15.17%)
/app/src/flavorDandelior/ic_launcher-web.png -- 29.94kb -> 26.33kb (12.05%)
/metadata/en-US/featureGraphic.png -- 861.38kb -> 773.90kb (10.16%)
/app/src/flavorDandelior/res/drawable-xhdpi/ic_launcher.png -- 9.28kb -> 8.74kb (5.83%)
/app/src/flavorDandelior/res/drawable-xhdpi/ic_launcher_round.png -- 9.28kb -> 8.74kb (5.83%)
/app/src/flavorDandelior/res/drawable-hdpi/ic_launcher_round.png -- 8.01kb -> 7.58kb (5.36%)
/app/src/flavorDandelior/res/drawable-hdpi/ic_launcher.png -- 8.01kb -> 7.58kb (5.36%)
/app/src/flavorDandelior/res/drawable-xxhdpi/ic_launcher_round.png -- 11.90kb -> 11.28kb (5.19%)
/app/src/flavorDandelior/res/drawable-xxhdpi/ic_launcher.png -- 11.90kb -> 11.28kb (5.19%)
/app/src/flavorDandelior/res/drawable-xxxhdpi/ic_launcher_round.png -- 14.72kb -> 14.08kb (4.31%)
/app/src/flavorDandelior/res/drawable-xxxhdpi/ic_launcher.png -- 14.72kb -> 14.08kb (4.31%)
/app/src/flavorDandelior/res/drawable-mdpi/ic_launcher_round.png -- 6.80kb -> 6.58kb (3.33%)
/app/src/flavorDandelior/res/drawable-mdpi/ic_launcher.png -- 6.80kb -> 6.58kb (3.33%)
/app/src/flavorDandelior/res/drawable-ldpi/ic_launcher_round.png -- 6.17kb -> 5.99kb (2.96%)
/app/src/flavorDandelior/res/drawable-ldpi/ic_launcher.png -- 6.17kb -> 5.99kb (2.96%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
2019-07-26 00:35:39 +00:00
Gregor Santner
938a54fc74
Release v1.3.1 2019-04-26 00:55:53 +02:00
Gregor Santner
0732fe1b91
New Crowdin translations (#243) 2019-04-25 22:53:54 +00:00
Gregor Santner
a7054d3ff8 Update metadata 2019-04-21 15:57:49 +02:00
25020c1692
Merge pull request #240 from vanitasvitae/de_metadata
German translation of metadata
2019-03-11 15:51:39 +01:00
b1fb5d646a
German translation of metadata 2019-03-11 14:10:35 +01:00
Gregor Santner
51c3f68f22 Release v1.3.0 2019-03-08 14:49:29 +01:00
Gregor Santner
a80f6ebb45 New Crowdin translations (#238) 2019-03-08 14:45:02 +01:00
Gregor Santner
49c6a97ce7 Add AndroidSupportMeWrapper 2019-03-08 12:32:10 +01:00
Gregor Santner
4f44d1acd3
New Crowdin translations (#231) 2019-02-07 09:38:41 +00:00
Gregor Santner
24571f6921
Auto reformat code 2019-02-07 10:31:18 +01:00
massimilianoLe
fb8eb60974 pullRefresh as option + Shortcut to settings @themesettings (#226)
* pull to refresh page

* Make youtube links open external

* corrected a bit but still not able to check if app is installed

* corrected triggersync

* Added option For user to choose how to open youtube links

* removed unecessary comment

* update with dandelion

* pull refresh option+shortcut to themes

* Changes request applyed

* added name in contributors list
2019-02-07 09:25:06 +00:00
Gregor Santner
b833311353 Release v1.2.5 2019-01-11 02:43:53 +01:00
Gregor Santner
6f310985d6 Update gradle tooling & gsantner-opoc 2019-01-11 02:38:30 +01:00
Gregor Santner
6d62c70359
New Crowdin translations (#224) 2019-01-11 00:16:10 +00:00
Gregor Santner
d34cbe1ed1
Remove/move serbian 2019-01-11 01:11:05 +01:00
Gregor Santner
66cbf9a47d update crowdin yaml 2019-01-11 00:56:13 +01:00
Gregor Santner
b1d5e980c2
New Crowdin translations (#221) 2019-01-10 23:31:30 +00:00
massimilianoLe
f693418d64 Make youtube links open external, by @massimilianoLe (#220) 2018-12-01 17:12:04 +01:00
Gregor Santner
04e89e516c
New Crowdin translations (#218) 2018-11-23 10:31:00 +01:00
massimilianoLe
5854075080 pull to refresh page (#219) 2018-11-23 10:28:37 +01:00
Gregor Santner
1f8babd708 Release v1.2.3 2018-11-12 01:33:36 +01:00
Gregor Santner
2618bdf5ad
New Crowdin translations (#214) 2018-11-12 01:25:36 +01:00
Gregor Santner
19884c33c1
New Crowdin translations (#212) 2018-10-09 20:57:57 +02:00
Gregor Santner
2289c04f0f Update opoc and it's license headers 2018-10-01 21:12:17 +02:00
Gregor Santner
1129f1848a
New Crowdin translations (#210) 2018-09-27 11:17:17 +02:00
Gregor Santner
c77fd1db01
add more language remappings for crowdin 2018-09-27 11:13:25 +02:00
Gregor Santner
b072111b8b
add more language remappings for crowdin 2018-09-27 10:58:04 +02:00
Gregor Santner
351b2d6447
Mark only strings.xml as translatable on crowdin 2018-09-27 10:49:31 +02:00
Gregor Santner
ddc2549c66 Update Crowdin configuration file 2018-09-25 17:55:04 +02:00
Gregor Santner
c1d34fc5db
Merge pull request #204 from muhaaliss/stringlate-tr-9470
Updated tr (Turkish) translation, by @muhaaliss
2018-09-16 09:32:10 +02:00
Muha Aliss
33db3656fa Updated tr (Turkish) translation
Commit made via Stringlate
2018-09-16 03:17:33 +03:00
Gregor Santner
e194d2159e
Add @vanitasvitae 's unfinished image-viewer patch (deleted all test/demo branches for cleanup 2018-09-05 17:00:04 +02:00
Gregor Santner
e66c72d255 release v1.2.2 2018-09-04 20:00:55 +02:00
Gregor Santner
4cd88400ee Rework string ids to tell content 2018-09-04 19:16:51 +02:00
Gregor Santner
48a00b099e
. 2018-09-04 17:02:34 +02:00
Gregor Santner
e6b2fa606e
Merge pull request #201 from asereze/patch-1
Updated sc (Sardinian) translation xml file
2018-08-07 23:59:30 +02:00
asereze
0b66ef801f
Updated sc (Sardinian) translation xml file
I hope it's ok now.
2018-08-07 23:43:07 +02:00
Gregor Santner
e1ea19f02a Release v1.2.1 2018-08-06 23:36:04 +02:00
Gregor Santner
af9e3ad8a3
Update metadata 2018-07-30 21:40:30 +02:00
Gregor Santner
d76fe4b82b
Update metadata 2018-07-30 13:32:34 +02:00
Gregor Santner
dc07beafc3
Merge pull request #199 from xmgz/master
galician (gl) strings.xml updated, by @xmgz (#199)
2018-07-29 11:55:29 +02:00
Xosé M
423970ce39 faltaban 3 cadeas 2018-07-29 10:30:51 +02:00
Xosé M
215f67308e eliminar string preferences e about 2018-07-29 09:54:34 +02:00
Xosé M
376449486b minor gl fixes 2018-07-29 09:50:16 +02:00
Gregor Santner
1e15374229 Release v1.2.0 2018-07-25 03:30:28 +02:00
Gregor Santner
dbbd3cef35 Use searchable dialog for tag and aspect/contact list
* Remove seperate fragments for both cases
* Make use of opoc/SearchOrCustomTextDialog
* Basically also removes all fragment swaps
  * Only two fragments are stream and podselection
  * Pod logout restarts app
  * Thus long known Android Supportlib bug can't occur

* Fixes #198
2018-07-25 01:59:25 +02:00
Gregor Santner
918adcf358 Add flavor dandelior*, move flavor specific to folder instead gradle generated 2018-07-22 14:03:29 +02:00
Gregor Santner
957573ea83 Update opoc 2018-05-21 14:57:41 +02:00
Gregor Santner
65ba10712f Update paths 2018-05-13 12:08:27 +02:00
Gregor Santner
099eb9ca78
Update supportlib 2018-05-09 03:25:23 +02:00
Gregor Santner
ad3966dd85
Merge string resources to one file, propagte change to all translations 2018-05-09 03:23:12 +02:00
Gregor Santner
9a6798f9f4
Update french translation, by @arnaud-jacquemin, (closes #196) 2018-05-09 03:00:33 +02:00
Gregor Santner
2cc74ea613
Release v1.1.3 2018-04-08 22:10:53 +02:00
Gregor Santner
cebf0f473b
Fix podselection custom button color 2018-04-08 22:08:21 +02:00
Gregor Santner
9da1a910b3
Add existingconnection to opoc:networkutils:performCall 2018-04-08 20:12:51 +02:00
Gregor Santner
38cf36b46c Improve sharing *a lot* +GIF - add support for multiple filetypes
* now supporting GIFs too ;)
* Create connection over netcipher
2018-04-08 19:11:12 +02:00
Gregor Santner
68be2f3a4a
Load README when ow pod URL gets called and no pod selected , fixes #193 2018-04-08 18:05:56 +02:00
Gregor Santner
51093e0c3d
Rework screenshot saving and sharing; add new share options:
* Share option: Launcher shortcut (fixes #170)
* Share option: Copy link of current page to clipboard
* Share otpion: Export as PDF / print
2018-04-08 17:52:04 +02:00
Gregor Santner
d53128e5cb
Merge license and changelog dialog on first start 2018-04-08 09:01:52 +02:00
Gregor Santner
82ccc54436
Add FF Klar to custom tabs list 2018-04-08 08:44:00 +02:00
Gregor Santner
f6ab146fd7
Update github templates 2018-04-03 23:23:16 +02:00
Gregor Santner
80f8f10bf9 Release v1.1.2 2018-03-30 03:03:19 +02:00
Gregor Santner
dcc8728171 Update changelog
* fixes #180
2018-03-30 02:52:20 +02:00
Gregor Santner
b48dc5dcac
Fix loading non-pod links outside customtab/external browser 2018-03-30 02:46:44 +02:00
Gregor Santner
618f3eaaba
Fix webview-js dialog not dismissing correctly 2018-03-30 01:41:43 +02:00
Gregor Santner
08242760bb
Migrate to opoc/basefragment; Fix redundant casts 2018-03-30 00:38:31 +02:00
Gregor Santner
a88dc5d13c
. 2018-03-30 00:24:52 +02:00
Gregor Santner
586875e32b
Update gsantner-opoc to latest state 2018-03-30 00:14:54 +02:00
Gregor Santner
43a2ad25bc Update opoc license headers 2018-03-12 00:05:53 +01:00
Gregor Santner
6cac47763c
Release v1.1.1 2018-03-05 23:45:10 +01:00
Gregor Santner
5921549a9c Fix secondlion BuildConfig, githash 2018-03-05 23:37:24 +01:00
Gregor Santner
07acb6bd02 Redo icon as adaptive icon 2018-03-05 14:23:51 +01:00
Gregor Santner
dd0432f718 Update to latest opoc version
* Move various clases
* Especially improve language preference, backported from compat lib
2018-03-02 15:56:14 +01:00
x m l p
1bb061b563 Update galician translation, by @xmgz (#189) 2018-02-22 22:42:50 +01:00
XoseM
d8d74de22b actualizando o galego 2018-02-21 12:36:28 +01:00
XoseM
8df13fe283 Merge branch 'master' of https://github.com/xmgz/dandelion
pideumo o git
2018-02-21 12:32:21 +01:00
XoseM
724a0dbc9c actualizando a gl-translation 2018-02-21 12:31:45 +01:00
XoseM
1f873e2057 fixed strings from gl-tranlation branch 2018-02-21 12:14:48 +01:00
x m l p
ea66b57979
Update .gitignore 2018-02-21 12:02:03 +01:00
XoseM
cbb98f7c60 editando desde gl-translation 2018-02-21 11:51:25 +01:00
XoseM
ed511bec01 update using git help from gsantner 2018-02-21 11:45:02 +01:00
Xosé M
204429b8d5 engadido cómo traducir 2018-02-21 08:31:04 +01:00
Xosé M
120c48f702 actualizando segundo contexto 2018-02-21 08:02:47 +01:00
Gregor Santner
e4992870fe
Release v1.1.0 2018-02-07 00:17:24 +01:00
Gregor Santner
be4309ecd6
Replace shortcut's icons with vectors 2018-02-07 00:13:42 +01:00
Gregor Santner
a07bc144d8
Remove line breaks from fdroid metadata 2018-02-06 23:21:10 +01:00
Gregor Santner
3442f018e9
Update buildscript 2018-02-06 23:11:18 +01:00
8aec1aa74f Update podlink dorf-post.de (fix #181) (#184) 2018-01-15 22:52:04 +01:00
Gaukler Faun
a3cb818db4 implemented app shortcuts, template svg-file for shortcut icons (#183) 2018-01-07 16:03:02 +01:00
Xosé M. Lamas
15240fca49 pequenos erros tipográficos 2017-11-30 08:37:16 +01:00
Xose M
32a74e293a 1a modificacion en github (#179) 2017-11-28 10:15:54 +01:00
XoseM
b1c2219b4d 1ª modificación en github 2017-11-28 09:47:44 +01:00
Gregor Santner
7215cbd7e6
Update sc localization
* Closes #177
2017-11-24 00:55:43 +01:00
Gregor Santner
06119a52cd
Update github templates 2017-11-24 00:21:56 +01:00
Daria Szatan
755adb2ad9 Polish translation (#176)
Polish translation
2017-11-23 18:07:50 +01:00
Gregor Santner
1a99d53c5d
Last crowdin translation update 2017-11-22 21:02:12 +01:00
Gregor Santner
28dac50d84
Update and improve buildscript 2017-11-18 20:04:59 +01:00
Aditya Mehta
255c6d650e replaced traditional file sharing with FileProvider (#174)
replaced traditional file sharing with FileProvider (fixes #173)
2017-11-01 05:23:19 +01:00
Gregor Santner
8ac5c2dee9 Update translations 2017-10-31 18:12:02 +01:00
Gregor Santner
0393bf274f
Fix lint warnings in opoc ; update langprefs; more power for contextutils 2017-10-31 14:18:52 +01:00
Gregor Santner
d1c4e68df3
Release v1.0.8 2017-10-29 19:39:37 +01:00
Gregor Santner
08c450fc99
Update readme 2017-10-29 19:35:35 +01:00
Gregor Santner
ae226c9e16
Add metadata again 2017-10-29 18:05:49 +01:00
Gregor Santner
086f056216 Modify toolbar item positions 2017-10-29 17:26:13 +01:00
Gregor Santner
d1d2d7b4d1 Fix drawable lint issues 2017-10-29 15:33:59 +01:00
Gregor Santner
a96e91aefb
Top toolbar with overflow icons and light/dark theme 2017-10-29 14:47:00 +01:00
Gregor Santner
aaa2445bef
Merge extended notifications menu into main menu 2017-10-29 11:07:52 +01:00
Gregor Santner
cb811d8236 Update Gradle to 3.0/4.1 ; SDK 27 2017-10-29 11:01:27 +01:00
Gregor Santner
496faa7945
Release v1.0.7 2017-10-28 09:56:33 +02:00
Gregor Santner
34882ba69f
Remove metadata...again 2017-10-28 09:56:05 +02:00
Gregor Santner
ac8b8469b0
kabyle_init 2017-09-26 18:13:57 +02:00
Gregor Santner
e767e514f7
Release v1.0.6 2017-09-23 20:33:53 +02:00
Gregor Santner
bf6bdbd821 Re add metadata module 2017-09-23 20:33:28 +02:00
Gregor Santner
fe4d646c47
Release v1.0.5 2017-09-19 15:21:37 +02:00
Gregor Santner
19161ca3e4 Update LangPref ; Remove metadata 2017-09-19 15:19:00 +02:00
Gregor Santner
9767363a7e Update screenshots in readme 2017-09-17 22:07:39 +02:00
Gregor Santner
184de1931e
Make use of opoc/LanguagePreference (fixes #169) 2017-09-15 19:56:10 +02:00
Gregor Santner
4ba1b8671d Release v1.0.4 2017-09-11 21:19:30 +02:00
Gregor Santner
6a0b30dd7b Add F-Droid metadata ( fixes #161 ) 2017-09-11 20:53:09 +02:00
Gregor Santner
58d07f9c6c
Fix profile link 2017-09-11 20:32:40 +02:00
Gregor Santner
b4608794ab Hide statusbar option for mainacitvity 2017-09-11 18:48:58 +02:00
Gregor Santner
76f33a45ba
Move sardinian 2017-09-11 18:04:22 +02:00
Gregor Santner
eb28ca3f43 Merge branch 'master' of github.com:diaspora-for-android/dandelion 2017-09-09 17:09:14 +02:00
Gregor Santner
15a34a1895
Change package ID of gsantner/opoc 2017-09-09 17:09:04 +02:00
Gregor Santner
548ff25396
Add sardinian 2017-09-08 07:31:21 +02:00
Gregor Santner
b3129e0e91
l10n update 2017-08-29 14:45:54 +02:00
Gregor Santner
05d6efd107
Include String key as parameter in AppSettingsBase 2017-08-29 14:44:43 +02:00
Gregor Santner
e9fa2082d9 Update Readme 2017-08-24 13:34:32 +02:00
Gregor Santner
ea7ceacc12
add metadata 2017-08-15 18:36:39 +02:00
Gregor Santner
23142488c2
Release v1.0.3 2017-08-13 23:05:40 +02:00
Gregor Santner
eb0e2b0997
Improve badge and podselection colors ; Update podlist 2017-08-13 23:02:04 +02:00
Gregor Santner
c988fc3bdd
Lower butterknife version to not pull in more recent appcompat 2017-08-12 22:34:15 +02:00
Gregor Santner
92bd98ea28
Update opoc 2017-08-09 17:23:19 +02:00
Gregor Santner
bdd502174d Update README.md
IRC Channel link badge
2017-08-08 14:02:20 +02:00
Gregor Santner
b07941be75
Release v1.0.2 2017-08-05 14:01:31 +02:00
Gregor Santner
e54dbedec8
Revert: Update android sdk to api 26... Upstream bug still not fixed 2017-08-05 14:00:55 +02:00
Gregor Santner
8a934b4a68
Lower gradle version so F-Droid can build it
==== detail begin ====
Available gradle versions: 4.0 3.5 3.4.1 3.4 3.3 3.2.1 3.2 3.1 3.0 2.14.1 2.14 2.13 2.12 2.11 2.10 2.9 2.8 2.7 2.6 2.5 2.4 2.3 2.2.1 2.2 2.1 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.4
Found 4.0.2 via distributionUrl
/opt/gradle/bin/gradle: line 9: /opt/gradle/versions/4.0.2/bin/gradle: No such file or directory
==== detail end ====
2017-08-05 12:26:04 +02:00
Gregor Santner
acb27766a8
Update android sdk to api 26 2017-08-04 05:42:43 +02:00
Gregor Santner
a5a307c076
Update translations and contributors 2017-07-30 15:40:27 +02:00
Gregor Santner
96daa8789a
Release v1.0.1 2017-07-30 12:36:47 +02:00
Gregor Santner
8324fe52ec
Move untranslatable strings 2017-07-29 21:20:39 +02:00
Gregor Santner
99e369088a
Update SimpleMarkdownParser 2017-07-29 04:44:28 +02:00
Gregor Santner
0e7ff63c9a Update AppSettings.java 2017-06-18 22:24:53 +02:00
Gregor Santner
4f43c56cf9
Release v1.0.0 2017-06-14 16:32:19 +02:00
Gregor Santner
bf99845379
Improve shared-by #159 2017-06-10 13:57:33 +02:00
Gregor Santner
6d93db79b8
Improve AMOLED mode 2017-06-10 13:01:57 +02:00
Gregor Santner
2d7d898bfe
- Added AMOLED mode
- Use opoc/AdBlock
- Improve NavDrawer
2017-06-08 02:33:00 +02:00
Gregor Santner
544e86073a
update gradle wrapper 2017-06-01 15:07:55 +02:00
Gregor Santner
756b31a4ea
Use opoc/Helpers 2017-05-29 19:05:37 +02:00
Gregor Santner
b075f020a3
Release v0.2.7 2017-05-26 12:14:33 +02:00
Gregor Santner
87f160f4c4
Some small improvements 2017-05-26 12:13:28 +02:00
Gregor Santner
e443a8ed6f
Use opoc/AppSettingsBase as base of AppSettings 2017-05-20 02:08:04 +02:00
Gregor Santner
1ff93b6959
Release v0.2.6 2017-05-03 23:48:22 +02:00
Gregor Santner
baff1a1d35
Fixed #156 #158 #159
* Added pod spyurk.am
* Added chinese traditional language
* Added NavSlider option: Statistics
* Changed shared-by-notice text
2017-04-15 12:00:52 +02:00
20afd6a2ad
Fix bottom bar hint text background color (Fix #157) 2017-04-10 20:04:03 +02:00
Gregor Santner
ddc0afa65a
Release v0.2.5 2017-04-10 19:50:40 +02:00
Gregor Santner
101c5f5b7d Introduce new markdown parser;
Rework existing md files;
Show changelog/update dialog
2017-03-25 16:45:32 +01:00
Gregor Santner
8d6b09c800 v0.2.4 Release - Custom default icon and color for secondlion ; fixes #155 2017-03-19 23:32:18 +01:00
5379386ecc
Added icons to notification dropdown menu 2017-03-08 10:17:49 +01:00
07bff2d71c
Fixed typo 2017-03-06 21:49:21 +01:00
Gregor Santner
0db1360853 Remove apkname property 2017-03-05 23:11:46 +01:00
Gregor Santner
ac2327d2f2 Fix #151; URL handling; language; dia.so
* Language switcher in settings (#151)
* Handle dia.so links
* Improve security at internal browser decision
2017-03-05 20:51:56 +01:00
Gregor Santner
47184fe878 Update README 2017-03-03 00:04:41 +01:00
a32d871cca
Updated changelog 2017-02-28 10:45:21 +01:00
Gregor Santner
a205f9372d Release v0.2.3 2017-02-24 23:24:00 +01:00
Gregor Santner
4ed9a0169a Update LICENSE & README; Replace leftovers of diasporaForAndroid; 2017-02-24 18:47:14 +01:00
9f39e3ca1c
Make sure Diaspora image folder exists before sharing/downloading images 2017-01-24 13:12:34 +01:00
392b76c53d
Fixed crash after clicking photo upload button twice (#139) 2017-01-24 13:04:26 +01:00
Gregor Santner
8ef2cacc79
Fix some TR's 2017-01-21 16:49:04 +01:00
06574ccbcf Merge pull request #138 from luiscruz/autorefactor-recycle
Android automatic refactor - Recycle
2017-01-06 15:53:48 +01:00
Luis Cruz
0aad48ad49 android automatic refactor recycle 2017-01-04 10:02:18 +00:00
5428113706
Added option to copy images to clipboard. Also caught mysterious classcastexception in settings. 2016-12-30 22:02:32 +01:00
Gregor Santner
98bf2d6a93
New language: Czech - thanks @bezcitu; Search single-line; Update Readme 2016-12-24 15:33:52 +01:00
Gregor Santner
9ecaf6900a
Update travis 2016-12-22 13:23:20 +01:00
Gregor Santner
165626fc6c
Added flavour secondlion* 2016-12-22 04:07:30 +01:00
Gregor Santner
a31a530c7c Release v0.2.2
* Move toggle mobile/desktop to navslider (opt-in)
* Update TR
2016-12-20 12:19:43 +01:00
Gregor Santner
05e6e4d2bd
Reduce messages by broadcast 2016-12-18 16:10:48 +01:00
Gregor Santner
175125996e
Reformat java files 2016-12-18 15:07:23 +01:00
Gregor Santner
4f3eac9977
Allow to jump to last visited page on stream; FIX NullPtr in shared text methods 2016-12-18 15:07:00 +01:00
Gregor Santner
d567b5fbdd
Update strings.xml 2016-12-18 12:31:35 +01:00
Gregor Santner
4519d16af8
Added hungarian language, Update podlist 2016-12-17 00:59:19 +01:00
Gregor Santner
c461ff5b7c
Fixes #117 - Reset NavHeader on change account, reset web profile 2016-12-16 05:24:03 +01:00
Gregor Santner
9e0c6b1741
Fix Rotation, Remove legacy code, Remove PunkBeer Pod
* Fix #92 Rotation
* Fix #111 Legacy
* Remove punkbeer
<https://diasp.org/posts/6449363>
2016-12-16 04:45:53 +01:00
Gregor Santner
19ac40c5b3 Update README.md 2016-12-02 13:07:46 +01:00
Gregor Santner
97543ced06 Announce 0.2.1-next 2016-11-24 00:41:51 +01:00
Gregor Santner
8abb662546 Release - v0.2.1 2016-11-22 19:22:44 +01:00
Gregor Santner
bea1a83f90 Changes for dandelion 2016-11-20 16:43:38 +01:00
3a4f41f758 Merge pull request #125 from Diaspora-for-Android/rotation-option
Added option to control screen rotation (Fix #92)
2016-11-20 15:49:46 +01:00
8ede0ea304
Fixed rotation 2016-11-20 15:49:01 +01:00
6037c0b3eb
Fixed #127 2016-11-13 18:21:33 +01:00
b62f8d32b7
Added option to control screen rotation 2016-11-12 15:36:56 +01:00
dbafcc065c
Fixed duplicate strings and removed unnecessary background colors 2016-11-11 20:37:27 +01:00
be0a37dbc8
Workaround for overlapping fragments. Fixes #116 2016-11-11 20:17:59 +01:00
812c4dabf7 Merge pull request #120 from Diaspora-for-Android/option-topbar-stream
Added back stream loading on topbar click. Made it toggleable in sett…
2016-11-11 20:04:51 +01:00
Gregor Santner
a3060866e9 Update ISSUE_TEMPLATE.md 2016-11-11 12:44:22 +01:00
Gregor Santner
499027a8f1 Revoking last commit 2016-11-10 23:09:22 +01:00
b8476aa107
Do not attempt to load stream when there is no registered account 2016-11-10 14:24:31 +01:00
00e238a028
Added back stream loading on topbar click. Made it toggleable in settings 2016-11-10 14:18:22 +01:00
d6c6920840
Merged translations 2016-11-10 13:30:37 +01:00
c02ededf9f New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
New translations
New translations
New translations
New translations
Approved. Step name: Proofread
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
Approved. Step name: Proofread
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
Translated
Translated
New translations
Translated
Translated
New translations
New translations
New translations
Translated
Translated
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
New translations
New translations
New translations
New translations
New translations
New translations
Approved. Step name: Proofread
New translations
New translations
New translations
New translations
New translations
New translations
New translations
New translations
Approved. Step name: Proofread
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
New translations
New translations
Approved. Step name: Proofread
New translations
New translations
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
Translated
Translated
New translations
New translations
New translations
Translated
New translations
New translations
New translations
New translations
New translations
New translations
Approved. Step name: Proofread
New translations

Translated
Translated
Translated
Translated
Translated
Translated
New translations
Translated
Translated
New translations
New translations
Translated
New translations
Translated
Translated
Translated
Translated
Translated
New translations
Translated
Translated
Approved. Step name: Proofread
Translated
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
Translated
Approved. Step name: Proofread
New translations
New translations
New translations
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
Translated
New translations
Translated
Approved. Step name: Proofread
New translations
Translated
Approved. Step name: Proofread
New translations
Translated
Translated
Translated
Translated
New translations
Translated
Translated
Translated
Translated
Translated
New translations
New translations
Approved. Step name: Proofread
Translated
New translations
New translations
Translated
Translated
Approved. Step name: Proofread
Approved. Step name: Proofread
Translated
Translated
Translated
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
New translations
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
New translations
Approved. Step name: Proofread
Approved. Step name: Proofread
Approved. Step name: Proofread
Translated
New translations
Translated
Translated
Translated
Approved. Step name: Proofread
Translated
Approved. Step name: Proofread
Translated
New translations
Translated
New translations
Translated
New translations
New translations
Approved. Step name: Proofread
New translations
Translated
Approved. Step name: Proofread
New translations
New translations
Translated
New translations
New translations
Translated
Translated
Approved. Step name: Proofread
Translated
New translations
Translated
New translations
Approved. Step name: Proofread
New translations
New translations
2016-11-10 12:20:52 +01:00
c5b201f456
Fixed string 2016-11-08 22:17:15 +01:00
8b48cf38ce
Fixed translatable string 2016-11-08 21:04:01 +01:00
527912e49b
Fixed a ton of lint issues 2016-11-08 20:41:53 +01:00
72a41a0b8a
Updated Issue Template 2016-11-08 16:32:27 +01:00
d0a541bc34
Replaced setTextColor on Buttons with new ThemeHelper method 2016-11-08 16:21:06 +01:00
1db57bd957 Merge pull request #115 from Diaspora-for-Android/rework-about-again
Reworked AboutFragment
2016-11-08 13:45:21 +01:00
f2ed7069a6 Reworked AboutFragment
Reworked licenseFragment

removed unused old layout

Fixed lint issues

Fixed margin

use onClick and fix string indent
2016-11-08 13:07:38 +01:00
Gregor Santner
7a0ec98ed4 Change default signed APK name 2016-11-07 20:53:16 +01:00
Gregor Santner
ff48cb8982 Announcing 0.2.0-next (again) 2016-11-07 18:07:09 +01:00
Gregor Santner
fff3c7a716 v0.2.0a 2016-11-07 17:41:01 +01:00
bea35292f8
Fixed #113 (well, that was quick n easy) 2016-11-06 20:55:51 +01:00
8e324d8f2b Added reports navdrawer entry and divided visibility options into subcategories as suggested by gsantner
Merge PR #110 from DfA/divide-visibility-options

Reports Navdrawer Item reworked
set context of webview in onAttach method of BrowserFragment

Merge branch 'master' of github.com:Diaspora-for-Android/diaspora-android
2016-11-06 20:36:43 +01:00
e6f16fce50
Suppressed unfixable warnings on clearPodSettings and clearAppSettings. 2016-11-06 19:55:45 +01:00
b07a1eba1e
Possible fix for webview crashes 2016-11-06 17:33:22 +01:00
825d9be1e0
Fixed a lint issue and caught potential null pointers in AppLog 2016-11-06 16:45:21 +01:00
73cb775af2
Merged wipe-settings 2016-11-06 16:29:19 +01:00
dd4af48b8e Fixed lint issues (suppressed, where they cant be fixed)
Release 0.2.0 (Updated translation files)

Announcing 0.2.0-next

Added wipe-settings option

Merge branch 'master' of github.com:Diaspora-for-Android/diaspora-android

Merge branch 'master' into wipe-settings

Added ThemedAlertDialogBuilder and a corresponding method in ThemeHelper

Merge branch 'master' into wipe-settings

Reworked dialog
2016-11-06 16:23:18 +01:00
76d58cb100
Added ThemedAlertDialogBuilder and a corresponding method in ThemeHelper 2016-11-06 15:48:54 +01:00
58c61a0d05 Merge branch 'master' of github.com:Diaspora-for-Android/diaspora-android 2016-11-06 15:17:50 +01:00
Gregor Santner
f1dc2eb733 Announcing 0.2.0-next 2016-11-06 05:37:53 +01:00
d17d89f7f9
Fixed lint issues (suppressed, where they cant be fixed) 2016-11-04 23:28:57 +01:00
Gregor Santner
a151d37a4e start of 0.2.0-next 2016-11-04 10:47:33 +01:00
324 changed files with 21579 additions and 4990 deletions

23
.atomignore Executable file
View file

@ -0,0 +1,23 @@
.git
.github
.gradle
.idea
build
gradle
.gitlab-ci.yml
*.iml
local.properties
settings.gradle
gradlew
gradlew.bat
LICENSE.md
app/build
app/.gitignore
app/pom.xml
app/proguard-rules.pro
.hidden
.travis.yml
circle.yml
CODE_OF_CONDUCT*
gradle.properties
LICENSE*

View file

@ -1,51 +1,24 @@
#### General information #### General information
* **App version:**
* **System:**
* **Pod:**
* **Device:** <!-- eg Nexus 5 --> #### Description
* **Android Version:** <!--eg Android 6.0.1 -->
* **App version:** <!-- See in About -> Debug. eg 0.1.5, or commit -->
* **App source:** <!--F-Droid, self build (latest HEAD) -- Can be left blank if not related -->
* **Pod:** <!--eg pod.geraspora.de -- Can be left blank if not related -->
* **Diaspora pod version:** <!--eg 0.5.99.0-p9bd2337c (can be found on the bottom) -- Can be left blank if not related -->
#### Log
<!-- <!--
I have: Look for already reported issues before posting!
Also take a look at documentation and wiki, or write in the project chat.
- searched open and closed issues for duplicates App version: The version of the app installed and the installation source. Example: v0.3.5 F-Droid
- read <https://github.com/Diaspora-for-Android/diaspora-android/blob/master/CONTRIBUTING.md> Please keep in mind that only the latest downloadable version is supported and that there are no backports to older versions.
- not submitted translations - see [Crowdin](https://crowdin.com/project/diaspora-for-android/invite) System: Information about where the app is running. Give all details you know, but at least the Android OS version.
Example: Android 8.0.1, Nexus 5, LineageOS
Description:
What this is about, what happens and what is expected to happen. What needs to be done for it to happen.
If a crash is happening a log is needed. Screenshots or demonstration videos are always helpful too.
--> -->
#### Steps to reproduce
1. …
2. …
3. …
#### Expected result
**What is the expected output?**
**What do you see instead?**
Upload screenshots via drag&drop if needed and apply resizing:
`<img width="30%" height="30%" src="https://cloud.githubusercontent.com/assets/67..b55.jpg">`
#### Debug output
Please post the output of adb logcat. The log should begin with the start of Diaspora for Android and include all the steps it takes to reproduce the problem.
````
adb logcat -s com.github.dfa.diaspora_android
````
#### In-App debug log
This is useful for visual bugs without application crashes
````
You can long click on the in-app debug log in order to copy it to the clipboard
````

27
.github/PULL_REQUEST_TEMPLATE vendored Normal file
View file

@ -0,0 +1,27 @@
<!--
Hello, and thanks for contributing!
Please always do auto-reformat on code before creating a PR.
In Android-Studio do a right-click on java->Reformat and check the first two options.
After creating the PR please wait patiently till somebody from the team has time to give a review.
The top-priority requirement for this to get merged is, that building/tests don't fail.
If theres an continious integration system integrated in this project, you should see a colored checkmark in the PR window which tells the status.
## Contributors document
Add yourself! When adding your information to the `CONTRIBUTORS.md` file, please use the following format:
Schema: **[Name](Reference)**<br/>~° Text
Where:
* Name: username, first/lastname
* Reference: E-Mail, Webpage
* Text: Information about / kind of contribution
Example:
* **[Nice Guy](http://niceguy.web)**<br/>~° German localization
-->

View file

@ -0,0 +1,68 @@
##############################################################################################################################
# # Cleanup:
#const sleep = ms => () => new Promise((resolve, reject) => window.setTimeout(resolve, ms));
#Promise.resolve()
#.then(() => { document.getElementsByClassName("details-overlay details-reset position-relative d-inline-block ")[3].children[0].click(); })
#.then(sleep(500))
#.then(() => { document.getElementsByClassName("dropdown-item btn-link menu-item-danger")[0].click(); })
#.then(sleep(1000))
#.then(() => { document.getElementsByClassName("btn btn-block btn-danger")[0].click();});
#
# while [ 1 ] ; do sleep 4; xdotool key Up; sleep 0.1; xdotool key Return; done
##############################################################################################################################
name: "CI"
on: [push, pull_request]
jobs:
build:
if: "!contains(github.event.head_commit.message, 'ci skip') && (!contains(github.event_name, 'pull_request') || (contains(github.event_name, 'pull_request') && github.event.pull_request.head.repo.full_name != github.repository))"
runs-on: ubuntu-latest
steps:
- name: "Checkout: Code"
uses: actions/checkout@v2
- name: "Checkout: Code (PR)"
uses: actions/checkout@v2
if: "contains(github.event_name, 'pull_request')"
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: "Setup: Java"
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: "Cache: Gradle"
uses: actions/cache@v2
with:
path: |
~/.gradle
.gradle
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.*') }}
- name: "Build: Project with make"
run: make clean all
- name: "Build: List dist files"
if: always()
run: find dist -type f -maxdepth 2
- name: "Artifacts: All"
if: always()
uses: actions/upload-artifact@v2.2.1
with:
name: "all"
path: dist
retention-days: 5
- name: "Artifacts: Android APK"
uses: actions/upload-artifact@v2.2.1
with:
name: "android-apk"
path: |
dist/*.apk

21
.gitignore vendored
View file

@ -1,12 +1,3 @@
##############
### Project ##
app/src/main/res/raw/changelog.md
app/src/main/res/raw/contributors.md
app/src/main/res/raw/license.md
app/src/main/res/raw/readme.md
app/src/main/res/raw/contributors.txt
app/src/main/res/raw/podlist.json
############## ##############
### Common ### ### Common ###
*~* *~*
@ -45,6 +36,7 @@ tmp/
### Gradle ### ### Gradle ###
.gradle .gradle
build/ build/
dist/
gradle-app.setting gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
@ -99,3 +91,14 @@ proguard/
# Android Studio Stuff # Android Studio Stuff
.navigation/ .navigation/
gen-external-apklibs gen-external-apklibs
### Project ##
app/src/main/res/raw/changelog.*
app/src/main/res/raw/license.*
app/src/main/res/raw/readme.*
app/src/main/res/raw/contributors.*
app/flavor*
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

View file

@ -1,35 +0,0 @@
language: android
jdk:
- oraclejdk8
android:
components:
- tools
- tools # TODO https://github.com/travis-ci/travis-ci/issues/6193
- platform-tools
- build-tools-24.0.3
- android-24
- extra-android-m2repository
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
script: "./gradlew $TASK"
env:
- TASK="lintDebug"
- TASK="build check --stacktrace"
branches:
except:
- l10n_master
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/e462044d3105a7bb4b4f
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always
after_success:
- bash <(curl -s https://codecov.io/bash)

View file

@ -1,4 +1,141 @@
# v0.2.0 ### Recent changes
- See [Discussions](https://github.com/gsantner/dandelion/discussions), [Issues](https://github.com/gsantner/dandelion/issues) and [Project page](https://github.com/gsantner/dandelion#readme) to see what is going on.
### v1.4.0
- Add seconds to 'save picture' date format
- Updated translations
- Added german F-Droid description translation
- Update to Android SDK 29
### v1.3.0
- Add option to open youtube links external/in YouTube app (optional)
- Pull to refresh
### v1.2.3
**Improved:**
- More supported languages, more complete translations!
### v1.2.1
**App release: dandelior**
- Added an (rebranded) flavor of dandelion: dandelior
- Only differenties in use are other (black) icon and AMOLED colors by default enabled
- Already available on F-Droid
**New features:**
- All new Aspects and Tags, using a searchable dialog
**Fixed:**
- Sometimes the Stream went white, which is due an still (>3 years) unfixed Android Support library bug. It should not occur very often anymore due less use of fragments.
**Improved:**
- Various small tweaks
- Updated translation files
### v1.1.3
- Improve sharing *a lot*, add support for multiple filetypes
- Support for downloading GIFs ;)
- Rework screenshot saving and sharing; add new share options:
- Merge license and changelog dialog on first start
### v1.1.2
- Fix: loading non-pod links outside customtab/external browser
- Fix: webview-js dialog not dismissing correctly
### v1.1.0
- Added: App shortcuts (Android 7+)
- Updated: podlist
- More supported languages
- File sharing fixes
### v1.0.8
- Modified: Navigation - Merge bottom toolbar into top
- Updated: Build for Android O/27
- Updated: Language change preference
- Added: B/W coloring of toolbar popup
### v1.0.5
- Updated: Language preference
### v1.0.4
- Updated: README
- Added: Hide statusbar option
- Fixed: Language list
- Added: Sardinian,Malayalam,Turkish translation
### v1.0.3
- Update opoc
- Better visibility for counter badge
- Refactor DiasporaPod model
- Update PodList (many new pods!)
- Fix CustomTab bug
### v1.0.2 (2017-08-05)
- Improve build script
- Update translation file license
### v1.0.1 (2017-07-30)
- Update SimpleMarkdownParser
- Move untranslatable strings
### v1.0.0 (2017-06-14)
- Added AMOLED mode
- Improve NavDrawer
- Improve Shared by notice
- Use opoc/Helpers,AdBlock
### v0.2.7 (2017-05-26)
- Small improvements
### v0.2.6 (2017-05-03)
- Fixed #156 #158 #159
- Added chinese traditional language
- Added NavSlider option: Statistics
- Changed shared-by-notice text
- Fix bottom bar hint text background color (Fix #157)
- Color improvements
### v0.2.5 (2017-04-10)
- Introduce minimalistic Markdown Parser
- Show LICENSE at first start
- Show CHANGELOG after update
- Convert existing Markup files to Markdown
- Update existing markdown files
- Update AboutActivity to use new Parser
- Added translations: Danish, Korean, Galician
### v0.2.4 (2017-03-19)
- Different icon and color for secondlion
- Language switcher
- Handle dia.so links
- Improve security at internal browser decision
- More icons for notification dropdown
- Update gradle build scripts
- Added CircleCI
### v0.2.3 (2017-02-24)
- Add Czech translation (thanks @bezcitu)
- Add option to copy image urls to clipboard
- Fixed some bugs related to image upload/download
- Published secondlion\* (nighly version of dandelion\*)
### v0.2.2
- Move "toggle mobile/deskop" to nav-slider
- Reduce messages sent via broadcast
- Allow to jump to last visited page on stream
- New language: Hungarian
- FIX NullPtr in shared text methods
- FIX #117 - Reset NavHeader on change account, reset web profile
- FIX #92 Roation settings
- FIX #111 Remove legacy code
### v0.2.1
- App name changed to **dandelion***
- Rotation options
- Top toolbar loads screen again (toggleable in settings)
- Fixed overlapping fragments
- Visual rework of the About-section of the app
### v0.2.0a
- Added: Customizable Theme Colors! - Added: Customizable Theme Colors!
- Improved account setup with easy tor hidden service configuration - Improved account setup with easy tor hidden service configuration
- Eye candy for the settings activity - Eye candy for the settings activity
@ -7,7 +144,7 @@
- Lots of bugfixes - Lots of bugfixes
- Fixes for the bugfixes! - Fixes for the bugfixes!
# v0.1.6 ### v0.1.6
- Added: New languages - Added: New languages
- Changed: New delicious visual style + launcher icon - Changed: New delicious visual style + launcher icon
- Changed: Notifications-/Messages-indicator does now display number of events! - Changed: Notifications-/Messages-indicator does now display number of events!
@ -19,7 +156,7 @@
- Fixed: Image upload for older devices - Fixed: Image upload for older devices
- Added: Option to open external links in Chrome CustomTab - Added: Option to open external links in Chrome CustomTab
# v0.1.5 ### v0.1.5
- Update title depending on what the user is doing - Update title depending on what the user is doing
- New greenish color scheme - New greenish color scheme
- Replaced SwipeToRefresh functionality with refresh button - Replaced SwipeToRefresh functionality with refresh button
@ -34,7 +171,7 @@
- Allow slider customization - Allow slider customization
- Show aspect name after selection - Show aspect name after selection
# v0.1.4 (2016-07-31) ### v0.1.4 (2016-07-31)
- by @vanitasvitae, @gsantner, @di72nn - by @vanitasvitae, @gsantner, @di72nn
- Allow turning off toolbar intellihide - Allow turning off toolbar intellihide
- Handle links from browseable intent filter #38 - Handle links from browseable intent filter #38
@ -49,7 +186,7 @@
- Share screenshot fix; Minor Aspects rework - Share screenshot fix; Minor Aspects rework
- Update to SDK 24 (Android N) - Update to SDK 24 (Android N)
# v0.1.3 (2016-07-04) ### v0.1.3 (2016-07-04)
- Added titles on top toolbar (by @scoute-dich) - Added titles on top toolbar (by @scoute-dich)
- Made bottom toolbar automatically disappear - Made bottom toolbar automatically disappear
- Added option to share images to external app - Added option to share images to external app
@ -60,7 +197,7 @@
- Removed swipe-to-refresh functionality in some places - Removed swipe-to-refresh functionality in some places
- Big thanks and good luck to @scoute-dich and @martinchodev for accompanying this project :) - Big thanks and good luck to @scoute-dich and @martinchodev for accompanying this project :)
# v0.1.2 (2016-06-05) ### v0.1.2 (2016-06-05)
- Extract and show aspects (by @gsantner) - Extract and show aspects (by @gsantner)
- Cache last podlist - Cache last podlist
- Better sharing from app - Better sharing from app
@ -73,7 +210,7 @@
- Lots of refactoring; Reworked Splash,PodSelectionActivity; Switch Pod; Clear settings; - Lots of refactoring; Reworked Splash,PodSelectionActivity; Switch Pod; Clear settings;
- Activity transitions, usability MainActivity, green accent color - Activity transitions, usability MainActivity, green accent color
# v0.1.1 ### v0.1.1
- Sharing updated (by @scoute-dich) - Sharing updated (by @scoute-dich)
- Screenshotting updated - Screenshotting updated
- Gitter integration (by @gsantner) - Gitter integration (by @gsantner)
@ -83,8 +220,8 @@
- Travis CI integration - Travis CI integration
- Bump Gradle, Build-Tools, Libs to Android Studio 2.1 defaults - Bump Gradle, Build-Tools, Libs to Android Studio 2.1 defaults
# v0.1.0 (Diaspora for Android) ### v0.1.0 (Diaspora for Android)
First version of the organization *Diaspora for Android* First version of the organization *Diaspora for Android*
Consists mostly of code from: Consists mostly of code from:
- Diaspora-Native-Webapp (by @martinchodev ) - Diaspora-Native-Webapp (by @martinchodev )
- scoutedich additions (by @scoute-dich) - scoutedich additions (by @scoute-dich)

74
CODE_OF_CONDUCT.md Normal file
View file

@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <gsantner AT mailbox DOT org>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View file

@ -1,6 +0,0 @@
We are always open for any kind of contribution. (PR's, bug reports, feature requests, translations, ..)
If you got any questions feel free to join our XMPP/Jabber conference at `diaspora-android@conference.jabberhead.tk` or [Gitter](https://gitter.im/Diaspora-for-Android/diaspora-android).
Note that the main project members are mostly busy with their job/university/school and may not react or start coding immediately.
We use Crowdin to translate Diaspora for Android. Join our project here: <https://crowdin.com/project/diaspora-for-android/invite>
If your desired language is not listed please contact the maintainers/owner.

32
CONTRIBUTORS.md Normal file
View file

@ -0,0 +1,32 @@
<!--
This file contains references to people who contributed to the app.
Schema: **[Name](Reference)**<br/>~° Text
Where:
* Name: username, first/lastname
* Reference: E-Mail, Webpage
* Text: Information about / kind of contribution
## LIST OF CONTRIBUTORS
-->
* **[Gregor Santner](http://github.com/gsantner)**<br/>~° Development of dandelion
* **[Paul Schaub](https://github.com/vanitasvitae)**<br/>~° Development of dandelion
* **[Martín Vukovic](martinvukovic AT protonmail DOT com)**<br/>~° Diaspora Native WebApp
* **[Gaukler Faun](https://github.com/scoute-dich)**<br/>~° Diaspora Native WebApp additions
* **[Airon90](https://diasp.eu/u/airon90)**<br/>~° Italian translation
* **[Nacho Fernández](nacho_f AT joindiaspora DOT com)**<br/>~° Spanish translation
* **[Naofumi Fukue](https://github.com/naofum)**<br/>~° Japanese translation
* **[pskosinski](email AT pskosinski DOT pl)**<br/>~° Polish translation
* **[SansPseudoFix](https://github.com/SansPseudoFix)**<br/>~° French translation
* **[Zsolt Szakács](maxigaz AT diaspora DOT zone)**<br/>~° Hungarian translation
* **[Luís F.S. Rosa](https://github.com/luisfsr)**<br/>~° Brazilian Portuguese translation
* **[Danilo Raffaelli](https://crowdin.com/profile/Daraf)**<br/>~° Italian translation
* **[Âng Iōngchun](https://pubpod.alqualonde.org/u/iongchun)**<br/>~° Chinese traditional translation
* **[Mikkel Kirkgaard Nielsen](http://www.mikini.dk)**<br/>~° Danish translation
* **[Jean Lucas](jean AT 4ray DOT co)**<br/>~° Spanish translation
* **[asereze](https://github.com/asereze)**<br/>~° Sardinian translation
* **[Xosé M. Lamas](http://xmgz.eu)**<br />~° Galician translation
* **[massimiliano](https://framagit.org/massimiliano)**<br />~° Contributor

View file

@ -1,17 +0,0 @@
00l>> This file contains references to people who contributed to the app.
01l>> If you helped by translating the app, please send a message on Crowdin.
02l>> You can also send a mail to [gdev AT live DOT de](https://gsantner.github.io/about/email/) to get included.
03l>>
04l>> Schemes:
05l>> Firstname Lastname (Link): Text
06l>> Firstname Lastname (E-Mail): Text
07l>> Username (Link): Text
08l>> Username (E-Mail): Text
## 99l CONTRIBUTORS
Abhijith Balan (abhijithb21 AT openmailbox DOT org): Malayalam translation
Airon90 (https://diasp.eu/u/airon90): Italian translation
Gaukler Faun (https://github.com/scoute-dich): Diaspora Native WebApp additions
Martín Vukovic (martinvukovic AT protonmail DOT com): Diaspora Native WebApp
Nacho Fernández (nacho_f AT joindiaspora DOT com): Spanish translation
pskosinski (email AT pskosinski DOT pl): Polish translation
SansPseudoFix (https://github.com/SansPseudoFix): French translation

View file

@ -1,20 +1,25 @@
# App # dandelion\*
`---------------`
This program is free software: you can redistribute it and/or modify <small>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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/. along with this program. If not, see https://www.gnu.org/licenses/.</small>
`---------------`
If you want to publish dandelion\* in an app store, you have to change the app name (dandelion\*), package name & launcher icon (blue). See "7. Additional Terms" of GPL.
You also have to provide the modifications in source code somewhere online for free. This is explicitly not about building the app and sharing with some friends, it's about app stores.
The reason is, that most app stores allow an app id just once, which would block our uploads if somebody else uploaded. Also, we want to keep control on where the app is published, and want to make sure there is no malware in it.
The F-Droid project team is explicitly allowed to publish dandelion\* without listed required modifications above at official F-Droid repository.
# Miscellaneous ## Miscellaneous
We took some inspiration and code from LeafPic. Go check it out, its free software as well! We took some inspiration and code from LeafPic. Go check it out, its free software as well!
https://github.com/HoraApps/LeafPic <https://github.com/HoraApps/LeafPic>

99
Makefile Normal file
View file

@ -0,0 +1,99 @@
# License of Makefile: Public Domain / CC0
.PHONY: $(shell sed -n -e '/^$$/ { n ; /^[^ .\#][^ ]*:/ { s/:.*$$// ; p ; } ; }' $(MAKEFILE_LIST))
.NOTPARALLEL: clean
.DEFAULT_GOAL := all
env-%:
@: $(if ${${*}},,$(error Environment variable $* not set))
####################################################################################
DIST_DIR = dist
MOVE = mv
all: $(DIST_DIR) spellcheck lint deptree test build aapt_dump_badging
####################################################################################
$(DIST_DIR):
mkdir -p ${DIST_DIR}
ANDROID_BUILD_TOOLS := $(shell test -n "$ANDROID_SDK_ROOT" && find "${ANDROID_SDK_ROOT}/build-tools" -iname "aapt" | sort -r | head -n1 | xargs dirname)
TOOL_SPELLCHECKING_ISPELL := $(shell command -v ispell 2> /dev/null)
FLAVOR := $(or ${FLAVOR},${FLAVOR},Atest)
.NOTPARALLEL: gradle gradle-analyze-log
gradle: env-ANDROID_SDK_ROOT
mkdir -p $(DIST_DIR)/log/
chmod +x gradlew
./gradlew --no-daemon --parallel --stacktrace $A 2>&1 | tee "$(DIST_DIR)/log/gradle.log"
@echo "-----------------------------------------------------------------------------------"
gradle-analyze-log:
mv "$(DIST_DIR)/log/gradle.log" "$(DIST_DIR)/log/gradle$A.log"
cat "$(DIST_DIR)/log/gradle$A.log" | grep "BUILD " | tail -n1 | grep -q "BUILD SUCCESSFUL in"
adb: env-ANDROID_SDK_ROOT
"${ANDROID_SDK_ROOT}/platform-tools/adb" $A 2>&1 | tee "$(DIST_DIR)/log/adb-$L.log"
aapt: env-ANDROID_SDK_ROOT
"${ANDROID_BUILD_TOOLS}/aapt" $A 2>&1 | grep -v 'application-label-' | tee "$(DIST_DIR)/log/aapt$L.log"
build:
rm -f $(DIST_DIR)/*.apk
$(MAKE) A="clean assembleFlavor$(FLAVOR) -x lint" gradle
find app -type f -newermt '-300 seconds' -iname '*.apk' -not -iname '*unsigned.apk' | xargs cp -R -t $(DIST_DIR)/
$(MAKE) A="-build" gradle-analyze-log
lint:
rm -Rf $(DIST_DIR)/lint
mkdir -p $(DIST_DIR)/lint/
$(MAKE) A="lintFlavorDefaultDebug" gradle
find app -type f -iname 'lint-results-*' | grep -v 'intermediates' | xargs cp -R -t $(DIST_DIR)/lint
$(MAKE) A="-lint" gradle-analyze-log
test:
rm -Rf $(DIST_DIR)/tests
$(MAKE) A="testFlavorDefaultDebugUnitTest -x lint" gradle
mkdir -p app/build/test-results/testFlavorDefaultDebugUnitTest && echo 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHRlc3RzdWl0ZSBuYW1lPSJkdW1teSIgdGVzdHM9IjEiIHNraXBwZWQ9IjAiIGZhaWx1cmVzPSIwIiBlcnJvcnM9IjAiIHRpbWVzdGFtcD0iMjAyMC0xMi0wOFQwMDowMDowMCIgaG9zdG5hbWU9ImxvY2FsaG9zdCIgdGltZT0iMC4wMSI+CiAgPHByb3BlcnRpZXMvPgogIDx0ZXN0Y2FzZSBuYW1lPSJkdW1teSIgY2xhc3NuYW1lPSJkdW1teSIgdGltZT0iMC4wMSIvPgogIDxzeXN0ZW0tb3V0PjwhW0NEQVRBW11dPjwvc3lzdGVtLW91dD4KICA8c3lzdGVtLWVycj48IVtDREFUQVtdXT48L3N5c3RlbS1lcnI+CjwvdGVzdHN1aXRlPgo=' | base64 -d > 'app/build/test-results/testFlavorDefaultDebugUnitTest/TEST-dummy.xml'
find app -type d -iname 'testFlavorDefaultDebugUnitTest' | xargs cp -R -t $(DIST_DIR)/
mv ${DIST_DIR}/testFlavorDefaultDebugUnitTest $(DIST_DIR)/tests
$(MAKE) A="-test" gradle-analyze-log
deptree:
$(MAKE) A="app:dependencies --configuration flavor$(FLAVOR)DebugRuntimeClasspath" gradle
$(MAKE) A="-dependency-tree" gradle-analyze-log
clean:
$(MAKE) A="clean" gradle
rm -Rf $(DIST_DIR) app/build app/flavor* .idea dist
find . -type f -iname "*.iml" -delete
$(MAKE) $(DIST_DIR)
@echo "-----------------------------------------------------------------------------------"
install:
$(MAKE) A="install -r $(DIST_DIR)/*.apk" L="install" adb
run:
$(MAKE) A="shell monkey -p $$(aapt dump badging $(DIST_DIR)/*.apk | grep package: | sed 's@.* name=@@' | sed 's@ .*@@' | xargs | head -n1) -c android.intent.category.LAUNCHER 1" L="run" adb
aapt_dump_badging:
$(MAKE) A="dump badging $(DIST_DIR)/*.apk" aapt
@echo "-----------------------------------------------------------------------------------"
spellcheck:
mkdir -p "$(DIST_DIR)/lint/"
ifndef TOOL_SPELLCHECKING_ISPELL
@echo "Tool ispell (spellcheck) not found in PATH. Spellcheck skipped." > "$(DIST_DIR)/lint/stringsxml-spellcheck.txt"
else
@echo "Use ispell for spellchecking the original values/strings.xml"
find . -iname "strings.xml" -path "*/main*/values/*" | head -n1 | xargs cat \
| grep "<string name=" | sed 's@.*">@@' | sed 's@</string>@@' | sed 's@\\n@ @g' | sed 's@\\@@g' \
| ispell -W3 -a | grep ^\& | sed 's@[0-9]@@g' | sort | uniq | cut -d, -f1-4 \
| sed 's@^..@- @' | column -t -s: \
> "$(DIST_DIR)/lint/stringsxml-spellcheck.txt"
@echo "\nPotential words with bad spelling:"
endif
@cat "$(DIST_DIR)/lint/stringsxml-spellcheck.txt"
@echo "-----------------------------------------------------------------------------------"

96
NEWS.md Normal file
View file

@ -0,0 +1,96 @@
# dandelion - News
## General
### Installation
You can install and update from [F-Droid](https://f-droid.org/repository/browse/?fdid=com.github.dfa.diaspora_android) or [GitHub](https://github.com/gsantner/dandelion/releases/latest).
F-Droid is a store for free & open source apps.
The *.apk's available for download are signed by the F-Droid team and guaranteed to correspond to the (open source) source code of dandelion.
Generally this is the recommended way to install dandelion & keep it updated.
### Get informed
* Check the [project readme](https://github.com/gsantner/dandelion/tree/news#readme) for general project information.
* Check the [project news](https://github.com/gsantner/dandelion/blob/master/NEWS.md#readme) for more details on what is going on.
* Check the [project git history](https://github.com/gsantner/dandelion/commits/master) for most recent code changes.
### The right place to ask
If you have questions or found an issue please head to the [dandelion project](https://github.com/gsantner/dandelion/issues/new/choose) and ask there.
[Search](https://github.com/gsantner/dandelion/issues?q=#js-issues-search) for same/similar and related issues/questions before, it might be already answered or resolved.
### Navigation
* [dandelion v1.2 - Add dandelior - Searchable Tags and Aspects](#dandelion-v12---add-dandelior---searchable-tags-and-aspects)
* [dandelion v0.1.2 - Aspekte, Pod wechseln](#dandelion-v012---aspekte-pod-wechseln)
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
# dandelion\* v1.2 - Add dandelior\* - Searchable Tags and Aspects
_12. August 2018_
## dandelior\* is a rebranded version of dandelion\*
dandelior\* is based 100% on the same code and resources as dandelion\*. Its from the same code repository, just a different build flavor.
The main purpose of dandelior\* is the most requested feature till date - to support multiple accounts / another account at dandelion\*.
- Added an (rebranded) flavor of dandelion: dandelior
- Only differenties in use are other (black) icon and AMOLED colors by default enabled
- Already available on F-Droid
**New features:**
- All new Aspects and Tags, using a searchable dialog
**Fixed:**
- Sometimes the Stream went white, which is due an still (3+ years) unfixed Android Support library bug. It should not occur very often anymore due less use of fragments.
**Improved:**
- Various small tweaks
- Updated translation files
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
# dandelion v0.1.2 - Aspekte, Pod wechseln
_05. Juni 2016_
In den letzten Tagen hat @gsantner viel Zeit in die inoffizielle diaspora\* Android App ([dandelion\*](https://github.com/gsantner/dandelion)) investiert.
Dabei wurden unter anderem folgende Änderungen beigesteuert:
- Allgemeines zur Usability
- Animationen für den Activity-Wechsel und Startup, WebView-Scroll-Top
- Podliste caching
- Aspekt-Liste und Aspekte hinzugefügt
- Verbessertes Sharing aus der App
- Material Progressbar
- Suche verbessert
- Collapsing top menu
- toolbar/actions/menu geändert, fab entfernt
- Refactoring layout & menu files, dialogs
- Überarbeitete Main,Splash,PodSelectionActivity
- Pod wechseln

104
README.md
View file

@ -1,43 +1,81 @@
[![F-Droid](https://f-droid.org/wiki/images/0/06/F-Droid-button_get-it-on.png)](https://f-droid.org/repository/browse/?fdid=com.github.dfa.diaspora_android) [![GitHub releases](https://img.shields.io/github/tag/gsantner/dandelion.svg)](https://github.com/gsantner/dandelion/releases)
[![GitHub downloads](https://img.shields.io/github/downloads/gsantner/dandelion/total.svg?logo=github&logoColor=lime)](https://github.com/gsantner/dandelion/releases)
[![Translate on Crowdin](https://img.shields.io/badge/translate-crowdin-green.svg)](https://crowdin.com/project/diaspora-for-android/invite)
[![Chat on Matrix](https://img.shields.io/badge/chat-matrix-blue.svg)](https://matrix.to/#/#dandelion:matrix.org)
[![GitHub CI](https://github.com/gsantner/dandelion/workflows/CI/badge.svg)](https://github.com/gsantner/dandelion/actions)
[![Codacy code quality](https://img.shields.io/codacy/grade/aff869c440bc48b7bd64680e97cbc453)](https://www.codacy.com/app/gsantner/dandelion)
<a name="badgers"></a>[![Build Status](https://travis-ci.org/Diaspora-for-Android/diaspora-android.svg?branch=master)](https://travis-ci.org/Diaspora-for-Android/diaspora-android) # dandelion\*
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/diaspora-for-android/localized.svg)](https://crowdin.com/project/diaspora-for-android) <img src="/app/src/main/ic_launcher-web.png" align="left" width="100" hspace="10" vspace="10">
[![Chat - FreeNode IRC](https://img.shields.io/badge/chat-on%20freenode-blue.svg)](https://kiwiirc.com/client/irc.freenode.net/?nick=user-dfa|?#diaspora-for-android) This is an unofficial webview based client for the community-run, distributed social network <b><a href="https://diasporafoundation.org/">diaspora*</a></b>.
[![Chat - Gitter](https://img.shields.io/badge/chat-on%20gitter-blue.svg)](https://gitter.im/Diaspora-for-Android/diaspora-android)
<div style="display:flex;" >
<a href="https://f-droid.org/repository/browse/?fdid=com.github.dfa.diaspora_android">
<img src="https://f-droid.org/badge/get-it-on.png" alt="Get it on F-Droid" height="80">
</a>
<!--<a href="https://play.google.com/store/apps/details?id=com.github.dfa.diaspora_android">
<img alt="Get it on Google Play" height="80" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" />
</a>-->
</div></br>
# Diaspora for Android ## Description
This is an unofficial webview based client for the community-run, distributed social network <b><a href="https://diasporafoundation.org/">diaspora*</a></b>.
It's currently under development and should be used with that in mind. Please submit any bugs you might find.
This is an unofficial webview based client for the community-run, distributed social network **[Diaspora*](https://diasporafoundation.org/)**. It's currently under development and should be used with that in mind. Please submit any bugs you might find. #### WebApp
The app is developed as a WebApp because currently diaspora\* doesn't have an functional API that can be used to create a native interface to retrieve the user's data, publications, direct messages and so on. That's why there are currently only WebApps for diaspora\* out there.
[Stay tuned on diaspora\* issues](https://github.com/diaspora/diaspora/labels/api) about API.
- Download ([F-Droid](https://f-droid.org/repository/browse/?fdid=com.github.dfa.diaspora_android), [Release Archive](https://github.com/Diaspora-for-Android/diaspora-android/releases)) Why is a WebApp better than using the mobile site on a browser?
- Watch [Changelog](https://github.com/Diaspora-for-Android/diaspora-android/blob/master/CHANGELOG.md)
- See [Screenshots](https://github.com/Diaspora-for-Android/diaspora-android/blob/master/SCREENSHOTS.md)
## Contributions
We are always open for any kind of contribution. (PR's, bug reports, feature requests, translations, ..)
If you got any questions feel free to contact us on IRC, XMPP or Gitter. You can start chatting by clicking on the [blue chat badges](#badgers) listed on top.
We use Crowdin to translate Diaspora for Android. Join our project here: <https://crowdin.com/project/diaspora-for-android/invite>. If your desired language is not listed please contact the maintainers/owner.
Note that the main project members are working on this project for free during leisure time, are mostly busy with their job/university/school, and may not react or start coding immediately.
### License
Diaspora for Android is released under GNU GENERAL PUBLIC LICENSE (see [LICENCE](https://github.com/Diaspora-for-Android/diaspora-android/blob/master/LICENSE.md)).
### WebApp
The app is developed as a WebApp because currently Diaspora doesn't have an API that can be used to create a native interface to retrieve the user's data, publications, direct messages and so on. That's why there are only WebApps for Diaspora out there.
[Stay tuned on Diaspora* Issues](https://github.com/diaspora/diaspora/labels/api) about API.
Why is a WebApp better than using the mobile site on a browser?
Basically it provides better integration with the system (events coming into and going out of the app), notifications, customized interface and functions and a nice little icon that takes you directly to your favorite social network :) Basically it provides better integration with the system (events coming into and going out of the app), notifications, customized interface and functions and a nice little icon that takes you directly to your favorite social network :)
### Device Requirements #### Device Requirements
The minimum Android version supported is Jelly Bean, Android v4.2.0 / API 17 The minimum Android version supported is Jelly Bean, Android v4.2.0 / API 17
### App Permissions ### Privacy & Permissions<a name="privacy"></a>
Diaspora for Android requires access to the Internet and to external storage to be able to upload photos when creating a new post and for taking screenshots. dandelion\* requires access to the Internet and to external storage to be able to upload photos when creating a new post and for taking screenshots.
## Maintainers
- gsantner ([GitHub](https://github.com/gsantner), [Web](https://gsantner.github.io), [diaspora*](https://pod.geraspora.de/people/d1cbdd70095301341e834860008dbc6c)) ## Contributions
- vanitasvitae ([GitHub](https://github.com/vanitasvitae), [Diaspora](https://pod.geraspora.de/people/bbd7af90fbec013213e34860008dbc6c)) The project is always open for contributions and accepts pull requests.
The project uses [AOSP Java Code Style](https://source.android.com/source/code-style#follow-field-naming-conventions), with one exception: private members are `_camelCase` instead of `mBigCamel`. You may use Android Studios _auto reformat feature_ before sending a PR.
Translations can be contributed on GitHub. You can use Stringlate ([![Translate - with Stringlate](https://img.shields.io/badge/stringlate-translate-green.svg)](https://lonamiwebs.github.io/stringlate/translate?git=https%3A%2F%2Fgithub.com%2Fgsantner%2Fdandelion.git)) to translate the project directly on your Android phone. It allows you to export as E-Mail attachement and to post on GitHub.
Join our Matrix channel and say hello! Don't be afraid to start talking. [![Chat - Matrix](https://img.shields.io/badge/chat-on%20matrix-blue.svg)](https://matrix.to/#/#dandelion:matrix.org)
Note that the main project members are working on this project for free during leisure time, are mostly busy with their job/university/school, and may not react or start coding immediately.
#### Resources
* Project: [Changelog](/CHANGELOG.md) | [Issues level/beginner](https://github.com/gsantner/dandelion/issues?q=is%3Aissue+is%3Aopen+label%3Alevel%2Fbeginner) | [License](/LICENSE.txt) | [CoC](/CODE_OF_CONDUCT.md)
* Project diaspora\* account: [dandelion00@diasp.org](https://diasp.org/people/48b78420923501341ef3782bcb452bd5)
* diaspora\*: [GitHub](https://github.com/diaspora/diaspora) | [Web](https://diasporafoundation.org) | [d\* HQ account](https://pod.diaspora.software/people/7bca7c80311b01332d046c626dd55703)
* App on F-Droid: [Metadata](https://gitlab.com/fdroid/fdroiddata/blob/master/metadata/com.github.dfa.diaspora_android.txt) | [Page](https://f-droid.org/packages/com.github.dfa.diaspora_android/) | [Wiki](https://f-droid.org/wiki/page/com.github.dfa.diaspora_android) | [Build log](https://f-droid.org/wiki/page/com.github.dfa.diaspora_android/lastbuild)
## Licensing
dandelion\* is released under GNU GENERAL PUBLIC LICENSE (see [LICENCE](https://github.com/gsantner/dandelion/blob/master/LICENSE.md)).
The app is licensed GPL v3. Localization files and resources (strings\*.xml) are licensed CC0 1.0.
For more licensing informations, see [`3rd party licenses`](/app/src/main/res/raw/licenses_3rd_party.md).
## Screenshots
<div style="display:flex;" >
<img src="https://raw.githubusercontent.com/gsantner/dandelion/master/metadata/en-US/phoneScreenshots/01.png" width="19%" >
<img src="https://raw.githubusercontent.com/gsantner/dandelion/master/metadata/en-US/phoneScreenshots/02.png" width="19%" style="margin-left:10px;" >
<img src="https://raw.githubusercontent.com/gsantner/dandelion/master/metadata/en-US/phoneScreenshots/03.png" width="19%" style="margin-left:10px;" >
<img src="https://raw.githubusercontent.com/gsantner/dandelion/master/metadata/en-US/phoneScreenshots/04.png" width="19%" style="margin-left:10px;" >
<img src="https://raw.githubusercontent.com/gsantner/dandelion/master/metadata/en-US/phoneScreenshots/05.png" width="19%" style="margin-left:10px;" >
</div>
<div style="display:flex;" >
<img src="https://raw.githubusercontent.com/gsantner/dandelion/master/metadata/en-US/phoneScreenshots/06.png" width="19%" >
<img src="https://raw.githubusercontent.com/gsantner/dandelion/master/metadata/en-US/phoneScreenshots/07.png" width="19%" style="margin-left:10px;" >
<img src="https://raw.githubusercontent.com/gsantner/dandelion/master/metadata/en-US/phoneScreenshots/08.png" width="19%" style="margin-left:10px;" >
<img src="https://raw.githubusercontent.com/gsantner/dandelion/master/metadata/en-US/phoneScreenshots/09.png" width="19%" style="margin-left:10px;" >
</div>
### Notice
#### Maintainers
- gsantner ([GitHub](https://github.com/gsantner), [diaspora*](https://pod.geraspora.de/people/d1cbdd70095301341e834860008dbc6c))
- vanitasvitae ([GitHub](https://github.com/vanitasvitae), [diaspora*](https://pod.geraspora.de/people/bbd7af90fbec013213e34860008dbc6c))

View file

@ -1,24 +0,0 @@
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/01.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/02.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/03.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/04.png" height="60%" width="60%"></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/05.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/06.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/07.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/08.png" height="60%" width="60%"></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/09.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/10.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/11.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/12.png" height="60%" width="60%"></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/13.png" height="60%" width="60%"></td>
<td><img src="https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/graphics/screens/0.1.6/14.png" height="60%" width="60%"></td>
</tr>
</table>

View file

@ -1,20 +1,63 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'android-apt' if (enable_plugin_kotlin) {
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
}
android { android {
compileSdkVersion 24 buildToolsVersion rootProject.ext.version_buildTools
buildToolsVersion "24.0.3" compileSdkVersion rootProject.ext.version_compileSdk
defaultConfig { defaultConfig {
resValue "string", "manifest_package_id", "com.github.dfa.diaspora_android"
applicationId "com.github.dfa.diaspora_android" applicationId "com.github.dfa.diaspora_android"
minSdkVersion 17 versionName "1.3.5"
targetSdkVersion 24 versionCode 46
versionCode 9
versionName "0.2.0"
setProperty("archivesBaseName", "diasporaAndroid__${versionName}__")
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
minSdkVersion rootProject.ext.version_minSdk
targetSdkVersion rootProject.ext.version_compileSdk
buildConfigField "boolean", "IS_TEST_BUILD", "false"
buildConfigField "boolean", "IS_GPLAY_BUILD", "false"
buildConfigField "String[]", "DETECTED_ANDROID_LOCALES", "${findUsedAndroidLocales()}"
buildConfigField "String", "BUILD_DATE", "\"${getBuildDate()}\""
buildConfigField "String", "GITHASH", "\"${getGitHash()}\""
setProperty("archivesBaseName", applicationId + "-v" + versionCode + "-" + versionName)
} }
flavorDimensions "default"
productFlavors {
flavorDefault {
}
/*
flavorGplay {
buildConfigField "boolean", "IS_GPLAY_BUILD", "true"
}*/
flavorDandelior {
applicationId "net.gsantner.dandelior"
}
flavorAtest {
applicationId "net.gsantner.secondlion"
versionCode = Integer.parseInt(new Date().format('yyMMdd'))
versionName = new Date().format('yyMMdd')
buildConfigField "boolean", "IS_TEST_BUILD", "true"
}
}
sourceSets {
main { assets.srcDirs = ['src/main/assets'] }
if (enable_plugin_kotlin) {
main.java.srcDirs += 'src/main/kotlin'
}
main.java.srcDirs += 'thirdparty/java'
main.res.srcDirs += 'thirdparty/res'
main.assets.srcDirs += 'thirdparty/assets'
}
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
@ -22,88 +65,72 @@ android {
} }
} }
lintOptions { configurations.all {
disable 'MissingTranslation' resolutionStrategy {
eachDependency { details ->
if (details.requested.group == 'com.android.support') {
if (details.requested.name != 'multidex' && details.requested.name != 'multidex-instrumentation') {
details.useVersion "${rootProject.ext.version_library_appcompat}"
}
}
}
}
} }
}
// Additional repositories packagingOptions {
repositories { exclude 'META-INF/LICENSE-LGPL-2.1.txt'
maven { exclude 'META-INF/LICENSE-LGPL-3.txt'
url "https://jitpack.io" exclude 'META-INF/LICENSE-W3C-TEST'
}
compileOptions {
encoding = 'UTF-8'
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
disable 'MissingTranslation', 'InvalidPackage', 'ObsoleteLintCustomCheck', 'DefaultLocale', 'UnusedAttribute', 'VectorRaster', 'InflateParams', 'IconLocation', 'UnusedResources', 'TypographyEllipsis'
abortOnError false
} }
} }
dependencies { dependencies {
// Sub-Projects // Sub-Projects
//compile project(':subprojectFromRoot') //implementation project(':subprojectFromRoot')
// Jars // Jars
compile fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.13'
// Android standard libs // Android standard libs
compile 'com.android.support:appcompat-v7:24.2.1' implementation "com.android.support:appcompat-v7:${version_library_appcompat}"
compile 'com.android.support:design:24.1.0' //Don't update. Broken up to 25.0.0 implementation "com.android.support:design:${version_library_appcompat}"
compile 'com.android.support:support-v4:24.2.1' implementation "com.android.support:support-v4:${version_library_appcompat}"
compile 'com.android.support:customtabs:24.2.1' implementation "com.android.support:customtabs:${version_library_appcompat}"
implementation "com.android.support:cardview-v7:${version_library_appcompat}"
implementation "com.android.support:preference-v7:${version_library_appcompat}"
// More libraries // UI libraries
compile 'com.jakewharton:butterknife:8.0.1' implementation "com.github.DASAR:ShiftColorPicker:v0.5"
compile 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
compile 'info.guardianproject.netcipher:netcipher-webkit:2.0.0-alpha1'
compile 'com.github.DASAR:ShiftColorPicker:v0.5'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
}
// ##################### // Tool libraries
// Groovy Coding Area implementation 'commons-io:commons-io:2.6'
// ##################### implementation "info.guardianproject.netcipher:netcipher:${version_library_netcipher}"
final String RAW_DIR = "app/src/main/res/raw" implementation "info.guardianproject.netcipher:netcipher-webkit:${version_library_netcipher}"
final String[] ROOT_TO_RAW_COPYFILES = ["README.md", "LICENSE.md", "CHANGELOG.md", "CONTRIBUTORS.txt"] //noinspection AnnotationProcessorOnCompilePath
final String PODLIST_URL = 'https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/podList/podlist.json' implementation "com.jakewharton:butterknife:${version_library_butterknife}"
final String PODLIST_PATH = "${RAW_DIR}/podlist.json" if (enable_plugin_kotlin) {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${version_plugin_kotlin}"
// Called before building
task copyRepoFiles(type: Copy) {
// Copy files over to raw dir
from rootProject.files(ROOT_TO_RAW_COPYFILES)
into RAW_DIR.replaceFirst("app/", "")
rename { String fileName ->
fileName.replace(fileName, fileName.toLowerCase())
} }
// Filter Contributors file // Processors
from(rootProject.file("CONTRIBUTORS.txt")) { def anpros = ["com.jakewharton:butterknife-compiler:${version_library_butterknife}"]
into '.' // Target already changed to 'src/main/res/raw' for (anpro in anpros) {
rename { String fileName -> if (enable_plugin_kotlin) {
fileName.replace(fileName, fileName.toLowerCase()) kapt anpro
} } else {
filter { line -> annotationProcessor anpro
(line.toString().matches("..l>>.*") || line.toString().startsWith("## 99l CONTRIBUTORS")) ? null : line.toString().trim().replaceAll(" \\(.*\\)", "")
}
}
// Download PodList
downloadFile(PODLIST_PATH, PODLIST_URL, false)
// Application variants
android.applicationVariants.all { v ->
// Do if we build in release (signed apk) mode
if (v.buildType.name == "release") {
downloadFile(PODLIST_PATH, PODLIST_URL, true)
} }
} }
} }
// Downloads a file
def downloadFile(filePath, url, downloadIfExists) {
def f = new File(filePath)
f.exists() && downloadIfExists && f.delete();
if (!f.exists()) {
new URL(url).withInputStream { i -> f.withOutputStream { it << i } }
}
}
tasks.copyRepoFiles.execute()

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M0.025,-0.07h19.95v20.14H0.025z"
android:fillColor="#492600"/>
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="36.363636"
android:viewportHeight="36.363636">
<group android:translateX="8.181818"
android:translateY="8.181818">
<path
android:pathData="M11.337,14.123l-0.963,-1.345c-0.257,-0.36 -0.466,-0.64 -0.477,-0.64 -0.012,0 -0.416,0.544 -0.958,1.287a83.9,83.9 0,0 1,-0.947 1.287c-0.015,0 -1.86,-1.3 -1.865,-1.313 -0.002,-0.007 0.415,-0.62 0.927,-1.361 0.512,-0.742 0.931,-1.36 0.931,-1.375 0,-0.023 -0.166,-0.081 -1.468,-0.515l-1.485,-0.496c-0.013,-0.005 0.063,-0.263 0.327,-1.094 0.19,-0.599 0.349,-1.093 0.354,-1.099 0.005,-0.006 0.707,0.219 1.56,0.5 0.852,0.28 1.556,0.509 1.565,0.509 0.008,0 0.018,-0.013 0.022,-0.03 0.003,-0.015 0.01,-0.74 0.016,-1.612 0.006,-0.87 0.015,-1.59 0.02,-1.6 0.009,-0.012 0.248,-0.015 1.127,-0.015 0.614,0 1.123,0.004 1.13,0.01 0.01,0.006 0.027,0.485 0.056,1.56 0.046,1.766 0.047,1.79 0.075,1.79 0.01,0 0.686,-0.226 1.501,-0.503a50.795,50.795 0,0 1,1.49 -0.492c0.016,0.019 0.685,2.194 0.676,2.202 -0.004,0.005 -0.684,0.237 -1.51,0.517 -1.137,0.386 -1.504,0.515 -1.507,0.531 -0.003,0.012 0.388,0.597 0.886,1.324 0.49,0.716 0.888,1.308 0.886,1.314a96.945,96.945 0,0 1,-1.852 1.364c-0.006,0 -0.239,-0.317 -0.517,-0.705z"
android:fillColor="#fafafa"/>
</group>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">secondlion*</string>
</resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M0.025,-0.07h19.95v20.14H0.025z"
android:fillColor="#000000"/>
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="36.363636"
android:viewportHeight="36.363636">
<group android:translateX="8.181818"
android:translateY="8.181818">
<path
android:pathData="M11.337,14.123l-0.963,-1.345c-0.257,-0.36 -0.466,-0.64 -0.477,-0.64 -0.012,0 -0.416,0.544 -0.958,1.287a83.9,83.9 0,0 1,-0.947 1.287c-0.015,0 -1.86,-1.3 -1.865,-1.313 -0.002,-0.007 0.415,-0.62 0.927,-1.361 0.512,-0.742 0.931,-1.36 0.931,-1.375 0,-0.023 -0.166,-0.081 -1.468,-0.515l-1.485,-0.496c-0.013,-0.005 0.063,-0.263 0.327,-1.094 0.19,-0.599 0.349,-1.093 0.354,-1.099 0.005,-0.006 0.707,0.219 1.56,0.5 0.852,0.28 1.556,0.509 1.565,0.509 0.008,0 0.018,-0.013 0.022,-0.03 0.003,-0.015 0.01,-0.74 0.016,-1.612 0.006,-0.87 0.015,-1.59 0.02,-1.6 0.009,-0.012 0.248,-0.015 1.127,-0.015 0.614,0 1.123,0.004 1.13,0.01 0.01,0.006 0.027,0.485 0.056,1.56 0.046,1.766 0.047,1.79 0.075,1.79 0.01,0 0.686,-0.226 1.501,-0.503a50.795,50.795 0,0 1,1.49 -0.492c0.016,0.019 0.685,2.194 0.676,2.202 -0.004,0.005 -0.684,0.237 -1.51,0.517 -1.137,0.386 -1.504,0.515 -1.507,0.531 -0.003,0.012 0.388,0.597 0.886,1.324 0.49,0.716 0.888,1.308 0.886,1.314a96.945,96.945 0,0 1,-1.852 1.364c-0.006,0 -0.239,-0.317 -0.517,-0.705z"
android:fillColor="#fafafa"/>
</group>
</vector>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">dandelior*</string>
</resources>

View file

@ -7,45 +7,70 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<application <application
android:name="com.github.dfa.diaspora_android.App"
android:allowBackup="false" android:allowBackup="false"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:name="com.github.dfa.diaspora_android.App"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/DiasporaLight" > android:requestLegacyExternalStorage="true"
android:theme="@style/DiasporaLight">
<provider <provider
android:name="com.github.dfa.diaspora_android.service.HashtagContentProvider" android:name="com.github.dfa.diaspora_android.service.HashtagContentProvider"
android:authorities="com.github.dfa.diaspora_android.mainactivity" android:authorities="${applicationId}.mainactivity"
android:exported="false"/> android:exported="false" />
<!--File provider for sharing files-->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
</provider>
<service <service
android:name="com.github.dfa.diaspora_android.service.FetchPodsService" android:name="com.github.dfa.diaspora_android.service.FetchPodsService"
android:enabled="true" android:enabled="true"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".activity.SettingsActivity" android:name="com.github.dfa.diaspora_android.activity.SettingsActivity"
android:configChanges="keyboardHidden|locale|orientation|screenSize"
android:label="@string/settings"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/DiasporaLight.NoActionBar" android:theme="@style/DiasporaLight.NoActionBar" />
android:label="@string/settings" />
<activity <activity
android:name=".activity.AboutActivity" android:name="com.github.dfa.diaspora_android.activity.AboutActivity"
android:label="@string/about_activity__title_about_app" android:configChanges="locale"
android:theme="@style/DiasporaLight.NoActionBar"/> android:label="@string/about"
android:theme="@style/DiasporaLight.NoActionBar" />
<activity <activity
android:name=".activity.MainActivity" android:name="com.github.dfa.diaspora_android.activity.MainActivity"
android:configChanges="keyboardHidden|locale|orientation|screenSize"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/DiasporaLight.NoActionBar" android:theme="@style/DiasporaLight.NoActionBar"
android:label="@string/diaspora"> android:windowSoftInputMode="adjustResize">
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
<intent-filter> <intent-filter>
<action android:name="sc_new_post" />
<action android:name="sc_nav_followed_tags" />
<action android:name="sc_aspects" />
<action android:name="sc_activities" />
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
@ -56,7 +81,7 @@
</intent-filter> </intent-filter>
<!-- Hashtag click intent from HtmlTextViews --> <!-- Hashtag click intent from HtmlTextViews -->
<intent-filter> <intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.cc.tag" /> <data android:mimeType="vnd.android.cursor.item/vnd.cc.tag" />
@ -65,150 +90,716 @@
<!-- Intent from Web Browser / Mail / IM / Clickable Link --> <!-- Intent from Web Browser / Mail / IM / Clickable Link -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<!-- Additional allowed services -->
<data
android:host="dia.so"
android:scheme="https" />
<!--@@@ PODLIST START--> <!--@@@ PODLIST START-->
<data android:host="joindiaspora.com" android:scheme="https" /> <data
<data android:host="diasporaaqmjixh5.onion" android:scheme="http" /> android:host="joindiaspora.com"
<data android:host="pod.geraspora.de" android:scheme="https" /> android:scheme="https" />
<data android:host="diasp.org" android:scheme="https" /> <data
<data android:host="framasphere.org" android:scheme="https" /> android:host="diasporaaqmjixh5.onion"
<data android:host="nerdpol.ch" android:scheme="https" /> android:scheme="http" />
<data android:host="despora.de" android:scheme="https" /> <data
<data android:host="sechat.org" android:scheme="https" /> android:host="pod.geraspora.de"
<data android:host="sechatqpscuj2npx.onion" android:scheme="http" /> android:scheme="https" />
<data android:host="berdaguermontes.eu" android:scheme="https" /> <data
<data android:host="berlinspora.de" android:scheme="https" /> android:host="diasp.org"
<data android:host="community.kanalinseln.de" android:scheme="https" /> android:scheme="https" />
<data android:host="d.consumium.org" android:scheme="https" /> <data
<data android:host="dia.manuelbichler.at" android:scheme="https" /> android:host="diasporgc3d32vv4.onion"
<data android:host="dia.myocastor.de" android:scheme="https" /> android:scheme="https" />
<data android:host="diapod.net" android:scheme="https" /> <data
<data android:host="diapod.org" android:scheme="https" /> android:host="framasphere.org"
<data android:host="diasp.ca" android:scheme="https" /> android:scheme="https" />
<data android:host="diasp.cz" android:scheme="https" /> <data
<data android:host="diasp.de" android:scheme="https" /> android:host="nerdpol.ch"
<data android:host="diasp.eu" android:scheme="https" /> android:scheme="https" />
<data android:host="diasp.eu.com" android:scheme="https" /> <data
<data android:host="diasp.nl" android:scheme="https" /> android:host="despora.de"
<data android:host="diaspod.de" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora-fr.org" android:scheme="https" /> <data
<data android:host="diaspora.alfter.us" android:scheme="https" /> android:host="sechat.org"
<data android:host="diaspora.bohramt.de" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.com.ar" android:scheme="https" /> <data
<data android:host="diaspora.deadhexagon.com" android:scheme="https" /> android:host="sechatqpscuj2npx.onion"
<data android:host="diaspora.digi-merc.org" android:scheme="https" /> android:scheme="http" />
<data android:host="diaspora.dorf-post.de" android:scheme="https" /> <data
<data android:host="diaspora.espiritolivre.org" android:scheme="https" /> android:host="berdaguermontes.eu"
<data android:host="diaspora.horwood.biz" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.hzsogood.net" android:scheme="https" /> <data
<data android:host="diaspora.kapper.net" android:scheme="https" /> android:host="berlinspora.de"
<data android:host="diaspora.koehn.com" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.kosebamse.com" android:scheme="https" /> <data
<data android:host="diaspora.lebarjack.com" android:scheme="https" /> android:host="community.kanalinseln.de"
<data android:host="diaspora.microdata.co.uk" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.moosje.nl" android:scheme="https" /> <data
<data android:host="diaspora.net.gr" android:scheme="https" /> android:host="d.consumium.org"
<data android:host="diaspora.permutationsofchaos.com" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.pimpmypony.eu" android:scheme="https" /> <data
<data android:host="diaspora.pingupod.de" android:scheme="https" /> android:host="dia.manuelbichler.at"
<data android:host="diaspora.podzimek.org" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.poleni.com" android:scheme="https" /> <data
<data android:host="diaspora.psyco.fr" android:scheme="https" /> android:host="dia.myocastor.de"
<data android:host="diaspora.punkbeer.me" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.raven-ip.com" android:scheme="https" /> <data
<data android:host="diaspora.retrodigital.net" android:scheme="https" /> android:host="diapod.net"
<data android:host="diaspora.soh.re" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.subsignal.org" android:scheme="https" /> <data
<data android:host="diaspora.trash-talk.de" android:scheme="https" /> android:host="diapod.org"
<data android:host="diaspora.u4u.org" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.unixcorn.org" android:scheme="https" /> <data
<data android:host="diasporabr.com.br" android:scheme="https" /> android:host="diasp.ca"
<data android:host="diasporabrazil.org" android:scheme="https" /> android:scheme="https" />
<data android:host="diasporapr.tk" android:scheme="https" /> <data
<data android:host="diasporing.ch" android:scheme="https" /> android:host="diasp.cz"
<data android:host="distributed.chat" android:scheme="https" /> android:scheme="https" />
<data android:host="espora.com.es" android:scheme="https" /> <data
<data android:host="espora.social" android:scheme="https" /> android:host="diasp.de"
<data android:host="failure.net" android:scheme="https" /> android:scheme="https" />
<data android:host="flokk.no" android:scheme="https" /> <data
<data android:host="freehuman.fr" android:scheme="https" /> android:host="diasp.eu"
<data android:host="iliketoast.net" android:scheme="https" /> android:scheme="https" />
<data android:host="jons.gr" android:scheme="https" /> <data
<data android:host="kapok.se" android:scheme="https" /> android:host="diasp.eu.com"
<data android:host="karmasphe.re" android:scheme="https" /> android:scheme="https" />
<data android:host="laba.mba" android:scheme="https" /> <data
<data android:host="liberdade.digital" android:scheme="https" /> android:host="diasp.nl"
<data android:host="librenet.co.za" android:scheme="https" /> android:scheme="https" />
<data android:host="librenet.gr" android:scheme="https" /> <data
<data android:host="misamigos.online" android:scheme="https" /> android:host="diaspod.de"
<data android:host="mondiaspora.net" android:scheme="https" /> android:scheme="https" />
<data android:host="networkwizard.de" android:scheme="https" /> <data
<data android:host="nx-pod.de" android:scheme="https" /> android:host="diaspora-fr.org"
<data android:host="pe.spbstu.ru" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.4ray.co" android:scheme="https" /> <data
<data android:host="pod.8n1.org" android:scheme="https" /> android:host="diaspora.alfter.us"
<data android:host="pod.alterworld.info" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.asap-soft.com" android:scheme="https" /> <data
<data android:host="pod.cannyfoxx.me" android:scheme="https" /> android:host="diaspora.bohramt.de"
<data android:host="pod.cyberdungeon.de" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.dapor.net" android:scheme="https" /> <data
<data android:host="pod.datenknoten.me" android:scheme="https" /> android:host="diaspora.com.ar"
<data android:host="pod.diaspora.software" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.dirkomatik.de" android:scheme="https" /> <data
<data android:host="pod.disroot.org" android:scheme="https" /> android:host="diaspora.deadhexagon.com"
<data android:host="pod.gedankenausbruch.com" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.gleisnetze.de" android:scheme="https" /> <data
<data android:host="pod.goodsharing.at" android:scheme="https" /> android:host="diaspora.digi-merc.org"
<data android:host="pod.hashtagueule.fr" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.hoizi.net" android:scheme="https" /> <data
<data android:host="pod.itabs.nl" android:scheme="https" /> android:host="diaspora.dorf-post.de"
<data android:host="pod.jpope.org" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.liebeleu.de" android:scheme="https" /> <data
<data android:host="pod.nomorestars.com" android:scheme="https" /> android:host="diaspora.espiritolivre.org"
<data android:host="pod.orkz.net" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.ponk.pink" android:scheme="https" /> <data
<data android:host="pod.promedol.com" android:scheme="https" /> android:host="diaspora.horwood.biz"
<data android:host="pod.psynet.su" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.roocita.com" android:scheme="https" /> <data
<data android:host="pod.sertelon.fr" android:scheme="https" /> android:host="diaspora.hzsogood.net"
<data android:host="pod.storel.li" android:scheme="https" /> android:scheme="https" />
<data android:host="pod.tchncs.de" android:scheme="https" /> <data
<data android:host="pod.thomasdalichow.de" android:scheme="https" /> android:host="diaspora.kapper.net"
<data android:host="pod.volt.io" android:scheme="https" /> android:scheme="https" />
<data android:host="podbay.net" android:scheme="https" /> <data
<data android:host="poddery.com" android:scheme="https" /> android:host="diaspora.koehn.com"
<data android:host="podricing.pw" android:scheme="https" /> android:scheme="https" />
<data android:host="pubpod.alqualonde.org" android:scheme="https" /> <data
<data android:host="revreso.de" android:scheme="https" /> android:host="diaspora.kosebamse.com"
<data android:host="ruhrspora.de" android:scheme="https" /> android:scheme="https" />
<data android:host="russiandiaspora.org" android:scheme="https" /> <data
<data android:host="shrekislove.us" android:scheme="https" /> android:host="diaspora.lebarjack.com"
<data android:host="social.acclaro.digital" android:scheme="https" /> android:scheme="https" />
<data android:host="social.baldr.io" android:scheme="https" /> <data
<data android:host="social.daxbau.net" android:scheme="https" /> android:host="diaspora.microdata.co.uk"
<data android:host="social.elaon.de" android:scheme="https" /> android:scheme="https" />
<data android:host="social.lanham.id.au" android:scheme="https" /> <data
<data android:host="social.mbuto.me" android:scheme="https" /> android:host="diaspora.moosje.nl"
<data android:host="socializer.cc" android:scheme="https" /> android:scheme="https" />
<data android:host="spora.zone" android:scheme="https" /> <data
<data android:host="subvillage.de" android:scheme="https" /> android:host="diaspora.net.gr"
<data android:host="sysad.org" android:scheme="https" /> android:scheme="https" />
<data android:host="teki.be" android:scheme="https" /> <data
<data android:host="therealtalk.org" android:scheme="https" /> android:host="diaspora.permutationsofchaos.com"
<data android:host="thinkopen.net" android:scheme="https" /> android:scheme="https" />
<data android:host="tippentappen.de" android:scheme="https" /> <data
<data android:host="whatsnewz.com" android:scheme="https" /> android:host="diaspora.pimpmypony.eu"
<data android:host="wk3.org" android:scheme="https" /> android:scheme="https" />
<data android:host="www.datataffel.dk" android:scheme="https" /> <data
<data android:host="www.diasporaix.de" android:scheme="https" /> android:host="diaspora.pingupod.de"
<data android:host="diaspora.hofud.com" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.softwarelivre.org" android:scheme="https" /> <data
<data android:host="confetticake.club" android:scheme="https" /> android:host="diaspora.podzimek.org"
<data android:host="diaspote.org" android:scheme="https" /> android:scheme="https" />
<data android:host="diaspora.zone" android:scheme="https" /> <data
<data android:host="pod.userzap.de" android:scheme="https" /> android:host="diaspora.poleni.com"
android:scheme="https" />
<data
android:host="diaspora.psyco.fr"
android:scheme="https" />
<data
android:host="diaspora.raven-ip.com"
android:scheme="https" />
<data
android:host="diaspora.retrodigital.net"
android:scheme="https" />
<data
android:host="diaspora.soh.re"
android:scheme="https" />
<data
android:host="diaspora.subsignal.org"
android:scheme="https" />
<data
android:host="diaspora.trash-talk.de"
android:scheme="https" />
<data
android:host="diaspora.u4u.org"
android:scheme="https" />
<data
android:host="diaspora.unixcorn.org"
android:scheme="https" />
<data
android:host="diasporabr.com.br"
android:scheme="https" />
<data
android:host="diasporabrazil.org"
android:scheme="https" />
<data
android:host="diasporapr.tk"
android:scheme="https" />
<data
android:host="diasporing.ch"
android:scheme="https" />
<data
android:host="distributed.chat"
android:scheme="https" />
<data
android:host="espora.com.es"
android:scheme="https" />
<data
android:host="espora.social"
android:scheme="https" />
<data
android:host="failure.net"
android:scheme="https" />
<data
android:host="flokk.no"
android:scheme="https" />
<data
android:host="freehuman.fr"
android:scheme="https" />
<data
android:host="iliketoast.net"
android:scheme="https" />
<data
android:host="jons.gr"
android:scheme="https" />
<data
android:host="kapok.se"
android:scheme="https" />
<data
android:host="karmasphe.re"
android:scheme="https" />
<data
android:host="laba.mba"
android:scheme="https" />
<data
android:host="liberdade.digital"
android:scheme="https" />
<data
android:host="librenet.co.za"
android:scheme="https" />
<data
android:host="librenet.gr"
android:scheme="https" />
<data
android:host="misamigos.online"
android:scheme="https" />
<data
android:host="mondiaspora.net"
android:scheme="https" />
<data
android:host="networkwizard.de"
android:scheme="https" />
<data
android:host="nx-pod.de"
android:scheme="https" />
<data
android:host="pe.spbstu.ru"
android:scheme="https" />
<data
android:host="pod.4ray.co"
android:scheme="https" />
<data
android:host="pod.8n1.org"
android:scheme="https" />
<data
android:host="pod.alterworld.info"
android:scheme="https" />
<data
android:host="pod.asap-soft.com"
android:scheme="https" />
<data
android:host="pod.cannyfoxx.me"
android:scheme="https" />
<data
android:host="pod.cyberdungeon.de"
android:scheme="https" />
<data
android:host="pod.dapor.net"
android:scheme="https" />
<data
android:host="pod.datenknoten.me"
android:scheme="https" />
<data
android:host="pod.diaspora.software"
android:scheme="https" />
<data
android:host="pod.dirkomatik.de"
android:scheme="https" />
<data
android:host="pod.disroot.org"
android:scheme="https" />
<data
android:host="pod.gedankenausbruch.com"
android:scheme="https" />
<data
android:host="pod.gleisnetze.de"
android:scheme="https" />
<data
android:host="pod.goodsharing.at"
android:scheme="https" />
<data
android:host="pod.hashtagueule.fr"
android:scheme="https" />
<data
android:host="pod.hoizi.net"
android:scheme="https" />
<data
android:host="pod.itabs.nl"
android:scheme="https" />
<data
android:host="pod.jpope.org"
android:scheme="https" />
<data
android:host="pod.liebeleu.de"
android:scheme="https" />
<data
android:host="pod.nomorestars.com"
android:scheme="https" />
<data
android:host="pod.orkz.net"
android:scheme="https" />
<data
android:host="pod.ponk.pink"
android:scheme="https" />
<data
android:host="pod.promedol.com"
android:scheme="https" />
<data
android:host="pod.psynet.su"
android:scheme="https" />
<data
android:host="pod.roocita.com"
android:scheme="https" />
<data
android:host="pod.sertelon.fr"
android:scheme="https" />
<data
android:host="pod.storel.li"
android:scheme="https" />
<data
android:host="pod.tchncs.de"
android:scheme="https" />
<data
android:host="pod.thomasdalichow.de"
android:scheme="https" />
<data
android:host="pod.volt.io"
android:scheme="https" />
<data
android:host="podbay.net"
android:scheme="https" />
<data
android:host="poddery.com"
android:scheme="https" />
<data
android:host="podricing.pw"
android:scheme="https" />
<data
android:host="pubpod.alqualonde.org"
android:scheme="https" />
<data
android:host="revreso.de"
android:scheme="https" />
<data
android:host="ruhrspora.de"
android:scheme="https" />
<data
android:host="russiandiaspora.org"
android:scheme="https" />
<data
android:host="shrekislove.us"
android:scheme="https" />
<data
android:host="social.acclaro.digital"
android:scheme="https" />
<data
android:host="social.baldr.io"
android:scheme="https" />
<data
android:host="social.daxbau.net"
android:scheme="https" />
<data
android:host="social.elaon.de"
android:scheme="https" />
<data
android:host="social.lanham.id.au"
android:scheme="https" />
<data
android:host="social.mbuto.me"
android:scheme="https" />
<data
android:host="socializer.cc"
android:scheme="https" />
<data
android:host="spora.zone"
android:scheme="https" />
<data
android:host="subvillage.de"
android:scheme="https" />
<data
android:host="sysad.org"
android:scheme="https" />
<data
android:host="teki.be"
android:scheme="https" />
<data
android:host="therealtalk.org"
android:scheme="https" />
<data
android:host="thinkopen.net"
android:scheme="https" />
<data
android:host="tippentappen.de"
android:scheme="https" />
<data
android:host="whatsnewz.com"
android:scheme="https" />
<data
android:host="wk3.org"
android:scheme="https" />
<data
android:host="www.datataffel.dk"
android:scheme="https" />
<data
android:host="www.diasporaix.de"
android:scheme="https" />
<data
android:host="diaspora.hofud.com"
android:scheme="https" />
<data
android:host="diaspora.softwarelivre.org"
android:scheme="https" />
<data
android:host="confetticake.club"
android:scheme="https" />
<data
android:host="diaspote.org"
android:scheme="https" />
<data
android:host="diaspora.zone"
android:scheme="https" />
<data
android:host="pod.userzap.de"
android:scheme="https" />
<data
android:host="www.vodeoo.com"
android:scheme="https" />
<data
android:host="diaspora.punkbeer.me"
android:scheme="https" />
<data
android:host="ingtech.net"
android:scheme="https" />
<data
android:host="mmkr.co"
android:scheme="https" />
<data
android:host="pod.kneedrag.org"
android:scheme="https" />
<data
android:host="spyurk.am"
android:scheme="https" />
<data
android:host="pod.mew.cat"
android:scheme="https" />
<data
android:host="dfhz.tk"
android:scheme="https" />
<data
android:host="netiz.in"
android:scheme="https" />
<data
android:host="pod1.orobouros.net"
android:scheme="https" />
<data
android:host="witchcraft.ml"
android:scheme="https" />
<data
android:host="libellula.criptica.org"
android:scheme="https" />
<data
android:host="pod.datamol.org"
android:scheme="https" />
<data
android:host="social.berdaguermontes.eu"
android:scheme="https" />
<data
android:host="mh8.lat-clan.fr"
android:scheme="https" />
<data
android:host="dp.lumy.me"
android:scheme="https" />
<data
android:host="social.souvenirfromlife.fr"
android:scheme="https" />
<data
android:host="diaspora.mokrynskyi.com"
android:scheme="https" />
<data
android:host="hub.transition-regensburg.de"
android:scheme="https" />
<data
android:host="co.zy.lc"
android:scheme="https" />
<data
android:host="diaspora.treefish.org"
android:scheme="https" />
<data
android:host="diaspora.bke.ro"
android:scheme="https" />
<data
android:host="pod.sd.vc"
android:scheme="https" />
<data
android:host="diaspora.cxx.rocks"
android:scheme="https" />
<data
android:host="social.homenet.org"
android:scheme="https" />
<data
android:host="social.cigliola.com"
android:scheme="https" />
<data
android:host="friaspora.tk"
android:scheme="https" />
<data
android:host="pod.lasserh.dk"
android:scheme="https" />
<data
android:host="hubz.tk"
android:scheme="https" />
<data
android:host="hubzilla.kosebamse.com"
android:scheme="https" />
<data
android:host="driaans.nl"
android:scheme="https" />
<data
android:host="dispersio.us"
android:scheme="https" />
<data
android:host="go.lookbehind.eu"
android:scheme="https" />
<data
android:host="diasp.ot-si.com"
android:scheme="https" />
<data
android:host="diaspora.crossfamilyweb.com"
android:scheme="https" />
<data
android:host="hub.aoeu.me"
android:scheme="https" />
<data
android:host="dia.pwn.ninja"
android:scheme="https" />
<data
android:host="3ogsbs3vuvapgg37.onion.to"
android:scheme="https" />
<data
android:host="hubz.secretlair.me"
android:scheme="https" />
<data
android:host="got.noip.me"
android:scheme="https" />
<data
android:host="pod.bitcast.info"
android:scheme="https" />
<data
android:host="f.tschlotfeldt.de"
android:scheme="https" />
<data
android:host="hubloq.net"
android:scheme="https" />
<data
android:host="hubzilla.kneedrag.org"
android:scheme="https" />
<data
android:host="gesichtsbu.ch"
android:scheme="https" />
<data
android:host="hubzi.fraengii.de"
android:scheme="https" />
<data
android:host="friendica.narf.ssji.net"
android:scheme="https" />
<data
android:host="durohr.de"
android:scheme="https" />
<data
android:host="0kcg.com"
android:scheme="https" />
<data
android:host="aegibson.me"
android:scheme="https" />
<data
android:host="redmatrix.us"
android:scheme="https" />
<data
android:host="15o2.de"
android:scheme="https" />
<data
android:host="upt.social"
android:scheme="https" />
<data
android:host="friendica.bohrshouse.com"
android:scheme="https" />
<data
android:host="hubzilla.site"
android:scheme="https" />
<data
android:host="hubzilla.zavb.de"
android:scheme="https" />
<data
android:host="diaspora.aeriesguard.com"
android:scheme="https" />
<data
android:host="pod.cornify.de"
android:scheme="https" />
<data
android:host="hochminuseins.net"
android:scheme="https" />
<data
android:host="thecrimsontint.com"
android:scheme="https" />
<data
android:host="diaspora.clubelek.fr"
android:scheme="https" />
<data
android:host="teamhubzilla.org"
android:scheme="https" />
<data
android:host="diaspora.schlimme.net"
android:scheme="https" />
<data
android:host="www.wiwiec.com"
android:scheme="https" />
<data
android:host="diasp.danletard.de"
android:scheme="https" />
<data
android:host="libertypod.com"
android:scheme="https" />
<data
android:host="hubzilla.pskosinski.pl"
android:scheme="https" />
<data
android:host="pod.juvenesco.eu"
android:scheme="https" />
<data
android:host="pirati.ca"
android:scheme="https" />
<data
android:host="diasp.sk"
android:scheme="https" />
<data
android:host="f.libreden.net"
android:scheme="https" />
<data
android:host="pod.mausdompteur.de"
android:scheme="https" />
<data
android:host="diaspora.raitisoja.com"
android:scheme="https" />
<data
android:host="squeet.me"
android:scheme="https" />
<data
android:host="pod.kakise.xyz"
android:scheme="https" />
<data
android:host="pod.diasporacaribe.org"
android:scheme="https" />
<data
android:host="hub.feder8.ru"
android:scheme="https" />
<data
android:host="hubzilla.a-zwenkau.de"
android:scheme="https" />
<data
android:host="social.punkbeer.me"
android:scheme="https" />
<data
android:host="pod.sapient.fun"
android:scheme="https" />
<data
android:host="pod.phantasie.cc"
android:scheme="https" />
<data
android:host="diaspora.masharih.me"
android:scheme="https" />
<data
android:host="hub.mariovavti.com"
android:scheme="https" />
<data
android:host="social.patur.in"
android:scheme="https" />
<data
android:host="jeroenpraat.nl"
android:scheme="https" />
<data
android:host="grindcore.ch"
android:scheme="https" />
<data
android:host="pod.vixiv.net"
android:scheme="https" />
<data
android:host="social.deuxfleurs.fr"
android:scheme="https" />
<data
android:host="parlementum.net"
android:scheme="https" />
<data
android:host="villianbook.com"
android:scheme="https" />
<data
android:host="frolix8.asia"
android:scheme="https" />
<data
android:host="hub.vilarejo.pro.br"
android:scheme="https" />
<data
android:host="social.vixiv.net"
android:scheme="https" />
<!--@@@ PODLIST END--> <!--@@@ PODLIST END-->
</intent-filter> </intent-filter>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before After
Before After

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -34,18 +34,35 @@ import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
public class App extends Application { import net.gsantner.opoc.util.AdBlock;
import net.gsantner.opoc.util.ContextUtils;
import net.gsantner.opoc.util.ShareUtil;
public class App extends Application {
private volatile static App app;
private AppSettings appSettings; private AppSettings appSettings;
private AvatarImageLoader avatarImageLoader; private AvatarImageLoader avatarImageLoader;
private CookieManager cookieManager; private CookieManager cookieManager;
private DiasporaUserProfile diasporaUserProfile; private DiasporaUserProfile diasporaUserProfile;
public static App get() {
return app;
}
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
ShareUtil.setFileProviderAuthority(BuildConfig.APPLICATION_ID);
app = this;
final Context c = getApplicationContext(); final Context c = getApplicationContext();
appSettings = new AppSettings(c); appSettings = AppSettings.get();
String a = new ContextUtils(this).bcstr("FLAVOR", "");
a += "__";
if (appSettings.isAppFirstStart() && "flavorDandelior".equals(new ContextUtils(this).bcstr("FLAVOR", ""))) {
appSettings.setAmoledColorMode(true);
}
// Init app log // Init app log
AppLog.setLoggingEnabled(appSettings.isLoggingEnabled()); AppLog.setLoggingEnabled(appSettings.isLoggingEnabled());
@ -64,6 +81,7 @@ public class App extends Application {
} }
cookieManager.setAcceptCookie(true); cookieManager.setAcceptCookie(true);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
AdBlock.getInstance().loadHostsFromRawAssetsAsync(this);
} }
public void resetPodData(@Nullable WebView webView) { public void resetPodData(@Nullable WebView webView) {
@ -79,7 +97,10 @@ public class App extends Application {
new AvatarImageLoader(this).clearAvatarImage(); new AvatarImageLoader(this).clearAvatarImage();
// Clear preferences__master // Clear preferences__master
appSettings.clearPodSettings(); appSettings.resetPodSettings();
// Clear User profile - reload empty AppSettingsBase data
diasporaUserProfile.loadFromAppSettings();
// Clear cookies // Clear cookies
//noinspection deprecation //noinspection deprecation

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -20,11 +20,13 @@ package com.github.dfa.diaspora_android.activity;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout; import android.support.design.widget.AppBarLayout;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -33,10 +35,9 @@ import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -50,14 +51,14 @@ import com.github.dfa.diaspora_android.ui.theme.ThemedActivity;
import com.github.dfa.diaspora_android.ui.theme.ThemedFragment; import com.github.dfa.diaspora_android.ui.theme.ThemedFragment;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.ContextUtils;
import com.github.dfa.diaspora_android.util.Helpers;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; import java.util.Observer;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick;
/** /**
* Activity that holds some fragments that show information about the app in a tab layout * Activity that holds some fragments that show information about the app in a tab layout
@ -65,20 +66,17 @@ import butterknife.ButterKnife;
public class AboutActivity extends ThemedActivity public class AboutActivity extends ThemedActivity
implements IntellihideToolbarActivityListener { implements IntellihideToolbarActivityListener {
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
@BindView(R.id.about__appbar) @BindView(R.id.about__appbar)
AppBarLayout appBarLayout; protected AppBarLayout _appBarLayout;
@BindView(R.id.main__topbar) @BindView(R.id.main__topbar)
protected Toolbar toolbar; protected Toolbar _toolbar;
@BindView(R.id.appbar_linear_layout) @BindView(R.id.appbar_linear_layout)
protected LinearLayout linearLayout; protected LinearLayout _linearLayout;
@BindView(R.id.tabs) @BindView(R.id.tabs)
protected TabLayout tabLayout; protected TabLayout _tabLayout;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -86,9 +84,9 @@ public class AboutActivity extends ThemedActivity
setContentView(R.layout.about__activity); setContentView(R.layout.about__activity);
ButterKnife.bind(this); ButterKnife.bind(this);
setSupportActionBar(toolbar); setSupportActionBar(_toolbar);
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px)); _toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
toolbar.setNavigationOnClickListener(new View.OnClickListener() { _toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
AboutActivity.this.onBackPressed(); AboutActivity.this.onBackPressed();
@ -96,47 +94,39 @@ public class AboutActivity extends ThemedActivity
}); });
// Create the adapter that will return a fragment for each of the three // Create the adapter that will return a fragment for each of the three
// primary sections of the activity. // primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter. // Set up the ViewPager with the sections adapter.
mViewPager = ButterKnife.findById(this, R.id.container); ViewPager mViewPager = ButterKnife.findById(this, R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setAdapter(mSectionsPagerAdapter);
tabLayout.setupWithViewPager(mViewPager); _tabLayout.setupWithViewPager(mViewPager);
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (getAppSettings().isIntellihideToolbars()) { setToolbarIntellihide(getAppSettings().isIntellihideToolbars());
this.enableToolbarHiding();
} else {
this.disableToolbarHiding();
}
} }
@Override @Override
protected void applyColorToViews() { protected void applyColorToViews() {
ThemeHelper.updateToolbarColor(toolbar); ThemeHelper.updateToolbarColor(_toolbar);
ThemeHelper.updateTabLayoutColor(tabLayout); ThemeHelper.updateTabLayoutColor(_tabLayout);
ThemeHelper.setPrimaryColorAsBackground(linearLayout); ThemeHelper.setPrimaryColorAsBackground(_linearLayout);
} }
@Override public void setToolbarIntellihide(boolean enable) {
public void enableToolbarHiding() { AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) _linearLayout.getLayoutParams();
AppLog.d(this, "Enable Intellihide"); if (enable) {
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams(); AppLog.d(this, "Enable Intellihide");
//scroll|enterAlways|snap params.setScrollFlags(toolbarDefaultScrollFlags);
params.setScrollFlags(toolbarDefaultScrollFlags);
appBarLayout.setExpanded(true, true);
}
@Override } else {
public void disableToolbarHiding() { AppLog.d(this, "Disable Intellihide");
AppLog.d(this, "Disable Intellihide"); params.setScrollFlags(0); // clear all scroll flags
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams(); }
params.setScrollFlags(0); // clear all scroll flags _appBarLayout.setExpanded(true, true);
appBarLayout.setExpanded(true, true);
} }
/** /**
@ -146,35 +136,55 @@ public class AboutActivity extends ThemedActivity
public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.AboutFragment"; public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.AboutFragment";
@BindView(R.id.fragment_about__about_text)
TextView aboutText;
@BindView(R.id.fragment_about__app_version) @BindView(R.id.fragment_about__app_version)
TextView appVersion; TextView appVersion;
@BindView(R.id.fragment_about__spread_the_word_text)
HtmlTextView spreadText;
@BindView(R.id.fragment_about__contribute_button)
Button contributeBtn;
@BindView(R.id.fragment_about__translate_button)
Button translateBtn;
@BindView(R.id.fragment_about__feedback_button)
Button feedbackBtn;
@BindView(R.id.fragment_about__spread_the_word_button)
Button spreadBtn;
public AboutFragment() { public AboutFragment() {
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, protected int getLayoutResId() {
Bundle savedInstanceState) { return R.layout.about__fragment_about;
View rootView = inflater.inflate(R.layout.about__fragment_about, container, false); }
ButterKnife.bind(this, rootView);
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
if (isAdded()) { if (isAdded()) {
try { try {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
appVersion.setText(getString(R.string.fragment_debug__app_version, pInfo.versionName + " (" + pInfo.versionCode + ")")); appVersion.setText(getString(R.string.app_version_with_arg, pInfo.versionName + " (" + pInfo.versionCode + ")"));
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return rootView;
} }
@Override @Override
protected void applyColorToViews() { protected void applyColorToViews() {
ThemeHelper.updateTextViewLinkColor(aboutText); ThemeHelper.getInstance(getAppSettings());
ThemeHelper.updateTextViewLinkColor(spreadText);
ThemeHelper.updateButtonTextColor(contributeBtn);
ThemeHelper.updateButtonTextColor(feedbackBtn);
ThemeHelper.updateButtonTextColor(spreadBtn);
ThemeHelper.updateButtonTextColor(translateBtn);
} }
@Override @Override
@ -182,15 +192,32 @@ public class AboutActivity extends ThemedActivity
return TAG; return TAG;
} }
@Override
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
/* Nothing to do */
}
@Override @Override
public boolean onBackPressed() { public boolean onBackPressed() {
return false; return false;
} }
@OnClick({R.id.fragment_about__contribute_button, R.id.fragment_about__translate_button, R.id.fragment_about__feedback_button, R.id.fragment_about__spread_the_word_button})
public void buttonClicked(View view) {
switch (view.getId()) {
case R.id.fragment_about__contribute_button:
ContextUtils.get().openWebpageInExternalBrowser(getString(R.string.fragment_about__contribute_link));
break;
case R.id.fragment_about__translate_button:
ContextUtils.get().openWebpageInExternalBrowser(getString(R.string.fragment_about__translate_link));
break;
case R.id.fragment_about__feedback_button:
ContextUtils.get().openWebpageInExternalBrowser(getString(R.string.fragment_About__feedback_link));
break;
case R.id.fragment_about__spread_the_word_button:
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.app_name));
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.hey_checkout_dandelion_tag__appspecific, getString(R.string.fragment_about__fdroid_link)));
startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_dotdotdot)));
break;
}
}
} }
/** /**
@ -199,11 +226,20 @@ public class AboutActivity extends ThemedActivity
public static class LicenseFragment extends ThemedFragment { public static class LicenseFragment extends ThemedFragment {
public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.LicenseFragment"; public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.LicenseFragment";
@BindView(R.id.fragment_license__licensetext) @BindView(R.id.fragment_license__maintainers_text)
HtmlTextView textLicenseBox; HtmlTextView maintainers;
@BindView(R.id.fragment_license__3rdparty) @BindView(R.id.fragment_license__contributors_text)
HtmlTextView textLicense3partyBox; HtmlTextView contributors;
@BindView(R.id.fragment_license__thirdparty_libs_text)
HtmlTextView thirdPartyLibs;
@BindView(R.id.fragment_license__license_button)
Button licenseBtn;
@BindView(R.id.fragment_license__leafpic_button)
Button leafpicBtn;
private String accentColor; private String accentColor;
@ -212,54 +248,43 @@ public class AboutActivity extends ThemedActivity
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { protected int getLayoutResId() {
View rootView = inflater.inflate(R.layout.about__fragment_license, container, false); return R.layout.about__fragment_license;
ButterKnife.bind(this, rootView);
final Context context = rootView.getContext();
accentColor = Helpers.colorToHex(ThemeHelper.getAccentColor());
textLicenseBox.setTextFormatted(getString(R.string.fragment_license__license_content,
getMaintainersHtml(context),
getContributorsHtml(context),
getLicenseHtml(context)
));
textLicense3partyBox.setTextFormatted(
getLicense3dPartyHtml(context)
);
return rootView;
} }
public String getContributorsHtml(Context context) { @Override
String text = Helpers.readTextfileFromRawRessource(context, R.raw.contributors, public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
"<font color='" + accentColor + "'><b>*</b></font> ", "<br>"); super.onViewCreated(view, savedInstanceState);
return text; ButterKnife.bind(this, view);
accentColor = ContextUtils.get().colorToHexString(ThemeHelper.getAccentColor());
maintainers.setTextFormatted(getString(R.string.this_app_is_currently_developed_and_maintained_by_witharg,
ContextUtils.get().loadMarkdownForTextViewFromRaw(R.raw.maintainers, "")));
contributors.setTextFormatted(getString(R.string.thank_you_witharg,
ContextUtils.get().loadMarkdownForTextViewFromRaw(R.raw.contributors, "")));
thirdPartyLibs.setTextFormatted(
ContextUtils.get().loadMarkdownForTextViewFromRaw(R.raw.licenses_3rd_party, ""));
} }
public String getMaintainersHtml(Context context) { @OnClick({R.id.fragment_license__leafpic_button, R.id.fragment_license__license_button})
String text = Helpers.readTextfileFromRawRessource(context, R.raw.maintainers, "", "<br>"); public void buttonClicked(View v) {
text = text switch (v.getId()) {
.replace("NEWENTRY", "<font color='" + accentColor + "'><b>*</b></font> ") case R.id.fragment_license__leafpic_button:
.replace("SUBTABBY", "&nbsp;&nbsp;"); ContextUtils.get().openWebpageInExternalBrowser(getString(R.string.fragment_licesen__misc_leafpic_link));
return text; break;
} case R.id.fragment_license__license_button:
ContextUtils.get().openWebpageInExternalBrowser(getString(R.string.fragment_license__license_gpl_link));
public String getLicenseHtml(Context context) { break;
String text = Helpers.readTextfileFromRawRessource(context, R.raw.license, }
"", "").replace("\n\n", "<br><br>");
return text;
}
public String getLicense3dPartyHtml(Context context) {
String text = Helpers.readTextfileFromRawRessource(context, R.raw.license_third_party, "", "<br>");
text = text.replace("NEWENTRY", "<font color='" + accentColor + "'><b>*</b></font> ");
return text;
} }
@Override @Override
protected void applyColorToViews() { protected void applyColorToViews() {
ThemeHelper.updateTextViewLinkColor(textLicense3partyBox); ThemeHelper.getInstance(getAppSettings());
ThemeHelper.updateTextViewLinkColor(textLicenseBox); ThemeHelper.updateButtonTextColor(leafpicBtn);
ThemeHelper.updateButtonTextColor(licenseBtn);
ThemeHelper.updateTextViewLinkColor(maintainers);
ThemeHelper.updateTextViewLinkColor(thirdPartyLibs);
} }
@Override @Override
@ -267,11 +292,6 @@ public class AboutActivity extends ThemedActivity
return TAG; return TAG;
} }
@Override
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
/* Nothing to do */
}
@Override @Override
public boolean onBackPressed() { public boolean onBackPressed() {
return false; return false;
@ -321,7 +341,7 @@ public class AboutActivity extends ThemedActivity
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE); ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("DEBUG_LOG", AppLog.Log.getLogBuffer()); ClipData clip = ClipData.newPlainText("DEBUG_LOG", AppLog.Log.getLogBuffer());
clipboard.setPrimaryClip(clip); clipboard.setPrimaryClip(clip);
Toast.makeText(DebugFragment.this.getActivity(), R.string.fragment_debug__toast_log_copied, Toast.LENGTH_SHORT).show(); Toast.makeText(DebugFragment.this.getActivity(), R.string.debug_log_copied_to_clipboard, Toast.LENGTH_SHORT).show();
} else { } else {
AppLog.d(this, "Not Added!"); AppLog.d(this, "Not Added!");
} }
@ -335,15 +355,14 @@ public class AboutActivity extends ThemedActivity
try { try {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
AppSettings appSettings = ((App) getActivity().getApplication()).getSettings(); AppSettings appSettings = ((App) getActivity().getApplication()).getSettings();
DiasporaUrlHelper urls = new DiasporaUrlHelper(appSettings);
packageName.setText(pInfo.packageName); packageName.setText(pInfo.packageName);
appVersion.setText(getString(R.string.fragment_debug__app_version, pInfo.versionName + " (" + pInfo.versionCode + ")")); appVersion.setText(getString(R.string.app_version_with_arg, pInfo.versionName + " (" + pInfo.versionCode + ")"));
osVersion.setText(getString(R.string.fragment_debug__android_version, Build.VERSION.RELEASE)); osVersion.setText(getString(R.string.android_version_witharg, Build.VERSION.RELEASE));
deviceName.setText(getString(R.string.fragment_debug__device_name, Build.MANUFACTURER + " " + Build.MODEL)); deviceName.setText(getString(R.string.device_name_witharg, Build.MANUFACTURER + " " + Build.MODEL));
if (app.getSettings().getPod() != null) { if (app.getSettings().getPod() != null) {
podDomain.setText(getString(R.string.fragment_debug__pod_profile_url, app.getSettings().getPod().getPodUrl())); podDomain.setText(getString(R.string.pod_domain_witharg__appspecific, app.getSettings().getPod().getPodUrl()));
podName.setText(getString(R.string.fragment_debug__pod_profile_name, app.getSettings().getPod().getName())); podName.setText(getString(R.string.pod_profile_name_witharg__appspecific, app.getSettings().getPod().getName()));
} }
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
@ -385,7 +404,7 @@ public class AboutActivity extends ThemedActivity
return new AboutFragment(); return new AboutFragment();
case 1: //License case 1: //License
return new LicenseFragment(); return new LicenseFragment();
case 3: //Debug case 2: //Debug
default: default:
return new DebugFragment(); return new DebugFragment();
} }
@ -401,11 +420,11 @@ public class AboutActivity extends ThemedActivity
public CharSequence getPageTitle(int position) { public CharSequence getPageTitle(int position) {
switch (position) { switch (position) {
case 0: case 0:
return getString(R.string.about_activity__title_about_app); return getString(R.string.about);
case 1: case 1:
return getString(R.string.about_activity__title_about_license); return getString(R.string.license);
case 2: case 2:
return getString(R.string.about_activity__title_debug_info); return getString(R.string.debugging);
} }
return null; return null;
} }

View file

@ -1,197 +0,0 @@
/*
This file is part of the Diaspora for Android.
Diaspora for Android 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.
Diaspora for Android 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 the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.dfa.diaspora_android.activity;
import android.content.Context;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.DiasporaAspect;
import com.github.dfa.diaspora_android.listener.OnSomethingClickListener;
import com.github.dfa.diaspora_android.ui.theme.ThemedFragment;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.Helpers;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Fragment that shows a list of the Aspects
*/
public class AspectListFragment extends ThemedFragment implements OnSomethingClickListener<Object> {
public static final String TAG = "com.github.dfa.diaspora_android.AspectListFragment";
protected RecyclerView aspectsRecyclerView;
protected App app;
protected DiasporaUrlHelper urls;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
AppLog.d(this, "onCreateView()");
return inflater.inflate(R.layout.recycler_list__fragment, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
aspectsRecyclerView = (RecyclerView) view.findViewById(R.id.fragment_list__recycler_view);
app = (App) getActivity().getApplication();
AppSettings appSettings = app.getSettings();
urls = new DiasporaUrlHelper(appSettings);
aspectsRecyclerView.setHasFixedSize(true);
aspectsRecyclerView.setNestedScrollingEnabled(false);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
aspectsRecyclerView.setLayoutManager(layoutManager);
final AspectAdapter adapter = new AspectAdapter(appSettings, this);
aspectsRecyclerView.setAdapter(adapter);
//Set window title
getActivity().setTitle(R.string.nav_aspects);
}
@Override
public String getFragmentTag() {
return TAG;
}
@Override
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
/* Nothing to do */
}
@Override
public boolean onBackPressed() {
return false;
}
@Override
public void onSomethingClicked(Object null1, Integer null2, String aspectId) {
((MainActivity) getActivity()).openDiasporaUrl(urls.getAspectUrl(aspectId));
}
@Override
protected void applyColorToViews() {
aspectsRecyclerView.invalidate();
}
public static class AspectAdapter extends RecyclerView.Adapter<AspectAdapter.ViewHolder> {
private AppSettings appSettings;
private DiasporaAspect[] aspectList;
private List<String> aspectFavsList;
private OnSomethingClickListener<Object> aspectClickedListener;
static class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.recycler_view__list_item__text)
public TextView title;
@BindView(R.id.recycler_view__list_item__favourite)
AppCompatImageView favouriteImage;
@BindView(R.id.recycler_view__list_item__root)
RelativeLayout root;
ViewHolder(View v) {
super(v);
ButterKnife.bind(this, v);
}
}
AspectAdapter(AppSettings appSettings, OnSomethingClickListener<Object> aspectClickedListener) {
this.appSettings = appSettings;
this.aspectList = appSettings.getAspects();
this.aspectFavsList = new ArrayList<>(Arrays.asList(appSettings.getAspectFavs()));
this.aspectClickedListener = aspectClickedListener;
}
@Override
public int getItemCount() {
return aspectList.length;
}
@Override
public AspectAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.recycler_list__list_item_with_fav, parent, false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
// Alternating colors
final Context c = holder.root.getContext();
final DiasporaAspect aspect = aspectList[position];
holder.title.setText(aspect.name);
if (position % 2 == 1) {
holder.root.setBackgroundColor(Helpers.getColorFromRessource(c, R.color.alternate_row_color));
}
// Favourite (Star) Image
applyFavouriteImage(holder.favouriteImage, isAspectFaved(aspect.name));
// Click on fav button
holder.favouriteImage.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (isAspectFaved(aspect.name)) {
aspectFavsList.remove(aspectFavsList.indexOf(aspect.name));
} else {
aspectFavsList.add(aspect.name);
}
appSettings.setAspectFavs(aspectFavsList);
applyFavouriteImage(holder.favouriteImage, isAspectFaved(aspect.name));
}
});
holder.root.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
aspectClickedListener.onSomethingClicked(null, null, aspect.id + "");
}
});
}
private boolean isAspectFaved(String tag) {
return aspectFavsList.contains(tag);
}
private void applyFavouriteImage(AppCompatImageView imageView, boolean isFaved) {
imageView.setImageResource(isFaved ? R.drawable.ic_star_filled_48px : R.drawable.ic_star_border_black_48px);
imageView.setColorFilter(isFaved ? appSettings.getAccentColor() : 0, PorterDuff.Mode.SRC_ATOP);
}
}
}

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -25,12 +25,13 @@ import android.app.Activity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog; import android.support.v4.content.ContextCompat;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -39,22 +40,30 @@ import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback; import android.webkit.ValueCallback;
import android.webkit.WebChromeClient; import android.webkit.WebChromeClient;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.Toast;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.BuildConfig;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.DiasporaUserProfile; import com.github.dfa.diaspora_android.data.DiasporaUserProfile;
import com.github.dfa.diaspora_android.ui.theme.ThemedAlertDialogBuilder;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.ContextUtils;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.Helpers;
import com.github.dfa.diaspora_android.web.BrowserFragment; import com.github.dfa.diaspora_android.web.BrowserFragment;
import com.github.dfa.diaspora_android.web.DiasporaStreamWebChromeClient; import com.github.dfa.diaspora_android.web.DiasporaStreamWebChromeClient;
import com.github.dfa.diaspora_android.web.FileUploadWebChromeClient; import com.github.dfa.diaspora_android.web.FileUploadWebChromeClient;
import com.github.dfa.diaspora_android.web.WebHelper; import com.github.dfa.diaspora_android.web.WebHelper;
import net.gsantner.opoc.util.PermissionChecker;
import net.gsantner.opoc.util.ShareUtil;
import org.json.JSONException; import org.json.JSONException;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Date;
/** /**
* Fragment that displays the Stream of the diaspora* user * Fragment that displays the Stream of the diaspora* user
@ -92,13 +101,15 @@ public class DiasporaStreamFragment extends BrowserFragment {
} }
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.stream__menu_top, menu);
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
} inflater.inflate(R.menu.stream__menu_top, menu);
@Override if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) { menu.findItem(R.id.action_share_pdf).setVisible(true);
inflater.inflate(R.menu.stream__menu_bottom, menu); }
final boolean darkBg = ContextUtils.get().shouldColorOnTopBeLight(AppSettings.get().getPrimaryColor());
ContextUtils.get().tintMenuItems(menu, true, ContextCompat.getColor(getActivity(), darkBg ? R.color.white : R.color.black));
} }
@Override @Override
@ -117,6 +128,8 @@ public class DiasporaStreamFragment extends BrowserFragment {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
AppLog.d(this, "StreamFragment.onOptionsItemSelected()"); AppLog.d(this, "StreamFragment.onOptionsItemSelected()");
ShareUtil shu = new ShareUtil(getContext());
PermissionChecker permc = new PermissionChecker(getActivity());
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_reload: { case R.id.action_reload: {
if (WebHelper.isOnline(getContext())) { if (WebHelper.isOnline(getContext())) {
@ -127,11 +140,6 @@ public class DiasporaStreamFragment extends BrowserFragment {
} }
} }
case R.id.action_toggle_desktop_page: {
loadUrl(urls.getToggleMobileUrl());
return true;
}
case R.id.action_go_to_top: { case R.id.action_go_to_top: {
ObjectAnimator anim = ObjectAnimator.ofInt(webView, "scrollY", webView.getScrollY(), 0); ObjectAnimator anim = ObjectAnimator.ofInt(webView, "scrollY", webView.getScrollY(), 0);
anim.setDuration(400); anim.setDuration(400);
@ -144,17 +152,51 @@ public class DiasporaStreamFragment extends BrowserFragment {
sharingIntent.setType("text/plain"); sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, webView.getTitle()); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, webView.getTitle());
sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl());
startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.action_share_dotdotdot))); startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_dotdotdot)));
return true;
}
case R.id.action_share_pdf: {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
shu.createPdf(webView, "dandelion-" + ShareUtil.SDF_SHORT.format(new Date()));
}
return true;
}
case R.id.action_share_link_to_clipboard: {
shu.setClipboard(webView.getUrl());
Toast.makeText(getContext(), R.string.link_adress_copied, Toast.LENGTH_SHORT).show();
return true;
}
case R.id.action_create_launcher_shortcut: {
if (webView.getUrl() != null) {
Intent intent = new Intent(getContext(), MainActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(webView.getUrl()));
shu.createLauncherDesktopShortcut(intent, R.drawable.ic_launcher, webView.getTitle());
}
return true; return true;
} }
case R.id.action_take_screenshot: { case R.id.action_take_screenshot: {
makeScreenshotOfWebView(false); if (permc.doIfExtStoragePermissionGranted(getString(R.string.screenshot_permission__appspecific))) {
File fileSaveDirectory = appSettings.getAppSaveDirectory();
if (permc.mkdirIfStoragePermissionGranted(fileSaveDirectory)) {
Bitmap bmp = ShareUtil.getBitmapFromWebView(webView);
String filename = "dandelion-" + ShareUtil.SDF_SHORT.format(new Date()) + ".jpg";
_cu.writeImageToFile(new File(fileSaveDirectory, filename), bmp);
Snackbar.make(webView, getString(R.string.saving_screenshot_as)
+ " " + filename, Snackbar.LENGTH_LONG).show();
}
}
return true; return true;
} }
case R.id.action_share_screenshot: { case R.id.action_share_screenshot: {
makeScreenshotOfWebView(true); if (permc.doIfExtStoragePermissionGranted(getString(R.string.screenshot_permission__appspecific))) {
shu.shareImage(ShareUtil.getBitmapFromWebView(webView));
}
return true; return true;
} }
} }
@ -231,7 +273,10 @@ public class DiasporaStreamFragment extends BrowserFragment {
protected DiasporaStreamWebChromeClient.SharedTextCallback sharedTextCallback = new DiasporaStreamWebChromeClient.SharedTextCallback() { protected DiasporaStreamWebChromeClient.SharedTextCallback sharedTextCallback = new DiasporaStreamWebChromeClient.SharedTextCallback() {
@Override @Override
public String getSharedText() { public String getSharedText() {
return ((MainActivity) getActivity()).getTextToBeShared(); if (getActivity() != null) {
return ((MainActivity) getActivity()).getTextToBeShared();
}
return "";
} }
@Override @Override
@ -247,8 +292,8 @@ public class DiasporaStreamFragment extends BrowserFragment {
int hasWRITE_EXTERNAL_STORAGE = getActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE); int hasWRITE_EXTERNAL_STORAGE = getActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) { if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) {
if (!shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { if (!shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
new AlertDialog.Builder(getContext()) new ThemedAlertDialogBuilder(getContext(), appSettings)
.setMessage(R.string.permissions_image) .setMessage(R.string.image_permission_description__appspecific)
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override @Override
@ -267,15 +312,13 @@ public class DiasporaStreamFragment extends BrowserFragment {
} }
} }
AppLog.v(this, "onOpenFileChooser"); AppLog.v(this, "onOpenFileChooser");
if (imageUploadFilePathCallbackNew != null)
imageUploadFilePathCallbackNew.onReceiveValue(null);
imageUploadFilePathCallbackNew = filePathCallback; imageUploadFilePathCallbackNew = filePathCallback;
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getContext().getPackageManager()) != null) { if (takePictureIntent.resolveActivity(getContext().getPackageManager()) != null) {
// Create the File where the photo should go // Create the File where the photo should go
File photoFile; File photoFile;
try { try {
photoFile = Helpers.createImageFile(); photoFile = ContextUtils.get().createImageFile();
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
} catch (IOException ex) { } catch (IOException ex) {
AppLog.e(this, "ERROR creating temp file: " + ex.toString()); AppLog.e(this, "ERROR creating temp file: " + ex.toString());
@ -328,20 +371,41 @@ public class DiasporaStreamFragment extends BrowserFragment {
@SuppressWarnings("unused") @SuppressWarnings("unused")
@JavascriptInterface @JavascriptInterface
public void setUserProfile(final String webMessage) throws JSONException { public void setUserProfile(final String webMessage) throws JSONException {
DiasporaUserProfile pup = ((App) getActivity().getApplication()).getDiasporaUserProfile(); final Activity activity = getActivity();
AppLog.spam(this, "StreamFragment.JavaScriptInterface.setUserProfile()"); if (activity != null) {
if (pup.isRefreshNeeded()) { activity.runOnUiThread(new Runnable() {
AppLog.v(this, "DiasporaUserProfile needs refresh; Try to parse JSON"); @Override
pup.parseJson(webMessage); public void run() {
} else { App app = ((App) activity.getApplication());
AppLog.spam(this, "No DiasporaUserProfile refresh needed"); final DiasporaUserProfile pup = app.getDiasporaUserProfile();
if (pup.isRefreshNeeded()) {
try {
// Try to very fail-safe check if user information gets really loaded from correct pod
if (!webView.getUrl().startsWith(app.getSettings().getPod().getPodUrl().getBaseUrl())) {
return;
}
} catch (Exception ignored) {
return;
}
AppLog.v(this, "DiasporaUserProfile needs refresh; Try to parse JSON");
pup.parseJson(webMessage);
getActivity().runOnUiThread(new Runnable() {
public void run() {
pup.analyzeUrl(webView.getUrl());
}
});
}
}
});
} }
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
@JavascriptInterface @JavascriptInterface
public void contentHasBeenShared() { public void contentHasBeenShared() {
((MainActivity) getActivity()).setTextToBeShared(null); if (getActivity() != null) {
((MainActivity) getActivity()).setTextToBeShared(null);
}
} }
} }

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -25,6 +25,8 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.LayerDrawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -34,12 +36,15 @@ import android.support.customtabs.CustomTabsSession;
import android.support.design.widget.AppBarLayout; import android.support.design.widget.AppBarLayout;
import android.support.design.widget.NavigationView; import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.GravityCompat; import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.ActionMenuView; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
@ -58,6 +63,7 @@ import android.widget.Toast;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.DiasporaAspect;
import com.github.dfa.diaspora_android.data.DiasporaPodList; import com.github.dfa.diaspora_android.data.DiasporaPodList;
import com.github.dfa.diaspora_android.data.DiasporaUserProfile; import com.github.dfa.diaspora_android.data.DiasporaUserProfile;
import com.github.dfa.diaspora_android.listener.DiasporaUserProfileChangedListener; import com.github.dfa.diaspora_android.listener.DiasporaUserProfileChangedListener;
@ -66,11 +72,16 @@ import com.github.dfa.diaspora_android.receiver.OpenExternalLinkReceiver;
import com.github.dfa.diaspora_android.receiver.UpdateTitleReceiver; import com.github.dfa.diaspora_android.receiver.UpdateTitleReceiver;
import com.github.dfa.diaspora_android.ui.BadgeDrawable; import com.github.dfa.diaspora_android.ui.BadgeDrawable;
import com.github.dfa.diaspora_android.ui.PodSelectionDialog; import com.github.dfa.diaspora_android.ui.PodSelectionDialog;
import com.github.dfa.diaspora_android.ui.theme.CustomFragment; import com.github.dfa.diaspora_android.ui.SearchOrCustomTextDialogCreator;
import com.github.dfa.diaspora_android.ui.theme.ThemeHelper; import com.github.dfa.diaspora_android.ui.theme.ThemeHelper;
import com.github.dfa.diaspora_android.ui.theme.ThemedActivity; import com.github.dfa.diaspora_android.ui.theme.ThemedActivity;
import com.github.dfa.diaspora_android.ui.theme.ThemedAlertDialogBuilder;
import com.github.dfa.diaspora_android.ui.theme.ThemedFragment;
import com.github.dfa.diaspora_android.util.ActivityUtils;
import com.github.dfa.diaspora_android.util.AndroidBug5497Workaround;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.ContextUtils;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.web.BrowserFragment; import com.github.dfa.diaspora_android.web.BrowserFragment;
import com.github.dfa.diaspora_android.web.ContextMenuWebView; import com.github.dfa.diaspora_android.web.ContextMenuWebView;
@ -78,8 +89,13 @@ import com.github.dfa.diaspora_android.web.ProxyHandler;
import com.github.dfa.diaspora_android.web.WebHelper; import com.github.dfa.diaspora_android.web.WebHelper;
import com.github.dfa.diaspora_android.web.custom_tab.CustomTabActivityHelper; import com.github.dfa.diaspora_android.web.custom_tab.CustomTabActivityHelper;
import net.gsantner.opoc.format.markdown.SimpleMarkdownParser;
import java.io.IOException;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick;
public class MainActivity extends ThemedActivity public class MainActivity extends ThemedActivity
implements NavigationView.OnNavigationItemSelectedListener, implements NavigationView.OnNavigationItemSelectedListener,
@ -105,14 +121,13 @@ public class MainActivity extends ThemedActivity
private App app; private App app;
private CustomTabActivityHelper customTabActivityHelper; private CustomTabActivityHelper customTabActivityHelper;
private AppSettings appSettings; private AppSettings _appSettings;
private DiasporaUrlHelper urls; private DiasporaUrlHelper urls;
private DiasporaUserProfile diasporaUserProfile; private DiasporaUserProfile diasporaUserProfile;
private final Handler uiHandler = new Handler(); private final Handler uiHandler = new Handler();
private OpenExternalLinkReceiver brOpenExternalLink; private OpenExternalLinkReceiver brOpenExternalLink;
private BroadcastReceiver brSetTitle; private BroadcastReceiver brSetTitle;
private Snackbar snackbarExitApp; private Snackbar snackbarExitApp, snackbarNoInternet, snackbarLastVisitedTimestampInStream;
private Snackbar snackbarNoInternet;
private FragmentManager fm; private FragmentManager fm;
private CustomTabsSession customTabsSession; private CustomTabsSession customTabsSession;
@ -125,9 +140,6 @@ public class MainActivity extends ThemedActivity
@BindView(R.id.main__topbar) @BindView(R.id.main__topbar)
Toolbar toolbarTop; Toolbar toolbarTop;
@BindView(R.id.main__bottombar)
ActionMenuView toolbarBottom;
@BindView(R.id.fragment_container) @BindView(R.id.fragment_container)
FrameLayout fragmentContainer; FrameLayout fragmentContainer;
@ -159,17 +171,26 @@ public class MainActivity extends ThemedActivity
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
AppLog.v(this, "onCreate()"); AppLog.v(this, "onCreate()");
// Pre UI
ContextUtils.get().setAppLanguage(AppSettings.get().getLanguage());
if (AppSettings.get().isEditorStatusBarHidden()) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
// Bind UI // Bind UI
setContentView(R.layout.main__activity); setContentView(R.layout.main__activity);
ButterKnife.bind(this); ButterKnife.bind(this);
if (AppSettings.get().isEditorStatusBarHidden()) {
AndroidBug5497Workaround.assistActivity(this);
}
if ((app = (App) getApplication()) == null) AppLog.e(this, "App is null!"); app = (App) getApplication();
if ((appSettings = app.getSettings()) == null) AppLog.e(this, "AppSettings is null!"); _appSettings = app.getSettings();
if ((diasporaUserProfile = app.getDiasporaUserProfile()) == null) diasporaUserProfile = app.getDiasporaUserProfile();
AppLog.e(this, "DiasporaUserProfile is null!");
diasporaUserProfile.setCallbackHandler(uiHandler); diasporaUserProfile.setCallbackHandler(uiHandler);
diasporaUserProfile.setListener(this); diasporaUserProfile.setListener(this);
urls = new DiasporaUrlHelper(appSettings); urls = new DiasporaUrlHelper(_appSettings);
customTabActivityHelper = new CustomTabActivityHelper(); customTabActivityHelper = new CustomTabActivityHelper();
customTabActivityHelper.setConnectionCallback(this); customTabActivityHelper.setConnectionCallback(this);
ProxyHandler.getInstance().updateProxySettings(this); ProxyHandler.getInstance().updateProxySettings(this);
@ -179,24 +200,23 @@ public class MainActivity extends ThemedActivity
brOpenExternalLink = new OpenExternalLinkReceiver(this); brOpenExternalLink = new OpenExternalLinkReceiver(this);
brSetTitle = new UpdateTitleReceiver(app, urls, new UpdateTitleReceiver.TitleCallback() { brSetTitle = new UpdateTitleReceiver(app, urls, new UpdateTitleReceiver.TitleCallback() {
@Override public void setTitle(String url, int resId) {
public void setTitle(int rId) { ThemedFragment top = getTopFragment();
CustomFragment top = getTopFragment();
if (top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) { if (top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) {
MainActivity.this.setTitle(rId); MainActivity.this.setTitle(resId);
showLastVisitedTimestampMessageIfNeeded(url);
} }
} }
@Override public void setTitle(String url, String title) {
public void setTitle(String title) { ThemedFragment top = getTopFragment();
CustomFragment top = getTopFragment();
if (top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) { if (top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) {
MainActivity.this.setTitle(title); MainActivity.this.setTitle(title);
} }
} }
}); });
if (!appSettings.hasPod()) { if (!_appSettings.hasPod()) {
AppLog.d(this, "We have no pod. Show PodSelectionFragment"); AppLog.d(this, "We have no pod. Show PodSelectionFragment");
updateNavigationViewEntryVisibilities(); updateNavigationViewEntryVisibilities();
showFragment(getFragment(PodSelectionFragment.TAG)); showFragment(getFragment(PodSelectionFragment.TAG));
@ -210,6 +230,21 @@ public class MainActivity extends ThemedActivity
openDiasporaUrl(urls.getStreamUrl()); openDiasporaUrl(urls.getStreamUrl());
} }
} }
// Show first start / update dialog
try {
if (_appSettings.isAppCurrentVersionFirstStart(true)) {
SimpleMarkdownParser smp = SimpleMarkdownParser.get().setDefaultSmpFilter(SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW);
String html = "";
html += smp.parse(getString(R.string.copyright_license_text_official).replace("\n", " \n"), "").getHtml();
html += "<br/><br/><br/><big><big>" + getString(R.string.changelog) + "</big></big><br/>" + smp.parse(getResources().openRawResource(R.raw.changelog), "", SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW, SimpleMarkdownParser.FILTER_CHANGELOG).getHtml();
html += "<br/><br/><br/><big><big>" + getString(R.string.licenses) + "</big></big><br/>" + smp.parse(getResources().openRawResource(R.raw.licenses_3rd_party), "").getHtml();
ActivityUtils _au = new ActivityUtils(this);
_au.showDialogWithHtmlTextView(R.string.licenses, html);
}
} catch (IOException e) {
e.printStackTrace();
}
} }
/** /**
@ -219,27 +254,32 @@ public class MainActivity extends ThemedActivity
private void setupUI() { private void setupUI() {
AppLog.i(this, "setupUI()"); AppLog.i(this, "setupUI()");
// Setup toolbar // Setup _toolbar
setSupportActionBar(toolbarTop); setSupportActionBar(toolbarTop);
toolbarBottom.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() { ActionBar actionBar = getSupportActionBar();
public boolean onMenuItemClick(MenuItem item) { if (actionBar != null) {
CustomFragment top = getTopFragment(); actionBar.setDisplayHomeAsUpEnabled(true);
return MainActivity.this.onOptionsItemSelected(item) || (top != null && top.onOptionsItemSelected(item)); }
}
});
setTitle(R.string.app_name); setTitle(R.string.app_name);
//Setup snackbar //Setup snackbar
snackbarExitApp = Snackbar snackbarExitApp = Snackbar
.make(fragmentContainer, R.string.confirm_exit, Snackbar.LENGTH_LONG) .make(fragmentContainer, R.string.do_you_want_to_exit, Snackbar.LENGTH_LONG)
.setAction(android.R.string.yes, new View.OnClickListener() { .setAction(android.R.string.yes, new View.OnClickListener() {
@Override
public void onClick(View view) { public void onClick(View view) {
finish(); finish();
moveTaskToBack(true); moveTaskToBack(true);
} }
}); });
snackbarNoInternet = Snackbar.make(fragmentContainer, R.string.no_internet, Snackbar.LENGTH_LONG); snackbarLastVisitedTimestampInStream =
Snackbar.make(fragmentContainer,
R.string.jump_to_last_visited_page_in_stream__appspecific, Snackbar.LENGTH_LONG)
.setAction(android.R.string.yes, new View.OnClickListener() {
public void onClick(View view) {
openDiasporaUrl(urls.getStreamWithTimestampUrl(diasporaUserProfile.getLastVisitedPositionInStream()));
}
});
snackbarNoInternet = Snackbar.make(fragmentContainer, R.string.sorry_need_to_be_connected_to_internet, Snackbar.LENGTH_LONG);
// Load app settings // Load app settings
setupNavigationSlider(); setupNavigationSlider();
@ -247,27 +287,15 @@ public class MainActivity extends ThemedActivity
} }
/** /**
* Show DiasporaStreamFragment if necessary and load URL url * Get an instance of the ThemedFragment with the tag fragmentTag.
*
* @param url URL to load in the DiasporaStreamFragment
*/
public void openDiasporaUrl(String url) {
AppLog.v(this, "openDiasporaUrl()");
DiasporaStreamFragment streamFragment = (DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG);
showFragment(streamFragment);
streamFragment.loadUrl(url);
}
/**
* Get an instance of the CustomFragment with the tag fragmentTag.
* If there was no instance so far, create a new one and add it to the FragmentManagers pool. * If there was no instance so far, create a new one and add it to the FragmentManagers pool.
* If there is no Fragment with the corresponding Tag, return the top fragment. * If there is no Fragment with the corresponding Tag, return the top fragment.
* *
* @param fragmentTag tag * @param fragmentTag tag
* @return corresponding Fragment * @return corresponding Fragment
*/ */
protected CustomFragment getFragment(String fragmentTag) { protected ThemedFragment getFragment(String fragmentTag) {
CustomFragment fragment = (CustomFragment) fm.findFragmentByTag(fragmentTag); ThemedFragment fragment = (ThemedFragment) fm.findFragmentByTag(fragmentTag);
if (fragment != null) { if (fragment != null) {
return fragment; return fragment;
} else { } else {
@ -280,14 +308,6 @@ public class MainActivity extends ThemedActivity
BrowserFragment bf = new BrowserFragment(); BrowserFragment bf = new BrowserFragment();
fm.beginTransaction().add(bf, fragmentTag).commit(); fm.beginTransaction().add(bf, fragmentTag).commit();
return bf; return bf;
case TagListFragment.TAG:
TagListFragment hlf = new TagListFragment();
fm.beginTransaction().add(hlf, fragmentTag).commit();
return hlf;
case AspectListFragment.TAG:
AspectListFragment alf = new AspectListFragment();
fm.beginTransaction().add(alf, fragmentTag).commit();
return alf;
case PodSelectionFragment.TAG: case PodSelectionFragment.TAG:
PodSelectionFragment psf = new PodSelectionFragment(); PodSelectionFragment psf = new PodSelectionFragment();
fm.beginTransaction().add(psf, fragmentTag).commit(); fm.beginTransaction().add(psf, fragmentTag).commit();
@ -300,23 +320,64 @@ public class MainActivity extends ThemedActivity
} }
} }
/**
* Show DiasporaStreamFragment if necessary and load URL url
*
* @param url URL to load in the DiasporaStreamFragment
*/
public void openDiasporaUrl(final String url) {
AppLog.v(this, "openDiasporaUrl()");
if (url != null && url.startsWith("http://127.0.0.1")) {
// This URL seems to be called somehow, but it doesn't make sense ;)
toolbarTop.postDelayed(() -> {
Intent i = new Intent(ACTION_OPEN_EXTERNAL_URL);
i.putExtra(EXTRA_URL, "https://github.com/gsantner/dandelion/blob/master/README.md");
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);
}, 1000);
return;
}
if (_appSettings.getPod() != null && _appSettings.getPod().getPodUrl() != null && _appSettings.getPod().getPodUrl().getBaseUrl() != null
&& url.startsWith(_appSettings.getPod().getPodUrl().getBaseUrl()) && !url.startsWith("https://dia.so/")) {
DiasporaStreamFragment streamFragment = (DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG);
showFragment(streamFragment);
showLastVisitedTimestampMessageIfNeeded(url);
streamFragment.loadUrl(url);
} else {
toolbarTop.postDelayed(() -> {
Intent i = new Intent(ACTION_OPEN_EXTERNAL_URL);
i.putExtra(EXTRA_URL, url);
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);
}, 1000);
}
}
public void showLastVisitedTimestampMessageIfNeeded(String url) {
if (url.equals(urls.getStreamUrl()) && diasporaUserProfile.hasLastVisitedTimestampInStream()) {
snackbarLastVisitedTimestampInStream.show();
diasporaUserProfile.resetLastVisitedPositionInStream();
}
}
/** /**
* Show the Fragment fragment in R.id.fragment_container. If the fragment was already visible, do nothing. * Show the Fragment fragment in R.id.fragment_container. If the fragment was already visible, do nothing.
* *
* @param fragment Fragment to show * @param fragment Fragment to show
*/ */
protected void showFragment(CustomFragment fragment) { protected void showFragment(ThemedFragment fragment) {
if (PodSelectionFragment.TAG.equals(fragment.getTag())) {
Fragment fragment1 = fm.findFragmentByTag(DiasporaStreamFragment.TAG);
if (fragment1 != null) {
new net.gsantner.opoc.util.ContextUtils(this).restartApp(MainActivity.class);
}
}
AppLog.v(this, "showFragment()"); AppLog.v(this, "showFragment()");
CustomFragment currentTop = (CustomFragment) fm.findFragmentById(R.id.fragment_container); ThemedFragment currentTop = (ThemedFragment) fm.findFragmentById(R.id.fragment_container);
if (currentTop == null || !currentTop.getFragmentTag().equals(fragment.getFragmentTag())) { if (currentTop == null || !currentTop.getFragmentTag().equals(fragment.getFragmentTag())) {
AppLog.v(this, "Fragment was not visible. Replace it."); AppLog.v(this, "Fragment was not visible. Replace it.");
fm.beginTransaction().addToBackStack(null).replace(R.id.fragment_container, fragment, fragment.getFragmentTag()).commit(); fm.beginTransaction().addToBackStack(null).replace(R.id.fragment_container, fragment, fragment.getFragmentTag()).commit();
invalidateOptionsMenu(); invalidateOptionsMenu();
if (appSettings.isIntellihideToolbars() && fragment.isAllowedIntellihide()) { setToolbarIntellihide(_appSettings.isIntellihideToolbars() && fragment.isAllowedIntellihide());
this.enableToolbarHiding();
} else {
this.disableToolbarHiding();
}
} else { } else {
AppLog.v(this, "Fragment was already visible. Do nothing."); AppLog.v(this, "Fragment was already visible. Do nothing.");
} }
@ -327,7 +388,7 @@ public class MainActivity extends ThemedActivity
*/ */
private void setupNavigationSlider() { private void setupNavigationSlider() {
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, navDrawer, toolbarTop, R.string.navigation_drawer_open, R.string.navigation_drawer_close); this, navDrawer, toolbarTop, R.string.open_navdrawer, R.string.close_navdrawer);
navDrawer.addDrawerListener(toggle); navDrawer.addDrawerListener(toggle);
toggle.syncState(); toggle.syncState();
@ -339,13 +400,10 @@ public class MainActivity extends ThemedActivity
navDrawerLayout = ButterKnife.findById(navHeader, R.id.nav_drawer); navDrawerLayout = ButterKnife.findById(navHeader, R.id.nav_drawer);
//Handle clicks on profile picture //Handle clicks on profile picture
navProfilePictureArea.setOnClickListener(new View.OnClickListener() { navProfilePictureArea.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) { public void onClick(View view) {
navDrawer.closeDrawer(GravityCompat.START); navDrawer.closeDrawer(GravityCompat.START);
if (WebHelper.isOnline(MainActivity.this)) { if (!_appSettings.getProfileId().equals("")) {
openDiasporaUrl(urls.getProfileUrl()); openDiasporaUrl(urls.getProfileUrl());
} else {
snackbarNoInternet.show();
} }
} }
}); });
@ -353,13 +411,13 @@ public class MainActivity extends ThemedActivity
navheaderDescription = ButterKnife.findById(navHeader, R.id.podselection__podupti_notice); navheaderDescription = ButterKnife.findById(navHeader, R.id.podselection__podupti_notice);
navheaderImage = ButterKnife.findById(navHeader, R.id.navheader_user_image); navheaderImage = ButterKnife.findById(navHeader, R.id.navheader_user_image);
if (!appSettings.getName().equals("")) { if (!_appSettings.getName().equals("")) {
navheaderTitle.setText(appSettings.getName()); navheaderTitle.setText(_appSettings.getName());
} }
if (appSettings.getPod() != null) { if (_appSettings.getPod() != null) {
navheaderDescription.setText(appSettings.getPod().getName()); navheaderDescription.setText(_appSettings.getPod().getName());
} }
String avatarUrl = appSettings.getAvatarUrl(); String avatarUrl = _appSettings.getAvatarUrl();
if (!avatarUrl.equals("")) { if (!avatarUrl.equals("")) {
//Display app launcher icon instead of default avatar asset //Display app launcher icon instead of default avatar asset
//(Which would by the way not load because of missing pod domain prefix in the url) //(Which would by the way not load because of missing pod domain prefix in the url)
@ -385,26 +443,43 @@ public class MainActivity extends ThemedActivity
navMenu.setGroupVisible(navMenu.findItem(R.id.nav_exit).getGroupId(), true); navMenu.setGroupVisible(navMenu.findItem(R.id.nav_exit).getGroupId(), true);
// Hide by app settings // Hide by app settings
navMenu.findItem(R.id.nav_exit).setVisible(appSettings.isVisibleInNavExit()); navMenu.findItem(R.id.nav_exit).setVisible(_appSettings.isVisibleInNavExit());
navMenu.findItem(R.id.nav_activities).setVisible(appSettings.isVisibleInNavActivities()); navMenu.findItem(R.id.nav_activities).setVisible(_appSettings.isVisibleInNavActivities());
navMenu.findItem(R.id.nav_aspects).setVisible(appSettings.isVisibleInNavAspects()); navMenu.findItem(R.id.nav_aspects).setVisible(_appSettings.isVisibleInNavAspects());
navMenu.findItem(R.id.nav_contacts).setVisible(appSettings.isVisibleInNavContacts()); navMenu.findItem(R.id.nav_contacts).setVisible(_appSettings.isVisibleInNavContacts());
navMenu.findItem(R.id.nav_commented).setVisible(appSettings.isVisibleInNavCommented()); navMenu.findItem(R.id.nav_commented).setVisible(_appSettings.isVisibleInNavCommented());
navMenu.findItem(R.id.nav_followed_tags).setVisible(appSettings.isVisibleInNavFollowed_tags()); navMenu.findItem(R.id.nav_followed_tags).setVisible(_appSettings.isVisibleInNavFollowed_tags());
navMenu.findItem(R.id.nav_about).setVisible(appSettings.isVisibleInNavHelp_license()); navMenu.findItem(R.id.nav_about).setVisible(_appSettings.isVisibleInNavHelp_license());
navMenu.findItem(R.id.nav_liked).setVisible(appSettings.isVisibleInNavLiked()); navMenu.findItem(R.id.nav_liked).setVisible(_appSettings.isVisibleInNavLiked());
navMenu.findItem(R.id.nav_mentions).setVisible(appSettings.isVisibleInNavMentions()); navMenu.findItem(R.id.nav_mentions).setVisible(_appSettings.isVisibleInNavMentions());
navMenu.findItem(R.id.nav_profile).setVisible(appSettings.isVisibleInNavProfile()); navMenu.findItem(R.id.nav_profile).setVisible(_appSettings.isVisibleInNavProfile());
navMenu.findItem(R.id.nav_public).setVisible(appSettings.isVisibleInNavPublic_activities()); navMenu.findItem(R.id.nav_public).setVisible(_appSettings.isVisibleInNavPublic_activities());
navMenu.findItem(R.id.nav_stream).setVisible(true); navMenu.findItem(R.id.nav_stream).setVisible(true);
navMenu.findItem(R.id.nav_statistics).setVisible(_appSettings.isVisibleInNavStatistics());
navMenu.findItem(R.id.nav_reports).setVisible(_appSettings.isVisibleInNavReports());
navMenu.findItem(R.id.nav_toggle_desktop_page).setVisible(_appSettings.isVisibleInNavToggleMobileDesktop());
navMenu.findItem(R.id.nav_product_support).setVisible(_appSettings.isVisibleInNavGsantnerAccount());
// Hide whole group (for logged in use) if no pod was selected // Hide whole group (for logged in use) if no pod was selected
if (!appSettings.hasPod()) { if (!_appSettings.hasPod()) {
navMenu.setGroupVisible(navMenu.findItem(R.id.nav_exit).getGroupId(), false); navMenu.setGroupVisible(navMenu.findItem(R.id.nav_exit).getGroupId(), false);
} }
} }
/**
* Open Stream when clicked on top _toolbar AND preference stream shortcut is true
*
* @param view selected view
*/
@OnClick(R.id.main__topbar)
public void onToolBarClicked(View view) {
AppLog.i(this, "onToolBarClicked()");
if (_appSettings.isTopbarStreamShortcutEnabled() && _appSettings.hasPod()) {
onNavigationItemSelected(navView.getMenu().findItem(R.id.nav_stream));
}
}
/** /**
* Forward incoming intents to handleIntent() * Forward incoming intents to handleIntent()
* *
@ -447,10 +522,12 @@ public class MainActivity extends ThemedActivity
} }
} else if (ACTION_CHANGE_ACCOUNT.equals(action)) { } else if (ACTION_CHANGE_ACCOUNT.equals(action)) {
AppLog.v(this, "Reset pod data and show PodSelectionFragment"); AppLog.v(this, "Reset pod data and show PodSelectionFragment");
appSettings.setPod(null); _appSettings.setPod(null);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override
public void run() { public void run() {
navheaderTitle.setText(R.string.app_name);
navheaderDescription.setText(R.string.app_subtitle);
navheaderImage.setImageResource(R.drawable.ic_launcher);
app.resetPodData(((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView()); app.resetPodData(((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView());
} }
}); });
@ -458,7 +535,6 @@ public class MainActivity extends ThemedActivity
} else if (ACTION_CLEAR_CACHE.equals(action)) { } else if (ACTION_CLEAR_CACHE.equals(action)) {
AppLog.v(this, "Clear WebView cache"); AppLog.v(this, "Clear WebView cache");
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override
public void run() { public void run() {
ContextMenuWebView wv = ((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView(); ContextMenuWebView wv = ((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView();
if (wv != null) { if (wv != null) {
@ -483,9 +559,21 @@ public class MainActivity extends ThemedActivity
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) { } else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
/* TODO: Implement and add filter to manifest */ /* TODO: Implement and add filter to manifest */
return; return;
} else if ("sc_new_post".equals(action)) {
openDiasporaUrl(urls.getNewPostUrl());
return;
} else if ("sc_activities".equals(action)) {
openDiasporaUrl(urls.getActivityUrl());
return;
} else if ("sc_contacts".equals(action)) {
onNavigationItemSelected(navView.getMenu().findItem(R.id.nav_aspects));
return;
} else if ("sc_tags".equals(action)) {
onNavigationItemSelected(navView.getMenu().findItem(R.id.nav_followed_tags));
return;
} }
//Catch split screen recreation //Catch split screen recreation
if (action.equals(Intent.ACTION_MAIN) && getTopFragment() != null) { if (action != null && action.equals(Intent.ACTION_MAIN) && getTopFragment() != null) {
return; return;
} }
@ -513,8 +601,8 @@ public class MainActivity extends ThemedActivity
* *
* @return top fragment or null if there is none displayed * @return top fragment or null if there is none displayed
*/ */
private CustomFragment getTopFragment() { private ThemedFragment getTopFragment() {
return (CustomFragment) fm.findFragmentById(R.id.fragment_container); return (ThemedFragment) fm.findFragmentById(R.id.fragment_container);
} }
/** /**
@ -527,7 +615,7 @@ public class MainActivity extends ThemedActivity
navDrawer.closeDrawer(navView); navDrawer.closeDrawer(navView);
return; return;
} }
CustomFragment top = getTopFragment(); ThemedFragment top = getTopFragment();
if (top != null) { if (top != null) {
AppLog.v(this, "Top Fragment is not null"); AppLog.v(this, "Top Fragment is not null");
if (!top.onBackPressed()) { if (!top.onBackPressed()) {
@ -579,48 +667,52 @@ public class MainActivity extends ThemedActivity
LocalBroadcastManager.getInstance(this).registerReceiver(brSetTitle, new IntentFilter(ACTION_UPDATE_TITLE_FROM_URL)); LocalBroadcastManager.getInstance(this).registerReceiver(brSetTitle, new IntentFilter(ACTION_UPDATE_TITLE_FROM_URL));
LocalBroadcastManager.getInstance(this).registerReceiver(brOpenExternalLink, new IntentFilter(ACTION_OPEN_EXTERNAL_URL)); LocalBroadcastManager.getInstance(this).registerReceiver(brOpenExternalLink, new IntentFilter(ACTION_OPEN_EXTERNAL_URL));
invalidateOptionsMenu(); invalidateOptionsMenu();
this.appSettings = getAppSettings(); _appSettings = getAppSettings();
if (appSettings.isIntellihideToolbars()) { if (_appSettings.isRecreateMainActivity()) {
enableToolbarHiding(); recreate();
} else { }
disableToolbarHiding(); setToolbarIntellihide(_appSettings.isIntellihideToolbars());
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayShowTitleEnabled(AppSettings.get().isShowTitleInMainView());
} }
updateNavigationViewEntryVisibilities(); updateNavigationViewEntryVisibilities();
} }
/** /**
* Clear and repopulate top and bottom toolbar. * Clear and repopulate top and bottom _toolbar.
* Also add menu items of the displayed fragment * Also add menu items of the displayed fragment
* *
* @param menu top toolbar * @param menu top _toolbar
* @return boolean * @return boolean
*/ */
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
AppLog.v(this, "onCreateOptionsMenu()"); AppLog.v(this, "onCreateOptionsMenu()");
boolean cache;
//Clear the menus //Clear the menus
menu.clear(); menu.clear();
toolbarBottom.getMenu().clear();
toolbarBottom.setVisibility(View.VISIBLE);
CustomFragment top = getTopFragment(); ThemedFragment top = getTopFragment();
if (top != null) { if (top != null) {
//PodSelectionFragment? if (!top.getFragmentTag().equals(PodSelectionFragment.TAG)) {
if (top.getFragmentTag().equals(PodSelectionFragment.TAG)) { cache = _appSettings.isExtendedNotificationsActivated();
///Hide bottom toolbar getMenuInflater().inflate(R.menu.main__menu_top, menu);
toolbarBottom.setVisibility(View.GONE); menu.findItem(R.id.action_notifications).setVisible(!cache);
} else { menu.findItem(R.id.action_notifications_extended).setVisible(cache);
getMenuInflater().inflate(appSettings.isExtendedNotificationsActivated() ?
R.menu.main__menu_top__notifications_dropdown : R.menu.main__menu_top, menu);
getMenuInflater().inflate(R.menu.main__menu_bottom, toolbarBottom.getMenu());
top.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater());
} }
} }
ContextUtils cu = ContextUtils.get();
final boolean darkBg = cu.get().shouldColorOnTopBeLight(AppSettings.get().getPrimaryColor());
cu.tintMenuItems(menu, true, ContextCompat.getColor(this, darkBg ? R.color.white : R.color.black));
cu.setSubMenuIconsVisiblity(menu, true);
return true; return true;
} }
/** /**
* Set the notification and messages counter in the top toolbar * Set the notification and messages counter in the top _toolbar
* *
* @param menu menu * @param menu menu
* @return boolean * @return boolean
@ -653,7 +745,7 @@ public class MainActivity extends ThemedActivity
AppLog.i(this, "onOptionsItemSelected()"); AppLog.i(this, "onOptionsItemSelected()");
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_notifications: { case R.id.action_notifications: {
if (appSettings.isExtendedNotificationsActivated()) { if (_appSettings.isExtendedNotificationsActivated()) {
return true; return true;
} }
//Otherwise we execute the action of action_notifications_all //Otherwise we execute the action of action_notifications_all
@ -739,12 +831,6 @@ public class MainActivity extends ThemedActivity
} }
} }
case R.id.action_exit: {
moveTaskToBack(true);
finish();
return true;
}
case R.id.action_compose: { case R.id.action_compose: {
if (WebHelper.isOnline(MainActivity.this)) { if (WebHelper.isOnline(MainActivity.this)) {
openDiasporaUrl(urls.getNewPostUrl()); openDiasporaUrl(urls.getNewPostUrl());
@ -758,14 +844,17 @@ public class MainActivity extends ThemedActivity
if (WebHelper.isOnline(MainActivity.this)) { if (WebHelper.isOnline(MainActivity.this)) {
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
View layout = getLayoutInflater().inflate(R.layout.ui__dialog_search__people_tags, null, false); @SuppressLint("InflateParams") View layout = getLayoutInflater().inflate(R.layout.ui__dialog_search__people_tags, null, false);
final EditText input = (EditText) layout.findViewById(R.id.dialog_search__input); final EditText input = layout.findViewById(R.id.dialog_search__input);
input.setMaxLines(1);
input.setSingleLine(true);
ThemeHelper.updateEditTextColor(input);
final DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() { final DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int which) { public void onClick(DialogInterface dialogInterface, int which) {
String query = input.getText().toString().trim().replaceAll((which == DialogInterface.BUTTON_NEGATIVE ? "\\*" : "\\#"), ""); String query = input.getText().toString().trim().replaceAll((which == DialogInterface.BUTTON_NEGATIVE ? "\\*" : "\\#"), "");
if (query.equals("")) { if (query.equals("")) {
Snackbar.make(fragmentContainer, R.string.search_alert_bypeople_validate_needsomedata, Snackbar.LENGTH_LONG).show(); Snackbar.make(fragmentContainer, R.string.please_add_a_name, Snackbar.LENGTH_LONG).show();
} else { } else {
openDiasporaUrl(which == DialogInterface.BUTTON_NEGATIVE ? urls.getSearchPeopleUrl(query) : urls.getSearchTagsUrl(query)); openDiasporaUrl(which == DialogInterface.BUTTON_NEGATIVE ? urls.getSearchPeopleUrl(query) : urls.getSearchTagsUrl(query));
} }
@ -774,11 +863,11 @@ public class MainActivity extends ThemedActivity
} }
}; };
final android.support.v7.app.AlertDialog dialog = new android.support.v7.app.AlertDialog.Builder(this) final AlertDialog dialog = new ThemedAlertDialogBuilder(this, _appSettings)
.setView(layout).setTitle(R.string.search_alert_title) .setView(layout).setTitle(R.string.search_alert_title)
.setCancelable(true) .setCancelable(true)
.setPositiveButton(R.string.search_alert_tag, clickListener) .setPositiveButton(R.string.by_tags, clickListener)
.setNegativeButton(R.string.search_alert_people, clickListener) .setNegativeButton(R.string.by_people, clickListener)
.create(); .create();
input.setOnEditorActionListener(new TextView.OnEditorActionListener() { input.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@ -880,9 +969,9 @@ public class MainActivity extends ThemedActivity
private void setSharedTexts(String sharedSubject, String sharedBody) { private void setSharedTexts(String sharedSubject, String sharedBody) {
AppLog.i(this, "setSharedTexts()"); AppLog.i(this, "setSharedTexts()");
String body = WebHelper.replaceUrlWithMarkdown(sharedBody); String body = WebHelper.replaceUrlWithMarkdown(sharedBody);
if (appSettings.isAppendSharedViaApp()) { if (_appSettings.isAppendSharedViaApp()) {
AppLog.v(this, "Append app reference to shared text"); AppLog.v(this, "Append app reference to shared text");
body = body + "\n\n" + getString(R.string.shared_by_diaspora_android); body = body + "\n\n" + getString(R.string.shared_via_app);
} }
final String escapedBody = WebHelper.escapeHtmlText(body); final String escapedBody = WebHelper.escapeHtmlText(body);
if (sharedSubject != null) { if (sharedSubject != null) {
@ -891,7 +980,7 @@ public class MainActivity extends ThemedActivity
AppLog.v(this, "Set shared text; Subject: \"" + escapedSubject + "\" Body: \"" + escapedBody + "\""); AppLog.v(this, "Set shared text; Subject: \"" + escapedSubject + "\" Body: \"" + escapedBody + "\"");
textToBeShared = "**" + escapedSubject + "** " + escapedBody; textToBeShared = "**" + escapedSubject + "** " + escapedBody;
} else { } else {
AppLog.v(this, "Set shared text; Subject: \"" + sharedSubject + "\" Body: \"" + sharedBody + "\""); AppLog.v(this, "Set shared text; Subject: \"null\" Body: \"" + sharedBody + "\"");
textToBeShared = escapedBody; textToBeShared = escapedBody;
} }
} }
@ -917,7 +1006,7 @@ public class MainActivity extends ThemedActivity
public void onNotificationCountChanged(DiasporaUserProfile diasporaUserProfile, int notificationCount) { public void onNotificationCountChanged(DiasporaUserProfile diasporaUserProfile, int notificationCount) {
AppLog.i(this, "onNotificationCountChanged()"); AppLog.i(this, "onNotificationCountChanged()");
// Count saved in DiasporaUserProfile // Count saved in DiasporaUserProfile
// Invalidate the top toolbar to update the unread messages counter // Invalidate the top _toolbar to update the unread messages counter
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
@ -926,7 +1015,7 @@ public class MainActivity extends ThemedActivity
public void onUnreadMessageCountChanged(DiasporaUserProfile diasporaUserProfile, int unreadMessageCount) { public void onUnreadMessageCountChanged(DiasporaUserProfile diasporaUserProfile, int unreadMessageCount) {
AppLog.i(this, "onUnreadMessageCountChanged()"); AppLog.i(this, "onUnreadMessageCountChanged()");
// Count saved in DiasporaUserProfile // Count saved in DiasporaUserProfile
// Invalidate the top toolbar to update the unread messages counter // Invalidate the top _toolbar to update the unread messages counter
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
@ -967,32 +1056,57 @@ public class MainActivity extends ThemedActivity
break; break;
case R.id.nav_profile: { case R.id.nav_profile: {
if (WebHelper.isOnline(MainActivity.this)) { if (!_appSettings.getProfileId().equals("")) {
openDiasporaUrl(urls.getProfileUrl()); openDiasporaUrl(urls.getProfileUrl());
} else {
snackbarNoInternet.show();
} }
} }
break; break;
case R.id.nav_followed_tags: { case R.id.nav_followed_tags: {
showFragment(getFragment(TagListFragment.TAG)); SearchOrCustomTextDialogCreator.showDiasporaTagsDialog(this, arg -> {
if (arg.startsWith(SearchOrCustomTextDialogCreator.SPECIAL_PREFIX)) {
arg = arg.replace(SearchOrCustomTextDialogCreator.SPECIAL_PREFIX, "").trim();
if (arg.equals(getString(R.string.manage_hashtags))) {
openDiasporaUrl(urls.getManageTagsUrl());
} else {
openDiasporaUrl(urls.getAllFollowedTagsUrl());
}
} else {
openDiasporaUrl(urls.getSearchTagsUrl(arg));
}
});
} }
break; break;
//TODO: Replace with fragment
case R.id.nav_aspects: { case R.id.nav_aspects: {
showFragment(getFragment(AspectListFragment.TAG)); SearchOrCustomTextDialogCreator.showDiasporaAspectsDialog(this, arg -> {
if (arg.startsWith(SearchOrCustomTextDialogCreator.SPECIAL_PREFIX)) {
arg = arg.replace(SearchOrCustomTextDialogCreator.SPECIAL_PREFIX, "").trim();
if (arg.equals(getString(R.string.manage_your_contact_list))) {
openDiasporaUrl(urls.getContactsUrl());
} else if (arg.equals(getString(R.string.nav_profile))) {
openDiasporaUrl(urls.getProfileUrl());
}
} else {
for (DiasporaAspect daspect : _appSettings.getAspects()) {
if (arg.equals(daspect.name)) {
openDiasporaUrl(urls.getAspectUrl(Long.toString(daspect.id)));
break;
}
}
}
});
} }
break; break;
case R.id.nav_contacts: { case R.id.nav_contacts: {
if (WebHelper.isOnline(MainActivity.this)) { if (WebHelper.isOnline(MainActivity.this)) {
openDiasporaUrl(urls.getManageContactsUrl()); openDiasporaUrl(urls.getContactsUrl());
} else { } else {
snackbarNoInternet.show(); snackbarNoInternet.show();
} }
} }
break;
case R.id.nav_activities: { case R.id.nav_activities: {
if (WebHelper.isOnline(MainActivity.this)) { if (WebHelper.isOnline(MainActivity.this)) {
@ -1027,8 +1141,8 @@ public class MainActivity extends ThemedActivity
} else { } else {
snackbarNoInternet.show(); snackbarNoInternet.show();
} }
break;
} }
break;
case R.id.nav_public: { case R.id.nav_public: {
if (WebHelper.isOnline(MainActivity.this)) { if (WebHelper.isOnline(MainActivity.this)) {
@ -1036,14 +1150,42 @@ public class MainActivity extends ThemedActivity
} else { } else {
snackbarNoInternet.show(); snackbarNoInternet.show();
} }
break;
} }
break;
case R.id.nav_reports: {
if (WebHelper.isOnline(MainActivity.this)) {
openDiasporaUrl(urls.getReportsUrl());
} else {
snackbarNoInternet.show();
}
}
break;
case R.id.nav_statistics: {
if (WebHelper.isOnline(MainActivity.this)) {
openDiasporaUrl(urls.getStatisticsUrl());
} else {
snackbarNoInternet.show();
}
}
break;
case R.id.nav_toggle_desktop_page: {
openDiasporaUrl(urls.getToggleMobileUrl());
}
break;
case R.id.nav_product_support: {
openDiasporaUrl(urls.getProfileUrl("d1cbdd70095301341e834860008dbc6c"));
}
break;
case R.id.nav_exit: { case R.id.nav_exit: {
moveTaskToBack(true); moveTaskToBack(true);
finish(); finish();
break;
} }
break;
case R.id.nav_settings: { case R.id.nav_settings: {
startActivity(new Intent(this, SettingsActivity.class)); startActivity(new Intent(this, SettingsActivity.class));
@ -1098,7 +1240,7 @@ public class MainActivity extends ThemedActivity
/** /**
* Set the string that will be shared into the new-post-editor * Set the string that will be shared into the new-post-editor
* *
* @param textToBeShared * @param textToBeShared text that will be shared into the post-editor
*/ */
public void setTextToBeShared(String textToBeShared) { public void setTextToBeShared(String textToBeShared) {
this.textToBeShared = textToBeShared; this.textToBeShared = textToBeShared;
@ -1107,25 +1249,31 @@ public class MainActivity extends ThemedActivity
@Override @Override
protected void applyColorToViews() { protected void applyColorToViews() {
ThemeHelper.updateToolbarColor(toolbarTop); ThemeHelper.updateToolbarColor(toolbarTop);
ThemeHelper.updateActionMenuViewColor(toolbarBottom); navDrawerLayout.setBackgroundColor(_appSettings.getPrimaryColor());
navDrawerLayout.setBackgroundColor(appSettings.getPrimaryColor()); navProfilePictureArea.setBackgroundColor(_appSettings.getPrimaryColor());
navProfilePictureArea.setBackgroundColor(appSettings.getPrimaryColor()); if (_appSettings.isAmoledColorMode()) {
navView.setItemTextColor(ColorStateList.valueOf(Color.GRAY));
navView.setItemIconTintList(ColorStateList.valueOf(Color.GRAY));
navView.setBackgroundColor(Color.BLACK);
navheaderTitle.setTextColor(Color.GRAY);
navheaderDescription.setTextColor(Color.DKGRAY);
}
int popupTheme = ContextUtils.get().shouldColorOnTopBeLight(AppSettings.get().getPrimaryColor())
? R.style.AppTheme_PopupOverlay_Dark : R.style.AppTheme_PopupOverlay_Light;
toolbarTop.setPopupTheme(popupTheme);
} }
@Override public void setToolbarIntellihide(boolean enable) {
public void enableToolbarHiding() {
AppLog.d(this, "Enable Intellihide");
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarTop.getLayoutParams(); AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarTop.getLayoutParams();
//scroll|enterAlways|snap if (enable) {
params.setScrollFlags(toolbarDefaultScrollFlags); AppLog.d(this, "Enable Intellihide");
appBarLayout.setExpanded(true, true); params.setScrollFlags(toolbarDefaultScrollFlags);
}
@Override } else {
public void disableToolbarHiding() { AppLog.d(this, "Disable Intellihide");
AppLog.d(this, "Disable Intellihide"); params.setScrollFlags(0); // clear all scroll flags
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarTop.getLayoutParams(); }
params.setScrollFlags(0); // clear all scroll flags
appBarLayout.setExpanded(true, true); appBarLayout.setExpanded(true, true);
} }
} }

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -22,13 +22,16 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.AppCompatButton;
import android.support.v7.widget.SearchView; import android.support.v7.widget.SearchView;
import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -38,6 +41,7 @@ import android.webkit.CookieManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ListView; import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
@ -47,10 +51,10 @@ import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
import com.github.dfa.diaspora_android.service.FetchPodsService; import com.github.dfa.diaspora_android.service.FetchPodsService;
import com.github.dfa.diaspora_android.ui.PodSelectionDialog; import com.github.dfa.diaspora_android.ui.PodSelectionDialog;
import com.github.dfa.diaspora_android.ui.theme.ThemedFragment; import com.github.dfa.diaspora_android.ui.theme.ThemedFragment;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.ActivityUtils;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.ContextUtils;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.Helpers;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -72,6 +76,13 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
@BindView(R.id.podselection__fragment__listpods) @BindView(R.id.podselection__fragment__listpods)
protected ListView listViewPod; protected ListView listViewPod;
@BindView(R.id.podselection__fragment__root)
RelativeLayout rootView;
@BindView(R.id.podselection__fragment__button_use_custom_pod)
AppCompatButton buttonUseCustomPod;
protected App app; protected App app;
protected AppSettings appSettings; protected AppSettings appSettings;
private DiasporaPodList podList; private DiasporaPodList podList;
@ -79,16 +90,14 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
private String filterString = ""; private String filterString = "";
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { protected int getLayoutResId() {
AppLog.d(this, "onCreateView()"); return R.layout.podselection__fragment;
View view = inflater.inflate(R.layout.podselection__fragment, container, false);
ButterKnife.bind(this, view);
return view;
} }
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
app = (App) getActivity().getApplication(); app = (App) getActivity().getApplication();
appSettings = app.getSettings(); appSettings = app.getSettings();
@ -116,11 +125,11 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
} }
}); });
LocalBroadcastManager.getInstance(getContext()).registerReceiver(podListReceiver, new IntentFilter(FetchPodsService.MESSAGE_PODS_RECEIVED)); LocalBroadcastManager.getInstance(getContext()).registerReceiver(podListReceiver, new IntentFilter(FetchPodsService.MESSAGE_PODS_RECEIVED));
Helpers.showInfoIfUserNotConnectedToInternet(getContext(), listViewPod); ActivityUtils.get(getActivity()).showInfoIfUserNotConnectedToInternet(listViewPod);
} }
public void mergePodlistWithRessources(DiasporaPodList podlist) { public void mergePodlistWithRessources(DiasporaPodList podlist) {
String sPodlist = Helpers.readTextfileFromRawRessource(getContext(), R.raw.podlist, "", ""); String sPodlist = ContextUtils.get().readTextfileFromRawRes(R.raw.podlist, "", "");
try { try {
JSONObject jPodlist = new JSONObject(sPodlist); JSONObject jPodlist = new JSONObject(sPodlist);
podlist.mergeWithNewerEntries(new DiasporaPodList().fromJson(jPodlist)); podlist.mergeWithNewerEntries(new DiasporaPodList().fromJson(jPodlist));
@ -152,7 +161,7 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
} catch (JSONException ignored) { } catch (JSONException ignored) {
} }
} else { } else {
Snackbar.make(listViewPod, R.string.podlist_error, Snackbar.LENGTH_SHORT).show(); Snackbar.make(listViewPod, R.string.could_not_retrieve_list_of_pods__appspecific, Snackbar.LENGTH_SHORT).show();
} }
} }
} }
@ -160,7 +169,14 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
@Override @Override
protected void applyColorToViews() { protected void applyColorToViews() {
/* Not really anything to do. Maybe later */ int dividerHeight = listViewPod.getDividerHeight();
rootView.setBackgroundColor(appSettings.isAmoledColorMode() ? Color.BLACK : Color.WHITE);
listViewPod.setDivider(new ColorDrawable(Color.GRAY));
listViewPod.setDividerHeight(dividerHeight);
int bgcolor = appSettings.isAmoledColorMode() ? Color.DKGRAY : appSettings.getAccentColor();
buttonUseCustomPod.setBackgroundColor(bgcolor);
buttonUseCustomPod.setTextColor(_cu.shouldColorOnTopBeLight(bgcolor) ? Color.WHITE : Color.BLACK);
} }
@Override @Override
@ -176,10 +192,18 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
listedPodsList.add(pod.getPodUrl().getHost()); listedPodsList.add(pod.getPodUrl().getHost());
} }
listViewPodAdapter = new ArrayAdapter<>( listViewPodAdapter = new ArrayAdapter<String>(
getContext(), getContext(),
android.R.layout.simple_list_item_1, android.R.layout.simple_list_item_1,
listedPodsList); listedPodsList) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
TextView textView = view.findViewById(android.R.id.text1);
textView.setTextColor(appSettings.isAmoledColorMode() ? Color.GRAY : Color.BLACK);
return view;
}
};
// save index and top position // save index and top position
int index = listViewPod.getFirstVisiblePosition(); int index = listViewPod.getFirstVisiblePosition();
@ -204,6 +228,7 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.podselection__menu, menu); inflater.inflate(R.menu.podselection__menu, menu);
MenuItem searchItem = menu.findItem(R.id.podselection__action_search); MenuItem searchItem = menu.findItem(R.id.podselection__action_search);
@ -212,14 +237,15 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
searchView.setOnQueryTextListener(this); searchView.setOnQueryTextListener(this);
} }
super.onCreateOptionsMenu(menu, inflater); final boolean darkBg = ContextUtils.get().shouldColorOnTopBeLight(AppSettings.get().getPrimaryColor());
ContextUtils.get().tintMenuItems(menu, true, ContextCompat.getColor(getActivity(), darkBg ? R.color.white : R.color.black));
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_reload: { case R.id.action_reload: {
if (!Helpers.showInfoIfUserNotConnectedToInternet(getContext(), listViewPod)) { if (!ActivityUtils.get(getActivity()).showInfoIfUserNotConnectedToInternet(listViewPod)) {
Intent i = new Intent(getContext(), FetchPodsService.class); Intent i = new Intent(getContext(), FetchPodsService.class);
getContext().startService(i); getContext().startService(i);
return true; return true;
@ -268,11 +294,6 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
/* /*
* Dummy implementations * Dummy implementations
*/ */
@Override
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
}
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
return false; return false;

View file

@ -2,7 +2,6 @@ package com.github.dfa.diaspora_android.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.AlarmManager; import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
@ -27,6 +26,7 @@ import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.ui.theme.ColorPalette; import com.github.dfa.diaspora_android.ui.theme.ColorPalette;
import com.github.dfa.diaspora_android.ui.theme.ThemeHelper; import com.github.dfa.diaspora_android.ui.theme.ThemeHelper;
import com.github.dfa.diaspora_android.ui.theme.ThemedActivity; import com.github.dfa.diaspora_android.ui.theme.ThemedActivity;
import com.github.dfa.diaspora_android.ui.theme.ThemedAlertDialogBuilder;
import com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceFragment; import com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceFragment;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
@ -38,12 +38,7 @@ import butterknife.ButterKnife;
import uz.shift.colorpicker.LineColorPicker; import uz.shift.colorpicker.LineColorPicker;
import uz.shift.colorpicker.OnColorChangedListener; import uz.shift.colorpicker.OnColorChangedListener;
/** public class SettingsActivity extends ThemedActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
* SettingsActivity
* Created by vanitas on 24.10.16.
*/
public class SettingsActivity extends ThemedActivity {
//Toolbar //Toolbar
@BindView(R.id.settings__appbar) @BindView(R.id.settings__appbar)
@ -68,7 +63,7 @@ public class SettingsActivity extends ThemedActivity {
SettingsActivity.this.onBackPressed(); SettingsActivity.this.onBackPressed();
} }
}); });
getAppSettings().registerPreferenceChangedListener(this);
oldProxySettings = getAppSettings().getProxySettings(); oldProxySettings = getAppSettings().getProxySettings();
showFragment(SettingsFragmentMaster.TAG, false); showFragment(SettingsFragmentMaster.TAG, false);
} }
@ -126,6 +121,7 @@ public class SettingsActivity extends ThemedActivity {
ProxyHandler.getInstance().updateProxySettings(this); ProxyHandler.getInstance().updateProxySettings(this);
} }
} }
getAppSettings().unregisterPreferenceChangedListener(this);
super.onStop(); super.onStop();
} }
@ -135,7 +131,7 @@ public class SettingsActivity extends ThemedActivity {
if (top != null && top.getFragmentTag().equals(SettingsFragmentProxy.TAG)) { if (top != null && top.getFragmentTag().equals(SettingsFragmentProxy.TAG)) {
ProxyHandler.ProxySettings newProxySettings = getAppSettings().getProxySettings(); ProxyHandler.ProxySettings newProxySettings = getAppSettings().getProxySettings();
if (oldProxySettings.isEnabled() && !newProxySettings.isEnabled()) { if (oldProxySettings.isEnabled() && !newProxySettings.isEnabled()) {
Toast.makeText(this, R.string.toast__proxy_disabled__restart_required, Toast.LENGTH_LONG).show(); Toast.makeText(this, R.string.app_needs_restart_to_disable_proxy_usage, Toast.LENGTH_LONG).show();
} }
} }
super.onBackPressed(); super.onBackPressed();
@ -150,6 +146,13 @@ public class SettingsActivity extends ThemedActivity {
return (ThemedPreferenceFragment) getFragmentManager().findFragmentById(R.id.settings__fragment_container); return (ThemedPreferenceFragment) getFragmentManager().findFragmentById(R.id.settings__fragment_container);
} }
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(getString(R.string.pref_key__screen_rotation))) {
this.updateScreenRotation();
}
}
public static class SettingsFragmentMaster extends ThemedPreferenceFragment { public static class SettingsFragmentMaster extends ThemedPreferenceFragment {
public static final String TAG = "com.github.dfa.diaspora_android.settings.SettingsFragmentMaster"; public static final String TAG = "com.github.dfa.diaspora_android.settings.SettingsFragmentMaster";
@ -184,6 +187,12 @@ public class SettingsActivity extends ThemedActivity {
((SettingsActivity) getActivity()).showFragment(SettingsFragmentDebugging.TAG, true); ((SettingsActivity) getActivity()).showFragment(SettingsFragmentDebugging.TAG, true);
return true; return true;
} }
/** Usability */
else if (settings.isKeyEqual(key, R.string.pref_key__is_overview_statusbar_hidden)) {
AppSettings.get().setRecreateMainActivity(true);
} else if (settings.isKeyEqual(key, R.string.pref_key__language)) {
AppSettings.get().setRecreateMainActivity(true);
}
/** Network */ /** Network */
else if (settings.isKeyEqual(key, R.string.pref_key__clear_cache)) { else if (settings.isKeyEqual(key, R.string.pref_key__clear_cache)) {
Intent intent = new Intent(getActivity(), MainActivity.class); Intent intent = new Intent(getActivity(), MainActivity.class);
@ -210,14 +219,14 @@ public class SettingsActivity extends ThemedActivity {
} else if (settings.isKeyEqual(key, R.string.pref_key__manage_contacts)) { } else if (settings.isKeyEqual(key, R.string.pref_key__manage_contacts)) {
Intent intent = new Intent(getActivity(), MainActivity.class); Intent intent = new Intent(getActivity(), MainActivity.class);
intent.setAction(MainActivity.ACTION_OPEN_URL); intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getManageContactsUrl()); intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getContactsUrl());
startActivity(intent); startActivity(intent);
getActivity().finish(); getActivity().finish();
return true; return true;
} else if (settings.isKeyEqual(key, R.string.pref_key__change_account)) { } else if (settings.isKeyEqual(key, R.string.pref_key__change_account)) {
new AlertDialog.Builder(getActivity()) new ThemedAlertDialogBuilder(getActivity(), AppSettings.get())
.setTitle(getString(R.string.confirmation)) .setTitle(getString(R.string.confirmation))
.setMessage(getString(R.string.pref_warning__change_account)) .setMessage(getString(R.string.logout_warning_description))
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
.setPositiveButton(android.R.string.yes, .setPositiveButton(android.R.string.yes,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@ -262,6 +271,8 @@ public class SettingsActivity extends ThemedActivity {
@Override @Override
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) { public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
AppSettings settings = ((App) getActivity().getApplication()).getSettings();
DiasporaUrlHelper diasporaUrlHelper = new DiasporaUrlHelper(settings);
if (isAdded() && preference.hasKey()) { if (isAdded() && preference.hasKey()) {
String key = preference.getKey(); String key = preference.getKey();
if (key.equals(getString(R.string.pref_key__primary_color__preference_click))) { if (key.equals(getString(R.string.pref_key__primary_color__preference_click))) {
@ -270,6 +281,13 @@ public class SettingsActivity extends ThemedActivity {
} else if (key.equals(getString(R.string.pref_key__accent_color__preference_click))) { } else if (key.equals(getString(R.string.pref_key__accent_color__preference_click))) {
showColorPickerDialog(2); showColorPickerDialog(2);
return true; return true;
} else if (key.equals(getString(R.string.pref_key__manage_theme))) {
Intent intent = new Intent(getActivity(), MainActivity.class);
intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getThemeUrl());
startActivity(intent);
getActivity().finish();
return true;
} }
} }
return super.onPreferenceTreeClick(screen, preference); return super.onPreferenceTreeClick(screen, preference);
@ -293,15 +311,15 @@ public class SettingsActivity extends ThemedActivity {
//Inflate dialog layout //Inflate dialog layout
LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater();
View dialogLayout = inflater.inflate(R.layout.ui__dialog__color_picker, null); View dialogLayout = inflater.inflate(R.layout.ui__dialog__color_picker, null);
final android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(context); final ThemedAlertDialogBuilder builder = new ThemedAlertDialogBuilder(context, appSettings);
builder.setView(dialogLayout); builder.setView(dialogLayout);
final FrameLayout titleBackground = (FrameLayout) dialogLayout.findViewById(R.id.color_picker_dialog__title_background); final FrameLayout titleBackground = dialogLayout.findViewById(R.id.color_picker_dialog__title_background);
final TextView title = (TextView) dialogLayout.findViewById(R.id.color_picker_dialog__title); final TextView title = dialogLayout.findViewById(R.id.color_picker_dialog__title);
final LineColorPicker base = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_dialog__base_picker); final LineColorPicker base = dialogLayout.findViewById(R.id.color_picker_dialog__base_picker);
final LineColorPicker shade = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_dialog__shade_picker); final LineColorPicker shade = dialogLayout.findViewById(R.id.color_picker_dialog__shade_picker);
title.setText(type == 1 ? R.string.pref_title__primary_color : R.string.pref_title__accent_color); title.setText(type == 1 ? R.string.primary_colors : R.string.accent_color);
title.setTextColor(getResources().getColor(R.color.white)); title.setTextColor(getResources().getColor(R.color.white));
final int[] current = (type == 1 ? appSettings.getPrimaryColorSettings() : appSettings.getAccentColorSettings()); final int[] current = (type == 1 ? appSettings.getPrimaryColorSettings() : appSettings.getAccentColorSettings());
base.setColors((type == 1 ? ColorPalette.getBaseColors(context) : ColorPalette.getAccentColors(context))); base.setColors((type == 1 ? ColorPalette.getBaseColors(context) : ColorPalette.getAccentColors(context)));
@ -390,8 +408,8 @@ public class SettingsActivity extends ThemedActivity {
public void updateSummaries() { public void updateSummaries() {
if (isAdded()) { if (isAdded()) {
AppSettings settings = ((App) getActivity().getApplication()).getSettings(); AppSettings settings = ((App) getActivity().getApplication()).getSettings();
findPreference(settings.getKey(R.string.pref_key__http_proxy_host)).setSummary(settings.getProxyHttpHost()); findPreference(settings.rstr(R.string.pref_key__http_proxy_host)).setSummary(settings.getProxyHttpHost());
findPreference(settings.getKey(R.string.pref_key__http_proxy_port)).setSummary(Integer.toString(settings.getProxyHttpPort())); findPreference(settings.rstr(R.string.pref_key__http_proxy_port)).setSummary(Integer.toString(settings.getProxyHttpPort()));
} }
} }
@ -403,7 +421,7 @@ public class SettingsActivity extends ThemedActivity {
if (appSettings.isKeyEqual(key, R.string.pref_key__http_proxy_load_tor_preset)) { if (appSettings.isKeyEqual(key, R.string.pref_key__http_proxy_load_tor_preset)) {
appSettings.setProxyHttpHost("127.0.0.1"); appSettings.setProxyHttpHost("127.0.0.1");
appSettings.setProxyHttpPort(8118); appSettings.setProxyHttpPort(8118);
Toast.makeText(screen.getContext(), R.string.toast__proxy_orbot_preset_loaded, Toast.LENGTH_SHORT).show(); Toast.makeText(screen.getContext(), R.string.orbot_proxy_preset_loaded, Toast.LENGTH_SHORT).show();
return true; return true;
} }
} }
@ -449,5 +467,35 @@ public class SettingsActivity extends ThemedActivity {
public String getFragmentTag() { public String getFragmentTag() {
return TAG; return TAG;
} }
@Override
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
if (isAdded() && preference.hasKey()) {
AppSettings appSettings = ((App) getActivity().getApplication()).getSettings();
String key = preference.getKey();
if (appSettings.isKeyEqual(key, R.string.pref_key__wipe_settings)) {
showWipeSettingsDialog();
return true;
}
}
return super.onPreferenceTreeClick(screen, preference);
}
private void showWipeSettingsDialog() {
final AppSettings appSettings = AppSettings.get();
ThemedAlertDialogBuilder builder = new ThemedAlertDialogBuilder(getActivity(), appSettings);
builder.setTitle(R.string.confirmation)
.setMessage(R.string.wipe_settings_warning__appspecific)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
appSettings.resetAppSettings();
appSettings.resetPodSettings();
new net.gsantner.opoc.util.ContextUtils(appSettings.getContext()).restartApp(MainActivity.class);
}
}).setNegativeButton(android.R.string.cancel, null)
.create().show();
}
} }
} }

View file

@ -1,196 +0,0 @@
/*
This file is part of the Diaspora for Android.
Diaspora for Android 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.
Diaspora for Android 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 the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.dfa.diaspora_android.activity;
import android.content.Context;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.listener.OnSomethingClickListener;
import com.github.dfa.diaspora_android.ui.theme.ThemedFragment;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.Helpers;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Fragment that shows a list of the HashTags the user follows
*/
public class TagListFragment extends ThemedFragment implements OnSomethingClickListener<Object> {
public static final String TAG = "com.github.dfa.diaspora_android.TagListFragment";
protected RecyclerView followedTagsRecyclerView;
protected App app;
protected DiasporaUrlHelper urls;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
AppLog.d(this, "onCreateView()");
return inflater.inflate(R.layout.recycler_list__fragment, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
followedTagsRecyclerView = (RecyclerView) view.findViewById(R.id.fragment_list__recycler_view);
app = (App) getActivity().getApplication();
AppSettings appSettings = app.getSettings();
urls = new DiasporaUrlHelper(appSettings);
followedTagsRecyclerView.setHasFixedSize(true);
followedTagsRecyclerView.setNestedScrollingEnabled(false);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
followedTagsRecyclerView.setLayoutManager(layoutManager);
final FollowedTagsAdapter adapter = new FollowedTagsAdapter(appSettings, this);
followedTagsRecyclerView.setAdapter(adapter);
//Set window title
getActivity().setTitle(R.string.nav_followed_tags);
}
@Override
public String getFragmentTag() {
return TAG;
}
@Override
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
/* Nothing to do */
}
@Override
public boolean onBackPressed() {
return false;
}
@Override
public void onSomethingClicked(Object null1, Integer null2, String tag) {
((MainActivity) getActivity()).openDiasporaUrl(urls.getSearchTagsUrl(tag));
}
@Override
protected void applyColorToViews() {
followedTagsRecyclerView.invalidate();
}
public static class FollowedTagsAdapter extends RecyclerView.Adapter<FollowedTagsAdapter.ViewHolder> {
private AppSettings appSettings;
private String[] followedTagsList;
private List<String> followedTagsFavsList;
private OnSomethingClickListener<Object> tagClickedListener;
static class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.recycler_view__list_item__text)
public TextView title;
@BindView(R.id.recycler_view__list_item__favourite)
AppCompatImageView favouriteImage;
@BindView(R.id.recycler_view__list_item__root)
RelativeLayout root;
ViewHolder(View v) {
super(v);
ButterKnife.bind(this, v);
}
}
FollowedTagsAdapter(AppSettings appSettings, OnSomethingClickListener<Object> tagClickedListener) {
this.appSettings = appSettings;
this.followedTagsList = appSettings.getFollowedTags();
this.followedTagsFavsList = new ArrayList<>(Arrays.asList(appSettings.getFollowedTagsFavs()));
this.tagClickedListener = tagClickedListener;
}
@Override
public int getItemCount() {
return followedTagsList.length;
}
@Override
public FollowedTagsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.recycler_list__list_item_with_fav, parent, false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
// Alternating colors
final Context c = holder.root.getContext();
final String tag = followedTagsList[position];
holder.title.setText(tag);
if (position % 2 == 1) {
holder.root.setBackgroundColor(Helpers.getColorFromRessource(c, R.color.alternate_row_color));
}
// Favourite (Star) Image
applyFavouriteImage(holder.favouriteImage, isFollowedTagFaved(tag));
// Click on fav button
holder.favouriteImage.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (isFollowedTagFaved(tag)) {
followedTagsFavsList.remove(followedTagsFavsList.indexOf(tag));
} else {
followedTagsFavsList.add(tag);
}
appSettings.setFollowedTagsFavs(followedTagsFavsList);
applyFavouriteImage(holder.favouriteImage, isFollowedTagFaved(tag));
}
});
holder.root.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tagClickedListener.onSomethingClicked(null, null, tag);
}
});
}
private boolean isFollowedTagFaved(String tag) {
return followedTagsFavsList.contains(tag);
}
private void applyFavouriteImage(AppCompatImageView imageView, boolean isFaved) {
imageView.setImageResource(isFaved ? R.drawable.ic_star_filled_48px : R.drawable.ic_star_border_black_48px);
imageView.setColorFilter(isFaved ? appSettings.getAccentColor() : 0, PorterDuff.Mode.SRC_ATOP);
}
}
}

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */

View file

@ -6,20 +6,22 @@ import org.json.JSONObject;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
* Created by gsantner (https://gsantner.github.io/ on 30.09.16. * Created by gsantner (gsantner AT mailbox DOT org on 30.09.16.
* DiasporaPodList - List container for DiasporaPod's, with methods to merge with other DiasporaPodLists * DiasporaPodList - List container for DiasporaPod's, with methods to merge with other DiasporaPodLists
* DiasporaPod - Data container for a Pod, can include N DiasporaPodUrl's * DiasporaPod - Data container for a Pod, can include N DiasporaPodUrl's
* DiasporaPodUrl - A Url of an DiasporaPod * DiasporaPodUrl - A Url of an DiasporaPod
* For all Classes a loading and saving to JSON method is available * For all Classes a loading and saving to JSON method is available
*/ */
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue", "SpellCheckingInspection", "UnusedReturnValue", "JavaDoc", "FieldCanBeLocal"})
public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, Serializable { public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, Serializable {
private static final boolean EXPORT_TOJSON_ACTIVE6 = false; private static final boolean EXPORT_TOJSON_POST_COUNT_LOCAL = true;
private List<DiasporaPod> pods = new ArrayList<>(); private List<DiasporaPod> pods = new ArrayList<>();
private boolean trackMergeChanges = false; private boolean trackMergeChanges = false;
private Integer trackAddedIndexStart = -1; private Integer trackAddedIndexStart = -1;
@ -88,8 +90,8 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
if (updatePodBak.getId() != 0 && updatePod.getId() == 0) { if (updatePodBak.getId() != 0 && updatePod.getId() == 0) {
updatePod.setId(updatePodBak.getId()); updatePod.setId(updatePodBak.getId());
} }
if (updatePodBak.getActive6() != 0 && updatePod.getActive6() == 0) { if (updatePodBak.getPostCountLocal() != 0 && updatePod.getPostCountLocal() == 0) {
updatePod.setActive6(updatePodBak.getActive6()); updatePod.setPostCountLocal(updatePodBak.getPostCountLocal());
} }
if (updatePodBak.getScore() != 0 && updatePod.getScore() == 0) { if (updatePodBak.getScore() != 0 && updatePod.getScore() == 0) {
updatePod.setScore(updatePodBak.getScore()); updatePod.setScore(updatePodBak.getScore());
@ -179,12 +181,12 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
* *
*/ */
public static class DiasporaPod implements Iterable<DiasporaPodList.DiasporaPod.DiasporaPodUrl>, Comparable<DiasporaPod>, Serializable { public static class DiasporaPod implements Iterable<DiasporaPodList.DiasporaPod.DiasporaPodUrl>, Comparable<DiasporaPod>, Serializable {
private List<DiasporaPodUrl> podUrls = new ArrayList<>(); private List<DiasporaPodUrl> _podUrls = new ArrayList<>();
private List<String> mainLangs = new ArrayList<>(); private List<String> _mainLangs = new ArrayList<>();
private String name = ""; private String _name = "";
private int score = 0; private int _score = 0;
private int id = 0; private int _id = 0;
private long active6 = 0; private long _postCountLocal = 0;
public DiasporaPod() { public DiasporaPod() {
@ -199,14 +201,14 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
JSONArray jarr; JSONArray jarr;
if (json.has("name")) { if (json.has("name")) {
name = json.getString("name"); _name = json.getString("name");
} }
if (json.has("mainLangs")) { if (json.has("mainLangs")) {
jarr = json.getJSONArray("mainLangs"); jarr = json.getJSONArray("mainLangs");
for (int i = 0; i < jarr.length(); i++) { for (int i = 0; i < jarr.length(); i++) {
String val = jarr.getString(i); String val = jarr.getString(i);
if (!mainLangs.contains(val)) { if (!_mainLangs.contains(val)) {
mainLangs.add(val); _mainLangs.add(val);
} }
} }
} }
@ -214,19 +216,19 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
jarr = json.getJSONArray("podUrls"); jarr = json.getJSONArray("podUrls");
for (int i = 0; i < jarr.length(); i++) { for (int i = 0; i < jarr.length(); i++) {
DiasporaPodUrl podUrl = new DiasporaPodUrl().fromJson(jarr.getJSONObject(i)); DiasporaPodUrl podUrl = new DiasporaPodUrl().fromJson(jarr.getJSONObject(i));
if (!podUrls.contains(podUrl)) { if (!_podUrls.contains(podUrl)) {
podUrls.add(podUrl); _podUrls.add(podUrl);
} }
} }
} }
if (json.has("score")) { if (json.has("score")) {
score = json.getInt("score"); _score = json.getInt("score");
} }
if (json.has("active6")) { if (json.has("postCountLocal")) {
active6 = json.getLong("active6"); _postCountLocal = json.getLong("postCountLocal");
} }
if (json.has("id")) { if (json.has("id")) {
id = json.getInt("id"); _id = json.getInt("id");
} }
return this; return this;
} }
@ -236,25 +238,28 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
*/ */
public JSONObject toJson() throws JSONException { public JSONObject toJson() throws JSONException {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("name", name); json.put("name", _name);
json.put("score", score); json.put("id", _id);
json.put("id", id);
if (_score != 0) {
json.put("score", _score);
}
// Only export active6 (frequently changing if told to do) // Only export active6 (frequently changing if told to do)
if (EXPORT_TOJSON_ACTIVE6) { if (EXPORT_TOJSON_POST_COUNT_LOCAL && _postCountLocal > 0) {
json.put("active6", active6); json.put("postCountLocal", _postCountLocal);
} }
// Pod urls // Pod urls
JSONArray jarr = new JSONArray(); JSONArray jarr = new JSONArray();
for (DiasporaPodUrl value : podUrls) { for (DiasporaPodUrl value : _podUrls) {
jarr.put(value.toJson()); jarr.put(value.toJson());
} }
json.put("podUrls", jarr); json.put("podUrls", jarr);
// main langs // main langs
jarr = new JSONArray(); jarr = new JSONArray();
for (String value : mainLangs) { for (String value : _mainLangs) {
jarr.put(value); jarr.put(value);
} }
json.put("mainLangs", jarr); json.put("mainLangs", jarr);
@ -268,11 +273,11 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
DiasporaPod otherPod = (DiasporaPod) o; DiasporaPod otherPod = (DiasporaPod) o;
// Check if id is equal // Check if id is equal
ret = this.id != 0 && this.id == otherPod.id; ret = _id != 0 && _id == otherPod._id;
// Check if host is the same (fallback if id is 0) // Check if _host is the same (fallback if id is 0)
if (!ret) { if (!ret) {
for (DiasporaPodUrl podUrl : podUrls) { for (DiasporaPodUrl podUrl : _podUrls) {
for (DiasporaPodUrl otherPodUrl : otherPod.getPodUrls()) { for (DiasporaPodUrl otherPodUrl : otherPod.getPodUrls()) {
if (podUrl.getBaseUrl().equals(otherPodUrl.getBaseUrl())) { if (podUrl.getBaseUrl().equals(otherPodUrl.getBaseUrl())) {
ret = true; ret = true;
@ -292,47 +297,46 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
if (!myPodUrls.isEmpty() && !otherPodUrls.isEmpty()) { if (!myPodUrls.isEmpty() && !otherPodUrls.isEmpty()) {
return myPodUrls.get(0).getHost().compareTo(otherPodUrls.get(0).getHost()); return myPodUrls.get(0).getHost().compareTo(otherPodUrls.get(0).getHost());
} }
return _name.compareTo(otherPod.getName());
} }
return name.compareTo(otherPod.getName()); return _name.compareTo("");
} }
@Override @Override
public String toString() { public String toString() {
return name + "(" + id + ")"; return _name + "(" + _id + ")";
} }
/** /**
* Iterator for Iterable interface (forEach, ..) * Iterator for Iterable interface (forEach, ..)
*/ */
public Iterator<DiasporaPodUrl> iterator() { public Iterator<DiasporaPodUrl> iterator() {
return podUrls.iterator(); return _podUrls.iterator();
} }
/* /*
* Getter & Setter * Getter & Setter
*/ */
public List<DiasporaPodUrl> getPodUrls() { public List<DiasporaPodUrl> getPodUrls() {
return podUrls; return _podUrls;
} }
public DiasporaPod setPodUrls(List<DiasporaPodUrl> podUrls) { public DiasporaPod setPodUrls(List<DiasporaPodUrl> podUrls) {
this.podUrls = podUrls; _podUrls = podUrls;
return this; return this;
} }
public List<String> getMainLangs() { public List<String> getMainLangs() {
return mainLangs; return _mainLangs;
} }
public DiasporaPod setMainLangs(List<String> mainLangs) { public DiasporaPod setMainLangs(List<String> mainLangs) {
this.mainLangs = mainLangs; _mainLangs = mainLangs;
return this; return this;
} }
public DiasporaPod appendMainLangs(String... values) { public DiasporaPod appendMainLangs(String... values) {
for (String mainLang : values) { _mainLangs.addAll(Arrays.asList(values));
this.mainLangs.add(mainLang);
}
return this; return this;
} }
@ -340,52 +344,50 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
* Returns the first DiasporaPodUrl in the list * Returns the first DiasporaPodUrl in the list
*/ */
public DiasporaPodUrl getPodUrl() { public DiasporaPodUrl getPodUrl() {
if (podUrls.size() > 0) { if (_podUrls.size() > 0) {
return podUrls.get(0); return _podUrls.get(0);
} }
return null; return null;
} }
public DiasporaPod appendPodUrls(DiasporaPodUrl... values) { public DiasporaPod appendPodUrls(DiasporaPodUrl... values) {
for (DiasporaPodUrl value : values) { _podUrls.addAll(Arrays.asList(values));
this.podUrls.add(value);
}
return this; return this;
} }
public String getName() { public String getName() {
return name; return _name;
} }
public DiasporaPod setName(String name) { public DiasporaPod setName(String name) {
this.name = name; _name = name;
return this; return this;
} }
public int getScore() { public int getScore() {
return score; return _score;
} }
public DiasporaPod setScore(int score) { public DiasporaPod setScore(int score) {
this.score = score; _score = score;
return this; return this;
} }
public long getActive6() { public long getPostCountLocal() {
return active6; return _postCountLocal;
} }
public DiasporaPod setActive6(long active6) { public DiasporaPod setPostCountLocal(long postCountLocal) {
this.active6 = active6; _postCountLocal = postCountLocal;
return this; return this;
} }
public int getId() { public int getId() {
return id; return _id;
} }
public DiasporaPod setId(int id) { public DiasporaPod setId(int id) {
this.id = id; _id = id;
return this; return this;
} }
@ -397,9 +399,9 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
* *
*/ */
public static class DiasporaPodUrl implements Serializable { public static class DiasporaPodUrl implements Serializable {
private String host = ""; private String _host = "";
private String protocol = "https"; private String _protocol = "https";
private Integer port = 443; private Integer _port = 443;
public DiasporaPodUrl() { public DiasporaPodUrl() {
} }
@ -414,7 +416,7 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
* @return * @return
*/ */
public String getBaseUrl() { public String getBaseUrl() {
return protocol + "://" + host + (isPortNeeded() ? port : ""); return _protocol + "://" + _host + (isPortNeeded() ? _port : "");
} }
/** /**
@ -424,13 +426,13 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
*/ */
public DiasporaPodUrl fromJson(JSONObject json) throws JSONException { public DiasporaPodUrl fromJson(JSONObject json) throws JSONException {
if (json.has("host")) { if (json.has("host")) {
host = json.getString("host"); _host = json.getString("host");
} }
if (json.has("protocol")) { if (json.has("protocol")) {
protocol = json.getString("protocol"); _protocol = json.getString("protocol");
} }
if (json.has("port")) { if (json.has("port")) {
port = json.getInt("port"); _port = json.getInt("port");
} }
return this; return this;
} }
@ -440,12 +442,12 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
*/ */
public JSONObject toJson() throws JSONException { public JSONObject toJson() throws JSONException {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("host", host); json.put("host", _host);
if (!protocol.equals("https")) { if (!_protocol.equals("https")) {
json.put("protocol", protocol); json.put("protocol", _protocol);
} }
if (port != 443) { if (_port != 443) {
json.put("port", port); json.put("port", _port);
} }
return json; return json;
} }
@ -471,7 +473,7 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
* Tells if the ports needs to shown * Tells if the ports needs to shown
*/ */
public boolean isPortNeeded() { public boolean isPortNeeded() {
return !((port == 80 && protocol.equals("http")) || (port == 443 && protocol.equals("https"))); return !((_port == 80 && _protocol.equals("http")) || (_port == 443 && _protocol.equals("https")));
} }
@Override @Override
@ -480,6 +482,7 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
} }
@Override @Override
@SuppressWarnings("SimplifiableIfStatement")
public boolean equals(Object o) { public boolean equals(Object o) {
if (o instanceof DiasporaPodUrl) { if (o instanceof DiasporaPodUrl) {
return getBaseUrl().equals(((DiasporaPodUrl) o).getBaseUrl()); return getBaseUrl().equals(((DiasporaPodUrl) o).getBaseUrl());
@ -491,29 +494,29 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
* GETTER & SETTER * GETTER & SETTER
*/ */
public String getHost() { public String getHost() {
return host; return _host;
} }
public DiasporaPodUrl setHost(String host) { public DiasporaPodUrl setHost(String host) {
this.host = host; _host = host;
return this; return this;
} }
public String getProtocol() { public String getProtocol() {
return protocol; return _protocol;
} }
public DiasporaPodUrl setProtocol(String protocol) { public DiasporaPodUrl setProtocol(String protocol) {
this.protocol = protocol; _protocol = protocol;
return this; return this;
} }
public Integer getPort() { public Integer getPort() {
return port; return _port;
} }
public DiasporaPodUrl setPort(Integer port) { public DiasporaPodUrl setPort(Integer port) {
this.port = port; _port = port;
return this; return this;
} }
} }

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -24,6 +24,7 @@ import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.listener.DiasporaUserProfileChangedListener; import com.github.dfa.diaspora_android.listener.DiasporaUserProfileChangedListener;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -31,7 +32,7 @@ import org.json.JSONObject;
/** /**
* User profile * User profile
* Created by gsantner (https://gsantner.github.io/) on 24.03.16. Part of Diaspora for Android. * Created by gsantner (gsantner AT mailbox DOT org) on 24.03.16. Part of dandelion*.
*/ */
public class DiasporaUserProfile { public class DiasporaUserProfile {
private static final int MINIMUM_USERPROFILE_LOAD_TIMEDIFF = 5000; private static final int MINIMUM_USERPROFILE_LOAD_TIMEDIFF = 5000;
@ -40,6 +41,7 @@ public class DiasporaUserProfile {
private DiasporaUserProfileChangedListener listener; private DiasporaUserProfileChangedListener listener;
private final App app; private final App app;
private final AppSettings appSettings; private final AppSettings appSettings;
DiasporaUrlHelper urls;
private JSONObject json; private JSONObject json;
private long userProfileLastLoadedTimestamp; private long userProfileLastLoadedTimestamp;
private boolean isWebUserProfileLoaded; private boolean isWebUserProfileLoaded;
@ -51,12 +53,17 @@ public class DiasporaUserProfile {
private String[] followedTags; private String[] followedTags;
private int notificationCount; private int notificationCount;
private int unreadMessagesCount; private int unreadMessagesCount;
private long lastVisitedPositionInStream = -1;
public DiasporaUserProfile(App app) { public DiasporaUserProfile(App app) {
this.app = app; this.app = app;
appSettings = app.getSettings(); appSettings = app.getSettings();
urls = new DiasporaUrlHelper(appSettings);
loadFromAppSettings();
}
public void loadFromAppSettings() {
avatarUrl = appSettings.getAvatarUrl(); avatarUrl = appSettings.getAvatarUrl();
guid = appSettings.getProfileId(); guid = appSettings.getProfileId();
name = appSettings.getName(); name = appSettings.getName();
@ -64,6 +71,7 @@ public class DiasporaUserProfile {
followedTags = appSettings.getFollowedTags(); followedTags = appSettings.getFollowedTags();
notificationCount = appSettings.getNotificationCount(); notificationCount = appSettings.getNotificationCount();
unreadMessagesCount = appSettings.getUnreadMessageCount(); unreadMessagesCount = appSettings.getUnreadMessageCount();
lastVisitedPositionInStream = appSettings.getLastVisitedPositionInStream();
} }
public DiasporaUserProfile(App app, Handler callbackHandler, DiasporaUserProfileChangedListener listener) { public DiasporaUserProfile(App app, Handler callbackHandler, DiasporaUserProfileChangedListener listener) {
@ -95,7 +103,7 @@ public class DiasporaUserProfile {
} }
// GUID (User id) // GUID (User id)
if (json.has("guid") && loadGuid(json.getString("guid"))) { if (json.has("guid") && loadGuid(json.getString("guid")) && !guid.isEmpty()) {
appSettings.setProfileId(guid); appSettings.setProfileId(guid);
} }
@ -134,6 +142,16 @@ public class DiasporaUserProfile {
return isWebUserProfileLoaded; return isWebUserProfileLoaded;
} }
public void analyzeUrl(String url) {
String prefix = urls.getPodUrl() + DiasporaUrlHelper.SUBURL_STREAM_WITH_TIMESTAMP;
if (url.startsWith(prefix)) {
try {
setLastVisitedPositionInStream(Long.parseLong(url.replace(prefix, "")));
} catch (NumberFormatException ignored) {
}
}
}
/* /*
// Getters & Setters // Getters & Setters
*/ */
@ -166,6 +184,23 @@ public class DiasporaUserProfile {
return followedTags; return followedTags;
} }
public long getLastVisitedPositionInStream() {
return lastVisitedPositionInStream;
}
public void setLastVisitedPositionInStream(long lastVisitedPositionInStream) {
this.lastVisitedPositionInStream = lastVisitedPositionInStream;
appSettings.setLastVisitedPositionInStream(lastVisitedPositionInStream);
}
public boolean hasLastVisitedTimestampInStream() {
return appSettings.getLastVisitedPositionInStream() != -1;
}
public void resetLastVisitedPositionInStream() {
appSettings.setLastVisitedPositionInStream(-1);
}
/* /*
* Private property setters * Private property setters
*/ */

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -21,7 +21,7 @@ package com.github.dfa.diaspora_android.listener;
import com.github.dfa.diaspora_android.data.DiasporaUserProfile; import com.github.dfa.diaspora_android.data.DiasporaUserProfile;
/** /**
* Created by gsantner (https://gsantner.github.io/) on 26.03.16. * Created by gsantner (gsantner AT mailbox DOT org) on 26.03.16.
* Interface that needs to be implemented by classes that listen for Profile related changes * Interface that needs to be implemented by classes that listen for Profile related changes
*/ */
public interface DiasporaUserProfileChangedListener { public interface DiasporaUserProfileChangedListener {

View file

@ -10,7 +10,5 @@ import android.support.design.widget.AppBarLayout;
public interface IntellihideToolbarActivityListener { public interface IntellihideToolbarActivityListener {
int toolbarDefaultScrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP; int toolbarDefaultScrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP;
void enableToolbarHiding(); void setToolbarIntellihide(boolean enable);
void disableToolbarHiding();
} }

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -48,12 +48,12 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context c, Intent receiveIntent) { public void onReceive(Context c, Intent receiveIntent) {
AppSettings appSettings = new AppSettings(c); AppSettings appSettings = AppSettings.get();
ThemeHelper.getInstance(appSettings); ThemeHelper.getInstance(appSettings);
AppLog.v(this, "OpenExternalLinkReceiver.onReceive(): url"); AppLog.v(this, "OpenExternalLinkReceiver.onReceive(): url");
Uri url = null; Uri url;
try { try {
String sUrl = receiveIntent.getStringExtra(MainActivity.EXTRA_URL); String sUrl = receiveIntent.getStringExtra(MainActivity.EXTRA_URL);
url = Uri.parse(sUrl); url = Uri.parse(sUrl);

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -38,6 +38,7 @@ public class UpdateTitleReceiver extends BroadcastReceiver {
private AppSettings appSettings; private AppSettings appSettings;
private App app; private App app;
private TitleCallback callback; private TitleCallback callback;
private String lastUrl;
public UpdateTitleReceiver(App app, DiasporaUrlHelper urls, TitleCallback callback) { public UpdateTitleReceiver(App app, DiasporaUrlHelper urls, TitleCallback callback) {
this.urls = urls; this.urls = urls;
@ -48,20 +49,24 @@ public class UpdateTitleReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
String url = intent.getStringExtra(MainActivity.EXTRA_URL); lastUrl = intent.getStringExtra(MainActivity.EXTRA_URL);
if (url != null && url.startsWith(urls.getPodUrl())) { if (lastUrl != null && lastUrl.startsWith(urls.getPodUrl())) {
String subUrl = url.substring((urls.getPodUrl()).length()); String subUrl = lastUrl.substring((urls.getPodUrl()).length());
AppLog.spam(this, "onReceive()- Set title for subUrl " + subUrl); AppLog.spam(this, "onReceive()- Set title for subUrl " + subUrl);
if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_STREAM)) { if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_STREAM)) {
setTitle(R.string.nav_stream); setTitle(R.string.nav_stream);
} else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_POSTS)) { } else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_POSTS)) {
setTitle(R.string.diaspora); setTitle(R.string.app_name);
} else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_NOTIFICATIONS)) { } else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_NOTIFICATIONS)) {
setTitle(R.string.notifications); setTitle(R.string.notifications);
} else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_CONVERSATIONS)) { } else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_CONVERSATIONS)) {
setTitle(R.string.conversations); setTitle(R.string.conversations);
} else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_NEW_POST)) { } else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_NEW_POST)) {
setTitle(R.string.new_post); setTitle(R.string.new_post);
} else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_STATISTICS)) {
setTitle(R.string.statistics);
} else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_CONTACTS)) {
setTitle(R.string.contacts);
} else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_PEOPLE + appSettings.getProfileId())) { } else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_PEOPLE + appSettings.getProfileId())) {
setTitle(R.string.nav_profile); setTitle(R.string.nav_profile);
} else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_ACTIVITY)) { } else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_ACTIVITY)) {
@ -74,25 +79,25 @@ public class UpdateTitleReceiver extends BroadcastReceiver {
setTitle(R.string.nav_mentions); setTitle(R.string.nav_mentions);
} else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_PUBLIC)) { } else if (subUrl.startsWith(DiasporaUrlHelper.SUBURL_PUBLIC)) {
setTitle(R.string.public_); setTitle(R.string.public_);
} else if (urls.isAspectUrl(url)) { } else if (urls.isAspectUrl(lastUrl)) {
setTitle(urls.getAspectNameFromUrl(url, app)); setTitle(urls.getAspectNameFromUrl(lastUrl, app));
} }
} else { } else {
AppLog.spam(this, "onReceive()- Invalid url: " + url); AppLog.spam(this, "onReceive()- Invalid url: " + lastUrl);
} }
} }
private void setTitle(int rId) { private void setTitle(int rId) {
callback.setTitle(rId); callback.setTitle(lastUrl, rId);
} }
private void setTitle(String title) { private void setTitle(String title) {
callback.setTitle(title); callback.setTitle(lastUrl, title);
} }
public interface TitleCallback { public interface TitleCallback {
void setTitle(int Rid); void setTitle(String url, int resId);
void setTitle(String title); void setTitle(String url, String title);
} }
} }

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -24,6 +24,8 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.widget.ImageView; import android.widget.ImageView;
import net.gsantner.opoc.util.DownloadTask;
import java.io.File; import java.io.File;
public class AvatarImageLoader { public class AvatarImageLoader {
@ -52,7 +54,9 @@ public class AvatarImageLoader {
public void startImageDownload(ImageView imageView, String avatarUrl) { public void startImageDownload(ImageView imageView, String avatarUrl) {
if (!avatarUrl.equals("")) { if (!avatarUrl.equals("")) {
new ImageDownloadTask(imageView, avatarFile.getAbsolutePath()).execute(avatarUrl); new DownloadTask(new File(avatarFile.getAbsolutePath()), (ok, file) -> {
loadToImageView(imageView);
}).execute(avatarUrl);
} }
} }
} }

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -39,73 +39,76 @@ import javax.net.ssl.HttpsURLConnection;
import info.guardianproject.netcipher.NetCipher; import info.guardianproject.netcipher.NetCipher;
public class FetchPodsService extends Service { public class FetchPodsService extends Service {
public static final String EXTRA_PODLIST = "pods";
public static final String MESSAGE_PODS_RECEIVED = "com.github.dfa.diaspora.podsreceived"; public static final String MESSAGE_PODS_RECEIVED = "com.github.dfa.diaspora.podsreceived";
public static final String PODDY_PODLIST_URL = "https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/podList/podlist.json"; public static final String EXTRA_PODLIST = "pods";
public FetchPodsService() { public FetchPodsService() {
} }
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
getPods(); new GetPodsTask(this).execute();
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
} }
private void getPods() {
AsyncTask<Void, Void, DiasporaPodList> getPodsAsync = new AsyncTask<Void, Void, DiasporaPodList>() {
@Override
protected DiasporaPodList doInBackground(Void... params) {
StringBuilder sb = new StringBuilder();
BufferedReader br = null;
try {
HttpsURLConnection con = NetCipher.getHttpsURLConnection(PODDY_PODLIST_URL);
if (con.getResponseCode() == HttpsURLConnection.HTTP_OK) {
br = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
}
// Parse JSON & return pod list
JSONObject json = new JSONObject(sb.toString());
return new DiasporaPodList().fromJson(json);
} else {
AppLog.e(this, "Failed to download list of pods");
}
} catch (IOException | JSONException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ignored) {
}
}
}
// Could not fetch list of pods :(
return new DiasporaPodList();
}
@Override
protected void onPostExecute(DiasporaPodList pods) {
if (pods == null) {
pods = new DiasporaPodList();
}
Intent broadcastIntent = new Intent(MESSAGE_PODS_RECEIVED);
broadcastIntent.putExtra(EXTRA_PODLIST, pods);
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(broadcastIntent);
stopSelf();
}
};
getPodsAsync.execute();
}
@Override @Override
public IBinder onBind(Intent intent) { public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service. // TODO: Return the communication channel to the service.
throw new UnsupportedOperationException("Not yet implemented"); throw new UnsupportedOperationException("Not yet implemented");
} }
} }
class GetPodsTask extends AsyncTask<Void, Void, DiasporaPodList> {
private static final String PODDY_PODLIST_URL = "https://raw.githubusercontent.com/gsantner/dandelion/master/app/src/main/res/raw/podlist.json";
private final Service service;
GetPodsTask(Service service) {
this.service = service;
}
@Override
protected DiasporaPodList doInBackground(Void... params) {
StringBuilder sb = new StringBuilder();
BufferedReader br = null;
try {
HttpsURLConnection con = NetCipher.getHttpsURLConnection(PODDY_PODLIST_URL);
if (con.getResponseCode() == HttpsURLConnection.HTTP_OK) {
br = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
}
// Parse JSON & return pod list
JSONObject json = new JSONObject(sb.toString());
return new DiasporaPodList().fromJson(json);
} else {
AppLog.e(this, "Failed to download list of pods");
}
} catch (IOException | JSONException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ignored) {
}
}
}
// Could not fetch list of pods :(
return new DiasporaPodList();
}
@Override
protected void onPostExecute(DiasporaPodList pods) {
if (pods == null) {
pods = new DiasporaPodList();
}
Intent broadcastIntent = new Intent(FetchPodsService.MESSAGE_PODS_RECEIVED);
broadcastIntent.putExtra(FetchPodsService.EXTRA_PODLIST, pods);
LocalBroadcastManager.getInstance(service.getApplicationContext()).sendBroadcast(broadcastIntent);
service.stopSelf();
}
}

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.

View file

@ -1,98 +0,0 @@
/*
This file is part of the Diaspora for Android.
Diaspora for Android 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.
Diaspora for Android 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 the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.dfa.diaspora_android.service;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import com.github.dfa.diaspora_android.util.AppLog;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.net.ssl.HttpsURLConnection;
import info.guardianproject.netcipher.NetCipher;
/**
* Task that can be used to download images from URLs and store them in storage
* Created by gsantner (https://gsantner.github.io/) on 24.03.16.
*/
public class ImageDownloadTask extends AsyncTask<String, Void, Bitmap> {
private final ImageView imageView;
private String savePath;
/**
* Download image from URL
*
* @param imageView ImageView to set image to (null = don't set)
* @param savePath Save image to file (null = don't save)
*/
public ImageDownloadTask(@Nullable ImageView imageView, @Nullable String savePath) {
this.imageView = imageView;
this.savePath = savePath;
}
protected Bitmap doInBackground(String... urls) {
String url = urls[0];
Bitmap bitmap = null;
FileOutputStream out = null;
InputStream inStream;
HttpsURLConnection connection;
try {
connection = NetCipher.getHttpsURLConnection(url);
inStream = connection.getInputStream();
bitmap = BitmapFactory.decodeStream(inStream);
// Save to file if not null
if (savePath != null) {
out = new FileOutputStream(savePath);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
}
try {
inStream.close();
} catch (IOException e) {/*Nothing*/}
connection.disconnect();
} catch (Exception e) {
AppLog.e(this, e.getMessage());
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ignored) {
}
}
return bitmap;
}
protected void onPostExecute(Bitmap result) {
// Display on imageview if not null
if (imageView != null) {
imageView.setImageBitmap(result);
}
}
}

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */

View file

@ -1,95 +0,0 @@
/*
This file is part of the Diaspora for Android.
Diaspora for Android 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.
Diaspora for Android 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 the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.dfa.diaspora_android.service;
import android.content.Context;
import android.os.AsyncTask;
import android.webkit.CookieManager;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import info.guardianproject.netcipher.NetCipher;
/**
* AsyncTask to fetch a users profile
*/
public class StatisticsFetchTask extends AsyncTask<Void, Void, Void> {
// Code for getting the profile async without any UI/WebView
// TODO: This is an early version,needs to be converted to Service
private final App app;
private final Context context;
private final DiasporaUrlHelper urls;
public StatisticsFetchTask(final App app) {
this.context = app.getApplicationContext();
this.app = app;
this.urls = new DiasporaUrlHelper(app.getSettings());
}
@Override
protected Void doInBackground(Void... params) {
String extractedProfileData = null;
final CookieManager cookieManager = app.getCookieManager();
String cookies = cookieManager.getCookie(urls.getPodUrl());
HttpsURLConnection connection;
InputStream inStream;
try {
URL url = new URL(urls.getStatisticsUrl());
connection = NetCipher.getHttpsURLConnection(url);
connection.setReadTimeout(10000);
connection.setConnectTimeout(15000);
connection.setRequestMethod("GET");
if (cookies != null) {
connection.setRequestProperty("Cookie", cookies);
}
connection.connect();
inStream = connection.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(inStream));
String line;
while ((line = br.readLine()) != null) {
AppLog.d(this, "STATS: " + line);
}
try {
br.close();
inStream.close();
} catch (IOException e) {/*Nothing*/}
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -28,95 +28,80 @@ import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.LayerDrawable;
import android.support.v4.content.ContextCompat; import android.support.annotation.NonNull;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.ContextUtils;
@SuppressWarnings("WeakerAccess")
public class BadgeDrawable extends Drawable { public class BadgeDrawable extends Drawable {
// Source: http://mobikul.com/adding-badge-count-on-menu-items-like-cart-notification-etc/ // Source: http://mobikul.com/adding-badge-count-on-menu-items-like-cart-notification-etc/
private static final String BADGE_VALUE_OVERFLOW = "*"; private static final String BADGE_VALUE_OVERFLOW = "*";
private Paint badgeBackground; private Paint _badgeBackground;
private Paint badgeStroke; private Paint _badgeText;
private Paint badgeText; private Rect _textRect = new Rect();
private Rect textRect = new Rect();
private String badgeValue = ""; private String _badgeValue = "";
private boolean shouldDraw; private boolean _shouldDraw;
public BadgeDrawable(Context context) { public BadgeDrawable(Context context) {
float textSize = context.getResources().getDimension(R.dimen.textsize_badge_count); float textSize = context.getResources().getDimension(R.dimen.textsize_badge_count);
AppSettings settings = new AppSettings(context); AppSettings settings = AppSettings.get();
badgeBackground = new Paint(); _badgeBackground = new Paint();
badgeBackground.setColor(settings.getAccentColor()); _badgeBackground.setColor(settings.getAccentColor());
badgeBackground.setAntiAlias(true); _badgeBackground.setAntiAlias(true);
badgeBackground.setStyle(Paint.Style.FILL); _badgeBackground.setStyle(Paint.Style.FILL);
badgeStroke = new Paint();
badgeStroke.setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.colorPrimaryDark));
badgeStroke.setAntiAlias(true);
badgeStroke.setStyle(Paint.Style.FILL);
badgeText = new Paint(); _badgeText = new Paint();
badgeText.setColor(Color.WHITE); _badgeText.setColor(ContextUtils.get().shouldColorOnTopBeLight(settings.getAccentColor()) ? Color.WHITE : Color.BLACK);
badgeText.setTypeface(Typeface.DEFAULT); _badgeText.setTypeface(Typeface.DEFAULT);
badgeText.setTextSize(textSize); _badgeText.setTextSize(textSize);
badgeText.setAntiAlias(true); _badgeText.setAntiAlias(true);
badgeText.setTextAlign(Paint.Align.CENTER); _badgeText.setTextAlign(Paint.Align.CENTER);
} }
@Override @Override
public void draw(Canvas canvas) { public void draw(@NonNull Canvas canvas) {
if (!shouldDraw) { if (!_shouldDraw) {
return; return;
} }
Rect bounds = getBounds(); Rect bounds = getBounds();
float width = bounds.right - bounds.left; float width = bounds.right - bounds.left;
float height = bounds.bottom - bounds.top; float height = bounds.bottom - bounds.top;
float oneDp = ContextUtils.get().convertDpToPx(1);
// Position the badge in the top-right quadrant of the icon. // Position the badge in the top-right quadrant of the icon.
float radius = ((Math.max(width, height) / 2)) / 2; float radius = ((Math.max(width, height) / 2)) / 2;
float centerX = (width - radius - 1) + 5; float centerX = (width - radius - 1) + oneDp * 2;
float centerY = radius - 5; float centerY = radius - 2 * oneDp;
if (badgeValue.length() <= 2) { canvas.drawCircle(centerX, centerY, (int) (radius + oneDp * 5), _badgeBackground);
// Draw badge circle.
canvas.drawCircle(centerX, centerY, (int) (radius + 7.5), badgeStroke); // Draw badge count message inside the circle.
canvas.drawCircle(centerX, centerY, (int) (radius + 5.5), badgeBackground); _badgeText.getTextBounds(_badgeValue, 0, _badgeValue.length(), _textRect);
} else { float textHeight = _textRect.bottom - _textRect.top;
canvas.drawCircle(centerX, centerY, (int) (radius + 8.5), badgeStroke);
canvas.drawCircle(centerX, centerY, (int) (radius + 6.5), badgeBackground);
//canvas.drawRoundRect(radius, radius, radius, radius, 10, 10, badgeBackground);
}
// Draw badge count text inside the circle.
badgeText.getTextBounds(badgeValue, 0, badgeValue.length(), textRect);
float textHeight = textRect.bottom - textRect.top;
float textY = centerY + (textHeight / 2f); float textY = centerY + (textHeight / 2f);
if (badgeValue.length() > 2) canvas.drawText(_badgeValue.length() > 2 ? BADGE_VALUE_OVERFLOW : _badgeValue,
canvas.drawText(BADGE_VALUE_OVERFLOW, centerX, textY, badgeText); centerX, textY, _badgeText);
else
canvas.drawText(badgeValue, centerX, textY, badgeText);
} }
/* // Sets the text to display. Badge displays a '*' if more than 2 characters
Sets the count (i.e notifications) to display. private void setBadgeText(String text) {
*/ _badgeValue = text;
public void setCount(String count) {
badgeValue = count;
// Only draw a badge if there are notifications. // Only draw a badge if the value isn't a zero
shouldDraw = !count.equalsIgnoreCase("0"); _shouldDraw = !text.equalsIgnoreCase("0");
invalidateSelf(); invalidateSelf();
} }
@Override @Override
public void setAlpha(int alpha) { public void setAlpha(int alpha) {
// do nothing
} }
@Override @Override
public void setColorFilter(ColorFilter cf) { public void setColorFilter(ColorFilter cf) {
// do nothing
} }
@Override @Override
@ -125,11 +110,11 @@ public class BadgeDrawable extends Drawable {
} }
public static void setBadgeCount(Context context, LayerDrawable icon, Integer count) { public static void setBadgeCount(Context context, LayerDrawable icon, Integer count) {
setBadgeCount(context, icon, count.toString()); setBadgeText(context, icon, count.toString());
} }
public static void setBadgeCount(Context context, LayerDrawable icon, String count) { // Max of 2 characters
public static void setBadgeText(Context context, LayerDrawable icon, String text) {
BadgeDrawable badge; BadgeDrawable badge;
// Reuse drawable if possible // Reuse drawable if possible
@ -140,7 +125,7 @@ public class BadgeDrawable extends Drawable {
badge = new BadgeDrawable(context); badge = new BadgeDrawable(context);
} }
badge.setCount(count); badge.setBadgeText(text);
icon.mutate(); icon.mutate();
icon.setDrawableByLayerId(R.id.ic_badge, badge); icon.setDrawableByLayerId(R.id.ic_badge, badge);
} }

View file

@ -1,31 +1,30 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.ui; package com.github.dfa.diaspora_android.ui;
import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.text.Html; import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.util.Linkify; import android.text.util.Linkify;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Patterns; import android.util.Patterns;
import android.widget.TextView;
import com.github.dfa.diaspora_android.activity.MainActivity; import com.github.dfa.diaspora_android.activity.MainActivity;
@ -38,7 +37,7 @@ import java.util.regex.Pattern;
* Hashtags open the MainActivity, load the new-post site of the selected pod and insert the * Hashtags open the MainActivity, load the new-post site of the selected pod and insert the
* hashtag into the post editor. See data/HashtagContentProvider. * hashtag into the post editor. See data/HashtagContentProvider.
*/ */
public class HtmlTextView extends TextView { public class HtmlTextView extends AppCompatTextView {
public HtmlTextView(Context context) { public HtmlTextView(Context context) {
super(context); super(context);
@ -55,14 +54,8 @@ public class HtmlTextView extends TextView {
init(); init();
} }
@TargetApi(21)
public HtmlTextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
/** /**
* Linkify, format markdown and escape the displayed text. * Linkify, format markdown and escape the displayed message.
*/ */
private void init() { private void init() {
formatHtmlAndCustomTags(); formatHtmlAndCustomTags();

View file

@ -36,12 +36,13 @@ import butterknife.OnClick;
import butterknife.OnItemSelected; import butterknife.OnItemSelected;
/** /**
* Created by gsantner (https://gsantner.github.io) on 06.10.16. * Dialog that helps the user configure a pod
* Created by gsantner on 06.10.16.
*/ */
public class PodSelectionDialog extends ThemedAppCompatDialogFragment { public class PodSelectionDialog extends ThemedAppCompatDialogFragment {
public static final String TAG = "com.github.dfa.diaspora_android.ui.PodSelectionDialog"; public static final String TAG = "com.github.dfa.diaspora_android.ui.PodSelectionDialog";
public static interface PodSelectionDialogResultListener { public interface PodSelectionDialogResultListener {
void onPodSelectionDialogResult(DiasporaPod pod, boolean accepted); void onPodSelectionDialogResult(DiasporaPod pod, boolean accepted);
} }
@ -127,7 +128,7 @@ public class PodSelectionDialog extends ThemedAppCompatDialogFragment {
spinnerProfile.setVisibility(View.VISIBLE); spinnerProfile.setVisibility(View.VISIBLE);
String[] podUrlss = new String[podUrls.size()]; String[] podUrlss = new String[podUrls.size()];
for (int i = 0; i < podUrls.size(); podUrlss[i] = podUrls.get(i++).getBaseUrl()) ; for (int i = 0; i < podUrls.size(); podUrlss[i] = podUrls.get(i++).getBaseUrl()) ;
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, podUrlss); ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, podUrlss);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerProfile.setAdapter(spinnerAdapter); spinnerProfile.setAdapter(spinnerAdapter);
} }
@ -158,7 +159,7 @@ public class PodSelectionDialog extends ThemedAppCompatDialogFragment {
if (isAdded()) { if (isAdded()) {
return ((App) getActivity().getApplication()).getSettings(); return ((App) getActivity().getApplication()).getSettings();
} else { } else {
return new AppSettings(getContext().getApplicationContext()); return AppSettings.get();
} }
} }

View file

@ -0,0 +1,85 @@
package com.github.dfa.diaspora_android.ui;
import android.app.Activity;
import android.support.v4.content.ContextCompat;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.DiasporaAspect;
import com.github.dfa.diaspora_android.util.AppSettings;
import net.gsantner.opoc.ui.SearchOrCustomTextDialog;
import net.gsantner.opoc.util.Callback;
import java.util.ArrayList;
import java.util.Arrays;
public class SearchOrCustomTextDialogCreator {
public static final String SPECIAL_PREFIX = "\uD83D\uDCA0";
public static void showDiasporaTagsDialog(final Activity activity, final Callback.a1<String> callback) {
SearchOrCustomTextDialog.DialogOptions dopt = new SearchOrCustomTextDialog.DialogOptions();
baseConf(activity, dopt);
dopt.callback = callback;
dopt.isSearchEnabled = true;
dopt.searchHintText = R.string.search;
dopt.titleText = R.string.tags;
new Thread(() -> {
AppSettings appSettings = AppSettings.get();
ArrayList<String> hl = new ArrayList<>();
ArrayList<String> data = new ArrayList<>(Arrays.asList(appSettings.getFollowedTags()));
if (data.size() > 0) {
String highlighted = surroundString(data.remove(0));
data.add(0, highlighted);
hl.add(highlighted);
}
for (int strid : new int[]{R.string.manage_hashtags}) {
String special = surroundString(appSettings.rstr(strid));
data.add(0, special);
hl.add(special);
}
dopt.data = data;
dopt.highlightData = hl;
activity.runOnUiThread(() -> SearchOrCustomTextDialog.showMultiChoiceDialogWithSearchFilterUI(activity, dopt));
}).start();
}
private static String surroundString(String text) {
return SPECIAL_PREFIX + " " + text + " ";
}
public static void showDiasporaAspectsDialog(final Activity activity, final Callback.a1<String> callback) {
SearchOrCustomTextDialog.DialogOptions dopt = new SearchOrCustomTextDialog.DialogOptions();
baseConf(activity, dopt);
dopt.callback = callback;
dopt.isSearchEnabled = false;
dopt.titleText = R.string.contacts;
new Thread(() -> {
AppSettings appSettings = AppSettings.get();
ArrayList<String> hl = new ArrayList<>();
ArrayList<String> data = new ArrayList<>();
for (DiasporaAspect aspect : AppSettings.get().getAspects()) {
data.add(aspect.name);
}
for (int strid : new int[]{R.string.nav_profile, R.string.manage_your_contact_list}) {
String special = surroundString(appSettings.rstr(strid));
data.add(0, special);
hl.add(special);
}
dopt.data = data;
dopt.highlightData = hl;
activity.runOnUiThread(() -> SearchOrCustomTextDialog.showMultiChoiceDialogWithSearchFilterUI(activity, dopt));
}).start();
}
private static void baseConf(Activity activity, SearchOrCustomTextDialog.DialogOptions dopt) {
AppSettings as = new AppSettings(activity);
dopt.isDarkDialog = as.isAmoledColorMode();
dopt.textColor = ContextCompat.getColor(activity, dopt.isDarkDialog ? R.color.white : R.color.primary_text);
dopt.highlightColor = as.getAccentColor();
}
}

View file

@ -8,6 +8,7 @@ import android.support.v4.graphics.ColorUtils;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
/** /**
* Class that handles Colors
* Created by dnld on 24/02/16. * Created by dnld on 24/02/16.
*/ */
public class ColorPalette { public class ColorPalette {

View file

@ -1,73 +0,0 @@
/*
This file is part of the Diaspora for Android.
Diaspora for Android 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.
Diaspora for Android 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 the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.dfa.diaspora_android.ui.theme;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.Menu;
import android.view.MenuInflater;
/**
* Customized abstract Fragment class with some useful methods
* Created by vanitas on 21.09.16.
*/
public abstract class CustomFragment extends Fragment {
public static final String TAG = "com.github.dfa.diaspora_android.ui.theme.CustomFragment";
/**
* We have an optionsMenu
*
* @param savedInstanceState state
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
/**
* Return the tag used to identify the Fragment.
*
* @return tag
*/
public abstract String getFragmentTag();
/**
* Add fragment-dependent options to the bottom options toolbar
*
* @param menu bottom menu
* @param inflater inflater
*/
public abstract void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater);
/**
* Return true if the fragment reacted to a back button press, false else.
* In case the fragment returned false, the parent activity should handle the backPress.
*
* @return did we react to the back press?
*/
public abstract boolean onBackPressed();
public boolean isAllowedIntellihide() {
return true;
}
}

View file

@ -1,24 +1,25 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
This class is inspired by org.horasapps.LeafPic This class is inspired by org.horasapps.LeafPic
*/ */
package com.github.dfa.diaspora_android.ui.theme; package com.github.dfa.diaspora_android.ui.theme;
import android.content.DialogInterface;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
@ -26,9 +27,11 @@ import android.os.Build;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.widget.CompoundButtonCompat; import android.support.v4.widget.CompoundButtonCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.ActionMenuView; import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -61,7 +64,7 @@ public class ThemeHelper {
public static ThemeHelper getInstance() { public static ThemeHelper getInstance() {
if (instance == null) if (instance == null)
throw new IllegalStateException("ThemeHelper must be initialized using getInstance(AppSettings) before it can be used!"); throw new IllegalStateException("ThemeHelper must be initialized using getInstance(AppSettingsBase) before it can be used!");
return instance; return instance;
} }
@ -151,6 +154,26 @@ public class ThemeHelper {
} }
public static int getNeutralGreyColor() { public static int getNeutralGreyColor() {
return ContextCompat.getColor(getInstance().appSettings.getApplicationContext(), R.color.md_grey_800); return ContextCompat.getColor(getInstance().appSettings.getContext(), R.color.md_grey_800);
}
public static void updateAlertDialogColor(AlertDialog alertDialog) {
if (alertDialog != null) {
for (int i : new int[]{
DialogInterface.BUTTON_POSITIVE,
DialogInterface.BUTTON_NEUTRAL,
DialogInterface.BUTTON_NEGATIVE}) {
Button b = alertDialog.getButton(i);
if (b != null) {
b.setTextColor(getAccentColor());
}
}
}
}
public static void updateButtonTextColor(Button button) {
if (button != null) {
button.setTextColor(getAccentColor());
}
} }
} }

View file

@ -1,32 +1,32 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.ui.theme; package com.github.dfa.diaspora_android.ui.theme;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.ActivityManager; import android.content.pm.ActivityInfo;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build; import android.os.Build;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.ContextUtils;
/** /**
* Activity that supports color schemes * Activity that supports color schemes
@ -43,9 +43,11 @@ public abstract class ThemedActivity extends AppCompatActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
ThemeHelper.getInstance(getAppSettings()); ThemeHelper.getInstance(getAppSettings());
updateLanguage();
updateStatusBarColor(); updateStatusBarColor();
updateRecentAppColor(); updateRecentAppColor();
applyColorToViews(); applyColorToViews();
updateScreenRotation();
} }
protected abstract void applyColorToViews(); protected abstract void applyColorToViews();
@ -65,14 +67,25 @@ public abstract class ThemedActivity extends AppCompatActivity {
*/ */
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void updateRecentAppColor() { private void updateRecentAppColor() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
BitmapDrawable drawable = ((BitmapDrawable) getDrawable(R.drawable.ic_launcher)); }
if (drawable != null) {
setTaskDescription(new ActivityManager.TaskDescription( protected void updateScreenRotation() {
getResources().getString(R.string.app_name), String setting = getAppSettings().getScreenRotation();
drawable.getBitmap(), int rotation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; // Default (system settings)
getAppSettings().getPrimaryColor()));
} if (setting.equals(getString(R.string.rotation_val_sensor))) {
rotation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
} else if (setting.equals(getString(R.string.rotation_val_portrait))) {
rotation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
} else if (setting.equals(getString(R.string.rotation_val_landscape))) {
rotation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} }
setRequestedOrientation(rotation);
}
public void updateLanguage() {
AppSettings appSettings = getAppSettings();
ContextUtils.get().setAppLanguage(appSettings.getLanguage());
} }
} }

View file

@ -0,0 +1,45 @@
package com.github.dfa.diaspora_android.ui.theme;
import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v7.app.AlertDialog;
import com.github.dfa.diaspora_android.util.AppSettings;
/**
* AlertDialog Builder that colors its buttons
* Created by vanitas on 06.11.16.
*/
public class ThemedAlertDialogBuilder extends AlertDialog.Builder {
protected AppSettings appSettings;
public ThemedAlertDialogBuilder(@NonNull Context context, AppSettings appSettings) {
super(context);
this.appSettings = appSettings;
}
public ThemedAlertDialogBuilder(@NonNull Context context, @StyleRes int themeResId, AppSettings appSettings) {
super(context, themeResId);
this.appSettings = appSettings;
}
@Override
public AlertDialog create() {
final AlertDialog dialog = super.create();
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
applyColors(dialog);
}
});
return dialog;
}
private void applyColors(AlertDialog alertDialog) {
ThemeHelper.getInstance(appSettings);
ThemeHelper.updateAlertDialogColor(alertDialog);
}
}

View file

@ -2,6 +2,7 @@ package com.github.dfa.diaspora_android.ui.theme;
import android.app.Dialog; import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatDialogFragment; import android.support.v7.app.AppCompatDialogFragment;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
@ -13,6 +14,7 @@ import com.github.dfa.diaspora_android.util.AppSettings;
public abstract class ThemedAppCompatDialogFragment extends AppCompatDialogFragment { public abstract class ThemedAppCompatDialogFragment extends AppCompatDialogFragment {
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState); Dialog dialog = super.onCreateDialog(savedInstanceState);

View file

@ -10,6 +10,7 @@ import android.widget.CheckBox;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
/** /**
* CheckboxPreference that colors its checkbox with accent color
* Created by vanitas on 24.10.16. * Created by vanitas on 24.10.16.
*/ */
@ -40,8 +41,8 @@ public class ThemedCheckBoxPreference extends CheckBoxPreference implements Them
@Override @Override
public void setColors() { public void setColors() {
CheckBox checkBox = (CheckBox) rootLayout.findViewById(android.R.id.checkbox); CheckBox checkBox = rootLayout.findViewById(android.R.id.checkbox);
ThemeHelper.getInstance(new AppSettings(getContext())); ThemeHelper.getInstance(AppSettings.get());
ThemeHelper.updateCheckBoxColor(checkBox); ThemeHelper.updateCheckBoxColor(checkBox);
} }
} }

View file

@ -10,7 +10,7 @@ import android.widget.ImageView;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.Helpers; import com.github.dfa.diaspora_android.util.ContextUtils;
/** /**
* Preference that shows selected Color in a circle * Preference that shows selected Color in a circle
@ -38,7 +38,7 @@ public class ThemedColorPickerPreference extends Preference implements Themeable
@Override @Override
protected void onBindView(View view) { protected void onBindView(View view) {
super.onBindView(view); super.onBindView(view);
colorPreview = (ImageView) view.findViewById(android.R.id.icon); colorPreview = view.findViewById(android.R.id.icon);
setColors(); setColors();
} }
@ -47,16 +47,16 @@ public class ThemedColorPickerPreference extends Preference implements Themeable
Drawable circle; Drawable circle;
if (colorPreview != null && (circle = colorPreview.getDrawable()) != null) { if (colorPreview != null && (circle = colorPreview.getDrawable()) != null) {
Context c = getContext(); Context c = getContext();
AppSettings appSettings = new AppSettings(getContext()); AppSettings appSettings = AppSettings.get();
String key = getKey(); String key = getKey();
int color = Helpers.getColorFromRessource(c, R.color.primary); int color = ContextUtils.get().rcolor(R.color.primary);
if ((appSettings.isKeyEqual(key, R.string.pref_key__primary_color_shade))) { if ((appSettings.isKeyEqual(key, R.string.pref_key__primary_color_shade))) {
color = appSettings.getPrimaryColor(); color = appSettings.getPrimaryColor();
} else if ((appSettings.isKeyEqual(key, R.string.pref_key__accent_color_shade))) { } else if ((appSettings.isKeyEqual(key, R.string.pref_key__accent_color_shade))) {
color = appSettings.getAccentColor(); color = appSettings.getAccentColor();
} else { } else {
color = appSettings.getColor(getSharedPreferences(), key, color); color = appSettings.getColor(key, color, getSharedPreferences());
} }
circle.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); circle.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
} }

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -21,12 +21,14 @@ package com.github.dfa.diaspora_android.ui.theme;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import net.gsantner.opoc.activity.GsFragmentBase;
/** /**
* Fragment that supports color schemes * Fragment that supports color schemes
* Created by vanitas on 06.10.16. * Created by vanitas on 06.10.16.
*/ */
public abstract class ThemedFragment extends CustomFragment { public abstract class ThemedFragment extends GsFragmentBase {
protected AppSettings getAppSettings() { protected AppSettings getAppSettings() {
return ((App) getActivity().getApplication()).getSettings(); return ((App) getActivity().getApplication()).getSettings();
} }
@ -39,4 +41,9 @@ public abstract class ThemedFragment extends CustomFragment {
ThemeHelper.getInstance(getAppSettings()); ThemeHelper.getInstance(getAppSettings());
applyColorToViews(); applyColorToViews();
} }
public boolean isAllowedIntellihide() {
return true;
}
} }

View file

@ -36,7 +36,7 @@ public class ThemedPreferenceCategory extends PreferenceCategory implements Them
@Override @Override
protected View onCreateView(ViewGroup parent) { protected View onCreateView(ViewGroup parent) {
View rootLayout = super.onCreateView(parent); View rootLayout = super.onCreateView(parent);
this.titleTextView = (TextView) rootLayout.findViewById(android.R.id.title); this.titleTextView = rootLayout.findViewById(android.R.id.title);
setColors(); setColors();
return rootLayout; return rootLayout;
} }
@ -44,7 +44,7 @@ public class ThemedPreferenceCategory extends PreferenceCategory implements Them
@Override @Override
public void setColors() { public void setColors() {
if (titleTextView != null) { if (titleTextView != null) {
ThemeHelper.getInstance(new AppSettings(getContext())); ThemeHelper.getInstance(AppSettings.get());
ThemeHelper.updateTextViewTextColor(titleTextView); ThemeHelper.updateTextViewTextColor(titleTextView);
} }
} }

View file

@ -10,6 +10,7 @@ import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
/** /**
* PreferenceFragment with a colored status bar
* Created by vanitas on 24.10.16. * Created by vanitas on 24.10.16.
*/ */

View file

@ -27,9 +27,9 @@ public class ThemedVisibilityPreference extends ThemedCheckBoxPreference {
@Override @Override
public void setColors() { public void setColors() {
CheckBox checkBox = (CheckBox) rootLayout.findViewById(android.R.id.checkbox); CheckBox checkBox = rootLayout.findViewById(android.R.id.checkbox);
checkBox.setButtonDrawable(R.drawable.ic_visibility_selector); checkBox.setButtonDrawable(R.drawable.ic_visibility_selector);
ThemeHelper.getInstance(new AppSettings(getContext())); ThemeHelper.getInstance(AppSettings.get());
ThemeHelper.updateCheckBoxColor(checkBox); ThemeHelper.updateCheckBoxColor(checkBox);
} }
} }

View file

@ -0,0 +1,86 @@
package com.github.dfa.diaspora_android.util;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.content.FileProvider;
import android.view.View;
import com.github.dfa.diaspora_android.BuildConfig;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.web.WebHelper;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"})
public class ActivityUtils extends net.gsantner.opoc.util.ActivityUtils {
public ActivityUtils(Activity activity) {
super(activity);
}
public static ActivityUtils get(Activity activity) {
return new ActivityUtils(activity);
}
public File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("dd-MM-yy_HH-mm", Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
AppLog.d(ActivityUtils.class, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
return new File(
imageFileName + /* prefix */
".jpg", /* suffix */
storageDir.getAbsolutePath() /* directory */
);
}
/**
* Show Information if user is offline, returns true if is not connected to internet
*
* @param anchor A view anchor
*/
public boolean showInfoIfUserNotConnectedToInternet(View anchor) {
boolean isOnline = WebHelper.isOnline(_context);
if (!isOnline) {
showSnackBar(R.string.sorry_need_to_be_connected_to_internet, true);
}
return !isOnline;
}
public void logBundle(Bundle savedInstanceState, String k) {
if (savedInstanceState != null) {
for (String key : savedInstanceState.keySet()) {
AppLog.d("Bundle", key + " is a key in the bundle " + k);
Object bun = savedInstanceState.get(key);
if (bun != null) {
if (bun instanceof Bundle) {
logBundle((Bundle) bun, k + "." + key);
} else if (bun instanceof byte[]) {
AppLog.d("Bundle", "Key: " + k + "." + key + ": " + Arrays.toString((byte[]) bun));
} else {
AppLog.d("Bundle", "Key: " + k + "." + key + ": " + bun.toString());
}
}
}
}
}
/**
* This method creates file sharing uri by using FileProvider
*
* @return
*/
public static Uri getFileSharingUri(Context context, File file) {
return FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID, file);
}
}

View file

@ -0,0 +1,58 @@
package com.github.dfa.diaspora_android.util;
import android.app.Activity;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
// From https://stackoverflow.com/a/19494006
public class AndroidBug5497Workaround {
// For more information, see https://code.google.com/p/android/issues/detail?id=5497
// To use this class, simply invoke assistActivity() on an Activity that already has its content view set.
public static void assistActivity(Activity activity) {
new AndroidBug5497Workaround(activity);
}
private View mChildOfContent;
private int usableHeightPrevious;
private FrameLayout.LayoutParams frameLayoutParams;
private AndroidBug5497Workaround(Activity activity) {
FrameLayout content = activity.findViewById(android.R.id.content);
mChildOfContent = content.getChildAt(0);
mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
possiblyResizeChildOfContent();
}
});
frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();
}
private void possiblyResizeChildOfContent() {
int usableHeightNow = computeUsableHeight();
if (usableHeightNow != usableHeightPrevious) {
int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
if (heightDifference > (usableHeightSansKeyboard / 4)) {
// keyboard probably just became visible
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
} else {
// keyboard probably just became hidden
frameLayoutParams.height = usableHeightSansKeyboard;
}
mChildOfContent.requestLayout();
usableHeightPrevious = usableHeightNow;
}
}
private int computeUsableHeight() {
Rect r = new Rect();
mChildOfContent.getWindowVisibleDisplayFrame(r);
return (r.bottom - r.top);
}
}

View file

@ -1,23 +1,24 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.util; package com.github.dfa.diaspora_android.util;
import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -25,6 +26,7 @@ import java.util.Observable;
import java.util.Observer; import java.util.Observer;
/** /**
* Class that logs debug messages to Androids Log and to additional targets (like textviews)
* Created by gregor on 18.09.16. * Created by gregor on 18.09.16.
*/ */
public class AppLog { public class AppLog {
@ -59,37 +61,61 @@ public class AppLog {
*/ */
public static void v(Object source, String _text) { public static void v(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
Log.v(getLogPrefix(source), _text); if (source != null) {
Log.v(getLogPrefix(source), _text);
} else {
Log.v("null", _text);
}
} }
} }
public static void i(Object source, String _text) { public static void i(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
Log.i(getLogPrefix(source), _text); if (source != null) {
Log.i(getLogPrefix(source), _text);
} else {
Log.i("null", _text);
}
} }
} }
public static void d(Object source, String _text) { public static void d(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
Log.d(getLogPrefix(source), _text); if (source != null) {
Log.d(getLogPrefix(source), _text);
} else {
Log.d("null", _text);
}
} }
} }
public static void e(Object source, String _text) { public static void e(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
Log.e(getLogPrefix(source), _text); if (source != null) {
Log.e(getLogPrefix(source), _text);
} else {
Log.e("null", _text);
}
} }
} }
public static void w(Object source, String _text) { public static void w(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
Log.w(getLogPrefix(source), _text); if (source != null) {
Log.w(getLogPrefix(source), _text);
} else {
Log.w("null", _text);
}
} }
} }
public static void spam(Object source, String _text) { public static void spam(Object source, String _text) {
if (isLoggingEnabled() && isLoggingSpamEnabled()) { if (isLoggingEnabled() && isLoggingSpamEnabled()) {
Log.v(getLogPrefix(source), _text); if (source != null) {
Log.v(getLogPrefix(source), _text);
} else {
Log.v("null", _text);
}
} }
} }
@ -103,9 +129,9 @@ public class AppLog {
public static Log instance; public static Log instance;
private AppSettings appSettings; private AppSettings appSettings;
private SimpleDateFormat dateFormat; private final DateFormat dateFormat;
private ArrayList<String> logBuffer; private final ArrayList<String> logBuffer;
private ArrayList<Observer> observers; private final ArrayList<Observer> observers;
private Log() { private Log() {
this(null); this(null);
@ -118,7 +144,8 @@ public class AppLog {
} else { } else {
logBuffer = new ArrayList<>(); logBuffer = new ArrayList<>();
} }
dateFormat = new SimpleDateFormat("HH:mm:ss"); SimpleDateFormat.getTimeInstance();
dateFormat = SimpleDateFormat.getDateInstance();
observers = new ArrayList<>(); observers = new ArrayList<>();
} }

View file

@ -1,15 +1,15 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.util; package com.github.dfa.diaspora_android.util;
@ -17,117 +17,81 @@ package com.github.dfa.diaspora_android.util;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Environment;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.BuildConfig;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.DiasporaAspect; import com.github.dfa.diaspora_android.data.DiasporaAspect;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod; import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod.DiasporaPodUrl;
import com.github.dfa.diaspora_android.web.ProxyHandler; import com.github.dfa.diaspora_android.web.ProxyHandler;
import net.gsantner.opoc.preference.SharedPreferencesPropertyBackend;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.File;
import java.util.List; import java.util.List;
/** /**
* Settings * Settings
* Created by gsantner (https://gsantner.github.io/) on 20.03.16. Part of Diaspora for Android. * Created by gsantner (gsantner AT mailbox DOT org) on 20.03.16. Part of dandelion*.
*/ */
public class AppSettings { @SuppressWarnings("ConstantConditions")
private final SharedPreferences prefApp; public class AppSettings extends SharedPreferencesPropertyBackend {
private final SharedPreferences prefPod; private final SharedPreferences _prefPod;
private final Context context;
private DiasporaPod currentPod0Cached; private DiasporaPod currentPod0Cached;
public static AppSettings get() {
return new AppSettings(App.get());
}
public AppSettings(Context context) { public AppSettings(Context context) {
this.context = context.getApplicationContext(); super(context);
prefApp = this.context.getSharedPreferences("app", Context.MODE_PRIVATE); _prefPod = _context.getSharedPreferences("pod0", Context.MODE_PRIVATE);
prefPod = this.context.getSharedPreferences("pod0", Context.MODE_PRIVATE);
} }
public Context getApplicationContext() { /**
return context; * Clear all settings in _prefPod (Settings related to the configured pod)
* This uses commit instead of apply, since
* SettingsActivity.SettingsFragmentDebugging.showWipeSettingsDialog()
* kills the app after the calling this, so we have to block until we are finished.
*/
@SuppressLint("CommitPrefEdits")
public void resetPodSettings() {
super.resetSettings(_prefPod);
} }
public void clearPodSettings() { /**
prefPod.edit().clear().apply(); * Clear all settings in _prefApp (related to the App itself)
* This uses commit instead of apply, since
* SettingsActivity.SettingsFragmentDebugging.showWipeSettingsDialog()
* kills the app after the calling this, so we have to block until we are finished.
*/
@SuppressLint("CommitPrefEdits")
public void resetAppSettings() {
super.resetSettings(_prefApp);
} }
public void clearAppSettings() { //#################################
prefApp.edit().clear().apply(); //## Getter & Setter for settings
} //#################################
public String getKey(int stringKeyRessourceId) {
return context.getString(stringKeyRessourceId);
}
public boolean isKeyEqual(String key, int stringKeyRessourceId) {
return key.equals(getKey(stringKeyRessourceId));
}
private void setString(SharedPreferences pref, int keyRessourceId, String value) {
pref.edit().putString(context.getString(keyRessourceId), value).apply();
}
private void setInt(SharedPreferences pref, int keyRessourceId, int value) {
pref.edit().putInt(context.getString(keyRessourceId), value).apply();
}
private void setBool(SharedPreferences pref, int keyRessourceId, boolean value) {
pref.edit().putBoolean(context.getString(keyRessourceId), value).apply();
}
private void setStringArray(SharedPreferences pref, int keyRessourceId, Object[] values) {
StringBuilder sb = new StringBuilder();
for (Object value : values) {
sb.append("%%%");
sb.append(value.toString());
}
setString(pref, keyRessourceId, sb.toString().replaceFirst("%%%", ""));
}
private String[] getStringArray(SharedPreferences pref, int keyRessourceId) {
String value = pref.getString(context.getString(keyRessourceId), "%%%");
if (value.equals("%%%")) {
return new String[0];
}
return value.split("%%%");
}
private String getString(SharedPreferences pref, int ressourceId, String defaultValue) {
return pref.getString(context.getString(ressourceId), defaultValue);
}
private boolean getBoolean(SharedPreferences pref, int ressourceId, boolean defaultValue) {
return pref.getBoolean(context.getString(ressourceId), defaultValue);
}
private int getInt(SharedPreferences pref, int ressourceId, int defaultValue) {
return pref.getInt(context.getString(ressourceId), defaultValue);
}
public int getColor(SharedPreferences pref, String key, int defaultColor) {
return pref.getInt(key, defaultColor);
}
/*
// Setters & Getters
*/
public String getProfileId() { public String getProfileId() {
return getString(prefPod, R.string.pref_key__podprofile_id, ""); return getString(R.string.pref_key__podprofile_id, "", _prefPod);
} }
public void setProfileId(String profileId) { public void setProfileId(String profileId) {
setString(prefPod, R.string.pref_key__podprofile_id, profileId); setString(R.string.pref_key__podprofile_id, profileId, _prefPod);
} }
public boolean isLoadImages() { public boolean isLoadImages() {
return getBoolean(prefApp, R.string.pref_key__load_images, true); return getBool(R.string.pref_key__load_images, true);
} }
public int getMinimumFontSize() { public int getMinimumFontSize() {
switch (getString(prefApp, R.string.pref_key__font_size, "")) { switch (getString(R.string.pref_key__font_size, "")) {
case "huge": case "huge":
return 20; return 20;
case "large": case "large":
@ -135,43 +99,30 @@ public class AppSettings {
case "normal": case "normal":
return 8; return 8;
default: default:
setString(prefApp, R.string.pref_key__font_size, "normal"); setString(R.string.pref_key__font_size, "normal");
return 8; return 8;
} }
} }
public String getAvatarUrl() { public String getAvatarUrl() {
return getString(prefPod, R.string.pref_key__podprofile_avatar_url, ""); return getString(R.string.pref_key__podprofile_avatar_url, "", _prefPod);
} }
public void setAvatarUrl(String avatarUrl) { public void setAvatarUrl(String avatarUrl) {
setString(prefPod, R.string.pref_key__podprofile_avatar_url, avatarUrl); setString(R.string.pref_key__podprofile_avatar_url, avatarUrl, _prefPod);
} }
public String getName() { public String getName() {
return getString(prefPod, R.string.pref_key__podprofile_name, ""); return getString(R.string.pref_key__podprofile_name, "", _prefPod);
} }
public void setName(String name) { public void setName(String name) {
setString(prefPod, R.string.pref_key__podprofile_name, name); setString(R.string.pref_key__podprofile_name, name, _prefPod);
}
// TODO: Remove legacy at some time ;)
public void upgradeLegacyPoddomain() {
String legacy = getString(prefPod, R.string.pref_key__poddomain_legacy, "");
if (!legacy.equals("")) {
DiasporaPod pod = new DiasporaPod();
pod.setName(legacy);
pod.getPodUrls().add(new DiasporaPodUrl().setHost(legacy));
setPod(pod);
}
} }
public DiasporaPod getPod() { public DiasporaPod getPod() {
upgradeLegacyPoddomain();
if (currentPod0Cached == null) { if (currentPod0Cached == null) {
String pref = getString(prefPod, R.string.pref_key__current_pod_0, ""); String pref = getString(R.string.pref_key__current_pod_0, "", _prefPod);
try { try {
currentPod0Cached = new DiasporaPod().fromJson(new JSONObject(pref)); currentPod0Cached = new DiasporaPod().fromJson(new JSONObject(pref));
@ -184,24 +135,27 @@ public class AppSettings {
public void setPod(DiasporaPod pod) { public void setPod(DiasporaPod pod) {
try { try {
setString(prefPod, R.string.pref_key__current_pod_0, setString(R.string.pref_key__current_pod_0,
pod == null ? null : pod.toJson().toString()); pod == null ? null : pod.toJson().toString(), _prefPod);
currentPod0Cached = pod; currentPod0Cached = pod;
} catch (JSONException ignored) { } catch (JSONException ignored) {
} }
} }
public boolean hasPod() { public boolean hasPod() {
upgradeLegacyPoddomain(); return !getString(R.string.pref_key__current_pod_0, "", _prefPod).equals("");
return !getString(prefPod, R.string.pref_key__current_pod_0, "").equals("");
} }
public void setPodAspects(DiasporaAspect[] aspects) { public void setPodAspects(DiasporaAspect[] aspects) {
setStringArray(prefPod, R.string.pref_key__podprofile_aspects, aspects); String[] strs = new String[aspects.length];
for (int i = 0; i < strs.length; i++) {
strs[i] = aspects[i].toShareAbleText();
}
setStringArray(R.string.pref_key__podprofile_aspects, strs, _prefPod);
} }
public DiasporaAspect[] getAspects() { public DiasporaAspect[] getAspects() {
String[] s = getStringArray(prefPod, R.string.pref_key__podprofile_aspects); String[] s = getStringArray(R.string.pref_key__podprofile_aspects, _prefPod);
DiasporaAspect[] aspects = new DiasporaAspect[s.length]; DiasporaAspect[] aspects = new DiasporaAspect[s.length];
for (int i = 0; i < aspects.length; i++) { for (int i = 0; i < aspects.length; i++) {
aspects[i] = new DiasporaAspect(s[i]); aspects[i] = new DiasporaAspect(s[i]);
@ -210,53 +164,53 @@ public class AppSettings {
} }
public String[] getFollowedTags() { public String[] getFollowedTags() {
return getStringArray(prefPod, R.string.pref_key__podprofile_followed_tags); return getStringArray(R.string.pref_key__podprofile_followed_tags, _prefPod);
} }
public void setFollowedTags(String[] values) { public void setFollowedTags(String[] values) {
setStringArray(prefPod, R.string.pref_key__podprofile_followed_tags, values); setStringArray(R.string.pref_key__podprofile_followed_tags, values, _prefPod);
} }
public String[] getFollowedTagsFavs() { public String[] getFollowedTagsFavs() {
return getStringArray(prefPod, R.string.pref_key__podprofile_followed_tags_favs); return getStringArray(R.string.pref_key__podprofile_followed_tags_favs, _prefPod);
} }
public void setFollowedTagsFavs(List<String> values) { public void setFollowedTagsFavs(List<String> values) {
setStringArray(prefPod, R.string.pref_key__podprofile_followed_tags_favs, values.toArray(new String[values.size()])); setStringList(R.string.pref_key__podprofile_followed_tags_favs, values, _prefPod);
} }
public String[] getAspectFavs() { public String[] getAspectFavs() {
return getStringArray(prefPod, R.string.pref_key__podprofile_aspects_favs); return getStringArray(R.string.pref_key__podprofile_aspects_favs, _prefPod);
} }
public void setAspectFavs(List<String> values) { public void setAspectFavs(List<String> values) {
setStringArray(prefPod, R.string.pref_key__podprofile_aspects_favs, values.toArray(new String[values.size()])); setStringList(R.string.pref_key__podprofile_aspects_favs, values, _prefPod);
} }
public int getUnreadMessageCount() { public int getUnreadMessageCount() {
return getInt(prefPod, R.string.pref_key__podprofile_unread_message_count, 0); return getInt(R.string.pref_key__podprofile_unread_message_count, 0, _prefPod);
} }
public void setUnreadMessageCount(int unreadMessageCount) { public void setUnreadMessageCount(int unreadMessageCount) {
setInt(prefPod, R.string.pref_key__podprofile_unread_message_count, unreadMessageCount); setInt(R.string.pref_key__podprofile_unread_message_count, unreadMessageCount, _prefPod);
} }
public int getNotificationCount() { public int getNotificationCount() {
return getInt(prefPod, R.string.pref_key__podprofile_notification_count, 0); return getInt(R.string.pref_key__podprofile_notification_count, 0, _prefPod);
} }
public void setNotificationCount(int notificationCount) { public void setNotificationCount(int notificationCount) {
setInt(prefPod, R.string.pref_key__podprofile_notification_count, notificationCount); setInt(R.string.pref_key__podprofile_notification_count, notificationCount, _prefPod);
} }
public boolean isAppendSharedViaApp() { public boolean isAppendSharedViaApp() {
return getBoolean(prefApp, R.string.pref_key__append_shared_via_app, true); return getBool(R.string.pref_key__append_shared_via_app, true);
} }
@SuppressLint("CommitPrefEdits") @SuppressLint("CommitPrefEdits")
public void setProxyHttpEnabled(boolean enabled) { public void setProxyHttpEnabled(boolean enabled) {
//commit instead of apply because the app is likely to be killed before apply is called. //commit instead of apply because the app is likely to be killed before apply is called.
prefApp.edit().putBoolean(context.getString(R.string.pref_key__http_proxy_enabled), enabled).commit(); _prefApp.edit().putBoolean(rstr(R.string.pref_key__http_proxy_enabled), enabled).commit();
} }
/** /**
@ -265,11 +219,16 @@ public class AppSettings {
* @return whether proxy is enabled or not * @return whether proxy is enabled or not
*/ */
public boolean isProxyHttpEnabled() { public boolean isProxyHttpEnabled() {
return getBoolean(prefApp, R.string.pref_key__http_proxy_enabled, false); try {
return getBool(R.string.pref_key__http_proxy_enabled, false);
} catch (ClassCastException e) {
setProxyHttpEnabled(false);
return false;
}
} }
public boolean wasProxyEnabled() { public boolean wasProxyEnabled() {
return getBoolean(prefApp, R.string.pref_key__proxy_was_enabled, false); return getBool(R.string.pref_key__proxy_was_enabled, false);
} }
/** /**
@ -280,7 +239,7 @@ public class AppSettings {
*/ */
@SuppressLint("CommitPrefEdits") @SuppressLint("CommitPrefEdits")
public void setProxyWasEnabled(boolean b) { public void setProxyWasEnabled(boolean b) {
prefApp.edit().putBoolean(context.getString(R.string.pref_key__proxy_was_enabled), b).commit(); _prefApp.edit().putBoolean(rstr(R.string.pref_key__proxy_was_enabled), b).commit();
} }
/** /**
@ -289,11 +248,11 @@ public class AppSettings {
* @return proxy host * @return proxy host
*/ */
public String getProxyHttpHost() { public String getProxyHttpHost() {
return getString(prefApp, R.string.pref_key__http_proxy_host, ""); return getString(R.string.pref_key__http_proxy_host, "");
} }
public void setProxyHttpHost(String value) { public void setProxyHttpHost(String value) {
setString(prefApp, R.string.pref_key__http_proxy_host, value); setString(R.string.pref_key__http_proxy_host, value);
} }
/** /**
@ -303,17 +262,17 @@ public class AppSettings {
*/ */
public int getProxyHttpPort() { public int getProxyHttpPort() {
try { try {
String str = getString(prefApp, R.string.pref_key__http_proxy_port, "0"); String str = getString(R.string.pref_key__http_proxy_port, "0");
return Integer.parseInt(str); return Integer.parseInt(str);
} catch (ClassCastException e) { } catch (ClassCastException e) {
int port = getInt(prefApp, R.string.pref_key__http_proxy_port, 0); int port = getInt(R.string.pref_key__http_proxy_port, 0);
setProxyHttpPort(port); setProxyHttpPort(port);
return port; return port;
} }
} }
public void setProxyHttpPort(int value) { public void setProxyHttpPort(int value) {
setString(prefApp, R.string.pref_key__http_proxy_port, Integer.toString(value)); setString(R.string.pref_key__http_proxy_port, Integer.toString(value));
} }
public ProxyHandler.ProxySettings getProxySettings() { public ProxyHandler.ProxySettings getProxySettings() {
@ -321,98 +280,201 @@ public class AppSettings {
} }
public boolean isIntellihideToolbars() { public boolean isIntellihideToolbars() {
return getBoolean(prefApp, R.string.pref_key__intellihide_toolbars, true); return getBool(R.string.pref_key__intellihide_toolbars, false);
} }
public boolean isChromeCustomTabsEnabled() { public boolean isChromeCustomTabsEnabled() {
return getBoolean(prefApp, R.string.pref_key__chrome_custom_tabs_enabled, true); return getBool(R.string.pref_key__chrome_custom_tabs_enabled, true);
} }
public boolean isLoggingEnabled() { public boolean isLoggingEnabled() {
return getBoolean(prefApp, R.string.pref_key__logging_enabled, false); return getBool(R.string.pref_key__logging_enabled, false);
} }
public boolean isLoggingSpamEnabled() { public boolean isLoggingSpamEnabled() {
return getBoolean(prefApp, R.string.pref_key__logging_spam_enabled, false); return getBool(R.string.pref_key__logging_spam_enabled, false);
} }
public boolean isVisibleInNavExit() { public boolean isVisibleInNavExit() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__exit, false); return getBool(R.string.pref_key__visibility_nav__exit, true);
} }
public boolean isVisibleInNavHelp_license() { public boolean isVisibleInNavHelp_license() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__help_license, true); return getBool(R.string.pref_key__visibility_nav__help_license, true);
} }
public boolean isVisibleInNavPublic_activities() { public boolean isVisibleInNavPublic_activities() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__public_activities, false); return getBool(R.string.pref_key__visibility_nav__public_activities, false);
} }
public boolean isVisibleInNavMentions() { public boolean isVisibleInNavMentions() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__mentions, false); return getBool(R.string.pref_key__visibility_nav__mentions, false);
} }
public boolean isVisibleInNavCommented() { public boolean isVisibleInNavCommented() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__commented, true); return getBool(R.string.pref_key__visibility_nav__commented, true);
} }
public boolean isVisibleInNavLiked() { public boolean isVisibleInNavLiked() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__liked, true); return getBool(R.string.pref_key__visibility_nav__liked, true);
} }
public boolean isVisibleInNavActivities() { public boolean isVisibleInNavActivities() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__activities, true); return getBool(R.string.pref_key__visibility_nav__activities, true);
} }
public boolean isVisibleInNavAspects() { public boolean isVisibleInNavAspects() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__aspects, true); return getBool(R.string.pref_key__visibility_nav__aspects, true);
} }
public boolean isVisibleInNavFollowed_tags() { public boolean isVisibleInNavFollowed_tags() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__followed_tags, true); return getBool(R.string.pref_key__visibility_nav__followed_tags, true);
} }
public boolean isVisibleInNavProfile() { public boolean isVisibleInNavProfile() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__profile, true); return getBool(R.string.pref_key__visibility_nav__profile, true);
} }
public boolean isVisibleInNavContacts() { public boolean isVisibleInNavContacts() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__contacts, false); return getBool(R.string.pref_key__visibility_nav__contacts, false);
}
public boolean isVisibleInNavStatistics() {
return getBool(R.string.pref_key__visibility_nav__statistics, false);
}
public boolean isVisibleInNavReports() {
return getBool(R.string.pref_key__visibility_nav__reports, false);
}
public boolean isVisibleInNavGsantnerAccount() {
return getBool(R.string.pref_key__visibility_nav__gsantner_account, false);
}
public boolean isVisibleInNavToggleMobileDesktop() {
return getBool(R.string.pref_key__visibility_nav__toggle_mobile_desktop, false);
}
public boolean isTopbarStreamShortcutEnabled() {
return getBool(R.string.pref_key__topbar_stream_shortcut, false);
}
public boolean isOpenYoutubeExternalEnabled() {
return getBool(R.string.pref_key__open_youtube_external_enabled, true);
}
public boolean isSwipeRefreshEnabled() {
return getBool(R.string.pref_key__swipe_refresh_enabled, true);
}
public String getScreenRotation() {
return getString(R.string.pref_key__screen_rotation, R.string.rotation_val_system);
}
public boolean isAppFirstStart() {
boolean value = getBool(R.string.pref_key__app_first_start, true);
setBool(R.string.pref_key__app_first_start, false);
return value;
}
public boolean isAppCurrentVersionFirstStart(boolean doSet) {
int value = getInt(R.string.pref_key__app_first_start_current_version, -1);
if (doSet) {
setInt(R.string.pref_key__app_first_start_current_version, BuildConfig.VERSION_CODE);
}
return value != BuildConfig.VERSION_CODE && !BuildConfig.IS_TEST_BUILD;
}
public File getAppSaveDirectory() {
return new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/dandelion");
}
public long getLastVisitedPositionInStream() {
return getLong(R.string.pref_key__podprofile_last_stream_position, -1, _prefPod);
}
public void setLastVisitedPositionInStream(long timestamp) {
setLong(R.string.pref_key__podprofile_last_stream_position, timestamp, _prefPod);
}
public void setLanguage(String value) {
setString(R.string.pref_key__language, value);
}
public String getLanguage() {
return getString(R.string.pref_key__language, "");
} }
public void setPrimaryColorSettings(int base, int shade) { public void setPrimaryColorSettings(int base, int shade) {
setInt(prefApp, R.string.pref_key__primary_color_base, base); setInt(R.string.pref_key__primary_color_base, base);
setInt(prefApp, R.string.pref_key__primary_color_shade, shade); setInt(R.string.pref_key__primary_color_shade, shade);
} }
public int[] getPrimaryColorSettings() { public int[] getPrimaryColorSettings() {
return new int[]{ return new int[]{
getInt(prefApp, R.string.pref_key__primary_color_base, context.getResources().getColor(R.color.md_blue_500)), getInt(R.string.pref_key__primary_color_base, rcolor(R.color.md_blue_650)),
getInt(prefApp, R.string.pref_key__primary_color_shade, context.getResources().getColor(R.color.primary)) getInt(R.string.pref_key__primary_color_shade, rcolor(R.color.primary))
}; };
} }
@SuppressWarnings("ConstantConditions")
public int getPrimaryColor() { public int getPrimaryColor() {
return getInt(prefApp, R.string.pref_key__primary_color_shade, context.getResources().getColor(R.color.primary)); if (isAmoledColorMode()) {
return Color.BLACK;
} else {
return getInt(R.string.pref_key__primary_color_shade, rcolor(
BuildConfig.IS_TEST_BUILD ? R.color.md_brown_800 : R.color.primary));
}
} }
public void setAccentColorSettings(int base, int shade) { public void setAccentColorSettings(int base, int shade) {
setInt(prefApp, R.string.pref_key__accent_color_base, base); setInt(R.string.pref_key__accent_color_base, base);
setInt(prefApp, R.string.pref_key__accent_color_shade, shade); setInt(R.string.pref_key__accent_color_shade, shade);
} }
public int[] getAccentColorSettings() { public int[] getAccentColorSettings() {
return new int[]{ return new int[]{
getInt(prefApp, R.string.pref_key__accent_color_base, context.getResources().getColor(R.color.md_deep_orange_500)), getInt(R.string.pref_key__accent_color_base, rcolor(R.color.md_green_400)),
getInt(prefApp, R.string.pref_key__accent_color_shade, context.getResources().getColor(R.color.accent)) getInt(R.string.pref_key__accent_color_shade, rcolor(R.color.accent))
}; };
} }
public int getAccentColor() { public int getAccentColor() {
return getInt(prefApp, R.string.pref_key__accent_color_shade, context.getResources().getColor(R.color.accent)); return getInt(R.string.pref_key__accent_color_shade, rcolor(R.color.accent));
} }
public boolean isExtendedNotificationsActivated() { public boolean isExtendedNotificationsActivated() {
return getBoolean(prefApp, R.string.pref_key__extended_notifications, false); return getBool(R.string.pref_key__extended_notifications, false);
} }
}
public boolean isAmoledColorMode() {
return getBool(R.string.pref_key__primary_color__amoled_mode, false);
}
public void setAmoledColorMode(boolean enable) {
setBool(R.string.pref_key__primary_color__amoled_mode, enable);
}
public boolean isAdBlockEnabled() {
return getBool(R.string.pref_key__adblock_enable, true);
}
public boolean isEditorStatusBarHidden() {
return getBool(R.string.pref_key__is_overview_statusbar_hidden, false);
}
public void setRecreateMainActivity(boolean value) {
setBool(R.string.pref_key__recreate_main_activity, value);
}
public boolean isRecreateMainActivity() {
boolean value = getBool(R.string.pref_key__recreate_main_activity, false);
setRecreateMainActivity(false);
return value;
}
public boolean isShowTitleInMainView() {
return getBool(R.string.pref_key__show_title, false);
}
}

View file

@ -0,0 +1,58 @@
package com.github.dfa.diaspora_android.util;
import android.content.Context;
import android.os.Bundle;
import android.os.Environment;
import com.github.dfa.diaspora_android.App;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"})
public class ContextUtils extends net.gsantner.opoc.util.ContextUtils {
protected ContextUtils(Context context) {
super(context);
}
public static ContextUtils get() {
return new ContextUtils(App.get());
}
public File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("dd-MM-yy_HH-mm", Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
AppLog.d(ContextUtils.class, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
return new File(
imageFileName + /* prefix */
".jpg", /* suffix */
storageDir.getAbsolutePath() /* directory */
);
}
public void logBundle(Bundle savedInstanceState, String k) {
if (savedInstanceState != null) {
for (String key : savedInstanceState.keySet()) {
AppLog.d("Bundle", key + " is a key in the bundle " + k);
Object bun = savedInstanceState.get(key);
if (bun != null) {
if (bun instanceof Bundle) {
logBundle((Bundle) bun, k + "." + key);
} else if (bun instanceof byte[]) {
AppLog.d("Bundle", "Key: " + k + "." + key + ": " + Arrays.toString((byte[]) bun));
} else {
AppLog.d("Bundle", "Key: " + k + "." + key + ": " + bun.toString());
}
}
}
}
}
}

View file

@ -1,18 +1,18 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -27,13 +27,15 @@ import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
* Helper class that provides easy access to specific urls related to diaspora * Helper class that provides easy access to specific urls related to diaspora
* Created by vanitasvitae on 10.08.16. * Created by vanitasvitae on 10.08.16.
*/ */
@SuppressWarnings("unused") @SuppressWarnings({"unused", "SpellCheckingInspection", "SameParameterValue", "WeakerAccess"})
public class DiasporaUrlHelper { public class DiasporaUrlHelper {
private final AppSettings settings; private final AppSettings settings;
public static final String URL_BLANK = "about:blank";
public static final String SUBURL_NOTIFICATIONS = "/notifications"; public static final String SUBURL_NOTIFICATIONS = "/notifications";
public static final String SUBURL_POSTS = "/posts/"; public static final String SUBURL_POSTS = "/posts/";
public static final String SUBURL_STREAM = "/stream"; public static final String SUBURL_STREAM = "/stream";
public static final String SUBURL_STREAM_WITH_TIMESTAMP = SUBURL_STREAM + "?max_time=";
public static final String SUBURL_CONVERSATIONS = "/conversations"; public static final String SUBURL_CONVERSATIONS = "/conversations";
public static final String SUBURL_NEW_POST = "/status_messages/new"; public static final String SUBURL_NEW_POST = "/status_messages/new";
public static final String SUBURL_PEOPLE = "/people/"; public static final String SUBURL_PEOPLE = "/people/";
@ -52,21 +54,22 @@ public class DiasporaUrlHelper {
public static final String SUBURL_PERSONAL_SETTINGS = "/user/edit"; public static final String SUBURL_PERSONAL_SETTINGS = "/user/edit";
public static final String SUBURL_MANAGE_TAGS = "/tag_followings/manage"; public static final String SUBURL_MANAGE_TAGS = "/tag_followings/manage";
public static final String SUBURL_SIGN_IN = "/users/sign_in"; public static final String SUBURL_SIGN_IN = "/users/sign_in";
public static final String SUBURL_MANAGE_CONTACTS = "/contacts"; public static final String SUBURL_CONTACTS = "/contacts";
public static final String URL_BLANK = "about:blank"; public static final String SUBURL_REPORTS = "/reports";
public static final String SUBURL_NOTIFICATIONS_ALSO_COMMENTED = "/notifications?type=also_commented"; public static final String SUBURL_NOTIFICATIONS_ALSO_COMMENTED = "/notifications?type=also_commented";
public static final String SUBURL_NOTIFICATIONS_COMMENT_ON_POST = "/notifications?type=comment_on_post"; public static final String SUBURL_NOTIFICATIONS_COMMENT_ON_POST = "/notifications?type=comment_on_post";
public static final String SUBURL_NOTIFICATIONS_LIKED = "/notifications?type=liked"; public static final String SUBURL_NOTIFICATIONS_LIKED = "/notifications?type=liked";
public static final String SUBURL_NOTIFICATIONS_MENTIONED = "/notifications?type=mentioned"; public static final String SUBURL_NOTIFICATIONS_MENTIONED = "/notifications?type=mentioned";
public static final String SUBURL_NOTIFICATIONS_RESHARED = "/notifications?type=reshared"; public static final String SUBURL_NOTIFICATIONS_RESHARED = "/notifications?type=reshared";
public static final String SUBURL_NOTIFICATIONS_STARTED_SHARING = "/notifications?type=started_sharing"; public static final String SUBURL_NOTIFICATIONS_STARTED_SHARING = "/notifications?type=started_sharing";
public static final String SUBURL_THEME = "/user/edit";
public DiasporaUrlHelper(AppSettings settings) { public DiasporaUrlHelper(AppSettings settings) {
this.settings = settings; this.settings = settings;
} }
/** /**
* Return a url of the pod set in AppSettings. * Return a url of the pod set in AppSettingsBase.
* Eg. https://pod.geraspora.de * Eg. https://pod.geraspora.de
* *
* @return https://(pod-domain.tld) * @return https://(pod-domain.tld)
@ -89,6 +92,15 @@ public class DiasporaUrlHelper {
return getPodUrl() + SUBURL_STREAM; return getPodUrl() + SUBURL_STREAM;
} }
/**
* Return a url that points to the stream of the configured diaspora account on a timestamp
*
* @return https://(pod-domain.tld)/stream?max_time=1482057867
*/
public String getStreamWithTimestampUrl(long timestamp) {
return getPodUrl() + SUBURL_STREAM_WITH_TIMESTAMP + timestamp;
}
/** /**
* Return a url that points to the notifications feed of the configured diaspora account * Return a url that points to the notifications feed of the configured diaspora account
* *
@ -140,7 +152,7 @@ public class DiasporaUrlHelper {
* @param profileId Id of the profile to be shown * @param profileId Id of the profile to be shown
* @return https://(pod-domain.tld)/people/(profileId) * @return https://(pod-domain.tld)/people/(profileId)
*/ */
public String getProfileUrl(long profileId) { public String getProfileUrl(String profileId) {
return getPodUrl() + SUBURL_PEOPLE + profileId; return getPodUrl() + SUBURL_PEOPLE + profileId;
} }
@ -218,6 +230,15 @@ public class DiasporaUrlHelper {
return getPodUrl() + SUBURL_SEARCH_TAGS + query; return getPodUrl() + SUBURL_SEARCH_TAGS + query;
} }
/**
* Return a url that queries posts for the given hashtag query
*
* @return https://(pod-domain.tld)/followed_tags
*/
public String getAllFollowedTagsUrl() {
return getPodUrl() + SUBURL_FOLOWED_TAGS;
}
/** /**
* Return a url that queries user accounts for query * Return a url that queries user accounts for query
* *
@ -237,6 +258,16 @@ public class DiasporaUrlHelper {
return getPodUrl() + SUBURL_STATISTICS; return getPodUrl() + SUBURL_STATISTICS;
} }
/**
* Return an Url that points to the reports page of a the configured pod.
* Note: This url is only useful/visible for podmins and moderators.
*
* @return https://(pod-domain.tld)/reports
*/
public String getReportsUrl() {
return getPodUrl() + SUBURL_REPORTS;
}
/** /**
* Return a url that points to the sign in page of the pod. * Return a url that points to the sign in page of the pod.
* *
@ -269,8 +300,8 @@ public class DiasporaUrlHelper {
* *
* @return https://(pod-domain.tld)/contacts * @return https://(pod-domain.tld)/contacts
*/ */
public String getManageContactsUrl() { public String getContactsUrl() {
return getPodUrl() + SUBURL_MANAGE_CONTACTS; return getPodUrl() + SUBURL_CONTACTS;
} }
public String getSuburlNotificationsAlsoCommentedUrl() { public String getSuburlNotificationsAlsoCommentedUrl() {
@ -323,4 +354,13 @@ public class DiasporaUrlHelper {
} }
return app.getString(R.string.aspects); return app.getString(R.string.aspects);
} }
/**
* Return a url that points to the settings of the pod.
*
* @return https://(pod-domain.tld)/user/edit
*/
public String getThemeUrl() {
return getPodUrl() + SUBURL_THEME;
}
} }

View file

@ -1,153 +0,0 @@
/*
This file is part of the Diaspora for Android.
Diaspora for Android 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.
Diaspora for Android 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 the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.dfa.diaspora_android.util;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.support.design.widget.Snackbar;
import android.view.View;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.web.WebHelper;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
public class Helpers {
public static void animateToActivity(Activity from, Class to, boolean finishFromActivity) {
Intent intent = new Intent(from, to);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
from.startActivity(intent);
from.overridePendingTransition(R.anim.fadein, R.anim.fadeout);
if (finishFromActivity) {
from.finish();
}
}
public static int getColorFromRessource(Context context, int ressourceId) {
Resources res = context.getResources();
if (Build.VERSION.SDK_INT >= 23) {
return res.getColor(ressourceId, context.getTheme());
} else {
return res.getColor(ressourceId);
}
}
public static void loadUrlInExternalBrowser(Context context, String url) {
try {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
context.startActivity(browserIntent);
} catch (Exception ignored) {
}
}
public static File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("dd-MM-yy_HH-mm", Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
AppLog.d(Helpers.class, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
return new File(
imageFileName + /* prefix */
".jpg", /* suffix */
storageDir.getAbsolutePath() /* directory */
);
}
public static String readTextfileFromRawRessource(Context context, int rawRessourceId, String linePrefix, String linePostfix) {
StringBuilder sb = new StringBuilder();
String line = "";
BufferedReader br = null;
linePrefix = linePrefix == null ? "" : linePrefix;
linePostfix = linePostfix == null ? "" : linePostfix;
try {
br = new BufferedReader(new InputStreamReader(context.getResources().openRawResource(rawRessourceId)));
while ((line = br.readLine()) != null) {
sb.append(linePrefix);
sb.append(line);
sb.append(linePostfix);
sb.append("\n");
}
} catch (Exception ignored) {
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ignored) {
}
}
}
return sb.toString();
}
public static String hexColorFromRessourceColor(Context context, int idColor) {
return "#" + Integer.toHexString(context.getResources().getColor(idColor) & 0x00ffffff);
}
public static String colorToHex(int color) {
return "#" + Integer.toHexString(color & 0x00ffffff);
}
public static void printBundle(Bundle savedInstanceState, String k) {
if (savedInstanceState != null) {
for (String key : savedInstanceState.keySet()) {
AppLog.d("SAVED", key + " is a key in the bundle " + k);
Object bun = savedInstanceState.get(key);
if (bun != null) {
if (bun instanceof Bundle) {
printBundle((Bundle) bun, k + "." + key);
} else if (bun instanceof byte[]) {
AppLog.d("SAVED", "Key: " + k + "." + key + ": " + Arrays.toString((byte[]) bun));
} else {
AppLog.d("SAVED", "Key: " + k + "." + key + ": " + bun.toString());
}
}
}
}
}
/**
* Show Information if user is offline, returns true if is not connected to internet
*
* @param context Context
* @param anchor A view anchor
*/
public static boolean showInfoIfUserNotConnectedToInternet(Context context, View anchor) {
boolean isOnline = WebHelper.isOnline(context);
if (!isOnline) {
Snackbar.make(anchor, R.string.no_internet, Snackbar.LENGTH_LONG).show();
}
return !isOnline;
}
}

View file

@ -1,36 +1,27 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.web; package com.github.dfa.diaspora_android.web;
import android.Manifest; import android.content.Context;
import android.content.DialogInterface; import android.content.MutableContextWrapper;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.WebSettings; import android.webkit.WebSettings;
@ -39,21 +30,11 @@ import android.widget.ProgressBar;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.activity.MainActivity;
import com.github.dfa.diaspora_android.ui.theme.ThemeHelper; import com.github.dfa.diaspora_android.ui.theme.ThemeHelper;
import com.github.dfa.diaspora_android.ui.theme.ThemedFragment; import com.github.dfa.diaspora_android.ui.theme.ThemedFragment;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/** /**
* Fragment with a webView and a ProgressBar. * Fragment with a webView and a ProgressBar.
* This Fragment retains its instance. * This Fragment retains its instance.
@ -63,7 +44,6 @@ import java.util.Locale;
public class BrowserFragment extends ThemedFragment { public class BrowserFragment extends ThemedFragment {
public static final String TAG = "com.github.dfa.diaspora_android.BrowserFragment"; public static final String TAG = "com.github.dfa.diaspora_android.BrowserFragment";
protected View rootLayout;
protected ContextMenuWebView webView; protected ContextMenuWebView webView;
protected ProgressBar progressBar; protected ProgressBar progressBar;
protected AppSettings appSettings; protected AppSettings appSettings;
@ -71,16 +51,14 @@ public class BrowserFragment extends ThemedFragment {
protected WebSettings webSettings; protected WebSettings webSettings;
protected String pendingUrl; protected String pendingUrl;
protected SwipeRefreshLayout swipe;//pull to refresh
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { protected int getLayoutResId() {
AppLog.d(this, "onCreateView()"); return R.layout.browser__fragment;
if (rootLayout == null) {
rootLayout = inflater.inflate(R.layout.browser__fragment, container, false);
}
return rootLayout;
} }
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
AppLog.d(this, "onViewCreated()"); AppLog.d(this, "onViewCreated()");
@ -91,7 +69,7 @@ public class BrowserFragment extends ThemedFragment {
} }
if (this.webView == null) { if (this.webView == null) {
this.webView = (ContextMenuWebView) view.findViewById(R.id.webView); this.webView = view.findViewById(R.id.webView);
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -103,7 +81,7 @@ public class BrowserFragment extends ThemedFragment {
} }
if (this.progressBar == null) { if (this.progressBar == null) {
this.progressBar = (ProgressBar) view.findViewById(R.id.progressBar); this.progressBar = view.findViewById(R.id.progressBar);
} }
if (pendingUrl != null) { if (pendingUrl != null) {
@ -114,14 +92,26 @@ public class BrowserFragment extends ThemedFragment {
webView.setParentActivity(getActivity()); webView.setParentActivity(getActivity());
this.setRetainInstance(true); this.setRetainInstance(true);
//pull to refresh
swipe = view.findViewById(R.id.swipe);
swipe.setDistanceToTriggerSync(2000);
swipe.setOnRefreshListener(() -> reloadUrl());
if (appSettings.isSwipeRefreshEnabled()) {
swipe.setEnabled(true);
} else {
swipe.setRefreshing(false);
swipe.setEnabled(false);
return;
}
} }
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
if (getRetainInstance() && rootLayout.getParent() instanceof ViewGroup) { if (getRetainInstance() && getView() != null && getView().getParent() instanceof ViewGroup) {
((ViewGroup) rootLayout.getParent()).removeView(rootLayout); ((ViewGroup) getView().getParent()).removeView(getView());
} }
} }
@ -159,96 +149,17 @@ public class BrowserFragment extends ThemedFragment {
} }
} }
@SuppressWarnings("ResultOfMethodCallIgnored")
protected boolean makeScreenshotOfWebView(boolean hasToShareScreenshot) {
AppLog.i(this, "StreamFragment.makeScreenshotOfWebView()");
if (android.os.Build.VERSION.SDK_INT >= 23) {
int hasWRITE_EXTERNAL_STORAGE = getActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) {
if (!shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
new AlertDialog.Builder(getContext())
.setMessage(R.string.permissions_screenshot)
.setNegativeButton(android.R.string.no, null)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (android.os.Build.VERSION.SDK_INT >= 23)
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
MainActivity.REQUEST_CODE_ASK_PERMISSIONS);
}
})
.show();
return false;
}
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
MainActivity.REQUEST_CODE_ASK_PERMISSIONS);
return false;
}
}
Date dateNow = new Date();
DateFormat dateFormat = new SimpleDateFormat("yy_MM_dd--HH_mm_ss", Locale.getDefault());
File fileSaveDirectory = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/Diaspora");
String fileSaveName = hasToShareScreenshot ? ".DfA_share.jpg" : String.format("DfA_%s.jpg", dateFormat.format(dateNow));
if (!fileSaveDirectory.exists()) {
if (!fileSaveDirectory.mkdirs()) {
AppLog.w(this, "Could not mkdir " + fileSaveDirectory.getAbsolutePath());
}
}
if (!hasToShareScreenshot) {
Snackbar.make(webView, getString(R.string.share__toast_screenshot) + " " + fileSaveName, Snackbar.LENGTH_LONG).show();
}
Bitmap bitmap;
webView.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(webView.getDrawingCache());
webView.setDrawingCacheEnabled(false);
OutputStream bitmapWriter = null;
try {
bitmapWriter = new FileOutputStream(new File(fileSaveDirectory, fileSaveName));
bitmap.compress(Bitmap.CompressFormat.JPEG, 85, bitmapWriter);
bitmapWriter.flush();
bitmap.recycle();
} catch (Exception e) {
return false;
} finally {
if (bitmapWriter != null) {
try {
bitmapWriter.close();
} catch (IOException _ignSaveored) {/* Nothing */}
}
}
// Only show share intent when Action Share Screenshot was selected
if (hasToShareScreenshot) {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("image/jpeg");
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, webView.getTitle());
sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl());
Uri bmpUri = Uri.fromFile(new File(fileSaveDirectory, fileSaveName));
sharingIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
startActivity(Intent.createChooser(sharingIntent, getString(R.string.action_share_dotdotdot)));
} else {
// Broadcast that this file is indexable
File file = new File(fileSaveDirectory, fileSaveName);
Uri uri = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri);
getActivity().sendBroadcast(intent);
}
return true;
}
@Override @Override
public String getFragmentTag() { public String getFragmentTag() {
return TAG; return TAG;
} }
@Override @Override
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) { public void onAttach(Context context) {
/* Nothing to do here */ super.onAttach(context);
if (webView != null && webView.getContext() instanceof MutableContextWrapper) {
((MutableContextWrapper) webView.getContext()).setBaseContext(context);
}
} }
public boolean onBackPressed() { public boolean onBackPressed() {
@ -295,6 +206,7 @@ public class BrowserFragment extends ThemedFragment {
@Override @Override
public void run() { public void run() {
getWebView().reload(); getWebView().reload();
swipe.setRefreshing(false);//pull to refresh
} }
}); });

View file

@ -1,47 +1,44 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the dandelion*.
Diaspora for Android is free software: you can redistribute it and/or modify dandelion* is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, dandelion* is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the dandelion*.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.web; package com.github.dfa.diaspora_android.web;
import android.Manifest;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Environment;
import android.support.v4.content.LocalBroadcastManager;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast; import android.widget.Toast;
import com.github.dfa.diaspora_android.BuildConfig;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.activity.MainActivity; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.service.ImageDownloadTask;
import net.gsantner.opoc.util.DownloadTask;
import net.gsantner.opoc.util.PermissionChecker;
import net.gsantner.opoc.util.ShareUtil;
import java.io.File; import java.io.File;
import java.util.Date;
/** /**
* Subclass of WebView which adds a context menu for long clicks on images or links to share, save * Subclass of WebView which adds a context menu for long clicks on images or links to share, save
@ -52,13 +49,14 @@ public class ContextMenuWebView extends NestedWebView {
public static final int ID_SAVE_IMAGE = 10; public static final int ID_SAVE_IMAGE = 10;
public static final int ID_IMAGE_EXTERNAL_BROWSER = 11; public static final int ID_IMAGE_EXTERNAL_BROWSER = 11;
public static final int ID_COPY_IMAGE_LINK = 15;
public static final int ID_COPY_LINK = 12; public static final int ID_COPY_LINK = 12;
public static final int ID_SHARE_LINK = 13; public static final int ID_SHARE_LINK = 13;
public static final int ID_SHARE_IMAGE = 14; public static final int ID_SHARE_IMAGE = 14;
private final Context context; private final Context context;
private Activity parentActivity; private Activity parentActivity;
private String lasLoadUrl = ""; private String lastLoadUrl = "";
public ContextMenuWebView(Context context, AttributeSet attrs, int defStyle) { public ContextMenuWebView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
@ -80,93 +78,46 @@ public class ContextMenuWebView extends NestedWebView {
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
HitTestResult result = getHitTestResult(); HitTestResult result = getHitTestResult();
String url = result.getExtra(); String url = result.getExtra();
final ShareUtil shu = new ShareUtil(context);
final PermissionChecker permc = new PermissionChecker(parentActivity);
final AppSettings appSettings = new AppSettings(context);
switch (item.getItemId()) { switch (item.getItemId()) {
//Save image to external memory //Save image to external memory
case ID_SAVE_IMAGE: { case ID_SAVE_IMAGE: {
boolean writeToStoragePermitted = true; if (permc.doIfExtStoragePermissionGranted(context.getString(R.string.image_permission_description__appspecific))) {
if (android.os.Build.VERSION.SDK_INT >= 23) { File fileSaveDirectory = appSettings.getAppSaveDirectory();
int hasWRITE_EXTERNAL_STORAGE = parentActivity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE); if (permc.mkdirIfStoragePermissionGranted(fileSaveDirectory)) {
if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) { String filename = "dandelion-" + ShareUtil.SDF_SHORT.format(new Date()) + url.substring(url.lastIndexOf("."));
writeToStoragePermitted = false; /*Uri source = Uri.parse(url);
if (!parentActivity.shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
new AlertDialog.Builder(parentActivity)
.setMessage(R.string.permissions_image)
.setPositiveButton(context.getText(android.R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (android.os.Build.VERSION.SDK_INT >= 23)
parentActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
MainActivity.REQUEST_CODE__ACCESS_EXTERNAL_STORAGE);
}
})
.setNegativeButton(context.getText(android.R.string.no), null)
.show();
}
parentActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
MainActivity.REQUEST_CODE__ACCESS_EXTERNAL_STORAGE);
}
}
if (writeToStoragePermitted) {
if (url != null) {
Uri source = Uri.parse(url);
DownloadManager.Request request = new DownloadManager.Request(source); DownloadManager.Request request = new DownloadManager.Request(source);
File destinationFile = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" request.setDestinationUri(Uri.fromFile(new File(fileSaveDirectory, filename)));
+ System.currentTimeMillis() + ".png"); ((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);*/
request.setDestinationUri(Uri.fromFile(destinationFile)); new DownloadTask(new File(fileSaveDirectory, filename), (ok, dlfile) -> {
((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request); if (ok) {
Toast.makeText(context, context.getText(R.string.share__toast_saved_image_to_location) + " " + Toast.makeText(context, context.getText(R.string.saving_image_to) + " " + dlfile.getName(), Toast.LENGTH_LONG).show();
destinationFile.getAbsolutePath(), Toast.LENGTH_LONG).show(); }
}).execute(url);
} }
} }
}
break;
case ID_SHARE_IMAGE:
if (url != null) {
boolean writeToStoragePermitted = true;
if (android.os.Build.VERSION.SDK_INT >= 23) {
int hasWRITE_EXTERNAL_STORAGE = parentActivity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) {
writeToStoragePermitted = false;
if (!parentActivity.shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
new AlertDialog.Builder(parentActivity)
.setMessage(R.string.permissions_image)
.setPositiveButton(context.getText(android.R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (android.os.Build.VERSION.SDK_INT >= 23)
parentActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
MainActivity.REQUEST_CODE__ACCESS_EXTERNAL_STORAGE);
}
})
.setNegativeButton(context.getText(android.R.string.no), null)
.show();
} else {
parentActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
MainActivity.REQUEST_CODE__ACCESS_EXTERNAL_STORAGE);
}
}
}
if (writeToStoragePermitted) {
final Uri local = Uri.parse(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + System.currentTimeMillis() + ".png");
new ImageDownloadTask(null, local.getPath()) {
@Override
protected void onPostExecute(Bitmap result) {
Uri myUri = Uri.fromFile(new File(local.getPath()));
Intent sharingIntent = new Intent();
sharingIntent.setAction(Intent.ACTION_SEND);
sharingIntent.putExtra(Intent.EXTRA_STREAM, myUri);
sharingIntent.setType("image/png");
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.action_share_dotdotdot)));
}
}.execute(url);
}
} else {
Toast.makeText(context, "Cannot share image: url is null", Toast.LENGTH_SHORT).show();
}
break; break;
}
case ID_SHARE_IMAGE: {
if (permc.doIfExtStoragePermissionGranted(context.getString(R.string.image_permission_description__appspecific))) {
File fileSaveDirectory = appSettings.getAppSaveDirectory();
if (permc.mkdirIfStoragePermissionGranted(fileSaveDirectory)) {
String filename = ".dandelion-shared" + url.substring(url.lastIndexOf("."));
new DownloadTask(new File(fileSaveDirectory, filename), (ok, dlfile) -> {
if (ok) {
Toast.makeText(context, context.getText(R.string.saving_image_to) + " " + dlfile.getName(), Toast.LENGTH_LONG).show();
shu.shareStream(dlfile, "image/" + dlfile.getAbsolutePath().lastIndexOf(".") + 1);
}
}).execute(url);
}
}
break;
}
case ID_IMAGE_EXTERNAL_BROWSER: case ID_IMAGE_EXTERNAL_BROWSER:
if (url != null) { if (url != null) {
@ -176,11 +127,12 @@ public class ContextMenuWebView extends NestedWebView {
break; break;
//Copy url to clipboard //Copy url to clipboard
case ID_COPY_IMAGE_LINK:
case ID_COPY_LINK: case ID_COPY_LINK:
if (url != null) { if (url != null) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setPrimaryClip(ClipData.newPlainText("text", url)); clipboard.setPrimaryClip(ClipData.newPlainText("text", url));
Toast.makeText(context, R.string.share__toast_link_address_copied, Toast.LENGTH_SHORT).show(); Toast.makeText(context, R.string.link_adress_copied, Toast.LENGTH_SHORT).show();
} }
break; break;
@ -192,7 +144,7 @@ public class ContextMenuWebView extends NestedWebView {
sendIntent.putExtra(Intent.EXTRA_TEXT, url); sendIntent.putExtra(Intent.EXTRA_TEXT, url);
sendIntent.setType("text/plain"); sendIntent.setType("text/plain");
context.startActivity(Intent.createChooser(sendIntent, getResources() context.startActivity(Intent.createChooser(sendIntent, getResources()
.getText(R.string.context_menu_share_link))); .getText(R.string.share_link_address)));
} }
break; break;
} }
@ -205,15 +157,16 @@ public class ContextMenuWebView extends NestedWebView {
result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE) { result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
// Menu options for an image. // Menu options for an image.
menu.setHeaderTitle(result.getExtra()); menu.setHeaderTitle(result.getExtra());
menu.add(0, ID_SAVE_IMAGE, 0, context.getString(R.string.context_menu_save_image)).setOnMenuItemClickListener(handler); menu.add(0, ID_SAVE_IMAGE, 0, context.getString(R.string.save_image)).setOnMenuItemClickListener(handler);
menu.add(0, ID_IMAGE_EXTERNAL_BROWSER, 0, context.getString(R.string.context_menu_open_external_browser)).setOnMenuItemClickListener(handler); menu.add(0, ID_IMAGE_EXTERNAL_BROWSER, 0, context.getString(R.string.open_in_external_browser)).setOnMenuItemClickListener(handler);
menu.add(0, ID_SHARE_IMAGE, 0, context.getString(R.string.context_menu_share_image)).setOnMenuItemClickListener(handler); menu.add(0, ID_SHARE_IMAGE, 0, context.getString(R.string.share_image)).setOnMenuItemClickListener(handler);
menu.add(0, ID_COPY_IMAGE_LINK, 0, context.getString(R.string.copy_image_address_to_clipboard)).setOnMenuItemClickListener(handler);
} else if (result.getType() == HitTestResult.ANCHOR_TYPE || } else if (result.getType() == HitTestResult.ANCHOR_TYPE ||
result.getType() == HitTestResult.SRC_ANCHOR_TYPE) { result.getType() == HitTestResult.SRC_ANCHOR_TYPE) {
// Menu options for a hyperlink. // Menu options for a hyperlink.
menu.setHeaderTitle(result.getExtra()); menu.setHeaderTitle(result.getExtra());
menu.add(0, ID_COPY_LINK, 0, context.getString(R.string.context_menu_copy_link)).setOnMenuItemClickListener(handler); menu.add(0, ID_COPY_LINK, 0, context.getString(R.string.copy_link_adress_to_clipboard)).setOnMenuItemClickListener(handler);
menu.add(0, ID_SHARE_LINK, 0, context.getString(R.string.context_menu_share_link)).setOnMenuItemClickListener(handler); menu.add(0, ID_SHARE_LINK, 0, context.getString(R.string.share_link_address)).setOnMenuItemClickListener(handler);
} }
} }
@ -225,14 +178,7 @@ public class ContextMenuWebView extends NestedWebView {
@Override @Override
public void loadUrl(String url) { public void loadUrl(String url) {
super.loadUrl(url); super.loadUrl(url);
WebHelper.sendUpdateTitleByUrlIntent(url, getContext());
// Don't spam intents ;)
if (!lasLoadUrl.equals(url)) {
Intent updateActivityTitleIntent = new Intent(MainActivity.ACTION_UPDATE_TITLE_FROM_URL);
updateActivityTitleIntent.putExtra(MainActivity.EXTRA_URL, getUrl());
LocalBroadcastManager.getInstance(context).sendBroadcast(updateActivityTitleIntent);
}
lasLoadUrl = url;
} }
public void setParentActivity(Activity activity) { public void setParentActivity(Activity activity) {

Some files were not shown because too many files have changed in this diff Show more