more cleanup

This commit is contained in:
Daniel Gultsch 2018-02-19 15:00:42 +01:00
parent bf6b54a7aa
commit 235275ba91
4 changed files with 10 additions and 54 deletions

View file

@ -1409,26 +1409,18 @@ public class ConversationActivity extends XmppActivity
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.battery_optimizations_enabled); builder.setTitle(R.string.battery_optimizations_enabled);
builder.setMessage(R.string.battery_optimizations_enabled_dialog); builder.setMessage(R.string.battery_optimizations_enabled_dialog);
builder.setPositiveButton(R.string.next, new OnClickListener() { builder.setPositiveButton(R.string.next, (dialog, which) -> {
@Override Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
public void onClick(DialogInterface dialog, int which) { Uri uri = Uri.parse("package:" + getPackageName());
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); intent.setData(uri);
Uri uri = Uri.parse("package:" + getPackageName()); try {
intent.setData(uri); startActivityForResult(intent, REQUEST_BATTERY_OP);
try { } catch (ActivityNotFoundException e) {
startActivityForResult(intent, REQUEST_BATTERY_OP); Toast.makeText(ConversationActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show();
} 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) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
builder.setOnDismissListener(new DialogInterface.OnDismissListener() { builder.setOnDismissListener(dialog -> setNeverAskForBatteryOptimizationsAgain());
@Override
public void onDismiss(DialogInterface dialog) {
setNeverAskForBatteryOptimizationsAgain();
}
});
} }
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(false); dialog.setCanceledOnTouchOutside(false);

View file

@ -538,8 +538,7 @@ public abstract class XmppActivity extends AppCompatActivity {
} }
protected void inviteToConversation(Conversation conversation) { protected void inviteToConversation(Conversation conversation) {
Intent intent = new Intent(getApplicationContext(), Intent intent = new Intent(this, ChooseContactActivity.class);
ChooseContactActivity.class);
List<String> contacts = new ArrayList<>(); List<String> contacts = new ArrayList<>();
if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getMode() == Conversation.MODE_MULTI) {
for (MucOptions.User user : conversation.getMucOptions().getUsers(false)) { for (MucOptions.User user : conversation.getMucOptions().getUsers(false)) {

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/scan_fingerprint"
android:title="@string/scan_qr_code"/>
<item
android:id="@+id/ask_question"
android:title="@string/ask_question"/>
<item
android:id="@+id/manual_verification"
android:title="@string/manually_verify" />
</menu>

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_show_qr_code"
android:title="@string/show_qr_code"
app:showAsAction="never" />
<item
android:id="@+id/action_accounts"
android:orderInCategory="90"
app:showAsAction="never"
android:title="@string/action_accounts" />
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
app:showAsAction="never"
android:title="@string/action_settings" />
</menu>