ask to be excluded from battery optimization

This commit is contained in:
Daniel Gultsch 2016-01-11 11:17:45 +01:00
parent 95db6db935
commit c296d6f446
7 changed files with 362 additions and 243 deletions

View file

@ -14,6 +14,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.NFC"/> <uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-permission <uses-permission
android:name="android.permission.READ_PHONE_STATE" android:name="android.permission.READ_PHONE_STATE"

View file

@ -16,6 +16,7 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.Settings;
import android.support.v4.widget.SlidingPaneLayout; import android.support.v4.widget.SlidingPaneLayout;
import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener; import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener;
import android.util.Log; import android.util.Log;
@ -36,6 +37,8 @@ import android.widget.Toast;
import net.java.otr4j.session.SessionStatus; import net.java.otr4j.session.SessionStatus;
import org.openintents.openpgp.util.OpenPgpApi;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -61,7 +64,6 @@ import eu.siacs.conversations.utils.ExceptionHelper;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.jid.InvalidJidException; import eu.siacs.conversations.xmpp.jid.InvalidJidException;
import eu.siacs.conversations.xmpp.jid.Jid; import eu.siacs.conversations.xmpp.jid.Jid;
import org.openintents.openpgp.util.OpenPgpApi;
public class ConversationActivity extends XmppActivity public class ConversationActivity extends XmppActivity
implements OnAccountUpdate, OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, XmppConnectionService.OnShowErrorToast { implements OnAccountUpdate, OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, XmppConnectionService.OnShowErrorToast {
@ -969,7 +971,8 @@ public class ConversationActivity extends XmppActivity
return true; return true;
} else if (modifier && key == downKey) { } else if (modifier && key == downKey) {
if (isConversationsOverviewHideable() && !isConversationsOverviewVisable()) { if (isConversationsOverviewHideable() && !isConversationsOverviewVisable()) {
showConversationsOverview();; showConversationsOverview();
;
} }
return selectDownConversation(); return selectDownConversation();
} else if (modifier && key == upKey) { } else if (modifier && key == upKey) {
@ -1196,7 +1199,9 @@ public class ConversationActivity extends XmppActivity
} }
forbidProcessingPendings = false; forbidProcessingPendings = false;
ExceptionHelper.checkForCrash(this, this.xmppConnectionService); if (!ExceptionHelper.checkForCrash(this, this.xmppConnectionService)) {
openBatteryOptimizationDialogIfNeeded();
}
setIntent(new Intent()); setIntent(new Intent());
} }
@ -1272,8 +1277,7 @@ public class ConversationActivity extends XmppActivity
} }
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
final Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_DECRYPT_PGP) { if (requestCode == REQUEST_DECRYPT_PGP) {
@ -1344,6 +1348,39 @@ public class ConversationActivity extends XmppActivity
if (requestCode == ConversationActivity.REQUEST_DECRYPT_PGP) { if (requestCode == ConversationActivity.REQUEST_DECRYPT_PGP) {
mConversationFragment.onActivityResult(requestCode, resultCode, data); mConversationFragment.onActivityResult(requestCode, resultCode, data);
} }
if (requestCode == REQUEST_BATTERY_OP) {
setNeverAskForBatteryOptimizationsAgain();
}
}
}
private void setNeverAskForBatteryOptimizationsAgain() {
getPreferences().edit().putBoolean("show_battery_optimization", false).commit();
}
private void openBatteryOptimizationDialogIfNeeded() {
if (showBatteryOptimizationWarning() && getPreferences().getBoolean("show_battery_optimization", true)) {
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);
startActivityForResult(intent, REQUEST_BATTERY_OP);
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
setNeverAskForBatteryOptimizationsAgain();
}
});
}
builder.create().show();
} }
} }

View file

