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 {
@ -442,7 +444,7 @@ public class ConversationActivity extends XmppActivity
case ATTACHMENT_CHOICE_CHOOSE_IMAGE: case ATTACHMENT_CHOICE_CHOOSE_IMAGE:
intent.setAction(Intent.ACTION_GET_CONTENT); intent.setAction(Intent.ACTION_GET_CONTENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { 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/*"); intent.setType("image/*");
chooser = true; chooser = true;
@ -509,16 +511,16 @@ public class ConversationActivity extends XmppActivity
} }
switch (attachmentChoice) { switch (attachmentChoice) {
case ATTACHMENT_CHOICE_LOCATION: case ATTACHMENT_CHOICE_LOCATION:
getPreferences().edit().putString("recently_used_quick_action","location").apply(); getPreferences().edit().putString("recently_used_quick_action", "location").apply();
break; break;
case ATTACHMENT_CHOICE_RECORD_VOICE: case ATTACHMENT_CHOICE_RECORD_VOICE:
getPreferences().edit().putString("recently_used_quick_action","voice").apply(); getPreferences().edit().putString("recently_used_quick_action", "voice").apply();
break; break;
case ATTACHMENT_CHOICE_TAKE_PHOTO: case ATTACHMENT_CHOICE_TAKE_PHOTO:
getPreferences().edit().putString("recently_used_quick_action","photo").apply(); getPreferences().edit().putString("recently_used_quick_action", "photo").apply();
break; break;
case ATTACHMENT_CHOICE_CHOOSE_IMAGE: case ATTACHMENT_CHOICE_CHOOSE_IMAGE:
getPreferences().edit().putString("recently_used_quick_action","picture").apply(); getPreferences().edit().putString("recently_used_quick_action", "picture").apply();
break; break;
} }
final Conversation conversation = getSelectedConversation(); final Conversation conversation = getSelectedConversation();
@ -570,7 +572,7 @@ public class ConversationActivity extends XmppActivity
.setNextEncryption(Message.ENCRYPTION_NONE); .setNextEncryption(Message.ENCRYPTION_NONE);
xmppConnectionService.databaseBackend xmppConnectionService.databaseBackend
.updateConversation(conversation); .updateConversation(conversation);
selectPresenceToAttachFile(attachmentChoice,Message.ENCRYPTION_NONE); selectPresenceToAttachFile(attachmentChoice, Message.ENCRYPTION_NONE);
} }
}); });
} }
@ -610,7 +612,7 @@ public class ConversationActivity extends XmppActivity
attachFile(requestCode); attachFile(requestCode);
} }
} else { } 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();
} }
} }
@ -622,7 +624,7 @@ public class ConversationActivity extends XmppActivity
Transferable transferable = message.getTransferable(); Transferable transferable = message.getTransferable();
if (transferable != null) { if (transferable != null) {
if (!transferable.start()) { 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) { } else if (message.treatAsDownloadable() != Message.Decision.NEVER) {
xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message, true); xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message, true);
@ -700,9 +702,9 @@ public class ConversationActivity extends XmppActivity
this.mConversationFragment.reInit(getSelectedConversation()); this.mConversationFragment.reInit(getSelectedConversation());
} else { } else {
setSelectedConversation(null); setSelectedConversation(null);
if (mRedirected.compareAndSet(false,true)) { if (mRedirected.compareAndSet(false, true)) {
Intent intent = new Intent(this, StartConversationActivity.class); Intent intent = new Intent(this, StartConversationActivity.class);
intent.putExtra("init",true); intent.putExtra("init", true);
startActivity(intent); startActivity(intent);
finish(); finish();
} }
@ -840,7 +842,7 @@ public class ConversationActivity extends XmppActivity
conversation.setNextEncryption(Message.ENCRYPTION_PGP); conversation.setNextEncryption(Message.ENCRYPTION_PGP);
item.setChecked(true); item.setChecked(true);
} else { } else {
announcePgp(conversation.getAccount(),conversation); announcePgp(conversation.getAccount(), conversation);
} }
} else { } else {
showInstallPgpDialog(); showInstallPgpDialog();
@ -946,7 +948,7 @@ public class ConversationActivity extends XmppActivity
int rotation = getWindowManager().getDefaultDisplay().getRotation(); int rotation = getWindowManager().getDefaultDisplay().getRotation();
final int upKey; final int upKey;
final int downKey; final int downKey;
switch(rotation) { switch (rotation) {
case Surface.ROTATION_90: case Surface.ROTATION_90:
upKey = KeyEvent.KEYCODE_DPAD_LEFT; upKey = KeyEvent.KEYCODE_DPAD_LEFT;
downKey = KeyEvent.KEYCODE_DPAD_RIGHT; downKey = KeyEvent.KEYCODE_DPAD_RIGHT;
@ -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) {
@ -1105,11 +1108,11 @@ public class ConversationActivity extends XmppActivity
public void onSaveInstanceState(final Bundle savedInstanceState) { public void onSaveInstanceState(final Bundle savedInstanceState) {
Conversation conversation = getSelectedConversation(); Conversation conversation = getSelectedConversation();
if (conversation != null) { if (conversation != null) {
savedInstanceState.putString(STATE_OPEN_CONVERSATION,conversation.getUuid()); savedInstanceState.putString(STATE_OPEN_CONVERSATION, conversation.getUuid());
} else { } else {
savedInstanceState.remove(STATE_OPEN_CONVERSATION); savedInstanceState.remove(STATE_OPEN_CONVERSATION);
} }
savedInstanceState.putBoolean(STATE_PANEL_OPEN,isConversationsOverviewVisable()); savedInstanceState.putBoolean(STATE_PANEL_OPEN, isConversationsOverviewVisable());
if (this.mPendingImageUris.size() >= 1) { if (this.mPendingImageUris.size() >= 1) {
savedInstanceState.putString(STATE_PENDING_URI, this.mPendingImageUris.get(0).toString()); savedInstanceState.putString(STATE_PENDING_URI, this.mPendingImageUris.get(0).toString());
} else { } else {
@ -1136,7 +1139,7 @@ public class ConversationActivity extends XmppActivity
} }
if (xmppConnectionService.getAccounts().size() == 0) { if (xmppConnectionService.getAccounts().size() == 0) {
if (mRedirected.compareAndSet(false,true)) { if (mRedirected.compareAndSet(false, true)) {
if (Config.X509_VERIFICATION) { if (Config.X509_VERIFICATION) {
startActivity(new Intent(this, ManageAccountActivity.class)); startActivity(new Intent(this, ManageAccountActivity.class));
} else { } else {
@ -1145,9 +1148,9 @@ public class ConversationActivity extends XmppActivity
finish(); finish();
} }
} else if (conversationList.size() <= 0) { } else if (conversationList.size() <= 0) {
if (mRedirected.compareAndSet(false,true)) { if (mRedirected.compareAndSet(false, true)) {
Intent intent = new Intent(this, StartConversationActivity.class); Intent intent = new Intent(this, StartConversationActivity.class);
intent.putExtra("init",true); intent.putExtra("init", true);
startActivity(intent); startActivity(intent);
finish(); finish();
} }
@ -1179,7 +1182,7 @@ public class ConversationActivity extends XmppActivity
this.onActivityResult(mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second); this.onActivityResult(mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second);
} }
if(!forbidProcessingPendings) { if (!forbidProcessingPendings) {
for (Iterator<Uri> i = mPendingImageUris.iterator(); i.hasNext(); i.remove()) { for (Iterator<Uri> i = mPendingImageUris.iterator(); i.hasNext(); i.remove()) {
Uri foo = i.next(); Uri foo = i.next();
attachImageToConversation(getSelectedConversation(), foo); attachImageToConversation(getSelectedConversation(), foo);
@ -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());
} }
@ -1205,14 +1210,14 @@ public class ConversationActivity extends XmppActivity
final String downloadUuid = intent.getStringExtra(MESSAGE); final String downloadUuid = intent.getStringExtra(MESSAGE);
final String text = intent.getStringExtra(TEXT); final String text = intent.getStringExtra(TEXT);
final String nick = intent.getStringExtra(NICK); 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)) { if (selectConversationByUuid(uuid)) {
this.mConversationFragment.reInit(getSelectedConversation()); this.mConversationFragment.reInit(getSelectedConversation());
if (nick != null) { if (nick != null) {
if (pm) { if (pm) {
Jid jid = getSelectedConversation().getJid(); Jid jid = getSelectedConversation().getJid();
try { try {
Jid next = Jid.fromParts(jid.getLocalpart(),jid.getDomainpart(),nick); Jid next = Jid.fromParts(jid.getLocalpart(), jid.getDomainpart(), nick);
this.mConversationFragment.privateMessageWith(next); this.mConversationFragment.privateMessageWith(next);
} catch (final InvalidJidException ignored) { } catch (final InvalidJidException ignored) {
//do nothing //do nothing
@ -1262,7 +1267,7 @@ public class ConversationActivity extends XmppActivity
Uri uri = intent.getData(); Uri uri = intent.getData();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && uri == null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && uri == null) {
ClipData clipData = intent.getClipData(); 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()); uris.add(clipData.getItemAt(i).getUri());
} }
} else { } else {
@ -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) {
@ -1301,15 +1305,15 @@ public class ConversationActivity extends XmppActivity
mPendingImageUris.clear(); mPendingImageUris.clear();
mPendingImageUris.addAll(extractUriFromIntent(data)); mPendingImageUris.addAll(extractUriFromIntent(data));
if (xmppConnectionServiceBound) { if (xmppConnectionServiceBound) {
for(Iterator<Uri> i = mPendingImageUris.iterator(); i.hasNext(); i.remove()) { for (Iterator<Uri> i = mPendingImageUris.iterator(); i.hasNext(); i.remove()) {
attachImageToConversation(getSelectedConversation(),i.next()); attachImageToConversation(getSelectedConversation(), i.next());
} }
} }
} else if (requestCode == ATTACHMENT_CHOICE_CHOOSE_FILE || requestCode == ATTACHMENT_CHOICE_RECORD_VOICE) { } else if (requestCode == ATTACHMENT_CHOICE_CHOOSE_FILE || requestCode == ATTACHMENT_CHOICE_RECORD_VOICE) {
mPendingFileUris.clear(); mPendingFileUris.clear();
mPendingFileUris.addAll(extractUriFromIntent(data)); mPendingFileUris.addAll(extractUriFromIntent(data));
if (xmppConnectionServiceBound) { 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()); attachFileToConversation(getSelectedConversation(), i.next());
} }
} }
@ -1327,9 +1331,9 @@ public class ConversationActivity extends XmppActivity
mPendingImageUris.clear(); mPendingImageUris.clear();
} }
} else if (requestCode == ATTACHMENT_CHOICE_LOCATION) { } else if (requestCode == ATTACHMENT_CHOICE_LOCATION) {
double latitude = data.getDoubleExtra("latitude",0); double latitude = data.getDoubleExtra("latitude", 0);
double longitude = data.getDoubleExtra("longitude",0); double longitude = data.getDoubleExtra("longitude", 0);
this.mPendingGeoUri = Uri.parse("geo:"+String.valueOf(latitude)+","+String.valueOf(longitude)); this.mPendingGeoUri = Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude));
if (xmppConnectionServiceBound) { if (xmppConnectionServiceBound) {
attachLocationToConversation(getSelectedConversation(), mPendingGeoUri); attachLocationToConversation(getSelectedConversation(), mPendingGeoUri);
this.mPendingGeoUri = null; this.mPendingGeoUri = null;
@ -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">
@ -10,22 +10,22 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/button_bar" android:layout_above="@+id/button_bar"
android:layout_alignParentTop="true" > android:layout_alignParentTop="true">
<LinearLayout <LinearLayout
android:id="@+id/account_main_layout" android:id="@+id/account_main_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" > android:orientation="vertical">
<RelativeLayout <RelativeLayout
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,15 +40,15 @@
<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"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/account_settings_jabber_id" android:text="@string/account_settings_jabber_id"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<AutoCompleteTextView <AutoCompleteTextView
android:id="@+id/account_jid" android:id="@+id/account_jid"
@ -58,7 +58,7 @@
android:inputType="textEmailAddress" android:inputType="textEmailAddress"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textColorHint="@color/black54" android:textColorHint="@color/black54"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -66,7 +66,7 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/account_settings_password" android:text="@string/account_settings_password"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<EditText <EditText
android:id="@+id/account_password" android:id="@+id/account_password"
@ -76,42 +76,42 @@
android:inputType="textPassword" android:inputType="textPassword"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textColorHint="@color/black54" android:textColorHint="@color/black54"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<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
@ -137,7 +137,7 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/register_account" android:text="@string/register_account"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/account_confirm_password_desc" android:id="@+id/account_confirm_password_desc"
@ -146,7 +146,7 @@
android:text="@string/account_settings_confirm_password" android:text="@string/account_settings_confirm_password"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" android:textSize="?attr/TextSizeBody"
android:visibility="gone" /> android:visibility="gone"/>
<EditText <EditText
android:id="@+id/account_password_confirm" android:id="@+id/account_password_confirm"
@ -155,30 +155,73 @@
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"
android:visibility="gone" > android:visibility="gone">
<TableLayout <TableLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:stretchColumns="1" > android:stretchColumns="1">
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -190,7 +233,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/server_info_session_established" android:text="@string/server_info_session_established"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/session_est" android:id="@+id/session_est"
@ -208,18 +251,18 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:stretchColumns="1" android:stretchColumns="1"
android:visibility="gone" > android:visibility="gone">
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content">
<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/server_info_pep" android:text="@string/server_info_pep"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/server_info_pep" android:id="@+id/server_info_pep"
@ -233,14 +276,14 @@
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content">
<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/server_info_blocking" android:text="@string/server_info_blocking"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/server_info_blocking" android:id="@+id/server_info_blocking"
@ -254,14 +297,14 @@
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content">
<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/server_info_stream_management" android:text="@string/server_info_stream_management"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/server_info_sm" android:id="@+id/server_info_sm"
@ -275,14 +318,14 @@
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content">
<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/server_info_roster_version" android:text="@string/server_info_roster_version"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/server_info_roster_version" android:id="@+id/server_info_roster_version"
@ -296,14 +339,14 @@
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content">
<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/server_info_carbon_messages" android:text="@string/server_info_carbon_messages"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/server_info_carbons" android:id="@+id/server_info_carbons"
@ -317,14 +360,14 @@
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content">
<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/server_info_mam" android:text="@string/server_info_mam"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/server_info_mam" android:id="@+id/server_info_mam"
@ -338,14 +381,14 @@
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content">
<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/server_info_csi" android:text="@string/server_info_csi"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/server_info_csi" android:id="@+id/server_info_csi"
@ -358,14 +401,14 @@
</TableRow> </TableRow>
<TableRow <TableRow
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content">
<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/server_info_http_upload" android:text="@string/server_info_http_upload"
android:textColor="@color/black87" android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody"/>
<TextView <TextView
android:id="@+id/server_info_http_upload" android:id="@+id/server_info_http_upload"
@ -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"
@ -508,7 +551,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:divider="?android:dividerHorizontal" android:divider="?android:dividerHorizontal"
android:orientation="vertical" android:orientation="vertical"
android:showDividers="middle" > android:showDividers="middle">
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -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"
@ -531,14 +574,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel" android:text="@string/cancel"
android:textColor="@color/black87" /> android:textColor="@color/black87"/>
<View <View
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_marginBottom="7dp" android:layout_marginBottom="7dp"
android:layout_marginTop="7dp" android:layout_marginTop="7dp"
android:background="@color/black12" /> android:background="@color/black12"/>
<Button <Button
android:id="@+id/save_button" android:id="@+id/save_button"
@ -548,7 +591,7 @@
android:layout_weight="1" android:layout_weight="1"
android:enabled="false" android:enabled="false"
android:text="@string/save" android:text="@string/save"
android:textColor="@color/black54" /> android:textColor="@color/black54"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

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>