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:
Yevhen Babiichuk (DustDFG) 2026-02-10 20:55:14 +02:00
parent e6e0be772a
commit 9c03e4dcf5
2 changed files with 9 additions and 2 deletions

View File

@ -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()

View File

@ -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;
};