diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-06-11 19:14:55 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-06-11 19:14:55 +0200 |
commit | d494a6d3908c04d9be140a79af91619b87ce3add (patch) | |
tree | 83f1f8433a60a5628615da46bb5d2b42ed1d7697 | |
parent | d4cd37f8ecb1229aca0cd940a4bf9d7d6d6677e3 (diff) |
recreate settingsactivity when theme changed
4 files changed, 17 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index a38ae7e59..81967bfa7 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -322,7 +322,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp recreate(); } else { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); - this.showDynamicTags = preferences.getBoolean("show_dynamic_tags", false); + this.showDynamicTags = preferences.getBoolean(SettingsActivity.SHOW_DYNAMIC_TAGS, false); this.showLastSeen = preferences.getBoolean("last_activity", false); } } diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index 13cb9bb99..feeec7c1c 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -43,6 +43,8 @@ public class SettingsActivity extends XmppActivity implements public static final String BLIND_TRUST_BEFORE_VERIFICATION = "btbv"; public static final String AUTOMATIC_MESSAGE_DELETION = "automatic_message_deletion"; public static final String BROADCAST_LAST_ACTIVITY = "last_activity"; + public static final String THEME = "theme"; + public static final String SHOW_DYNAMIC_TAGS = "show_dynamic_tags"; public static final int REQUEST_WRITE_LOGS = 0xbf8701; private SettingsFragment mSettingsFragment; @@ -276,8 +278,12 @@ public class SettingsActivity extends XmppActivity implements reconnectAccounts(); } else if (name.equals(AUTOMATIC_MESSAGE_DELETION)) { xmppConnectionService.expireOldMessages(true); + } else if (name.equals(THEME)) { + final int theme = findTheme(); + if (this.mTheme != theme) { + recreate(); + } } - } @Override diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index 73400dde3..784e511ef 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -92,9 +92,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU private ViewPager mViewPager; private ListPagerAdapter mListPagerAdapter; private List<ListItem> contacts = new ArrayList<>(); - private ArrayAdapter<ListItem> mContactsAdapter; + private ListItemAdapter mContactsAdapter; private List<ListItem> conferences = new ArrayList<>(); - private ArrayAdapter<ListItem> mConferenceAdapter; + private ListItemAdapter mConferenceAdapter; private List<String> mActivatedAccounts = new ArrayList<>(); private List<String> mKnownHosts; private List<String> mKnownConferenceHosts; @@ -304,6 +304,8 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } else { askForContactsPermissions(); } + mConferenceAdapter.refreshSettings(); + mContactsAdapter.refreshSettings(); } @Override diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java index 00c612e20..ce0649c56 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java @@ -24,6 +24,7 @@ import java.util.concurrent.RejectedExecutionException; import de.pixart.messenger.R; import de.pixart.messenger.entities.ListItem; +import de.pixart.messenger.ui.SettingsActivity; import de.pixart.messenger.ui.XmppActivity; import de.pixart.messenger.utils.UIHelper; @@ -50,8 +51,11 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { public ListItemAdapter(XmppActivity activity, List<ListItem> objects) { super(activity, 0, objects); this.activity = activity; + } + + public void refreshSettings() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); - this.showDynamicTags = preferences.getBoolean("show_dynamic_tags", false); + this.showDynamicTags = preferences.getBoolean(SettingsActivity.SHOW_DYNAMIC_TAGS, false); } @Override |