aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDocile-Alligator <chineseperson5@gmail.com>2022-04-23 13:26:23 +0000
committerDocile-Alligator <chineseperson5@gmail.com>2022-04-23 13:26:23 +0000
commit05e9b8b36e1625a23e96f0205f7a8d92be485b99 (patch)
tree13422dcd42c2e35a7a330c88ec7b8d441eda0737 /app
parent3283541c9a254177bb712a125ed8c631ced4b7bc (diff)
downloadinfinity-for-reddit-05e9b8b36e1625a23e96f0205f7a8d92be485b99.tar
infinity-for-reddit-05e9b8b36e1625a23e96f0205f7a8d92be485b99.tar.gz
infinity-for-reddit-05e9b8b36e1625a23e96f0205f7a8d92be485b99.tar.bz2
infinity-for-reddit-05e9b8b36e1625a23e96f0205f7a8d92be485b99.tar.lz
infinity-for-reddit-05e9b8b36e1625a23e96f0205f7a8d92be485b99.tar.xz
infinity-for-reddit-05e9b8b36e1625a23e96f0205f7a8d92be485b99.tar.zst
infinity-for-reddit-05e9b8b36e1625a23e96f0205f7a8d92be485b99.zip
Fix a bug when setting up notification work manager in MainActivity.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
index 5b4e20e2..4c791b2e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
@@ -321,11 +321,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
mMessageFullname = savedInstanceState.getString(MESSAGE_FULLNAME_STATE);
mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE);
inboxCount = savedInstanceState.getInt(INBOX_COUNT_STATE);
- initializeNotificationAndBindView(true);
+ initializeNotificationAndBindView();
} else {
mMessageFullname = getIntent().getStringExtra(EXTRA_MESSSAGE_FULLNAME);
mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME);
- initializeNotificationAndBindView(false);
+ initializeNotificationAndBindView();
}
}
@@ -355,7 +355,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
applyFABTheme(fab);
}
- private void initializeNotificationAndBindView(boolean doNotInitializeNotificationIfNoNewAccount) {
+ private void initializeNotificationAndBindView() {
boolean enableNotification = mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY, true);
long notificationInterval = Long.parseLong(mSharedPreferences.getString(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY, "1"));
TimeUnit timeUnit = (notificationInterval == 15 || notificationInterval == 30) ? TimeUnit.MINUTES : TimeUnit.HOURS;
@@ -385,9 +385,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
bindView();
}
} else {
- if (doNotInitializeNotificationIfNoNewAccount) {
- setNotification(workManager, notificationInterval, timeUnit, enableNotification);
- }
+ setNotification(workManager, notificationInterval, timeUnit, enableNotification);
bindView();
}