mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Fix a bug when setting up notification work manager in MainActivity.
This commit is contained in:
parent
3283541c9a
commit
05e9b8b36e
@ -321,11 +321,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
mMessageFullname = savedInstanceState.getString(MESSAGE_FULLNAME_STATE);
|
mMessageFullname = savedInstanceState.getString(MESSAGE_FULLNAME_STATE);
|
||||||
mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE);
|
mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE);
|
||||||
inboxCount = savedInstanceState.getInt(INBOX_COUNT_STATE);
|
inboxCount = savedInstanceState.getInt(INBOX_COUNT_STATE);
|
||||||
initializeNotificationAndBindView(true);
|
initializeNotificationAndBindView();
|
||||||
} else {
|
} else {
|
||||||
mMessageFullname = getIntent().getStringExtra(EXTRA_MESSSAGE_FULLNAME);
|
mMessageFullname = getIntent().getStringExtra(EXTRA_MESSSAGE_FULLNAME);
|
||||||
mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME);
|
mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME);
|
||||||
initializeNotificationAndBindView(false);
|
initializeNotificationAndBindView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
applyFABTheme(fab);
|
applyFABTheme(fab);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeNotificationAndBindView(boolean doNotInitializeNotificationIfNoNewAccount) {
|
private void initializeNotificationAndBindView() {
|
||||||
boolean enableNotification = mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY, true);
|
boolean enableNotification = mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY, true);
|
||||||
long notificationInterval = Long.parseLong(mSharedPreferences.getString(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY, "1"));
|
long notificationInterval = Long.parseLong(mSharedPreferences.getString(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY, "1"));
|
||||||
TimeUnit timeUnit = (notificationInterval == 15 || notificationInterval == 30) ? TimeUnit.MINUTES : TimeUnit.HOURS;
|
TimeUnit timeUnit = (notificationInterval == 15 || notificationInterval == 30) ? TimeUnit.MINUTES : TimeUnit.HOURS;
|
||||||
@ -385,9 +385,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
bindView();
|
bindView();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (doNotInitializeNotificationIfNoNewAccount) {
|
setNotification(workManager, notificationInterval, timeUnit, enableNotification);
|
||||||
setNotification(workManager, notificationInterval, timeUnit, enableNotification);
|
|
||||||
}
|
|
||||||
|
|
||||||
bindView();
|
bindView();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user