From 235275ba91aff2258c6a4f58840e25438f93b51e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 19 Feb 2018 15:00:42 +0100 Subject: [PATCH] more cleanup --- .../ui/ConversationActivity.java | 26 +++++++------------ .../siacs/conversations/ui/XmppActivity.java | 3 +-- src/main/res/menu/verification_choices.xml | 15 ----------- src/main/res/menu/verify_otr.xml | 20 -------------- 4 files changed, 10 insertions(+), 54 deletions(-) delete mode 100644 src/main/res/menu/verification_choices.xml delete mode 100644 src/main/res/menu/verify_otr.xml diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 174eac841..e1b6c6f5e 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1409,26 +1409,18 @@ public class ConversationActivity extends XmppActivity AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.battery_optimizations_enabled); builder.setMessage(R.string.battery_optimizations_enabled_dialog); - builder.setPositiveButton(R.string.next, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - Uri uri = Uri.parse("package:" + getPackageName()); - intent.setData(uri); - try { - startActivityForResult(intent, REQUEST_BATTERY_OP); - } catch (ActivityNotFoundException e) { - Toast.makeText(ConversationActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show(); - } + builder.setPositiveButton(R.string.next, (dialog, which) -> { + Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); + Uri uri = Uri.parse("package:" + getPackageName()); + intent.setData(uri); + try { + startActivityForResult(intent, REQUEST_BATTERY_OP); + } catch (ActivityNotFoundException e) { + Toast.makeText(ConversationActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show(); } }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - builder.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - setNeverAskForBatteryOptimizationsAgain(); - } - }); + builder.setOnDismissListener(dialog -> setNeverAskForBatteryOptimizationsAgain()); } AlertDialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 5b26576e6..67706a952 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -538,8 +538,7 @@ public abstract class XmppActivity extends AppCompatActivity { } protected void inviteToConversation(Conversation conversation) { - Intent intent = new Intent(getApplicationContext(), - ChooseContactActivity.class); + Intent intent = new Intent(this, ChooseContactActivity.class); List contacts = new ArrayList<>(); if (conversation.getMode() == Conversation.MODE_MULTI) { for (MucOptions.User user : conversation.getMucOptions().getUsers(false)) { diff --git a/src/main/res/menu/verification_choices.xml b/src/main/res/menu/verification_choices.xml deleted file mode 100644 index e833ba79d..000000000 --- a/src/main/res/menu/verification_choices.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/menu/verify_otr.xml b/src/main/res/menu/verify_otr.xml deleted file mode 100644 index 6517ae0b1..000000000 --- a/src/main/res/menu/verify_otr.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - \ No newline at end of file