diff options
author | Martin Fietz <martin.fietz@gmail.com> | 2018-01-09 21:03:30 +0100 |
---|---|---|
committer | Martin Fietz <martin.fietz@gmail.com> | 2018-01-09 21:03:30 +0100 |
commit | 89366d97d18ac1132fabb6909cd46bcfa7a6e5ae (patch) | |
tree | 2f1e556fafd50b6fa3e31ef6caa625e0102ecdbf /app | |
parent | b1c212c2fc62b96f272fc0cedf683018ff312801 (diff) | |
download | AntennaPod-89366d97d18ac1132fabb6909cd46bcfa7a6e5ae.zip |
Replace code for SDK version lower than 14
Diffstat (limited to 'app')
7 files changed, 20 insertions, 59 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java index 11e033e51..eeb001ea1 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java @@ -39,7 +39,6 @@ import de.test.antennapod.util.syndication.feedgenerator.RSS2Generator; * Utility methods for UI tests. * Starts a web server that hosts feeds, episodes and images. */ -@TargetApi(Build.VERSION_CODES.HONEYCOMB) public class UITestUtils { private static final String TAG = UITestUtils.class.getSimpleName(); @@ -49,7 +48,6 @@ public class UITestUtils { public static final int NUM_FEEDS = 5; public static final int NUM_ITEMS_PER_FEED = 10; - public static final int HOME_VIEW = (Build.VERSION.SDK_INT >= 11) ? android.R.id.home : R.id.home; public static final String TEST_FILE_NAME = "3sec.mp3"; diff --git a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java index f6a8db5fb..3abf7557a 100644 --- a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java +++ b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java @@ -41,10 +41,8 @@ public class PodcastApp extends Application { .detectLeakedSqlLiteObjects() .penaltyLog() .penaltyDropBox(); - if (Build.VERSION.SDK_INT >= 11) { - builder.detectActivityLeaks(); - builder.detectLeakedClosableObjects(); - } + builder.detectActivityLeaks(); + builder.detectLeakedClosableObjects(); if(Build.VERSION.SDK_INT >= 16) { builder.detectLeakedRegistrationObjects(); } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java index 2a58d5104..21951dc0e 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -88,16 +88,10 @@ public class FeedInfoActivity extends AppCompatActivity { public void onClick(View v) { if(feed != null && feed.getDownload_url() != null) { String url = feed.getDownload_url(); - if (android.os.Build.VERSION.SDK_INT >= 11) { - ClipData clipData = ClipData.newPlainText(url, url); - android.content.ClipboardManager cm = (android.content.ClipboardManager) FeedInfoActivity.this - .getSystemService(Context.CLIPBOARD_SERVICE); - cm.setPrimaryClip(clipData); - } else { - android.text.ClipboardManager cm = (android.text.ClipboardManager) FeedInfoActivity.this - .getSystemService(Context.CLIPBOARD_SERVICE); - cm.setText(url); - } + ClipData clipData = ClipData.newPlainText(url, url); + android.content.ClipboardManager cm = (android.content.ClipboardManager) FeedInfoActivity.this + .getSystemService(Context.CLIPBOARD_SERVICE); + cm.setPrimaryClip(clipData); Toast t = Toast.makeText(FeedInfoActivity.this, R.string.copied_url_msg, Toast.LENGTH_SHORT); t.show(); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index a0586fe16..f6bdfddda 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -112,9 +112,7 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo Bundle savedInstanceState) { Log.d(TAG, "Creating view"); webvDescription = new WebView(getActivity().getApplicationContext()); - if (Build.VERSION.SDK_INT >= 11) { - webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null); - } + webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null); TypedArray ta = getActivity().getTheme().obtainStyledAttributes(new int[] {android.R.attr.colorBackground}); int backgroundColor = ta.getColor(0, UserPreferences.getTheme() == @@ -238,17 +236,11 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo ShareUtils.shareLink(getActivity(), selectedURL); break; case R.id.copy_url_item: - if (android.os.Build.VERSION.SDK_INT >= 11) { - ClipData clipData = ClipData.newPlainText(selectedURL, - selectedURL); - android.content.ClipboardManager cm = (android.content.ClipboardManager) getActivity() - .getSystemService(Context.CLIPBOARD_SERVICE); - cm.setPrimaryClip(clipData); - } else { - android.text.ClipboardManager cm = (android.text.ClipboardManager) getActivity() - .getSystemService(Context.CLIPBOARD_SERVICE); - cm.setText(selectedURL); - } + ClipData clipData = ClipData.newPlainText(selectedURL, + selectedURL); + android.content.ClipboardManager cm = (android.content.ClipboardManager) getActivity() + .getSystemService(Context.CLIPBOARD_SERVICE); + cm.setPrimaryClip(clipData); Toast t = Toast.makeText(getActivity(), R.string.copied_url_msg, Toast.LENGTH_SHORT); t.show(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java index 7939dcb23..da7fc5299 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -184,8 +184,7 @@ public class ItemFragment extends Fragment implements OnSwipeGesture { } webvDescription = (WebView) layout.findViewById(R.id.webvDescription); if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) { - if (Build.VERSION.SDK_INT >= 11 - && Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } webvDescription.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.black)); @@ -483,17 +482,11 @@ public class ItemFragment extends Fragment implements OnSwipeGesture { ShareUtils.shareLink(getActivity(), selectedURL); break; case R.id.copy_url_item: - if (android.os.Build.VERSION.SDK_INT >= 11) { - ClipData clipData = ClipData.newPlainText(selectedURL, - selectedURL); - android.content.ClipboardManager cm = (android.content.ClipboardManager) getActivity() - .getSystemService(Context.CLIPBOARD_SERVICE); - cm.setPrimaryClip(clipData); - } else { - android.text.ClipboardManager cm = (android.text.ClipboardManager) getActivity() - .getSystemService(Context.CLIPBOARD_SERVICE); - cm.setText(selectedURL); - } + ClipData clipData = ClipData.newPlainText(selectedURL, + selectedURL); + android.content.ClipboardManager cm = (android.content.ClipboardManager) getActivity() + .getSystemService(Context.CLIPBOARD_SERVICE); + cm.setPrimaryClip(clipData); Toast t = Toast.makeText(getActivity(), R.string.copied_url_msg, Toast.LENGTH_SHORT); t.show(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java index a118673a6..d819e68d2 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -350,16 +350,6 @@ public class ItemlistFragment extends ListFragment { } } - - @Override - public void setListAdapter(ListAdapter adapter) { - // This workaround prevents the ListFragment from setting a list adapter when its state is restored. - // This is only necessary on API 10 because addFooterView throws an internal exception in this case. - if (Build.VERSION.SDK_INT > 10 || insideOnFragmentLoaded) { - super.setListAdapter(adapter); - } - } - @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java index 3b5a68f7f..4f47ff137 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -230,12 +230,8 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc .setOnPreferenceChangeListener( (preference, newValue) -> { Intent i = new Intent(activity, MainActivity.class); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK - | Intent.FLAG_ACTIVITY_NEW_TASK); - } else { - i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } + i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK + | Intent.FLAG_ACTIVITY_NEW_TASK); activity.finish(); activity.startActivity(i); return true; |