@ -5,9 +5,10 @@ import android.app.AlertDialog.Builder;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings;
import android.security.KeyChain; import android.security.KeyChain;
import android.security.KeyChainAliasCallback; import android.security.KeyChainAliasCallback;
import android.text.Editable; import android.text.Editable;
@ -52,16 +53,17 @@ import eu.siacs.conversations.xmpp.pep.Avatar;
public class EditAccountActivity extends XmppActivity implements OnAccountUpdate, public class EditAccountActivity extends XmppActivity implements OnAccountUpdate,
OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast { OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast {
private LinearLayout mMainLayout;
private AutoCompleteTextView mAccountJid; private AutoCompleteTextView mAccountJid;
private EditText mPassword; private EditText mPassword;
private EditText mPasswordConfirm; private EditText mPasswordConfirm;
private CheckBox mRegisterNew; private CheckBox mRegisterNew;
private Button mCancelButton; private Button mCancelButton;
private Button mSaveButton; private Button mSaveButton;
private Button mDisableBatterOptimizations;
private TableLayout mMoreTable; private TableLayout mMoreTable;
private LinearLayout mStats; private LinearLayout mStats;
private RelativeLayout mBatteryOptimizations;
private TextView mServerInfoSm; private TextView mServerInfoSm;
private TextView mServerInfoRosterVersion; private TextView mServerInfoRosterVersion;
private TextView mServerInfoCarbons; private TextView mServerInfoCarbons;
@ -311,6 +313,14 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
}); });
} }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_BATTERY_OP) {
updateAccountInformation(mAccount == null);
}
}
protected void updateSaveButton() { protected void updateSaveButton() {
if (accountInfoEdited() && !mInitMode) { if (accountInfoEdited() && !mInitMode) {
this.mSaveButton.setText(R.string.save); this.mSaveButton.setText(R.string.save);
@ -372,7 +382,6 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_account); setContentView(R.layout.activity_edit_account);
this.mMainLayout = (LinearLayout) findViewById(R.id.account_main_layout);
this.mAccountJid = (AutoCompleteTextView) findViewById(R.id.account_jid); this.mAccountJid = (AutoCompleteTextView) findViewById(R.id.account_jid);
this.mAccountJid.addTextChangedListener(this.mTextWatcher); this.mAccountJid.addTextChangedListener(this.mTextWatcher);
this.mAccountJidLabel = (TextView) findViewById(R.id.account_jid_label); this.mAccountJidLabel = (TextView) findViewById(R.id.account_jid_label);
@ -387,6 +396,17 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
this.mAvatar.setOnClickListener(this.mAvatarClickListener); this.mAvatar.setOnClickListener(this.mAvatarClickListener);
this.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new); this.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new);
this.mStats = (LinearLayout) findViewById(R.id.stats); this.mStats = (LinearLayout) findViewById(R.id.stats);
this.mBatteryOptimizations = (RelativeLayout) findViewById(R.id.battery_optimization);
this.mDisableBatterOptimizations = (Button) findViewById(R.id.batt_op_disable);
this.mDisableBatterOptimizations.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
Uri uri = Uri.parse("package:"+getPackageName());
intent.setData(uri);
startActivityForResult(intent,REQUEST_BATTERY_OP);
}
});
this.mSessionEst = (TextView) findViewById(R.id.session_est); this.mSessionEst = (TextView) findViewById(R.id.session_est);
this.mServerInfoRosterVersion = (TextView) findViewById(R.id.server_info_roster_version); this.mServerInfoRosterVersion = (TextView) findViewById(R.id.server_info_roster_version);
this.mServerInfoCarbons = (TextView) findViewById(R.id.server_info_carbons); this.mServerInfoCarbons = (TextView) findViewById(R.id.server_info_carbons);
@ -595,6 +615,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
} }
if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) { if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) {
this.mStats.setVisibility(View.VISIBLE); this.mStats.setVisibility(View.VISIBLE);
this.mBatteryOptimizations.setVisibility(showBatteryOptimizationWarning() ? View.VISIBLE : View.GONE);
this.mSessionEst.setText(UIHelper.readableTimeDifferenceFull(this, this.mAccount.getXmppConnection() this.mSessionEst.setText(UIHelper.readableTimeDifferenceFull(this, this.mAccount.getXmppConnection()
.getLastSessionEstablished())); .getLastSessionEstablished()));
Features features = this.mAccount.getXmppConnection().getFeatures(); Features features = this.mAccount.getXmppConnection().getFeatures();

View file

@ -35,6 +35,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.InputType; import android.text.InputType;
@ -91,6 +92,7 @@ public abstract class XmppActivity extends Activity {
protected static final int REQUEST_ANNOUNCE_PGP = 0x0101; protected static final int REQUEST_ANNOUNCE_PGP = 0x0101;
protected static final int REQUEST_INVITE_TO_CONVERSATION = 0x0102; protected static final int REQUEST_INVITE_TO_CONVERSATION = 0x0102;
protected static final int REQUEST_CHOOSE_PGP_ID = 0x0103; protected static final int REQUEST_CHOOSE_PGP_ID = 0x0103;
protected static final int REQUEST_BATTERY_OP = 0x13849ff;
public XmppConnectionService xmppConnectionService; public XmppConnectionService xmppConnectionService;
public boolean xmppConnectionServiceBound = false; public boolean xmppConnectionServiceBound = false;
@ -372,6 +374,15 @@ public abstract class XmppActivity extends Activity {
} }
} }
protected boolean showBatteryOptimizationWarning() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
return !pm.isIgnoringBatteryOptimizations(getPackageName());
} else {
return false;
}
}
protected boolean usingEnterKey() { protected boolean usingEnterKey() {
return getPreferences().getBoolean("display_enter_key", false); return getPreferences().getBoolean("display_enter_key", false);
} }

