mirror of
https://github.com/gsantner/dandelion
synced 2024-11-17 01:42:07 +01:00
pull refresh option+shortcut to themes
This commit is contained in:
parent
6bc3d3937f
commit
19d54c5c05
9 changed files with 56 additions and 5 deletions
|
@ -271,6 +271,8 @@ public class SettingsActivity extends ThemedActivity implements SharedPreference
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
|
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
|
||||||
|
AppSettings settings = ((App) getActivity().getApplication()).getSettings();
|
||||||
|
DiasporaUrlHelper diasporaUrlHelper = new DiasporaUrlHelper(settings);
|
||||||
if (isAdded() && preference.hasKey()) {
|
if (isAdded() && preference.hasKey()) {
|
||||||
String key = preference.getKey();
|
String key = preference.getKey();
|
||||||
if (key.equals(getString(R.string.pref_key__primary_color__preference_click))) {
|
if (key.equals(getString(R.string.pref_key__primary_color__preference_click))) {
|
||||||
|
@ -279,6 +281,13 @@ public class SettingsActivity extends ThemedActivity implements SharedPreference
|
||||||
} else if (key.equals(getString(R.string.pref_key__accent_color__preference_click))) {
|
} else if (key.equals(getString(R.string.pref_key__accent_color__preference_click))) {
|
||||||
showColorPickerDialog(2);
|
showColorPickerDialog(2);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (key.equals(getString(R.string.pref_key__manage_theme))) {
|
||||||
|
Intent intent = new Intent(getActivity(), MainActivity.class);
|
||||||
|
intent.setAction(MainActivity.ACTION_OPEN_URL);
|
||||||
|
intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getThemeUrl());
|
||||||
|
startActivity(intent);
|
||||||
|
getActivity().finish();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.onPreferenceTreeClick(screen, preference);
|
return super.onPreferenceTreeClick(screen, preference);
|
||||||
|
|
|
@ -363,6 +363,10 @@ public class AppSettings extends SharedPreferencesPropertyBackend {
|
||||||
return getBool(R.string.pref_key__open_youtube_external_enabled, true);
|
return getBool(R.string.pref_key__open_youtube_external_enabled, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSwipeRefreshEnabled() {
|
||||||
|
return getBool(R.string.pref_key__swipe_refresh_enabled, true);
|
||||||
|
}
|
||||||
|
|
||||||
public String getScreenRotation() {
|
public String getScreenRotation() {
|
||||||
return getString(R.string.pref_key__screen_rotation, R.string.rotation_val_system);
|
return getString(R.string.pref_key__screen_rotation, R.string.rotation_val_system);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class DiasporaUrlHelper {
|
||||||
public static final String SUBURL_NOTIFICATIONS_MENTIONED = "/notifications?type=mentioned";
|
public static final String SUBURL_NOTIFICATIONS_MENTIONED = "/notifications?type=mentioned";
|
||||||
public static final String SUBURL_NOTIFICATIONS_RESHARED = "/notifications?type=reshared";
|
public static final String SUBURL_NOTIFICATIONS_RESHARED = "/notifications?type=reshared";
|
||||||
public static final String SUBURL_NOTIFICATIONS_STARTED_SHARING = "/notifications?type=started_sharing";
|
public static final String SUBURL_NOTIFICATIONS_STARTED_SHARING = "/notifications?type=started_sharing";
|
||||||
|
public static final String SUBURL_THEME = "/user/edit";
|
||||||
|
|
||||||
public DiasporaUrlHelper(AppSettings settings) {
|
public DiasporaUrlHelper(AppSettings settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
@ -353,4 +354,13 @@ public class DiasporaUrlHelper {
|
||||||
}
|
}
|
||||||
return app.getString(R.string.aspects);
|
return app.getString(R.string.aspects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a url that points to the settings of the pod.
|
||||||
|
*
|
||||||
|
* @return https://(pod-domain.tld)/user/edit
|
||||||
|
*/
|
||||||
|
public String getThemeUrl() {
|
||||||
|
return getPodUrl() + SUBURL_THEME;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,9 +94,17 @@ public class BrowserFragment extends ThemedFragment {
|
||||||
this.setRetainInstance(true);
|
this.setRetainInstance(true);
|
||||||
|
|
||||||
//pull to refresh
|
//pull to refresh
|
||||||
swipe = view.findViewById(R.id.swipe);
|
swipe = view.findViewById( R.id.swipe );
|
||||||
swipe.setOnRefreshListener(() -> reloadUrl());
|
swipe.setDistanceToTriggerSync( 2000 );
|
||||||
swipe.setDistanceToTriggerSync(2000);
|
swipe.setOnRefreshListener( () -> reloadUrl() );
|
||||||
|
if (appSettings.isSwipeRefreshEnabled()){
|
||||||
|
swipe.setEnabled( true );
|
||||||
|
|
||||||
|
}else {
|
||||||
|
swipe.setRefreshing(false);
|
||||||
|
swipe.setEnabled( false );
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -149,4 +149,6 @@
|
||||||
<string name="pdf" translatable="false">PDF</string>
|
<string name="pdf" translatable="false">PDF</string>
|
||||||
<string name="gsantner" translatable="false">gsantner</string>
|
<string name="gsantner" translatable="false">gsantner</string>
|
||||||
<string name="pref_key__open_youtube_external_enabled" translatable="false">pref_key__open_youtube_external_enabled</string>
|
<string name="pref_key__open_youtube_external_enabled" translatable="false">pref_key__open_youtube_external_enabled</string>
|
||||||
|
<string name="pref_key__manage_theme" translatable="false">pref_key_manage_theme</string>
|
||||||
|
<string name="pref_key__swipe_refresh_enabled" translatable="false">pref_key__swipe_refresh_enabled</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -255,5 +255,9 @@
|
||||||
<string name="tell_me_more">Tell me more</string>
|
<string name="tell_me_more">Tell me more</string>
|
||||||
<string name="open_youtube_external_tabs_description">Enable to open Youtube links on external app</string>
|
<string name="open_youtube_external_tabs_description">Enable to open Youtube links on external app</string>
|
||||||
<string name="pref_title__open_youtube_external">Youtube links</string>
|
<string name="pref_title__open_youtube_external">Youtube links</string>
|
||||||
|
<string name="pref_desc__sub_theme">Change the theme of your channel</string>
|
||||||
|
<string name="pref_title__sub_theme">Hubzilla theme settings</string>
|
||||||
|
<string name="pref_title_swipe_refresh">Pull to refresh</string>
|
||||||
|
<string name="swipe_refresh_description">Pulling down on top of page to refresh.\nYou need to restart the app for changes to take effect.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -103,6 +103,13 @@
|
||||||
android:summary="@string/control_screen_rotation"
|
android:summary="@string/control_screen_rotation"
|
||||||
android:title="@string/screen_rotation"/>
|
android:title="@string/screen_rotation"/>
|
||||||
|
|
||||||
|
<com.github.dfa.diaspora_android.ui.theme.ThemedCheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:icon="@drawable/ic_touch_app_black_24px"
|
||||||
|
android:key="@string/pref_key__swipe_refresh_enabled"
|
||||||
|
android:title="@string/pref_title_swipe_refresh"
|
||||||
|
android:summary="@string/swipe_refresh_description"/>
|
||||||
|
|
||||||
</com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceCategory>
|
</com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceCategory>
|
||||||
|
|
||||||
<!-- Diaspora Pod Settings -->
|
<!-- Diaspora Pod Settings -->
|
||||||
|
|
|
@ -21,5 +21,12 @@
|
||||||
android:summary="@string/amoled_mode_description__app_specific"
|
android:summary="@string/amoled_mode_description__app_specific"
|
||||||
android:title="@string/amoled_mode"
|
android:title="@string/amoled_mode"
|
||||||
android:icon="@drawable/ic_color_lens_black_24px" />
|
android:icon="@drawable/ic_color_lens_black_24px" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:icon="@drawable/ic_color_lens_black_24px"
|
||||||
|
android:key="@string/pref_key__manage_theme"
|
||||||
|
android:summary="@string/pref_desc__sub_theme"
|
||||||
|
android:title="@string/pref_title__sub_theme"/>
|
||||||
|
|
||||||
</com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceCategory>
|
</com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
||||||
#Sun Apr 08 08:39:15 CEST 2018
|
#Tue Jan 15 17:52:59 CET 2019
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||||
|
|
Loading…
Reference in a new issue