aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java1
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java301
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java11
-rw-r--r--src/main/res/drawable/date_bubble.xml4
-rw-r--r--src/main/res/drawable/date_bubble_dark.xml21
-rw-r--r--src/main/res/drawable/message_border.xml2
-rw-r--r--src/main/res/drawable/message_bubble_received_light.xml4
-rw-r--r--src/main/res/drawable/message_bubble_received_light_dark.xml21
-rw-r--r--src/main/res/drawable/message_bubble_received_warning.xml4
-rw-r--r--src/main/res/drawable/message_bubble_received_warning_dark.xml21
-rw-r--r--src/main/res/drawable/message_bubble_sent_blue.xml4
-rw-r--r--src/main/res/drawable/message_bubble_sent_blue_dark.xml21
-rw-r--r--src/main/res/values/themes.xml2
13 files changed, 222 insertions, 195 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 5e005f391..d47f8cb72 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -1154,6 +1154,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
binding.textinput.addTextChangedListener(new StylingHelper.MessageEditorStyler(binding.textinput));
binding.textinput.setOnEditorActionListener(mEditorActionListener);
binding.textinput.setRichContentListener(new String[]{"image/*"}, mEditorContentListener);
+ binding.textinput.setBackgroundResource(activity.isDarkTheme() ? R.drawable.message_bubble_sent_blue_dark : R.drawable.message_bubble_sent_blue);
binding.textSendButton.setOnClickListener(this.mSendButtonListener);
binding.textSendButton.setOnLongClickListener(this.mSendButtonLongListener);
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index 070a88bb0..53ff2cff0 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -32,11 +32,7 @@ import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
-import android.widget.ImageButton;
import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -82,34 +78,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private static final int REQUEST_DATA_SAVER = 0xf244;
private static final int REQUEST_CHANGE_STATUS = 0xee11;
- private TextInputLayout mAccountJidLayout;
- private EditText mPassword;
- private TextInputLayout mPasswordLayout;
- private Button mCancelButton;
- private Button mSaveButton;
- private Button mDisableOsOptimizationsButton;
- private TextView getmDisableOsOptimizationsBody;
- private TableLayout mMoreTable;
-
- private TextView mOtrFingerprint;
- private TextView mAxolotlFingerprint;
- private TextView mPgpFingerprint;
- private TextView mOwnFingerprintDesc;
- private TextView mOtrFingerprintDesc;
- private TextView getmPgpFingerprintDesc;
- private ImageView mAvatar;
- private RelativeLayout mOtrFingerprintBox;
- private RelativeLayout mAxolotlFingerprintBox;
- private RelativeLayout mPgpFingerprintBox;
- private ImageButton mOtrFingerprintToClipboardButton;
- private ImageButton mAxolotlFingerprintToClipboardButton;
- private ImageButton mPgpDeleteFingerprintButton;
- private LinearLayout keys;
- private LinearLayout mNamePort;
- private EditText mHostname;
- private TextInputLayout mHostnameLayout;
- private EditText mPort;
- private TextInputLayout mPortLayout;
+
private AlertDialog mCaptchaDialog = null;
private Jid jidToEdit;
@@ -127,7 +96,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
@Override
public void onClick(final View v) {
- final String password = mPassword.getText().toString();
+ final String password = binding.accountPassword.getText().toString();
final boolean wasDisabled = mAccount != null && mAccount.getStatus() == Account.State.DISABLED;
if (!mInitMode && passwordChangedInMagicCreateMode()) {
@@ -146,8 +115,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
final boolean registerNewAccount = binding.accountRegisterNew.isChecked() && !Config.DISALLOW_REGISTRATION_IN_UI;
if (mUsernameMode && binding.accountJid.getText().toString().contains("@")) {
- mAccountJidLayout.setError(getString(R.string.invalid_username));
- removeErrorsOnAllBut(mAccountJidLayout);
+ binding.accountJidLayout.setError(getString(R.string.invalid_username));
+ removeErrorsOnAllBut(binding.accountJidLayout);
binding.accountJid.requestFocus();
return;
}
@@ -177,49 +146,49 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
} catch (final NullPointerException | IllegalArgumentException e) {
if (mUsernameMode) {
- mAccountJidLayout.setError(getString(R.string.invalid_username));
+ binding.accountJidLayout.setError(getString(R.string.invalid_username));
} else {
- mAccountJidLayout.setError(getString(R.string.invalid_jid));
+ binding.accountJidLayout.setError(getString(R.string.invalid_jid));
}
binding.accountJid.requestFocus();
- removeErrorsOnAllBut(mAccountJidLayout);
+ removeErrorsOnAllBut(binding.accountJidLayout);
return;
}
String hostname = null;
int numericPort = 5222;
if (mShowOptions) {
- hostname = mHostname.getText().toString().replaceAll("\\s", "");
- final String port = mPort.getText().toString().replaceAll("\\s", "");
+ hostname = binding.hostname.getText().toString().replaceAll("\\s", "");
+ final String port = binding.port.getText().toString().replaceAll("\\s", "");
if (hostname.contains(" ")) {
- mHostnameLayout.setError(getString(R.string.not_valid_hostname));
- mHostname.requestFocus();
- removeErrorsOnAllBut(mHostnameLayout);
+ binding.hostnameLayout.setError(getString(R.string.not_valid_hostname));
+ binding.hostname.requestFocus();
+ removeErrorsOnAllBut(binding.hostnameLayout);
return;
}
try {
numericPort = Integer.parseInt(port);
if (numericPort < 0 || numericPort > 65535) {
- mPortLayout.setError(getString(R.string.not_a_valid_port));
- removeErrorsOnAllBut(mPortLayout);
- mPort.requestFocus();
+ binding.portLayout.setError(getString(R.string.not_a_valid_port));
+ removeErrorsOnAllBut(binding.portLayout);
+ binding.port.requestFocus();
return;
}
} catch (NumberFormatException e) {
- mPortLayout.setError(getString(R.string.not_a_valid_port));
- removeErrorsOnAllBut(mPortLayout);
- mPort.requestFocus();
+ binding.portLayout.setError(getString(R.string.not_a_valid_port));
+ removeErrorsOnAllBut(binding.portLayout);
+ binding.port.requestFocus();
return;
}
}
if (jid.getLocal() == null) {
if (mUsernameMode) {
- mAccountJidLayout.setError(getString(R.string.invalid_username));
+ binding.accountJidLayout.setError(getString(R.string.invalid_username));
} else {
- mAccountJidLayout.setError(getString(R.string.invalid_jid));
+ binding.accountJidLayout.setError(getString(R.string.invalid_jid));
}
- removeErrorsOnAllBut(mAccountJidLayout);
+ removeErrorsOnAllBut(binding.accountJidLayout);
binding.accountJid.requestFocus();
return;
}
@@ -236,9 +205,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
mAccount.setPort(numericPort);
mAccount.setHostname(hostname);
if (XmppConnection.errorMessage != null) {
- mAccountJidLayout.setError(XmppConnection.errorMessage);
+ binding.accountJidLayout.setError(XmppConnection.errorMessage);
} else {
- mAccountJidLayout.setError(null);
+ binding.accountJidLayout.setError(null);
}
mAccount.setPassword(password);
mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount);
@@ -248,8 +217,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
} else {
if (xmppConnectionService.findAccountByJid(jid) != null) {
- mAccountJidLayout.setError(getString(R.string.account_already_exists));
- removeErrorsOnAllBut(mAccountJidLayout);
+ binding.accountJidLayout.setError(getString(R.string.account_already_exists));
+ removeErrorsOnAllBut(binding.accountJidLayout);
binding.accountJid.requestFocus();
return;
}
@@ -261,8 +230,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount);
xmppConnectionService.createAccount(mAccount);
}
- mHostnameLayout.setError(null);
- mPortLayout.setError(null);
+ binding.hostnameLayout.setError(null);
+ binding.portLayout.setError(null);
if (mAccount.isEnabled()
&& !registerNewAccount
&& !mInitMode) {
@@ -466,42 +435,42 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
boolean accountInfoEdited = accountInfoEdited();
if (!mInitMode && passwordChangedInMagicCreateMode()) {
- this.mSaveButton.setText(R.string.change_password);
- this.mSaveButton.setEnabled(true);
+ this.binding.saveButton.setText(R.string.change_password);
+ this.binding.saveButton.setEnabled(true);
} else if (accountInfoEdited && !mInitMode) {
- this.mSaveButton.setText(R.string.save);
- this.mSaveButton.setEnabled(true);
+ this.binding.saveButton.setText(R.string.save);
+ this.binding.saveButton.setEnabled(true);
} else if (mAccount != null
&& (mAccount.getStatus() == Account.State.CONNECTING || mAccount.getStatus() == Account.State.REGISTRATION_SUCCESSFUL || mFetchingAvatar)) {
- this.mSaveButton.setEnabled(false);
- this.mSaveButton.setText(R.string.account_status_connecting);
+ this.binding.saveButton.setEnabled(false);
+ this.binding.saveButton.setText(R.string.account_status_connecting);
} else if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !mInitMode) {
- this.mSaveButton.setEnabled(true);
- this.mSaveButton.setText(R.string.enable);
+ this.binding.saveButton.setEnabled(true);
+ this.binding.saveButton.setText(R.string.enable);
} else {
- this.mSaveButton.setEnabled(true);
+ this.binding.saveButton.setEnabled(true);
if (!mInitMode) {
if (mAccount != null && mAccount.isOnlineAndConnected()) {
- this.mSaveButton.setText(R.string.save);
+ this.binding.saveButton.setText(R.string.save);
if (!accountInfoEdited) {
- this.mSaveButton.setEnabled(false);
+ this.binding.saveButton.setEnabled(false);
}
} else {
XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
URL url = connection != null && mAccount.getStatus() == Account.State.PAYMENT_REQUIRED ? connection.getRedirectionUrl() : null;
if (url != null) {
- this.mSaveButton.setText(R.string.open_website);
+ this.binding.saveButton.setText(R.string.open_website);
} else {
- this.mSaveButton.setText(R.string.connect);
+ this.binding.saveButton.setText(R.string.connect);
}
}
} else {
XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
URL url = connection != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB ? connection.getRedirectionUrl() : null;
if (url != null && this.binding.accountRegisterNew.isChecked()) {
- this.mSaveButton.setText(R.string.open_website);
+ this.binding.saveButton.setText(R.string.open_website);
} else {
- this.mSaveButton.setText(R.string.next);
+ this.binding.saveButton.setText(R.string.next);
}
}
}
@@ -512,9 +481,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
return false;
}
return jidEdited() ||
- !this.mAccount.getPassword().equals(this.mPassword.getText().toString()) ||
- !this.mAccount.getHostname().equals(this.mHostname.getText().toString()) ||
- !String.valueOf(this.mAccount.getPort()).equals(this.mPort.getText().toString());
+ !this.mAccount.getPassword().equals(binding.accountPassword.getText().toString()) ||
+ !this.mAccount.getHostname().equals(this.binding.hostname.getText().toString()) ||
+ !String.valueOf(this.mAccount.getPort()).equals(this.binding.port.getText().toString());
}
protected boolean jidEdited() {
@@ -530,7 +499,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
protected boolean passwordChangedInMagicCreateMode() {
return mAccount != null
&& mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)
- && !this.mAccount.getPassword().equals(this.mPassword.getText().toString())
+ && !this.mAccount.getPassword().equals(binding.accountPassword.getText().toString())
&& !this.jidEdited()
&& mAccount.isOnlineAndConnected();
}
@@ -556,43 +525,15 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
configureActionBar(getSupportActionBar());
this.binding.accountJid.addTextChangedListener(this.mTextWatcher);
this.binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener);
- this.mAccountJidLayout = (TextInputLayout) findViewById(R.id.account_jid_layout);
- this.mPassword = findViewById(R.id.account_password);
- this.mPassword.addTextChangedListener(this.mTextWatcher);
- this.mPasswordLayout = (TextInputLayout) findViewById(R.id.account_password_layout);
- this.mAvatar = findViewById(R.id.avater);
- this.mAvatar.setOnClickListener(this.mAvatarClickListener);
- this.mDisableOsOptimizationsButton = findViewById(R.id.os_optimization_disable);
- this.getmDisableOsOptimizationsBody = findViewById(R.id.os_optimization_body);
- this.mPgpFingerprintBox = findViewById(R.id.pgp_fingerprint_box);
- this.mPgpFingerprint = findViewById(R.id.pgp_fingerprint);
- this.getmPgpFingerprintDesc = findViewById(R.id.pgp_fingerprint_desc);
- this.mPgpDeleteFingerprintButton = findViewById(R.id.action_delete_pgp);
- this.mOtrFingerprint = findViewById(R.id.otr_fingerprint);
- this.mOtrFingerprintDesc = findViewById(R.id.otr_fingerprint_desc);
- this.mOtrFingerprintBox = findViewById(R.id.otr_fingerprint_box);
- this.mOtrFingerprintToClipboardButton = findViewById(R.id.action_copy_to_clipboard);
- this.mAxolotlFingerprint = findViewById(R.id.axolotl_fingerprint);
- this.mAxolotlFingerprintBox = findViewById(R.id.axolotl_fingerprint_box);
- this.mAxolotlFingerprintToClipboardButton = findViewById(R.id.action_copy_axolotl_to_clipboard);
- this.mOwnFingerprintDesc = findViewById(R.id.own_fingerprint_desc);
- this.keys = findViewById(R.id.other_device_keys);
- this.mNamePort = findViewById(R.id.name_port);
- this.mHostname = findViewById(R.id.hostname);
- this.mHostname.addTextChangedListener(mTextWatcher);
- this.mHostname.setOnFocusChangeListener(mEditTextFocusListener);
- this.mHostnameLayout = (TextInputLayout)findViewById(R.id.hostname_layout);
- this.mClearDevicesButton = findViewById(R.id.clear_devices);
- this.mClearDevicesButton.setOnClickListener(v -> showWipePepDialog());
- this.mPort = findViewById(R.id.port);
- this.mPort.setText("5222");
- this.mPort.addTextChangedListener(mTextWatcher);
- this.mPortLayout = (TextInputLayout)findViewById(R.id.port_layout);
- this.mSaveButton = findViewById(R.id.save_button);
- this.mCancelButton = findViewById(R.id.cancel_button);
- this.mSaveButton.setOnClickListener(this.mSaveButtonClickListener);
- this.mCancelButton.setOnClickListener(this.mCancelButtonClickListener);
- this.mMoreTable = findViewById(R.id.server_info_more);
+ this.binding.accountPassword.addTextChangedListener(this.mTextWatcher);
+ this.binding.avater.setOnClickListener(this.mAvatarClickListener);
+ this.binding.hostname.addTextChangedListener(mTextWatcher);
+ this.binding.hostname.setOnFocusChangeListener(mEditTextFocusListener);
+ this.binding.clearDevices.setOnClickListener(v -> showWipePepDialog());
+ this.binding.port.setText("5222");
+ this.binding.port.addTextChangedListener(mTextWatcher);
+ this.binding.saveButton.setOnClickListener(this.mSaveButtonClickListener);
+ this.binding.cancelButton.setOnClickListener(this.mCancelButtonClickListener);
if (savedInstanceState != null && savedInstanceState.getBoolean("showMoreTable")) {
changeMoreTableVisibility(true);
}
@@ -661,7 +602,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
public boolean onPrepareOptionsMenu(Menu menu) {
final MenuItem showMoreInfo = menu.findItem(R.id.action_server_info_show_more);
if (showMoreInfo.isVisible()) {
- showMoreInfo.setChecked(mMoreTable.getVisibility() == View.VISIBLE);
+ showMoreInfo.setChecked(binding.serverInfoMore.getVisibility() == View.VISIBLE);
}
return super.onPrepareOptionsMenu(menu);
}
@@ -696,7 +637,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
getSupportActionBar().setTitle(getString(R.string.account_details));
}
} else {
- this.mAvatar.setVisibility(View.GONE);
+ binding.avater.setVisibility(View.GONE);
ActionBar ab = getSupportActionBar();
if (ab != null) {
if (init && Config.MAGIC_CREATE_DOMAIN == null) {
@@ -710,7 +651,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
SharedPreferences preferences = getPreferences();
mUseTor = Config.FORCE_ORBOT || preferences.getBoolean("use_tor", false);
this.mShowOptions = mUseTor || preferences.getBoolean("show_connection_options", false);
- this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
+ this.binding.namePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
}
@Override
@@ -730,7 +671,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (mAccount != null) {
savedInstanceState.putString("account", mAccount.getJid().asBareJid().toString());
savedInstanceState.putBoolean("initMode", mInitMode);
- savedInstanceState.putBoolean("showMoreTable", mMoreTable.getVisibility() == View.VISIBLE);
+ savedInstanceState.putBoolean("showMoreTable", binding.serverInfoMore.getVisibility() == View.VISIBLE);
}
super.onSaveInstanceState(savedInstanceState);
}
@@ -754,9 +695,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mInitMode |= this.mAccount.isOptionSet(Account.OPTION_REGISTER);
this.mUsernameMode |= mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) && mAccount.isOptionSet(Account.OPTION_REGISTER);
if (this.mAccount.getPrivateKeyAlias() != null) {
- this.mPassword.setHint(R.string.authenticate_with_certificate);
+ binding.accountPassword.setHint(R.string.authenticate_with_certificate);
if (this.mInitMode) {
- this.mPassword.requestFocus();
+ binding.accountPassword.requestFocus();
}
}
if (mPendingFingerprintVerificationUri != null) {
@@ -768,7 +709,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (Config.MAGIC_CREATE_DOMAIN == null && this.xmppConnectionService.getAccounts().size() == 0) {
- this.mCancelButton.setEnabled(false);
+ this.binding.cancelButton.setEnabled(false);
}
if (mUsernameMode) {
this.binding.accountJid.setHint(R.string.username_hint);
@@ -865,7 +806,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
private void changeMoreTableVisibility(boolean visible) {
- mMoreTable.setVisibility(visible ? View.VISIBLE : View.GONE);
+ binding.serverInfoMore.setVisibility(visible ? View.VISIBLE : View.GONE);
}
private void gotoChangePassword(String newPassword) {
@@ -984,14 +925,14 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} else {
this.binding.accountJid.getEditableText().append(this.mAccount.getJid().asBareJid().toString());
}
- this.mPassword.getEditableText().clear();
- this.mPassword.getEditableText().append(this.mAccount.getPassword());
- this.mPassword.setText(this.mAccount.getPassword());
- this.mHostname.setText("");
- this.mHostname.getEditableText().append(this.mAccount.getHostname());
- this.mPort.setText("");
- this.mPort.getEditableText().append(String.valueOf(this.mAccount.getPort()));
- this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
+ binding.accountPassword.getEditableText().clear();
+ binding.accountPassword.getEditableText().append(this.mAccount.getPassword());
+ binding.accountPassword.setText(this.mAccount.getPassword());
+ this.binding.hostname.setText("");
+ this.binding.hostname.getEditableText().append(this.mAccount.getHostname());
+ this.binding.port.setText("");
+ this.binding.port.getEditableText().append(String.valueOf(this.mAccount.getPort()));
+ this.binding.namePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
}
@@ -1007,11 +948,11 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
if (!mInitMode) {
- this.mAvatar.setVisibility(View.VISIBLE);
- this.mAvatar.setImageBitmap(avatarService().get(this.mAccount, getPixel(Config.AVATAR_SIZE)));
+ binding.avater.setVisibility(View.VISIBLE);
+ binding.avater.setImageBitmap(avatarService().get(this.mAccount, getPixel(Config.AVATAR_SIZE)));
this.binding.accountJid.setEnabled(false);
} else {
- this.mAvatar.setVisibility(View.GONE);
+ binding.avater.setVisibility(View.GONE);
}
this.binding.accountRegisterNew.setChecked(this.mAccount.isOptionSet(Account.OPTION_REGISTER));
if (this.mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) {
@@ -1094,26 +1035,26 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (pgpKeyId != 0 && Config.supportOpenPgp()) {
OnClickListener openPgp = view -> launchOpenKeyChain(pgpKeyId);
OnClickListener delete = view -> showDeletePgpDialog();
- this.mPgpFingerprintBox.setVisibility(View.VISIBLE);
- this.mPgpFingerprint.setText(OpenPgpUtils.convertKeyIdToHex(pgpKeyId));
- this.mPgpFingerprint.setOnClickListener(openPgp);
+ this.binding.pgpFingerprintBox.setVisibility(View.VISIBLE);
+ this.binding.pgpFingerprint.setText(OpenPgpUtils.convertKeyIdToHex(pgpKeyId));
+ this.binding.pgpFingerprint.setOnClickListener(openPgp);
if ("pgp".equals(messageFingerprint)) {
- this.getmPgpFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight);
+ this.binding.pgpFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight);
}
- this.getmPgpFingerprintDesc.setOnClickListener(openPgp);
- this.mPgpDeleteFingerprintButton.setOnClickListener(delete);
+ this.binding.pgpFingerprintDesc.setOnClickListener(openPgp);
+ this.binding.actionDeletePgp.setOnClickListener(delete);
} else {
- this.mPgpFingerprintBox.setVisibility(View.GONE);
+ this.binding.pgpFingerprintBox.setVisibility(View.GONE);
}
final String otrFingerprint = this.mAccount.getOtrFingerprint();
if (otrFingerprint != null && Config.supportOtr()) {
if ("otr".equals(messageFingerprint)) {
- this.mOtrFingerprintDesc.setTextColor(ContextCompat.getColor(this, R.color.accent));
+ this.binding.otrFingerprintDesc.setTextColor(ContextCompat.getColor(this, R.color.accent));
}
- this.mOtrFingerprintBox.setVisibility(View.VISIBLE);
- this.mOtrFingerprint.setText(CryptoHelper.prettifyFingerprint(otrFingerprint));
- this.mOtrFingerprintToClipboardButton.setVisibility(View.VISIBLE);
- this.mOtrFingerprintToClipboardButton.setOnClickListener(v -> {
+ this.binding.otrFingerprintBox.setVisibility(View.VISIBLE);
+ this.binding.otrFingerprint.setText(CryptoHelper.prettifyFingerprint(otrFingerprint));
+ this.binding.actionCopyToClipboard.setVisibility(View.VISIBLE);
+ this.binding.actionCopyToClipboard.setOnClickListener(v -> {
if (copyTextToClipboard(CryptoHelper.prettifyFingerprint(otrFingerprint), R.string.otr_fingerprint)) {
Toast.makeText(
EditAccountActivity.this,
@@ -1122,30 +1063,30 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
});
} else {
- this.mOtrFingerprintBox.setVisibility(View.GONE);
+ this.binding.otrFingerprintBox.setVisibility(View.GONE);
}
final String ownAxolotlFingerprint = this.mAccount.getAxolotlService().getOwnFingerprint();
if (ownAxolotlFingerprint != null && Config.supportOmemo()) {
- this.mAxolotlFingerprintBox.setVisibility(View.VISIBLE);
+ this.binding.axolotlFingerprintBox.setVisibility(View.VISIBLE);
if (ownAxolotlFingerprint.equals(messageFingerprint)) {
- this.mOwnFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight);
- this.mOwnFingerprintDesc.setText(R.string.omemo_fingerprint_selected_message);
+ this.binding.ownFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight);
+ this.binding.ownFingerprintDesc.setText(R.string.omemo_fingerprint_selected_message);
} else {
- this.mOwnFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption);
- this.mOwnFingerprintDesc.setText(R.string.omemo_fingerprint);
+ this.binding.ownFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption);
+ this.binding.ownFingerprintDesc.setText(R.string.omemo_fingerprint);
}
- this.mAxolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(ownAxolotlFingerprint.substring(2)));
- this.mAxolotlFingerprintToClipboardButton.setVisibility(View.VISIBLE);
- this.mAxolotlFingerprintToClipboardButton.setOnClickListener(v -> copyOmemoFingerprint(ownAxolotlFingerprint));
+ this.binding.axolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(ownAxolotlFingerprint.substring(2)));
+ this.binding.actionCopyAxolotlToClipboard.setVisibility(View.VISIBLE);
+ this.binding.actionCopyAxolotlToClipboard.setOnClickListener(v -> copyOmemoFingerprint(ownAxolotlFingerprint));
} else {
- this.mAxolotlFingerprintBox.setVisibility(View.GONE);
+ this.binding.axolotlFingerprintBox.setVisibility(View.GONE);
}
boolean hasKeys = false;
- keys.removeAllViews();
- for(XmppAxolotlSession session : mAccount.getAxolotlService().findOwnSessions()) {
+ binding.otherDeviceKeys.removeAllViews();
+ for (XmppAxolotlSession session : mAccount.getAxolotlService().findOwnSessions()) {
if (!session.getTrust().isCompromised()) {
boolean highlight = session.getFingerprint().equals(messageFingerprint);
- addFingerprintRow(keys,session,highlight);
+ addFingerprintRow(binding.otherDeviceKeys, session, highlight);
hasKeys = true;
}
}
@@ -1164,13 +1105,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
final TextInputLayout errorLayout;
if (this.mAccount.errorStatus()) {
if (this.mAccount.getStatus() == Account.State.UNAUTHORIZED) {
- errorLayout = this.mPasswordLayout;
+ errorLayout = this.binding.accountPasswordLayout;
} else if (mShowOptions
&& this.mAccount.getStatus() == Account.State.SERVER_NOT_FOUND
- && this.mHostname.getText().length() > 0) {
- errorLayout = this.mHostnameLayout;
+ && this.binding.hostname.getText().length() > 0) {
+ errorLayout = this.binding.hostnameLayout;
} else {
- errorLayout = this.mAccountJidLayout;
+ errorLayout = this.binding.accountJidLayout;
}
errorLayout.setError(getString(this.mAccount.getStatus().getReadableId()));
if (init || !accountInfoEdited()) {
@@ -1186,21 +1127,21 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
private void removeErrorsOnAllBut(TextInputLayout exception) {
- if (this.mAccountJidLayout != exception) {
- this.mAccountJidLayout.setErrorEnabled(false);
- this.mAccountJidLayout.setError(null);
+ if (this.binding.accountJidLayout != exception) {
+ this.binding.accountJidLayout.setErrorEnabled(false);
+ this.binding.accountJidLayout.setError(null);
}
- if (this.mPasswordLayout != exception) {
- this.mPasswordLayout.setErrorEnabled(false);
- this.mPasswordLayout.setError(null);
+ if (this.binding.accountPasswordLayout != exception) {
+ this.binding.accountPasswordLayout.setErrorEnabled(false);
+ this.binding.accountPasswordLayout.setError(null);
}
- if (this.mHostnameLayout != exception) {
- this.mHostnameLayout.setErrorEnabled(false);
- this.mHostnameLayout.setError(null);
+ if (this.binding.hostnameLayout != exception) {
+ this.binding.hostnameLayout.setErrorEnabled(false);
+ this.binding.hostnameLayout.setError(null);
}
- if (this.mPortLayout != exception) {
- this.mPortLayout.setErrorEnabled(false);
- this.mPortLayout.setError(null);
+ if (this.binding.portLayout!= exception) {
+ this.binding.portLayout.setErrorEnabled(false);
+ this.binding.portLayout.setError(null);
}
}
@@ -1223,9 +1164,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.binding.osOptimization.setVisibility(showBatteryWarning || showDataSaverWarning ? View.VISIBLE : View.GONE);
if (showDataSaverWarning) {
this.binding.osOptimizationHeadline.setText(R.string.data_saver_enabled);
- this.getmDisableOsOptimizationsBody.setText(R.string.data_saver_enabled_explained);
- this.mDisableOsOptimizationsButton.setText(R.string.allow);
- this.mDisableOsOptimizationsButton.setOnClickListener(v -> {
+ this.binding.osOptimizationBody.setText(R.string.data_saver_enabled_explained);
+ this.binding.osOptimizationDisable.setText(R.string.allow);
+ this.binding.osOptimizationDisable.setOnClickListener(v -> {
Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS);
Uri uri = Uri.parse("package:" + getPackageName());
intent.setData(uri);
@@ -1236,10 +1177,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
});
} else if (showBatteryWarning) {
- this.mDisableOsOptimizationsButton.setText(R.string.disable);
+ this.binding.osOptimizationDisable.setText(R.string.disable);
this.binding.osOptimizationHeadline.setText(R.string.battery_optimizations_enabled);
- this.getmDisableOsOptimizationsBody.setText(R.string.battery_optimizations_enabled_explained);
- this.mDisableOsOptimizationsButton.setOnClickListener(v -> {
+ this.binding.osOptimizationBody.setText(R.string.battery_optimizations_enabled_explained);
+ this.binding.osOptimizationDisable.setOnClickListener(v -> {
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
Uri uri = Uri.parse("package:" + getPackageName());
intent.setData(uri);
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 4e33214c5..92c937053 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -457,8 +457,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
body.insert(end, "\n");
body.setSpan(new DividerSpan(false), end, end + 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
- int color = darkBackground ? this.getMessageTextColor(darkBackground, false)
- : ContextCompat.getColor(activity, R.color.bubble);
+ int color = darkBackground ? this.getMessageTextColor(darkBackground, false) : ContextCompat.getColor(activity, R.color.bubble);
DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
body.setSpan(new QuoteSpan(color, metrics), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
@@ -799,6 +798,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
case DATE_SEPARATOR:
view = activity.getLayoutInflater().inflate(R.layout.message_date_bubble, parent, false);
viewHolder.status_message = view.findViewById(R.id.status_message);
+ viewHolder.message_box = view.findViewById(R.id.message_box);
break;
case SENT:
view = activity.getLayoutInflater().inflate(R.layout.message_sent, parent, false);
@@ -860,6 +860,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} else {
viewHolder.status_message.setText(DateUtils.formatDateTime(activity, message.getTimeSent(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR));
}
+ viewHolder.message_box.setBackgroundResource(darkBackground ? R.drawable.date_bubble_dark : R.drawable.date_bubble);
return view;
} else if (type == STATUS) {
if ("LOAD_MORE".equals(message.getBody())) {
@@ -974,11 +975,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
if (type == RECEIVED) {
if (isInValidSession) {
- viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_light);
+ viewHolder.message_box.setBackgroundResource(darkBackground ? R.drawable.message_bubble_received_light_dark : R.drawable.message_bubble_received_light);
viewHolder.encryption.setVisibility(View.GONE);
viewHolder.encryption.setTextColor(this.getMessageTextColor(darkBackground, false));
} else {
- viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning);
+ viewHolder.message_box.setBackgroundResource(darkBackground ? R.drawable.message_bubble_received_warning_dark: R.drawable.message_bubble_received_warning);
viewHolder.encryption.setVisibility(View.VISIBLE);
viewHolder.encryption.setTextColor(activity.getWarningTextColor());
if (omemoEncryption && !message.isTrusted()) {
@@ -990,7 +991,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
if (type == SENT) {
- viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_sent_blue);
+ viewHolder.message_box.setBackgroundResource(activity.isDarkTheme() ? R.drawable.message_bubble_sent_blue_dark : R.drawable.message_bubble_sent_blue);
}
displayStatus(viewHolder, message, type, darkBackground);
diff --git a/src/main/res/drawable/date_bubble.xml b/src/main/res/drawable/date_bubble.xml
index 1669d5a02..3edf349e9 100644
--- a/src/main/res/drawable/date_bubble.xml
+++ b/src/main/res/drawable/date_bubble.xml
@@ -13,9 +13,9 @@
android:top="6dp" />
<stroke
android:width="1dp"
- android:color="?attr/color_border">
+ android:color="@color/grey500">
</stroke>
<solid
- android:color="?attr/color_bubble_date">
+ android:color="@color/lightgreen">
</solid>
</shape> \ No newline at end of file
diff --git a/src/main/res/drawable/date_bubble_dark.xml b/src/main/res/drawable/date_bubble_dark.xml
new file mode 100644
index 000000000..345c315c1
--- /dev/null
+++ b/src/main/res/drawable/date_bubble_dark.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <corners
+ android:topLeftRadius="5dp"
+ android:topRightRadius="5dp"
+ android:bottomRightRadius="5dp"
+ android:bottomLeftRadius="5dp">
+ </corners>
+ <padding
+ android:bottom="6dp"
+ android:left="6dp"
+ android:right="6dp"
+ android:top="6dp" />
+ <stroke
+ android:width="1dp"
+ android:color="@color/grey800">
+ </stroke>
+ <solid
+ android:color="@color/darkgreen">
+ </solid>
+</shape> \ No newline at end of file
diff --git a/src/main/res/drawable/message_border.xml b/src/main/res/drawable/message_border.xml
index 6b3180944..cee834e98 100644
--- a/src/main/res/drawable/message_border.xml
+++ b/src/main/res/drawable/message_border.xml
@@ -10,6 +10,6 @@
android:right="1.5dp"
android:top="1.5dp" />
- <solid android:color="?attr/color_border" />
+ <solid android:color="@color/grey800" />
</shape> \ No newline at end of file
diff --git a/src/main/res/drawable/message_bubble_received_light.xml b/src/main/res/drawable/message_bubble_received_light.xml
index 5cb1ac4db..32e146460 100644
--- a/src/main/res/drawable/message_bubble_received_light.xml
+++ b/src/main/res/drawable/message_bubble_received_light.xml
@@ -13,9 +13,9 @@
android:top="2dp" />
<stroke
android:width="1dp"
- android:color="?attr/color_border">
+ android:color="@color/grey500">
</stroke>
<solid
- android:color="?attr/color_bubble_light">
+ android:color="@color/lightwhite">
</solid>
</shape> \ No newline at end of file
diff --git a/src/main/res/drawable/message_bubble_received_light_dark.xml b/src/main/res/drawable/message_bubble_received_light_dark.xml
new file mode 100644
index 000000000..b5c38d7e9
--- /dev/null
+++ b/src/main/res/drawable/message_bubble_received_light_dark.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <corners
+ android:topLeftRadius="0dp"
+ android:topRightRadius="5dp"
+ android:bottomRightRadius="5dp"
+ android:bottomLeftRadius="5dp">
+ </corners>
+ <padding
+ android:bottom="2dp"
+ android:left="6dp"
+ android:right="6dp"
+ android:top="2dp" />
+ <stroke
+ android:width="1dp"
+ android:color="@color/grey800">
+ </stroke>
+ <solid
+ android:color="@color/darkwhite">
+ </solid>
+</shape> \ No newline at end of file
diff --git a/src/main/res/drawable/message_bubble_received_warning.xml b/src/main/res/drawable/message_bubble_received_warning.xml
index 22959c88a..b3bf6d451 100644
--- a/src/main/res/drawable/message_bubble_received_warning.xml
+++ b/src/main/res/drawable/message_bubble_received_warning.xml
@@ -13,9 +13,9 @@
android:top="4dp" />
<stroke
android:width="1dp"
- android:color="?attr/color_border">
+ android:color="@color/grey500">
</stroke>
<solid
- android:color="?attr/color_bubble_warning">
+ android:color="@color/lightred">
</solid>
</shape> \ No newline at end of file
diff --git a/src/main/res/drawable/message_bubble_received_warning_dark.xml b/src/main/res/drawable/message_bubble_received_warning_dark.xml
new file mode 100644
index 000000000..8681a3d9f
--- /dev/null
+++ b/src/main/res/drawable/message_bubble_received_warning_dark.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <corners
+ android:topLeftRadius="0dp"
+ android:topRightRadius="5dp"
+ android:bottomRightRadius="5dp"
+ android:bottomLeftRadius="5dp">
+ </corners>
+ <padding
+ android:bottom="4dp"
+ android:left="6dp"
+ android:right="6dp"
+ android:top="4dp" />
+ <stroke
+ android:width="1dp"
+ android:color="@color/grey800">
+ </stroke>
+ <solid
+ android:color="@color/darkred">
+ </solid>
+</shape> \ No newline at end of file
diff --git a/src/main/res/drawable/message_bubble_sent_blue.xml b/src/main/res/drawable/message_bubble_sent_blue.xml
index 2613296c6..1ee3ad0c8 100644
--- a/src/main/res/drawable/message_bubble_sent_blue.xml
+++ b/src/main/res/drawable/message_bubble_sent_blue.xml
@@ -13,9 +13,9 @@
android:top="4dp" />
<stroke
android:width="1dp"
- android:color="?attr/color_border">
+ android:color="@color/grey500">
</stroke>
<solid
- android:color="?attr/color_bubble_blue">
+ android:color="@color/lightblue">
</solid>
</shape> \ No newline at end of file
diff --git a/src/main/res/drawable/message_bubble_sent_blue_dark.xml b/src/main/res/drawable/message_bubble_sent_blue_dark.xml
new file mode 100644
index 000000000..6257e0078
--- /dev/null
+++ b/src/main/res/drawable/message_bubble_sent_blue_dark.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <corners
+ android:topLeftRadius="5dp"
+ android:topRightRadius="5dp"
+ android:bottomRightRadius="0dp"
+ android:bottomLeftRadius="5dp">
+ </corners>
+ <padding
+ android:bottom="4dp"
+ android:left="6dp"
+ android:right="6dp"
+ android:top="4dp" />
+ <stroke
+ android:width="1dp"
+ android:color="@color/grey800">
+ </stroke>
+ <solid
+ android:color="@color/darkblue">
+ </solid>
+</shape> \ No newline at end of file
diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml
index 98065a8f6..2b57ae3b6 100644
--- a/src/main/res/values/themes.xml
+++ b/src/main/res/values/themes.xml
@@ -26,7 +26,7 @@
<item name="color_bubble_date">@color/lightgreen</item>
<item name="color_bubble_warning">@color/lightred</item>
- <item name="color_border">@color/grey500</item>
+ <item name="color_border">@color/grey800</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:actionModeBackground">@color/accent</item>