From 479d1f0a6c99260b06f58bf09eccdcf64289ec65 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 5 Jan 2013 12:19:26 +0400 Subject: [PATCH] prevent crash on 2.3 with dim_status_bar enabled, cleanup unused imports --- src/org/fox/ttrss/ArticleFragment.java | 4 ---- src/org/fox/ttrss/ArticlePager.java | 4 ++-- src/org/fox/ttrss/CommonActivity.java | 5 ----- src/org/fox/ttrss/HeadlinesActivity.java | 1 - src/org/fox/ttrss/HeadlinesFragment.java | 9 --------- src/org/fox/ttrss/OnlineActivity.java | 3 --- src/org/fox/ttrss/PreferencesActivity.java | 6 ++++++ src/org/fox/ttrss/offline/OfflineArticleFragment.java | 4 +--- src/org/fox/ttrss/offline/OfflineArticlePager.java | 11 ++++++++++- src/org/fox/ttrss/offline/OfflineFeedsActivity.java | 2 -- .../fox/ttrss/offline/OfflineHeadlinesFragment.java | 2 -- 11 files changed, 19 insertions(+), 32 deletions(-) diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index b932d9a2..edae1019 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -3,7 +3,6 @@ package org.fox.ttrss; import java.net.MalformedURLException; import java.net.URL; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; import org.fox.ttrss.types.Article; @@ -36,9 +35,6 @@ import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebView; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.Spinner; import android.widget.TextView; public class ArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener { diff --git a/src/org/fox/ttrss/ArticlePager.java b/src/org/fox/ttrss/ArticlePager.java index ae11c534..8fe8c255 100644 --- a/src/org/fox/ttrss/ArticlePager.java +++ b/src/org/fox/ttrss/ArticlePager.java @@ -49,7 +49,7 @@ public class ArticlePager extends Fragment { if (article != null) { ArticleFragment af = new ArticleFragment(article); - if (m_prefs.getBoolean("dim_status_bar", false) && getView() != null) { + if (!m_prefs.getBoolean("dim_status_bar", false) && getView() != null && !m_activity.isCompatMode()) { getView().setSystemUiVisibility(View.STATUS_BAR_HIDDEN); } @@ -263,7 +263,7 @@ public class ArticlePager extends Fragment { m_activity.initMenu(); - if (!m_activity.isCompatMode() && m_prefs.getBoolean("dim_status_bar", false)) { + if (!m_activity.isCompatMode() && m_prefs.getBoolean("dim_status_bar", false) && !m_activity.isCompatMode()) { getView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); } } diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index d1f09958..5c18f383 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -1,13 +1,8 @@ package org.fox.ttrss; -import java.util.List; - import org.fox.ttrss.util.DatabaseHelper; import android.annotation.SuppressLint; -import android.content.Context; -import android.content.SharedPreferences; -import android.content.pm.PackageInfo; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v4.app.FragmentActivity; diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java index 68f226e7..3b497163 100644 --- a/src/org/fox/ttrss/HeadlinesActivity.java +++ b/src/org/fox/ttrss/HeadlinesActivity.java @@ -10,7 +10,6 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; -import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.util.Log; import android.view.MenuItem; diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 85a61aa5..0de9d186 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -1,7 +1,5 @@ package org.fox.ttrss; -import java.net.MalformedURLException; -import java.net.URL; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -11,24 +9,20 @@ import java.util.TimeZone; import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; -import org.fox.ttrss.types.Attachment; import org.fox.ttrss.types.Feed; import org.fox.ttrss.util.HeadlinesRequest; import org.jsoup.Jsoup; import android.app.Activity; import android.content.Context; -import android.content.Intent; import android.content.SharedPreferences; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; -import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.text.Html; import android.text.Html.ImageGetter; -import android.text.method.LinkMovementMethod; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -43,12 +37,9 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; -import android.widget.Button; import android.widget.CheckBox; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; -import android.widget.Spinner; import android.widget.TextView; import com.google.gson.JsonElement; diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index f315566a..098d5717 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -1,8 +1,6 @@ package org.fox.ttrss; import java.lang.reflect.Type; -import java.net.MalformedURLException; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -11,7 +9,6 @@ import org.fox.ttrss.offline.OfflineDownloadService; import org.fox.ttrss.offline.OfflineUploadService; import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; -import org.fox.ttrss.types.Attachment; import org.fox.ttrss.types.Feed; import org.fox.ttrss.types.Label; diff --git a/src/org/fox/ttrss/PreferencesActivity.java b/src/org/fox/ttrss/PreferencesActivity.java index d7d7680d..3b11600c 100644 --- a/src/org/fox/ttrss/PreferencesActivity.java +++ b/src/org/fox/ttrss/PreferencesActivity.java @@ -9,6 +9,12 @@ public class PreferencesActivity extends PreferenceActivity { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); + + boolean compatMode = android.os.Build.VERSION.SDK_INT <= 10; + + if (compatMode) { + findPreference("dim_status_bar").setEnabled(false); + } } } diff --git a/src/org/fox/ttrss/offline/OfflineArticleFragment.java b/src/org/fox/ttrss/offline/OfflineArticleFragment.java index f299a36e..2eda1efb 100644 --- a/src/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -3,7 +3,6 @@ package org.fox.ttrss.offline; import java.text.SimpleDateFormat; import java.util.Date; -import org.fox.ttrss.ArticlePager; import org.fox.ttrss.CommonActivity; import org.fox.ttrss.R; import org.fox.ttrss.util.ImageCacheService; @@ -17,7 +16,6 @@ import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; -import android.graphics.Paint; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; @@ -27,6 +25,7 @@ import android.util.Log; import android.util.TypedValue; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; +import android.view.GestureDetector; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.MotionEvent; @@ -38,7 +37,6 @@ import android.webkit.WebSettings; import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebView; import android.widget.TextView; -import android.view.GestureDetector; public class OfflineArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener { private final String TAG = this.getClass().getSimpleName(); diff --git a/src/org/fox/ttrss/offline/OfflineArticlePager.java b/src/org/fox/ttrss/offline/OfflineArticlePager.java index 74eb8ca9..c2d41ef0 100644 --- a/src/org/fox/ttrss/offline/OfflineArticlePager.java +++ b/src/org/fox/ttrss/offline/OfflineArticlePager.java @@ -79,7 +79,7 @@ public class OfflineArticlePager extends Fragment { if (m_cursor.moveToPosition(position)) { - if (m_prefs.getBoolean("dim_status_bar", false) && getView() != null) { + if (m_prefs.getBoolean("dim_status_bar", false) && getView() != null && !m_activity.isCompatMode()) { getView().setSystemUiVisibility(View.STATUS_BAR_HIDDEN); } @@ -95,6 +95,15 @@ public class OfflineArticlePager extends Fragment { } } + @Override + public void onResume() { + super.onResume(); + + if (!m_activity.isCompatMode() && m_prefs.getBoolean("dim_status_bar", false) && !m_activity.isCompatMode()) { + getView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); + } + } + public OfflineArticlePager() { super(); } diff --git a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java index 1b35d9e1..002d74e4 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java +++ b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java @@ -1,11 +1,9 @@ package org.fox.ttrss.offline; import org.fox.ttrss.GlobalState; -import org.fox.ttrss.LoadingFragment; import org.fox.ttrss.R; import android.animation.LayoutTransition; -import android.animation.ObjectAnimator; import android.annotation.SuppressLint; import android.content.Intent; import android.database.sqlite.SQLiteStatement; diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index e2d3e096..60858473 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -23,7 +23,6 @@ import android.support.v4.app.Fragment; import android.support.v4.widget.SimpleCursorAdapter; import android.text.Html; import android.text.Html.ImageGetter; -import android.text.method.LinkMovementMethod; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -36,7 +35,6 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.CheckBox; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView;