diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-01-11 11:17:45 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-01-11 11:17:45 +0100 |
commit | c296d6f4466e2616432660bb01465f3746e1bb65 (patch) | |
tree | 3aa0accefa3a69662564c9d2119a77b185d1205c /src | |
parent | 95db6db935ff58ce2731ab535e3758a13dd5b68b (diff) |
ask to be excluded from battery optimization
Diffstat (limited to 'src')
-rw-r--r-- | src/main/AndroidManifest.xml | 1 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 123 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java | 27 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/XmppActivity.java | 11 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java | 56 | ||||
-rw-r--r-- | src/main/res/layout/activity_edit_account.xml | 381 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 4 |
7 files changed, 361 insertions, 242 deletions
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 2f93480e..dda0fbe9 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -14,6 +14,7 @@ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.NFC"/> + <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> <uses-permission android:name="android.permission.READ_PHONE_STATE" diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 020d3ee7..ca76eb0c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -16,6 +16,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; +import android.provider.Settings; import android.support.v4.widget.SlidingPaneLayout; import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener; import android.util.Log; @@ -36,6 +37,8 @@ import android.widget.Toast; import net.java.otr4j.session.SessionStatus; +import org.openintents.openpgp.util.OpenPgpApi; + import java.util.ArrayList; import java.util.Iterator; 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.jid.InvalidJidException; import eu.siacs.conversations.xmpp.jid.Jid; -import org.openintents.openpgp.util.OpenPgpApi; public class ConversationActivity extends XmppActivity implements OnAccountUpdate, OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, XmppConnectionService.OnShowErrorToast { @@ -200,7 +202,7 @@ public class ConversationActivity extends XmppActivity @Override public void onItemClick(AdapterView<?> arg0, View clickedView, - int position, long arg3) { + int position, long arg3) { if (getSelectedConversation() != conversationList.get(position)) { setSelectedConversation(conversationList.get(position)); ConversationActivity.this.mConversationFragment.reInit(getSelectedConversation()); @@ -288,7 +290,7 @@ public class ConversationActivity extends XmppActivity SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView; mSlidingPaneLayout.setParallaxDistance(150); mSlidingPaneLayout - .setShadowResource(R.drawable.es_slidingpane_shadow); + .setShadowResource(R.drawable.es_slidingpane_shadow); mSlidingPaneLayout.setSliderFadeColor(0); mSlidingPaneLayout.setPanelSlideListener(new PanelSlideListener() { @@ -299,7 +301,7 @@ public class ConversationActivity extends XmppActivity hideKeyboard(); if (xmppConnectionServiceBound) { xmppConnectionService.getNotificationService() - .setOpenConversation(null); + .setOpenConversation(null); } closeContextMenu(); } @@ -442,7 +444,7 @@ public class ConversationActivity extends XmppActivity case ATTACHMENT_CHOICE_CHOOSE_IMAGE: intent.setAction(Intent.ACTION_GET_CONTENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE,true); + intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); } intent.setType("image/*"); chooser = true; @@ -509,16 +511,16 @@ public class ConversationActivity extends XmppActivity } switch (attachmentChoice) { case ATTACHMENT_CHOICE_LOCATION: - getPreferences().edit().putString("recently_used_quick_action","location").apply(); + getPreferences().edit().putString("recently_used_quick_action", "location").apply(); break; case ATTACHMENT_CHOICE_RECORD_VOICE: - getPreferences().edit().putString("recently_used_quick_action","voice").apply(); + getPreferences().edit().putString("recently_used_quick_action", "voice").apply(); break; case ATTACHMENT_CHOICE_TAKE_PHOTO: - getPreferences().edit().putString("recently_used_quick_action","photo").apply(); + getPreferences().edit().putString("recently_used_quick_action", "photo").apply(); break; case ATTACHMENT_CHOICE_CHOOSE_IMAGE: - getPreferences().edit().putString("recently_used_quick_action","picture").apply(); + getPreferences().edit().putString("recently_used_quick_action", "picture").apply(); break; } final Conversation conversation = getSelectedConversation(); @@ -558,19 +560,19 @@ public class ConversationActivity extends XmppActivity selectPresenceToAttachFile(attachmentChoice, encryption); } else { final ConversationFragment fragment = (ConversationFragment) getFragmentManager() - .findFragmentByTag("conversation"); + .findFragmentByTag("conversation"); if (fragment != null) { fragment.showNoPGPKeyDialog(false, new OnClickListener() { @Override public void onClick(DialogInterface dialog, - int which) { + int which) { conversation - .setNextEncryption(Message.ENCRYPTION_NONE); + .setNextEncryption(Message.ENCRYPTION_NONE); xmppConnectionService.databaseBackend - .updateConversation(conversation); - selectPresenceToAttachFile(attachmentChoice,Message.ENCRYPTION_NONE); + .updateConversation(conversation); + selectPresenceToAttachFile(attachmentChoice, Message.ENCRYPTION_NONE); } }); } @@ -610,8 +612,8 @@ public class ConversationActivity extends XmppActivity attachFile(requestCode); } } else { - Toast.makeText(this,R.string.no_storage_permission,Toast.LENGTH_SHORT).show(); - } + Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); + } } public void startDownloadable(Message message) { @@ -622,14 +624,14 @@ public class ConversationActivity extends XmppActivity Transferable transferable = message.getTransferable(); if (transferable != null) { if (!transferable.start()) { - Toast.makeText(this, R.string.not_connected_try_again,Toast.LENGTH_SHORT).show(); + Toast.makeText(this, R.string.not_connected_try_again, Toast.LENGTH_SHORT).show(); } } else if (message.treatAsDownloadable() != Message.Decision.NEVER) { xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message, true); } } - @Override + @Override public boolean onOptionsItemSelected(final MenuItem item) { if (item.getItemId() == android.R.id.home) { showConversationsOverview(); @@ -700,9 +702,9 @@ public class ConversationActivity extends XmppActivity this.mConversationFragment.reInit(getSelectedConversation()); } else { setSelectedConversation(null); - if (mRedirected.compareAndSet(false,true)) { + if (mRedirected.compareAndSet(false, true)) { Intent intent = new Intent(this, StartConversationActivity.class); - intent.putExtra("init",true); + intent.putExtra("init", true); startActivity(intent); finish(); } @@ -717,7 +719,7 @@ public class ConversationActivity extends XmppActivity View dialogView = getLayoutInflater().inflate( R.layout.dialog_clear_history, null); final CheckBox endConversationCheckBox = (CheckBox) dialogView - .findViewById(R.id.end_conversation_checkbox); + .findViewById(R.id.end_conversation_checkbox); builder.setView(dialogView); builder.setNegativeButton(getString(R.string.cancel), null); builder.setPositiveButton(getString(R.string.delete_messages), @@ -819,7 +821,7 @@ public class ConversationActivity extends XmppActivity } PopupMenu popup = new PopupMenu(this, menuItemView); final ConversationFragment fragment = (ConversationFragment) getFragmentManager() - .findFragmentByTag("conversation"); + .findFragmentByTag("conversation"); if (fragment != null) { popup.setOnMenuItemClickListener(new OnMenuItemClickListener() { @@ -840,7 +842,7 @@ public class ConversationActivity extends XmppActivity conversation.setNextEncryption(Message.ENCRYPTION_PGP); item.setChecked(true); } else { - announcePgp(conversation.getAccount(),conversation); + announcePgp(conversation.getAccount(), conversation); } } else { showInstallPgpDialog(); @@ -946,7 +948,7 @@ public class ConversationActivity extends XmppActivity int rotation = getWindowManager().getDefaultDisplay().getRotation(); final int upKey; final int downKey; - switch(rotation) { + switch (rotation) { case Surface.ROTATION_90: upKey = KeyEvent.KEYCODE_DPAD_LEFT; downKey = KeyEvent.KEYCODE_DPAD_RIGHT; @@ -969,7 +971,8 @@ public class ConversationActivity extends XmppActivity return true; } else if (modifier && key == downKey) { if (isConversationsOverviewHideable() && !isConversationsOverviewVisable()) { - showConversationsOverview();; + showConversationsOverview(); + ; } return selectDownConversation(); } else if (modifier && key == upKey) { @@ -1105,11 +1108,11 @@ public class ConversationActivity extends XmppActivity public void onSaveInstanceState(final Bundle savedInstanceState) { Conversation conversation = getSelectedConversation(); if (conversation != null) { - savedInstanceState.putString(STATE_OPEN_CONVERSATION,conversation.getUuid()); + savedInstanceState.putString(STATE_OPEN_CONVERSATION, conversation.getUuid()); } else { savedInstanceState.remove(STATE_OPEN_CONVERSATION); } - savedInstanceState.putBoolean(STATE_PANEL_OPEN,isConversationsOverviewVisable()); + savedInstanceState.putBoolean(STATE_PANEL_OPEN, isConversationsOverviewVisable()); if (this.mPendingImageUris.size() >= 1) { savedInstanceState.putString(STATE_PENDING_URI, this.mPendingImageUris.get(0).toString()); } else { @@ -1136,7 +1139,7 @@ public class ConversationActivity extends XmppActivity } if (xmppConnectionService.getAccounts().size() == 0) { - if (mRedirected.compareAndSet(false,true)) { + if (mRedirected.compareAndSet(false, true)) { if (Config.X509_VERIFICATION) { startActivity(new Intent(this, ManageAccountActivity.class)); } else { @@ -1145,9 +1148,9 @@ public class ConversationActivity extends XmppActivity finish(); } } else if (conversationList.size() <= 0) { - if (mRedirected.compareAndSet(false,true)) { + if (mRedirected.compareAndSet(false, true)) { Intent intent = new Intent(this, StartConversationActivity.class); - intent.putExtra("init",true); + intent.putExtra("init", true); startActivity(intent); finish(); } @@ -1179,7 +1182,7 @@ public class ConversationActivity extends XmppActivity this.onActivityResult(mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second); } - if(!forbidProcessingPendings) { + if (!forbidProcessingPendings) { for (Iterator<Uri> i = mPendingImageUris.iterator(); i.hasNext(); i.remove()) { Uri foo = i.next(); attachImageToConversation(getSelectedConversation(), foo); @@ -1196,7 +1199,9 @@ public class ConversationActivity extends XmppActivity } forbidProcessingPendings = false; - ExceptionHelper.checkForCrash(this, this.xmppConnectionService); + if (!ExceptionHelper.checkForCrash(this, this.xmppConnectionService)) { + openBatteryOptimizationDialogIfNeeded(); + } setIntent(new Intent()); } @@ -1205,14 +1210,14 @@ public class ConversationActivity extends XmppActivity final String downloadUuid = intent.getStringExtra(MESSAGE); final String text = intent.getStringExtra(TEXT); final String nick = intent.getStringExtra(NICK); - final boolean pm = intent.getBooleanExtra(PRIVATE_MESSAGE,false); + final boolean pm = intent.getBooleanExtra(PRIVATE_MESSAGE, false); if (selectConversationByUuid(uuid)) { this.mConversationFragment.reInit(getSelectedConversation()); if (nick != null) { if (pm) { Jid jid = getSelectedConversation().getJid(); try { - Jid next = Jid.fromParts(jid.getLocalpart(),jid.getDomainpart(),nick); + Jid next = Jid.fromParts(jid.getLocalpart(), jid.getDomainpart(), nick); this.mConversationFragment.privateMessageWith(next); } catch (final InvalidJidException ignored) { //do nothing @@ -1262,7 +1267,7 @@ public class ConversationActivity extends XmppActivity Uri uri = intent.getData(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && uri == null) { ClipData clipData = intent.getClipData(); - for(int i = 0; i < clipData.getItemCount(); ++i) { + for (int i = 0; i < clipData.getItemCount(); ++i) { uris.add(clipData.getItemAt(i).getUri()); } } else { @@ -1272,8 +1277,7 @@ public class ConversationActivity extends XmppActivity } @Override - protected void onActivityResult(int requestCode, int resultCode, - final Intent data) { + protected void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { if (requestCode == REQUEST_DECRYPT_PGP) { @@ -1301,15 +1305,15 @@ public class ConversationActivity extends XmppActivity mPendingImageUris.clear(); mPendingImageUris.addAll(extractUriFromIntent(data)); if (xmppConnectionServiceBound) { - for(Iterator<Uri> i = mPendingImageUris.iterator(); i.hasNext(); i.remove()) { - attachImageToConversation(getSelectedConversation(),i.next()); + for (Iterator<Uri> i = mPendingImageUris.iterator(); i.hasNext(); i.remove()) { + attachImageToConversation(getSelectedConversation(), i.next()); } } } else if (requestCode == ATTACHMENT_CHOICE_CHOOSE_FILE || requestCode == ATTACHMENT_CHOICE_RECORD_VOICE) { mPendingFileUris.clear(); mPendingFileUris.addAll(extractUriFromIntent(data)); if (xmppConnectionServiceBound) { - for(Iterator<Uri> i = mPendingFileUris.iterator(); i.hasNext(); i.remove()) { + for (Iterator<Uri> i = mPendingFileUris.iterator(); i.hasNext(); i.remove()) { attachFileToConversation(getSelectedConversation(), i.next()); } } @@ -1327,9 +1331,9 @@ public class ConversationActivity extends XmppActivity mPendingImageUris.clear(); } } else if (requestCode == ATTACHMENT_CHOICE_LOCATION) { - double latitude = data.getDoubleExtra("latitude",0); - double longitude = data.getDoubleExtra("longitude",0); - this.mPendingGeoUri = Uri.parse("geo:"+String.valueOf(latitude)+","+String.valueOf(longitude)); + double latitude = data.getDoubleExtra("latitude", 0); + double longitude = data.getDoubleExtra("longitude", 0); + this.mPendingGeoUri = Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude)); if (xmppConnectionServiceBound) { attachLocationToConversation(getSelectedConversation(), mPendingGeoUri); this.mPendingGeoUri = null; @@ -1344,6 +1348,39 @@ public class ConversationActivity extends XmppActivity if (requestCode == ConversationActivity.REQUEST_DECRYPT_PGP) { 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(); } } diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 01054de1..09958c22 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -5,9 +5,10 @@ import android.app.AlertDialog.Builder; import android.app.PendingIntent; import android.content.DialogInterface; import android.content.Intent; -import android.content.res.Configuration; import android.graphics.Bitmap; +import android.net.Uri; import android.os.Bundle; +import android.provider.Settings; import android.security.KeyChain; import android.security.KeyChainAliasCallback; import android.text.Editable; @@ -52,16 +53,17 @@ import eu.siacs.conversations.xmpp.pep.Avatar; public class EditAccountActivity extends XmppActivity implements OnAccountUpdate, OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast { - private LinearLayout mMainLayout; private AutoCompleteTextView mAccountJid; private EditText mPassword; private EditText mPasswordConfirm; private CheckBox mRegisterNew; private Button mCancelButton; private Button mSaveButton; + private Button mDisableBatterOptimizations; private TableLayout mMoreTable; private LinearLayout mStats; + private RelativeLayout mBatteryOptimizations; private TextView mServerInfoSm; private TextView mServerInfoRosterVersion; 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() { if (accountInfoEdited() && !mInitMode) { this.mSaveButton.setText(R.string.save); @@ -372,7 +382,6 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); 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.addTextChangedListener(this.mTextWatcher); 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.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new); 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.mServerInfoRosterVersion = (TextView) findViewById(R.id.server_info_roster_version); 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) { this.mStats.setVisibility(View.VISIBLE); + this.mBatteryOptimizations.setVisibility(showBatteryOptimizationWarning() ? View.VISIBLE : View.GONE); this.mSessionEst.setText(UIHelper.readableTimeDifferenceFull(this, this.mAccount.getXmppConnection() .getLastSessionEstablished())); Features features = this.mAccount.getXmppConnection().getFeatures(); diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index a23f51eb..36e82b2a 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -35,6 +35,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; +import android.os.PowerManager; import android.os.SystemClock; import android.preference.PreferenceManager; 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_INVITE_TO_CONVERSATION = 0x0102; protected static final int REQUEST_CHOOSE_PGP_ID = 0x0103; + protected static final int REQUEST_BATTERY_OP = 0x13849ff; public XmppConnectionService xmppConnectionService; 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() { return getPreferences().getBoolean("display_enter_key", false); } diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java index 0f182847..8799b4a5 100644 --- a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java @@ -24,6 +24,7 @@ import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; 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.Jid; @@ -35,14 +36,13 @@ public class ExceptionHelper { } } - public static void checkForCrash(Context context, - final XmppConnectionService service) { + public static boolean checkForCrash(ConversationActivity activity, final XmppConnectionService service) { try { final SharedPreferences preferences = PreferenceManager - .getDefaultSharedPreferences(context); + .getDefaultSharedPreferences(activity); boolean neverSend = preferences.getBoolean("never_send", false); if (neverSend) { - return; + return false; } List<Account> accounts = service.getAccounts(); Account account = null; @@ -53,24 +53,25 @@ public class ExceptionHelper { } } if (account == null) { - return; + return false; } final Account finalAccount = account; - FileInputStream file = context.openFileInput("stacktrace.txt"); + FileInputStream file = activity.openFileInput("stacktrace.txt"); InputStreamReader inputStreamReader = new InputStreamReader(file); BufferedReader stacktrace = new BufferedReader(inputStreamReader); final StringBuilder report = new StringBuilder(); - PackageManager pm = context.getPackageManager(); + PackageManager pm = activity.getPackageManager(); PackageInfo packageInfo = null; try { - packageInfo = pm.getPackageInfo(context.getPackageName(), 0); + packageInfo = pm.getPackageInfo(activity.getPackageName(), 0); report.append("Version: " + packageInfo.versionName + '\n'); report.append("Last Update: " - + DateUtils.formatDateTime(context, - packageInfo.lastUpdateTime, - DateUtils.FORMAT_SHOW_TIME - | DateUtils.FORMAT_SHOW_DATE) + '\n'); + + DateUtils.formatDateTime(activity, + packageInfo.lastUpdateTime, + DateUtils.FORMAT_SHOW_TIME + | DateUtils.FORMAT_SHOW_DATE) + '\n'); } catch (NameNotFoundException e) { + return false; } String line; while ((line = stacktrace.readLine()) != null) { @@ -78,11 +79,11 @@ public class ExceptionHelper { report.append('\n'); } file.close(); - context.deleteFile("stacktrace.txt"); - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(context.getString(R.string.crash_report_title)); - builder.setMessage(context.getText(R.string.crash_report_message)); - builder.setPositiveButton(context.getText(R.string.send_now), + activity.deleteFile("stacktrace.txt"); + AlertDialog.Builder builder = new AlertDialog.Builder(activity); + builder.setTitle(activity.getString(R.string.crash_report_title)); + builder.setMessage(activity.getText(R.string.crash_report_message)); + builder.setPositiveButton(activity.getText(R.string.send_now), new OnClickListener() { @Override @@ -91,18 +92,18 @@ public class ExceptionHelper { Log.d(Config.LOGTAG, "using account=" + finalAccount.getJid().toBareJid() + " to send in stack trace"); - Conversation conversation = null; - try { - conversation = service.findOrCreateConversation(finalAccount, - Jid.fromString("bugs@siacs.eu"), false); - } catch (final InvalidJidException ignored) { - } - Message message = new Message(conversation, report + Conversation conversation = null; + try { + conversation = service.findOrCreateConversation(finalAccount, + Jid.fromString("bugs@siacs.eu"), false); + } catch (final InvalidJidException ignored) { + } + Message message = new Message(conversation, report .toString(), Message.ENCRYPTION_NONE); service.sendMessage(message); } }); - builder.setNegativeButton(context.getText(R.string.send_never), + builder.setNegativeButton(activity.getText(R.string.send_never), new OnClickListener() { @Override @@ -112,8 +113,9 @@ public class ExceptionHelper { } }); builder.create().show(); + return true; } catch (final IOException ignored) { - } - + return false; + } } } diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index 73395bba..ed935819 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <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:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/grey200"> @@ -10,22 +10,22 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/button_bar" - android:layout_alignParentTop="true" > + android:layout_alignParentTop="true"> <LinearLayout android:id="@+id/account_main_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" > + android:orientation="vertical"> <RelativeLayout android:id="@+id/editor" 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:layout_marginBottom="@dimen/activity_vertical_margin" android:background="@drawable/infocard_border" android:orientation="vertical" android:padding="@dimen/infocard_padding"> @@ -40,78 +40,78 @@ <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:layout_toRightOf="@+id/avater"> - <TextView - android:id="@+id/account_jid_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/account_settings_jabber_id" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:layout_toRightOf="@+id/avater" + android:orientation="vertical"> + <TextView + android:id="@+id/account_jid_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/account_settings_jabber_id" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody"/> - <AutoCompleteTextView - android:id="@+id/account_jid" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/account_settings_example_jabber_id" - android:inputType="textEmailAddress" - android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" /> + <AutoCompleteTextView + android:id="@+id/account_jid" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="@string/account_settings_example_jabber_id" + android:inputType="textEmailAddress" + android:textColor="@color/black87" + android:textColorHint="@color/black54" + android:textSize="?attr/TextSizeBody"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:text="@string/account_settings_password" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="@string/account_settings_password" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody"/> - <EditText - android:id="@+id/account_password" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/password" - android:inputType="textPassword" - android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" /> + <EditText + android:id="@+id/account_password" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="@string/password" + android:inputType="textPassword" + android:textColor="@color/black87" + android:textColorHint="@color/black54" + android:textSize="?attr/TextSizeBody"/> <LinearLayout android:id="@+id/name_port" - android:layout_marginTop="8dp" - android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:orientation="horizontal" android:weightSum="1"> <LinearLayout - android:orientation="vertical" android:layout_width="0dp" android:layout_height="match_parent" - android:layout_weight="0.8"> + android:layout_weight="0.8" + android:orientation="vertical"> <TextView + android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/account_settings_hostname" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:id="@+id/textView"/> + android:textSize="?attr/TextSizeBody"/> <EditText + android:id="@+id/hostname" android:layout_width="fill_parent" android:layout_height="wrap_content" + android:hint="@string/hostname_or_onion" + android:inputType="textNoSuggestions" android:textColor="@color/black87" android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" - android:id="@+id/hostname" - android:inputType="textNoSuggestions" - android:hint="@string/hostname_or_onion"/> + android:textSize="?attr/TextSizeBody"/> </LinearLayout> <LinearLayout - android:orientation="vertical" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.2" + android:orientation="vertical" > <TextView android:layout_width="wrap_content" @@ -120,65 +120,108 @@ android:textColor="@color/black87" android:textSize="?attr/TextSizeBody"/> <EditText + android:id="@+id/port" android:layout_width="match_parent" android:layout_height="match_parent" android:inputType="number" android:maxLength="5" android:textColor="@color/black87" android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" - android:id="@+id/port"/> + android:textSize="?attr/TextSizeBody"/> </LinearLayout> </LinearLayout> <CheckBox - android:id="@+id/account_register_new" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:text="@string/register_account" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:id="@+id/account_register_new" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="@string/register_account" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody"/> + <TextView + android:id="@+id/account_confirm_password_desc" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/account_settings_confirm_password" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + android:visibility="gone"/> + + <EditText + android:id="@+id/account_password_confirm" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:hint="@string/confirm_password" + android:inputType="textPassword" + android:textColor="@color/black87" + android:textColorHint="@color/black54" + android:textSize="?attr/TextSizeBody" + android:visibility="gone"/> + </LinearLayout> + </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/account_confirm_password_desc" + android:id="@+id/batt_op_headline" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/account_settings_confirm_password" + android:text="@string/battery_optimizations_enabled" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:visibility="gone" /> - - <EditText - android:id="@+id/account_password_confirm" - android:layout_width="match_parent" + 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:hint="@string/confirm_password" - android:inputType="textPassword" - android:visibility="gone" + android:text="@string/battery_optimizations_enabled_explained" android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" /> - </LinearLayout> + 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:layout_width="fill_parent" android:layout_height="fill_parent" + 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:layout_marginBottom="@dimen/activity_vertical_margin" android:background="@drawable/infocard_border" android:orientation="vertical" android:padding="@dimen/infocard_padding" - android:visibility="gone" > + android:visibility="gone"> <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:stretchColumns="1" > + android:stretchColumns="1"> <TableRow android:layout_width="fill_parent" @@ -190,7 +233,7 @@ android:layout_height="wrap_content" android:text="@string/server_info_session_established" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody"/> <TextView android:id="@+id/session_est" @@ -208,18 +251,18 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:stretchColumns="1" - android:visibility="gone" > + android:visibility="gone"> <TableRow android:layout_width="fill_parent" - android:layout_height="wrap_content" > + android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_info_pep" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody"/> <TextView android:id="@+id/server_info_pep" @@ -233,14 +276,14 @@ <TableRow android:layout_width="fill_parent" - android:layout_height="wrap_content" > + android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_info_blocking" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody"/> <TextView android:id="@+id/server_info_blocking" @@ -254,14 +297,14 @@ <TableRow android:layout_width="fill_parent" - android:layout_height="wrap_content" > + android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_info_stream_management" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody"/> <TextView android:id="@+id/server_info_sm" @@ -275,14 +318,14 @@ <TableRow android:layout_width="fill_parent" - android:layout_height="wrap_content" > + android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_info_roster_version" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody"/> <TextView android:id="@+id/server_info_roster_version" @@ -296,14 +339,14 @@ <TableRow android:layout_width="fill_parent" - android:layout_height="wrap_content" > + android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_info_carbon_messages" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody"/> <TextView android:id="@+id/server_info_carbons" @@ -317,14 +360,14 @@ <TableRow android:layout_width="fill_parent" - android:layout_height="wrap_content" > + android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_info_mam" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody"/> <TextView android:id="@+id/server_info_mam" @@ -338,14 +381,14 @@ <TableRow android:layout_width="fill_parent" - android:layout_height="wrap_content" > + android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_info_csi" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody"/> <TextView android:id="@+id/server_info_csi" @@ -358,14 +401,14 @@ </TableRow> <TableRow android:layout_width="fill_parent" - android:layout_height="wrap_content" > + android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_info_http_upload" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody"/> <TextView android:id="@+id/server_info_http_upload" @@ -379,9 +422,9 @@ </TableLayout> <RelativeLayout + android:id="@+id/otr_fingerprint_box" android:layout_width="wrap_content" android:layout_height="match_parent" - android:id="@+id/otr_fingerprint_box" android:layout_marginTop="32dp"> <LinearLayout @@ -395,17 +438,17 @@ android:id="@+id/otr_fingerprint" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:fontFamily="monospace" android:textColor="@color/black87" android:textSize="?attr/TextSizeBody" - android:typeface="monospace" - android:fontFamily="monospace"/> + android:typeface="monospace"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" + android:text="@string/otr_fingerprint" android:textColor="@color/black54" - android:textSize="?attr/TextSizeInfo" - android:text="@string/otr_fingerprint"/> + android:textSize="?attr/TextSizeInfo"/> </LinearLayout> <ImageButton @@ -415,79 +458,79 @@ android:layout_alignParentRight="true" android:layout_centerVertical="true" android:background="?android:selectableItemBackground" + android:contentDescription="@string/copy_otr_clipboard_description" android:padding="@dimen/image_button_padding" android:src="?attr/icon_copy" - android:visibility="visible" - android:contentDescription="@string/copy_otr_clipboard_description"/> + android:visibility="visible"/> + </RelativeLayout> + <RelativeLayout + android:id="@+id/axolotl_fingerprint_box" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginTop="32dp"> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_toLeftOf="@+id/axolotl_actions" + android:orientation="vertical"> + + <TextView + android:id="@+id/axolotl_fingerprint" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="monospace" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + android:typeface="monospace"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/this_device_omemo_fingerprint" + android:textColor="@color/black54" + android:textSize="?attr/TextSizeInfo"/> + </LinearLayout> + + <LinearLayout + android:id="@+id/axolotl_actions" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:orientation="vertical"> + + <ImageButton + android:id="@+id/action_copy_axolotl_to_clipboard" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?android:selectableItemBackground" + android:contentDescription="@string/copy_omemo_clipboard_description" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_copy" + android:visibility="visible"/> + <ImageButton + android:id="@+id/action_regenerate_axolotl_key" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?android:selectableItemBackground" + android:contentDescription="@string/regenerate_omemo_key" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_refresh" + android:visibility="gone"/> + + </LinearLayout> </RelativeLayout> - <RelativeLayout - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:id="@+id/axolotl_fingerprint_box" - android:layout_marginTop="32dp"> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_toLeftOf="@+id/axolotl_actions" - android:orientation="vertical"> - - <TextView - android:id="@+id/axolotl_fingerprint" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:typeface="monospace" - android:fontFamily="monospace"/> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeInfo" - android:text="@string/this_device_omemo_fingerprint"/> - </LinearLayout> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/axolotl_actions" - android:layout_centerVertical="true" - android:layout_alignParentRight="true" - android:orientation="vertical"> - - <ImageButton - android:id="@+id/action_copy_axolotl_to_clipboard" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="?android:selectableItemBackground" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_copy" - android:visibility="visible" - android:contentDescription="@string/copy_omemo_clipboard_description"/> - <ImageButton - android:id="@+id/action_regenerate_axolotl_key" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="?android:selectableItemBackground" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_refresh" - android:visibility="gone" - android:contentDescription="@string/regenerate_omemo_key"/> - - </LinearLayout> - </RelativeLayout> </LinearLayout> <LinearLayout android:id="@+id/other_device_keys_card" 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:layout_marginBottom="@dimen/activity_vertical_margin" android:background="@drawable/infocard_border" android:orientation="vertical" android:padding="@dimen/infocard_padding" @@ -497,10 +540,10 @@ android:id="@+id/other_device_keys_title" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:text="@string/other_devices" android:textColor="@color/black87" android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" - android:text="@string/other_devices"/> + android:textStyle="bold"/> <LinearLayout android:id="@+id/other_device_keys" @@ -508,7 +551,7 @@ android:layout_height="wrap_content" android:divider="?android:dividerHorizontal" android:orientation="vertical" - android:showDividers="middle" > + android:showDividers="middle"> </LinearLayout> </LinearLayout> </LinearLayout> @@ -519,10 +562,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:layout_alignParentStart="true" android:layout_alignParentEnd="true" android:layout_alignParentLeft="true" - android:layout_alignParentRight="true" > + android:layout_alignParentRight="true" + android:layout_alignParentStart="true"> <Button android:id="@+id/cancel_button" @@ -531,14 +574,14 @@ android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/cancel" - android:textColor="@color/black87" /> + android:textColor="@color/black87"/> <View android:layout_width="1dp" android:layout_height="fill_parent" android:layout_marginBottom="7dp" android:layout_marginTop="7dp" - android:background="@color/black12" /> + android:background="@color/black12"/> <Button android:id="@+id/save_button" @@ -548,7 +591,7 @@ android:layout_weight="1" android:enabled="false" android:text="@string/save" - android:textColor="@color/black54" /> + android:textColor="@color/black54"/> </LinearLayout> </RelativeLayout> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index deffa64e..2185d099 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -575,4 +575,8 @@ <string name="pref_picture_compression_summary">Resize and compressed pictures</string> <string name="always">Always</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> |