add workaround for android issue #26194, thanks google
This commit is contained in:
parent
26e14506c5
commit
ae3b87ff91
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.fox.ttrss"
|
package="org.fox.ttrss"
|
||||||
android:versionCode="353"
|
android:versionCode="354"
|
||||||
android:versionName="1.126" >
|
android:versionName="1.127" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="15"
|
android:minSdkVersion="15"
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -24,12 +24,12 @@
|
|||||||
</EditTextPreference>
|
</EditTextPreference>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/ssl" >
|
<PreferenceCategory android:title="@string/ssl" >
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="ssl_trust_any"
|
android:key="ssl_trust_any"
|
||||||
android:summary="@string/ssl_trust_any_long"
|
android:summary="@string/ssl_trust_any_long"
|
||||||
android:title="@string/ssl_trust_any" />
|
android:title="@string/ssl_trust_any" />
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="ssl_trust_any_host"
|
android:key="ssl_trust_any_host"
|
||||||
android:summary="@string/ssl_trust_any_host_long"
|
android:summary="@string/ssl_trust_any_host_long"
|
||||||
@ -59,49 +59,49 @@
|
|||||||
android:key="theme"
|
android:key="theme"
|
||||||
android:title="@string/pref_theme" />
|
android:title="@string/pref_theme" />
|
||||||
|
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="sort_feeds_by_unread"
|
android:key="sort_feeds_by_unread"
|
||||||
android:title="@string/sort_feeds_by_unread" />
|
android:title="@string/sort_feeds_by_unread" />
|
||||||
<!-- <SwitchPreference
|
<!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="download_feed_icons"
|
android:key="download_feed_icons"
|
||||||
android:title="@string/download_feed_icons" /> -->
|
android:title="@string/download_feed_icons" /> -->
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="enable_cats"
|
android:key="enable_cats"
|
||||||
android:title="@string/enable_cats" />
|
android:title="@string/enable_cats" />
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:dependency="enable_cats"
|
android:dependency="enable_cats"
|
||||||
android:key="browse_cats_like_feeds"
|
android:key="browse_cats_like_feeds"
|
||||||
android:summary="@string/browse_cats_like_feeds_summary"
|
android:summary="@string/browse_cats_like_feeds_summary"
|
||||||
android:title="@string/browse_cats_like_feeds" />
|
android:title="@string/browse_cats_like_feeds" />
|
||||||
|
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="headlines_show_content"
|
android:key="headlines_show_content"
|
||||||
android:summary="@string/pref_headlines_show_content_long"
|
android:summary="@string/pref_headlines_show_content_long"
|
||||||
android:title="@string/pref_headlines_show_content" />
|
android:title="@string/pref_headlines_show_content" />
|
||||||
|
|
||||||
<!-- <SwitchPreference
|
<!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="headlines_show_flavor_image"
|
android:key="headlines_show_flavor_image"
|
||||||
android:title="@string/prefs_headlines_show_flavor_image" /> -->
|
android:title="@string/prefs_headlines_show_flavor_image" /> -->
|
||||||
|
|
||||||
<!-- <SwitchPreference
|
<!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="headlines_full_content"
|
android:key="headlines_full_content"
|
||||||
android:summary="@string/pref_headlines_full_content_long"
|
android:summary="@string/pref_headlines_full_content_long"
|
||||||
android:title="@string/pref_headlines_full_content" /> -->
|
android:title="@string/pref_headlines_full_content" /> -->
|
||||||
|
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="headlines_mark_read_scroll"
|
android:key="headlines_mark_read_scroll"
|
||||||
android:summary="@string/pref_headlines_mark_read_scroll_long"
|
android:summary="@string/pref_headlines_mark_read_scroll_long"
|
||||||
android:title="@string/pref_headlines_mark_read_scroll" />
|
android:title="@string/pref_headlines_mark_read_scroll" />
|
||||||
|
|
||||||
<!-- <SwitchPreference
|
<!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="enable_condensed_fonts"
|
android:key="enable_condensed_fonts"
|
||||||
android:summary="@string/pref_headlines_use_condensed_fonts_long"
|
android:summary="@string/pref_headlines_use_condensed_fonts_long"
|
||||||
@ -121,7 +121,7 @@
|
|||||||
android:summary="@string/prefs_headline_display_mode_long"
|
android:summary="@string/prefs_headline_display_mode_long"
|
||||||
android:title="@string/prefs_headline_display_mode" />
|
android:title="@string/prefs_headline_display_mode" />
|
||||||
|
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="open_fresh_on_startup"
|
android:key="open_fresh_on_startup"
|
||||||
android:title="@string/prefs_open_fresh_on_startup" />
|
android:title="@string/prefs_open_fresh_on_startup" />
|
||||||
@ -133,24 +133,24 @@
|
|||||||
android:key="article_font_size_sp"
|
android:key="article_font_size_sp"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:title="@string/pref_font_size" />
|
android:title="@string/pref_font_size" />
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="justify_article_text"
|
android:key="justify_article_text"
|
||||||
android:title="@string/justify_article_text" />
|
android:title="@string/justify_article_text" />
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="use_volume_keys"
|
android:key="use_volume_keys"
|
||||||
android:summary="@string/use_volume_keys_long"
|
android:summary="@string/use_volume_keys_long"
|
||||||
android:title="@string/use_volume_keys" />
|
android:title="@string/use_volume_keys" />
|
||||||
<!-- <SwitchPreference
|
<!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="full_screen_mode"
|
android:key="full_screen_mode"
|
||||||
android:title="@string/prefs_fullscreen_mode" /> -->
|
android:title="@string/prefs_fullscreen_mode" /> -->
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="confirm_headlines_catchup"
|
android:key="confirm_headlines_catchup"
|
||||||
android:title="@string/prefs_confirm_headlines_catchup" />
|
android:title="@string/prefs_confirm_headlines_catchup" />
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="enable_article_fab"
|
android:key="enable_article_fab"
|
||||||
android:summary="@string/prefs_enable_fab_long"
|
android:summary="@string/prefs_enable_fab_long"
|
||||||
@ -165,26 +165,26 @@
|
|||||||
android:summary="@string/offline_articles_to_download_long"
|
android:summary="@string/offline_articles_to_download_long"
|
||||||
android:title="@string/offline_articles_to_download" />
|
android:title="@string/offline_articles_to_download" />
|
||||||
|
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="offline_image_cache_enabled"
|
android:key="offline_image_cache_enabled"
|
||||||
android:summary="@string/offline_image_cache_enabled_summary"
|
android:summary="@string/offline_image_cache_enabled_summary"
|
||||||
android:title="@string/offline_image_cache_enabled" />
|
android:title="@string/offline_image_cache_enabled" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/prefs_widget" >
|
<PreferenceCategory android:title="@string/prefs_widget" >
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="widget_show_fresh"
|
android:key="widget_show_fresh"
|
||||||
android:title="@string/prefs_widget_show_fresh"
|
android:title="@string/prefs_widget_show_fresh"
|
||||||
android:summary="@string/prefs_widget_show_fresh_summary" />
|
android:summary="@string/prefs_widget_show_fresh_summary" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/debugging" >
|
<PreferenceCategory android:title="@string/debugging" >
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="webview_hardware_accel"
|
android:key="webview_hardware_accel"
|
||||||
android:summary="@string/accel_webview_summary"
|
android:summary="@string/accel_webview_summary"
|
||||||
android:title="@string/accel_webview_title" />
|
android:title="@string/accel_webview_title" />
|
||||||
<SwitchPreference
|
<org.fox.ttrss.util.LessBrokenSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="transport_debugging"
|
android:key="transport_debugging"
|
||||||
android:title="@string/transport_debugging" />
|
android:title="@string/transport_debugging" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user