mirror of
https://github.com/gsantner/dandelion
synced 2025-09-10 10:49:42 +02:00
pullRefresh as option + Shortcut to settings @themesettings (#226)
* pull to refresh page * Make youtube links open external * corrected a bit but still not able to check if app is installed * corrected triggersync * Added option For user to choose how to open youtube links * removed unecessary comment * update with dandelion * pull refresh option+shortcut to themes * Changes request applyed * added name in contributors list
This commit is contained in:
parent
b833311353
commit
fb8eb60974
18 changed files with 77 additions and 26 deletions
|
@ -271,6 +271,8 @@ public class SettingsActivity extends ThemedActivity implements SharedPreference
|
|||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
|
||||
AppSettings settings = ((App) getActivity().getApplication()).getSettings();
|
||||
DiasporaUrlHelper diasporaUrlHelper = new DiasporaUrlHelper(settings);
|
||||
if (isAdded() && preference.hasKey()) {
|
||||
String key = preference.getKey();
|
||||
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))) {
|
||||
showColorPickerDialog(2);
|
||||
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);
|
||||
|
|
|
@ -363,6 +363,10 @@ public class AppSettings extends SharedPreferencesPropertyBackend {
|
|||
return getBool(R.string.pref_key__open_youtube_external_enabled, true);
|
||||
}
|
||||
|
||||
public boolean isSwipeRefreshEnabled() {
|
||||
return getBool(R.string.pref_key__swipe_refresh_enabled, true);
|
||||
}
|
||||
|
||||
public String getScreenRotation() {
|
||||
return getString(R.string.pref_key__screen_rotation, R.string.rotation_val_system);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ public class DiasporaUrlHelper {
|
|||
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_STARTED_SHARING = "/notifications?type=started_sharing";
|
||||
public static final String SUBURL_THEME = "/user/edit";
|
||||
|
||||
public DiasporaUrlHelper(AppSettings settings) {
|
||||
this.settings = settings;
|
||||
|
@ -353,4 +354,13 @@ public class DiasporaUrlHelper {
|
|||
}
|
||||
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);
|
||||
|
||||
//pull to refresh
|
||||
swipe = view.findViewById(R.id.swipe);
|
||||
swipe.setOnRefreshListener(() -> reloadUrl());
|
||||
swipe.setDistanceToTriggerSync(2000);
|
||||
swipe = view.findViewById( R.id.swipe );
|
||||
swipe.setDistanceToTriggerSync( 2000 );
|
||||
swipe.setOnRefreshListener( () -> reloadUrl() );
|
||||
if (appSettings.isSwipeRefreshEnabled()){
|
||||
swipe.setEnabled( true );
|
||||
|
||||
} else {
|
||||
swipe.setRefreshing( false );
|
||||
swipe.setEnabled( false );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue