mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-27 19:22:15 -05:00
recreate settingsactivity when theme changed
This commit is contained in:
parent
10025123e9
commit
00bb527333
@ -250,7 +250,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);
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,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;
|
||||
@ -371,6 +373,11 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -90,9 +90,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;
|
||||
@ -289,6 +289,8 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||
} else {
|
||||
askForContactsPermissions();
|
||||
}
|
||||
mConferenceAdapter.refreshSettings();
|
||||
mContactsAdapter.refreshSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1038,7 +1038,7 @@ public abstract class XmppActivity extends Activity {
|
||||
}
|
||||
|
||||
protected int findTheme() {
|
||||
Boolean dark = getPreferences().getString("theme", "light").equals("dark");
|
||||
Boolean dark = getPreferences().getString(SettingsActivity.THEME, "light").equals("dark");
|
||||
Boolean larger = getPreferences().getBoolean("use_larger_font", false);
|
||||
|
||||
if(dark) {
|
||||
|
@ -23,6 +23,7 @@ import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.entities.ListItem;
|
||||
import eu.siacs.conversations.ui.SettingsActivity;
|
||||
import eu.siacs.conversations.ui.XmppActivity;
|
||||
import eu.siacs.conversations.utils.UIHelper;
|
||||
|
||||
@ -45,8 +46,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
|
||||
|
Loading…
Reference in New Issue
Block a user