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:
massimilianoLe 2019-02-07 10:25:06 +01:00 committed by Gregor Santner
parent b833311353
commit fb8eb60974
18 changed files with 77 additions and 26 deletions

View File

@ -9,7 +9,7 @@ Where:
* Reference: E-Mail, Webpage
* Text: Information about / kind of contribution
## LIST OF CONTRIBUTORS
-->
@ -30,3 +30,4 @@ Where:
* **[Jean Lucas](jean AT 4ray DOT co)**<br/>~° Spanish translation
* **[asereze](https://github.com/asereze)**<br/>~° Sardinian translation
* **[Xosé M. Lamas](http://xmgz.eu)**<br />~° Galician translation
* **[massimiliano](https://framagit.org/massimiliano)**<br />~° Contributor

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -93,6 +93,6 @@
<string name="device">Toestel</string>
<string name="diaspora_pod__appspecific">diaspora * Pod</string>
<!-- License & help (large amount of text) -->
<string name="open_youtube_external_tabs_description">Bemagtig om Youtube links oop te maak in eksterne Toeps</string>
<string name="pref_title__open_youtube_external">Youtube links</string>
<string name="enable_to_open_youtube_links_on_external_app">Bemagtig om Youtube links oop te maak in eksterne Toeps</string>
<string name="youtube_links">Youtube links</string>
</resources>

View File

@ -200,6 +200,6 @@ diaspora*. Si voleu contribuir, endavant! Actualment som un equip molt petit, de
<string name="the_following_libraries_are_used">S\'utilitzen les següents biblioteques:</string>
<string name="inspiration_from_leafpic__appspecific">Prenem alguna inspiració i codi de LeafPic. Aneu a comprovar-ho, també és programari gratuït!</string>
<string name="tell_me_more">Expliqueu-me més</string>
<string name="open_youtube_external_tabs_description">Activeu-ho per obrir enllaços de Youtube en aplicacions externes</string>
<string name="pref_title__open_youtube_external">Enllaços de YouTube</string>
<string name="enable_to_open_youtube_links_on_external_app">Activeu-ho per obrir enllaços de Youtube en aplicacions externes</string>
<string name="youtube_links">Enllaços de YouTube</string>
</resources>

View File

@ -198,6 +198,6 @@
<string name="the_following_libraries_are_used">Se utilizan las siguientes bibliotecas:</string>
<string name="inspiration_from_leafpic__appspecific">Tomamos algo de inspiración y código de LeafPic. ¡Venga, tomad prestado, es software libre también!</string>
<string name="tell_me_more">Saber más</string>
<string name="open_youtube_external_tabs_description">Habilitar para abrir enlaces de Youtube en aplicaciones externas</string>
<string name="pref_title__open_youtube_external">Enlaces de YouTube</string>
<string name="enable_to_open_youtube_links_on_external_app">Habilitar para abrir enlaces de Youtube en aplicaciones externas</string>
<string name="youtube_links">Enlaces de YouTube</string>
</resources>

View File

@ -201,6 +201,6 @@
<string name="the_following_libraries_are_used">Utilízase o seguinte código:</string>
<string name="inspiration_from_leafpic__appspecific">Inspirámonos e collemos código de LeafPic. Bótalle un ollo, tamén é software libre!</string>
<string name="tell_me_more">Cóntame máis</string>
<string name="open_youtube_external_tabs_description">Activar para abrir vídeos YouTube nunha app externa</string>
<string name="pref_title__open_youtube_external">Ligazóns YouTube</string>
<string name="enable_to_open_youtube_links_on_external_app">Activar para abrir vídeos YouTube nunha app externa</string>
<string name="youtube_links">Ligazóns YouTube</string>
</resources>

View File

@ -198,6 +198,6 @@
<string name="the_following_libraries_are_used">以下のライブラリーが使用されます:</string>
<string name="inspiration_from_leafpic__appspecific">LeafPic からいくつかのインスピレーションとコードを得ました。チェックしてみてください。同様のフリーソフトウェアです!</string>
<string name="tell_me_more">さらに詳しく</string>
<string name="open_youtube_external_tabs_description">外部アプリで Youtube のリンクを開くことができます</string>
<string name="pref_title__open_youtube_external">Youtube のリンク</string>
<string name="enable_to_open_youtube_links_on_external_app">外部アプリで Youtube のリンクを開くことができます</string>
<string name="youtube_links">Youtube のリンク</string>
</resources>

View File

@ -156,6 +156,6 @@
<string name="show_third_party_licenses">Bibliotecas de terceiros</string>
<string name="the_following_libraries_are_used">Utilizamos as seguintes bibliotecas:</string>
<string name="tell_me_more">Saber mais</string>
<string name="open_youtube_external_tabs_description">Ative para abrir as ligações YouTube na aplicação externa</string>
<string name="pref_title__open_youtube_external">Ligações YouTube</string>
<string name="enable_to_open_youtube_links_on_external_app">Ative para abrir as ligações YouTube na aplicação externa</string>
<string name="youtube_links">Ligações YouTube</string>
</resources>

View File

@ -198,6 +198,6 @@
<string name="the_following_libraries_are_used">Используются следующие библиотеки:</string>
<string name="inspiration_from_leafpic__appspecific">Мы вдохновлялись и взяли немного кода из LeafPic. Попробуйте это приложение, оно тоже является свободным ПО!</string>
<string name="tell_me_more">Расскажите мне больше</string>
<string name="open_youtube_external_tabs_description">Открывать ссылки на Youtube во внешних приложениях</string>
<string name="pref_title__open_youtube_external">Ссылки на Youtube</string>
<string name="enable_to_open_youtube_links_on_external_app">Открывать ссылки на Youtube во внешних приложениях</string>
<string name="youtube_links">Ссылки на Youtube</string>
</resources>

View File

@ -201,6 +201,6 @@
<string name="the_following_libraries_are_used">Sunt impreadas custas librerias:</string>
<string name="inspiration_from_leafpic__appspecific">Amus pigadu ispiratzione e parte de su còdighe dae LeafPic. Abbistade·bos·lu, est fintzas cussu unu programma lìberu!</string>
<string name="tell_me_more">Àteras informatziones</string>
<string name="open_youtube_external_tabs_description">Abìlita pro abèrrere sos ligàmenes de Youtube in un\'aplicatzione esterna</string>
<string name="pref_title__open_youtube_external">Ligàmenes de Youtube</string>
<string name="enable_to_open_youtube_links_on_external_app">Abìlita pro abèrrere sos ligàmenes de Youtube in un\'aplicatzione esterna</string>
<string name="youtube_links">Ligàmenes de Youtube</string>
</resources>

View File

@ -199,6 +199,6 @@
<string name="the_following_libraries_are_used">我們使用了下列程式庫:</string>
<string name="inspiration_from_leafpic__appspecific">我們從 LeafPic 應用程式得到一些啟發以及程式碼。去看看吧,它也是自由軟體喔!</string>
<string name="tell_me_more">再多說一些</string>
<string name="open_youtube_external_tabs_description">使用其他應用程式來開啟 Youtube 連結</string>
<string name="pref_title__open_youtube_external">Youtube 連結</string>
<string name="enable_to_open_youtube_links_on_external_app">使用其他應用程式來開啟 Youtube 連結</string>
<string name="youtube_links">Youtube 連結</string>
</resources>

View File

@ -149,4 +149,6 @@
<string name="pdf" translatable="false">PDF</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__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>

View File

@ -253,7 +253,10 @@
<string name="the_following_libraries_are_used">The following libraries are used:</string>
<string name="inspiration_from_leafpic__appspecific">We took some inspiration and code from LeafPic. Go check it out, it\'s free software as well!</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="pref_title__open_youtube_external">Youtube links</string>
<string name="enable_to_open_youtube_links_on_external_app">Enable to open Youtube links on external app</string>
<string name="youtube_links">Youtube links</string>
<string name="change_the_theme_of_your_account">Change the theme of your account</string>
<string name="pull_to_refresh">Pull to refresh</string>
<string name="pulling_down_on_top_of_page_to_refresh">Pulling down on top of page to refresh.\nYou need to restart the app for changes to take effect.</string>
</resources>

View File

@ -77,8 +77,8 @@
android:defaultValue="true"
android:icon="@drawable/ic_open_yt_external_black_24px"
android:key="@string/pref_key__open_youtube_external_enabled"
android:summary="@string/open_youtube_external_tabs_description"
android:title="@string/pref_title__open_youtube_external"/>
android:summary="@string/enable_to_open_youtube_links_on_external_app"
android:title="@string/youtube_links"/>
<com.github.dfa.diaspora_android.ui.theme.ThemedCheckBoxPreference
android:defaultValue="false"
@ -103,6 +103,13 @@
android:summary="@string/control_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/pull_to_refresh"
android:summary="@string/pulling_down_on_top_of_page_to_refresh"/>
</com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceCategory>
<!-- Diaspora Pod Settings -->

View File

@ -21,5 +21,12 @@
android:summary="@string/amoled_mode_description__app_specific"
android:title="@string/amoled_mode"
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/change_the_theme_of_your_account"
android:title="@string/open_diaspora_account_settings__appspecific"/>
</com.github.dfa.diaspora_android.ui.theme.ThemedPreferenceCategory>
</PreferenceScreen>