From f2dde1362b07a21d5778cf8d704bd44460977683 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 15 Nov 2013 14:57:10 +0400 Subject: [PATCH] replace integer android version numbers with version codes disable webview_accel preference on 2.3 target sdk 19 --- AndroidManifest.xml | 2 +- src/org/fox/ttrss/ArticleFragment.java | 4 ++-- src/org/fox/ttrss/CommonActivity.java | 4 ++-- src/org/fox/ttrss/OnlineActivity.java | 24 ++++--------------- src/org/fox/ttrss/PreferencesActivity.java | 5 ++-- .../fox/ttrss/offline/OfflineActivity.java | 2 +- .../ttrss/offline/OfflineArticleFragment.java | 4 ++-- src/org/fox/ttrss/share/CommonActivity.java | 2 +- 8 files changed, 16 insertions(+), 31 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index cc212e7a..ddd41696 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -6,7 +6,7 @@ + android:targetSdkVersion="19" /> diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 3b2fda84..d587735e 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -168,7 +168,7 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl // prevent flicker in ics if (!m_prefs.getBoolean("webview_hardware_accel", true) || useTitleWebView) { - if (android.os.Build.VERSION.SDK_INT >= 11) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { web.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } } @@ -215,7 +215,7 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl cssOverride = "body { background : transparent; }"; } - if (useTitleWebView || android.os.Build.VERSION.SDK_INT < 11) { + if (useTitleWebView || android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { web.setBackgroundColor(Color.TRANSPARENT); } else { // seriously? diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index b417d25a..ad15b0cc 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -155,7 +155,7 @@ public class CommonActivity extends SherlockFragmentActivity { @SuppressLint({ "NewApi", "ServiceCast" }) @SuppressWarnings("deprecation") public void copyToClipboard(String str) { - if (android.os.Build.VERSION.SDK_INT < 11) { + if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); clipboard.setText(str); } else { @@ -196,7 +196,7 @@ public class CommonActivity extends SherlockFragmentActivity { protected int getScreenWidthInPixel() { Display display = getWindowManager().getDefaultDisplay(); - if (android.os.Build.VERSION.SDK_INT >= 13) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB_MR2) { Point size = new Point(); display.getSize(size); int width = size.x; diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 6cd08cd4..241f54da 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -594,7 +594,7 @@ public class OnlineActivity extends CommonActivity { } TextView titleText = new TextView(this); - if (android.os.Build.VERSION.SDK_INT >= 16) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { titleText.setPaddingRelative(24, 24, 24, 24); } else { titleText.setPadding(24, 24, 24, 24); @@ -891,11 +891,9 @@ public class OnlineActivity extends CommonActivity { } return true; case R.id.share_article: - //if (android.os.Build.VERSION.SDK_INT < 14) { - if (ap != null) { - shareArticle(ap.getSelectedArticle()); - } - //} + if (ap != null) { + shareArticle(ap.getSelectedArticle()); + } return true; case R.id.toggle_marked: if (ap != null & ap.getSelectedArticle() != null) { @@ -1526,20 +1524,6 @@ public class OnlineActivity extends CommonActivity { } } - /* if (android.os.Build.VERSION.SDK_INT >= 14) { - ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider(); - - ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); - - if (af != null && af.getSelectedArticle() != null) { - shareProvider.setShareIntent(getShareIntent(af.getSelectedArticle())); - - if (!isSmallScreen()) { - m_menu.findItem(R.id.share_article).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - } - } - } */ - HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); if (hf != null) { diff --git a/src/org/fox/ttrss/PreferencesActivity.java b/src/org/fox/ttrss/PreferencesActivity.java index 274d1ba4..6b9599da 100644 --- a/src/org/fox/ttrss/PreferencesActivity.java +++ b/src/org/fox/ttrss/PreferencesActivity.java @@ -10,10 +10,11 @@ public class PreferencesActivity extends PreferenceActivity { addPreferencesFromResource(R.xml.preferences); - boolean compatMode = android.os.Build.VERSION.SDK_INT <= 10; + boolean compatMode = android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB; if (compatMode) { - findPreference("dim_status_bar").setEnabled(false); + findPreference("dim_status_bar").setEnabled(false); + findPreference("webview_hardware_accel").setEnabled(false); } } diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java index 4d5513f0..756e49c0 100644 --- a/src/org/fox/ttrss/offline/OfflineActivity.java +++ b/src/org/fox/ttrss/offline/OfflineActivity.java @@ -139,7 +139,7 @@ public class OfflineActivity extends CommonActivity { } TextView titleText = new TextView(this); - if (android.os.Build.VERSION.SDK_INT >= 16) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { titleText.setPaddingRelative(24, 24, 24, 24); } else { titleText.setPadding(24, 24, 24, 24); diff --git a/src/org/fox/ttrss/offline/OfflineArticleFragment.java b/src/org/fox/ttrss/offline/OfflineArticleFragment.java index da65cb2f..e814dddf 100644 --- a/src/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -215,7 +215,7 @@ public class OfflineArticleFragment extends Fragment implements GestureDetector. // prevent flicker in ics if (!m_prefs.getBoolean("webview_hardware_accel", true) || useTitleWebView) { - if (android.os.Build.VERSION.SDK_INT >= 11) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { web.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } } @@ -230,7 +230,7 @@ public class OfflineArticleFragment extends Fragment implements GestureDetector. cssOverride = "body { background : transparent; }"; } - if (useTitleWebView || android.os.Build.VERSION.SDK_INT < 11) { + if (useTitleWebView || android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { web.setBackgroundColor(Color.TRANSPARENT); } else { // seriously? diff --git a/src/org/fox/ttrss/share/CommonActivity.java b/src/org/fox/ttrss/share/CommonActivity.java index 21c8e443..63458532 100644 --- a/src/org/fox/ttrss/share/CommonActivity.java +++ b/src/org/fox/ttrss/share/CommonActivity.java @@ -29,7 +29,7 @@ public class CommonActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { - m_compatMode = android.os.Build.VERSION.SDK_INT <= 10; + m_compatMode = android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB; Log.d(TAG, "m_compatMode=" + m_compatMode);