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);
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);

View file

@ -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<String> contacts = new ArrayList<>();
if (conversation.getMode() == Conversation.MODE_MULTI) {
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>