removed update toast when app first opens
This commit is contained in:
parent
aa8a05d118
commit
e3106936b8
3 changed files with 11 additions and 6 deletions
|
|
@ -48,7 +48,9 @@ public class MoreFragment extends PreferenceFragmentCompat {
|
|||
});
|
||||
|
||||
updateApp.setOnPreferenceClickListener(preference -> {
|
||||
updateUtil.updateApp();
|
||||
if(!updateUtil.updateApp()){
|
||||
Toast.makeText(getContext(), R.string.you_are_in_latest_version, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,7 +225,9 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||
});
|
||||
|
||||
version.setOnPreferenceClickListener(preference -> {
|
||||
updateUtil.updateApp();
|
||||
if(!updateUtil.updateApp()){
|
||||
Toast.makeText(getContext(), R.string.you_are_in_latest_version, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ public class UpdateUtil {
|
|||
downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
}
|
||||
|
||||
public void updateApp(){
|
||||
public boolean updateApp(){
|
||||
if (updatingApp) {
|
||||
Toast.makeText(context, context.getString(R.string.ytdl_already_updating), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
AtomicReference<JSONObject> res = new AtomicReference<>(new JSONObject());
|
||||
try{
|
||||
|
|
@ -71,8 +71,7 @@ public class UpdateUtil {
|
|||
} catch (JSONException ignored) {}
|
||||
|
||||
if(version.equals("v"+BuildConfig.VERSION_NAME)){
|
||||
Toast.makeText(context, R.string.you_are_in_latest_version, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
MaterialAlertDialogBuilder updateDialog = new MaterialAlertDialogBuilder(context)
|
||||
|
|
@ -82,6 +81,8 @@ public class UpdateUtil {
|
|||
.setNegativeButton("Cancel", (dialogInterface, i) -> {})
|
||||
.setPositiveButton("Update", (dialogInterface, i) -> startAppUpdate(res.get()));
|
||||
updateDialog.show();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue