Show toast "checking for update..." every time user starts manual check
When user toggles auto updates in settings it will firstly show "check for update..." toast as like if user presses to button of manual check. It adds consistency and allows to reuse manual check in other places of the app
This commit is contained in:
parent
e6e0be772a
commit
9c03e4dcf5
@ -175,6 +175,15 @@ class NewVersionWorker(
|
||||
*/
|
||||
@JvmStatic
|
||||
fun enqueueNewVersionCheckingWork(context: Context, isManual: Boolean) {
|
||||
if (isManual) {
|
||||
ContextCompat.getMainExecutor(context).execute {
|
||||
Toast.makeText(
|
||||
context,
|
||||
R.string.checking_updates_toast,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
val workRequest = OneTimeWorkRequestBuilder<NewVersionWorker>()
|
||||
.setInputData(workDataOf(IS_MANUAL to isManual))
|
||||
.build()
|
||||
|
||||
@ -3,7 +3,6 @@ package org.schabi.newpipe.settings;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceManager;
|
||||
@ -25,7 +24,6 @@ public class UpdateSettingsFragment extends BasePreferenceFragment {
|
||||
};
|
||||
|
||||
private final Preference.OnPreferenceClickListener manualUpdateClick = preference -> {
|
||||
Toast.makeText(getContext(), R.string.checking_updates_toast, Toast.LENGTH_SHORT).show();
|
||||
NewVersionWorker.enqueueNewVersionCheckingWork(requireContext(), true);
|
||||
return true;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user