View file

@ -24,6 +24,7 @@ import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.ConversationActivity;
import eu.siacs.conversations.xmpp.jid.InvalidJidException; import eu.siacs.conversations.xmpp.jid.InvalidJidException;
import eu.siacs.conversations.xmpp.jid.Jid; import eu.siacs.conversations.xmpp.jid.Jid;
@ -35,14 +36,13 @@ public class ExceptionHelper {
} }
} }
public static void checkForCrash(Context context, public static boolean checkForCrash(ConversationActivity activity, final XmppConnectionService service) {
final XmppConnectionService service) {
try { try {
final SharedPreferences preferences = PreferenceManager final SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(context); .getDefaultSharedPreferences(activity);
boolean neverSend = preferences.getBoolean("never_send", false); boolean neverSend = preferences.getBoolean("never_send", false);
if (neverSend) { if (neverSend) {
return; return false;
} }
List<Account> accounts = service.getAccounts(); List<Account> accounts = service.getAccounts();
Account account = null; Account account = null;
@ -53,24 +53,25 @@ public class ExceptionHelper {
} }
} }
if (account == null) { if (account == null) {
return; return false;
} }
final Account finalAccount = account; final Account finalAccount = account;
FileInputStream file = context.openFileInput("stacktrace.txt"); FileInputStream file = activity.openFileInput("stacktrace.txt");
InputStreamReader inputStreamReader = new InputStreamReader(file); InputStreamReader inputStreamReader = new InputStreamReader(file);
BufferedReader stacktrace = new BufferedReader(inputStreamReader); BufferedReader stacktrace = new BufferedReader(inputStreamReader);
final StringBuilder report = new StringBuilder(); final StringBuilder report = new StringBuilder();
PackageManager pm = context.getPackageManager(); PackageManager pm = activity.getPackageManager();
PackageInfo packageInfo = null; PackageInfo packageInfo = null;
try { try {
packageInfo = pm.getPackageInfo(context.getPackageName(), 0); packageInfo = pm.getPackageInfo(activity.getPackageName(), 0);
report.append("Version: " + packageInfo.versionName + '\n'); report.append("Version: " + packageInfo.versionName + '\n');
report.append("Last Update: " report.append("Last Update: "
+ DateUtils.formatDateTime(context, + DateUtils.formatDateTime(activity,
packageInfo.lastUpdateTime, packageInfo.lastUpdateTime,
DateUtils.FORMAT_SHOW_TIME DateUtils.FORMAT_SHOW_TIME
| DateUtils.FORMAT_SHOW_DATE) + '\n'); | DateUtils.FORMAT_SHOW_DATE) + '\n');
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
return false;
} }
String line; String line;
while ((line = stacktrace.readLine()) != null) { while ((line = stacktrace.readLine()) != null) {
@ -78,11 +79,11 @@ public class ExceptionHelper {
report.append('\n'); report.append('\n');
} }
file.close(); file.close();
context.deleteFile("stacktrace.txt"); activity.deleteFile("stacktrace.txt");
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(context.getString(R.string.crash_report_title)); builder.setTitle(activity.getString(R.string.crash_report_title));
builder.setMessage(context.getText(R.string.crash_report_message)); builder.setMessage(activity.getText(R.string.crash_report_message));
builder.setPositiveButton(context.getText(R.string.send_now), builder.setPositiveButton(activity.getText(R.string.send_now),
new OnClickListener() { new OnClickListener() {
@Override @Override
@ -102,7 +103,7 @@ public class ExceptionHelper {
service.sendMessage(message); service.sendMessage(message);
} }
}); });
builder.setNegativeButton(context.getText(R.string.send_never), builder.setNegativeButton(activity.getText(R.string.send_never),
new OnClickListener() { new OnClickListener() {
@Override @Override
@ -112,8 +113,9 @@ public class ExceptionHelper {
} }
}); });
builder.create().show(); builder.create().show();
return true;
} catch (final IOException ignored) { } catch (final IOException ignored) {
} return false;
}
} }
} }

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/grey200"> android:background="@color/grey200">
@ -22,10 +22,10 @@
android:id="@+id/editor" android:id="@+id/editor"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:background="@drawable/infocard_border" android:background="@drawable/infocard_border"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/infocard_padding"> android:padding="@dimen/infocard_padding">
@ -40,8 +40,8 @@
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_toRightOf="@+id/avater"
android:layout_toRightOf="@+id/avater"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/account_jid_label" android:id="@+id/account_jid_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -80,38 +80,38 @@
<LinearLayout <LinearLayout
android:id="@+id/name_port" android:id="@+id/name_port"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:weightSum="1"> android:weightSum="1">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.8"> android:layout_weight="0.8"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/textView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/account_settings_hostname" android:text="@string/account_settings_hostname"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" android:textSize="?attr/TextSizeBody"/>
android:id="@+id/textView"/>
<EditText <EditText
android:id="@+id/hostname"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/hostname_or_onion"
android:inputType="textNoSuggestions"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textColorHint="@color/black54" android:textColorHint="@color/black54"
android:textSize="?attr/TextSizeBody" android:textSize="?attr/TextSizeBody"/>
android:id="@+id/hostname"
android:inputType="textNoSuggestions"
android:hint="@string/hostname_or_onion"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.2" android:layout_weight="0.2"
android:orientation="vertical"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -120,14 +120,14 @@
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody"/> android:textSize="?attr/TextSizeBody"/>
<EditText <EditText
android:id="@+id/port"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:inputType="number" android:inputType="number"
android:maxLength="5" android:maxLength="5"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textColorHint="@color/black54" android:textColorHint="@color/black54"
android:textSize="?attr/TextSizeBody" android:textSize="?attr/TextSizeBody"/>
android:id="@+id/port"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<CheckBox <CheckBox
@ -155,21 +155,64 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:hint="@string/confirm_password" android:hint="@string/confirm_password"
android:inputType="textPassword" android:inputType="textPassword"
android:visibility="gone"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textColorHint="@color/black54" android:textColorHint="@color/black54"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"
android:visibility="gone"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/battery_optimization"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:background="@drawable/infocard_border"
android:orientation="vertical"
android:padding="@dimen/infocard_padding"
android:visibility="gone">
<TextView
android:id="@+id/batt_op_headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/battery_optimizations_enabled"
android:textColor="@color/black87"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold"/>
<TextView
android:id="@+id/batt_op_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/batt_op_headline"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:text="@string/battery_optimizations_enabled_explained"
android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody"/>
<Button
android:id="@+id/batt_op_disable"
style="?android:attr/borderlessButtonStyle"
android:layout_marginRight="-8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" android:layout_below="@+id/batt_op_body"
android:text="@string/disable" android:textColor="@color/accent"/>
</RelativeLayout>
<LinearLayout <LinearLayout
android:id="@+id/stats" android:id="@+id/stats"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:background="@drawable/infocard_border" android:background="@drawable/infocard_border"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/infocard_padding" android:padding="@dimen/infocard_padding"
@ -379,9 +422,9 @@
</TableLayout> </TableLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/otr_fingerprint_box"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/otr_fingerprint_box"
android:layout_marginTop="32dp"> android:layout_marginTop="32dp">
<LinearLayout <LinearLayout
@ -395,17 +438,17 @@
android:id="@+id/otr_fingerprint" android:id="@+id/otr_fingerprint"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="monospace"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" android:textSize="?attr/TextSizeBody"
android:typeface="monospace" android:typeface="monospace"/>
android:fontFamily="monospace"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/otr_fingerprint"
android:textColor="@color/black54" android:textColor="@color/black54"
android:textSize="?attr/TextSizeInfo" android:textSize="?attr/TextSizeInfo"/>
android:text="@string/otr_fingerprint"/>
</LinearLayout> </LinearLayout>
<ImageButton <ImageButton
@ -415,15 +458,15 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:background="?android:selectableItemBackground" android:background="?android:selectableItemBackground"
android:contentDescription="@string/copy_otr_clipboard_description"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:src="?attr/icon_copy" android:src="?attr/icon_copy"
android:visibility="visible" android:visibility="visible"/>
android:contentDescription="@string/copy_otr_clipboard_description"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/axolotl_fingerprint_box"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/axolotl_fingerprint_box"
android:layout_marginTop="32dp"> android:layout_marginTop="32dp">
<LinearLayout <LinearLayout
@ -437,25 +480,25 @@
android:id="@+id/axolotl_fingerprint" android:id="@+id/axolotl_fingerprint"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="monospace"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" android:textSize="?attr/TextSizeBody"
android:typeface="monospace" android:typeface="monospace"/>
android:fontFamily="monospace"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/this_device_omemo_fingerprint"
android:textColor="@color/black54" android:textColor="@color/black54"
android:textSize="?attr/TextSizeInfo" android:textSize="?attr/TextSizeInfo"/>
android:text="@string/this_device_omemo_fingerprint"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/axolotl_actions"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/axolotl_actions"
android:layout_centerVertical="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:orientation="vertical"> android:orientation="vertical">
<ImageButton <ImageButton
@ -463,19 +506,19 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:selectableItemBackground" android:background="?android:selectableItemBackground"
android:contentDescription="@string/copy_omemo_clipboard_description"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:src="?attr/icon_copy" android:src="?attr/icon_copy"
android:visibility="visible" android:visibility="visible"/>
android:contentDescription="@string/copy_omemo_clipboard_description"/>
<ImageButton <ImageButton
android:id="@+id/action_regenerate_axolotl_key" android:id="@+id/action_regenerate_axolotl_key"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:selectableItemBackground" android:background="?android:selectableItemBackground"
android:contentDescription="@string/regenerate_omemo_key"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:src="?attr/icon_refresh" android:src="?attr/icon_refresh"
android:visibility="gone" android:visibility="gone"/>
android:contentDescription="@string/regenerate_omemo_key"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
@ -484,10 +527,10 @@
android:id="@+id/other_device_keys_card" android:id="@+id/other_device_keys_card"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:background="@drawable/infocard_border" android:background="@drawable/infocard_border"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/infocard_padding" android:padding="@dimen/infocard_padding"
@ -497,10 +540,10 @@
android:id="@+id/other_device_keys_title" android:id="@+id/other_device_keys_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/other_devices"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeHeadline" android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold" android:textStyle="bold"/>
android:text="@string/other_devices"/>
<LinearLayout <LinearLayout
android:id="@+id/other_device_keys" android:id="@+id/other_device_keys"
@ -519,10 +562,10 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" > android:layout_alignParentRight="true"
android:layout_alignParentStart="true">
<Button <Button
android:id="@+id/cancel_button" android:id="@+id/cancel_button"

View file

@ -575,4 +575,8 @@
<string name="pref_picture_compression_summary">Resize and compressed pictures</string> <string name="pref_picture_compression_summary">Resize and compressed pictures</string>
<string name="always">Always</string> <string name="always">Always</string>
<string name="automatically">Automatically</string> <string name="automatically">Automatically</string>
<string name="battery_optimizations_enabled">Battery optimizations enabled</string>
<string name="battery_optimizations_enabled_explained">Your phone is doing some heavy battery optimizations on Conversations that might lead to delayed notifications or even message loss. It is recommended to disable those.</string>
<string name="battery_optimizations_enabled_dialog">Your phone is doing some heavy battery optimizations on Conversations that might lead to delayed notifications or even message loss.\n\nYou will now be asked to disable those.</string>
<string name="disable">Disable</string>
</resources> </resources>