mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-07 16:18:49 +00:00
Use SharedPreferences.apply() rather than commit(), as the latter blocks on I/O.
This commit is contained in:
parent
c0eabf93b1
commit
cd346b6005
2 changed files with 4 additions and 4 deletions
|
@ -122,7 +122,7 @@ public abstract class OeffiMainActivity extends OeffiActivity {
|
||||||
if (prefsGetNetwork() == null) {
|
if (prefsGetNetwork() == null) {
|
||||||
NetworkPickerActivity.start(this);
|
NetworkPickerActivity.start(this);
|
||||||
|
|
||||||
prefs.edit().putLong(Constants.PREFS_KEY_LAST_INFO_AT, now).commit();
|
prefs.edit().putLong(Constants.PREFS_KEY_LAST_INFO_AT, now).apply();
|
||||||
|
|
||||||
downloadAndProcessMessages(prefsGetNetwork());
|
downloadAndProcessMessages(prefsGetNetwork());
|
||||||
} else if (versionCode != lastVersionCode) {
|
} else if (versionCode != lastVersionCode) {
|
||||||
|
@ -576,9 +576,9 @@ public abstract class OeffiMainActivity extends OeffiActivity {
|
||||||
showDialog(DIALOG_MESSAGE, message);
|
showDialog(DIALOG_MESSAGE, message);
|
||||||
|
|
||||||
final long now = System.currentTimeMillis();
|
final long now = System.currentTimeMillis();
|
||||||
messagesPrefs.edit().putLong(id, now).commit();
|
messagesPrefs.edit().putLong(id, now).apply();
|
||||||
if ("info".equals(action))
|
if ("info".equals(action))
|
||||||
prefs.edit().putLong(Constants.PREFS_KEY_LAST_INFO_AT, now).commit();
|
prefs.edit().putLong(Constants.PREFS_KEY_LAST_INFO_AT, now).apply();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
log.info("Got '{}: {}' when fetching message from: '{}'", response.code(),
|
log.info("Got '{}: {}' when fetching message from: '{}'", response.code(),
|
||||||
|
|
|
@ -1235,7 +1235,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
|
||||||
final StringBuilder p = new StringBuilder();
|
final StringBuilder p = new StringBuilder();
|
||||||
for (final Product product : products)
|
for (final Product product : products)
|
||||||
p.append(product.code);
|
p.append(product.code);
|
||||||
prefs.edit().putString(Constants.PREFS_KEY_PRODUCT_FILTER, p.toString()).commit();
|
prefs.edit().putString(Constants.PREFS_KEY_PRODUCT_FILTER, p.toString()).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final List<Station> getStations() {
|
public final List<Station> getStations() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue