recreate activity after theme has changed. fixed #764

This commit is contained in:
iNPUTmice 2014-12-09 20:22:21 +01:00
parent ae3bd9c9e9
commit 05d1f46c15
2 changed files with 20 additions and 3 deletions

View file

@ -675,6 +675,15 @@ public class ConversationActivity extends XmppActivity implements
} }
} }
@Override
public void onResume() {
super.onResume();
int theme = findTheme();
if (this.mTheme != theme) {
recreate();
}
}
@Override @Override
public void onSaveInstanceState(final Bundle savedInstanceState) { public void onSaveInstanceState(final Bundle savedInstanceState) {
Conversation conversation = getSelectedConversation(); Conversation conversation = getSelectedConversation();

View file

@ -94,6 +94,7 @@ public abstract class XmppActivity extends Activity {
protected boolean mUseSubject = true; protected boolean mUseSubject = true;
private DisplayMetrics metrics; private DisplayMetrics metrics;
protected int mTheme;
protected interface OnValueEdited { protected interface OnValueEdited {
public void onValueEdited(String value); public void onValueEdited(String value);
@ -292,9 +293,8 @@ public abstract class XmppActivity extends Activity {
mPrimaryColor = getResources().getColor(R.color.primary); mPrimaryColor = getResources().getColor(R.color.primary);
mSecondaryBackgroundColor = getResources().getColor( mSecondaryBackgroundColor = getResources().getColor(
R.color.secondarybackground); R.color.secondarybackground);
if (getPreferences().getBoolean("use_larger_font", false)) { this.mTheme = findTheme();
setTheme(R.style.ConversationsTheme_LargerText); setTheme(this.mTheme);
}
mUseSubject = getPreferences().getBoolean("use_subject", true); mUseSubject = getPreferences().getBoolean("use_subject", true);
} }
@ -721,6 +721,14 @@ public abstract class XmppActivity extends Activity {
} }
} }
protected int findTheme() {
if (getPreferences().getBoolean("use_larger_font", false)) {
return R.style.ConversationsTheme_LargerText;
} else {
return R.style.ConversationsTheme;
}
}
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();