mirror of
https://github.com/gsantner/dandelion
synced 2024-11-25 13:52:08 +01:00
Proxy tor preset
Set windowSoftInputMode to adjustResize, Repair sharing text into app, Repair image sharing on 4.2 Fix view intent Update TR; Update buildToolsVersion -> 24.0.2 Update ISSUE_TEMPLATE.md Update README.md Switch ic_launcher back to png Replace blowball image on splash with character Reworked UI using Fragments Merge branch 'master' into rework_fragments Update README.md Fixed top/bottom menu entry population Added HashtagFragment Moved WebClients and ChromeClients to webview package Removed SplashActivity, migrated PodSelectionActivity to PodSelectionFragment Merge branch 'master' into rework_fragments Handle Intent.Action.Main in handleIntent() Update strings-about.xml Fixed image sharing to other apps Get title for image sharing dialog from resources instead of using hardcoded string. Also do not show multiple permission dialogs stacked Removed test Fragments and old SplashActivity related stuff Merge branch 'master' into rework_fragments Added some documentation to MainActivity Fixed clear webview cache. Thanks @di72nn Only set window title depending on webviews content, when DiasporaStreamFragment is displayed (do not overwrite other fragments title when the webview loads in the background) Reworked custom themes Set customtab color Do not open load the stream when clicked on toolbar Added note about customtabs and proxys. Fixes #77 Resolved merge conflicts Removed duplicate method getAppSettings Fixed default color was id instead of color value bug Update TR Some improvements of code quality Moved colorpicker repo up Fixed applying of settings Fixed bug causing ClassCastException Moved ThemeHelper and ColorPalette to util.theming Added missing license headers to source files Merge branch 'master' into proper-themes Apply nav-slider entry visibilities in onResume SettingsActivity: Switched to Toolbar and fixed toolbar color issue Fixed BrowserFragment reloading in onResume and added credits to LeafPic Added reference to ColorPicker in 3rd party licenses and updated support libraries Merged master Fixed applying proxy settings Merged master proxy changes Fixed nav slider layout color issue Proxy tor preset Reworked custom themes Set customtab color Do not open load the stream when clicked on toolbar Added note about customtabs and proxys. Fixes #77 Resolved merge conflicts Removed duplicate method getAppSettings Fixed default color was id instead of color value bug Update TR Some improvements of code quality Moved colorpicker repo up Fixed applying of settings Fixed bug causing ClassCastException Moved ThemeHelper and ColorPalette to util.theming Added missing license headers to source files Merge branch 'master' into proper-themes Apply nav-slider entry visibilities in onResume SettingsActivity: Switched to Toolbar and fixed toolbar color issue Fixed BrowserFragment reloading in onResume and added credits to LeafPic Added reference to ColorPicker in 3rd party licenses and updated support libraries Merged master Fixed applying proxy settings Merged master proxy changes Fixed nav slider layout color issue Merge branch 'proper-themes' of github.com:Diaspora-for-Android/diaspora-android into proper-themes
This commit is contained in:
parent
a1ca8596b8
commit
c67992fc37
79 changed files with 2978 additions and 918 deletions
4
.github/ISSUE_TEMPLATE.md
vendored
4
.github/ISSUE_TEMPLATE.md
vendored
|
@ -24,10 +24,10 @@ I have:
|
||||||
|
|
||||||
|
|
||||||
#### Expected result
|
#### Expected result
|
||||||
|
**What is the expected output?**
|
||||||
|
|
||||||
What is the expected output?
|
**What do you see instead?**
|
||||||
|
|
||||||
What do you see instead?
|
|
||||||
|
|
||||||
Upload screenshots via drag&drop if needed and apply resizing:
|
Upload screenshots via drag&drop if needed and apply resizing:
|
||||||
`<img width="30%" height="30%" src="https://cloud.githubusercontent.com/assets/67..b55.jpg">`
|
`<img width="30%" height="30%" src="https://cloud.githubusercontent.com/assets/67..b55.jpg">`
|
||||||
|
|
|
@ -6,7 +6,7 @@ android:
|
||||||
- tools
|
- tools
|
||||||
- tools # TODO https://github.com/travis-ci/travis-ci/issues/6193
|
- tools # TODO https://github.com/travis-ci/travis-ci/issues/6193
|
||||||
- platform-tools
|
- platform-tools
|
||||||
- build-tools-24.0.1
|
- build-tools-24.0.2
|
||||||
- android-24
|
- android-24
|
||||||
- extra-android-m2repository
|
- extra-android-m2repository
|
||||||
before_cache:
|
before_cache:
|
||||||
|
|
|
@ -14,6 +14,7 @@ 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/.
|
||||||
|
|
||||||
|
|
||||||
# Splashscreen-Images
|
# Miscellaneous
|
||||||
|
|
||||||
The splashscreen images can be found on [flickr](https://www.flickr.com/photos/129581906@N06/sets/72157651933980136/with/16594947123/).
|
We took some inspiration and code from LeafPic. Go check it out, its free software as well!
|
||||||
|
https://github.com/HoraApps/LeafPic
|
30
README.md
30
README.md
|
@ -1,8 +1,9 @@
|
||||||
[![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)
|
[![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)
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/Diaspora-for-Android/diaspora-android.svg?branch=master)](https://travis-ci.org/Diaspora-for-Android/diaspora-android)
|
<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)
|
||||||
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/diaspora-for-android/localized.svg)](https://crowdin.com/project/diaspora-for-android)
|
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/diaspora-for-android/localized.svg)](https://crowdin.com/project/diaspora-for-android)
|
||||||
[![Join the chat at https://gitter.im/Diaspora-for-Android/diaspora-android](https://badges.gitter.im/Diaspora-for-Android/diaspora-android.svg)](https://gitter.im/Diaspora-for-Android/diaspora-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[![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)
|
||||||
|
[![Chat - Gitter](https://img.shields.io/badge/chat-on%20gitter-blue.svg)](https://gitter.im/Diaspora-for-Android/diaspora-android)
|
||||||
|
|
||||||
|
|
||||||
# Diaspora for Android
|
# Diaspora for Android
|
||||||
|
@ -15,28 +16,31 @@ This is an unofficial webview based client for the community-run, distributed so
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
We are always open for any kind of contribution. (PR's, bug reports, feature requests, translations, ..)
|
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).
|
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.
|
||||||
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>
|
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.
|
||||||
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
|
### License
|
||||||
It's released under GNU GENERAL PUBLIC LICENSE (see [LICENCE](https://github.com/Diaspora-for-Android/diaspora-android/blob/master/LICENSE.md)).
|
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
|
### WebApp
|
||||||
The app is developed as an 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.
|
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.
|
[Stay tuned on Diaspora* Issues](https://github.com/diaspora/diaspora/labels/api) about API.
|
||||||
|
|
||||||
Why a WebApp is better than using the mobile site on a browser?
|
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 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
|
### App Permissions
|
||||||
It requires access to the Internet and to external storage to be able to upload photos when creating a new post and for taking screenshots.
|
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.
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
- gsantner ([GitHub](https://github.com/gsantner), [Web](https://gsantner.github.io))
|
- gsantner ([GitHub](https://github.com/gsantner), [Web](https://gsantner.github.io), [diaspora*](https://pod.geraspora.de/people/d1cbdd70095301341e834860008dbc6c))
|
||||||
- vanitasvitae ([GitHub](https://github.com/vanitasvitae))
|
- vanitasvitae ([GitHub](https://github.com/vanitasvitae), [Diaspora](https://pod.geraspora.de/people/bbd7af90fbec013213e34860008dbc6c))
|
||||||
|
|
||||||
|
## Acknowledgements
|
||||||
|
- We took some inspiration and code from [LeafPic](https://github.com/HoraApps/LeafPic), big thanks to Donald Shtjefni and the LeafPic Team!
|
||||||
|
|
|
@ -1,14 +1,24 @@
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://cloud.githubusercontent.com/assets/7854206/17698079/5025aa3a-63b9-11e6-9c25-dda3020dd36f.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/01.png" height="60%" width="60%"></td>
|
||||||
<td><img src="https://cloud.githubusercontent.com/assets/7854206/17698080/503f9904-63b9-11e6-9eb7-9ad1500889af.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://cloud.githubusercontent.com/assets/7854206/17698082/50443bee-63b9-11e6-9881-d8e871453650.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://cloud.githubusercontent.com/assets/7854206/17698083/50488514-63b9-11e6-8a44-e7d7e43ae728.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>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://cloud.githubusercontent.com/assets/7854206/17698085/504b17ac-63b9-11e6-845f-273f9d0e50ff.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/05.png" height="60%" width="60%"></td>
|
||||||
<td><img src="https://cloud.githubusercontent.com/assets/7854206/17698084/504ab4b0-63b9-11e6-96a0-32bc27f4b0ab.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://cloud.githubusercontent.com/assets/7854206/17698081/503ff9a8-63b9-11e6-8c52-d14fdf973881.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://cloud.githubusercontent.com/assets/7854206/17698086/505cbd0e-63b9-11e6-8719-9398b81734a1.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>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -3,14 +3,14 @@ apply plugin: 'android-apt'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 24
|
compileSdkVersion 24
|
||||||
buildToolsVersion "24.0.1"
|
buildToolsVersion "24.0.2"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.github.dfa.diaspora_android"
|
applicationId "com.github.dfa.diaspora_android"
|
||||||
minSdkVersion 17
|
minSdkVersion 17
|
||||||
targetSdkVersion 24
|
targetSdkVersion 24
|
||||||
versionCode 8
|
versionCode 8
|
||||||
versionName "0.1.6"
|
versionName "0.1.6-next"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -31,6 +31,13 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
//Color picker
|
||||||
|
url "http://dl.bintray.com/dasar/maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Sub-Projects
|
// Sub-Projects
|
||||||
//compile project(':subprojectFromRoot')
|
//compile project(':subprojectFromRoot')
|
||||||
|
@ -40,15 +47,16 @@ dependencies {
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
|
|
||||||
// Android standard libs
|
// Android standard libs
|
||||||
compile 'com.android.support:appcompat-v7:24.2.0'
|
compile 'com.android.support:appcompat-v7:24.2.1'
|
||||||
compile 'com.android.support:design:24.1.0' //Don't u dare to upd8!
|
compile 'com.android.support:design:24.1.0' //Don't u dare to upd8!
|
||||||
compile 'com.android.support:support-v4:24.2.0'
|
compile 'com.android.support:support-v4:24.2.1'
|
||||||
compile "com.android.support:customtabs:24.2.0"
|
compile "com.android.support:customtabs:24.2.1"
|
||||||
|
|
||||||
// More libraries
|
// More libraries
|
||||||
compile 'com.jakewharton:butterknife:8.0.1'
|
compile 'com.jakewharton:butterknife:8.0.1'
|
||||||
compile 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
|
compile 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
|
||||||
compile 'info.guardianproject.netcipher:netcipher-webkit:2.0.0-alpha1'
|
compile 'info.guardianproject.netcipher:netcipher-webkit:2.0.0-alpha1'
|
||||||
|
compile(group: 'uz.shift', name: 'colorpicker', version: '0.5', ext: 'aar') //Color picker
|
||||||
apt 'com.jakewharton:butterknife-compiler:8.0.1'
|
apt 'com.jakewharton:butterknife-compiler:8.0.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,53 +11,41 @@
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:name="com.github.dfa.diaspora_android.App"
|
android:name="com.github.dfa.diaspora_android.App"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/DiasporaLight" >
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="com.github.dfa.diaspora_android.data.HashtagProvider"
|
android:name="com.github.dfa.diaspora_android.data.HashtagProvider"
|
||||||
android:authorities="com.github.dfa.diaspora_android.mainactivity" />
|
android:authorities="com.github.dfa.diaspora_android.mainactivity" />
|
||||||
<activity
|
|
||||||
android:name="com.github.dfa.diaspora_android.activity.SplashActivity"
|
|
||||||
android:launchMode="singleInstance"
|
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:screenOrientation="portrait"
|
|
||||||
android:theme="@style/Theme.AppCompat.NoActionBar">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
<activity
|
|
||||||
android:name=".activity.PodSelectionActivity"
|
|
||||||
android:launchMode="singleInstance"
|
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
android:label="@string/title_activity_pods"
|
|
||||||
android:screenOrientation="portrait"
|
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
|
||||||
android:windowSoftInputMode="stateHidden" >
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".activity.SettingsActivity"
|
|
||||||
android:launchMode="singleInstance"
|
|
||||||
android:theme="@style/AppTheme"
|
|
||||||
android:label="@string/settings">
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="com.github.dfa.diaspora_android.task.GetPodsService"
|
android:name="com.github.dfa.diaspora_android.task.GetPodsService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false" >
|
android:exported="false" />
|
||||||
</service>
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.SettingsActivity"
|
||||||
|
android:launchMode="singleInstance"
|
||||||
|
android:theme="@style/DiasporaLight.NoActionBar"
|
||||||
|
android:label="@string/settings" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.AboutActivity"
|
||||||
|
android:label="@string/about_activity__title_about_app"
|
||||||
|
android:theme="@style/DiasporaLight.NoActionBar"/>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.MainActivity"
|
android:name=".activity.MainActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:windowSoftInputMode="adjustPan"
|
android:windowSoftInputMode="adjustResize"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/DiasporaLight.NoActionBar"
|
||||||
android:label="@string/diaspora">
|
android:label="@string/diaspora">
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEND" />
|
<action android:name="android.intent.action.SEND" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
@ -255,9 +243,7 @@
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
|
||||||
android:name=".activity.AboutActivity"
|
|
||||||
android:label="@string/about_activity__title_about_app"
|
|
||||||
android:theme="@style/AppTheme.NoActionBar"/>
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -31,9 +31,10 @@ import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentPagerAdapter;
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
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.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -43,10 +44,14 @@ 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.AppSettings;
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
import com.github.dfa.diaspora_android.fragment.ThemedFragment;
|
||||||
import com.github.dfa.diaspora_android.ui.HtmlTextView;
|
import com.github.dfa.diaspora_android.ui.HtmlTextView;
|
||||||
|
import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener;
|
||||||
import com.github.dfa.diaspora_android.util.AppLog;
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
|
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
|
||||||
import com.github.dfa.diaspora_android.util.Helpers;
|
import com.github.dfa.diaspora_android.util.Helpers;
|
||||||
import com.github.dfa.diaspora_android.util.Log;
|
import com.github.dfa.diaspora_android.util.Log;
|
||||||
|
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
|
||||||
|
|
||||||
import java.util.Observable;
|
import java.util.Observable;
|
||||||
import java.util.Observer;
|
import java.util.Observer;
|
||||||
|
@ -57,17 +62,24 @@ import butterknife.ButterKnife;
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
public class AboutActivity extends AppCompatActivity {
|
public class AboutActivity extends ThemedActivity
|
||||||
|
implements IntellihideToolbarActivityListener {
|
||||||
|
|
||||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||||
private ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
|
|
||||||
|
@BindView(R.id.about__appbar)
|
||||||
|
AppBarLayout appBarLayout;
|
||||||
|
|
||||||
@BindView(R.id.main__topbar)
|
@BindView(R.id.main__topbar)
|
||||||
protected Toolbar toolbar;
|
protected Toolbar toolbar;
|
||||||
|
|
||||||
@BindView(R.id.linearlayout)
|
@BindView(R.id.appbar_linear_layout)
|
||||||
protected LinearLayout linearLayout;
|
protected LinearLayout linearLayout;
|
||||||
|
|
||||||
|
@BindView(R.id.tabs)
|
||||||
|
protected TabLayout tabLayout;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -87,23 +99,58 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||||
|
|
||||||
// Set up the ViewPager with the sections adapter.
|
// Set up the ViewPager with the sections adapter.
|
||||||
mViewPager = (ViewPager) findViewById(R.id.container);
|
mViewPager = ButterKnife.findById(this, R.id.container);
|
||||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||||
|
|
||||||
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
|
|
||||||
tabLayout.setupWithViewPager(mViewPager);
|
tabLayout.setupWithViewPager(mViewPager);
|
||||||
|
|
||||||
//Apply intellihide
|
|
||||||
if (!((App) getApplication()).getSettings().isIntellihideToolbars()) {
|
|
||||||
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams();
|
|
||||||
params.setScrollFlags(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if(getAppSettings().isIntellihideToolbars()) {
|
||||||
|
this.enableToolbarHiding();
|
||||||
|
} else {
|
||||||
|
this.disableToolbarHiding();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyColorToViews() {
|
||||||
|
ThemeHelper.updateToolbarColor(toolbar);
|
||||||
|
ThemeHelper.updateTabLayoutColor(tabLayout);
|
||||||
|
ThemeHelper.setPrimaryColorAsBackground(linearLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableToolbarHiding() {
|
||||||
|
AppLog.d(this, "Enable Intellihide");
|
||||||
|
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams();
|
||||||
|
//scroll|enterAlways|snap
|
||||||
|
params.setScrollFlags(toolbarDefaultScrollFlags);
|
||||||
|
appBarLayout.setExpanded(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableToolbarHiding() {
|
||||||
|
AppLog.d(this, "Disable Intellihide");
|
||||||
|
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams();
|
||||||
|
params.setScrollFlags(0); // clear all scroll flags
|
||||||
|
appBarLayout.setExpanded(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment that shows general information about the app
|
* Fragment that shows general information about the app
|
||||||
*/
|
*/
|
||||||
public static class AboutFragment extends Fragment {
|
public static class AboutFragment extends ThemedFragment {
|
||||||
|
|
||||||
|
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)
|
||||||
|
TextView appVersion;
|
||||||
|
|
||||||
public AboutFragment() {
|
public AboutFragment() {
|
||||||
}
|
}
|
||||||
|
@ -112,8 +159,7 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View rootView = inflater.inflate(R.layout.about__fragment_about, container, false);
|
View rootView = inflater.inflate(R.layout.about__fragment_about, container, false);
|
||||||
TextView appVersion = (TextView) rootView.findViewById(R.id.fragment_about__app_version);
|
ButterKnife.bind(this, rootView);
|
||||||
|
|
||||||
if (isAdded()) {
|
if (isAdded()) {
|
||||||
try {
|
try {
|
||||||
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
||||||
|
@ -125,18 +171,42 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyColorToViews() {
|
||||||
|
ThemeHelper.updateTextViewColor(aboutText);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFragmentTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
/* Nothing to do */
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBackPressed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment that shows information about the license of the app and used 3rd party libraries
|
* Fragment that shows information about the license of the app and used 3rd party libraries
|
||||||
*/
|
*/
|
||||||
public static class LicenseFragment extends Fragment {
|
public static class LicenseFragment extends ThemedFragment {
|
||||||
|
public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.LicenseFragment";
|
||||||
|
|
||||||
@BindView(R.id.fragment_license__licensetext)
|
@BindView(R.id.fragment_license__licensetext)
|
||||||
HtmlTextView textLicenseBox;
|
HtmlTextView textLicenseBox;
|
||||||
|
|
||||||
@BindView(R.id.fragment_license__3rdparty)
|
@BindView(R.id.fragment_license__3rdparty)
|
||||||
HtmlTextView textLicense3partyBox;
|
HtmlTextView textLicense3partyBox;
|
||||||
|
|
||||||
|
private String accentColor;
|
||||||
|
|
||||||
|
|
||||||
public LicenseFragment() {
|
public LicenseFragment() {
|
||||||
}
|
}
|
||||||
|
@ -146,7 +216,7 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
View rootView = inflater.inflate(R.layout.about__fragment_license, container, false);
|
View rootView = inflater.inflate(R.layout.about__fragment_license, container, false);
|
||||||
ButterKnife.bind(this, rootView);
|
ButterKnife.bind(this, rootView);
|
||||||
final Context context = rootView.getContext();
|
final Context context = rootView.getContext();
|
||||||
accentColor = Helpers.hexColorFromRessourceColor(context, R.color.colorAccent);
|
accentColor = Helpers.colorToHex(ThemeHelper.getAccentColor());
|
||||||
|
|
||||||
textLicenseBox.setTextFormatted(getString(R.string.fragment_license__license_content,
|
textLicenseBox.setTextFormatted(getString(R.string.fragment_license__license_content,
|
||||||
getMaintainersHtml(context),
|
getMaintainersHtml(context),
|
||||||
|
@ -160,8 +230,6 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String accentColor;
|
|
||||||
|
|
||||||
public String getContributorsHtml(Context context) {
|
public String getContributorsHtml(Context context) {
|
||||||
String text = Helpers.readTextfileFromRawRessource(context, R.raw.contributors,
|
String text = Helpers.readTextfileFromRawRessource(context, R.raw.contributors,
|
||||||
"<font color='" + accentColor + "'><b>*</b></font> ", "<br>");
|
"<font color='" + accentColor + "'><b>*</b></font> ", "<br>");
|
||||||
|
@ -187,13 +255,52 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
text = text.replace("NEWENTRY", "<font color='" + accentColor + "'><b>*</b></font> ");
|
text = text.replace("NEWENTRY", "<font color='" + accentColor + "'><b>*</b></font> ");
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyColorToViews() {
|
||||||
|
ThemeHelper.updateTextViewColor(textLicense3partyBox);
|
||||||
|
ThemeHelper.updateTextViewColor(textLicenseBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFragmentTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
/* Nothing to do */
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBackPressed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment that shows debug information like app version, pod version...
|
* Fragment that shows debug information like app version, pod version...
|
||||||
*/
|
*/
|
||||||
public static class DebugFragment extends Fragment implements Observer {
|
public static class DebugFragment extends Fragment implements Observer {
|
||||||
private TextView logBox;
|
public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.DebugFragment";
|
||||||
|
|
||||||
|
@BindView(R.id.fragment_debug__package_name)
|
||||||
|
TextView packageName;
|
||||||
|
|
||||||
|
@BindView(R.id.fragment_debug__app_version)
|
||||||
|
TextView appVersion;
|
||||||
|
|
||||||
|
@BindView(R.id.fragment_debug__android_version)
|
||||||
|
TextView osVersion;
|
||||||
|
|
||||||
|
@BindView(R.id.fragment_debug__device_name)
|
||||||
|
TextView deviceName;
|
||||||
|
|
||||||
|
@BindView(R.id.fragment_debug__pod_domain)
|
||||||
|
TextView podDomain;
|
||||||
|
|
||||||
|
@BindView(R.id.fragment_debug__log_box)
|
||||||
|
TextView logBox;
|
||||||
|
|
||||||
public DebugFragment() {
|
public DebugFragment() {
|
||||||
}
|
}
|
||||||
|
@ -202,16 +309,10 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View rootView = inflater.inflate(R.layout.about__fragment_debug, container, false);
|
View rootView = inflater.inflate(R.layout.about__fragment_debug, container, false);
|
||||||
TextView packageName = (TextView) rootView.findViewById(R.id.fragment_debug__package_name);
|
ButterKnife.bind(this, rootView);
|
||||||
TextView appVersion = (TextView) rootView.findViewById(R.id.fragment_debug__app_version);
|
|
||||||
TextView osVersion = (TextView) rootView.findViewById(R.id.fragment_debug__android_version);
|
|
||||||
TextView deviceName = (TextView) rootView.findViewById(R.id.fragment_debug__device_name);
|
|
||||||
TextView podDomain = (TextView) rootView.findViewById(R.id.fragment_debug__pod_domain);
|
|
||||||
logBox = (TextView) rootView.findViewById(R.id.fragment_debug__log_box);
|
|
||||||
logBox.setOnLongClickListener(new View.OnLongClickListener() {
|
logBox.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View view) {
|
public boolean onLongClick(View view) {
|
||||||
AppLog.d(this, "Long click registered");
|
|
||||||
if (isAdded()) {
|
if (isAdded()) {
|
||||||
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
|
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
|
||||||
ClipData clip = ClipData.newPlainText("DEBUG_LOG", Log.getLogBuffer());
|
ClipData clip = ClipData.newPlainText("DEBUG_LOG", Log.getLogBuffer());
|
||||||
|
@ -229,14 +330,14 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
if (isAdded()) {
|
if (isAdded()) {
|
||||||
try {
|
try {
|
||||||
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
||||||
AppSettings settings = ((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.fragment_debug__app_version, pInfo.versionName + " (" + pInfo.versionCode + ")"));
|
||||||
|
|
||||||
osVersion.setText(getString(R.string.fragment_debug__android_version, Build.VERSION.RELEASE));
|
osVersion.setText(getString(R.string.fragment_debug__android_version, Build.VERSION.RELEASE));
|
||||||
deviceName.setText(getString(R.string.fragment_debug__device_name, Build.MANUFACTURER + " " + Build.MODEL));
|
deviceName.setText(getString(R.string.fragment_debug__device_name, Build.MANUFACTURER + " " + Build.MODEL));
|
||||||
podDomain.setText(getString(R.string.fragment_debug__pod_domain, settings.getPodDomain()));
|
podDomain.setText(getString(R.string.fragment_debug__pod_domain, urls.getPodUrl()));
|
||||||
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -25,7 +25,6 @@ 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.Configuration;
|
|
||||||
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;
|
||||||
|
@ -41,7 +40,6 @@ 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.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
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.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
@ -55,6 +53,7 @@ import android.widget.EditText;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -62,24 +61,31 @@ 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.AppSettings;
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
import com.github.dfa.diaspora_android.data.PodUserProfile;
|
import com.github.dfa.diaspora_android.data.PodUserProfile;
|
||||||
|
import com.github.dfa.diaspora_android.fragment.BrowserFragment;
|
||||||
import com.github.dfa.diaspora_android.fragment.CustomFragment;
|
import com.github.dfa.diaspora_android.fragment.CustomFragment;
|
||||||
import com.github.dfa.diaspora_android.fragment.StreamFragment;
|
import com.github.dfa.diaspora_android.fragment.DiasporaStreamFragment;
|
||||||
|
import com.github.dfa.diaspora_android.fragment.HashtagListFragment;
|
||||||
|
import com.github.dfa.diaspora_android.fragment.PodSelectionFragment;
|
||||||
import com.github.dfa.diaspora_android.listener.WebUserProfileChangedListener;
|
import com.github.dfa.diaspora_android.listener.WebUserProfileChangedListener;
|
||||||
import com.github.dfa.diaspora_android.receiver.OpenExternalLinkReceiver;
|
import com.github.dfa.diaspora_android.receiver.OpenExternalLinkReceiver;
|
||||||
|
import com.github.dfa.diaspora_android.util.ProxyHandler;
|
||||||
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.IntellihideToolbarActivityListener;
|
||||||
import com.github.dfa.diaspora_android.util.AppLog;
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper;
|
import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper;
|
||||||
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.util.theming.ThemeHelper;
|
||||||
import com.github.dfa.diaspora_android.util.WebHelper;
|
import com.github.dfa.diaspora_android.util.WebHelper;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity
|
public class MainActivity extends ThemedActivity
|
||||||
implements NavigationView.OnNavigationItemSelectedListener, WebUserProfileChangedListener, CustomTabActivityHelper.ConnectionCallback {
|
implements NavigationView.OnNavigationItemSelectedListener,
|
||||||
|
WebUserProfileChangedListener,
|
||||||
|
CustomTabActivityHelper.ConnectionCallback,
|
||||||
|
IntellihideToolbarActivityListener {
|
||||||
|
|
||||||
|
|
||||||
public static final int REQUEST_CODE_ASK_PERMISSIONS = 123;
|
public static final int REQUEST_CODE_ASK_PERMISSIONS = 123;
|
||||||
|
@ -92,7 +98,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
public static final String ACTION_CHANGE_ACCOUNT = "com.github.dfa.diaspora_android.MainActivity.change_account";
|
public static final String ACTION_CHANGE_ACCOUNT = "com.github.dfa.diaspora_android.MainActivity.change_account";
|
||||||
public static final String ACTION_CLEAR_CACHE = "com.github.dfa.diaspora_android.MainActivity.clear_cache";
|
public static final String ACTION_CLEAR_CACHE = "com.github.dfa.diaspora_android.MainActivity.clear_cache";
|
||||||
public static final String ACTION_UPDATE_TITLE_FROM_URL = "com.github.dfa.diaspora_android.MainActivity.set_title";
|
public static final String ACTION_UPDATE_TITLE_FROM_URL = "com.github.dfa.diaspora_android.MainActivity.set_title";
|
||||||
public static final String ACTION_RELOAD_ACTIVITY = "com.github.dfa.diaspora_android.MainActivity.reload_activity";
|
|
||||||
public static final String URL_MESSAGE = "URL_MESSAGE";
|
public static final String URL_MESSAGE = "URL_MESSAGE";
|
||||||
public static final String EXTRA_URL = "com.github.dfa.diaspora_android.extra_url";
|
public static final String EXTRA_URL = "com.github.dfa.diaspora_android.extra_url";
|
||||||
public static final String CONTENT_HASHTAG = "content://com.github.dfa.diaspora_android.mainactivity/";
|
public static final String CONTENT_HASHTAG = "content://com.github.dfa.diaspora_android.mainactivity/";
|
||||||
|
@ -113,6 +118,9 @@ public class MainActivity extends AppCompatActivity
|
||||||
/**
|
/**
|
||||||
* UI Bindings
|
* UI Bindings
|
||||||
*/
|
*/
|
||||||
|
@BindView(R.id.main__appbar)
|
||||||
|
AppBarLayout appBarLayout;
|
||||||
|
|
||||||
@BindView(R.id.main__topbar)
|
@BindView(R.id.main__topbar)
|
||||||
Toolbar toolbarTop;
|
Toolbar toolbarTop;
|
||||||
|
|
||||||
|
@ -128,12 +136,17 @@ public class MainActivity extends AppCompatActivity
|
||||||
@BindView(R.id.main__navdrawer)
|
@BindView(R.id.main__navdrawer)
|
||||||
DrawerLayout navDrawer;
|
DrawerLayout navDrawer;
|
||||||
|
|
||||||
|
RelativeLayout navDrawerLayout;
|
||||||
|
LinearLayout navProfilePictureArea;
|
||||||
|
|
||||||
|
|
||||||
// NavHeader cannot be bound by Butterknife
|
// NavHeader cannot be bound by Butterknife
|
||||||
private TextView navheaderTitle;
|
private TextView navheaderTitle;
|
||||||
private TextView navheaderDescription;
|
private TextView navheaderDescription;
|
||||||
private ImageView navheaderImage;
|
private ImageView navheaderImage;
|
||||||
|
|
||||||
|
private String textToBeShared;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* END UI Bindings
|
* END UI Bindings
|
||||||
|
@ -158,38 +171,58 @@ public class MainActivity extends AppCompatActivity
|
||||||
urls = new DiasporaUrlHelper(appSettings);
|
urls = new DiasporaUrlHelper(appSettings);
|
||||||
customTabActivityHelper = new CustomTabActivityHelper();
|
customTabActivityHelper = new CustomTabActivityHelper();
|
||||||
customTabActivityHelper.setConnectionCallback(this);
|
customTabActivityHelper.setConnectionCallback(this);
|
||||||
|
ProxyHandler.getInstance().updateProxySettings(this);
|
||||||
|
|
||||||
fm = getSupportFragmentManager();
|
fm = getSupportFragmentManager();
|
||||||
StreamFragment sf = getStreamFragment();
|
setupUI();
|
||||||
fm.beginTransaction().replace(R.id.fragment_container, sf, StreamFragment.TAG).commit();
|
|
||||||
sf.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater());
|
|
||||||
|
|
||||||
setupUI(savedInstanceState);
|
|
||||||
|
|
||||||
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
|
@Override
|
||||||
public void setTitle(int rId) {
|
public void setTitle(int rId) {
|
||||||
|
CustomFragment top = getTopFragment();
|
||||||
|
if (top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) {
|
||||||
MainActivity.this.setTitle(rId);
|
MainActivity.this.setTitle(rId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
|
CustomFragment top = getTopFragment();
|
||||||
|
if (top != null && top.getFragmentTag().equals(DiasporaStreamFragment.TAG)) {
|
||||||
MainActivity.this.setTitle(title);
|
MainActivity.this.setTitle(title);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!appSettings.hasPodDomain()) {
|
||||||
|
AppLog.d(this, "We have no pod. Show PodSelectionFragment");
|
||||||
|
showFragment(getFragment(PodSelectionFragment.TAG));
|
||||||
|
} else {
|
||||||
|
AppLog.d(this, "Pod found. Handle intents.");
|
||||||
|
//Handle intent
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (intent != null && intent.getAction() != null) {
|
||||||
|
handleIntent(intent);
|
||||||
|
} else {
|
||||||
|
openDiasporaUrl(urls.getStreamUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupUI(Bundle savedInstanceState) {
|
/**
|
||||||
|
* Setup the user interface. Set up both toolbars and initialize the snackbars.
|
||||||
|
* Initialize the navigation drawer and apply intellihide settings.
|
||||||
|
*/
|
||||||
|
private void setupUI() {
|
||||||
AppLog.i(this, "setupUI()");
|
AppLog.i(this, "setupUI()");
|
||||||
|
|
||||||
// Setup toolbar
|
// Setup toolbar
|
||||||
setSupportActionBar(toolbarTop);
|
setSupportActionBar(toolbarTop);
|
||||||
getMenuInflater().inflate(R.menu.main__menu_bottom, toolbarBottom.getMenu());
|
|
||||||
toolbarBottom.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
|
toolbarBottom.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
CustomFragment topFrag = (CustomFragment) getTopFragment();
|
CustomFragment top = getTopFragment();
|
||||||
return MainActivity.this.onOptionsItemSelected(item) || (topFrag != null && topFrag.onOptionsItemSelected(item));
|
return MainActivity.this.onOptionsItemSelected(item) || (top != null && top.onOptionsItemSelected(item));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setTitle(R.string.app_name);
|
setTitle(R.string.app_name);
|
||||||
|
@ -208,43 +241,79 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
// Load app settings
|
// Load app settings
|
||||||
setupNavigationSlider();
|
setupNavigationSlider();
|
||||||
|
|
||||||
if (!appSettings.isIntellihideToolbars()) {
|
|
||||||
AppLog.v(this, "Disable intelligent hiding of toolbars");
|
|
||||||
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarTop.getLayoutParams();
|
|
||||||
params.setScrollFlags(0); // clear all scroll flags
|
|
||||||
}
|
|
||||||
|
|
||||||
AppLog.v(this, "UI successfully set up");
|
AppLog.v(this, "UI successfully set up");
|
||||||
handleIntent(getIntent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show DiasporaStreamFragment if necessary and load URL url
|
||||||
|
*
|
||||||
|
* @param url URL to load in the DiasporaStreamFragment
|
||||||
|
*/
|
||||||
public void openDiasporaUrl(String url) {
|
public void openDiasporaUrl(String url) {
|
||||||
StreamFragment streamFragment = getStreamFragment();
|
AppLog.v(this, "openDiasporaUrl()");
|
||||||
if(!streamFragment.isVisible()) {
|
DiasporaStreamFragment streamFragment = (DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG);
|
||||||
AppLog.d(this, "StreamFragment not visible");
|
showFragment(streamFragment);
|
||||||
fm.beginTransaction().replace(R.id.fragment_container, streamFragment, StreamFragment.TAG).commit();
|
|
||||||
streamFragment.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater());
|
|
||||||
}
|
|
||||||
streamFragment.loadUrl(url);
|
streamFragment.loadUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StreamFragment getStreamFragment() {
|
/**
|
||||||
StreamFragment streamFragment = (StreamFragment) fm.findFragmentByTag(StreamFragment.TAG);
|
* Get an instance of the CustomFragment with the tag fragmentTag.
|
||||||
if(streamFragment == null) {
|
* If there was no instance so far, create a new one and add it to the FragmentManagers pool.
|
||||||
AppLog.d(this, "StreamFragment was null");
|
* If there is no Fragment with the corresponding Tag, return the top fragment.
|
||||||
streamFragment = new StreamFragment();
|
*
|
||||||
|
* @param fragmentTag tag
|
||||||
|
* @return corresponding Fragment
|
||||||
|
*/
|
||||||
|
protected CustomFragment getFragment(String fragmentTag) {
|
||||||
|
CustomFragment fragment = (CustomFragment) fm.findFragmentByTag(fragmentTag);
|
||||||
|
if (fragment != null) {
|
||||||
|
return fragment;
|
||||||
|
} else {
|
||||||
|
switch (fragmentTag) {
|
||||||
|
case DiasporaStreamFragment.TAG:
|
||||||
|
DiasporaStreamFragment dsf = new DiasporaStreamFragment();
|
||||||
|
fm.beginTransaction().add(dsf, fragmentTag).commit();
|
||||||
|
return dsf;
|
||||||
|
case BrowserFragment.TAG:
|
||||||
|
BrowserFragment bf = new BrowserFragment();
|
||||||
|
fm.beginTransaction().add(bf, fragmentTag).commit();
|
||||||
|
return bf;
|
||||||
|
case HashtagListFragment.TAG:
|
||||||
|
HashtagListFragment hlf = new HashtagListFragment();
|
||||||
|
fm.beginTransaction().add(hlf, fragmentTag).commit();
|
||||||
|
return hlf;
|
||||||
|
case PodSelectionFragment.TAG:
|
||||||
|
PodSelectionFragment psf = new PodSelectionFragment();
|
||||||
|
fm.beginTransaction().add(psf, fragmentTag).commit();
|
||||||
|
return psf;
|
||||||
|
default:
|
||||||
|
AppLog.e(this, "Invalid Fragment Tag: " + fragmentTag
|
||||||
|
+ "\nAdd Fragments Tag to getFragment()'s switch case.");
|
||||||
|
return getTopFragment();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return streamFragment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
* Show the Fragment fragment in R.id.fragment_container. If the fragment was already visible, do nothing.
|
||||||
AppLog.i(this, "onConfigurationChanged()");
|
*
|
||||||
|
* @param fragment Fragment to show
|
||||||
super.onConfigurationChanged(newConfig);
|
*/
|
||||||
|
protected void showFragment(CustomFragment fragment) {
|
||||||
|
AppLog.v(this, "showFragment()");
|
||||||
|
CustomFragment currentTop = (CustomFragment) fm.findFragmentById(R.id.fragment_container);
|
||||||
|
if (currentTop == null || !currentTop.getFragmentTag().equals(fragment.getFragmentTag())) {
|
||||||
|
AppLog.v(this, "Fragment was not visible. Replace it.");
|
||||||
|
fm.beginTransaction().addToBackStack(null).replace(R.id.fragment_container, fragment, fragment.getFragmentTag()).commit();
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
} else {
|
||||||
|
AppLog.v(this, "Fragment was already visible. Do nothing.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the navigation slider
|
||||||
|
*/
|
||||||
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.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||||
|
@ -255,9 +324,10 @@ public class MainActivity extends AppCompatActivity
|
||||||
navView.setNavigationItemSelectedListener(this);
|
navView.setNavigationItemSelectedListener(this);
|
||||||
|
|
||||||
View navHeader = navView.getHeaderView(0);
|
View navHeader = navView.getHeaderView(0);
|
||||||
LinearLayout navheaderProfileSection = ButterKnife.findById(navHeader, R.id.nav_profile_picture);
|
navProfilePictureArea = ButterKnife.findById(navHeader, R.id.nav_profile_picture);
|
||||||
|
navDrawerLayout = ButterKnife.findById(navHeader, R.id.nav_drawer);
|
||||||
//Handle clicks on profile picture
|
//Handle clicks on profile picture
|
||||||
navheaderProfileSection.setOnClickListener(new View.OnClickListener() {
|
navProfilePictureArea.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
navDrawer.closeDrawer(GravityCompat.START);
|
navDrawer.closeDrawer(GravityCompat.START);
|
||||||
|
@ -294,34 +364,39 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateNavigationViewEntryVisibilities();
|
||||||
|
}
|
||||||
|
|
||||||
// Set visibility
|
protected void updateNavigationViewEntryVisibilities() {
|
||||||
Menu navMenu = navView.getMenu();
|
Menu navMenu = navView.getMenu();
|
||||||
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_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_help_license).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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.main__topbar)
|
/**
|
||||||
public void onToolBarClicked(View view) {
|
* Forward incoming intents to handleIntent()
|
||||||
AppLog.i(this, "onToolBarClicked()");
|
*
|
||||||
onNavigationItemSelected(navView.getMenu().findItem(R.id.nav_stream));
|
* @param intent incoming
|
||||||
}
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
|
|
||||||
handleIntent(intent);
|
handleIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle intents and execute intent specific actions
|
||||||
|
*
|
||||||
|
* @param intent intent to get handled
|
||||||
|
*/
|
||||||
private void handleIntent(Intent intent) {
|
private void handleIntent(Intent intent) {
|
||||||
AppLog.i(this, "handleIntent()");
|
AppLog.i(this, "handleIntent()");
|
||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
|
@ -333,7 +408,9 @@ public class MainActivity extends AppCompatActivity
|
||||||
String type = intent.getType();
|
String type = intent.getType();
|
||||||
String loadUrl = null;
|
String loadUrl = null;
|
||||||
AppLog.v(this, "Action: " + action + " Type: " + type);
|
AppLog.v(this, "Action: " + action + " Type: " + type);
|
||||||
if (ACTION_OPEN_URL.equals(action)) {
|
if (Intent.ACTION_MAIN.equals(action)) {
|
||||||
|
loadUrl = urls.getStreamUrl();
|
||||||
|
} else if (ACTION_OPEN_URL.equals(action)) {
|
||||||
loadUrl = intent.getStringExtra(URL_MESSAGE);
|
loadUrl = intent.getStringExtra(URL_MESSAGE);
|
||||||
} else if (Intent.ACTION_VIEW.equals(action) && intent.getDataString() != null) {
|
} else if (Intent.ACTION_VIEW.equals(action) && intent.getDataString() != null) {
|
||||||
Uri data = intent.getData();
|
Uri data = intent.getData();
|
||||||
|
@ -342,18 +419,15 @@ public class MainActivity extends AppCompatActivity
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
loadUrl = intent.getDataString();
|
loadUrl = intent.getDataString();
|
||||||
|
AppLog.v(this, "Intent has a delicious URL for us: " + loadUrl);
|
||||||
}
|
}
|
||||||
} else if (ACTION_CHANGE_ACCOUNT.equals(action)) {
|
} else if (ACTION_CHANGE_ACCOUNT.equals(action)) {
|
||||||
AppLog.v(this, "Reset pod data and animate to PodSelectionActivity");
|
AppLog.v(this, "Reset pod data and show PodSelectionFragment");
|
||||||
app.resetPodData(getStreamFragment().getWebView());
|
app.resetPodData(((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView());
|
||||||
Helpers.animateToActivity(MainActivity.this, PodSelectionActivity.class, true);
|
showFragment(getFragment(PodSelectionFragment.TAG));
|
||||||
} 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");
|
||||||
getStreamFragment().getWebView().clearCache(true);
|
((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView().clearCache(true);
|
||||||
} else if (ACTION_RELOAD_ACTIVITY.equals(action)) {
|
|
||||||
AppLog.v(this, "Recreate activity");
|
|
||||||
recreate();
|
|
||||||
return;
|
|
||||||
} else if (Intent.ACTION_SEND.equals(action) && type != null) {
|
} else if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "text/plain":
|
case "text/plain":
|
||||||
|
@ -368,7 +442,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadUrl != null) {
|
if (loadUrl != null) {
|
||||||
|
@ -377,33 +452,35 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle activity results
|
||||||
|
*
|
||||||
|
* @param requestCode reqCode
|
||||||
|
* @param resultCode resCode
|
||||||
|
* @param data data
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
AppLog.d(this, "onActivityResult(): "+requestCode);
|
AppLog.v(this, "onActivityResult(): " + requestCode);
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
* Return the fragment which is currently displayed in R.id.fragment_container
|
||||||
AppLog.v(this, "onSaveInstanceState()");
|
*
|
||||||
super.onSaveInstanceState(outState);
|
* @return top fragment or null if there is none displayed
|
||||||
}
|
*/
|
||||||
|
private CustomFragment getTopFragment() {
|
||||||
@Override
|
Fragment top = fm.findFragmentById(R.id.fragment_container);
|
||||||
protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
|
if (top != null) {
|
||||||
AppLog.v(this, "onRestoreInstanceState()");
|
return (CustomFragment) top;
|
||||||
super.onRestoreInstanceState(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Fragment getTopFragment() {
|
|
||||||
for(Fragment f : fm.getFragments()) {
|
|
||||||
if(f.isVisible()) {
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle presses on the back button
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
AppLog.v(this, "onBackPressed()");
|
AppLog.v(this, "onBackPressed()");
|
||||||
|
@ -411,15 +488,20 @@ public class MainActivity extends AppCompatActivity
|
||||||
navDrawer.closeDrawer(navView);
|
navDrawer.closeDrawer(navView);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CustomFragment top = (CustomFragment) getTopFragment();
|
CustomFragment top = getTopFragment();
|
||||||
if(top != null) {
|
if (top != null) {
|
||||||
AppLog.d(this, "Top Fragment is not null");
|
AppLog.v(this, "Top Fragment is not null");
|
||||||
if(!top.onBackPressed()) {
|
if (!top.onBackPressed()) {
|
||||||
AppLog.d(this, "Top Fragment.onBackPressed was false");
|
AppLog.v(this, "Top Fragment.onBackPressed was false");
|
||||||
//TODO: Go back in Fragment backstack
|
AppLog.v(this, "BackStackEntryCount: " + fm.getBackStackEntryCount());
|
||||||
|
if (fm.getBackStackEntryCount() > 0) {
|
||||||
|
fm.popBackStack();
|
||||||
|
} else {
|
||||||
|
snackbarExitApp.show();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
AppLog.d(this, "Top Fragment.onBackPressed was true");
|
AppLog.v(this, "Top Fragment.onBackPressed was true");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,15 +539,53 @@ public class MainActivity extends AppCompatActivity
|
||||||
AppLog.v(this, "Register BroadcastReceivers");
|
AppLog.v(this, "Register BroadcastReceivers");
|
||||||
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));
|
||||||
|
this.appSettings = getAppSettings();
|
||||||
|
if (appSettings.isIntellihideToolbars()) {
|
||||||
|
this.enableToolbarHiding();
|
||||||
|
} else {
|
||||||
|
this.disableToolbarHiding();
|
||||||
|
}
|
||||||
|
updateNavigationViewEntryVisibilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear and repopulate top and bottom toolbar.
|
||||||
|
* Also add menu items of the displayed fragment
|
||||||
|
*
|
||||||
|
* @param menu top toolbar
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
AppLog.v(this, "onCreateOptionsMenu()");
|
AppLog.v(this, "onCreateOptionsMenu()");
|
||||||
|
//Clear the menus
|
||||||
|
menu.clear();
|
||||||
|
toolbarBottom.getMenu().clear();
|
||||||
|
toolbarBottom.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
CustomFragment top = getTopFragment();
|
||||||
|
if (top != null) {
|
||||||
|
//Are we displaying a Fragment other than PodSelectionFragment?
|
||||||
|
if (!top.getFragmentTag().equals(PodSelectionFragment.TAG)) {
|
||||||
getMenuInflater().inflate(R.menu.main__menu_top, menu);
|
getMenuInflater().inflate(R.menu.main__menu_top, menu);
|
||||||
|
getMenuInflater().inflate(R.menu.main__menu_bottom, toolbarBottom.getMenu());
|
||||||
|
top.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater());
|
||||||
|
}
|
||||||
|
//PodSelectionFragment
|
||||||
|
else {
|
||||||
|
//Hide bottom toolbar
|
||||||
|
toolbarBottom.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the notification and messages counter in the top toolbar
|
||||||
|
*
|
||||||
|
* @param menu menu
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
MenuItem item;
|
MenuItem item;
|
||||||
|
@ -482,6 +602,12 @@ public class MainActivity extends AppCompatActivity
|
||||||
return super.onPrepareOptionsMenu(menu);
|
return super.onPrepareOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle clicks on the optionsmenu
|
||||||
|
*
|
||||||
|
* @param item item
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
AppLog.i(this, "onOptionsItemSelected()");
|
AppLog.i(this, "onOptionsItemSelected()");
|
||||||
|
@ -575,18 +701,33 @@ public class MainActivity extends AppCompatActivity
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the profile name in the navigation slider
|
||||||
|
*
|
||||||
|
* @param name name
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onUserProfileNameChanged(String name) {
|
public void onUserProfileNameChanged(String name) {
|
||||||
AppLog.i(this, "onUserProfileNameChanged()");
|
AppLog.i(this, "onUserProfileNameChanged()");
|
||||||
navheaderTitle.setText(name);
|
navheaderTitle.setText(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the profile picture in the navigation slider
|
||||||
|
*
|
||||||
|
* @param avatarUrl url of the new profile pic
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onUserProfileAvatarChanged(String avatarUrl) {
|
public void onUserProfileAvatarChanged(String avatarUrl) {
|
||||||
AppLog.i(this, "onUserProfileAvatarChanged()");
|
AppLog.i(this, "onUserProfileAvatarChanged()");
|
||||||
app.getAvatarImageLoader().startImageDownload(navheaderImage, avatarUrl);
|
app.getAvatarImageLoader().startImageDownload(navheaderImage, avatarUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle hashtag clicks. Open the new-post-url and inject the clicked hashtag into the post-editor
|
||||||
|
*
|
||||||
|
* @param intent intent
|
||||||
|
*/
|
||||||
private void handleHashtag(Intent intent) {
|
private void handleHashtag(Intent intent) {
|
||||||
AppLog.v(this, "handleHashtag()");
|
AppLog.v(this, "handleHashtag()");
|
||||||
try {
|
try {
|
||||||
|
@ -597,15 +738,19 @@ public class MainActivity extends AppCompatActivity
|
||||||
openDiasporaUrl(urls.getNewPostUrl());
|
openDiasporaUrl(urls.getNewPostUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the new-post-url and inject text that was shared into the app into the post editors text field
|
||||||
|
*
|
||||||
|
* @param intent shareTextIntent
|
||||||
|
*/
|
||||||
private void handleSendText(Intent intent) {
|
private void handleSendText(Intent intent) {
|
||||||
AppLog.v(this, "handleSendText()");
|
AppLog.v(this, "handleSendText()");
|
||||||
try {
|
try {
|
||||||
setSharedTexts(null, intent.getStringExtra(Intent.EXTRA_TEXT));
|
setSharedTexts(null, intent.getStringExtra(Intent.EXTRA_TEXT));
|
||||||
|
openDiasporaUrl(urls.getNewPostUrl());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
AppLog.e(this, e.toString());
|
AppLog.e(this, e.toString());
|
||||||
}
|
}
|
||||||
openDiasporaUrl(urls.getBlankUrl());
|
|
||||||
openDiasporaUrl(urls.getNewPostUrl());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -617,11 +762,10 @@ public class MainActivity extends AppCompatActivity
|
||||||
AppLog.v(this, "handleSendSubject()");
|
AppLog.v(this, "handleSendSubject()");
|
||||||
try {
|
try {
|
||||||
setSharedTexts(intent.getStringExtra(Intent.EXTRA_SUBJECT), intent.getStringExtra(Intent.EXTRA_TEXT));
|
setSharedTexts(intent.getStringExtra(Intent.EXTRA_SUBJECT), intent.getStringExtra(Intent.EXTRA_TEXT));
|
||||||
|
openDiasporaUrl(urls.getNewPostUrl());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
AppLog.e(this, e.toString());
|
AppLog.e(this, e.toString());
|
||||||
}
|
}
|
||||||
openDiasporaUrl(urls.getBlankUrl()); //TODO: Necessary?
|
|
||||||
openDiasporaUrl(urls.getNewPostUrl());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -645,26 +789,36 @@ public class MainActivity extends AppCompatActivity
|
||||||
if (sharedSubject != null) {
|
if (sharedSubject != null) {
|
||||||
AppLog.v(this, "Append subject to shared text");
|
AppLog.v(this, "Append subject to shared text");
|
||||||
String escapedSubject = WebHelper.escapeHtmlText(WebHelper.replaceUrlWithMarkdown(sharedSubject));
|
String escapedSubject = WebHelper.escapeHtmlText(WebHelper.replaceUrlWithMarkdown(sharedSubject));
|
||||||
getStreamFragment().setTextToBeShared("**" + escapedSubject + "** " + escapedBody);
|
AppLog.v(this, "Set shared text; Subject: \"" + escapedSubject + "\" Body: \"" + escapedBody + "\"");
|
||||||
|
textToBeShared = "**" + escapedSubject + "** " + escapedBody;
|
||||||
} else {
|
} else {
|
||||||
AppLog.v(this, "Set shared text; Subject: \"" + sharedSubject + "\" Body: \"" + sharedBody + "\"");
|
AppLog.v(this, "Set shared text; Subject: \"" + sharedSubject + "\" Body: \"" + sharedBody + "\"");
|
||||||
getStreamFragment().setTextToBeShared(escapedBody);
|
textToBeShared = escapedBody;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Implement?
|
/**
|
||||||
|
* Share an image shared to the app via diaspora
|
||||||
|
*
|
||||||
|
* @param intent shareImageIntent
|
||||||
|
*/
|
||||||
|
//TODO: Implement some day
|
||||||
private void handleSendImage(Intent intent) {
|
private void handleSendImage(Intent intent) {
|
||||||
AppLog.i(this, "handleSendImage()");
|
AppLog.i(this, "handleSendImage()");
|
||||||
final Uri imageUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
final Uri imageUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
if (imageUri != null) {
|
if (imageUri != null) {
|
||||||
AppLog.v(this, "imageUri is not null. Handle shared image");
|
AppLog.v(this, "imageUri is not null. Handle shared image");
|
||||||
// TODO: Update UI to reflect text being shared
|
|
||||||
} else {
|
} else {
|
||||||
AppLog.w(this, "imageUri is null. Cannot precede.");
|
AppLog.w(this, "imageUri is null. Cannot precede.");
|
||||||
}
|
}
|
||||||
Toast.makeText(this, "Not yet implemented.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Not yet implemented.", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalidate the top toolbar to update the notification counter
|
||||||
|
*
|
||||||
|
* @param notificationCount new notification count
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onNotificationCountChanged(int notificationCount) {
|
public void onNotificationCountChanged(int notificationCount) {
|
||||||
AppLog.i(this, "onNotificationCountChanged()");
|
AppLog.i(this, "onNotificationCountChanged()");
|
||||||
|
@ -672,6 +826,11 @@ public class MainActivity extends AppCompatActivity
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalidate the top toolbar to update the unread messages counter
|
||||||
|
*
|
||||||
|
* @param unreadMessageCount new unread messages count
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onUnreadMessageCountChanged(int unreadMessageCount) {
|
public void onUnreadMessageCountChanged(int unreadMessageCount) {
|
||||||
AppLog.i(this, "onUnreadMessageCountChanged()");
|
AppLog.i(this, "onUnreadMessageCountChanged()");
|
||||||
|
@ -681,8 +840,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCustomTabsConnected() {
|
public void onCustomTabsConnected() {
|
||||||
if(customTabsSession == null) {
|
if (customTabsSession == null) {
|
||||||
AppLog.i(this, "CustomTabs warmup: "+customTabActivityHelper.warmup(0));
|
AppLog.i(this, "CustomTabs warmup: " + customTabActivityHelper.warmup(0));
|
||||||
customTabsSession = customTabActivityHelper.getSession();
|
customTabsSession = customTabActivityHelper.getSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -716,23 +875,17 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//TODO: Replace with fragment
|
|
||||||
case R.id.nav_followed_tags: {
|
case R.id.nav_followed_tags: {
|
||||||
if (WebHelper.isOnline(MainActivity.this)) {
|
showFragment(getFragment(HashtagListFragment.TAG));
|
||||||
openDiasporaUrl(urls.getBlankUrl());
|
|
||||||
WebHelper.showFollowedTagsList(getStreamFragment().getWebView(), app);
|
|
||||||
setTitle(R.string.nav_followed_tags);
|
|
||||||
} else {
|
|
||||||
snackbarNoInternet.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//TODO: Replace with fragment
|
//TODO: Replace with fragment
|
||||||
case R.id.nav_aspects: {
|
case R.id.nav_aspects: {
|
||||||
|
DiasporaStreamFragment stream = (DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG);
|
||||||
if (WebHelper.isOnline(MainActivity.this)) {
|
if (WebHelper.isOnline(MainActivity.this)) {
|
||||||
openDiasporaUrl(DiasporaUrlHelper.URL_BLANK);
|
openDiasporaUrl(DiasporaUrlHelper.URL_BLANK);
|
||||||
WebHelper.showAspectList(getStreamFragment().getWebView(), app);
|
WebHelper.showAspectList(stream.getWebView(), app);
|
||||||
setTitle(R.string.aspects);
|
setTitle(R.string.aspects);
|
||||||
} else {
|
} else {
|
||||||
snackbarNoInternet.show();
|
snackbarNoInternet.show();
|
||||||
|
@ -796,7 +949,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.nav_help_license: {
|
case R.id.nav_about: {
|
||||||
startActivity(new Intent(MainActivity.this, AboutActivity.class));
|
startActivity(new Intent(MainActivity.this, AboutActivity.class));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -806,6 +959,13 @@ public class MainActivity extends AppCompatActivity
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* React to results of requestPermission
|
||||||
|
*
|
||||||
|
* @param requestCode resCode
|
||||||
|
* @param permissions requested permissions
|
||||||
|
* @param grantResults granted results
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
|
@ -824,4 +984,47 @@ public class MainActivity extends AppCompatActivity
|
||||||
grantResults);
|
grantResults);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the string that will be shared into the new-post-editor
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public String getTextToBeShared() {
|
||||||
|
return textToBeShared;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the string that will be shared into the new-post-editor
|
||||||
|
*
|
||||||
|
* @param textToBeShared
|
||||||
|
*/
|
||||||
|
public void setTextToBeShared(String textToBeShared) {
|
||||||
|
this.textToBeShared = textToBeShared;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyColorToViews() {
|
||||||
|
ThemeHelper.updateToolbarColor(toolbarTop);
|
||||||
|
ThemeHelper.updateActionMenuViewColor(toolbarBottom);
|
||||||
|
navDrawerLayout.setBackgroundColor(appSettings.getPrimaryColor());
|
||||||
|
navProfilePictureArea.setBackgroundColor(appSettings.getPrimaryColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableToolbarHiding() {
|
||||||
|
AppLog.d(this, "Enable Intellihide");
|
||||||
|
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarTop.getLayoutParams();
|
||||||
|
//scroll|enterAlways|snap
|
||||||
|
params.setScrollFlags(toolbarDefaultScrollFlags);
|
||||||
|
appBarLayout.setExpanded(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableToolbarHiding() {
|
||||||
|
AppLog.d(this, "Disable Intellihide");
|
||||||
|
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarTop.getLayoutParams();
|
||||||
|
params.setScrollFlags(0); // clear all scroll flags
|
||||||
|
appBarLayout.setExpanded(true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,83 @@
|
||||||
/*
|
/*
|
||||||
This file is part of the Diaspora for Android.
|
This file is part of the Diaspora for Android.
|
||||||
|
|
||||||
Diaspora for Android is free software: you can redistribute it and/or modify
|
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
|
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,
|
Diaspora for Android 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 Diaspora for Android.
|
||||||
|
|
||||||
If not, see <http://www.gnu.org/licenses/>.
|
If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.github.dfa.diaspora_android.activity;
|
package com.github.dfa.diaspora_android.activity;
|
||||||
|
|
||||||
|
import android.app.AlarmManager;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.EditTextPreference;
|
import android.preference.EditTextPreference;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.design.widget.AppBarLayout;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
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.AppSettings;
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener;
|
||||||
|
import com.github.dfa.diaspora_android.util.theming.ColorPalette;
|
||||||
|
import com.github.dfa.diaspora_android.util.ProxyHandler;
|
||||||
import com.github.dfa.diaspora_android.util.AppLog;
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
|
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import uz.shift.colorpicker.LineColorPicker;
|
||||||
|
import uz.shift.colorpicker.OnColorChangedListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author vanitas
|
* @author vanitas
|
||||||
*/
|
*/
|
||||||
public class SettingsActivity extends AppCompatActivity {
|
public class SettingsActivity extends ThemedActivity implements IntellihideToolbarActivityListener {
|
||||||
private boolean activityRestartRequired;
|
@BindView(R.id.settings__appbar)
|
||||||
|
protected AppBarLayout appBarLayout;
|
||||||
|
|
||||||
|
@BindView(R.id.settings__toolbar)
|
||||||
|
protected Toolbar toolbar;
|
||||||
|
|
||||||
|
private ProxyHandler.ProxySettings oldProxySettings;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
ActionBar toolbar = getSupportActionBar();
|
setContentView(R.layout.settings__activity);
|
||||||
if (toolbar != null)
|
ButterKnife.bind(this);
|
||||||
toolbar.setDisplayHomeAsUpEnabled(true);
|
setSupportActionBar(toolbar);
|
||||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
|
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
|
||||||
|
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
SettingsActivity.this.onBackPressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
oldProxySettings = getAppSettings().getProxySettings();
|
||||||
|
getFragmentManager().beginTransaction().replace(R.id.settings__fragment_container, new SettingsFragment()).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,8 +91,26 @@ public class SettingsActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setActivityRestartRequired() {
|
@Override
|
||||||
this.activityRestartRequired = true;
|
protected void applyColorToViews() {
|
||||||
|
ThemeHelper.updateToolbarColor(toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableToolbarHiding() {
|
||||||
|
AppLog.d(this, "Enable Intellihide");
|
||||||
|
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
|
||||||
|
//scroll|enterAlways|snap
|
||||||
|
params.setScrollFlags(toolbarDefaultScrollFlags);
|
||||||
|
appBarLayout.setExpanded(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableToolbarHiding() {
|
||||||
|
AppLog.d(this, "Disable Intellihide");
|
||||||
|
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
|
||||||
|
params.setScrollFlags(0); // clear all scroll flags
|
||||||
|
appBarLayout.setExpanded(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
@ -78,12 +124,12 @@ public class SettingsActivity extends AppCompatActivity {
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this);
|
sharedPreferences.registerOnSharedPreferenceChangeListener(this);
|
||||||
setPreferenceSummaries();
|
setPreferenceSummaries();
|
||||||
sharedPreferences.edit().putBoolean(getString(R.string.pref_key__proxy_was_enabled),
|
sharedPreferences.edit().putBoolean(getString(R.string.pref_key__proxy_was_enabled),
|
||||||
sharedPreferences.getBoolean(getString(R.string.pref_key__proxy_enabled), false)).apply();
|
sharedPreferences.getBoolean(getString(R.string.pref_key__http_proxy_enabled), false)).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPreferenceSummaries() {
|
private void setPreferenceSummaries() {
|
||||||
String[] editTextKeys = new String[]{
|
String[] editTextKeys = new String[]{
|
||||||
getString(R.string.pref_key__proxy_host), getString(R.string.pref_key__proxy_port)
|
getString(R.string.pref_key__http_proxy_host), getString(R.string.pref_key__http_proxy_port)
|
||||||
};
|
};
|
||||||
for (String key : editTextKeys) {
|
for (String key : editTextKeys) {
|
||||||
EditTextPreference p = (EditTextPreference) findPreference(key);
|
EditTextPreference p = (EditTextPreference) findPreference(key);
|
||||||
|
@ -94,15 +140,12 @@ public class SettingsActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
updatePreference(findPreference(key));
|
updatePreference(findPreference(key));
|
||||||
if (key != null && isAdded() && (key.equals(getString(R.string.pref_key__clear_cache)) ||
|
if(key.equals(getString(R.string.pref_key__intellihide_toolbars))) {
|
||||||
key.equals(getString(R.string.pref_key__font_size)) ||
|
if(sharedPreferences.getBoolean(getString(R.string.pref_key__intellihide_toolbars), false)) {
|
||||||
key.equals(getString(R.string.pref_key__load_images)) ||
|
((SettingsActivity)getActivity()).enableToolbarHiding();
|
||||||
key.equals(getString(R.string.pref_key__intellihide_toolbars)) ||
|
} else {
|
||||||
key.equals(getString(R.string.pref_key__proxy_enabled)) ||
|
((SettingsActivity)getActivity()).disableToolbarHiding();
|
||||||
key.equals(getString(R.string.pref_key__proxy_host)) ||
|
}
|
||||||
key.equals(getString(R.string.pref_key__proxy_port)) ||
|
|
||||||
key.startsWith("pref_key__visibility_nav__"))) {
|
|
||||||
((SettingsActivity) getActivity()).setActivityRestartRequired();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,9 +166,31 @@ public class SettingsActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
|
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
|
||||||
|
App app = ((App) getActivity().getApplication());
|
||||||
|
AppSettings appSettings = app.getSettings();
|
||||||
|
if(Build.VERSION.SDK_INT >= 21) {
|
||||||
|
if (preference instanceof PreferenceScreen && ((PreferenceScreen) preference).getDialog() != null) {
|
||||||
|
Window window = ((PreferenceScreen) preference).getDialog().getWindow();
|
||||||
|
if (window != null) {
|
||||||
|
window.setStatusBarColor(ThemeHelper.getPrimaryDarkColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(getActivity(), MainActivity.class);
|
Intent intent = new Intent(getActivity(), MainActivity.class);
|
||||||
String podDomain = ((App) getActivity().getApplication()).getSettings().getPodDomain();
|
String podDomain = appSettings.getPodDomain();
|
||||||
|
|
||||||
switch (preference.getTitleRes()) {
|
switch (preference.getTitleRes()) {
|
||||||
|
case R.string.pref_title__primary_color: {
|
||||||
|
showColorPickerDialog(1);
|
||||||
|
intent = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case R.string.pref_title__accent_color: {
|
||||||
|
showColorPickerDialog(2);
|
||||||
|
intent = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case R.string.pref_title__personal_settings: {
|
case R.string.pref_title__personal_settings: {
|
||||||
intent.setAction(MainActivity.ACTION_OPEN_URL);
|
intent.setAction(MainActivity.ACTION_OPEN_URL);
|
||||||
intent.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/user/edit");
|
intent.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/user/edit");
|
||||||
|
@ -158,6 +223,17 @@ public class SettingsActivity extends AppCompatActivity {
|
||||||
.show();
|
.show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
case R.string.pref_title__http_proxy_load_tor_preset: {
|
||||||
|
((EditTextPreference) findPreference(getString(R.string.pref_key__http_proxy_host))).setText("127.0.0.1");
|
||||||
|
((EditTextPreference) findPreference(getString(R.string.pref_key__http_proxy_port))).setText("8118");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
case R.string.pref_title__clear_cache:
|
||||||
|
{
|
||||||
|
intent.setAction(MainActivity.ACTION_CLEAR_CACHE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
intent = null;
|
intent = null;
|
||||||
|
@ -171,6 +247,71 @@ public class SettingsActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
return super.onPreferenceTreeClick(screen, preference);
|
return super.onPreferenceTreeClick(screen, preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a colorPicker Dialog
|
||||||
|
* @param type 1 -> Primary Color, 2 -> Accent Color
|
||||||
|
*/
|
||||||
|
public void showColorPickerDialog(final int type) {
|
||||||
|
final AppSettings appSettings = ((App)getActivity().getApplication()).getSettings();
|
||||||
|
final Context context = getActivity();
|
||||||
|
|
||||||
|
//Inflate dialog layout
|
||||||
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
|
View dialogLayout = inflater.inflate(R.layout.color_picker__dialog, null);
|
||||||
|
final android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(context);
|
||||||
|
builder.setView(dialogLayout);
|
||||||
|
|
||||||
|
final FrameLayout titleBackground = (FrameLayout) dialogLayout.findViewById(R.id.color_picker_dialog__title_background);
|
||||||
|
final TextView title = (TextView) dialogLayout.findViewById(R.id.color_picker_dialog__title);
|
||||||
|
final LineColorPicker base = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_dialog__base_picker);
|
||||||
|
final LineColorPicker shade = (LineColorPicker) 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.setTextColor(getResources().getColor(R.color.white));
|
||||||
|
final int[] current = (type == 1 ? appSettings.getPrimaryColorSettings() : appSettings.getAccentColorSettings());
|
||||||
|
base.setColors((type == 1 ? ColorPalette.getBaseColors(context) : ColorPalette.getAccentColors(context)));
|
||||||
|
base.setSelectedColor(current[0]);
|
||||||
|
shade.setColors(ColorPalette.getColors(context, current[0]));
|
||||||
|
shade.setSelectedColor(current[1]);
|
||||||
|
titleBackground.setBackgroundColor(shade.getColor());
|
||||||
|
base.setOnColorChangedListener(new OnColorChangedListener() {
|
||||||
|
@Override
|
||||||
|
public void onColorChanged(int i) {
|
||||||
|
AppLog.d(this, "Selected Base color changed: "+i);
|
||||||
|
shade.setColors(ColorPalette.getColors(context, i));
|
||||||
|
titleBackground.setBackgroundColor(i);
|
||||||
|
if(i == current[0]) {
|
||||||
|
shade.setSelectedColor(current[1]);
|
||||||
|
titleBackground.setBackgroundColor(shade.getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
shade.setOnColorChangedListener(new OnColorChangedListener() {
|
||||||
|
@Override
|
||||||
|
public void onColorChanged(int i) {
|
||||||
|
titleBackground.setBackgroundColor(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Build dialog
|
||||||
|
builder
|
||||||
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
if(type == 1) {
|
||||||
|
appSettings.setPrimaryColorSettings(base.getColor(), shade.getColor());
|
||||||
|
if(Build.VERSION.SDK_INT >= 21) {
|
||||||
|
getActivity().getWindow().setStatusBarColor(ThemeHelper.getPrimaryDarkColor());
|
||||||
|
}
|
||||||
|
((ThemedActivity)getActivity()).applyColorToViews();
|
||||||
|
} else {
|
||||||
|
appSettings.setAccentColorSettings(base.getColor(), shade.getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -185,11 +326,21 @@ public class SettingsActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
ProxyHandler.ProxySettings newProxySettings = getAppSettings().getProxySettings();
|
||||||
if (activityRestartRequired) {
|
if(!oldProxySettings.equals(newProxySettings)) {
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
AppLog.d(this, "ProxySettings changed.");
|
||||||
intent.setAction(MainActivity.ACTION_RELOAD_ACTIVITY);
|
//Proxy on-off? => Restart app
|
||||||
startActivity(intent);
|
if(oldProxySettings.isEnabled() && !newProxySettings.isEnabled()) {
|
||||||
|
Intent restartActivity = new Intent(SettingsActivity.this, MainActivity.class);
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getActivity(SettingsActivity.this, 12374, restartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
|
AlarmManager mgr = (AlarmManager) SettingsActivity.this.getSystemService(Context.ALARM_SERVICE);
|
||||||
|
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, pendingIntent);
|
||||||
|
System.exit(0);
|
||||||
|
} //Proxy changed? => Update
|
||||||
|
else {
|
||||||
|
ProxyHandler.getInstance().updateProxySettings(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,56 +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.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import com.github.dfa.diaspora_android.App;
|
|
||||||
import com.github.dfa.diaspora_android.R;
|
|
||||||
import com.github.dfa.diaspora_android.util.Helpers;
|
|
||||||
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
|
|
||||||
|
|
||||||
public class SplashActivity extends AppCompatActivity {
|
|
||||||
private App app;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.splash__activity);
|
|
||||||
ButterKnife.bind(this);
|
|
||||||
app = (App) getApplication();
|
|
||||||
|
|
||||||
int delay = getResources().getInteger(R.integer.splash_delay);
|
|
||||||
new Handler().postDelayed(startActivityRunnable, delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Runnable startActivityRunnable = new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
boolean hasPodDomain = app.getSettings().hasPodDomain();
|
|
||||||
Helpers.animateToActivity(SplashActivity.this,
|
|
||||||
hasPodDomain ? MainActivity.class : PodSelectionActivity.class,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
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.annotation.TargetApi;
|
||||||
|
import android.app.ActivityManager;
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.github.dfa.diaspora_android.App;
|
||||||
|
import com.github.dfa.diaspora_android.R;
|
||||||
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity that supports color schemes
|
||||||
|
* Created by vanitas on 06.10.16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class ThemedActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
protected AppSettings getAppSettings() {
|
||||||
|
return ((App)getApplication()).getSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
ThemeHelper.getInstance(getAppSettings());
|
||||||
|
updateStatusBarColor();
|
||||||
|
updateRecentAppColor();
|
||||||
|
applyColorToViews();
|
||||||
|
}
|
||||||
|
protected abstract void applyColorToViews();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update color of the status bar
|
||||||
|
*/
|
||||||
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
private void updateStatusBarColor() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
getWindow().setStatusBarColor(ThemeHelper.getPrimaryDarkColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update primary color in recent apps overview
|
||||||
|
*/
|
||||||
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
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(
|
||||||
|
getResources().getString(R.string.app_name),
|
||||||
|
drawable.getBitmap(),
|
||||||
|
getAppSettings().getPrimaryColor()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +1,15 @@
|
||||||
/*
|
/*
|
||||||
This file is part of the Diaspora for Android.
|
This file is part of the Diaspora for Android.
|
||||||
|
|
||||||
Diaspora for Android is free software: you can redistribute it and/or modify
|
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
|
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,
|
Diaspora for Android 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 Diaspora for Android.
|
||||||
|
|
||||||
If not, see <http://www.gnu.org/licenses/>.
|
If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.github.dfa.diaspora_android.data;
|
package com.github.dfa.diaspora_android.data;
|
||||||
|
@ -23,6 +19,7 @@ import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
import com.github.dfa.diaspora_android.R;
|
import com.github.dfa.diaspora_android.R;
|
||||||
|
import com.github.dfa.diaspora_android.util.ProxyHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings
|
* Settings
|
||||||
|
@ -202,7 +199,7 @@ public class AppSettings {
|
||||||
@SuppressLint("CommitPrefEdits")
|
@SuppressLint("CommitPrefEdits")
|
||||||
public void setProxyEnabled(boolean enabled) {
|
public void setProxyEnabled(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__proxy_enabled), enabled).commit();
|
prefApp.edit().putBoolean(context.getString(R.string.pref_key__http_proxy_enabled), enabled).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -211,7 +208,7 @@ public class AppSettings {
|
||||||
* @return whether proxy is enabled or not
|
* @return whether proxy is enabled or not
|
||||||
*/
|
*/
|
||||||
public boolean isProxyEnabled() {
|
public boolean isProxyEnabled() {
|
||||||
return getBoolean(prefApp, R.string.pref_key__proxy_enabled, false);
|
return getBoolean(prefApp, R.string.pref_key__http_proxy_enabled, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean wasProxyEnabled() {
|
public boolean wasProxyEnabled() {
|
||||||
|
@ -235,9 +232,12 @@ public class AppSettings {
|
||||||
* @return proxy host
|
* @return proxy host
|
||||||
*/
|
*/
|
||||||
public String getProxyHost() {
|
public String getProxyHost() {
|
||||||
return getString(prefApp, R.string.pref_key__proxy_host, "");
|
return getString(prefApp, R.string.pref_key__http_proxy_host, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProxyHttpHost(String value) {
|
||||||
|
setString(prefApp, R.string.pref_key__http_proxy_host, value);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Default value: 0
|
* Default value: 0
|
||||||
*
|
*
|
||||||
|
@ -245,13 +245,21 @@ public class AppSettings {
|
||||||
*/
|
*/
|
||||||
public int getProxyPort() {
|
public int getProxyPort() {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(getString(prefApp, R.string.pref_key__proxy_port, "0"));
|
return Integer.parseInt(getString(prefApp, R.string.pref_key__http_proxy_port, "0"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
setString(prefApp, R.string.pref_key__proxy_port, "0");
|
setString(prefApp, R.string.pref_key__http_proxy_port, "0");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProxyHttpPort(int value) {
|
||||||
|
setInt(prefApp, R.string.pref_key__http_proxy_port, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProxyHandler.ProxySettings getProxySettings() {
|
||||||
|
return new ProxyHandler.ProxySettings(isProxyEnabled(), getProxyHost(), getProxyPort());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isIntellihideToolbars() {
|
public boolean isIntellihideToolbars() {
|
||||||
return getBoolean(prefApp, R.string.pref_key__intellihide_toolbars, false);
|
return getBoolean(prefApp, R.string.pref_key__intellihide_toolbars, false);
|
||||||
}
|
}
|
||||||
|
@ -307,4 +315,36 @@ public class AppSettings {
|
||||||
public boolean isVisibleInNavProfile() {
|
public boolean isVisibleInNavProfile() {
|
||||||
return getBoolean(prefApp, R.string.pref_key__visibility_nav__profile, false);
|
return getBoolean(prefApp, R.string.pref_key__visibility_nav__profile, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPrimaryColorSettings(int base, int shade) {
|
||||||
|
setInt(prefApp, R.string.pref_key__primary_color_base, base);
|
||||||
|
setInt(prefApp, R.string.pref_key__primary_color_shade, shade);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getPrimaryColorSettings() {
|
||||||
|
return new int[]{
|
||||||
|
getInt(prefApp, R.string.pref_key__primary_color_base, context.getResources().getColor(R.color.md_blue_500)),
|
||||||
|
getInt(prefApp, R.string.pref_key__primary_color_shade, context.getResources().getColor(R.color.primary))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPrimaryColor() {
|
||||||
|
return getInt(prefApp, R.string.pref_key__primary_color_shade, context.getResources().getColor(R.color.primary));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccentColorSettings(int base, int shade) {
|
||||||
|
setInt(prefApp, R.string.pref_key__accent_color_base, base);
|
||||||
|
setInt(prefApp, R.string.pref_key__accent_color_shade, shade);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getAccentColorSettings() {
|
||||||
|
return new int[]{
|
||||||
|
getInt(prefApp, R.string.pref_key__accent_color_base, context.getResources().getColor(R.color.md_deep_orange_500)),
|
||||||
|
getInt(prefApp, R.string.pref_key__accent_color_shade, context.getResources().getColor(R.color.accent))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAccentColor() {
|
||||||
|
return getInt(prefApp, R.string.pref_key__accent_color_shade, context.getResources().getColor(R.color.accent));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,24 @@
|
||||||
|
/*
|
||||||
|
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.fragment;
|
package com.github.dfa.diaspora_android.fragment;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.AlarmManager;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Context;
|
|
||||||
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;
|
||||||
|
@ -11,23 +26,27 @@ import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.StrictMode;
|
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v7.app.AlertDialog;
|
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.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
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.activity.MainActivity;
|
import com.github.dfa.diaspora_android.activity.MainActivity;
|
||||||
import com.github.dfa.diaspora_android.data.AppSettings;
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
import com.github.dfa.diaspora_android.util.ProxyHandler;
|
||||||
import com.github.dfa.diaspora_android.ui.ContextMenuWebView;
|
import com.github.dfa.diaspora_android.ui.ContextMenuWebView;
|
||||||
import com.github.dfa.diaspora_android.ui.CustomWebViewClient;
|
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
|
||||||
import com.github.dfa.diaspora_android.util.AppLog;
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
|
import com.github.dfa.diaspora_android.webview.CustomWebViewClient;
|
||||||
|
import com.github.dfa.diaspora_android.webview.ProgressBarWebChromeClient;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -38,42 +57,73 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.guardianproject.netcipher.NetCipher;
|
|
||||||
import info.guardianproject.netcipher.webkit.WebkitProxy;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment that contains a WebView with a bunch of functionality
|
* Fragment with a webView and a ProgressBar.
|
||||||
* Created by vanitas on 21.09.16.
|
* This Fragment retains its instance.
|
||||||
|
* Created by vanitas on 26.09.16.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract class WebViewFragment extends CustomFragment {
|
public class BrowserFragment extends ThemedFragment {
|
||||||
|
public static final String TAG = "com.github.dfa.diaspora_android.BrowserFragment";
|
||||||
|
|
||||||
protected WebSettings webSettings;
|
protected View rootLayout;
|
||||||
protected WebViewClient webViewClient;
|
|
||||||
protected ContextMenuWebView webView;
|
protected ContextMenuWebView webView;
|
||||||
protected ProgressBar progressBar;
|
protected ProgressBar progressBar;
|
||||||
protected AppSettings appSettings;
|
protected AppSettings appSettings;
|
||||||
|
protected CustomWebViewClient webViewClient;
|
||||||
|
protected WebSettings webSettings;
|
||||||
|
|
||||||
|
protected String pendingUrl;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
AppLog.d(this, "onCreateView()");
|
||||||
|
if(rootLayout == null) {
|
||||||
|
rootLayout = inflater.inflate(R.layout.browser__fragment, container, false);
|
||||||
|
}
|
||||||
|
return rootLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
AppLog.d(this, "onViewCreated()");
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
if(this.appSettings == null) {
|
||||||
|
this.appSettings = ((App) getActivity().getApplication()).getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setup(ContextMenuWebView webView, final ProgressBar progressBar, AppSettings appSettings) {
|
if(this.webView == null) {
|
||||||
this.appSettings = appSettings;
|
this.webView = (ContextMenuWebView) view.findViewById(R.id.webView);
|
||||||
|
this.applyWebViewSettings();
|
||||||
|
ProxyHandler.getInstance().addWebView(webView);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.progressBar == null) {
|
||||||
|
this.progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pendingUrl != null) {
|
||||||
|
loadUrl(pendingUrl);
|
||||||
|
pendingUrl = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
webView.setParentActivity(getActivity());
|
||||||
|
|
||||||
|
this.setRetainInstance(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
|
||||||
|
if (getRetainInstance() && rootLayout.getParent() instanceof ViewGroup) {
|
||||||
|
((ViewGroup) rootLayout.getParent()).removeView(rootLayout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyWebViewSettings() {
|
||||||
this.webSettings = webView.getSettings();
|
this.webSettings = webView.getSettings();
|
||||||
this.webView = webView;
|
|
||||||
this.progressBar = progressBar;
|
|
||||||
|
|
||||||
if (appSettings.isProxyEnabled()) {
|
|
||||||
if (!setProxy(appSettings.getProxyHost(), appSettings.getProxyPort())) {
|
|
||||||
AppLog.e(this, "Could not enable Proxy");
|
|
||||||
Toast.makeText(getContext(), R.string.toast_set_proxy_failed, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
} else if (appSettings.wasProxyEnabled()) {
|
|
||||||
resetProxy();
|
|
||||||
}
|
|
||||||
|
|
||||||
webSettings.setJavaScriptEnabled(true);
|
|
||||||
webSettings.setAllowFileAccess(false);
|
webSettings.setAllowFileAccess(false);
|
||||||
webSettings.setUseWideViewPort(true);
|
webSettings.setUseWideViewPort(true);
|
||||||
webSettings.setLoadWithOverviewMode(true);
|
webSettings.setLoadWithOverviewMode(true);
|
||||||
|
@ -91,100 +141,18 @@ public abstract class WebViewFragment extends CustomFragment {
|
||||||
//webView.setParentActivity(this);
|
//webView.setParentActivity(this);
|
||||||
webView.setOverScrollMode(WebView.OVER_SCROLL_ALWAYS);
|
webView.setOverScrollMode(WebView.OVER_SCROLL_ALWAYS);
|
||||||
|
|
||||||
//Set proxy
|
|
||||||
if (appSettings.isProxyEnabled()) {
|
|
||||||
if (!setProxy(appSettings.getProxyHost(), appSettings.getProxyPort())) {
|
|
||||||
AppLog.d(this, "Could not enable Proxy");
|
|
||||||
Toast.makeText(getContext(), R.string.toast_set_proxy_failed, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
} else if (appSettings.wasProxyEnabled()) {
|
|
||||||
resetProxy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WebViewClient
|
|
||||||
*/
|
|
||||||
this.webViewClient = new CustomWebViewClient((App) getActivity().getApplication(), webView);
|
this.webViewClient = new CustomWebViewClient((App) getActivity().getApplication(), webView);
|
||||||
webView.setWebViewClient(webViewClient);
|
webView.setWebViewClient(webViewClient);
|
||||||
|
webView.setWebChromeClient(new ProgressBarWebChromeClient(webView, progressBar));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Set proxy according to arguments. host must not be "" or null, port must be positive.
|
public void onResume() {
|
||||||
* Return true on success and update appSettings' proxy related values.
|
super.onResume();
|
||||||
*
|
if(webView != null) {
|
||||||
* @param host proxy host (eg. localhost or 127.0.0.1)
|
webSettings.setMinimumFontSize(appSettings.getMinimumFontSize());
|
||||||
* @param port proxy port (eg. 8118)
|
webSettings.setLoadsImagesAutomatically(appSettings.isLoadImages());
|
||||||
* @return success
|
|
||||||
* @throws IllegalArgumentException if arguments do not fit specifications above
|
|
||||||
*/
|
|
||||||
private boolean setProxy(final String host, final int port) {
|
|
||||||
AppLog.i(this, "StreamFragment.setProxy()");
|
|
||||||
if (host != null && !host.equals("") && port >= 0) {
|
|
||||||
AppLog.i(this, "Set proxy to "+host+":"+port);
|
|
||||||
//Temporary change thread policy
|
|
||||||
AppLog.v(this, "Set temporary ThreadPolicy");
|
|
||||||
StrictMode.ThreadPolicy old = StrictMode.getThreadPolicy();
|
|
||||||
StrictMode.ThreadPolicy tmp = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
|
||||||
StrictMode.setThreadPolicy(tmp);
|
|
||||||
|
|
||||||
AppLog.v(this, "Apply NetCipher proxy settings");
|
|
||||||
NetCipher.setProxy(host, port); //Proxy for HttpsUrlConnections
|
|
||||||
try {
|
|
||||||
//Proxy for the webview
|
|
||||||
AppLog.v(this, "Apply Webkit proxy settings");
|
|
||||||
WebkitProxy.setProxy(MainActivity.class.getName(), getContext().getApplicationContext(), null, host, port);
|
|
||||||
} catch (Exception e) {
|
|
||||||
AppLog.e(this, "Could not apply WebKit proxy settings:\n"+e.toString());
|
|
||||||
}
|
}
|
||||||
AppLog.v(this, "Save changes in appSettings");
|
|
||||||
appSettings.setProxyEnabled(true);
|
|
||||||
appSettings.setProxyWasEnabled(true);
|
|
||||||
|
|
||||||
AppLog.v(this, "Reset old ThreadPolicy");
|
|
||||||
StrictMode.setThreadPolicy(old);
|
|
||||||
AppLog.i(this, "Success! Reload WebView");
|
|
||||||
webView.reload();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
AppLog.e(this, "Invalid proxy configuration. Host: "+host+" Port: "+port+"\nRefuse to set proxy");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean setProxy() {
|
|
||||||
return setProxy(appSettings.getProxyHost(), appSettings.getProxyPort());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resetProxy() {
|
|
||||||
AppLog.i(this, "StreamFragment.resetProxy()");
|
|
||||||
AppLog.v(this, "write changes to appSettings");
|
|
||||||
appSettings.setProxyEnabled(false);
|
|
||||||
appSettings.setProxyWasEnabled(false);
|
|
||||||
|
|
||||||
//Temporary change thread policy
|
|
||||||
AppLog.v(this, "Set temporary ThreadPolicy");
|
|
||||||
StrictMode.ThreadPolicy old = StrictMode.getThreadPolicy();
|
|
||||||
StrictMode.ThreadPolicy tmp = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
|
||||||
StrictMode.setThreadPolicy(tmp);
|
|
||||||
|
|
||||||
AppLog.v(this, "clear NetCipher proxy");
|
|
||||||
NetCipher.clearProxy();
|
|
||||||
try {
|
|
||||||
AppLog.v(this, "clear WebKit proxy");
|
|
||||||
WebkitProxy.resetProxy(MainActivity.class.getName(), getContext());
|
|
||||||
} catch (Exception e) {
|
|
||||||
AppLog.e(this, "Could not clear WebKit proxy:\n"+e.toString());
|
|
||||||
}
|
|
||||||
AppLog.v(this, "Reset old ThreadPolicy");
|
|
||||||
StrictMode.setThreadPolicy(old);
|
|
||||||
|
|
||||||
//Restart app
|
|
||||||
AppLog.i(this, "Success! Restart app due to proxy reset");
|
|
||||||
Intent restartActivity = new Intent(getContext(), MainActivity.class);
|
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), 12374, restartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
|
|
||||||
AlarmManager mgr = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
|
|
||||||
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, pendingIntent);
|
|
||||||
System.exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
|
@ -270,6 +238,15 @@ public abstract class WebViewFragment extends CustomFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public String getFragmentTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
/* Nothing to do here */
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onBackPressed() {
|
public boolean onBackPressed() {
|
||||||
if(webView.canGoBack()) {
|
if(webView.canGoBack()) {
|
||||||
webView.goBack();
|
webView.goBack();
|
||||||
|
@ -279,20 +256,36 @@ public abstract class WebViewFragment extends CustomFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadUrl(String url) {
|
public void loadUrl(String url) {
|
||||||
AppLog.v(this, "loadUrl("+url+")");
|
if(getWebView() != null) {
|
||||||
|
AppLog.v(this, "loadUrl(): load "+url);
|
||||||
getWebView().loadUrlNew(url);
|
getWebView().loadUrlNew(url);
|
||||||
|
} else {
|
||||||
|
AppLog.v(this, "loadUrl(): WebView null: Set pending url to "+url);
|
||||||
|
pendingUrl = url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
|
if(getWebView() != null) {
|
||||||
return getWebView().getUrl();
|
return getWebView().getUrl();
|
||||||
|
} else {
|
||||||
|
return pendingUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadUrl() {
|
public void reloadUrl() {
|
||||||
AppLog.v(this, "reloadUrl()");
|
AppLog.v(this, "reloadUrl()");
|
||||||
|
if(getWebView() != null) {
|
||||||
getWebView().reload();
|
getWebView().reload();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ContextMenuWebView getWebView() {
|
public ContextMenuWebView getWebView() {
|
||||||
return this.webView;
|
return this.webView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyColorToViews() {
|
||||||
|
ThemeHelper.updateProgressBarColor(progressBar);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
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.fragment;
|
package com.github.dfa.diaspora_android.fragment;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -12,6 +30,8 @@ import android.view.MenuInflater;
|
||||||
|
|
||||||
public abstract class CustomFragment extends Fragment {
|
public abstract class CustomFragment extends Fragment {
|
||||||
|
|
||||||
|
public static final String TAG = "com.github.dfa.diaspora_android.CustomFragment";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We have an optionsMenu
|
* We have an optionsMenu
|
||||||
* @param savedInstanceState state
|
* @param savedInstanceState state
|
||||||
|
|
|
@ -1,7 +1,26 @@
|
||||||
|
/*
|
||||||
|
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.fragment;
|
package com.github.dfa.diaspora_android.fragment;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -12,23 +31,21 @@ 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.v7.app.AlertDialog;
|
||||||
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;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.webkit.JavascriptInterface;
|
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.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.activity.MainActivity;
|
||||||
import com.github.dfa.diaspora_android.data.PodUserProfile;
|
import com.github.dfa.diaspora_android.data.PodUserProfile;
|
||||||
import com.github.dfa.diaspora_android.ui.ContextMenuWebView;
|
import com.github.dfa.diaspora_android.webview.DiasporaStreamWebChromeClient;
|
||||||
|
import com.github.dfa.diaspora_android.webview.FileUploadWebChromeClient;
|
||||||
import com.github.dfa.diaspora_android.util.AppLog;
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
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.util.Helpers;
|
||||||
|
@ -40,161 +57,33 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment that contains a WebView displaying the stream of the user
|
* Fragment that displays the Stream of the diaspora* user
|
||||||
* Created by vanitas on 21.09.16.
|
* Created by vanitas on 26.09.16.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class StreamFragment extends WebViewFragment {
|
public class DiasporaStreamFragment extends BrowserFragment {
|
||||||
public static final String TAG = "com.github.dfa.diaspora_android.StreamFragment";
|
public static final String TAG = "com.github.dfa.diaspora_android.StreamFragment";
|
||||||
|
|
||||||
private DiasporaUrlHelper urls;
|
protected DiasporaUrlHelper urls;
|
||||||
|
|
||||||
private ValueCallback<Uri[]> imageUploadFilePathCallbackNew;
|
private ValueCallback<Uri[]> imageUploadFilePathCallbackNew;
|
||||||
private ValueCallback<Uri> imageUploadFilePathCallbackOld;
|
private ValueCallback<Uri> imageUploadFilePathCallbackOld;
|
||||||
private String mCameraPhotoPath;
|
private String mCameraPhotoPath;
|
||||||
protected String textToBeShared;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
AppLog.d(this, "onCreateView()");
|
|
||||||
return inflater.inflate(R.layout.stream__fragment, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
AppLog.d(this, "onViewCreated()");
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
this.webView = (ContextMenuWebView) view.findViewById(R.id.webView);
|
|
||||||
this.progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
|
|
||||||
this.appSettings = ((App) getActivity().getApplication()).getSettings();
|
|
||||||
this.urls = new DiasporaUrlHelper(appSettings);
|
this.urls = new DiasporaUrlHelper(appSettings);
|
||||||
|
webView.setWebChromeClient(new DiasporaStreamWebChromeClient(webView, progressBar, fileUploadCallback, sharedTextCallback));
|
||||||
|
|
||||||
this.setup(
|
webView.getSettings().setJavaScriptEnabled(true);
|
||||||
webView,
|
|
||||||
progressBar,
|
|
||||||
appSettings);
|
|
||||||
|
|
||||||
// Setup WebView
|
|
||||||
webView.addJavascriptInterface(new JavaScriptInterface(), "AndroidBridge");
|
webView.addJavascriptInterface(new JavaScriptInterface(), "AndroidBridge");
|
||||||
|
if(((MainActivity)getActivity()).getTextToBeShared() != null) {
|
||||||
if(webView.getUrl() == null) {
|
loadUrl(urls.getNewPostUrl());
|
||||||
loadUrl(urls.getPodUrl());
|
} else if(webView.getUrl() == null) {
|
||||||
|
loadUrl(urls.getStreamUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set WebChromeClient
|
|
||||||
webView.setWebChromeClient(new WebChromeClient() {
|
|
||||||
final ProgressBar pb = progressBar;
|
|
||||||
|
|
||||||
public void onProgressChanged(WebView wv, int progress) {
|
|
||||||
pb.setProgress(progress);
|
|
||||||
|
|
||||||
if (progress > 0 && progress <= 60) {
|
|
||||||
WebHelper.getUserProfile(wv);
|
|
||||||
WebHelper.optimizeMobileSiteLayout(wv);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (progress > 60) {
|
|
||||||
WebHelper.optimizeMobileSiteLayout(wv);
|
|
||||||
|
|
||||||
if (textToBeShared != null) {
|
|
||||||
AppLog.d(this, "Share text into webView");
|
|
||||||
WebHelper.shareTextIntoWebView(wv, textToBeShared);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
progressBar.setVisibility(progress == 100 ? View.GONE : View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//For Android 4.1/4.2 only. DO NOT REMOVE!
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
|
|
||||||
{
|
|
||||||
AppLog.v(this, "openFileChooser(ValCallback<Uri>, String, String");
|
|
||||||
//imageUploadFilePathCallbackOld = uploadMsg;
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setType("image/*");
|
|
||||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
|
||||||
intent.putExtra("return-data", true);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
||||||
AppLog.v(this, "startActivityForResult");
|
|
||||||
startActivityForResult(Intent.createChooser(intent, "Select Picture"), MainActivity.INPUT_FILE_REQUEST_CODE_OLD);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
|
|
||||||
if(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_image)
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AppLog.d(this, "onOpenFileChooser");
|
|
||||||
if (imageUploadFilePathCallbackNew != null) imageUploadFilePathCallbackNew.onReceiveValue(null);
|
|
||||||
imageUploadFilePathCallbackNew = filePathCallback;
|
|
||||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
|
||||||
if (takePictureIntent.resolveActivity(getContext().getPackageManager()) != null) {
|
|
||||||
// Create the File where the photo should go
|
|
||||||
File photoFile;
|
|
||||||
try {
|
|
||||||
photoFile = Helpers.createImageFile();
|
|
||||||
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
AppLog.e(this, "ERROR creating temp file: "+ ex.toString());
|
|
||||||
// Error occurred while creating the File
|
|
||||||
Snackbar.make(webView, R.string.unable_to_load_image, Snackbar.LENGTH_LONG).show();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Continue only if the File was successfully created
|
|
||||||
if (photoFile != null) {
|
|
||||||
mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
|
|
||||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
|
|
||||||
Uri.fromFile(photoFile));
|
|
||||||
} else {
|
|
||||||
takePictureIntent = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
||||||
contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
|
|
||||||
contentSelectionIntent.setType("image/*");
|
|
||||||
Intent[] intentArray;
|
|
||||||
if (takePictureIntent != null) {
|
|
||||||
intentArray = new Intent[]{takePictureIntent};
|
|
||||||
} else {
|
|
||||||
intentArray = new Intent[0];
|
|
||||||
}
|
|
||||||
Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
|
|
||||||
AppLog.d(this, "startActivityForResult");
|
|
||||||
startActivityForResult(chooserIntent, MainActivity.INPUT_FILE_REQUEST_CODE_NEW);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.setRetainInstance(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFragmentTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
@ -213,7 +102,7 @@ public class StreamFragment extends WebViewFragment {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case MainActivity.INPUT_FILE_REQUEST_CODE_NEW:
|
case MainActivity.INPUT_FILE_REQUEST_CODE_NEW:
|
||||||
case MainActivity.INPUT_FILE_REQUEST_CODE_OLD:
|
case MainActivity.INPUT_FILE_REQUEST_CODE_OLD:
|
||||||
AppLog.d(this, "INPUT_FILE_REQUEST_CODE: "+requestCode);
|
AppLog.v(this, "INPUT_FILE_REQUEST_CODE: "+requestCode);
|
||||||
onImageUploadResult(requestCode, resultCode, data);
|
onImageUploadResult(requestCode, resultCode, data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -267,16 +156,6 @@ public class StreamFragment extends WebViewFragment {
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ContextMenuWebView getWebView() {
|
|
||||||
AppLog.d(this, "getWebView: "+(this.webView != null));
|
|
||||||
return this.webView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTextToBeShared(String text) {
|
|
||||||
this.textToBeShared = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onImageUploadResult(int requestCode, int resultCode, Intent data) {
|
public void onImageUploadResult(int requestCode, int resultCode, Intent data) {
|
||||||
AppLog.d(this, "onImageUploadResult");
|
AppLog.d(this, "onImageUploadResult");
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
|
@ -344,7 +223,102 @@ public class StreamFragment extends WebViewFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected DiasporaStreamWebChromeClient.SharedTextCallback sharedTextCallback = new DiasporaStreamWebChromeClient.SharedTextCallback() {
|
||||||
|
@Override
|
||||||
|
public String getSharedText() {
|
||||||
|
return ((MainActivity)getActivity()).getTextToBeShared();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setSharedText(String shared) {
|
||||||
|
((MainActivity)getActivity()).setTextToBeShared(shared);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
protected FileUploadWebChromeClient.FileUploadCallback fileUploadCallback = new FileUploadWebChromeClient.FileUploadCallback() {
|
||||||
|
@Override
|
||||||
|
public boolean imageUpload(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
|
||||||
|
if(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_image)
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AppLog.v(this, "onOpenFileChooser");
|
||||||
|
if (imageUploadFilePathCallbackNew != null) imageUploadFilePathCallbackNew.onReceiveValue(null);
|
||||||
|
imageUploadFilePathCallbackNew = filePathCallback;
|
||||||
|
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
if (takePictureIntent.resolveActivity(getContext().getPackageManager()) != null) {
|
||||||
|
// Create the File where the photo should go
|
||||||
|
File photoFile;
|
||||||
|
try {
|
||||||
|
photoFile = Helpers.createImageFile();
|
||||||
|
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
AppLog.e(this, "ERROR creating temp file: "+ ex.toString());
|
||||||
|
// Error occurred while creating the File
|
||||||
|
Snackbar.make(webView, R.string.unable_to_load_image, Snackbar.LENGTH_LONG).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Continue only if the File was successfully created
|
||||||
|
if (photoFile != null) {
|
||||||
|
mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
|
||||||
|
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
|
||||||
|
Uri.fromFile(photoFile));
|
||||||
|
} else {
|
||||||
|
takePictureIntent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
|
contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
contentSelectionIntent.setType("image/*");
|
||||||
|
Intent[] intentArray;
|
||||||
|
if (takePictureIntent != null) {
|
||||||
|
intentArray = new Intent[]{takePictureIntent};
|
||||||
|
} else {
|
||||||
|
intentArray = new Intent[0];
|
||||||
|
}
|
||||||
|
Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
|
||||||
|
chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
|
||||||
|
chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
|
||||||
|
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
|
||||||
|
AppLog.d(this, "startActivityForResult");
|
||||||
|
startActivityForResult(chooserIntent, MainActivity.INPUT_FILE_REQUEST_CODE_NEW);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void legacyImageUpload(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
|
||||||
|
AppLog.v(this, "openFileChooser(ValCallback<Uri>, String, String");
|
||||||
|
imageUploadFilePathCallbackOld = uploadMsg;
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setType("image/*");
|
||||||
|
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||||
|
intent.putExtra("return-data", true);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
AppLog.v(this, "startActivityForResult");
|
||||||
|
startActivityForResult(Intent.createChooser(intent, "Select Picture"), MainActivity.INPUT_FILE_REQUEST_CODE_OLD);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private class JavaScriptInterface {
|
private class JavaScriptInterface {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void setUserProfile(final String webMessage) throws JSONException {
|
public void setUserProfile(final String webMessage) throws JSONException {
|
||||||
PodUserProfile pup = ((App)getActivity().getApplication()).getPodUserProfile();
|
PodUserProfile pup = ((App)getActivity().getApplication()).getPodUserProfile();
|
||||||
|
@ -357,9 +331,15 @@ public class StreamFragment extends WebViewFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void contentHasBeenShared() {
|
public void contentHasBeenShared() {
|
||||||
textToBeShared = null;
|
((MainActivity)getActivity()).setTextToBeShared(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFragmentTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*
|
||||||
|
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.fragment;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
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.TextView;
|
||||||
|
|
||||||
|
import com.github.dfa.diaspora_android.App;
|
||||||
|
import com.github.dfa.diaspora_android.R;
|
||||||
|
import com.github.dfa.diaspora_android.activity.MainActivity;
|
||||||
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
|
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragment that shows a list of the Hashtags the user follows
|
||||||
|
* Created by vanitas on 29.09.16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class HashtagListFragment extends CustomFragment {
|
||||||
|
|
||||||
|
public static final String TAG = "com.github.dfa.diaspora_android.HashtagListFragment";
|
||||||
|
|
||||||
|
protected RecyclerView followedTagsRecyclerView;
|
||||||
|
protected String[] followedTags;
|
||||||
|
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.hashtag_list__fragment, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
this.followedTagsRecyclerView = (RecyclerView) view.findViewById(R.id.fragment_followed_tags__recycler_view);
|
||||||
|
this.app = (App) getActivity().getApplication();
|
||||||
|
this.urls = new DiasporaUrlHelper(app.getSettings());
|
||||||
|
|
||||||
|
followedTags = app.getPodUserProfile().getFollowedTags();
|
||||||
|
followedTagsRecyclerView.setHasFixedSize(true);
|
||||||
|
followedTagsRecyclerView.setNestedScrollingEnabled(false);
|
||||||
|
|
||||||
|
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this.getContext());
|
||||||
|
followedTagsRecyclerView.setLayoutManager(layoutManager);
|
||||||
|
|
||||||
|
final FollowedTagsAdapter adapter = new FollowedTagsAdapter(followedTags, onHashtagClickListener);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected View.OnClickListener onHashtagClickListener = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
int itemPosition = followedTagsRecyclerView.getChildLayoutPosition(view);
|
||||||
|
if(itemPosition > -1 && itemPosition < followedTags.length) {
|
||||||
|
String tag = followedTags[itemPosition];
|
||||||
|
((MainActivity)getActivity()).openDiasporaUrl(urls.getSearchTagsUrl(tag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static class FollowedTagsAdapter extends RecyclerView.Adapter<FollowedTagsAdapter.ViewHolder> {
|
||||||
|
private String[] followedTagsList;
|
||||||
|
private View.OnClickListener itemClickListener;
|
||||||
|
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
// each data item is just a string in this case
|
||||||
|
public TextView title;
|
||||||
|
|
||||||
|
public ViewHolder(View v) {
|
||||||
|
super(v);
|
||||||
|
title = (TextView) v.findViewById(R.id.recycler_view__list_item__text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Provide a suitable constructor (depends on the kind of dataset)
|
||||||
|
public FollowedTagsAdapter(String[] tags, View.OnClickListener itemClickListener) {
|
||||||
|
this.followedTagsList = tags;
|
||||||
|
this.itemClickListener = itemClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FollowedTagsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View v = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.recycler_view__list_item, parent, false);
|
||||||
|
v.setOnClickListener(itemClickListener);
|
||||||
|
return new ViewHolder(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace the contents of a view (invoked by the layout manager)
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||||
|
|
||||||
|
holder.title.setText(followedTagsList[position]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the size of your dataset (invoked by the layout manager)
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return followedTagsList.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
If not, see <http://www.gnu.org/licenses/>.
|
If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.github.dfa.diaspora_android.activity;
|
package com.github.dfa.diaspora_android.fragment;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
@ -28,64 +28,103 @@ 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.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.webkit.CookieManager;
|
import android.webkit.CookieManager;
|
||||||
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
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.data.AppSettings;
|
||||||
import com.github.dfa.diaspora_android.task.GetPodsService;
|
import com.github.dfa.diaspora_android.task.GetPodsService;
|
||||||
import com.github.dfa.diaspora_android.util.Helpers;
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
|
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
|
||||||
import com.github.dfa.diaspora_android.util.WebHelper;
|
import com.github.dfa.diaspora_android.util.WebHelper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import butterknife.BindView;
|
/**
|
||||||
import butterknife.ButterKnife;
|
* Fragment that lets the user choose a Pod
|
||||||
import butterknife.OnClick;
|
* Created by vanitas on 01.10.16.
|
||||||
import butterknife.OnItemClick;
|
*/
|
||||||
|
|
||||||
|
public class PodSelectionFragment extends CustomFragment {
|
||||||
|
public static final String TAG = "com.github.dfa.diaspora_android.PodSelectionFragment";
|
||||||
|
|
||||||
public class PodSelectionActivity extends AppCompatActivity {
|
protected EditText editFilter;
|
||||||
private App app;
|
protected ListView listPods;
|
||||||
|
protected ImageView selectPodButton;
|
||||||
|
|
||||||
@BindView(R.id.podselection__edit_filter)
|
protected App app;
|
||||||
EditText editFilter;
|
protected AppSettings appSettings;
|
||||||
|
|
||||||
@BindView(R.id.podselection__listpods)
|
|
||||||
ListView listPods;
|
|
||||||
|
|
||||||
@BindView(R.id.main__topbar)
|
|
||||||
Toolbar toolbar;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
AppLog.d(this, "onCreateView()");
|
||||||
setContentView(R.layout.podselection__activity);
|
return inflater.inflate(R.layout.podselection__fragment, container, false);
|
||||||
ButterKnife.bind(this);
|
}
|
||||||
app = (App) getApplication();
|
|
||||||
setSupportActionBar(toolbar);
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
this.app = (App) getActivity().getApplication();
|
||||||
|
this.appSettings = app.getSettings();
|
||||||
|
|
||||||
|
this.editFilter = (EditText) view.findViewById(R.id.podselection__edit_filter);
|
||||||
|
this.listPods = (ListView) view.findViewById(R.id.podselection__listpods);
|
||||||
|
this.selectPodButton = (ImageView) view.findViewById(R.id.podselection__button_select_pod);
|
||||||
|
|
||||||
listPods.setTextFilterEnabled(true);
|
listPods.setTextFilterEnabled(true);
|
||||||
setListedPods(app.getSettings().getPreviousPodlist());
|
listPods.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(podListReceiver, new IntentFilter(GetPodsService.MESSAGE_PODS_RECEIVED));
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||||
if (!WebHelper.isOnline(PodSelectionActivity.this)) {
|
showPodConfirmationDialog((String) listPods.getAdapter().getItem(i));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setListedPods(appSettings.getPreviousPodlist());
|
||||||
|
LocalBroadcastManager.getInstance(getContext()).registerReceiver(podListReceiver, new IntentFilter(GetPodsService.MESSAGE_PODS_RECEIVED));
|
||||||
|
if (!WebHelper.isOnline(getContext())) {
|
||||||
Snackbar.make(listPods, R.string.no_internet, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(listPods, R.string.no_internet, Snackbar.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
selectPodButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (editFilter.getText().length() > 4 && editFilter.getText().toString().contains("")) {
|
||||||
|
showPodConfirmationDialog(editFilter.getText().toString());
|
||||||
|
} else {
|
||||||
|
Snackbar.make(listPods, R.string.valid_pod, Snackbar.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFragmentTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
/* Nothing to do */
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBackPressed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private final BroadcastReceiver podListReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver podListReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -104,20 +143,11 @@ public class PodSelectionActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@OnClick(R.id.podselection__button_select_pod)
|
|
||||||
public void onButtonSelectPodClicked(View view) {
|
|
||||||
if (editFilter.getText().length() > 4 && editFilter.getText().toString().contains("")) {
|
|
||||||
showPodConfirmationDialog(editFilter.getText().toString());
|
|
||||||
} else {
|
|
||||||
Snackbar.make(listPods, R.string.valid_pod, Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
Intent i = new Intent(PodSelectionActivity.this, GetPodsService.class);
|
Intent i = new Intent(getContext(), GetPodsService.class);
|
||||||
startService(i);
|
getContext().startService(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,7 +158,7 @@ public class PodSelectionActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayAdapter<String> adapter = new ArrayAdapter<>(
|
final ArrayAdapter<String> adapter = new ArrayAdapter<>(
|
||||||
PodSelectionActivity.this,
|
getContext(),
|
||||||
android.R.layout.simple_list_item_1,
|
android.R.layout.simple_list_item_1,
|
||||||
listedPodsList);
|
listedPodsList);
|
||||||
|
|
||||||
|
@ -154,24 +184,19 @@ public class PodSelectionActivity extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnItemClick(R.id.podselection__listpods)
|
|
||||||
public void onListPodsItemClicked(int position) {
|
|
||||||
showPodConfirmationDialog((String) listPods.getAdapter().getItem(position));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showPodConfirmationDialog(final String selectedPod) {
|
private void showPodConfirmationDialog(final String selectedPod) {
|
||||||
// Make a clickable link
|
// Make a clickable link
|
||||||
final SpannableString dialogMessage = new SpannableString(getString(R.string.confirm_pod, selectedPod));
|
final SpannableString dialogMessage = new SpannableString(getString(R.string.confirm_pod, selectedPod));
|
||||||
Linkify.addLinks(dialogMessage, Linkify.ALL);
|
Linkify.addLinks(dialogMessage, Linkify.ALL);
|
||||||
|
|
||||||
// Check if online
|
// Check if online
|
||||||
if (!WebHelper.isOnline(PodSelectionActivity.this)) {
|
if (!WebHelper.isOnline(getContext())) {
|
||||||
Snackbar.make(listPods, R.string.no_internet, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(listPods, R.string.no_internet, Snackbar.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show dialog
|
// Show dialog
|
||||||
new AlertDialog.Builder(PodSelectionActivity.this)
|
new AlertDialog.Builder(getContext())
|
||||||
.setTitle(getString(R.string.confirmation))
|
.setTitle(getString(R.string.confirmation))
|
||||||
.setMessage(dialogMessage)
|
.setMessage(dialogMessage)
|
||||||
.setPositiveButton(android.R.string.yes,
|
.setPositiveButton(android.R.string.yes,
|
||||||
|
@ -201,40 +226,28 @@ public class PodSelectionActivity extends AppCompatActivity {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Helpers.animateToActivity(this, MainActivity.class, true);
|
((MainActivity)getActivity()).openDiasporaUrl(new DiasporaUrlHelper(appSettings).getPodUrl());
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
Snackbar.make(listPods, R.string.confirm_exit, Snackbar.LENGTH_LONG)
|
|
||||||
.setAction(android.R.string.yes, new View.OnClickListener() {
|
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
public void onDestroy() {
|
||||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(podListReceiver);
|
LocalBroadcastManager.getInstance(getContext()).unregisterReceiver(podListReceiver);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
getMenuInflater().inflate(R.menu.podselection__menu, menu);
|
inflater.inflate(R.menu.podselection__menu, menu);
|
||||||
return true;
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 (WebHelper.isOnline(PodSelectionActivity.this)) {
|
if (WebHelper.isOnline(getContext())) {
|
||||||
Intent i = new Intent(PodSelectionActivity.this, GetPodsService.class);
|
Intent i = new Intent(getContext(), GetPodsService.class);
|
||||||
startService(i);
|
getContext().startService(i);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(listPods, R.string.no_internet, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(listPods, R.string.no_internet, Snackbar.LENGTH_LONG).show();
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
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.fragment;
|
||||||
|
|
||||||
|
import com.github.dfa.diaspora_android.App;
|
||||||
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragment that supports color schemes
|
||||||
|
* Created by vanitas on 06.10.16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class ThemedFragment extends CustomFragment {
|
||||||
|
protected AppSettings getAppSettings() {
|
||||||
|
return ((App)getActivity().getApplication()).getSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void applyColorToViews();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
ThemeHelper.getInstance(getAppSettings());
|
||||||
|
applyColorToViews();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
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.receiver;
|
package com.github.dfa.diaspora_android.receiver;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -15,7 +33,7 @@ import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
import com.github.dfa.diaspora_android.util.AppLog;
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
import com.github.dfa.diaspora_android.util.CustomTabHelpers.BrowserFallback;
|
import com.github.dfa.diaspora_android.util.CustomTabHelpers.BrowserFallback;
|
||||||
import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper;
|
import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper;
|
||||||
import com.github.dfa.diaspora_android.util.Helpers;
|
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BroadcastReceiver that opens links in a Chrome CustomTab
|
* BroadcastReceiver that opens links in a Chrome CustomTab
|
||||||
|
@ -30,7 +48,8 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context c, Intent receiveIntent) {
|
public void onReceive(Context c, Intent receiveIntent) {
|
||||||
AppSettings settings = new AppSettings(c);
|
AppSettings appSettings = new AppSettings(c);
|
||||||
|
ThemeHelper.getInstance(appSettings);
|
||||||
|
|
||||||
AppLog.v(this, "OpenExternalLinkReceiver.onReceive(): url");
|
AppLog.v(this, "OpenExternalLinkReceiver.onReceive(): url");
|
||||||
|
|
||||||
|
@ -43,10 +62,10 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.isChromeCustomTabsEnabled()) {
|
if (appSettings.isChromeCustomTabsEnabled()) {
|
||||||
// Setup Chrome Custom Tab
|
// Setup Chrome Custom Tab
|
||||||
CustomTabsIntent.Builder customTab = new CustomTabsIntent.Builder();
|
CustomTabsIntent.Builder customTab = new CustomTabsIntent.Builder();
|
||||||
customTab.setToolbarColor(Helpers.getColorFromRessource(c, R.color.colorPrimary));
|
customTab.setToolbarColor(ThemeHelper.getPrimaryColor());
|
||||||
customTab.addDefaultShareMenuItem();
|
customTab.addDefaultShareMenuItem();
|
||||||
|
|
||||||
Bitmap backButtonIcon = BitmapFactory.decodeResource(c.getResources(), R.drawable.chrome_custom_tab__back);
|
Bitmap backButtonIcon = BitmapFactory.decodeResource(c.getResources(), R.drawable.chrome_custom_tab__back);
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
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.receiver;
|
package com.github.dfa.diaspora_android.receiver;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
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;
|
package com.github.dfa.diaspora_android.ui;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -30,7 +48,7 @@ public class BadgeDrawable extends Drawable {
|
||||||
float textSize = context.getResources().getDimension(R.dimen.textsize_badge_count);
|
float textSize = context.getResources().getDimension(R.dimen.textsize_badge_count);
|
||||||
|
|
||||||
badgeBackground = new Paint();
|
badgeBackground = new Paint();
|
||||||
badgeBackground.setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.accent));
|
badgeBackground.setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.md_deep_orange_650));
|
||||||
badgeBackground.setAntiAlias(true);
|
badgeBackground.setAntiAlias(true);
|
||||||
badgeBackground.setStyle(Paint.Style.FILL);
|
badgeBackground.setStyle(Paint.Style.FILL);
|
||||||
badgeStroke = new Paint();
|
badgeStroke = new Paint();
|
||||||
|
|
|
@ -123,6 +123,31 @@ public class ContextMenuWebView extends NestedWebView {
|
||||||
|
|
||||||
case ID_SHARE_IMAGE:
|
case ID_SHARE_IMAGE:
|
||||||
if (url != null) {
|
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");
|
final Uri local = Uri.parse(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + System.currentTimeMillis() + ".png");
|
||||||
new ImageDownloadTask(null, local.getPath()) {
|
new ImageDownloadTask(null, local.getPath()) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -133,12 +158,14 @@ public class ContextMenuWebView extends NestedWebView {
|
||||||
sharingIntent.putExtra(Intent.EXTRA_STREAM, myUri);
|
sharingIntent.putExtra(Intent.EXTRA_STREAM, myUri);
|
||||||
sharingIntent.setType("image/png");
|
sharingIntent.setType("image/png");
|
||||||
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
context.startActivity(Intent.createChooser(sharingIntent, "Share image using"));
|
context.startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.action_share_dotdotdot)));
|
||||||
}
|
}
|
||||||
}.execute(url);
|
}.execute(url);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(context, "Cannot share image: url is null", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Cannot share image: url is null", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_IMAGE_EXTERNAL_BROWSER:
|
case ID_IMAGE_EXTERNAL_BROWSER:
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.github.dfa.diaspora_android.ui;
|
||||||
|
|
||||||
|
import android.support.design.widget.AppBarLayout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface that adds options to control intellihide of toolbars to the Activity
|
||||||
|
* Created by vanitas on 08.10.16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IntellihideToolbarActivityListener {
|
||||||
|
int toolbarDefaultScrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP;
|
||||||
|
void enableToolbarHiding();
|
||||||
|
void disableToolbarHiding();
|
||||||
|
}
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
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;
|
package com.github.dfa.diaspora_android.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
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.CustomTabHelpers;
|
package com.github.dfa.diaspora_android.util.CustomTabHelpers;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
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.CustomTabHelpers;
|
package com.github.dfa.diaspora_android.util.CustomTabHelpers;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
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.CustomTabHelpers;
|
package com.github.dfa.diaspora_android.util.CustomTabHelpers;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
|
@ -113,6 +113,10 @@ public class Helpers {
|
||||||
return "#" + Integer.toHexString(context.getResources().getColor(idColor) & 0x00ffffff);
|
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) {
|
public static void printBundle(Bundle savedInstanceState, String k) {
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
for (String key : savedInstanceState.keySet()) {
|
for (String key : savedInstanceState.keySet()) {
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
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;
|
package com.github.dfa.diaspora_android.util;
|
||||||
|
|
||||||
import com.github.dfa.diaspora_android.data.AppSettings;
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
/*
|
||||||
|
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.content.Context;
|
||||||
|
import android.os.StrictMode;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import com.github.dfa.diaspora_android.activity.MainActivity;
|
||||||
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import info.guardianproject.netcipher.NetCipher;
|
||||||
|
import info.guardianproject.netcipher.webkit.WebkitProxy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proxy Handler that applies proxy settings of the app to webviews etc.
|
||||||
|
* Created by vanitas on 10.10.16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ProxyHandler {
|
||||||
|
private static ProxyHandler instance;
|
||||||
|
private ArrayList<WebView> webViews;
|
||||||
|
|
||||||
|
|
||||||
|
private ProxyHandler() {
|
||||||
|
/* Singleton, yo? */
|
||||||
|
this.webViews = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ProxyHandler getInstance() {
|
||||||
|
if(instance == null) {
|
||||||
|
instance = new ProxyHandler();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateProxySettings(Context context) {
|
||||||
|
AppLog.d(this, "UpdateProxySettings()");
|
||||||
|
AppSettings appSettings = new AppSettings(context);
|
||||||
|
StrictMode.ThreadPolicy old = StrictMode.getThreadPolicy();
|
||||||
|
StrictMode.ThreadPolicy tmp = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||||
|
StrictMode.setThreadPolicy(tmp);
|
||||||
|
if (appSettings.isProxyEnabled()) {
|
||||||
|
//Update NetCipher
|
||||||
|
NetCipher.setProxy(appSettings.getProxyHost(), appSettings.getProxyPort());
|
||||||
|
//Update webviews
|
||||||
|
for (WebView wv : webViews) {
|
||||||
|
if (wv != null) {
|
||||||
|
try {
|
||||||
|
WebkitProxy.setProxy(MainActivity.class.getName(), context.getApplicationContext(), wv, appSettings.getProxyHost(), appSettings.getProxyPort());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StrictMode.setThreadPolicy(old);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addWebView(WebView wv) {
|
||||||
|
AppLog.d(this, "AddWebView");
|
||||||
|
if(wv != null && !webViews.contains(wv)) {
|
||||||
|
webViews.add(wv);
|
||||||
|
updateWebViewProxySettings(wv, wv.getContext());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateWebViewProxySettings(WebView wv, Context context) {
|
||||||
|
AppLog.d(this, "UpdateWebViewProxySettings()");
|
||||||
|
AppSettings appSettings = new AppSettings(context);
|
||||||
|
StrictMode.ThreadPolicy old = StrictMode.getThreadPolicy();
|
||||||
|
StrictMode.ThreadPolicy tmp = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||||
|
StrictMode.setThreadPolicy(tmp);
|
||||||
|
if(appSettings.isProxyEnabled()) {
|
||||||
|
if (wv != null) {
|
||||||
|
try {
|
||||||
|
WebkitProxy.setProxy(MainActivity.class.getName(), context.getApplicationContext(), wv, appSettings.getProxyHost(), appSettings.getProxyPort());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StrictMode.setThreadPolicy(old);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ProxySettings {
|
||||||
|
private final boolean enabled;
|
||||||
|
private final String host;
|
||||||
|
private final int port;
|
||||||
|
|
||||||
|
public ProxySettings(boolean enabled, String host, int port) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
this.host = host;
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPort() {
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
return (other instanceof ProxySettings) &&
|
||||||
|
enabled == ((ProxySettings) other).isEnabled() &&
|
||||||
|
host.equals(((ProxySettings) other).getHost()) &&
|
||||||
|
port == ((ProxySettings) other).getPort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -62,7 +62,7 @@ public class WebHelper {
|
||||||
public static void optimizeMobileSiteLayout(final WebView wv) {
|
public static void optimizeMobileSiteLayout(final WebView wv) {
|
||||||
wv.loadUrl("javascript: ( function() {" +
|
wv.loadUrl("javascript: ( function() {" +
|
||||||
" if (document.documentElement == null || document.documentElement.style == null) { return; }" +
|
" if (document.documentElement == null || document.documentElement.style == null) { return; }" +
|
||||||
" document.documentElement.style.paddingBottom = '260px';" +
|
" document.documentElement.style.paddingBottom = '50px';" +
|
||||||
" document.getElementById('main').style.paddingTop = '5px';" +
|
" document.getElementById('main').style.paddingTop = '5px';" +
|
||||||
" if(document.getElementById('main_nav')) {" +
|
" if(document.getElementById('main_nav')) {" +
|
||||||
" document.getElementById('main_nav').parentNode.removeChild(" +
|
" document.getElementById('main_nav').parentNode.removeChild(" +
|
||||||
|
|
|
@ -0,0 +1,288 @@
|
||||||
|
package com.github.dfa.diaspora_android.util.theming;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v4.graphics.ColorUtils;
|
||||||
|
|
||||||
|
import com.github.dfa.diaspora_android.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by dnld on 24/02/16.
|
||||||
|
*/
|
||||||
|
public class ColorPalette {
|
||||||
|
|
||||||
|
public static int[] getAccentColors(Context context){
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_yellow_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_grey_500),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getObscuredColor(int c){
|
||||||
|
float[] hsv = new float[3];
|
||||||
|
int color = c;
|
||||||
|
Color.colorToHSV(color, hsv);
|
||||||
|
hsv[2] *= 0.85f; // value component
|
||||||
|
color = Color.HSVToColor(hsv);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getTransparentColor(int color, int alpha){
|
||||||
|
return ColorUtils.setAlphaComponent(color, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int[] getTransparencyShadows(int color) {
|
||||||
|
int[] shadows = new int[10];
|
||||||
|
for (int i=0; i<10;i++)
|
||||||
|
shadows[i]= (ColorPalette.getTransparentColor(color, ((100-(i*10))*255) /100));
|
||||||
|
return shadows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int[] getBaseColors(Context context) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_pink_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_indigo_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_green_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_lime_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_yellow_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_amber_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_grey_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_grey_500)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int[] getColors(Context context, int c) {
|
||||||
|
if (c == ContextCompat.getColor(context, R.color.md_red_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_red_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_pink_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_pink_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_pink_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_pink_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_pink_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_pink_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_pink_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_pink_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_pink_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_purple_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_purple_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_deep_purple_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_purple_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_indigo_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_indigo_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_indigo_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_indigo_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_indigo_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_indigo_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_indigo_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_indigo_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_indigo_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_blue_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_650),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_750),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_light_blue_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_blue_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_cyan_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_cyan_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_teal_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_teal_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_green_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_green_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_light_green_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_green_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_green_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_green_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_green_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_green_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_green_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_green_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_light_green_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_lime_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_lime_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_lime_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_lime_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_lime_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_lime_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_lime_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_lime_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_lime_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_yellow_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_yellow_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_yellow_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_yellow_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_yellow_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_yellow_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_yellow_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_amber_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_amber_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_amber_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_amber_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_amber_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_amber_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_amber_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_amber_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_amber_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_orange_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_orange_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_deep_orange_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_650),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_deep_orange_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_brown_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_200),
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_brown_900)
|
||||||
|
};
|
||||||
|
} else if (c == ContextCompat.getColor(context, R.color.md_grey_500)) {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_grey_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_grey_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_grey_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_grey_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_grey_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_grey_900),
|
||||||
|
Color.parseColor("#000000")
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return new int[]{
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_grey_300),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_grey_400),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_grey_500),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_grey_600),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_grey_700),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_grey_800),
|
||||||
|
ContextCompat.getColor(context, R.color.md_blue_grey_900)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
/*
|
||||||
|
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/>.
|
||||||
|
This class is inspired by org.horasapps.LeafPic
|
||||||
|
*/
|
||||||
|
package com.github.dfa.diaspora_android.util.theming;
|
||||||
|
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.support.design.widget.TabLayout;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.widget.ActionMenuView;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton that can be used to color views
|
||||||
|
* Created by vanitas on 06.10.16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ThemeHelper {
|
||||||
|
private AppSettings appSettings;
|
||||||
|
private static ThemeHelper instance;
|
||||||
|
|
||||||
|
private ThemeHelper(AppSettings appSettings) {
|
||||||
|
this.appSettings = appSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ThemeHelper getInstance(AppSettings appSettings) {
|
||||||
|
if(instance == null) {
|
||||||
|
instance = new ThemeHelper(appSettings);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ThemeHelper getInstance() {
|
||||||
|
if(instance == null) throw new IllegalStateException("ThemeHelper must be initialized using getInstance(AppSettings) before it can be used!");
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateEditTextColor(EditText editText) {
|
||||||
|
if(editText != null) {
|
||||||
|
editText.setHighlightColor(getInstance().appSettings.getAccentColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateCheckBoxColor(CheckBox checkBox) {
|
||||||
|
if(checkBox != null) {
|
||||||
|
checkBox.setHighlightColor(getInstance().appSettings.getAccentColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateTabLayoutColor(TabLayout tabLayout) {
|
||||||
|
if(tabLayout != null) {
|
||||||
|
tabLayout.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
|
||||||
|
tabLayout.setSelectedTabIndicatorColor(getInstance().appSettings.getAccentColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateTextViewColor(TextView textView) {
|
||||||
|
if(textView != null) {
|
||||||
|
textView.setHighlightColor(getInstance().appSettings.getAccentColor());
|
||||||
|
textView.setLinkTextColor(getInstance().appSettings.getAccentColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateToolbarColor(Toolbar toolbar) {
|
||||||
|
if(toolbar != null) {
|
||||||
|
toolbar.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateActionMenuViewColor(ActionMenuView actionMenuView) {
|
||||||
|
if(actionMenuView != null) {
|
||||||
|
actionMenuView.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getPrimaryColor() {
|
||||||
|
return getInstance().appSettings.getPrimaryColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getAccentColor() {
|
||||||
|
return getInstance().appSettings.getAccentColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setPrimaryColorAsBackground(View view) {
|
||||||
|
if(view != null) {
|
||||||
|
view.setBackgroundColor(getPrimaryColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getPrimaryDarkColor() {
|
||||||
|
return ColorPalette.getObscuredColor(getPrimaryColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateActionBarColor(ActionBar actionBar) {
|
||||||
|
if(actionBar != null) {
|
||||||
|
actionBar.setBackgroundDrawable(new ColorDrawable(getInstance().appSettings.getPrimaryColor()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateProgressBarColor(ProgressBar progressBar) {
|
||||||
|
if(progressBar != null && progressBar.getProgressDrawable() != null) {
|
||||||
|
progressBar.getProgressDrawable().setColorFilter(getAccentColor(), PorterDuff.Mode.SRC_IN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
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.webview;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
@ -37,6 +37,7 @@ public class CustomWebViewClient extends WebViewClient {
|
||||||
this.webView = webView;
|
this.webView = webView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Open non-diaspora links in customtab/external browser
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
if (!url.contains(app.getSettings().getPodDomain())) {
|
if (!url.contains(app.getSettings().getPodDomain())) {
|
||||||
Intent i = new Intent(MainActivity.ACTION_OPEN_EXTERNAL_URL);
|
Intent i = new Intent(MainActivity.ACTION_OPEN_EXTERNAL_URL);
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
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.webview;
|
||||||
|
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
|
import com.github.dfa.diaspora_android.util.WebHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by vanitas on 26.09.16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DiasporaStreamWebChromeClient extends FileUploadWebChromeClient {
|
||||||
|
protected SharedTextCallback sharedTextCallback;
|
||||||
|
|
||||||
|
public DiasporaStreamWebChromeClient(WebView webView, ProgressBar progressBar, FileUploadCallback fileUploadCallback, SharedTextCallback callback) {
|
||||||
|
super(webView, progressBar, fileUploadCallback);
|
||||||
|
this.sharedTextCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(WebView wv, int progress) {
|
||||||
|
super.onProgressChanged(wv, progress);
|
||||||
|
if (progress > 0 && progress <= 60) {
|
||||||
|
WebHelper.getUserProfile(wv);
|
||||||
|
WebHelper.optimizeMobileSiteLayout(wv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (progress > 60) {
|
||||||
|
WebHelper.optimizeMobileSiteLayout(wv);
|
||||||
|
|
||||||
|
String textToBeShared = sharedTextCallback.getSharedText();
|
||||||
|
if (textToBeShared != null) {
|
||||||
|
AppLog.d(this, "Share text into webView");
|
||||||
|
WebHelper.shareTextIntoWebView(wv, textToBeShared);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface SharedTextCallback {
|
||||||
|
String getSharedText();
|
||||||
|
void setSharedText(String shared);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
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.webview;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.webkit.ValueCallback;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by vanitas on 26.09.16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class FileUploadWebChromeClient extends ProgressBarWebChromeClient {
|
||||||
|
protected FileUploadCallback fileUploadCallback;
|
||||||
|
|
||||||
|
public FileUploadWebChromeClient(WebView webView, ProgressBar progressBar, FileUploadCallback fileUploadCallback) {
|
||||||
|
super(webView, progressBar);
|
||||||
|
this.fileUploadCallback = fileUploadCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(WebView wv, int progress) {
|
||||||
|
super.onProgressChanged(wv, progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
//For Android 4.1/4.2 only. DO NOT REMOVE!
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
|
||||||
|
{
|
||||||
|
fileUploadCallback.legacyImageUpload(uploadMsg, acceptType, capture);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
|
||||||
|
return fileUploadCallback.imageUpload(webView, filePathCallback, fileChooserParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface FileUploadCallback {
|
||||||
|
boolean imageUpload(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams);
|
||||||
|
void legacyImageUpload(ValueCallback<Uri> uploadMsg, String acceptType, String capture);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
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.webview;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.webkit.WebChromeClient;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebChromeClient that connects the ProgressBar and the WebView and updates the progress of the progressBar.
|
||||||
|
* Created by vanitas on 26.09.16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ProgressBarWebChromeClient extends WebChromeClient {
|
||||||
|
protected final ProgressBar progressBar;
|
||||||
|
protected final WebView webView;
|
||||||
|
|
||||||
|
public ProgressBarWebChromeClient(WebView webView, ProgressBar progressBar) {
|
||||||
|
this.webView = webView;
|
||||||
|
this.progressBar = progressBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onProgressChanged(WebView wv, int progress) {
|
||||||
|
progressBar.setProgress(progress);
|
||||||
|
progressBar.setVisibility(progress == 100 ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
BIN
app/src/main/res/drawable-hdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/drawable-ldpi/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-ldpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
|
@ -1,6 +0,0 @@
|
||||||
<vector android:height="24dp" android:viewportHeight="20.0"
|
|
||||||
android:viewportWidth="20.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<path android:fillAlpha="1" android:fillColor="#207be6"
|
|
||||||
android:pathData="M10,10m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0" android:strokeColor="#00000000"/>
|
|
||||||
<path android:fillColor="#fafafa" android:pathData="M11.337,14.123C11.06,13.736 10.626,13.13 10.374,12.778 10.117,12.418 9.908,12.138 9.897,12.138c-0.011,-0 -0.416,0.544 -0.958,1.287 -0.516,0.708 -0.942,1.288 -0.948,1.288 -0.015,0 -1.86,-1.3 -1.865,-1.313 -0.002,-0.007 0.415,-0.619 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.515C5.71,9.879 5.042,9.656 5.032,9.652 5.019,9.647 5.095,9.389 5.359,8.558 5.549,7.959 5.708,7.465 5.713,7.459c0.005,-0.006 0.707,0.219 1.559,0.499 0.852,0.28 1.557,0.51 1.565,0.51 0.009,-0 0.019,-0.013 0.022,-0.029 0.003,-0.016 0.011,-0.742 0.016,-1.613 0.006,-0.871 0.015,-1.591 0.021,-1.6 0.008,-0.013 0.248,-0.016 1.127,-0.016 0.614,0 1.123,0.004 1.13,0.01 0.01,0.007 0.027,0.485 0.055,1.561 0.046,1.766 0.047,1.79 0.075,1.79 0.011,0 0.686,-0.226 1.501,-0.502 0.815,-0.276 1.485,-0.498 1.49,-0.492 0.016,0.019 0.685,2.194 0.676,2.202 -0.004,0.004 -0.684,0.237 -1.511,0.517 -1.137,0.385 -1.504,0.514 -1.507,0.531 -0.002,0.012 0.389,0.596 0.886,1.324 0.489,0.716 0.888,1.308 0.886,1.314 -0.005,0.015 -1.836,1.364 -1.852,1.364 -0.006,0 -0.239,-0.317 -0.516,-0.705z"/>
|
|
||||||
</vector>
|
|
|
@ -1,5 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:id="@android:id/progress">
|
||||||
|
<clip>
|
||||||
|
<shape>
|
||||||
|
<solid android:color="@color/white"/>
|
||||||
|
</shape>
|
||||||
|
</clip>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Old progressbar
|
||||||
|
|
||||||
<item android:id="@android:id/background">
|
<item android:id="@android:id/background">
|
||||||
<shape>
|
<shape>
|
||||||
<solid android:color="@color/colorPrimaryDark"/>
|
<solid android:color="@color/colorPrimaryDark"/>
|
||||||
|
@ -12,4 +22,6 @@
|
||||||
</shape>
|
</shape>
|
||||||
</clip>
|
</clip>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
-->
|
||||||
</layer-list>
|
</layer-list>
|
13
app/src/main/res/drawable/tor_onion.xml
Normal file
13
app/src/main/res/drawable/tor_onion.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<vector android:height="24dp" android:viewportHeight="185.0"
|
||||||
|
android:viewportWidth="185.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#abcd03" android:pathData="m103.9,14.01 l-4.92,19.53c6.97,-13.79 18.03,-24.17 30.73,-33.32 -9.29,10.79 -17.75,21.58 -22.94,32.37 8.74,-12.29 20.49,-19.12 33.73,-23.63 -17.62,15.71 -31.6,32.56 -42.26,49.49l-8.47,-3.69c1.5,-13.52 6.61,-27.37 14.12,-40.75z"/>
|
||||||
|
<path android:fillColor="#fffcdb" android:pathData="m81.29,51.17 l16.12,6.69c0,4.1 -0.33,16.6 2.23,20.28 26.8,34.52 22.29,103.71 -5.43,105.49 -42.22,0 -58.32,-28.68 -58.32,-55.04 0,-24.04 28.82,-40.02 46.03,-54.22 4.37,-3.82 3.61,-12.28 -0.62,-23.2z"/>
|
||||||
|
<path android:fillColor="#7d4698" android:pathData="m97.41,57.62 l5.81,2.96c-0.55,3.82 0.27,12.29 4.1,14.48 16.94,10.52 32.91,21.99 39.2,33.46 22.4,40.43 -15.71,77.85 -48.62,74.3 17.89,-13.25 23.08,-40.43 16.39,-70.06 -2.73,-11.61 -6.97,-22.13 -14.48,-34.01 -3.25,-5.83 -2.12,-13.07 -2.39,-21.12z"/>
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="m94.61,56.62 l12.02,1.64c-3.55,11.74 6.97,19.94 10.38,21.85 7.65,4.23 15.02,8.6 20.9,13.93 11.06,10.11 17.34,24.31 17.34,39.33 0,14.89 -6.83,29.23 -18.3,38.79 -10.79,9.01 -25.68,12.84 -40.15,12.84 -9.01,0 -17.07,-0.41 -25.81,-3.28 -19.94,-6.69 -34.83,-23.76 -36.06,-44.25 -1.09,-15.98 2.46,-28.13 14.89,-40.83 6.42,-6.69 19.39,-14.34 28.27,-20.49 4.37,-3.01 9.01,-11.47 0.14,-27.45l1.78,-1.37 13.16,8.81 -11.11,-4.58c0.96,1.37 3.55,7.51 4.1,9.29 1.23,5.05 0.68,9.97 -0.41,12.15 -5.6,10.11 -15.16,12.84 -22.12,18.57 -12.29,10.11 -25.68,18.16 -24.17,45.89 0.68,13.66 11.34,30.32 27.31,38.1 9.01,4.37 19.39,6.15 29.91,6.69 9.42,0.41 27.45,-5.19 37.28,-13.38 10.52,-8.74 16.39,-21.99 16.39,-35.51 0,-13.66 -5.46,-26.63 -15.71,-35.78 -5.87,-5.33 -15.57,-11.74 -21.58,-15.16 -6.01,-3.41 -13.52,-12.97 -11.06,-22.12z"/>
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="m90.93,76.84c-1.23,6.28 -2.6,17.62 -8.06,21.85 -2.32,1.64 -4.64,3.28 -7.1,4.92 -9.83,6.69 -19.67,12.97 -24.17,29.09 -0.96,3.41 -0.14,7.1 0.68,10.52 2.46,9.83 9.42,20.49 14.89,26.77 0,0.27 1.09,0.96 1.09,1.23 4.51,5.33 5.87,6.83 22.94,10.65l-0.41,1.91c-10.24,-2.73 -18.71,-5.19 -24.04,-11.34 0,-0.14 -0.96,-1.09 -0.96,-1.09 -5.74,-6.56 -12.7,-17.48 -15.3,-27.72 -0.96,-4.1 -1.77,-7.24 -0.68,-11.47 4.64,-16.66 14.75,-23.22 24.99,-30.18 2.32,-1.5 5.05,-2.87 7.24,-4.64 4.23,-3.14 6.55,-12.7 8.88,-20.49z"/>
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="m95.29,102.78c0.14,7.1 -0.56,10.66 1.22,15.72 1.09,3 4.78,7.1 5.88,11.06 1.5,5.33 3.14,11.2 3,14.75 0,4.1 -0.26,11.74 -2.03,19.94 -1.35,6.77 -4.47,12.58 -9.72,15.88 -5.37,-1.11 -11.68,-3 -15.41,-6.19 -7.24,-6.28 -13.65,-16.79 -14.47,-25.94 -0.68,-7.51 6.27,-18.59 15.97,-24.19 8.19,-4.78 10.1,-10.23 11.88,-18.97 -2.46,7.65 -4.77,14.06 -12.69,18.16 -11.47,6.01 -17.36,16.1 -16.81,25.66 0.82,12.29 5.74,20.62 15.44,27.31 4.1,2.87 11.75,5.9 16.53,6.72l0,-0.63c3.62,-0.68 8.32,-6.63 10.66,-14.69 2.05,-7.24 2.86,-16.5 2.72,-22.37 -0.14,-3.41 -1.64,-10.81 -4.38,-17.5 -1.5,-3.69 -3.81,-7.37 -5.31,-9.97 -1.64,-2.6 -1.65,-8.19 -2.47,-14.75z"/>
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="m94.48,129.56c0.14,4.78 2.06,10.9 2.88,17.19 0.68,4.64 0.39,9.31 0.25,13.41 -0.13,4.74 -1.72,13.24 -3.88,17.38 -2.04,-0.93 -2.83,-2 -4.16,-3.72 -1.64,-2.32 -2.75,-4.64 -3.84,-7.38 -0.82,-2.05 -1.78,-4.39 -2.19,-7.13 -0.55,-4.1 -0.39,-10.51 4.25,-17.06 3.55,-5.19 4.36,-5.58 5.59,-11.59 -1.64,5.33 -2.86,5.87 -6.69,10.38 -4.23,4.92 -4.94,12.16 -4.94,18.03 0,2.46 0.98,5.19 1.94,7.78 1.09,2.73 2.03,5.45 3.53,7.5 2.26,3.32 5.15,5.21 6.56,5.56 0.01,0 0.02,-0 0.03,0 0.03,0.01 0.06,0.03 0.09,0.03l0,-0.16c2.65,-2.95 4.24,-5.89 4.78,-8.84 0.68,-3.55 0.84,-7.11 1.25,-11.34 0.41,-3.55 0.11,-8.33 -0.84,-13.25 -1.37,-6.15 -3.67,-12.41 -4.63,-16.78z"/>
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="m94.89,71.1c0.14,7.1 0.68,20.35 2.6,25.54 0.55,1.77 5.6,9.56 9.15,18.98 2.46,6.56 3.01,12.56 3.41,14.34 1.64,7.78 -0.41,20.9 -3.14,33.32 -1.37,6.69 -6.01,15.02 -11.34,18.3l-1.09,1.91c3.01,-0.14 10.38,-7.38 12.97,-16.39 4.37,-15.3 6.15,-22.4 4.1,-39.33 -0.27,-1.64 -0.96,-7.24 -3.55,-13.25 -3.82,-9.15 -9.29,-17.89 -9.97,-19.67 -1.23,-2.87 -2.87,-15.3 -3.14,-23.76z"/>
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="m97.45,61.39c-0.41,7.3 -0.51,9.99 0.85,15.31 1.5,5.87 9.15,14.34 12.29,24.04 6.01,18.57 4.51,42.88 0.14,61.87 -1.64,6.69 -9.42,16.39 -17.21,19.53l5.74,1.37c3.14,-0.14 11.2,-7.65 14.34,-16.25 5.05,-13.52 6.01,-29.64 3.96,-46.57 -0.14,-1.64 -2.87,-16.25 -5.46,-22.4 -3.69,-9.15 -10.24,-17.34 -10.93,-19.12 -1.23,-3.01 -3.93,-9.24 -3.72,-17.77z"/>
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M93.11,56.25h0.55v126.02h-0.55z"/>
|
||||||
|
</vector>
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/main_content"
|
android:id="@+id/main_content"
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
tools:context="com.github.dfa.diaspora_android.activity.AboutActivity">
|
tools:context="com.github.dfa.diaspora_android.activity.AboutActivity">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/appbar"
|
android:id="@+id/about__appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
@ -17,7 +18,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/linearlayout"
|
android:id="@+id/appbar_linear_layout"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:layout_scrollFlags="scroll|enterAlways|snap"
|
app:layout_scrollFlags="scroll|enterAlways|snap"
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
android:layout_height="16dp" />
|
android:layout_height="16dp" />
|
||||||
|
|
||||||
<com.github.dfa.diaspora_android.ui.HtmlTextView
|
<com.github.dfa.diaspora_android.ui.HtmlTextView
|
||||||
|
android:id="@+id/fragment_about__about_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/fragment_about__about_content"
|
android:text="@string/fragment_about__about_content"
|
||||||
|
|
35
app/src/main/res/layout/color_picker__dialog.xml
Normal file
35
app/src/main/res/layout/color_picker__dialog.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/color_picker_dialog__title_background"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/color_picker_dialog__title"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large.Inverse"
|
||||||
|
/>
|
||||||
|
</FrameLayout>
|
||||||
|
<uz.shift.colorpicker.LineColorPicker
|
||||||
|
android:id="@+id/color_picker_dialog__base_picker"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
app:orientation="horizontal"/>
|
||||||
|
<uz.shift.colorpicker.LineColorPicker
|
||||||
|
android:id="@+id/color_picker_dialog__shade_picker"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
app:orientation="horizontal"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
27
app/src/main/res/layout/hashtag_list__fragment.xml
Normal file
27
app/src/main/res/layout/hashtag_list__fragment.xml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<android.support.v4.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/fragment_followed_tags__recycler_view"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
||||||
|
|
||||||
|
<!-- Offset -->
|
||||||
|
<android.support.v4.widget.Space
|
||||||
|
android:id="@+id/spacer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/bottom_toolbar_height"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</android.support.v4.widget.NestedScrollView>
|
||||||
|
</RelativeLayout>
|
|
@ -8,9 +8,9 @@
|
||||||
tools:context=".activity.MainActivity">
|
tools:context=".activity.MainActivity">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
|
android:id="@+id/main__appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom|end"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay"
|
android:theme="@style/AppTheme.AppBarOverlay"
|
||||||
app:layout_behavior=".ui.BottomBarBehavior">
|
app:layout_behavior=".ui.BottomBarBehavior">
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/nav_drawer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="110dp"
|
android:layout_height="110dp"
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
|
|
|
@ -1,88 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
tools:context=".activity.PodSelectionActivity">
|
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
|
||||||
android:id="@+id/main__topbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
|
||||||
tools:showIn="@layout/podselection__activity">
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@+id/podselection__listpods"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_above="@+id/podselection__podupti_notice"
|
|
||||||
android:layout_below="@+id/podselection__edit_filter"
|
|
||||||
android:choiceMode="singleChoice" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/podselection__edit_filter"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_toEndOf="@+id/textView"
|
|
||||||
android:layout_toStartOf="@+id/podselection__button_select_pod"
|
|
||||||
android:hint="@string/filter_hint"
|
|
||||||
android:inputType="textUri|textWebEditText" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/podselection__button_select_pod"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_above="@+id/podselection__listpods"
|
|
||||||
android:layout_alignEnd="@+id/podselection__listpods"
|
|
||||||
android:layout_alignTop="@+id/podselection__edit_filter"
|
|
||||||
android:contentDescription="@string/confirm_url"
|
|
||||||
android:paddingLeft="5dp"
|
|
||||||
android:paddingRight="5dp"
|
|
||||||
android:src="@drawable/ic_arrow_forward_black_48px" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/podselection__podupti_notice"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:autoLink="web"
|
|
||||||
android:text="@string/podlist_source_note"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_above="@+id/podselection__listpods"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_marginEnd="0dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:text="@string/prefix_https"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
|
65
app/src/main/res/layout/podselection__fragment.xml
Normal file
65
app/src/main/res/layout/podselection__fragment.xml
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
tools:showIn="@layout/podselection__fragment">
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/podselection__listpods"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@+id/podselection__podupti_notice"
|
||||||
|
android:layout_below="@+id/podselection__edit_filter"
|
||||||
|
android:choiceMode="singleChoice" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/podselection__edit_filter"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_toEndOf="@+id/textView"
|
||||||
|
android:layout_toStartOf="@+id/podselection__button_select_pod"
|
||||||
|
android:hint="@string/filter_hint"
|
||||||
|
android:inputType="textUri|textWebEditText" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/podselection__button_select_pod"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@+id/podselection__listpods"
|
||||||
|
android:layout_alignEnd="@+id/podselection__listpods"
|
||||||
|
android:layout_alignTop="@+id/podselection__edit_filter"
|
||||||
|
android:contentDescription="@string/confirm_url"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:src="@drawable/ic_arrow_forward_black_48px" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/podselection__podupti_notice"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:autoLink="web"
|
||||||
|
android:text="@string/podlist_source_note"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@+id/podselection__listpods"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_marginEnd="0dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="@string/prefix_https"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
</RelativeLayout>
|
23
app/src/main/res/layout/recycler_view__list_item.xml
Normal file
23
app/src/main/res/layout/recycler_view__list_item.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/divider"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/recycler_view__list_item__text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||||
|
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/divider"/>
|
||||||
|
</LinearLayout>
|
33
app/src/main/res/layout/settings__activity.xml
Normal file
33
app/src/main/res/layout/settings__activity.xml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
tools:context=".activity.SettingsActivity">
|
||||||
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
android:id="@+id/settings__appbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/settings__toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways|snap"
|
||||||
|
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/settings__fragment_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/primary"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
tools:context=".activity.SplashActivity">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:shadowColor="@color/black"
|
|
||||||
android:minHeight="100dp"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
android:minWidth="100dp"
|
|
||||||
android:src="@drawable/ic_launcher"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginBottom="30dp"
|
|
||||||
android:text="@string/app_name"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="32sp"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
|
@ -61,7 +61,7 @@
|
||||||
android:title="@string/settings" />
|
android:title="@string/settings" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_help_license"
|
android:id="@+id/nav_about"
|
||||||
android:icon="@drawable/ic_info_black_48px"
|
android:icon="@drawable/ic_info_black_48px"
|
||||||
android:title="@string/nav_help_license" />
|
android:title="@string/nav_help_license" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context=".activity.PodSelectionActivity">
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_reload"
|
android:id="@+id/action_reload"
|
||||||
|
|
|
@ -4,6 +4,9 @@ https://github.com/guardianproject/NetCipher
|
||||||
NEWENTRY ButterKnife
|
NEWENTRY ButterKnife
|
||||||
https://jakewharton.github.io/butterknife
|
https://jakewharton.github.io/butterknife
|
||||||
|
|
||||||
|
NEWENTRY ShiftColorPicker
|
||||||
|
https://github.com/DASAR/ShiftColorPicker
|
||||||
|
|
||||||
NEWENTRY Android Support Library
|
NEWENTRY Android Support Library
|
||||||
https://developer.android.com/topic/libraries/support-library/index.html
|
https://developer.android.com/topic/libraries/support-library/index.html
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,13 @@
|
||||||
<string name="pref_title__sub_nav_slider">Navigations Slider</string>
|
<string name="pref_title__sub_nav_slider">Navigations Slider</string>
|
||||||
<string name="pref_desc__sub_nav_slider">Konfiguration der Sichtbarkeit von Einträgen im Navigation-Slider</string>
|
<string name="pref_desc__sub_nav_slider">Konfiguration der Sichtbarkeit von Einträgen im Navigation-Slider</string>
|
||||||
<string name="pref_cat__visibility_nav_items">Sichtbarkeit der Einträge</string>
|
<string name="pref_cat__visibility_nav_items">Sichtbarkeit der Einträge</string>
|
||||||
|
<!-- Themes -->
|
||||||
|
<string name="pref_title__themes">Farbschema</string>
|
||||||
|
<string name="pref_desc__themes">Einstellungen des Farbdesigns</string>
|
||||||
|
<string name="pref_title__primary_color">Primärfarbe</string>
|
||||||
|
<string name="pref_desc__primary_color">Färbung der Werkzeugleisten</string>
|
||||||
|
<string name="pref_title__accent_color">Akzentfarbe</string>
|
||||||
|
<string name="pref_desc__accent_color">Färbung der Details</string>
|
||||||
<!-- Font size -->
|
<!-- Font size -->
|
||||||
<string name="pref_title__font_size">Schriftgröße</string>
|
<string name="pref_title__font_size">Schriftgröße</string>
|
||||||
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
|
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->
|
||||||
|
@ -21,13 +28,14 @@
|
||||||
<string name="pref_title__load_images">Lade Bilder</string>
|
<string name="pref_title__load_images">Lade Bilder</string>
|
||||||
<string name="pref_desc__load_images">Deaktiviere das Laden von Bildern, um den Datenverbrauch zu verringern</string>
|
<string name="pref_desc__load_images">Deaktiviere das Laden von Bildern, um den Datenverbrauch zu verringern</string>
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
|
<string name="pref_title__sub_proxy">Proxy</string>
|
||||||
<string name="pref_title__proxy_enabled">Aktiviere Netzwerkproxy</string>
|
<string name="pref_title__proxy_enabled">Aktiviere Netzwerkproxy</string>
|
||||||
<string name="pref_desc__proxy_enabled">Nutze einen Proxyserver, um Firewalls zu umgehen</string>
|
<string name="pref_desc__http_proxy_enabled">Nutze einen Proxyserver, um Firewalls zu umgehen</string>
|
||||||
<string name="pref_title__proxy_host">Host</string>
|
<string name="pref_title__http_proxy_host">Host</string>
|
||||||
<string name="pref_title__proxy_port">Port</string>
|
<string name="pref_title__http_proxy_port">Port</string>
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
<string name="pref_title__chrome_custom_tabs_enabled">Chrome Custom Tabs</string>
|
<string name="pref_title__chrome_custom_tabs_enabled">Chrome Custom Tabs</string>
|
||||||
<string name="pref_desc__chrome_custom_tabs_enabled">Externe Links mit Chrome Custom Tabs öffnen. Für dieses Feature muss Chromium oder Google Chrome installiert sein</string>
|
<string name="pref_desc__chrome_custom_tabs_enabled">Externe Links mit Chrome Custom Tabs öffnen. Chromium oder Google Chrome muss für dieses Feature installiert sein.\nWICHTIGER HINWEIS: Chrome Custom Tabs verwenden die konfigurierten Proxy-Server nicht!</string>
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">Persönliche Einstellungen</string>
|
<string name="pref_title__personal_settings">Persönliche Einstellungen</string>
|
||||||
<string name="pref_desc__personal_settings">Öffne die Einstellungen deines Diaspora Accounts</string>
|
<string name="pref_desc__personal_settings">Öffne die Einstellungen deines Diaspora Accounts</string>
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
<string name="pref_desc__load_images">Desactivar la carga de de imágenes a datos móviles seguros</string>
|
<string name="pref_desc__load_images">Desactivar la carga de de imágenes a datos móviles seguros</string>
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
<string name="pref_title__proxy_enabled">Activar Proxy</string>
|
<string name="pref_title__proxy_enabled">Activar Proxy</string>
|
||||||
<string name="pref_desc__proxy_enabled">El tráfico proxificado de Diaspora para evitar firewalls.\nPuede necesitar reiniciarse</string>
|
<string name="pref_desc__http_proxy_enabled">El tráfico proxificado de Diaspora para evitar firewalls.\nPuede necesitar reiniciarse</string>
|
||||||
<string name="pref_title__proxy_host">Anfitrión</string>
|
<string name="pref_title__http_proxy_host">Anfitrión</string>
|
||||||
<string name="pref_title__proxy_port">Puerto</string>
|
<string name="pref_title__http_proxy_port">Puerto</string>
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">Configuración personal</string>
|
<string name="pref_title__personal_settings">Configuración personal</string>
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
<string name="pref_title__load_images">Charger les images</string>
|
<string name="pref_title__load_images">Charger les images</string>
|
||||||
<string name="pref_desc__load_images">Désactiver le chargements des images pour préserver la data mobile</string>
|
<string name="pref_desc__load_images">Désactiver le chargements des images pour préserver la data mobile</string>
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
|
<string name="pref_title__sub_proxy">Proxy</string>
|
||||||
<string name="pref_title__proxy_enabled">Activer Proxy</string>
|
<string name="pref_title__proxy_enabled">Activer Proxy</string>
|
||||||
<string name="pref_desc__proxy_enabled">Serveur Proxy.\n(Nécessite un redémarrage)</string>
|
<string name="pref_desc__http_proxy_enabled">Serveur Proxy.\n(Nécessite un redémarrage)</string>
|
||||||
<string name="pref_title__proxy_host">Hôte</string>
|
<string name="pref_title__http_proxy_host">Hôte</string>
|
||||||
<string name="pref_title__proxy_port">Port</string>
|
<string name="pref_title__http_proxy_port">Port</string>
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
<string name="pref_title__chrome_custom_tabs_enabled">Onglets personnalisés de Chrome</string>
|
<string name="pref_title__chrome_custom_tabs_enabled">Onglets personnalisés de Chrome</string>
|
||||||
<string name="pref_desc__chrome_custom_tabs_enabled">Ouvrir les liens externes avec les onglets personnalisés. Chromium ou Google Chrome doit être installé pour cette fonctionnalité</string>
|
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">Paramètres personnels</string>
|
<string name="pref_title__personal_settings">Paramètres personnels</string>
|
||||||
<string name="pref_desc__personal_settings">Ouvrir vos paramètres de compte diaspora</string>
|
<string name="pref_desc__personal_settings">Ouvrir vos paramètres de compte diaspora</string>
|
||||||
|
|
|
@ -21,11 +21,13 @@
|
||||||
<string name="pref_title__load_images">Carica immagini</string>
|
<string name="pref_title__load_images">Carica immagini</string>
|
||||||
<string name="pref_desc__load_images">Disabilita il caricamento delle immagini per risparmiare la rete dati</string>
|
<string name="pref_desc__load_images">Disabilita il caricamento delle immagini per risparmiare la rete dati</string>
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
|
<string name="pref_title__sub_proxy">Proxy</string>
|
||||||
<string name="pref_title__proxy_enabled">Attiva proxy</string>
|
<string name="pref_title__proxy_enabled">Attiva proxy</string>
|
||||||
<string name="pref_desc__proxy_enabled">Traffico del proxy di Diaspora per bypassare i firewall.\nPuò essere necessario il riavvio dell\'app</string>
|
<string name="pref_desc__http_proxy_enabled">Traffico del proxy di Diaspora per bypassare i firewall.\nPuò essere necessario il riavvio dell\'app</string>
|
||||||
<string name="pref_title__proxy_host">Host</string>
|
<string name="pref_title__http_proxy_host">Host</string>
|
||||||
<string name="pref_title__proxy_port">Porta</string>
|
<string name="pref_title__http_proxy_port">Porta</string>
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
|
<string name="pref_title__chrome_custom_tabs_enabled">Schede personalizzate di Chrome</string>
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">Impostazioni personali</string>
|
<string name="pref_title__personal_settings">Impostazioni personali</string>
|
||||||
<string name="pref_desc__personal_settings">Apri le impostazioni del tuo account Diaspora</string>
|
<string name="pref_desc__personal_settings">Apri le impostazioni del tuo account Diaspora</string>
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
<string name="pref_title__load_images">画像の読み込み</string>
|
<string name="pref_title__load_images">画像の読み込み</string>
|
||||||
<string name="pref_desc__load_images">安全なモバイルデータのため、画像の読み込みを無効にします</string>
|
<string name="pref_desc__load_images">安全なモバイルデータのため、画像の読み込みを無効にします</string>
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
|
<string name="pref_title__sub_proxy">プロキシ</string>
|
||||||
<string name="pref_title__proxy_enabled">プロキシを有効にする</string>
|
<string name="pref_title__proxy_enabled">プロキシを有効にする</string>
|
||||||
<string name="pref_desc__proxy_enabled">Diaspora の通信をプロキシして、ファイアウォールに回避します。\n再起動が必要になることがあります</string>
|
<string name="pref_desc__http_proxy_enabled">Diaspora の通信をプロキシして、ファイアウォールに回避します。\n再起動が必要になることがあります</string>
|
||||||
<string name="pref_title__proxy_host">ホスト</string>
|
<string name="pref_title__http_proxy_host">ホスト</string>
|
||||||
<string name="pref_title__proxy_port">ポート</string>
|
<string name="pref_title__http_proxy_port">ポート</string>
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
<string name="pref_title__chrome_custom_tabs_enabled">Chrome カスタムタブ</string>
|
<string name="pref_title__chrome_custom_tabs_enabled">Chrome カスタムタブ</string>
|
||||||
<string name="pref_desc__chrome_custom_tabs_enabled">Chrome カスタム タブで外部リンクを開きます。この機能は Chromium または Google Chrome をインストールする必要があります</string>
|
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">個人用設定</string>
|
<string name="pref_title__personal_settings">個人用設定</string>
|
||||||
<string name="pref_desc__personal_settings">Diaspora アカウント設定を開きます</string>
|
<string name="pref_desc__personal_settings">Diaspora アカウント設定を開きます</string>
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
<string name="pref_desc__load_images">മൊബൈൽ ഡാറ്റ ഉപഭോഗം കുറയ്ക്കാനായി ചിത്രങ്ങൾ ലോഡ് ചെയ്യാതിരിക്കുക</string>
|
<string name="pref_desc__load_images">മൊബൈൽ ഡാറ്റ ഉപഭോഗം കുറയ്ക്കാനായി ചിത്രങ്ങൾ ലോഡ് ചെയ്യാതിരിക്കുക</string>
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
<string name="pref_title__proxy_enabled">പ്രോക്സി അനുവദിക്കൂ</string>
|
<string name="pref_title__proxy_enabled">പ്രോക്സി അനുവദിക്കൂ</string>
|
||||||
<string name="pref_desc__proxy_enabled">ഫയർവാളുകളെ മറികടക്കാൻ ഡയസ്പോറ ട്രാഫിക് പ്രോക്സി ചെയ്യൂ.\nപുനരാരംഭിക്കേണ്ടി വന്നേക്കാം</string>
|
<string name="pref_desc__http_proxy_enabled">ഫയർവാളുകളെ മറികടക്കാൻ ഡയസ്പോറ ട്രാഫിക് പ്രോക്സി ചെയ്യൂ.\nപുനരാരംഭിക്കേണ്ടി വന്നേക്കാം</string>
|
||||||
<string name="pref_title__proxy_host">ആഥിതേയൻ</string>
|
<string name="pref_title__http_proxy_host">ആഥിതേയൻ</string>
|
||||||
<string name="pref_title__proxy_port">പോർട്ട്</string>
|
<string name="pref_title__http_proxy_port">പോർട്ട്</string>
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">സ്വകാര്യ സജ്ജീകരണങ്ങൾ</string>
|
<string name="pref_title__personal_settings">സ്വകാര്യ സജ്ജീകരണങ്ങൾ</string>
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
<string name="pref_desc__load_images">Afbeelding laden uitschakelen om mobiele data te besparen</string>
|
<string name="pref_desc__load_images">Afbeelding laden uitschakelen om mobiele data te besparen</string>
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
<string name="pref_title__proxy_enabled">Proxy inschakelen</string>
|
<string name="pref_title__proxy_enabled">Proxy inschakelen</string>
|
||||||
<string name="pref_desc__proxy_enabled">Gebruik een Proxy voor Diaspora om de firewalls te omzeilen.\nRestart nodig</string>
|
<string name="pref_desc__http_proxy_enabled">Gebruik een Proxy voor Diaspora om de firewalls te omzeilen.\nRestart nodig</string>
|
||||||
<string name="pref_title__proxy_host">Host</string>
|
<string name="pref_title__http_proxy_host">Host</string>
|
||||||
<string name="pref_title__proxy_port">Poort</string>
|
<string name="pref_title__http_proxy_port">Poort</string>
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">Persoonlijke instellingen</string>
|
<string name="pref_title__personal_settings">Persoonlijke instellingen</string>
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
<string name="pref_desc__load_images">Desabilitar o carregamento de imagens para economizar seus créditos</string>
|
<string name="pref_desc__load_images">Desabilitar o carregamento de imagens para economizar seus créditos</string>
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
<string name="pref_title__proxy_enabled">Habilitar o Proxy</string>
|
<string name="pref_title__proxy_enabled">Habilitar o Proxy</string>
|
||||||
<string name="pref_desc__proxy_enabled">Usar proxy para o tráfego da diáspora para contornar firewalls.\nPode requerer reinicialização</string>
|
<string name="pref_desc__http_proxy_enabled">Usar proxy para o tráfego da diáspora para contornar firewalls.\nPode requerer reinicialização</string>
|
||||||
<string name="pref_title__proxy_host">Servidor</string>
|
<string name="pref_title__http_proxy_host">Servidor</string>
|
||||||
<string name="pref_title__proxy_port">Porta</string>
|
<string name="pref_title__http_proxy_port">Porta</string>
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">Configurações pessoais</string>
|
<string name="pref_title__personal_settings">Configurações pessoais</string>
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
<string name="pref_desc__load_images">Отключить загрузку изображений для экономии траффика</string>
|
<string name="pref_desc__load_images">Отключить загрузку изображений для экономии траффика</string>
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
<string name="pref_title__proxy_enabled">Использовать прокси</string>
|
<string name="pref_title__proxy_enabled">Использовать прокси</string>
|
||||||
<string name="pref_desc__proxy_enabled">Перенаправить трафик Диаспоры в обход брандмауэров.\nМожет потребовать перезапуска</string>
|
<string name="pref_desc__http_proxy_enabled">Перенаправить трафик Диаспоры в обход брандмауэров.\nМожет потребовать перезапуска</string>
|
||||||
<string name="pref_title__proxy_host">Хост</string>
|
<string name="pref_title__http_proxy_host">Хост</string>
|
||||||
<string name="pref_title__proxy_port">Порт</string>
|
<string name="pref_title__http_proxy_port">Порт</string>
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">Личные настройки</string>
|
<string name="pref_title__personal_settings">Личные настройки</string>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<resources>>
|
<resources>>
|
||||||
|
|
||||||
<style name="AppTheme.NoActionBar">
|
<style name="DiasporaLight.NoActionBar">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">@color/primary</color>
|
<color name="colorPrimary">@color/md_blue_650</color>
|
||||||
<color name="colorPrimaryDark">@color/primary_dark</color>
|
<color name="colorPrimaryDark">@color/md_blue_750</color>
|
||||||
<color name="colorAccent">@color/accent</color>
|
<color name="colorAccent">@color/md_deep_orange_650</color>
|
||||||
|
|
||||||
<!-- Colors from Palette -->
|
<!-- Colors from Palette -->
|
||||||
<color name="primary">#207be6</color>
|
<color name="primary">@color/md_blue_650</color>
|
||||||
<color name="primary_dark">#195ed2</color>
|
<color name="primary_dark">@color/md_blue_750</color>
|
||||||
|
<color name="accent">@color/md_deep_orange_650</color>
|
||||||
<color name="primary_light">#BBDEFB</color>
|
<color name="primary_light">#BBDEFB</color>
|
||||||
<color name="accent">#FF5300</color>
|
|
||||||
<color name="primary_text">#212121</color>
|
<color name="primary_text">#212121</color>
|
||||||
<color name="secondary_text">#727272</color>
|
<color name="secondary_text">#727272</color>
|
||||||
<color name="icons">#FFFFFF</color>
|
<color name="icons">#FFFFFF</color>
|
||||||
|
@ -17,4 +17,331 @@
|
||||||
|
|
||||||
<color name="white">#ffffff</color>
|
<color name="white">#ffffff</color>
|
||||||
<color name="black">#000000</color>
|
<color name="black">#000000</color>
|
||||||
|
|
||||||
|
<!-- Taken from org.horaapps.leafpic -->
|
||||||
|
<!--Accent Color Collection-->
|
||||||
|
<color name="accent_red">#f44336</color>
|
||||||
|
<color name="accent_pink">#e91e63</color>
|
||||||
|
<color name="accent_purple">#9c27b0</color>
|
||||||
|
<color name="accent_deep_purple">#673ab7</color>
|
||||||
|
<color name="accent_indago">#3f51b5</color>
|
||||||
|
<color name="accent_blue">#2196f3</color>
|
||||||
|
<color name="accent_cyan">#00bcd4</color>
|
||||||
|
<color name="accent_teal">#009688</color>
|
||||||
|
<color name="accent_green">#4caf50</color>
|
||||||
|
<color name="accent_yellow">#ffeb3b</color>
|
||||||
|
<color name="accent_amber">#ffc107</color>
|
||||||
|
<color name="accent_orange">#ff9800</color>
|
||||||
|
<color name="accent_brown">#795548</color>
|
||||||
|
<color name="accent_white">#FFFFFF</color>
|
||||||
|
<color name="accent_grey">#9e9e9e</color>
|
||||||
|
<color name="accent_black">#000000</color>
|
||||||
|
|
||||||
|
<!--MATERIAL COLORS-->
|
||||||
|
<color name="md_black_1000">#000000</color>
|
||||||
|
|
||||||
|
<color name="md_light_primary_icon">#8A000000</color>
|
||||||
|
<color name="md_light_primary_text">#DE000000</color>
|
||||||
|
<color name="md_light_secondary">#8A000000</color>
|
||||||
|
<color name="md_light_statusbar">@color/md_grey_300</color>
|
||||||
|
<color name="md_light_appbar">@color/md_grey_100</color>
|
||||||
|
<color name="md_light_background">@color/md_grey_200</color>
|
||||||
|
<color name="md_light_cards">@color/md_white_1000</color>
|
||||||
|
<color name="md_light_dialogs">@color/md_white_1000</color>
|
||||||
|
<color name="md_light_disabled">#61000000</color>
|
||||||
|
<color name="md_light_dividers">#1F000000</color>
|
||||||
|
|
||||||
|
<color name="md_dark_appbar">@color/md_grey_900</color>
|
||||||
|
<color name="md_dark_background">@color/md_grey_850</color>
|
||||||
|
<color name="md_dark_cards">@color/md_grey_800</color>
|
||||||
|
<color name="md_dark_dialogs">@color/md_grey_800</color>
|
||||||
|
<color name="md_dark_disabled">#4DFFFFFF</color>
|
||||||
|
<color name="md_dark_dividers">#1FFFFFFF</color>
|
||||||
|
<color name="md_dark_primary_icon">#B3FFFFFF</color>
|
||||||
|
<color name="md_dark_primary_text">#FFFFFFFF</color>
|
||||||
|
<color name="md_dark_secondary">#B3FFFFFF</color>
|
||||||
|
<color name="md_dark_statusbar">@color/md_black_1000</color>
|
||||||
|
|
||||||
|
<!--ALL COLOURS-->
|
||||||
|
<color name="md_amber_100">#FFECB3</color>
|
||||||
|
<color name="md_amber_200">#FFE082</color>
|
||||||
|
<color name="md_amber_300">#FFD54F</color>
|
||||||
|
<color name="md_amber_400">#FFCA28</color>
|
||||||
|
<color name="md_amber_50">#FFF8E1</color>
|
||||||
|
<color name="md_amber_500">#FFC107</color>
|
||||||
|
<color name="md_amber_600">#FFB300</color>
|
||||||
|
<color name="md_amber_700">#FFA000</color>
|
||||||
|
<color name="md_amber_800">#FF8F00</color>
|
||||||
|
<color name="md_amber_900">#FF6F00</color>
|
||||||
|
<color name="md_amber_A100">#FFE57F</color>
|
||||||
|
<color name="md_amber_A200">#FFD740</color>
|
||||||
|
<color name="md_amber_A400">#FFC400</color>
|
||||||
|
<color name="md_amber_A700">#FFAB00</color>
|
||||||
|
|
||||||
|
<color name="md_blue_100">#BBDEFB</color>
|
||||||
|
<color name="md_blue_200">#90CAF9</color>
|
||||||
|
<color name="md_blue_300">#64B5F6</color>
|
||||||
|
<color name="md_blue_400">#42A5F5</color>
|
||||||
|
<color name="md_blue_50">#E3F2FD</color>
|
||||||
|
<color name="md_blue_500">#2196F3</color>
|
||||||
|
<color name="md_blue_600">#1E88E5</color>
|
||||||
|
<color name="md_blue_650">#207be6</color>
|
||||||
|
<color name="md_blue_700">#1976D2</color>
|
||||||
|
<color name="md_blue_750">#195ed2</color>
|
||||||
|
<color name="md_blue_800">#1565C0</color>
|
||||||
|
<color name="md_blue_900">#0D47A1</color>
|
||||||
|
<color name="md_blue_A100">#82B1FF</color>
|
||||||
|
<color name="md_blue_A200">#448AFF</color>
|
||||||
|
<color name="md_blue_A400">#2979FF</color>
|
||||||
|
<color name="md_blue_A700">#2962FF</color>
|
||||||
|
|
||||||
|
<color name="md_blue_grey_100">#CFD8DC</color>
|
||||||
|
<color name="md_blue_grey_200">#B0BEC5</color>
|
||||||
|
<color name="md_blue_grey_300">#90A4AE</color>
|
||||||
|
<color name="md_blue_grey_400">#78909C</color>
|
||||||
|
<color name="md_blue_grey_50">#ECEFF1</color>
|
||||||
|
<color name="md_blue_grey_500">#607D8B</color>
|
||||||
|
<color name="md_blue_grey_600">#546E7A</color>
|
||||||
|
<color name="md_blue_grey_700">#455A64</color>
|
||||||
|
<color name="md_blue_grey_800">#37474F</color>
|
||||||
|
<color name="md_blue_grey_900">#263238</color>
|
||||||
|
|
||||||
|
<color name="md_brown_100">#D7CCC8</color>
|
||||||
|
<color name="md_brown_200">#BCAAA4</color>
|
||||||
|
<color name="md_brown_300">#A1887F</color>
|
||||||
|
<color name="md_brown_400">#8D6E63</color>
|
||||||
|
<color name="md_brown_50">#EFEBE9</color>
|
||||||
|
<color name="md_brown_500">#795548</color>
|
||||||
|
<color name="md_brown_600">#6D4C41</color>
|
||||||
|
<color name="md_brown_700">#5D4037</color>
|
||||||
|
<color name="md_brown_800">#4E342E</color>
|
||||||
|
<color name="md_brown_900">#3E2723</color>
|
||||||
|
|
||||||
|
<color name="md_cyan_100">#B2EBF2</color>
|
||||||
|
<color name="md_cyan_200">#80DEEA</color>
|
||||||
|
<color name="md_cyan_300">#4DD0E1</color>
|
||||||
|
<color name="md_cyan_400">#26C6DA</color>
|
||||||
|
<color name="md_cyan_50">#E0F7FA</color>
|
||||||
|
<color name="md_cyan_500">#00BCD4</color>
|
||||||
|
<color name="md_cyan_600">#00ACC1</color>
|
||||||
|
<color name="md_cyan_700">#0097A7</color>
|
||||||
|
<color name="md_cyan_800">#00838F</color>
|
||||||
|
<color name="md_cyan_900">#006064</color>
|
||||||
|
<color name="md_cyan_A100">#84FFFF</color>
|
||||||
|
<color name="md_cyan_A200">#18FFFF</color>
|
||||||
|
<color name="md_cyan_A400">#00E5FF</color>
|
||||||
|
<color name="md_cyan_A700">#00B8D4</color>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<color name="md_deep_orange_100">#FFCCBC</color>
|
||||||
|
<color name="md_deep_orange_200">#FFAB91</color>
|
||||||
|
<color name="md_deep_orange_300">#FF8A65</color>
|
||||||
|
<color name="md_deep_orange_400">#FF7043</color>
|
||||||
|
<color name="md_deep_orange_50">#FBE9E7</color>
|
||||||
|
<color name="md_deep_orange_500">#FF5722</color>
|
||||||
|
<color name="md_deep_orange_600">#F4511E</color>
|
||||||
|
<color name="md_deep_orange_650">#FF5300</color>
|
||||||
|
<color name="md_deep_orange_700">#E64A19</color>
|
||||||
|
<color name="md_deep_orange_800">#D84315</color>
|
||||||
|
<color name="md_deep_orange_900">#BF360C</color>
|
||||||
|
<color name="md_deep_orange_A100">#FF9E80</color>
|
||||||
|
<color name="md_deep_orange_A200">#FF6E40</color>
|
||||||
|
<color name="md_deep_orange_A400">#FF3D00</color>
|
||||||
|
<color name="md_deep_orange_A700">#DD2C00</color>
|
||||||
|
|
||||||
|
<color name="md_deep_purple_100">#D1C4E9</color>
|
||||||
|
<color name="md_deep_purple_200">#B39DDB</color>
|
||||||
|
<color name="md_deep_purple_300">#9575CD</color>
|
||||||
|
<color name="md_deep_purple_400">#7E57C2</color>
|
||||||
|
<color name="md_deep_purple_50">#EDE7F6</color>
|
||||||
|
<color name="md_deep_purple_500">#673AB7</color>
|
||||||
|
<color name="md_deep_purple_600">#5E35B1</color>
|
||||||
|
<color name="md_deep_purple_700">#512DA8</color>
|
||||||
|
<color name="md_deep_purple_800">#4527A0</color>
|
||||||
|
<color name="md_deep_purple_900">#311B92</color>
|
||||||
|
<color name="md_deep_purple_A100">#B388FF</color>
|
||||||
|
<color name="md_deep_purple_A200">#7C4DFF</color>
|
||||||
|
<color name="md_deep_purple_A400">#651FFF</color>
|
||||||
|
<color name="md_deep_purple_A700">#6200EA</color>
|
||||||
|
|
||||||
|
<color name="md_green_100">#C8E6C9</color>
|
||||||
|
<color name="md_green_200">#A5D6A7</color>
|
||||||
|
<color name="md_green_300">#81C784</color>
|
||||||
|
<color name="md_green_400">#66BB6A</color>
|
||||||
|
<color name="md_green_50">#E8F5E9</color>
|
||||||
|
<color name="md_green_500">#4CAF50</color>
|
||||||
|
<color name="md_green_600">#43A047</color>
|
||||||
|
<color name="md_green_700">#388E3C</color>
|
||||||
|
<color name="md_green_800">#2E7D32</color>
|
||||||
|
<color name="md_green_900">#1B5E20</color>
|
||||||
|
<color name="md_green_A100">#B9F6CA</color>
|
||||||
|
<color name="md_green_A200">#69F0AE</color>
|
||||||
|
<color name="md_green_A400">#00E676</color>
|
||||||
|
<color name="md_green_A700">#00C853</color>
|
||||||
|
|
||||||
|
<color name="md_grey_100">#F5F5F5</color>
|
||||||
|
<color name="md_grey_200">#EEEEEE</color>
|
||||||
|
<color name="md_grey_300">#E0E0E0</color>
|
||||||
|
<color name="md_grey_400">#BDBDBD</color>
|
||||||
|
<color name="md_grey_50">#FAFAFA</color>
|
||||||
|
<color name="md_grey_500">#9E9E9E</color>
|
||||||
|
<color name="md_grey_600">#757575</color>
|
||||||
|
<color name="md_grey_700">#616161</color>
|
||||||
|
<color name="md_grey_800">#424242</color>
|
||||||
|
<color name="md_grey_850">#303030</color>
|
||||||
|
<color name="md_grey_900">#212121</color>
|
||||||
|
|
||||||
|
<color name="md_indigo_100">#C5CAE9</color>
|
||||||
|
<color name="md_indigo_200">#9FA8DA</color>
|
||||||
|
<color name="md_indigo_300">#7986CB</color>
|
||||||
|
<color name="md_indigo_400">#5C6BC0</color>
|
||||||
|
<color name="md_indigo_50">#E8EAF6</color>
|
||||||
|
<color name="md_indigo_500">#3F51B5</color>
|
||||||
|
<color name="md_indigo_600">#3949AB</color>
|
||||||
|
<color name="md_indigo_700">#303F9F</color>
|
||||||
|
<color name="md_indigo_800">#283593</color>
|
||||||
|
<color name="md_indigo_900">#1A237E</color>
|
||||||
|
<color name="md_indigo_A100">#8C9EFF</color>
|
||||||
|
<color name="md_indigo_A200">#536DFE</color>
|
||||||
|
<color name="md_indigo_A400">#3D5AFE</color>
|
||||||
|
<color name="md_indigo_A700">#304FFE</color>
|
||||||
|
|
||||||
|
<color name="md_light_blue_100">#B3E5FC</color>
|
||||||
|
<color name="md_light_blue_200">#81D4FA</color>
|
||||||
|
<color name="md_light_blue_300">#4FC3F7</color>
|
||||||
|
<color name="md_light_blue_400">#29B6F6</color>
|
||||||
|
<color name="md_light_blue_50">#E1F5FE</color>
|
||||||
|
<color name="md_light_blue_500">#03A9F4</color>
|
||||||
|
<color name="md_light_blue_600">#039BE5</color>
|
||||||
|
<color name="md_light_blue_700">#0288D1</color>
|
||||||
|
<color name="md_light_blue_800">#0277BD</color>
|
||||||
|
<color name="md_light_blue_900">#01579B</color>
|
||||||
|
<color name="md_light_blue_A100">#80D8FF</color>
|
||||||
|
<color name="md_light_blue_A200">#40C4FF</color>
|
||||||
|
<color name="md_light_blue_A400">#00B0FF</color>
|
||||||
|
<color name="md_light_blue_A700">#0091EA</color>
|
||||||
|
|
||||||
|
<color name="md_light_green_100">#DCEDC8</color>
|
||||||
|
<color name="md_light_green_200">#C5E1A5</color>
|
||||||
|
<color name="md_light_green_300">#AED581</color>
|
||||||
|
<color name="md_light_green_400">#9CCC65</color>
|
||||||
|
<color name="md_light_green_50">#F1F8E9</color>
|
||||||
|
<color name="md_light_green_500">#8BC34A</color>
|
||||||
|
<color name="md_light_green_600">#7CB342</color>
|
||||||
|
<color name="md_light_green_700">#689F38</color>
|
||||||
|
<color name="md_light_green_800">#558B2F</color>
|
||||||
|
<color name="md_light_green_900">#33691E</color>
|
||||||
|
<color name="md_light_green_A100">#CCFF90</color>
|
||||||
|
<color name="md_light_green_A200">#B2FF59</color>
|
||||||
|
<color name="md_light_green_A400">#76FF03</color>
|
||||||
|
<color name="md_light_green_A700">#64DD17</color>
|
||||||
|
|
||||||
|
<color name="md_lime_100">#F0F4C3</color>
|
||||||
|
<color name="md_lime_200">#E6EE9C</color>
|
||||||
|
<color name="md_lime_300">#DCE775</color>
|
||||||
|
<color name="md_lime_400">#D4E157</color>
|
||||||
|
<color name="md_lime_50">#F9FBE7</color>
|
||||||
|
<color name="md_lime_500">#CDDC39</color>
|
||||||
|
<color name="md_lime_600">#C0CA33</color>
|
||||||
|
<color name="md_lime_700">#AFB42B</color>
|
||||||
|
<color name="md_lime_800">#9E9D24</color>
|
||||||
|
<color name="md_lime_900">#827717</color>
|
||||||
|
<color name="md_lime_A100">#F4FF81</color>
|
||||||
|
<color name="md_lime_A200">#EEFF41</color>
|
||||||
|
<color name="md_lime_A400">#C6FF00</color>
|
||||||
|
<color name="md_lime_A700">#AEEA00</color>
|
||||||
|
|
||||||
|
<color name="md_orange_100">#FFE0B2</color>
|
||||||
|
<color name="md_orange_200">#FFCC80</color>
|
||||||
|
<color name="md_orange_300">#FFB74D</color>
|
||||||
|
<color name="md_orange_400">#FFA726</color>
|
||||||
|
<color name="md_orange_50">#FFF3E0</color>
|
||||||
|
<color name="md_orange_500">#FF9800</color>
|
||||||
|
<color name="md_orange_600">#FB8C00</color>
|
||||||
|
<color name="md_orange_700">#F57C00</color>
|
||||||
|
<color name="md_orange_800">#EF6C00</color>
|
||||||
|
<color name="md_orange_900">#E65100</color>
|
||||||
|
<color name="md_orange_A100">#FFD180</color>
|
||||||
|
<color name="md_orange_A200">#FFAB40</color>
|
||||||
|
<color name="md_orange_A400">#FF9100</color>
|
||||||
|
<color name="md_orange_A700">#FF6D00</color>
|
||||||
|
|
||||||
|
<color name="md_pink_100">#F8BBD0</color>
|
||||||
|
<color name="md_pink_200">#F48FB1</color>
|
||||||
|
<color name="md_pink_300">#F06292</color>
|
||||||
|
<color name="md_pink_400">#EC407A</color>
|
||||||
|
<color name="md_pink_50">#FCE4EC</color>
|
||||||
|
<color name="md_pink_500">#E91E63</color>
|
||||||
|
<color name="md_pink_600">#D81B60</color>
|
||||||
|
<color name="md_pink_700">#C2185B</color>
|
||||||
|
<color name="md_pink_800">#AD1457</color>
|
||||||
|
<color name="md_pink_900">#880E4F</color>
|
||||||
|
<color name="md_pink_A100">#FF80AB</color>
|
||||||
|
<color name="md_pink_A200">#FF4081</color>
|
||||||
|
<color name="md_pink_A400">#F50057</color>
|
||||||
|
<color name="md_pink_A700">#C51162</color>
|
||||||
|
|
||||||
|
<color name="md_purple_100">#E1BEE7</color>
|
||||||
|
<color name="md_purple_200">#CE93D8</color>
|
||||||
|
<color name="md_purple_300">#BA68C8</color>
|
||||||
|
<color name="md_purple_400">#AB47BC</color>
|
||||||
|
<color name="md_purple_50">#F3E5F5</color>
|
||||||
|
<color name="md_purple_500">#9C27B0</color>
|
||||||
|
<color name="md_purple_600">#8E24AA</color>
|
||||||
|
<color name="md_purple_700">#7B1FA2</color>
|
||||||
|
<color name="md_purple_800">#6A1B9A</color>
|
||||||
|
<color name="md_purple_900">#4A148C</color>
|
||||||
|
<color name="md_purple_A100">#EA80FC</color>
|
||||||
|
<color name="md_purple_A200">#E040FB</color>
|
||||||
|
<color name="md_purple_A400">#D500F9</color>
|
||||||
|
<color name="md_purple_A700">#AA00FF</color>
|
||||||
|
|
||||||
|
<color name="md_red_100">#FFCDD2</color>
|
||||||
|
<color name="md_red_200">#EF9A9A</color>
|
||||||
|
<color name="md_red_300">#E57373</color>
|
||||||
|
<color name="md_red_400">#EF5350</color>
|
||||||
|
<color name="md_red_50">#FFEBEE</color>
|
||||||
|
<color name="md_red_500">#F44336</color>
|
||||||
|
<color name="md_red_600">#E53935</color>
|
||||||
|
<color name="md_red_700">#D32F2F</color>
|
||||||
|
<color name="md_red_800">#C62828</color>
|
||||||
|
<color name="md_red_900">#B71C1C</color>
|
||||||
|
<color name="md_red_A100">#FF8A80</color>
|
||||||
|
<color name="md_red_A200">#FF5252</color>
|
||||||
|
<color name="md_red_A400">#FF1744</color>
|
||||||
|
<color name="md_red_A700">#D50000</color>
|
||||||
|
|
||||||
|
<color name="md_teal_100">#B2DFDB</color>
|
||||||
|
<color name="md_teal_200">#80CBC4</color>
|
||||||
|
<color name="md_teal_300">#4DB6AC</color>
|
||||||
|
<color name="md_teal_400">#26A69A</color>
|
||||||
|
<color name="md_teal_50">#E0F2F1</color>
|
||||||
|
<color name="md_teal_500">#009688</color>
|
||||||
|
<color name="md_teal_600">#00897B</color>
|
||||||
|
<color name="md_teal_700">#00796B</color>
|
||||||
|
<color name="md_teal_800">#00695C</color>
|
||||||
|
<color name="md_teal_900">#004D40</color>
|
||||||
|
<color name="md_teal_A100">#A7FFEB</color>
|
||||||
|
<color name="md_teal_A200">#64FFDA</color>
|
||||||
|
<color name="md_teal_A400">#1DE9B6</color>
|
||||||
|
<color name="md_teal_A700">#00BFA5</color>
|
||||||
|
|
||||||
|
<color name="md_white_1000">#FFFFFF</color>
|
||||||
|
<color name="md_yellow_100">#FFF9C4</color>
|
||||||
|
<color name="md_yellow_200">#FFF59D</color>
|
||||||
|
<color name="md_yellow_300">#FFF176</color>
|
||||||
|
<color name="md_yellow_400">#FFEE58</color>
|
||||||
|
<color name="md_yellow_50">#FFFDE7</color>
|
||||||
|
<color name="md_yellow_500">#FFEB3B</color>
|
||||||
|
<color name="md_yellow_600">#FDD835</color>
|
||||||
|
<color name="md_yellow_700">#FBC02D</color>
|
||||||
|
<color name="md_yellow_800">#F9A825</color>
|
||||||
|
<color name="md_yellow_900">#F57F17</color>
|
||||||
|
<color name="md_yellow_A100">#FFFF8D</color>
|
||||||
|
<color name="md_yellow_A200">#FFFF00</color>
|
||||||
|
<color name="md_yellow_A400">#FFEA00</color>
|
||||||
|
<color name="md_yellow_A700">#FFD600</color>
|
||||||
|
|
||||||
|
<color name="transparent_black">#c4000000</color>
|
||||||
</resources>
|
</resources>
|
|
@ -7,6 +7,7 @@
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
<dimen name="fab_margin">16dp</dimen>
|
||||||
<dimen name="appbar_padding_top">8dp</dimen>
|
<dimen name="appbar_padding_top">8dp</dimen>
|
||||||
|
<dimen name="bottom_toolbar_height">45dp</dimen>
|
||||||
|
|
||||||
<!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
|
<!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
|
||||||
https://developer.android.com/design/patterns/navigation-drawer.html -->
|
https://developer.android.com/design/patterns/navigation-drawer.html -->
|
||||||
|
|
|
@ -15,11 +15,21 @@
|
||||||
<string name="pref_key__load_images" translatable="false">pref_key_load_images</string>
|
<string name="pref_key__load_images" translatable="false">pref_key_load_images</string>
|
||||||
<string name="pref_key__clear_cache" translatable="false">pref_key_clear_cache</string>
|
<string name="pref_key__clear_cache" translatable="false">pref_key_clear_cache</string>
|
||||||
<string name="pref_key__chrome_custom_tabs_enabled" translatable="false">pref_key__chrome_custom_tabs_enabled</string>
|
<string name="pref_key__chrome_custom_tabs_enabled" translatable="false">pref_key__chrome_custom_tabs_enabled</string>
|
||||||
|
<string name="pref_key__http_proxy_load_tor_preset">pref_key__http_proxy_load_tor_preset</string>
|
||||||
|
|
||||||
|
<!-- Themes -->
|
||||||
|
<string name="pref_key__primary_color__preference_click" translatable="false">pref_key_primary_color</string>
|
||||||
|
<string name="pref_key__primary_color_base" translatable="false">pref_key_primary_color_base</string>
|
||||||
|
<string name="pref_key__primary_color_shade" translatable="false">pref_key_primary_color_shade</string>
|
||||||
|
<string name="pref_key__accent_color__preference_click" translatable="false">pref_key_accent_color</string>
|
||||||
|
<string name="pref_key__accent_color_base" translatable="false">pref_key_accent_color_base</string>
|
||||||
|
<string name="pref_key__accent_color_shade" translatable="false">pref_key_accent_color_shade</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="pref_key__append_shared_via_app" translatable="false">pref_key_append_shared_via_app</string>
|
<string name="pref_key__append_shared_via_app" translatable="false">pref_key_append_shared_via_app</string>
|
||||||
<string name="pref_key__proxy_enabled" translatable="false">pref_key_proxy_enabled</string>
|
<string name="pref_key__http_proxy_enabled" translatable="false">pref_key_proxy_enabled</string>
|
||||||
<string name="pref_key__proxy_host" translatable="false">pref_key_proxy_host</string>
|
<string name="pref_key__http_proxy_host" translatable="false">pref_key_proxy_host</string>
|
||||||
<string name="pref_key__proxy_port" translatable="false">pref_key_proxy_port</string>
|
<string name="pref_key__http_proxy_port" translatable="false">pref_key_proxy_port</string>
|
||||||
<string name="pref_key__proxy_was_enabled" translatable="false">wasProxyEnabled</string>
|
<string name="pref_key__proxy_was_enabled" translatable="false">wasProxyEnabled</string>
|
||||||
|
|
||||||
<!-- Navigiation Slider -->
|
<!-- Navigiation Slider -->
|
||||||
|
@ -61,6 +71,13 @@
|
||||||
<string name="pref_desc__sub_nav_slider">Control visibility of entries in the navigation drawer</string>
|
<string name="pref_desc__sub_nav_slider">Control visibility of entries in the navigation drawer</string>
|
||||||
<string name="pref_cat__visibility_nav_items">Item visibility</string>
|
<string name="pref_cat__visibility_nav_items">Item visibility</string>
|
||||||
|
|
||||||
|
<!-- Themes -->
|
||||||
|
<string name="pref_title__themes">Theme and Colors</string>
|
||||||
|
<string name="pref_desc__themes">Control, which colors are used throughout the app</string>
|
||||||
|
<string name="pref_title__primary_color">Primary Color</string>
|
||||||
|
<string name="pref_desc__primary_color">Color of the toolbars</string>
|
||||||
|
<string name="pref_title__accent_color">Accent Color</string>
|
||||||
|
<string name="pref_desc__accent_color">Color of the progressbar</string>
|
||||||
|
|
||||||
<!-- Font size -->
|
<!-- Font size -->
|
||||||
<string name="pref_title__font_size">Font size</string>
|
<string name="pref_title__font_size">Font size</string>
|
||||||
|
@ -81,17 +98,21 @@
|
||||||
<string name="pref_desc__load_images">Disable image loading to safe mobile data</string>
|
<string name="pref_desc__load_images">Disable image loading to safe mobile data</string>
|
||||||
|
|
||||||
<!-- Proxy -->
|
<!-- Proxy -->
|
||||||
|
<string name="pref_title__http_proxy_load_tor_preset">Load Tor Preset</string>
|
||||||
|
<string name="pref_desc__http_proxy_load_tor_preset">Load proxy settings for Tor (Orbot) HTTP Proxy</string>
|
||||||
<string name="pref_title__sub_proxy">Proxy</string>
|
<string name="pref_title__sub_proxy">Proxy</string>
|
||||||
<string name="pref_desc__sub_proxy">@string/pref_desc__proxy_enabled</string>
|
<string name="pref_desc__sub_proxy" translatable="false">@string/pref_desc__http_proxy_enabled</string>
|
||||||
<string name="pref_title__proxy_enabled">Enable Proxy</string>
|
<string name="pref_title__proxy_enabled">Enable Proxy</string>
|
||||||
<string name="pref_desc__proxy_enabled">Proxy Diaspora\'s traffic to circumvent firewalls.\nMay require restart</string>
|
<string name="pref_desc__http_proxy_enabled">Proxy Diaspora\'s traffic to circumvent firewalls.\nMay require restart</string>
|
||||||
<string name="pref_title__proxy_host">Host</string>
|
<string name="pref_title__http_proxy_host">Host</string>
|
||||||
<string name="pref_title__proxy_port">Port</string>
|
<string name="pref_title__http_proxy_port">Port</string>
|
||||||
|
<string name="HTTP" translatable="false">HTTP</string>
|
||||||
|
<string name="SOCKS5" translatable="false">SOCKS5</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Chrome custom tabs -->
|
<!-- Chrome custom tabs -->
|
||||||
<string name="pref_title__chrome_custom_tabs_enabled">Chrome Custom Tabs</string>
|
<string name="pref_title__chrome_custom_tabs_enabled">Chrome Custom Tabs</string>
|
||||||
<string name="pref_desc__chrome_custom_tabs_enabled">Open external links with Chrome Custom Tabs. Chromium or Google Chrome needs to be installed for this feature</string>
|
<string name="pref_desc__chrome_custom_tabs_enabled">Open external links with Chrome Custom Tabs. Chromium or Google Chrome needs to be installed for this feature. \nIMPORTANT NOTE: Chrome Custom Tabs do not use configured proxy servers!</string>
|
||||||
|
|
||||||
<!-- Diaspora Settings -->
|
<!-- Diaspora Settings -->
|
||||||
<string name="pref_title__personal_settings">Personal settings</string>
|
<string name="pref_title__personal_settings">Personal settings</string>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="DiasporaLight" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
@ -9,11 +9,14 @@
|
||||||
<item name="actionMenuTextColor">@color/colorAccent</item>
|
<item name="actionMenuTextColor">@color/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.NoActionBar">
|
<style name="DiasporaLight.NoActionBar">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Settings" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
|
||||||
|
</style>
|
||||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
|
|
||||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||||
|
|
|
@ -57,6 +57,22 @@
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:title="@string/pref_title__themes"
|
||||||
|
android:summary="@string/pref_desc__themes" >
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="@string/pref_key__primary_color__preference_click"
|
||||||
|
android:summary="@string/pref_desc__primary_color"
|
||||||
|
android:title="@string/pref_title__primary_color" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="@string/pref_key__accent_color__preference_click"
|
||||||
|
android:summary="@string/pref_desc__accent_color"
|
||||||
|
android:title="@string/pref_title__accent_color" />
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:dialogTitle="@string/pref_title__font_size"
|
android:dialogTitle="@string/pref_title__font_size"
|
||||||
android:entries="@array/pref_entries__font_size"
|
android:entries="@array/pref_entries__font_size"
|
||||||
|
@ -129,21 +145,34 @@
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:summary="@string/pref_desc__sub_proxy"
|
android:summary="@string/pref_desc__sub_proxy"
|
||||||
android:title="@string/pref_title__sub_proxy">
|
android:title="@string/pref_title__sub_proxy">
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/HTTP">
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/pref_key__proxy_enabled"
|
android:key="@string/pref_key__http_proxy_enabled"
|
||||||
android:summary="@string/pref_desc__proxy_enabled"
|
android:summary="@string/pref_desc__http_proxy_enabled"
|
||||||
android:title="@string/pref_title__proxy_enabled"/>
|
android:title="@string/pref_title__proxy_enabled"/>
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:dependency="@string/pref_key__proxy_enabled"
|
android:dependency="@string/pref_key__http_proxy_enabled"
|
||||||
android:inputType="textNoSuggestions"
|
android:inputType="textNoSuggestions"
|
||||||
android:key="@string/pref_key__proxy_host"
|
android:key="@string/pref_key__http_proxy_host"
|
||||||
android:title="@string/pref_title__proxy_host"/>
|
android:title="@string/pref_title__http_proxy_host"/>
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:dependency="@string/pref_key__proxy_enabled"
|
android:dependency="@string/pref_key__http_proxy_enabled"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:key="@string/pref_key__proxy_port"
|
android:key="@string/pref_key__http_proxy_port"
|
||||||
android:title="@string/pref_title__proxy_port"/>
|
android:title="@string/pref_title__http_proxy_port"/>
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:icon="@drawable/tor_onion"
|
||||||
|
android:dependency="@string/pref_key__http_proxy_enabled"
|
||||||
|
android:key="@string/pref_key__http_proxy_load_tor_preset"
|
||||||
|
android:summary="@string/pref_desc__http_proxy_load_tor_preset"
|
||||||
|
android:title="@string/pref_title__http_proxy_load_tor_preset"/>
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|
1
tools/localization/.gitignore
vendored
1
tools/localization/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
crowdin.yaml
|
|
|
@ -1,40 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#########################################################
|
|
||||||
#
|
|
||||||
# Title
|
|
||||||
#
|
|
||||||
# Created by Gregor Santer (gsantner), 2016
|
|
||||||
# https://gsantner.github.io/
|
|
||||||
#
|
|
||||||
#########################################################
|
|
||||||
|
|
||||||
|
|
||||||
#Pfade
|
|
||||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
SCRIPTFILE=$(readlink -f $0)
|
|
||||||
SCRIPTPATH=$(dirname $SCRIPTFILE)
|
|
||||||
argc=$#
|
|
||||||
|
|
||||||
#########################################################
|
|
||||||
cd "$SCRIPTDIR"
|
|
||||||
|
|
||||||
if [ ! -f "crowdin.yaml" ] ; then
|
|
||||||
echo "project_identifier: diaspora-for-android" > 'crowdin.yaml'
|
|
||||||
echo "base_path: $(realpath '../../')" >>'crowdin.yaml'
|
|
||||||
echo "api_key: DONT_PUSH_API_KEY" >>'crowdin.yaml'
|
|
||||||
cat "../../crowdin.yaml" >> "crowdin.yaml"
|
|
||||||
echo "# Add all non locality languages here" >> "crowdin.yaml"
|
|
||||||
echo "# (e.g. enUS, enUK, deCH, deAT will automatically go into the right folder)" >> "crowdin.yaml"
|
|
||||||
echo "# Otherwise e.g. en would get added into the folder enEN (which is wrong)." >> "crowdin.yaml"
|
|
||||||
echo "# https://crowdin.com/page/api/language-codes contains supported language codes" >> "crowdin.yaml"
|
|
||||||
echo "# The first listed ones here are diffently managed by crowdin than on android" >> "crowdin.yaml"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep -q "DONT_PUSH" "crowdin.yaml" ; then
|
|
||||||
echo "Insert API key to crowdin.yaml"
|
|
||||||
echo "and update folder to the root folder of the repository"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load latest translations
|
|
||||||
crowdin-cli download -b master
|
|
Loading…
Reference in a new issue