diff options
author | Martin Fietz <martin.fietz@gmail.com> | 2018-01-09 20:19:38 +0100 |
---|---|---|
committer | Martin Fietz <martin.fietz@gmail.com> | 2018-01-09 20:19:38 +0100 |
commit | 1694432560a7cd24201257461eda1adf3fb0873f (patch) | |
tree | b7c04e72a26b77418ed789748f75b4255552c00d /app/src/main | |
parent | b1c212c2fc62b96f272fc0cedf683018ff312801 (diff) | |
download | AntennaPod-1694432560a7cd24201257461eda1adf3fb0873f.zip |
Delete PreferenceActivityGingerbread
Diffstat (limited to 'app/src/main')
6 files changed, 7 insertions, 135 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 56d076441..6be5bd1b3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -97,15 +97,6 @@ android:launchMode="singleInstance"/> <activity - android:name=".activity.PreferenceActivityGingerbread" - android:configChanges="keyboardHidden|orientation|screenSize" - android:label="@string/settings_label"> - <meta-data - android:name="android.support.PARENT_ACTIVITY" - android:value="de.danoeh.antennapod.activity.MainActivity"/> - </activity> - - <activity android:name=".activity.PreferenceActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/settings_label"> diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java index be1c9f9e6..d9c250b38 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java @@ -18,7 +18,6 @@ import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.flattr.FlattrUtils; -import de.danoeh.antennapod.preferences.PreferenceController; /** Guides the user through the authentication process */ @@ -104,7 +103,7 @@ public class FlattrAuthActivity extends ActionBarActivity { switch (item.getItemId()) { case android.R.id.home: if (authSuccessful) { - Intent intent = new Intent(this, PreferenceController.getPreferenceActivity()); + Intent intent = new Intent(this, PreferenceActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else { diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index f0fcdca90..9949c01a0 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -64,7 +64,6 @@ import de.danoeh.antennapod.fragment.PlaybackHistoryFragment; import de.danoeh.antennapod.fragment.QueueFragment; import de.danoeh.antennapod.fragment.SubscriptionFragment; import de.danoeh.antennapod.menuhandler.NavDrawerActivity; -import de.danoeh.antennapod.preferences.PreferenceController; import de.greenrobot.event.EventBus; import rx.Observable; import rx.Subscription; @@ -173,7 +172,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi findViewById(R.id.nav_settings).setOnClickListener(v -> { drawerLayout.closeDrawer(navDrawer); - startActivity(new Intent(MainActivity.this, PreferenceController.getPreferenceActivity())); + startActivity(new Intent(MainActivity.this, PreferenceActivity.class)); }); FragmentTransaction transaction = fm.beginTransaction(); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java index cc7d83e0c..3b1427f1b 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java @@ -61,7 +61,6 @@ import de.danoeh.antennapod.fragment.PlaybackHistoryFragment; import de.danoeh.antennapod.fragment.QueueFragment; import de.danoeh.antennapod.fragment.SubscriptionFragment; import de.danoeh.antennapod.menuhandler.NavDrawerActivity; -import de.danoeh.antennapod.preferences.PreferenceController; import de.greenrobot.event.EventBus; import rx.Observable; import rx.Subscription; @@ -270,7 +269,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem findViewById(R.id.nav_settings).setOnClickListener(v -> { drawerLayout.closeDrawer(navDrawer); - startActivity(new Intent(MediaplayerInfoActivity.this, PreferenceController.getPreferenceActivity())); + startActivity(new Intent(MediaplayerInfoActivity.this, PreferenceActivity.class)); }); butPlaybackSpeed = (Button) findViewById(R.id.butPlaybackSpeed); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivityGingerbread.java b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivityGingerbread.java deleted file mode 100644 index 390bec15c..000000000 --- a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivityGingerbread.java +++ /dev/null @@ -1,97 +0,0 @@ -package de.danoeh.antennapod.activity; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Intent; -import android.content.res.Resources.Theme; -import android.os.Bundle; -import android.preference.Preference; -import android.preference.PreferenceScreen; - -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.preferences.PreferenceController; - -/** - * PreferenceActivity for API 10. In order to change the behavior of the preference UI, see - * PreferenceController. - */ -public class PreferenceActivityGingerbread extends android.preference.PreferenceActivity { - private static final String TAG = "PreferenceActivity"; - private final PreferenceController.PreferenceUI preferenceUI = new PreferenceController.PreferenceUI() { - - @SuppressWarnings("deprecation") - @Override - public Preference findPreference(CharSequence key) { - return PreferenceActivityGingerbread.this.findPreference(key); - } - - @Override - public Activity getActivity() { - return PreferenceActivityGingerbread.this; - } - }; - private PreferenceController preferenceController; - - @SuppressLint("NewApi") - @SuppressWarnings("deprecation") - @Override - public void onCreate(Bundle savedInstanceState) { - setTheme(UserPreferences.getTheme()); - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.preferences); - preferenceController = new PreferenceController(preferenceUI); - preferenceController.onCreate(); - } - - - @Override - protected void onResume() { - super.onResume(); - preferenceController.onResume(); - } - - @Override - protected void onPause() { - preferenceController.onPause(); - super.onPause(); - } - - @Override - protected void onStop() { - preferenceController.onStop(); - super.onStop(); - } - - @Override - protected void onApplyThemeResource(Theme theme, int resid, boolean first) { - theme.applyStyle(UserPreferences.getTheme(), true); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - preferenceController.onActivityResult(requestCode, resultCode, data); - } - - @SuppressWarnings("deprecation") - @Override - public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, - Preference preference) { - super.onPreferenceTreeClick(preferenceScreen, preference); - if (preference != null) - if (preference instanceof PreferenceScreen) - if (((PreferenceScreen) preference).getDialog() != null) - ((PreferenceScreen) preference) - .getDialog() - .getWindow() - .getDecorView() - .setBackgroundDrawable( - this.getWindow().getDecorView() - .getBackground().getConstantState() - .newDrawable() - ); - return false; - } -} 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..c4e58f652 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -56,8 +56,6 @@ import de.danoeh.antennapod.activity.AboutActivity; import de.danoeh.antennapod.activity.DirectoryChooserActivity; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MediaplayerActivity; -import de.danoeh.antennapod.activity.PreferenceActivity; -import de.danoeh.antennapod.activity.PreferenceActivityGingerbread; import de.danoeh.antennapod.activity.StatisticsActivity; import de.danoeh.antennapod.asynctask.ExportWorker; import de.danoeh.antennapod.core.export.ExportWriter; @@ -97,8 +95,8 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc private static final String PREF_CHOOSE_DATA_DIR = "prefChooseDataDir"; private static final String AUTO_DL_PREF_SCREEN = "prefAutoDownloadSettings"; private static final String PREF_PLAYBACK_SPEED_LAUNCHER = "prefPlaybackSpeedLauncher"; - public static final String PREF_PLAYBACK_REWIND_DELTA_LAUNCHER = "prefPlaybackRewindDeltaLauncher"; - public static final String PREF_PLAYBACK_FAST_FORWARD_DELTA_LAUNCHER = "prefPlaybackFastForwardDeltaLauncher"; + private static final String PREF_PLAYBACK_REWIND_DELTA_LAUNCHER = "prefPlaybackRewindDeltaLauncher"; + private static final String PREF_PLAYBACK_FAST_FORWARD_DELTA_LAUNCHER = "prefPlaybackFastForwardDeltaLauncher"; private static final String PREF_GPODNET_LOGIN = "pref_gpodnet_authenticate"; private static final String PREF_GPODNET_SETLOGIN_INFORMATION = "pref_gpodnet_setlogin_information"; private static final String PREF_GPODNET_SYNC = "pref_gpodnet_sync"; @@ -132,19 +130,6 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc .registerOnSharedPreferenceChangeListener(this); } - /** - * Returns the preference activity that should be used on this device. - * - * @return PreferenceActivity if the API level is greater than 10, PreferenceActivityGingerbread otherwise. - */ - public static Class<? extends Activity> getPreferenceActivity() { - if (Build.VERSION.SDK_INT > 10) { - return PreferenceActivity.class; - } else { - return PreferenceActivityGingerbread.class; - } - } - @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if(key.equals(UserPreferences.PREF_SONIC)) { @@ -230,12 +215,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; |