Removed MaterialDialog dependency
The AlertDialogs from Androidx are material, too.
This commit is contained in:
parent
9df14af284
commit
fdd29fa3ec
|
@ -154,9 +154,6 @@ dependencies {
|
|||
|
||||
implementation "com.joanzapata.iconify:android-iconify-fontawesome:$iconifyVersion"
|
||||
implementation "com.joanzapata.iconify:android-iconify-material:$iconifyVersion"
|
||||
implementation("com.afollestad.material-dialogs:commons:$materialDialogsVersion") {
|
||||
transitive = true
|
||||
}
|
||||
implementation "com.yqritc:recyclerview-flexibledivider:$recyclerviewFlexibledividerVersion"
|
||||
implementation "com.githang:viewpagerindicator:2.5.1@aar"
|
||||
implementation "com.github.shts:TriangleLabelView:$triangleLabelViewVersion"
|
||||
|
|
|
@ -28,7 +28,6 @@ import android.widget.SeekBar.OnSeekBarChangeListener;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.joanzapata.iconify.IconDrawable;
|
||||
import com.joanzapata.iconify.fonts.FontAwesomeIcons;
|
||||
|
@ -427,19 +426,15 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
case R.id.disable_sleeptimer_item:
|
||||
if (controller.serviceAvailable()) {
|
||||
|
||||
MaterialDialog.Builder stDialog = new MaterialDialog.Builder(this);
|
||||
stDialog.title(R.string.sleep_timer_label);
|
||||
stDialog.content(getString(R.string.time_left_label)
|
||||
+ Converter.getDurationStringLong((int) controller
|
||||
.getSleepTimerTimeLeft()));
|
||||
stDialog.positiveText(R.string.disable_sleeptimer_label);
|
||||
stDialog.negativeText(R.string.cancel_label);
|
||||
stDialog.onPositive((dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
controller.disableSleepTimer();
|
||||
});
|
||||
stDialog.onNegative((dialog, which) -> dialog.dismiss());
|
||||
stDialog.build().show();
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.sleep_timer_label)
|
||||
.setMessage(getString(R.string.time_left_label)
|
||||
+ Converter.getDurationStringLong((int) controller
|
||||
.getSleepTimerTimeLeft()))
|
||||
.setPositiveButton(R.string.disable_sleeptimer_label, (dialog, which)
|
||||
-> controller.disableSleepTimer())
|
||||
.setNegativeButton(R.string.cancel_label, null)
|
||||
.show();
|
||||
}
|
||||
break;
|
||||
case R.id.set_sleeptimer_item:
|
||||
|
|
|
@ -6,12 +6,11 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -30,55 +29,55 @@ import de.danoeh.antennapod.core.util.LangUtils;
|
|||
public class OpmlImportBaseActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "OpmlImportBaseActivity";
|
||||
private static final int PERMISSION_REQUEST_READ_EXTERNAL_STORAGE = 5;
|
||||
private static final int PERMISSION_REQUEST_READ_EXTERNAL_STORAGE = 5;
|
||||
private OpmlImportWorker importWorker;
|
||||
@Nullable private Uri uri;
|
||||
@Nullable private Uri uri;
|
||||
|
||||
/**
|
||||
* Handles the choices made by the user in the OpmlFeedChooserActivity and
|
||||
* starts the OpmlFeedQueuer if necessary.
|
||||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.d(TAG, "Received result");
|
||||
if (resultCode == RESULT_CANCELED) {
|
||||
Log.d(TAG, "Activity was cancelled");
|
||||
/**
|
||||
* Handles the choices made by the user in the OpmlFeedChooserActivity and
|
||||
* starts the OpmlFeedQueuer if necessary.
|
||||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.d(TAG, "Received result");
|
||||
if (resultCode == RESULT_CANCELED) {
|
||||
Log.d(TAG, "Activity was cancelled");
|
||||
if (finishWhenCanceled()) {
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
int[] selected = data.getIntArrayExtra(OpmlFeedChooserActivity.EXTRA_SELECTED_ITEMS);
|
||||
if (selected != null && selected.length > 0) {
|
||||
OpmlFeedQueuer queuer = new OpmlFeedQueuer(this, selected) {
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
int[] selected = data.getIntArrayExtra(OpmlFeedChooserActivity.EXTRA_SELECTED_ITEMS);
|
||||
if (selected != null && selected.length > 0) {
|
||||
OpmlFeedQueuer queuer = new OpmlFeedQueuer(this, selected) {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
Intent intent = new Intent(OpmlImportBaseActivity.this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
Intent intent = new Intent(OpmlImportBaseActivity.this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
};
|
||||
queuer.executeAsync();
|
||||
} else {
|
||||
Log.d(TAG, "No items were selected");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
queuer.executeAsync();
|
||||
} else {
|
||||
Log.d(TAG, "No items were selected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void importUri(@Nullable Uri uri) {
|
||||
void importUri(@Nullable Uri uri) {
|
||||
if(uri == null) {
|
||||
new MaterialDialog.Builder(this)
|
||||
.content(R.string.opml_import_error_no_file)
|
||||
.positiveText(android.R.string.ok)
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(R.string.opml_import_error_no_file)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
this.uri = uri;
|
||||
this.uri = uri;
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
||||
uri.toString().contains(Environment.getExternalStorageDirectory().toString())) {
|
||||
uri.toString().contains(Environment.getExternalStorageDirectory().toString())) {
|
||||
int permission = ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
if (permission != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermission();
|
||||
|
@ -88,30 +87,28 @@ public class OpmlImportBaseActivity extends AppCompatActivity {
|
|||
startImport();
|
||||
}
|
||||
|
||||
private void requestPermission() {
|
||||
String[] permissions = { android.Manifest.permission.READ_EXTERNAL_STORAGE };
|
||||
ActivityCompat.requestPermissions(this, permissions, PERMISSION_REQUEST_READ_EXTERNAL_STORAGE);
|
||||
}
|
||||
private void requestPermission() {
|
||||
String[] permissions = { android.Manifest.permission.READ_EXTERNAL_STORAGE };
|
||||
ActivityCompat.requestPermissions(this, permissions, PERMISSION_REQUEST_READ_EXTERNAL_STORAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode,
|
||||
String[] permissions,
|
||||
int[] grantResults) {
|
||||
if (requestCode != PERMISSION_REQUEST_READ_EXTERNAL_STORAGE) {
|
||||
return;
|
||||
}
|
||||
if (grantResults.length > 0 && ArrayUtils.contains(grantResults, PackageManager.PERMISSION_GRANTED)) {
|
||||
startImport();
|
||||
} else {
|
||||
new MaterialDialog.Builder(this)
|
||||
.content(R.string.opml_import_ask_read_permission)
|
||||
.positiveText(android.R.string.ok)
|
||||
.negativeText(R.string.cancel_label)
|
||||
.onPositive((dialog, which) -> requestPermission())
|
||||
.onNegative((dialog, which) -> finish())
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode,
|
||||
String[] permissions,
|
||||
int[] grantResults) {
|
||||
if (requestCode != PERMISSION_REQUEST_READ_EXTERNAL_STORAGE) {
|
||||
return;
|
||||
}
|
||||
if (grantResults.length > 0 && ArrayUtils.contains(grantResults, PackageManager.PERMISSION_GRANTED)) {
|
||||
startImport();
|
||||
} else {
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(R.string.opml_import_ask_read_permission)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> requestPermission())
|
||||
.setNegativeButton(R.string.cancel_label, (dialog, which) -> finish())
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Starts the import process. */
|
||||
private void startImport() {
|
||||
|
@ -136,10 +133,10 @@ public class OpmlImportBaseActivity extends AppCompatActivity {
|
|||
importWorker.executeAsync();
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, Log.getStackTraceString(e));
|
||||
String message = getString(R.string.opml_reader_error);
|
||||
new MaterialDialog.Builder(this)
|
||||
.content(message + " " + e.getMessage())
|
||||
.positiveText(android.R.string.ok)
|
||||
String message = getString(R.string.opml_reader_error);
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(message + " " + e.getMessage())
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ import android.text.TextUtils;
|
|||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
|
@ -28,22 +26,22 @@ import de.danoeh.antennapod.dialog.ChooseDataFolderDialog;
|
|||
/** Is show if there is now external storage available. */
|
||||
public class StorageErrorActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "StorageErrorActivity";
|
||||
private static final String TAG = "StorageErrorActivity";
|
||||
|
||||
private static final String[] EXTERNAL_STORAGE_PERMISSIONS = {
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE };
|
||||
private static final int PERMISSION_REQUEST_EXTERNAL_STORAGE = 42;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.storage_error);
|
||||
setContentView(R.layout.storage_error);
|
||||
|
||||
Button btnChooseDataFolder = findViewById(R.id.btnChooseDataFolder);
|
||||
btnChooseDataFolder.setOnClickListener(v -> {
|
||||
Button btnChooseDataFolder = findViewById(R.id.btnChooseDataFolder);
|
||||
btnChooseDataFolder.setOnClickListener(v -> {
|
||||
if (Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT &&
|
||||
Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
showChooseDataFolderDialog();
|
||||
|
@ -82,11 +80,10 @@ public class StorageErrorActivity extends AppCompatActivity {
|
|||
}
|
||||
if (grantResults[0] != PackageManager.PERMISSION_GRANTED ||
|
||||
grantResults[1] != PackageManager.PERMISSION_GRANTED) {
|
||||
new MaterialDialog.Builder(this)
|
||||
.content(R.string.choose_data_directory_permission_rationale)
|
||||
.positiveText(android.R.string.ok)
|
||||
.onPositive((dialog, which) -> requestPermission())
|
||||
.onNegative((dialog, which) -> finish())
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(R.string.choose_data_directory_permission_rationale)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> requestPermission())
|
||||
.setNegativeButton(android.R.string.cancel, (dialog, which) -> finish())
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
@ -101,15 +98,15 @@ public class StorageErrorActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
try {
|
||||
unregisterReceiver(mediaUpdate);
|
||||
} catch (IllegalArgumentException e) {
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
try {
|
||||
unregisterReceiver(mediaUpdate);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(TAG, Log.getStackTraceString(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// see PreferenceController.showChooseDataFolderDialog()
|
||||
private void showChooseDataFolderDialog() {
|
||||
|
@ -123,9 +120,9 @@ public class StorageErrorActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == Activity.RESULT_OK &&
|
||||
requestCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) {
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == Activity.RESULT_OK &&
|
||||
requestCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) {
|
||||
String dir = data.getStringExtra(DirectoryChooserActivity.RESULT_SELECTED_DIR);
|
||||
|
||||
File path;
|
||||
|
@ -138,46 +135,46 @@ public class StorageErrorActivity extends AppCompatActivity {
|
|||
return;
|
||||
}
|
||||
String message = null;
|
||||
if(!path.exists()) {
|
||||
message = String.format(getString(R.string.folder_does_not_exist_error), dir);
|
||||
} else if(!path.canRead()) {
|
||||
message = String.format(getString(R.string.folder_not_readable_error), dir);
|
||||
} else if(!path.canWrite()) {
|
||||
message = String.format(getString(R.string.folder_not_writable_error), dir);
|
||||
}
|
||||
if(!path.exists()) {
|
||||
message = String.format(getString(R.string.folder_does_not_exist_error), dir);
|
||||
} else if(!path.canRead()) {
|
||||
message = String.format(getString(R.string.folder_not_readable_error), dir);
|
||||
} else if(!path.canWrite()) {
|
||||
message = String.format(getString(R.string.folder_not_writable_error), dir);
|
||||
}
|
||||
|
||||
if(message == null) {
|
||||
Log.d(TAG, "Setting data folder: " + dir);
|
||||
UserPreferences.setDataFolder(dir);
|
||||
leaveErrorState();
|
||||
} else {
|
||||
AlertDialog.Builder ab = new AlertDialog.Builder(this);
|
||||
ab.setMessage(message);
|
||||
ab.setPositiveButton(android.R.string.ok, null);
|
||||
ab.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message == null) {
|
||||
Log.d(TAG, "Setting data folder: " + dir);
|
||||
UserPreferences.setDataFolder(dir);
|
||||
leaveErrorState();
|
||||
} else {
|
||||
AlertDialog.Builder ab = new AlertDialog.Builder(this);
|
||||
ab.setMessage(message);
|
||||
ab.setPositiveButton(android.R.string.ok, null);
|
||||
ab.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void leaveErrorState() {
|
||||
finish();
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
}
|
||||
private void leaveErrorState() {
|
||||
finish();
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
}
|
||||
|
||||
private final BroadcastReceiver mediaUpdate = new BroadcastReceiver() {
|
||||
private final BroadcastReceiver mediaUpdate = new BroadcastReceiver() {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (TextUtils.equals(intent.getAction(), Intent.ACTION_MEDIA_MOUNTED)) {
|
||||
if (intent.getBooleanExtra("read-only", true)) {
|
||||
Log.d(TAG, "Media was mounted; Finishing activity");
|
||||
leaveErrorState();
|
||||
} else {
|
||||
Log.d(TAG, "Media seemed to have been mounted read only");
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (TextUtils.equals(intent.getAction(), Intent.ACTION_MEDIA_MOUNTED)) {
|
||||
if (intent.getBooleanExtra("read-only", true)) {
|
||||
Log.d(TAG, "Media was mounted; Finishing activity");
|
||||
leaveErrorState();
|
||||
} else {
|
||||
Log.d(TAG, "Media seemed to have been mounted read only");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.danoeh.antennapod.adapter;
|
|||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.widget.ProgressBar;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
@ -20,7 +21,6 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
|
|||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
||||
import de.danoeh.antennapod.dialog.ChooseDataFolderDialog;
|
||||
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
|
||||
|
||||
|
||||
public class DataFolderAdapter extends RecyclerView.Adapter<DataFolderAdapter.ViewHolder> {
|
||||
|
@ -105,7 +105,7 @@ public class DataFolderAdapter extends RecyclerView.Adapter<DataFolderAdapter.Vi
|
|||
private TextView path;
|
||||
private TextView size;
|
||||
private RadioButton radioButton;
|
||||
private MaterialProgressBar progressBar;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
|
|
@ -3,8 +3,7 @@ package de.danoeh.antennapod.adapter.actionbutton;
|
|||
import android.content.Context;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
|
@ -27,16 +26,15 @@ class MobileDownloadHelper {
|
|||
}
|
||||
|
||||
static void confirmMobileDownload(final Context context, final FeedItem item) {
|
||||
MaterialDialog.Builder builder = new MaterialDialog.Builder(context)
|
||||
.title(R.string.confirm_mobile_download_dialog_title)
|
||||
.content(R.string.confirm_mobile_download_dialog_message)
|
||||
.positiveText(context.getText(R.string.confirm_mobile_download_dialog_enable_temporarily))
|
||||
.onPositive((dialog, which) -> downloadFeedItems(context, item));
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.confirm_mobile_download_dialog_title)
|
||||
.setMessage(R.string.confirm_mobile_download_dialog_message)
|
||||
.setPositiveButton(context.getText(R.string.confirm_mobile_download_dialog_enable_temporarily),
|
||||
(dialog, which) -> downloadFeedItems(context, item));
|
||||
if (!DBReader.getQueueIDList().contains(item.getId())) {
|
||||
builder
|
||||
.content(R.string.confirm_mobile_download_dialog_message_not_in_queue)
|
||||
.neutralText(R.string.confirm_mobile_download_dialog_only_add_to_queue)
|
||||
.onNeutral((dialog, which) -> addToQueue(context, item));
|
||||
builder.setMessage(R.string.confirm_mobile_download_dialog_message_not_in_queue)
|
||||
.setNeutralButton(R.string.confirm_mobile_download_dialog_only_add_to_queue,
|
||||
(dialog, which) -> addToQueue(context, item));
|
||||
}
|
||||
builder.show();
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@ package de.danoeh.antennapod.dialog;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.DataFolderAdapter;
|
||||
|
||||
|
@ -25,21 +27,23 @@ public class ChooseDataFolderDialog {
|
|||
DataFolderAdapter adapter = new DataFolderAdapter(context, handlerFunc);
|
||||
|
||||
if (adapter.getItemCount() == 0) {
|
||||
new MaterialDialog.Builder(context)
|
||||
.title(R.string.error_label)
|
||||
.content(R.string.external_storage_error_msg)
|
||||
.neutralText(android.R.string.ok)
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.error_label)
|
||||
.setMessage(R.string.external_storage_error_msg)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
|
||||
MaterialDialog dialog = new MaterialDialog.Builder(context)
|
||||
.title(R.string.choose_data_directory)
|
||||
.content(R.string.choose_data_directory_message)
|
||||
.adapter(adapter, null)
|
||||
.negativeText(R.string.cancel_label)
|
||||
.cancelable(true)
|
||||
.build();
|
||||
View content = View.inflate(context, R.layout.choose_data_folder_dialog, null);
|
||||
AlertDialog dialog = new AlertDialog.Builder(context)
|
||||
.setView(content)
|
||||
.setTitle(R.string.choose_data_directory)
|
||||
.setMessage(R.string.choose_data_directory_message)
|
||||
.setNegativeButton(R.string.cancel_label, null)
|
||||
.create();
|
||||
((RecyclerView) content.findViewById(R.id.recyclerView)).setLayoutManager(new LinearLayoutManager(context));
|
||||
((RecyclerView) content.findViewById(R.id.recyclerView)).setAdapter(adapter);
|
||||
adapter.setDialog(dialog);
|
||||
dialog.show();
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@ package de.danoeh.antennapod.dialog;
|
|||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import java.util.Locale;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
|
||||
|
@ -24,7 +24,7 @@ public class PlaybackControlsDialog extends DialogFragment {
|
|||
private static final String ARGUMENT_IS_PLAYING_VIDEO = "isPlayingVideo";
|
||||
|
||||
private PlaybackController controller;
|
||||
private MaterialDialog dialog;
|
||||
private AlertDialog dialog;
|
||||
private boolean isPlayingVideo;
|
||||
|
||||
public static PlaybackControlsDialog newInstance(boolean isPlayingVideo) {
|
||||
|
@ -59,15 +59,14 @@ public class PlaybackControlsDialog extends DialogFragment {
|
|||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
isPlayingVideo = getArguments() != null && getArguments().getBoolean(ARGUMENT_IS_PLAYING_VIDEO);
|
||||
|
||||
dialog = new MaterialDialog.Builder(getContext())
|
||||
.title(R.string.audio_controls)
|
||||
.customView(R.layout.audio_controls, true)
|
||||
.neutralText(R.string.close_label)
|
||||
.onNeutral((dialog1, which) -> {
|
||||
final SeekBar left = (SeekBar) dialog1.findViewById(R.id.volume_left);
|
||||
final SeekBar right = (SeekBar) dialog1.findViewById(R.id.volume_right);
|
||||
dialog = new AlertDialog.Builder(getContext())
|
||||
.setTitle(R.string.audio_controls)
|
||||
.setView(R.layout.audio_controls)
|
||||
.setPositiveButton(R.string.close_label, (dialog1, which) -> {
|
||||
final SeekBar left = dialog.findViewById(R.id.volume_left);
|
||||
final SeekBar right = dialog.findViewById(R.id.volume_right);
|
||||
UserPreferences.setVolume(left.getProgress(), right.getProgress());
|
||||
}).build();
|
||||
}).create();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Dialog;
|
|||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
|
@ -16,10 +17,6 @@ import android.widget.EditText;
|
|||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.afollestad.materialdialogs.internal.MDButton;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
|
@ -48,7 +45,7 @@ public class ProxyDialog {
|
|||
|
||||
private final Context context;
|
||||
|
||||
private MaterialDialog dialog;
|
||||
private AlertDialog dialog;
|
||||
|
||||
private Spinner spType;
|
||||
private EditText etHost;
|
||||
|
@ -64,54 +61,53 @@ public class ProxyDialog {
|
|||
this.context = context;
|
||||
}
|
||||
|
||||
public Dialog createDialog() {
|
||||
dialog = new MaterialDialog.Builder(context)
|
||||
.title(R.string.pref_proxy_title)
|
||||
.customView(R.layout.proxy_settings, true)
|
||||
.positiveText(R.string.proxy_test_label)
|
||||
.negativeText(R.string.cancel_label)
|
||||
.onPositive((dialog1, which) -> {
|
||||
if(!testSuccessful) {
|
||||
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
|
||||
test();
|
||||
return;
|
||||
}
|
||||
String type = (String) ((Spinner) dialog1.findViewById(R.id.spType)).getSelectedItem();
|
||||
ProxyConfig proxy;
|
||||
if(Proxy.Type.valueOf(type) == Proxy.Type.DIRECT) {
|
||||
proxy = ProxyConfig.direct();
|
||||
} else {
|
||||
String host = etHost.getText().toString();
|
||||
String port = etPort.getText().toString();
|
||||
String username = etUsername.getText().toString();
|
||||
if(TextUtils.isEmpty(username)) {
|
||||
username = null;
|
||||
}
|
||||
String password = etPassword.getText().toString();
|
||||
if(TextUtils.isEmpty(password)) {
|
||||
password = null;
|
||||
}
|
||||
int portValue = 0;
|
||||
if(!TextUtils.isEmpty(port)) {
|
||||
portValue = Integer.valueOf(port);
|
||||
}
|
||||
if (Proxy.Type.valueOf(type) == Proxy.Type.SOCKS) {
|
||||
proxy = ProxyConfig.socks(host, portValue, username, password);
|
||||
} else {
|
||||
proxy = ProxyConfig.http(host, portValue, username, password);
|
||||
}
|
||||
}
|
||||
UserPreferences.setProxyConfig(proxy);
|
||||
AntennapodHttpClient.reinit();
|
||||
dialog.dismiss();
|
||||
})
|
||||
.onNegative((dialog1, which) -> dialog1.dismiss())
|
||||
.autoDismiss(false)
|
||||
.build();
|
||||
View view = dialog.getCustomView();
|
||||
spType = view.findViewById(R.id.spType);
|
||||
public Dialog show() {
|
||||
View content = View.inflate(context, R.layout.proxy_settings, null);
|
||||
dialog = new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.pref_proxy_title)
|
||||
.setView(content)
|
||||
.setNegativeButton(R.string.cancel_label, null)
|
||||
.setPositiveButton(R.string.proxy_test_label, null)
|
||||
.show();
|
||||
// To prevent cancelling the dialog on button click
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener((view) -> {
|
||||
if (!testSuccessful) {
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
test();
|
||||
return;
|
||||
}
|
||||
String type = (String) ((Spinner) content.findViewById(R.id.spType)).getSelectedItem();
|
||||
ProxyConfig proxy;
|
||||
if (Proxy.Type.valueOf(type) == Proxy.Type.DIRECT) {
|
||||
proxy = ProxyConfig.direct();
|
||||
} else {
|
||||
String host = etHost.getText().toString();
|
||||
String port = etPort.getText().toString();
|
||||
String username = etUsername.getText().toString();
|
||||
if(TextUtils.isEmpty(username)) {
|
||||
username = null;
|
||||
}
|
||||
String password = etPassword.getText().toString();
|
||||
if(TextUtils.isEmpty(password)) {
|
||||
password = null;
|
||||
}
|
||||
int portValue = 0;
|
||||
if(!TextUtils.isEmpty(port)) {
|
||||
portValue = Integer.valueOf(port);
|
||||
}
|
||||
if (Proxy.Type.valueOf(type) == Proxy.Type.SOCKS) {
|
||||
proxy = ProxyConfig.socks(host, portValue, username, password);
|
||||
} else {
|
||||
proxy = ProxyConfig.http(host, portValue, username, password);
|
||||
}
|
||||
}
|
||||
UserPreferences.setProxyConfig(proxy);
|
||||
AntennapodHttpClient.reinit();
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
List<String> types= new ArrayList<>();
|
||||
spType = content.findViewById(R.id.spType);
|
||||
List<String> types = new ArrayList<>();
|
||||
types.add(Proxy.Type.DIRECT.name());
|
||||
types.add(Proxy.Type.HTTP.name());
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
|
@ -123,22 +119,22 @@ public class ProxyDialog {
|
|||
spType.setAdapter(adapter);
|
||||
ProxyConfig proxyConfig = UserPreferences.getProxyConfig();
|
||||
spType.setSelection(adapter.getPosition(proxyConfig.type.name()));
|
||||
etHost = view.findViewById(R.id.etHost);
|
||||
etHost = content.findViewById(R.id.etHost);
|
||||
if(!TextUtils.isEmpty(proxyConfig.host)) {
|
||||
etHost.setText(proxyConfig.host);
|
||||
}
|
||||
etHost.addTextChangedListener(requireTestOnChange);
|
||||
etPort = view.findViewById(R.id.etPort);
|
||||
etPort = content.findViewById(R.id.etPort);
|
||||
if(proxyConfig.port > 0) {
|
||||
etPort.setText(String.valueOf(proxyConfig.port));
|
||||
}
|
||||
etPort.addTextChangedListener(requireTestOnChange);
|
||||
etUsername = view.findViewById(R.id.etUsername);
|
||||
etUsername = content.findViewById(R.id.etUsername);
|
||||
if(!TextUtils.isEmpty(proxyConfig.username)) {
|
||||
etUsername.setText(proxyConfig.username);
|
||||
}
|
||||
etUsername.addTextChangedListener(requireTestOnChange);
|
||||
etPassword = view.findViewById(R.id.etPassword);
|
||||
etPassword = content.findViewById(R.id.etPassword);
|
||||
if(!TextUtils.isEmpty(proxyConfig.password)) {
|
||||
etPassword.setText(proxyConfig.username);
|
||||
}
|
||||
|
@ -159,7 +155,7 @@ public class ProxyDialog {
|
|||
enableSettings(false);
|
||||
}
|
||||
});
|
||||
txtvMessage = view.findViewById(R.id.txtvMessage);
|
||||
txtvMessage = content.findViewById(R.id.txtvMessage);
|
||||
checkValidity();
|
||||
return dialog;
|
||||
}
|
||||
|
@ -230,14 +226,12 @@ public class ProxyDialog {
|
|||
private void setTestRequired(boolean required) {
|
||||
if(required) {
|
||||
testSuccessful = false;
|
||||
MDButton button = dialog.getActionButton(DialogAction.POSITIVE);
|
||||
button.setText(context.getText(R.string.proxy_test_label));
|
||||
button.setEnabled(true);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setText(R.string.proxy_test_label);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
|
||||
} else {
|
||||
testSuccessful = true;
|
||||
MDButton button = dialog.getActionButton(DialogAction.POSITIVE);
|
||||
button.setText(context.getText(android.R.string.ok));
|
||||
button.setEnabled(true);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setText(android.R.string.ok);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,10 @@ import androidx.annotation.Nullable;
|
|||
import androidx.annotation.VisibleForTesting;
|
||||
import android.util.Log;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
|
||||
|
@ -97,21 +96,18 @@ public class RatingDialog {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
private static MaterialDialog createDialog() {
|
||||
private static AlertDialog createDialog() {
|
||||
Context context = mContext.get();
|
||||
if(context == null) {
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
return new MaterialDialog.Builder(context)
|
||||
.title(R.string.rating_title)
|
||||
.content(R.string.rating_message)
|
||||
.positiveText(R.string.rating_now_label)
|
||||
.negativeText(R.string.rating_never_label)
|
||||
.neutralText(R.string.rating_later_label)
|
||||
.onPositive((dialog, which) -> rateNow())
|
||||
.onNegative((dialog, which) -> saveRated())
|
||||
.onNeutral((dialog, which) -> resetStartDate())
|
||||
.cancelListener(dialog1 -> resetStartDate())
|
||||
.build();
|
||||
return new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.rating_title)
|
||||
.setMessage(R.string.rating_message)
|
||||
.setPositiveButton(R.string.rating_now_label, (dialog, which) -> rateNow())
|
||||
.setNegativeButton(R.string.rating_never_label, (dialog, which) -> saveRated())
|
||||
.setNeutralButton(R.string.rating_later_label, (dialog, which) -> resetStartDate())
|
||||
.setOnCancelListener(dialog1 -> resetStartDate())
|
||||
.create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,12 @@ package de.danoeh.antennapod.dialog;
|
|||
import android.app.Activity;
|
||||
import android.text.InputType;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
||||
|
@ -25,20 +27,24 @@ public class RenameFeedDialog {
|
|||
if(activity == null) {
|
||||
return;
|
||||
}
|
||||
new MaterialDialog.Builder(activity)
|
||||
.title(de.danoeh.antennapod.core.R.string.rename_feed_label)
|
||||
.inputType(InputType.TYPE_CLASS_TEXT)
|
||||
.input(feed.getTitle(), feed.getTitle(), true, (dialog, input) -> {
|
||||
feed.setCustomTitle(input.toString());
|
||||
|
||||
View content = View.inflate(activity, R.layout.edit_text_dialog, null);
|
||||
EditText editText = content.findViewById(R.id.text);
|
||||
editText.setText(feed.getTitle());
|
||||
AlertDialog dialog = new AlertDialog.Builder(activity)
|
||||
.setView(content)
|
||||
.setTitle(de.danoeh.antennapod.core.R.string.rename_feed_label)
|
||||
.setPositiveButton(android.R.string.ok, (d, input) -> {
|
||||
feed.setCustomTitle(editText.getText().toString());
|
||||
DBWriter.setFeedCustomTitle(feed);
|
||||
dialog.dismiss();
|
||||
})
|
||||
.neutralText(de.danoeh.antennapod.core.R.string.reset)
|
||||
.onNeutral((dialog, which) -> dialog.getInputEditText().setText(feed.getFeedTitle()))
|
||||
.negativeText(de.danoeh.antennapod.core.R.string.cancel_label)
|
||||
.onNegative((dialog, which) -> dialog.dismiss())
|
||||
.autoDismiss(false)
|
||||
.setNeutralButton(de.danoeh.antennapod.core.R.string.reset, null)
|
||||
.setNegativeButton(de.danoeh.antennapod.core.R.string.cancel_label, null)
|
||||
.show();
|
||||
|
||||
// To prevent cancelling the dialog on button click
|
||||
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener(
|
||||
(view) -> editText.setText(feed.getFeedTitle()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package de.danoeh.antennapod.dialog;
|
|||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
@ -12,9 +11,7 @@ import android.widget.EditText;
|
|||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.event.MessageEvent;
|
||||
import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
|
||||
|
@ -26,7 +23,7 @@ public abstract class SleepTimerDialog {
|
|||
|
||||
private final Context context;
|
||||
|
||||
private MaterialDialog dialog;
|
||||
private AlertDialog dialog;
|
||||
private EditText etxtTime;
|
||||
private Spinner spTimeUnit;
|
||||
private CheckBox cbShakeToReset;
|
||||
|
@ -38,40 +35,38 @@ public abstract class SleepTimerDialog {
|
|||
this.context = context;
|
||||
}
|
||||
|
||||
public MaterialDialog createNewDialog() {
|
||||
MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
|
||||
builder.title(R.string.set_sleeptimer_label);
|
||||
builder.customView(R.layout.time_dialog, false);
|
||||
builder.positiveText(R.string.set_sleeptimer_label);
|
||||
builder.negativeText(R.string.cancel_label);
|
||||
builder.onNegative((dialog, which) -> dialog.dismiss());
|
||||
builder.onPositive((dialog, which) -> {
|
||||
try {
|
||||
savePreferences();
|
||||
long input = SleepTimerPreferences.timerMillis();
|
||||
onTimerSet(input, cbShakeToReset.isChecked(), cbVibrate.isChecked());
|
||||
dialog.dismiss();
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
Toast toast = Toast.makeText(context, R.string.time_dialog_invalid_input,
|
||||
Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
}
|
||||
});
|
||||
dialog = builder.build();
|
||||
|
||||
View view = dialog.getView();
|
||||
etxtTime = view.findViewById(R.id.etxtTime);
|
||||
spTimeUnit = view.findViewById(R.id.spTimeUnit);
|
||||
cbShakeToReset = view.findViewById(R.id.cbShakeToReset);
|
||||
cbVibrate = view.findViewById(R.id.cbVibrate);
|
||||
chAutoEnable = view.findViewById(R.id.chAutoEnable);
|
||||
public AlertDialog createNewDialog() {
|
||||
View content = View.inflate(context, R.layout.time_dialog, null);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.set_sleeptimer_label);
|
||||
builder.setView(content);
|
||||
builder.setNegativeButton(R.string.cancel_label, (dialog, which) -> dialog.dismiss());
|
||||
builder.setPositiveButton(R.string.set_sleeptimer_label, (dialog, which) -> {
|
||||
try {
|
||||
savePreferences();
|
||||
long input = SleepTimerPreferences.timerMillis();
|
||||
onTimerSet(input, cbShakeToReset.isChecked(), cbVibrate.isChecked());
|
||||
dialog.dismiss();
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
Toast toast = Toast.makeText(context, R.string.time_dialog_invalid_input,
|
||||
Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
}
|
||||
});
|
||||
dialog = builder.create();
|
||||
|
||||
etxtTime = content.findViewById(R.id.etxtTime);
|
||||
spTimeUnit = content.findViewById(R.id.spTimeUnit);
|
||||
cbShakeToReset = content.findViewById(R.id.cbShakeToReset);
|
||||
cbVibrate = content.findViewById(R.id.cbVibrate);
|
||||
chAutoEnable = content.findViewById(R.id.chAutoEnable);
|
||||
|
||||
etxtTime.setText(SleepTimerPreferences.lastTimerValue());
|
||||
etxtTime.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
checkInputLength(s.length());
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(s.length() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -109,16 +104,6 @@ public abstract class SleepTimerDialog {
|
|||
return dialog;
|
||||
}
|
||||
|
||||
private void checkInputLength(int length) {
|
||||
if (length > 0) {
|
||||
Log.d(TAG, "Length is larger than 0, enabling confirm button");
|
||||
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
|
||||
} else {
|
||||
Log.d(TAG, "Length is smaller than 0, disabling confirm button");
|
||||
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onTimerSet(long millis, boolean shakeToReset, boolean vibrate);
|
||||
|
||||
private void savePreferences() {
|
||||
|
|
|
@ -7,10 +7,6 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -45,38 +41,30 @@ public class VariableSpeedDialog {
|
|||
}
|
||||
|
||||
private static void showGetPluginDialog(final Context context, boolean showSpeedSelector) {
|
||||
MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
|
||||
builder.title(R.string.no_playback_plugin_title);
|
||||
builder.content(R.string.no_playback_plugin_or_sonic_msg);
|
||||
builder.positiveText(R.string.enable_sonic);
|
||||
builder.negativeText(R.string.download_plugin_label);
|
||||
builder.neutralText(R.string.close_label);
|
||||
builder.onPositive((dialog, which) -> {
|
||||
if (Build.VERSION.SDK_INT >= 16) { // just to be safe
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.no_playback_plugin_title);
|
||||
builder.setMessage(R.string.no_playback_plugin_or_sonic_msg);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
builder.setPositiveButton(R.string.enable_sonic, (dialog, which) -> {
|
||||
UserPreferences.enableSonic();
|
||||
if(showSpeedSelector) {
|
||||
if (showSpeedSelector) {
|
||||
showSpeedSelectorDialog(context);
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.onNegative((dialog, which) -> {
|
||||
try {
|
||||
context.startActivity(playStoreIntent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
// this is usually thrown on an emulator if the Android market is not installed
|
||||
Log.e(TAG, Log.getStackTraceString(e));
|
||||
}
|
||||
});
|
||||
builder.forceStacking(true);
|
||||
MaterialDialog dialog = builder.show();
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
View pos = dialog.getActionButton(DialogAction.POSITIVE);
|
||||
pos.setEnabled(false);
|
||||
});
|
||||
}
|
||||
if(!IntentUtils.isCallable(context.getApplicationContext(), playStoreIntent)) {
|
||||
View pos = dialog.getActionButton(DialogAction.NEGATIVE);
|
||||
pos.setEnabled(false);
|
||||
if (IntentUtils.isCallable(context.getApplicationContext(), playStoreIntent)) {
|
||||
builder.setNegativeButton(R.string.download_plugin_label, (dialog, which) -> {
|
||||
try {
|
||||
context.startActivity(playStoreIntent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
// this is usually thrown on an emulator if the Android market is not installed
|
||||
Log.e(TAG, Log.getStackTraceString(e));
|
||||
}
|
||||
});
|
||||
}
|
||||
builder.setNeutralButton(R.string.close_label, null);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private static void showSpeedSelectorDialog(final Context context) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.danoeh.antennapod.fragment;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
|
@ -18,8 +19,6 @@ import android.widget.GridView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import de.danoeh.antennapod.discovery.ItunesPodcastSearcher;
|
||||
import de.danoeh.antennapod.discovery.ItunesTopListLoader;
|
||||
import de.danoeh.antennapod.discovery.PodcastSearchResult;
|
||||
|
@ -120,9 +119,9 @@ public class ItunesSearchFragment extends Fragment {
|
|||
progressBar.setVisibility(View.GONE);
|
||||
gridView.setVisibility(View.VISIBLE);
|
||||
String prefix = getString(R.string.error_msg_prefix);
|
||||
new MaterialDialog.Builder(getActivity())
|
||||
.content(prefix + " " + error.getMessage())
|
||||
.neutralText(android.R.string.ok)
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setMessage(prefix + " " + error.getMessage())
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.danoeh.antennapod.fragment;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -11,7 +12,6 @@ import android.widget.AdapterView;
|
|||
import android.widget.GridView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
|
||||
|
@ -110,9 +110,9 @@ public class QuickFeedDiscoveryFragment extends Fragment implements AdapterView.
|
|||
Log.e(TAG, Log.getStackTraceString(error));
|
||||
view.setAlpha(1f);
|
||||
String prefix = getString(R.string.error_msg_prefix);
|
||||
new MaterialDialog.Builder(getActivity())
|
||||
.content(prefix + " " + error.getMessage())
|
||||
.neutralText(android.R.string.ok)
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setMessage(prefix + " " + error.getMessage())
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -5,11 +5,8 @@ import android.content.Context;
|
|||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import android.text.format.DateFormat;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
|
@ -65,7 +62,7 @@ public class NetworkPreferencesFragment extends PreferenceFragmentCompat {
|
|||
// validate and set correct value: number of downloads between 1 and 50 (inclusive)
|
||||
findPreference(PREF_PROXY).setOnPreferenceClickListener(preference -> {
|
||||
ProxyDialog dialog = new ProxyDialog(getActivity());
|
||||
dialog.createDialog().show();
|
||||
dialog.show();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -107,13 +104,10 @@ public class NetworkPreferencesFragment extends PreferenceFragmentCompat {
|
|||
private void showUpdateIntervalTimePreferencesDialog() {
|
||||
final Context context = getActivity();
|
||||
|
||||
MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
|
||||
builder.title(R.string.pref_autoUpdateIntervallOrTime_title);
|
||||
builder.content(R.string.pref_autoUpdateIntervallOrTime_message);
|
||||
builder.positiveText(R.string.pref_autoUpdateIntervallOrTime_Interval);
|
||||
builder.negativeText(R.string.pref_autoUpdateIntervallOrTime_TimeOfDay);
|
||||
builder.neutralText(R.string.pref_autoUpdateIntervallOrTime_Disable);
|
||||
builder.onPositive((dialog, which) -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.pref_autoUpdateIntervallOrTime_title);
|
||||
builder.setMessage(R.string.pref_autoUpdateIntervallOrTime_message);
|
||||
builder.setPositiveButton(R.string.pref_autoUpdateIntervallOrTime_Interval, (dialog, which) -> {
|
||||
AlertDialog.Builder builder1 = new AlertDialog.Builder(context);
|
||||
builder1.setTitle(context.getString(R.string.pref_autoUpdateIntervallOrTime_Interval));
|
||||
final String[] values = context.getResources().getStringArray(R.array.update_intervall_values);
|
||||
|
@ -133,7 +127,7 @@ public class NetworkPreferencesFragment extends PreferenceFragmentCompat {
|
|||
builder1.setNegativeButton(context.getString(R.string.cancel_label), null);
|
||||
builder1.show();
|
||||
});
|
||||
builder.onNegative((dialog, which) -> {
|
||||
builder.setNegativeButton(R.string.pref_autoUpdateIntervallOrTime_TimeOfDay, (dialog, which) -> {
|
||||
int hourOfDay = 7;
|
||||
int minute = 0;
|
||||
int[] updateTime = UserPreferences.getUpdateTimeOfDay();
|
||||
|
@ -152,7 +146,7 @@ public class NetworkPreferencesFragment extends PreferenceFragmentCompat {
|
|||
timePickerDialog.setTitle(context.getString(R.string.pref_autoUpdateIntervallOrTime_TimeOfDay));
|
||||
timePickerDialog.show();
|
||||
});
|
||||
builder.onNeutral((dialog, which) -> {
|
||||
builder.setNeutralButton(R.string.pref_autoUpdateIntervallOrTime_Disable, (dialog, which) -> {
|
||||
UserPreferences.disableAutoUpdate();
|
||||
setUpdateIntervalText();
|
||||
});
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/recyclerView" />
|
||||
|
||||
</LinearLayout>
|
|
@ -37,12 +37,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
tools:text="2 GB" />
|
||||
|
||||
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
||||
<ProgressBar
|
||||
android:id="@+id/used_space"
|
||||
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:mpb_progressStyle="horizontal" />
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text"
|
||||
android:ems="10"
|
||||
android:id="@+id/text" />
|
||||
|
||||
</LinearLayout>
|
|
@ -3,7 +3,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="32dp">
|
||||
android:padding="16dp">
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvType"
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/discover_error"
|
||||
android:textColor="@color/md_edittext_error"
|
||||
android:textColor="@color/download_failed_red"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_height="wrap_content" />
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
android:gravity="center"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
|
@ -33,7 +34,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
|
@ -33,27 +34,27 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/md_transparent"
|
||||
android:background="@android:color/transparent"
|
||||
android:contentDescription="@string/rewind_label"
|
||||
android:src="@drawable/ic_av_fast_rewind_white_80dp" />
|
||||
app:srcCompat="@drawable/ic_av_fast_rewind_white_80dp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butPlay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/md_transparent"
|
||||
android:background="@android:color/transparent"
|
||||
android:contentDescription="@string/pause_label"
|
||||
android:src="@drawable/ic_av_pause_white_80dp" />
|
||||
app:srcCompat="@drawable/ic_av_pause_white_80dp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butFF"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/md_transparent"
|
||||
android:background="@android:color/transparent"
|
||||
android:contentDescription="@string/fast_forward_label"
|
||||
android:src="@drawable/ic_av_fast_forward_white_80dp" />
|
||||
app:srcCompat="@drawable/ic_av_fast_forward_white_80dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -15,16 +15,14 @@
|
|||
android:key="prefEpisodeCacheSize"
|
||||
android:title="@string/pref_episode_cache_title"
|
||||
android:summary="@string/pref_episode_cache_summary"
|
||||
android:entryValues="@array/episode_cache_size_values"
|
||||
app:useStockLayout="true"/>
|
||||
android:entryValues="@array/episode_cache_size_values"/>
|
||||
<ListPreference
|
||||
android:defaultValue="-1"
|
||||
android:entries="@array/episode_cleanup_entries"
|
||||
android:key="prefEpisodeCleanup"
|
||||
android:title="@string/pref_episode_cleanup_title"
|
||||
android:summary="@string/pref_episode_cleanup_summary"
|
||||
android:entryValues="@array/episode_cleanup_values"
|
||||
app:useStockLayout="true"/>
|
||||
android:entryValues="@array/episode_cleanup_values"/>
|
||||
<SwitchPreference
|
||||
android:key="prefEnableAutoDownloadOnBattery"
|
||||
android:title="@string/pref_automatic_download_on_battery_title"
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/interruptions">
|
||||
<SwitchPreference
|
||||
|
@ -42,8 +40,7 @@
|
|||
android:entryValues="@array/video_background_behavior_values"
|
||||
android:key="prefVideoBehavior"
|
||||
android:summary="@string/pref_videoBehavior_sum"
|
||||
android:title="@string/pref_videoBehavior_title"
|
||||
app:useStockLayout="true"/>
|
||||
android:title="@string/pref_videoBehavior_title"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/playback_control">
|
||||
|
@ -95,8 +92,7 @@
|
|||
android:entries="@array/enqueue_location_options"
|
||||
android:entryValues="@array/enqueue_location_values"
|
||||
android:key="prefEnqueueLocation"
|
||||
android:title="@string/pref_enqueue_location_title"
|
||||
app:useStockLayout="true"/>
|
||||
android:title="@string/pref_enqueue_location_title"/>
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:enabled="true"
|
||||
|
@ -109,8 +105,7 @@
|
|||
android:entryValues="@array/smart_mark_as_played_values"
|
||||
android:key="prefSmartMarkAsPlayedSecs"
|
||||
android:summary="@string/pref_smart_mark_as_played_sum"
|
||||
android:title="@string/pref_smart_mark_as_played_title"
|
||||
app:useStockLayout="true"/>
|
||||
android:title="@string/pref_smart_mark_as_played_title"/>
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:enabled="true"
|
||||
|
@ -126,8 +121,7 @@
|
|||
android:key="prefMediaPlayer"
|
||||
android:title="@string/media_player"
|
||||
android:summary="@string/pref_media_player_message"
|
||||
android:entryValues="@array/media_player_values"
|
||||
app:useStockLayout="true"/>
|
||||
android:entryValues="@array/media_player_values"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/experimental_pref">
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
android:title="@string/pref_set_theme_title"
|
||||
android:key="prefTheme"
|
||||
android:summary="@string/pref_set_theme_sum"
|
||||
android:defaultValue="system"
|
||||
app:useStockLayout="true"/>
|
||||
android:defaultValue="system"/>
|
||||
<Preference
|
||||
android:key="prefHiddenDrawerItems"
|
||||
android:summary="@string/pref_nav_drawer_items_sum"
|
||||
|
@ -22,23 +21,20 @@
|
|||
android:title="@string/pref_nav_drawer_feed_order_title"
|
||||
android:key="prefDrawerFeedOrder"
|
||||
android:summary="@string/pref_nav_drawer_feed_order_sum"
|
||||
android:defaultValue="0"
|
||||
app:useStockLayout="true"/>
|
||||
android:defaultValue="0"/>
|
||||
<ListPreference
|
||||
android:entryValues="@array/nav_drawer_feed_counter_values"
|
||||
android:entries="@array/nav_drawer_feed_counter_options"
|
||||
android:title="@string/pref_nav_drawer_feed_counter_title"
|
||||
android:key="prefDrawerFeedIndicator"
|
||||
android:summary="@string/pref_nav_drawer_feed_counter_sum"
|
||||
android:defaultValue="0"
|
||||
app:useStockLayout="true"/>
|
||||
android:defaultValue="0"/>
|
||||
<SwitchPreference
|
||||
android:title="@string/pref_episode_cover_title"
|
||||
android:key="prefEpisodeCover"
|
||||
android:summary="@string/pref_episode_cover_summary"
|
||||
android:defaultValue="true"
|
||||
android:enabled="true"
|
||||
app:useStockLayout="true"/>
|
||||
android:enabled="true"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/external_elements">
|
||||
<SwitchPreference
|
||||
|
@ -71,7 +67,6 @@
|
|||
android:key="prefBackButtonBehavior"
|
||||
android:title="@string/pref_back_button_behavior_title"
|
||||
android:summary="@string/pref_back_button_behavior_sum"
|
||||
android:defaultValue="default"
|
||||
app:useStockLayout="true"/>
|
||||
android:defaultValue="default"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -55,7 +55,6 @@ project.ext {
|
|||
glideOkhttpIntegrationVersion = "4.8.0"
|
||||
iconifyVersion = "2.2.2"
|
||||
jsoupVersion = "1.11.2"
|
||||
materialDialogsVersion = "0.9.0.2"
|
||||
okhttpVersion = "3.12.5"
|
||||
okioVersion = "1.17.4"
|
||||
recyclerviewFlexibledividerVersion = "1.4.0"
|
||||
|
|
Loading…
Reference in New Issue