diff options
author | David-Development <david-dev@live.de> | 2022-02-19 11:42:31 +0300 |
---|---|---|
committer | David Luhmer <david-dev@live.de> | 2022-02-19 11:42:31 +0300 |
commit | 6cafa462a5bc314cdf373b4c796b99d437e72c3f (patch) | |
tree | 0c153e48a825d45c796c061d23be97ad1b933a89 /News-Android-App/src/main/java | |
parent | 0d6f5a73482319e7601976d58ff3b51e7e377ab0 (diff) |
always show incognito mode icon when its activev.0.9.9.71
Signed-off-by: David Luhmer <david-dev@live.de>
Diffstat (limited to 'News-Android-App/src/main/java')
-rw-r--r-- | News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java | 16 | ||||
-rw-r--r-- | News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java | 18 |
2 files changed, 30 insertions, 4 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java index fb18d86d..5b069c1a 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java @@ -20,6 +20,8 @@ package de.luhmer.owncloudnewsreader; +import static java.util.Objects.requireNonNull; + import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; @@ -63,8 +65,6 @@ import de.luhmer.owncloudnewsreader.model.TTSItem; import de.luhmer.owncloudnewsreader.view.PodcastSlidingUpPanelLayout; import de.luhmer.owncloudnewsreader.widget.WidgetProvider; -import static java.util.Objects.requireNonNull; - public class NewsDetailActivity extends PodcastFragmentActivity { @@ -91,6 +91,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity { private MenuItem menuItem_PlayPodcast; private MenuItem menuItem_Starred; private MenuItem menuItem_Read; + private MenuItem menuItem_Incognito; private DatabaseConnectionOrm dbConn; protected ActivityNewsDetailBinding binding; @@ -423,6 +424,15 @@ public class NewsDetailActivity extends PodcastFragmentActivity { binding.faDetailBar.faMarkAsRead.setImageResource(darkIcons ? R.drawable.ic_checkbox_outline_black : R.drawable.ic_checkbox_outline_white); } } + + if (menuItem_Incognito != null) { + if (isIncognitoEnabled()) { + // always show incognito icon if incognito mode is enabled + menuItem_Incognito.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); + } else { + menuItem_Incognito.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); + } + } } @@ -443,6 +453,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity { menuItem_Starred = menu.findItem(R.id.action_starred); menuItem_Read = menu.findItem(R.id.action_read); menuItem_PlayPodcast = menu.findItem(R.id.action_playPodcast); + menuItem_Incognito = menu.findItem(R.id.action_incognito_mode); if (mShowFastActions) { menuItem_Starred.setVisible(false); @@ -500,6 +511,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity { this.share(currentPosition); } else if (itemId == R.id.action_incognito_mode) { toggleIncognitoMode(); + updateActionBarIcons(); } return super.onOptionsItemSelected(item); diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java index 10f5ad70..a3791ca4 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java @@ -388,9 +388,23 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements if (!isAccountThere) { //Then add the new account Account account = new Account(getString(R.string.app_name), accountType); - mAccountManager.addAccountExplicitly(account, "", new Bundle()); - SettingsFragment.setAccountSyncInterval(this, getResources().getInteger(R.integer.default_sync_minutes)); + try { + mAccountManager.addAccountExplicitly(account, "", new Bundle()); + + SettingsFragment.setAccountSyncInterval(this, getResources().getInteger(R.integer.default_sync_minutes)); + } catch (SecurityException exception) { + // not sure if this error can still occur.. it showed up a few versions ago.. so we'll + // keep it here just to be safe + new AlertDialog.Builder(this) + .setTitle("Failed to add account") + .setMessage("If you installed this app previously from anywhere else than the Google Play Store (e.g. F-Droid), please make sure to uninstall it first.") + .setPositiveButton(android.R.string.ok, (dialog, which) -> { + dialog.dismiss(); + }) + .setIcon(android.R.drawable.ic_dialog_alert) + .show(); + } } } |