diff options
16 files changed, 67 insertions, 113 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java index 559fa0574..86ca90eb5 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java @@ -1,7 +1,6 @@ package de.danoeh.antennapod.activity; import android.app.Activity; -import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; @@ -9,6 +8,7 @@ import android.os.Environment; import android.os.FileObserver; import android.support.v4.app.NavUtils; import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; @@ -84,65 +84,41 @@ public class DirectoryChooserActivity extends ActionBarActivity { adb.setTitle(R.string.folder_not_empty_dialog_title); adb.setMessage(R.string.folder_not_empty_dialog_msg); adb.setNegativeButton(R.string.cancel_label, - new DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, - int which) { - dialog.dismiss(); - } - }); + (dialog, which) -> { + dialog.dismiss(); + }); adb.setPositiveButton(R.string.confirm_label, - new DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, - int which) { - dialog.dismiss(); - returnSelectedFolder(); - } - }); + (dialog, which) -> { + dialog.dismiss(); + returnSelectedFolder(); + }); adb.create().show(); } }); - butCancel.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - setResult(Activity.RESULT_CANCELED); - finish(); - } - }); - - listDirectories.setOnItemClickListener(new OnItemClickListener() { - - @Override - public void onItemClick(AdapterView<?> adapter, View view, - int position, long id) { - if (BuildConfig.DEBUG) - Log.d(TAG, "Selected index: " + position); - if (filesInDir != null && position >= 0 - && position < filesInDir.length) { - changeDirectory(filesInDir[position]); - } - } - }); - - butNavUp.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - File parent = null; - if (selectedDir != null - && (parent = selectedDir.getParentFile()) != null) { - changeDirectory(parent); - } - } - }); - - filenames = new ArrayList<String>(); - listDirectoriesAdapter = new ArrayAdapter<String>(this, + butCancel.setOnClickListener(v -> { + setResult(Activity.RESULT_CANCELED); + finish(); + }); + + listDirectories.setOnItemClickListener((adapter, view, position, id) -> { + Log.d(TAG, "Selected index: " + position); + if (filesInDir != null && position >= 0 + && position < filesInDir.length) { + changeDirectory(filesInDir[position]); + } + }); + + butNavUp.setOnClickListener(v -> { + File parent = null; + if (selectedDir != null + && (parent = selectedDir.getParentFile()) != null) { + changeDirectory(parent); + } + }); + + filenames = new ArrayList<>(); + listDirectoriesAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, filenames); listDirectories.setAdapter(listDirectoriesAdapter); changeDirectory(Environment.getExternalStorageDirectory()); 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 df680a297..6915c817b 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -1,7 +1,6 @@ package de.danoeh.antennapod.activity; import android.annotation.TargetApi; -import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; @@ -20,6 +19,7 @@ import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.app.AlertDialog; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.ContextMenu; diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index 90bd3afee..c53a5257b 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.activity; -import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.graphics.PixelFormat; @@ -8,6 +7,7 @@ import android.media.AudioManager; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; @@ -493,19 +493,13 @@ public abstract class MediaplayerActivity extends ActionBarActivity AlertDialog.Builder builder = new AlertDialog.Builder(MediaplayerActivity.this); builder.setTitle(R.string.pref_fast_forward); builder.setSingleChoiceItems(choices, checked, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - choice = values[which]; - } + (dialog, which) -> { + choice = values[which]; }); builder.setNegativeButton(R.string.cancel_label, null); - builder.setPositiveButton(R.string.confirm_label, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - UserPreferences.setPrefFastForwardSecs(choice); - txtvFF.setText(String.valueOf(choice)); - } + builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> { + UserPreferences.setPrefFastForwardSecs(choice); + txtvFF.setText(String.valueOf(choice)); }); builder.create().show(); return true; diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index a629b8758..c67d65a9d 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.activity; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; @@ -9,6 +8,7 @@ import android.os.Bundle; import android.os.Looper; import android.support.v4.app.NavUtils; import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java index f7e9256c0..46e5f0e8e 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java @@ -1,8 +1,8 @@ package de.danoeh.antennapod.activity; -import android.app.AlertDialog; import android.net.Uri; import android.os.Bundle; +import android.support.v7.app.AlertDialog; import android.util.Log; import de.danoeh.antennapod.core.preferences.UserPreferences; diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java index 445e4832c..efdf1a3c9 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.adapter; -import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.support.v7.app.AlertDialog; import android.widget.Toast; import org.apache.commons.lang3.Validate; diff --git a/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java index 3656c3638..3940eb8b6 100644 --- a/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java +++ b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlExportWorker.java @@ -1,13 +1,13 @@ package de.danoeh.antennapod.asynctask; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; +import android.support.v7.app.AlertDialog; import android.util.Log; import java.io.File; diff --git a/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlImportWorker.java b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlImportWorker.java index 5486bc4fb..86636485d 100644 --- a/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlImportWorker.java +++ b/app/src/main/java/de/danoeh/antennapod/asynctask/OpmlImportWorker.java @@ -1,12 +1,12 @@ package de.danoeh.antennapod.asynctask; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.AsyncTask; +import android.support.v7.app.AlertDialog; import android.util.Log; import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.core.R; @@ -37,8 +37,7 @@ public class OpmlImportWorker extends @Override protected ArrayList<OpmlElement> doInBackground(Void... params) { - if (BuildConfig.DEBUG) - Log.d(TAG, "Starting background work"); + Log.d(TAG, "Starting background work"); if (mReader==null) { return null; @@ -72,21 +71,14 @@ public class OpmlImportWorker extends } progDialog.dismiss(); if (exception != null) { - if (BuildConfig.DEBUG) - Log.d(TAG, - "An error occurred while trying to parse the opml document"); + Log.d(TAG, "An error occurred while trying to parse the opml document"); AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle(R.string.error_label); alert.setMessage(context.getString(R.string.opml_reader_error) + exception.getMessage()); - alert.setNeutralButton(android.R.string.ok, new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - } - - }); + alert.setNeutralButton(android.R.string.ok, (dialog, which) -> { + dialog.dismiss(); + }); alert.create().show(); } } diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java index 1585f9b86..75b1bc8d2 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java @@ -2,9 +2,9 @@ package de.danoeh.antennapod.dialog; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; +import android.support.v7.app.AlertDialog; import android.view.View; import android.widget.CheckBox; import android.widget.SeekBar; diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java index 16fb77f2a..5f531e88f 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java @@ -1,8 +1,8 @@ package de.danoeh.antennapod.dialog; -import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; +import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.InputType; import android.view.View; @@ -26,28 +26,19 @@ public class GpodnetSetHostnameDialog { et.setInputType(InputType.TYPE_TEXT_VARIATION_URI); dialog.setTitle(R.string.pref_gpodnet_sethostname_title) .setView(setupContentView(context, et)) - .setPositiveButton(R.string.confirm_label, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - final Editable e = et.getText(); - if (e != null) { - GpodnetPreferences.setHostname(e.toString()); - } - dialog.dismiss(); + .setPositiveButton(R.string.confirm_label, (dialog1, which) -> { + final Editable e = et.getText(); + if (e != null) { + GpodnetPreferences.setHostname(e.toString()); } + dialog1.dismiss(); }) - .setNegativeButton(R.string.cancel_label, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.cancel(); - } + .setNegativeButton(R.string.cancel_label, (dialog1, which) -> { + dialog1.cancel(); }) - .setNeutralButton(R.string.pref_gpodnet_sethostname_use_default_host, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - GpodnetPreferences.setHostname(GpodnetService.DEFAULT_BASE_HOST); - dialog.dismiss(); - } + .setNeutralButton(R.string.pref_gpodnet_sethostname_use_default_host, (dialog1, which) -> { + GpodnetPreferences.setHostname(GpodnetService.DEFAULT_BASE_HOST); + dialog1.dismiss(); }) .setCancelable(true); return dialog.show(); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java index 5f6e3d0e2..4b512a48d 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java @@ -1,11 +1,11 @@ package de.danoeh.antennapod.dialog; -import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; +import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.View; diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java index f32a1c2ee..84da32a40 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java @@ -1,10 +1,10 @@ package de.danoeh.antennapod.menuhandler; -import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; +import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; 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 138246038..f729ef807 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -1,7 +1,6 @@ package de.danoeh.antennapod.preferences; import android.app.Activity; -import android.app.AlertDialog; import android.app.TimePickerDialog; import android.content.Context; import android.content.DialogInterface; @@ -17,6 +16,7 @@ import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; +import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.TextWatcher; import android.text.format.DateFormat; diff --git a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java index fea2bbb2b..abb75e5e7 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java +++ b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java @@ -1,8 +1,8 @@ package de.danoeh.antennapod.core.dialog; -import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; +import android.support.v7.app.AlertDialog; import android.util.Log; import de.danoeh.antennapod.core.R; diff --git a/core/src/main/java/de/danoeh/antennapod/core/dialog/DownloadRequestErrorDialogCreator.java b/core/src/main/java/de/danoeh/antennapod/core/dialog/DownloadRequestErrorDialogCreator.java index 3d174bd8e..b7e79431d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/dialog/DownloadRequestErrorDialogCreator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/dialog/DownloadRequestErrorDialogCreator.java @@ -1,8 +1,9 @@ package de.danoeh.antennapod.core.dialog; -import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; +import android.support.v7.app.AlertDialog; + import de.danoeh.antennapod.core.R; /** Creates Alert Dialogs if a DownloadRequestException has happened. */ diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java index f37933876..318839e1d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.core.util.flattr; -import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; @@ -8,6 +7,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.preference.PreferenceManager; +import android.support.v7.app.AlertDialog; import android.util.Log; import org.apache.commons.lang3.StringUtils; |