From fb8eb6097446e89bcf6449fda14c51cabb66fe96 Mon Sep 17 00:00:00 2001
From: massimilianoLe <44651815+massimilianoLe@users.noreply.github.com>
Date: Thu, 7 Feb 2019 10:25:06 +0100
Subject: [PATCH] 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
---
CONTRIBUTORS.md | 3 ++-
.../activity/SettingsActivity.java | 9 +++++++++
.../dfa/diaspora_android/util/AppSettings.java | 4 ++++
.../diaspora_android/util/DiasporaUrlHelper.java | 10 ++++++++++
.../dfa/diaspora_android/web/BrowserFragment.java | 14 +++++++++++---
app/src/main/res/values-af/strings.xml | 4 ++--
app/src/main/res/values-ca/strings.xml | 4 ++--
app/src/main/res/values-es/strings.xml | 4 ++--
app/src/main/res/values-gl/strings.xml | 4 ++--
app/src/main/res/values-ja/strings.xml | 4 ++--
app/src/main/res/values-pt/strings.xml | 4 ++--
app/src/main/res/values-ru/strings.xml | 4 ++--
app/src/main/res/values-sc/strings.xml | 4 ++--
app/src/main/res/values-zh-rTW/strings.xml | 4 ++--
.../main/res/values/strings-not_translatable.xml | 2 ++
app/src/main/res/values/strings.xml | 7 +++++--
app/src/main/res/xml/preferences__master.xml | 11 +++++++++--
app/src/main/res/xml/preferences__sub_themes.xml | 7 +++++++
18 files changed, 77 insertions(+), 26 deletions(-)
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 7969e4cd..2ab0dd4c 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -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)**
~° Spanish translation
* **[asereze](https://github.com/asereze)**
~° Sardinian translation
* **[Xosé M. Lamas](http://xmgz.eu)**
~° Galician translation
+* **[massimiliano](https://framagit.org/massimiliano)**
~° Contributor
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java
index acda2b0d..0a38744e 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java
@@ -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);
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java b/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java
index 8ae76fea..80c672ad 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java
@@ -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);
}
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java b/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java
index a283540b..b272dac0 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java
@@ -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;
+ }
}
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/web/BrowserFragment.java b/app/src/main/java/com/github/dfa/diaspora_android/web/BrowserFragment.java
index d28716d4..892426f3 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/web/BrowserFragment.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/web/BrowserFragment.java
@@ -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
diff --git a/app/src/main/res/values-af/strings.xml b/app/src/main/res/values-af/strings.xml
index d6bd4363..0229e195 100644
--- a/app/src/main/res/values-af/strings.xml
+++ b/app/src/main/res/values-af/strings.xml
@@ -93,6 +93,6 @@
Toestel
diaspora * Pod
- Bemagtig om Youtube links oop te maak in eksterne Toeps
- Youtube links
+ Bemagtig om Youtube links oop te maak in eksterne Toeps
+ Youtube links
diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml
index 84a39af3..32bc8d8a 100644
--- a/app/src/main/res/values-ca/strings.xml
+++ b/app/src/main/res/values-ca/strings.xml
@@ -200,6 +200,6 @@ diaspora*. Si voleu contribuir, endavant! Actualment som un equip molt petit, de
S\'utilitzen les següents biblioteques:
Prenem alguna inspiració i codi de LeafPic. Aneu a comprovar-ho, també és programari gratuït!
Expliqueu-me més
- Activeu-ho per obrir enllaços de Youtube en aplicacions externes
- Enllaços de YouTube
+ Activeu-ho per obrir enllaços de Youtube en aplicacions externes
+ Enllaços de YouTube
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 2568c56e..3d53df61 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -198,6 +198,6 @@
Se utilizan las siguientes bibliotecas:
Tomamos algo de inspiración y código de LeafPic. ¡Venga, tomad prestado, es software libre también!
Saber más
- Habilitar para abrir enlaces de Youtube en aplicaciones externas
- Enlaces de YouTube
+ Habilitar para abrir enlaces de Youtube en aplicaciones externas
+ Enlaces de YouTube
diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml
index ca91f3e6..f166c804 100644
--- a/app/src/main/res/values-gl/strings.xml
+++ b/app/src/main/res/values-gl/strings.xml
@@ -201,6 +201,6 @@
Utilízase o seguinte código:
Inspirámonos e collemos código de LeafPic. Bótalle un ollo, tamén é software libre!
Cóntame máis
- Activar para abrir vídeos YouTube nunha app externa
- Ligazóns YouTube
+ Activar para abrir vídeos YouTube nunha app externa
+ Ligazóns YouTube
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index a3b6c284..33261bce 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -198,6 +198,6 @@
以下のライブラリーが使用されます:
LeafPic からいくつかのインスピレーションとコードを得ました。チェックしてみてください。同様のフリーソフトウェアです!
さらに詳しく
- 外部アプリで Youtube のリンクを開くことができます
- Youtube のリンク
+ 外部アプリで Youtube のリンクを開くことができます
+ Youtube のリンク
diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml
index 0baf4751..36ce35e7 100644
--- a/app/src/main/res/values-pt/strings.xml
+++ b/app/src/main/res/values-pt/strings.xml
@@ -156,6 +156,6 @@
Bibliotecas de terceiros
Utilizamos as seguintes bibliotecas:
Saber mais
- Ative para abrir as ligações YouTube na aplicação externa
- Ligações YouTube
+ Ative para abrir as ligações YouTube na aplicação externa
+ Ligações YouTube
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 0a184397..69f32727 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -198,6 +198,6 @@
Используются следующие библиотеки:
Мы вдохновлялись и взяли немного кода из LeafPic. Попробуйте это приложение, оно тоже является свободным ПО!
Расскажите мне больше
- Открывать ссылки на Youtube во внешних приложениях
- Ссылки на Youtube
+ Открывать ссылки на Youtube во внешних приложениях
+ Ссылки на Youtube
diff --git a/app/src/main/res/values-sc/strings.xml b/app/src/main/res/values-sc/strings.xml
index 72288008..d2bfafdb 100644
--- a/app/src/main/res/values-sc/strings.xml
+++ b/app/src/main/res/values-sc/strings.xml
@@ -201,6 +201,6 @@
Sunt impreadas custas librerias:
Amus pigadu ispiratzione e parte de su còdighe dae LeafPic. Abbistade·bos·lu, est fintzas cussu unu programma lìberu!
Àteras informatziones
- Abìlita pro abèrrere sos ligàmenes de Youtube in un\'aplicatzione esterna
- Ligàmenes de Youtube
+ Abìlita pro abèrrere sos ligàmenes de Youtube in un\'aplicatzione esterna
+ Ligàmenes de Youtube
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index e88fea5d..81149e0d 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -199,6 +199,6 @@
我們使用了下列程式庫:
我們從 LeafPic 應用程式得到一些啟發以及程式碼。去看看吧,它也是自由軟體喔!
再多說一些
- 使用其他應用程式來開啟 Youtube 連結
- Youtube 連結
+ 使用其他應用程式來開啟 Youtube 連結
+ Youtube 連結
diff --git a/app/src/main/res/values/strings-not_translatable.xml b/app/src/main/res/values/strings-not_translatable.xml
index c66a18d4..7ffbe26a 100644
--- a/app/src/main/res/values/strings-not_translatable.xml
+++ b/app/src/main/res/values/strings-not_translatable.xml
@@ -149,4 +149,6 @@
PDF
gsantner
pref_key__open_youtube_external_enabled
+ pref_key_manage_theme
+ pref_key__swipe_refresh_enabled
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6c542f21..fccd49d0 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -253,7 +253,10 @@
The following libraries are used:
We took some inspiration and code from LeafPic. Go check it out, it\'s free software as well!
Tell me more
- Enable to open Youtube links on external app
- Youtube links
+ Enable to open Youtube links on external app
+ Youtube links
+ Change the theme of your account
+ Pull to refresh
+ Pulling down on top of page to refresh.\nYou need to restart the app for changes to take effect.
diff --git a/app/src/main/res/xml/preferences__master.xml b/app/src/main/res/xml/preferences__master.xml
index c1ab7939..c6afd55f 100644
--- a/app/src/main/res/xml/preferences__master.xml
+++ b/app/src/main/res/xml/preferences__master.xml
@@ -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"/>
+
+
diff --git a/app/src/main/res/xml/preferences__sub_themes.xml b/app/src/main/res/xml/preferences__sub_themes.xml
index ec5a5e00..aa4bde15 100644
--- a/app/src/main/res/xml/preferences__sub_themes.xml
+++ b/app/src/main/res/xml/preferences__sub_themes.xml
@@ -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" />
+
+
+
\ No newline at end of file