diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-04-06 22:41:21 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-04-06 22:41:21 +0200 |
commit | 18548e9ebb246071f0bc46ca3bb07a300176cf24 (patch) | |
tree | af1e572162c4966bf0a871f1c0790d32dfd05bc9 /src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java | |
parent | 1e1f7f419ecbe9db44acb84fd06c7b889d1af475 (diff) |
Implements FS#189: Move calls of getPreferences to ConversationsPlusPreferences
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java | 87 |
1 files changed, 43 insertions, 44 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java index 5942bac6..f068036b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java @@ -108,6 +108,7 @@ public class ConversationActivity extends XmppActivity private Message mPendingDownloadableMessage = null; private boolean conversationWasSelectedByKeyboard = false; + protected boolean mUsingEnterKey = false; private View mContentView; @@ -184,6 +185,7 @@ public class ConversationActivity extends XmppActivity mPendingImageUris.add(Uri.parse(pending)); } } + this.mUsingEnterKey = ConversationsPlusPreferences.displayEnterKey(); setContentView(R.layout.fragment_conversations_overview); @@ -331,12 +333,12 @@ public class ConversationActivity extends XmppActivity public void switchToConversation(Conversation conversation) { setSelectedConversation(conversation); runOnUiThread(new Runnable() { - @Override - public void run() { - ConversationActivity.this.mConversationFragment.reInit(getSelectedConversation()); - openConversation(); - } - }); + @Override + public void run() { + ConversationActivity.this.mConversationFragment.reInit(getSelectedConversation()); + openConversation(); + } + }); } private void updateActionBarTitle() { @@ -713,19 +715,19 @@ public class ConversationActivity extends XmppActivity builder.setView(dialogView); builder.setNegativeButton(getString(R.string.cancel), null); builder.setPositiveButton(getString(R.string.delete_messages), - new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - ConversationActivity.this.xmppConnectionService.clearConversationHistory(conversation); - if (endConversationCheckBox.isChecked()) { - endConversation(conversation); - } else { - updateConversationList(); - ConversationActivity.this.mConversationFragment.updateMessages(); - } - } - }); + new OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + ConversationActivity.this.xmppConnectionService.clearConversationHistory(conversation); + if (endConversationCheckBox.isChecked()) { + endConversation(conversation); + } else { + updateConversationList(); + ConversationActivity.this.mConversationFragment.updateMessages(); + } + } + }); builder.create().show(); } @@ -896,24 +898,24 @@ public class ConversationActivity extends XmppActivity builder.setTitle(R.string.disable_notifications); final int[] durations = getResources().getIntArray(R.array.mute_options_durations); builder.setItems(R.array.mute_options_descriptions, - new OnClickListener() { - - @Override - public void onClick(final DialogInterface dialog, final int which) { - final long till; - if (durations[which] == -1) { - till = Long.MAX_VALUE; - } else { - till = System.currentTimeMillis() + (durations[which] * 1000); - } - conversation.setMutedTill(till); - ConversationActivity.this.xmppConnectionService.databaseBackend - .updateConversation(conversation); - updateConversationList(); - ConversationActivity.this.mConversationFragment.updateMessages(); - invalidateOptionsMenu(); - } - }); + new OnClickListener() { + + @Override + public void onClick(final DialogInterface dialog, final int which) { + final long till; + if (durations[which] == -1) { + till = Long.MAX_VALUE; + } else { + till = System.currentTimeMillis() + (durations[which] * 1000); + } + conversation.setMutedTill(till); + ConversationActivity.this.xmppConnectionService.databaseBackend + .updateConversation(conversation); + updateConversationList(); + ConversationActivity.this.mConversationFragment.updateMessages(); + invalidateOptionsMenu(); + } + }); builder.create().show(); } @@ -1370,19 +1372,16 @@ public class ConversationActivity extends XmppActivity mConversationFragment.onActivityResult(requestCode, resultCode, data); } if (requestCode == REQUEST_BATTERY_OP) { - setNeverAskForBatteryOptimizationsAgain(); + // Never Ask For Battery Optimizations Again + ConversationsPlusPreferences.commitShowBatteryOptimization(false); } } } - private void setNeverAskForBatteryOptimizationsAgain() { - getPreferences().edit().putBoolean("show_battery_optimization", false).commit(); - } - private void openBatteryOptimizationDialogIfNeeded() { if (hasAccountWithoutPush() && isOptimizingBattery() - && getPreferences().getBoolean("show_battery_optimization", true)) { + && ConversationsPlusPreferences.showBatteryOptimization()) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.battery_optimizations_enabled); builder.setMessage(R.string.battery_optimizations_enabled_dialog); @@ -1399,7 +1398,7 @@ public class ConversationActivity extends XmppActivity builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { - setNeverAskForBatteryOptimizationsAgain(); + ConversationsPlusPreferences.commitShowBatteryOptimization(false); } }); } |