|
19 | 19 |
|
20 | 20 | import android.app.AlertDialog;
|
21 | 21 | import android.app.ProgressDialog;
|
| 22 | +import android.content.SharedPreferences; |
22 | 23 | import android.os.Bundle;
|
23 | 24 | import android.text.method.LinkMovementMethod;
|
24 | 25 | import android.view.MenuItem;
|
| 26 | +import android.widget.Toast; |
25 | 27 |
|
26 | 28 | import androidx.appcompat.app.ActionBar;
|
27 | 29 | import androidx.appcompat.app.AppCompatActivity;
|
| 30 | +import androidx.preference.PreferenceManager; |
28 | 31 |
|
29 | 32 | import io.github.krlvm.powertunnel.BuildConstants;
|
30 | 33 | import io.github.krlvm.powertunnel.android.BuildConfig;
|
@@ -60,7 +63,7 @@ protected void onCreate(Bundle savedInstanceState) {
|
60 | 63 | NoUnderlineSpan.stripUnderlines(binding.license);
|
61 | 64 | binding.license.setMovementMethod(LinkMovementMethod.getInstance());
|
62 | 65 |
|
63 |
| - findViewById(R.id.update_button).setOnClickListener(v -> { |
| 66 | + binding.updateButton.setOnClickListener(v -> { |
64 | 67 | final ProgressDialog progress = new ProgressDialog(AboutActivity.this);
|
65 | 68 | progress.setTitle(R.string.dialog_update_checking_title);
|
66 | 69 | progress.setMessage(getString(R.string.dialog_update_checking_message, BuildConfig.VERSION_NAME));
|
@@ -88,6 +91,14 @@ protected void onCreate(Bundle savedInstanceState) {
|
88 | 91 | .show();
|
89 | 92 | });
|
90 | 93 | });
|
| 94 | + binding.updateButton.setLongClickable(true); |
| 95 | + binding.updateButton.setOnLongClickListener(v -> { |
| 96 | + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); |
| 97 | + final boolean wasDisabled = prefs.getBoolean("disable_update_notifier", false); |
| 98 | + prefs.edit().putBoolean("disable_update_notifier", !wasDisabled).apply(); |
| 99 | + Toast.makeText(this, "Update Notifier has been " + (wasDisabled ? "enabled" : "disabled"), Toast.LENGTH_SHORT).show(); |
| 100 | + return true; |
| 101 | + }); |
91 | 102 | }
|
92 | 103 |
|
93 | 104 | @Override
|
|
0 commit comments