add option to force small tablet mode, move tablet-specific options to

separate category, bump version
This commit is contained in:
Andrew Dolgov 2012-09-13 13:19:04 +04:00
parent 86a4f6c2de
commit a7dd01131d
5 changed files with 28 additions and 33 deletions

View File

@ -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="97" android:versionCode="98"
android:versionName="0.7.5" > android:versionName="0.7.6" >
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"

View File

@ -128,4 +128,6 @@
<string name="notify_article_published">Article published</string> <string name="notify_article_published">Article published</string>
<string name="notify_article_unpublished">Article unpublished</string> <string name="notify_article_unpublished">Article unpublished</string>
<string name="notify_article_note_set">Article note saved</string> <string name="notify_article_note_set">Article note saved</string>
<string name="force_small_tablet_ui">Force compact interface</string>
<string name="prefs_for_tablets">Tablets</string>
</resources> </resources>

View File

@ -2,21 +2,18 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="@string/connection" > <PreferenceCategory android:title="@string/connection" >
<EditTextPreference <EditTextPreference
android:key="login" android:key="login"
android:singleLine="true" android:singleLine="true"
android:summary="@string/login_summary" android:summary="@string/login_summary"
android:title="@string/login" > android:title="@string/login" >
</EditTextPreference> </EditTextPreference>
<EditTextPreference <EditTextPreference
android:key="password" android:key="password"
android:password="true" android:password="true"
android:singleLine="true" android:singleLine="true"
android:title="@string/password" > android:title="@string/password" >
</EditTextPreference> </EditTextPreference>
<EditTextPreference <EditTextPreference
android:hint="@string/default_url" android:hint="@string/default_url"
android:inputType="textUri" android:inputType="textUri"
@ -31,16 +28,13 @@
android:key="ssl_trust_any" android:key="ssl_trust_any"
android:title="@string/ssl_trust_any" /> android:title="@string/ssl_trust_any" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/http_authentication" > <PreferenceCategory android:title="@string/http_authentication" >
<EditTextPreference <EditTextPreference
android:key="http_login" android:key="http_login"
android:singleLine="true" android:singleLine="true"
android:summary="@string/http_login_summary" android:summary="@string/http_login_summary"
android:title="@string/login" > android:title="@string/login" >
</EditTextPreference> </EditTextPreference>
<EditTextPreference <EditTextPreference
android:key="http_password" android:key="http_password"
android:password="true" android:password="true"
@ -48,9 +42,9 @@
android:title="@string/password" > android:title="@string/password" >
</EditTextPreference> </EditTextPreference>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory
<PreferenceCategory android:key="category_look_and_feel" android:title="@string/look_and_feel" > android:key="category_look_and_feel"
android:title="@string/look_and_feel" >
<ListPreference <ListPreference
android:defaultValue="THEME_DARK" android:defaultValue="THEME_DARK"
android:entries="@array/pref_theme_names" android:entries="@array/pref_theme_names"
@ -58,7 +52,6 @@
android:key="theme" android:key="theme"
android:summary="@string/pref_theme_long" android:summary="@string/pref_theme_long"
android:title="@string/pref_theme" /> android:title="@string/pref_theme" />
<ListPreference <ListPreference
android:defaultValue="0" android:defaultValue="0"
android:entries="@array/pref_font_size_names" android:entries="@array/pref_font_size_names"
@ -70,52 +63,50 @@
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" />
<CheckBoxPreference <CheckBoxPreference
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" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="enable_cats" android:key="enable_cats"
android:title="@string/enable_cats" /> android:title="@string/enable_cats" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="browse_cats_like_feeds"
android:dependency="enable_cats" android:dependency="enable_cats"
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" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="combined_mode" android:key="combined_mode"
android:summary="@string/combined_mode_summary" android:summary="@string/combined_mode_summary"
android:title="@string/combined_mode" /> android:title="@string/combined_mode" />
<CheckBoxPreference
android:defaultValue="false"
android:key="tablet_article_swipe"
android:title="@string/tablet_article_swipe" />
<CheckBoxPreference <CheckBoxPreference
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" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory
android:key="category_tablets"
android:title="@string/prefs_for_tablets" >
<CheckBoxPreference
android:defaultValue="false"
android:key="tablet_article_swipe"
android:title="@string/tablet_article_swipe" />
<CheckBoxPreference
android:defaultValue="false"
android:key="force_small_tablet_ui"
android:title="@string/force_small_tablet_ui" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/offline_mode" > <PreferenceCategory android:title="@string/offline_mode" >
<CheckBoxPreference <CheckBoxPreference
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/debugging" > <PreferenceCategory android:title="@string/debugging" >
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="transport_debugging" android:key="transport_debugging"

View File

@ -2,8 +2,10 @@ package org.fox.ttrss;
import org.fox.ttrss.util.DatabaseHelper; import org.fox.ttrss.util.DatabaseHelper;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.FloatMath; import android.util.FloatMath;
@ -19,6 +21,8 @@ public class CommonActivity extends FragmentActivity {
public final static String FRAG_FEEDS = "feeds"; public final static String FRAG_FEEDS = "feeds";
public final static String FRAG_CATS = "cats"; public final static String FRAG_CATS = "cats";
private SharedPreferences m_prefs;
private SQLiteDatabase m_readableDb; private SQLiteDatabase m_readableDb;
private SQLiteDatabase m_writableDb; private SQLiteDatabase m_writableDb;
@ -51,7 +55,7 @@ public class CommonActivity extends FragmentActivity {
float inDiag = FloatMath.sqrt(inHeight * inHeight + inWidth * inWidth); float inDiag = FloatMath.sqrt(inHeight * inHeight + inWidth * inWidth);
if (inDiag < 9) { if (inDiag < 9 || m_prefs.getBoolean("force_small_tablet_ui", false)) {
m_smallTablet = true; m_smallTablet = true;
} }
@ -88,6 +92,9 @@ public class CommonActivity extends FragmentActivity {
m_compatMode = android.os.Build.VERSION.SDK_INT <= 10; m_compatMode = android.os.Build.VERSION.SDK_INT <= 10;
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
Log.d(TAG, "m_compatMode=" + m_compatMode); Log.d(TAG, "m_compatMode=" + m_compatMode);
detectSmallTablet(); detectSmallTablet();

View File

@ -20,11 +20,6 @@ public class PreferencesActivity extends PreferenceActivity {
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences);
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE) {
PreferenceCategory category = (PreferenceCategory)findPreference("category_look_and_feel");
category.removePreference(findPreference("tablet_article_swipe"));
}
findPreference("justify_article_text").setEnabled(!prefs.getBoolean("combined_mode", false)); findPreference("justify_article_text").setEnabled(!prefs.getBoolean("combined_mode", false));
findPreference("combined_mode").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { findPreference("combined_mode").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {