Make mobile streaming dialog easier to understand

This commit is contained in:
ByteHamster 2020-07-27 11:33:25 +02:00
parent 4ddee03214
commit d86121746a
1 changed files with 14 additions and 17 deletions

View File

@ -1,8 +1,6 @@
package de.danoeh.antennapod.dialog;
import android.content.Context;
import android.view.View;
import android.widget.CheckBox;
import androidx.appcompat.app.AlertDialog;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences;
@ -19,25 +17,24 @@ public class StreamingConfirmationDialog {
}
public void show() {
View view = View.inflate(context, R.layout.checkbox_do_not_show_again, null);
CheckBox checkDoNotShowAgain = view.findViewById(R.id.checkbox_do_not_show_again);
new AlertDialog.Builder(context)
.setTitle(R.string.stream_label)
.setMessage(R.string.confirm_mobile_streaming_notification_message)
.setView(view)
.setPositiveButton(R.string.stream_label, (dialog, which) -> {
if (checkDoNotShowAgain.isChecked()) {
UserPreferences.setAllowMobileStreaming(true);
}
new PlaybackServiceStarter(context, playable)
.callEvenIfRunning(true)
.startWhenPrepared(true)
.shouldStream(true)
.shouldStreamThisTime(true)
.start();
.setPositiveButton(R.string.stream_label, (dialog, which) -> stream())
.setNegativeButton(R.string.confirm_mobile_streaming_button_always, (dialog, which) -> {
UserPreferences.setAllowMobileStreaming(true);
stream();
})
.setNegativeButton(R.string.cancel_label, null)
.setNeutralButton(R.string.cancel_label, null)
.show();
}
private void stream() {
new PlaybackServiceStarter(context, playable)
.callEvenIfRunning(true)
.startWhenPrepared(true)
.shouldStream(true)
.shouldStreamThisTime(true)
.start();
}
}