Skip to content

Commit 9c03e4d

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
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
1 parent e6e0be7 commit 9c03e4d

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ class NewVersionWorker(
175175
*/
176176
@JvmStatic
177177
fun enqueueNewVersionCheckingWork(context: Context, isManual: Boolean) {
178+
if (isManual) {
179+
ContextCompat.getMainExecutor(context).execute {
180+
Toast.makeText(
181+
context,
182+
R.string.checking_updates_toast,
183+
Toast.LENGTH_SHORT
184+
).show()
185+
}
186+
}
178187
val workRequest = OneTimeWorkRequestBuilder<NewVersionWorker>()
179188
.setInputData(workDataOf(IS_MANUAL to isManual))
180189
.build()

app/src/main/java/org/schabi/newpipe/settings/UpdateSettingsFragment.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import android.app.AlertDialog;
44
import android.content.Context;
55
import android.os.Bundle;
6-
import android.widget.Toast;
76

87
import androidx.preference.Preference;
98
import androidx.preference.PreferenceManager;
@@ -25,7 +24,6 @@ public class UpdateSettingsFragment extends BasePreferenceFragment {
2524
};
2625

2726
private final Preference.OnPreferenceClickListener manualUpdateClick = preference -> {
28-
Toast.makeText(getContext(), R.string.checking_updates_toast, Toast.LENGTH_SHORT).show();
2927
NewVersionWorker.enqueueNewVersionCheckingWork(requireContext(), true);
3028
return true;
3129
};

0 commit comments

Comments
 (0)