summaryrefslogtreecommitdiff
path: root/org.fox.ttrss/src
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-06-26 14:40:42 +0300
committerAndrew Dolgov <[email protected]>2015-06-26 14:40:42 +0300
commitae3b87ff91d74de177d5557c093d61f4ea63d440 (patch)
tree617d4f1761f594b87a2ca813aa0fa6165d90d671 /org.fox.ttrss/src
parent26e14506c5bf9f5c4c8f156e099201e5f543ee99 (diff)
add workaround for android issue #26194, thanks google
Diffstat (limited to 'org.fox.ttrss/src')
-rwxr-xr-xorg.fox.ttrss/src/main/AndroidManifest.xml4
-rw-r--r--org.fox.ttrss/src/main/java/org/fox/ttrss/util/LessBrokenSwitchPreference.java77
-rwxr-xr-xorg.fox.ttrss/src/main/res/xml/preferences.xml42
3 files changed, 100 insertions, 23 deletions
diff --git a/org.fox.ttrss/src/main/AndroidManifest.xml b/org.fox.ttrss/src/main/AndroidManifest.xml
index eaaa8813..cc6b9edc 100755
--- a/org.fox.ttrss/src/main/AndroidManifest.xml
+++ b/org.fox.ttrss/src/main/AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
- android:versionCode="353"
- android:versionName="1.126" >
+ android:versionCode="354"
+ android:versionName="1.127" >
<uses-sdk
android:minSdkVersion="15"
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/LessBrokenSwitchPreference.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/LessBrokenSwitchPreference.java
new file mode 100644
index 00000000..df116064
--- /dev/null
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/LessBrokenSwitchPreference.java
@@ -0,0 +1,77 @@
+package org.fox.ttrss.util;
+
+// android is shit garbage
+// https://code.google.com/p/android/issues/detail?id=26194
+
+import android.content.Context;
+import android.preference.SwitchPreference;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Switch;
+
+public class LessBrokenSwitchPreference extends SwitchPreference {
+
+ /**
+ * Construct a new SwitchPreference with the given style options.
+ *
+ * @param context The Context that will style this preference
+ * @param attrs Style attributes that differ from the default
+ * @param defStyle Theme attribute defining the default style options
+ */
+ public LessBrokenSwitchPreference(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ /**
+ * Construct a new SwitchPreference with the given style options.
+ *
+ * @param context The Context that will style this preference
+ * @param attrs Style attributes that differ from the default
+ */
+ public LessBrokenSwitchPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ /**
+ * Construct a new SwitchPreference with default style options.
+ *
+ * @param context The Context that will style this preference
+ */
+ public LessBrokenSwitchPreference(Context context) {
+ super(context, null);
+ }
+
+ @Override
+ protected void onBindView(View view) {
+ // Clean listener before invoke SwitchPreference.onBindView
+ ViewGroup viewGroup= (ViewGroup)view;
+ clearListenerInViewGroup(viewGroup);
+ super.onBindView(view);
+ }
+
+ /**
+ * Clear listener in Switch for specify ViewGroup.
+ *
+ * @param viewGroup The ViewGroup that will need to clear the listener.
+ */
+ private void clearListenerInViewGroup(ViewGroup viewGroup) {
+ if (null == viewGroup) {
+ return;
+ }
+
+ int count = viewGroup.getChildCount();
+ for(int n = 0; n < count; ++n) {
+ View childView = viewGroup.getChildAt(n);
+ if(childView instanceof Switch) {
+ final Switch switchView = (Switch) childView;
+ switchView.setOnCheckedChangeListener(null);
+ return;
+ } else if (childView instanceof ViewGroup){
+ ViewGroup childGroup = (ViewGroup)childView;
+ clearListenerInViewGroup(childGroup);
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/org.fox.ttrss/src/main/res/xml/preferences.xml b/org.fox.ttrss/src/main/res/xml/preferences.xml
index bc259fcd..e8fcdcb6 100755
--- a/org.fox.ttrss/src/main/res/xml/preferences.xml
+++ b/org.fox.ttrss/src/main/res/xml/preferences.xml
@@ -24,12 +24,12 @@
</EditTextPreference>
</PreferenceCategory>
<PreferenceCategory android:title="@string/ssl" >
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="ssl_trust_any"
android:summary="@string/ssl_trust_any_long"
android:title="@string/ssl_trust_any" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="ssl_trust_any_host"
android:summary="@string/ssl_trust_any_host_long"
@@ -59,49 +59,49 @@
android:key="theme"
android:title="@string/pref_theme" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="sort_feeds_by_unread"
android:title="@string/sort_feeds_by_unread" />
- <!-- <SwitchPreference
+ <!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="download_feed_icons"
android:title="@string/download_feed_icons" /> -->
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="enable_cats"
android:title="@string/enable_cats" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:dependency="enable_cats"
android:key="browse_cats_like_feeds"
android:summary="@string/browse_cats_like_feeds_summary"
android:title="@string/browse_cats_like_feeds" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:key="headlines_show_content"
android:summary="@string/pref_headlines_show_content_long"
android:title="@string/pref_headlines_show_content" />
- <!-- <SwitchPreference
+ <!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:key="headlines_show_flavor_image"
android:title="@string/prefs_headlines_show_flavor_image" /> -->
- <!-- <SwitchPreference
+ <!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="headlines_full_content"
android:summary="@string/pref_headlines_full_content_long"
android:title="@string/pref_headlines_full_content" /> -->
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="headlines_mark_read_scroll"
android:summary="@string/pref_headlines_mark_read_scroll_long"
android:title="@string/pref_headlines_mark_read_scroll" />
- <!-- <SwitchPreference
+ <!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="enable_condensed_fonts"
android:summary="@string/pref_headlines_use_condensed_fonts_long"
@@ -121,7 +121,7 @@
android:summary="@string/prefs_headline_display_mode_long"
android:title="@string/prefs_headline_display_mode" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:key="open_fresh_on_startup"
android:title="@string/prefs_open_fresh_on_startup" />
@@ -133,24 +133,24 @@
android:key="article_font_size_sp"
android:inputType="number"
android:title="@string/pref_font_size" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:key="justify_article_text"
android:title="@string/justify_article_text" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="use_volume_keys"
android:summary="@string/use_volume_keys_long"
android:title="@string/use_volume_keys" />
- <!-- <SwitchPreference
+ <!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="full_screen_mode"
android:title="@string/prefs_fullscreen_mode" /> -->
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:key="confirm_headlines_catchup"
android:title="@string/prefs_confirm_headlines_catchup" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:key="enable_article_fab"
android:summary="@string/prefs_enable_fab_long"
@@ -165,26 +165,26 @@
android:summary="@string/offline_articles_to_download_long"
android:title="@string/offline_articles_to_download" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="offline_image_cache_enabled"
android:summary="@string/offline_image_cache_enabled_summary"
android:title="@string/offline_image_cache_enabled" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/prefs_widget" >
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:key="widget_show_fresh"
android:title="@string/prefs_widget_show_fresh"
android:summary="@string/prefs_widget_show_fresh_summary" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/debugging" >
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:key="webview_hardware_accel"
android:summary="@string/accel_webview_summary"
android:title="@string/accel_webview_title" />
- <SwitchPreference
+ <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="transport_debugging"
android:title="@string/transport_debugging" />