diff --git a/build.gradle b/build.gradle
index 908b80c17..2540a7836 100644
--- a/build.gradle
+++ b/build.gradle
@@ -74,7 +74,7 @@ dependencies {
implementation 'org.hsluv:hsluv:0.2'
implementation 'org.conscrypt:conscrypt-android:2.5.2'
implementation 'me.drakeet.support:toastcompat:1.1.0'
- implementation "com.leinardi.android:speed-dial:3.2.0"
+ implementation "com.leinardi.android:speed-dial:3.3.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
diff --git a/src/conversations/AndroidManifest.xml b/src/conversations/AndroidManifest.xml
index 87c925fe6..5b111101e 100644
--- a/src/conversations/AndroidManifest.xml
+++ b/src/conversations/AndroidManifest.xml
@@ -5,6 +5,7 @@
share());
if (bundle != null && bundle.containsKey("invite")) {
this.easyOnboardingInvite = bundle.getParcelable("invite");
@@ -65,11 +69,11 @@ public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOn
}
private void share() {
- final String shareText = getString(
- R.string.easy_invite_share_text,
- easyOnboardingInvite.getDomain(),
- easyOnboardingInvite.getShareableLink()
- );
+ final String shareText =
+ getString(
+ R.string.easy_invite_share_text,
+ easyOnboardingInvite.getDomain(),
+ easyOnboardingInvite.getShareableLink());
final Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, shareText);
@@ -95,16 +99,47 @@ public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOn
private void showInvite(final EasyOnboardingInvite invite) {
this.binding.inProgress.setVisibility(View.GONE);
this.binding.invite.setVisibility(View.VISIBLE);
- this.binding.tapToShare.setText(getString(R.string.tap_share_button_send_invite, invite.getDomain()));
+ this.binding.tapToShare.setText(
+ getString(R.string.tap_share_button_send_invite, invite.getDomain()));
final Point size = new Point();
getWindowManager().getDefaultDisplay().getSize(size);
final int width = Math.min(size.x, size.y);
- final Bitmap bitmap = BarcodeProvider.create2dBarcodeBitmap(invite.getShareableLink(), width);
+ final boolean nightMode =
+ (this.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK)
+ == Configuration.UI_MODE_NIGHT_YES;
+ final int black;
+ final int white;
+ if (nightMode) {
+ black =
+ MaterialColors.getColor(
+ this,
+ com.google.android.material.R.attr.colorSurface,
+ "No surface color configured");
+ white =
+ MaterialColors.getColor(
+ this,
+ com.google.android.material.R.attr.colorSurfaceInverse,
+ "No inverse surface color configured");
+ } else {
+ black =
+ MaterialColors.getColor(
+ this,
+ com.google.android.material.R.attr.colorSurfaceInverse,
+ "No inverse surface color configured");
+ white =
+ MaterialColors.getColor(
+ this,
+ com.google.android.material.R.attr.colorSurface,
+ "No surface color configured");
+ }
+ final Bitmap bitmap =
+ BarcodeProvider.create2dBarcodeBitmap(
+ invite.getShareableLink(), width, black, white);
binding.qrCode.setImageBitmap(bitmap);
}
@Override
- public void onSaveInstanceState(Bundle bundle) {
+ public void onSaveInstanceState(@NonNull Bundle bundle) {
super.onSaveInstanceState(bundle);
if (easyOnboardingInvite != null) {
bundle.putParcelable("invite", easyOnboardingInvite);
@@ -141,11 +176,12 @@ public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOn
@Override
public void inviteRequestFailed(final String message) {
- runOnUiThread(() -> {
- if (!Strings.isNullOrEmpty(message)) {
- Toast.makeText(this, message, Toast.LENGTH_LONG).show();
- }
- finish();
- });
+ runOnUiThread(
+ () -> {
+ if (!Strings.isNullOrEmpty(message)) {
+ Toast.makeText(this, message, Toast.LENGTH_LONG).show();
+ }
+ finish();
+ });
}
}
diff --git a/src/conversations/java/eu/siacs/conversations/ui/ImportBackupActivity.java b/src/conversations/java/eu/siacs/conversations/ui/ImportBackupActivity.java
index ed998677b..1f1040c09 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/ImportBackupActivity.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/ImportBackupActivity.java
@@ -18,6 +18,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import java.io.IOException;
@@ -31,7 +32,6 @@ import eu.siacs.conversations.services.ImportBackupService;
import eu.siacs.conversations.ui.adapter.BackupFileAdapter;
import eu.siacs.conversations.ui.util.SettingsUtils;
import eu.siacs.conversations.utils.BackupFileHeader;
-import eu.siacs.conversations.utils.ThemeHelper;
public class ImportBackupActivity extends ActionBarActivity implements ServiceConnection, ImportBackupService.OnBackupFilesLoaded, BackupFileAdapter.OnItemClickedListener, ImportBackupService.OnBackupProcessed {
@@ -46,22 +46,15 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo
@Override
protected void onCreate(final Bundle savedInstanceState) {
- this.mTheme = ThemeHelper.find(this);
- setTheme(this.mTheme);
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_import_backup);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
setLoadingState(savedInstanceState != null && savedInstanceState.getBoolean("loading_state", false));
this.backupFileAdapter = new BackupFileAdapter();
this.binding.list.setAdapter(this.backupFileAdapter);
this.backupFileAdapter.setOnItemClickedListener(this);
}
-
- @Override
- protected void onResume(){
- super.onResume();
- SettingsUtils.applyScreenshotPreventionSetting(this);
- }
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
@@ -80,12 +73,7 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo
@Override
public void onStart() {
super.onStart();
- final int theme = ThemeHelper.find(this);
- if (this.mTheme != theme) {
- recreate();
- } else {
- bindService(new Intent(this, ImportBackupService.class), this, Context.BIND_AUTO_CREATE);
- }
+ bindService(new Intent(this, ImportBackupService.class), this, Context.BIND_AUTO_CREATE);
final Intent intent = getIntent();
if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction()) && !this.mLoadingState) {
Uri uri = intent.getData();
@@ -146,7 +134,7 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo
final DialogEnterPasswordBinding enterPasswordBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.dialog_enter_password, null, false);
Log.d(Config.LOGTAG, "attempting to import " + backupFile.getUri());
enterPasswordBinding.explain.setText(getString(R.string.enter_password_to_restore, backupFile.getHeader().getJid().toString()));
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setView(enterPasswordBinding.getRoot());
builder.setTitle(R.string.enter_password);
builder.setNegativeButton(R.string.cancel, (dialog, which) -> {
@@ -186,6 +174,7 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo
binding.coordinator.setVisibility(loadingState ? View.GONE : View.VISIBLE);
binding.inProgress.setVisibility(loadingState ? View.VISIBLE : View.GONE);
setTitle(loadingState ? R.string.restoring_backup : R.string.restore_backup);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
configureActionBar(getSupportActionBar(), !loadingState);
this.mLoadingState = loadingState;
invalidateOptionsMenu();
diff --git a/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java b/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java
index 38761befd..5a301f769 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java
@@ -10,45 +10,32 @@ import android.widget.Toast;
import androidx.databinding.DataBindingUtil;
-import java.security.SecureRandom;
-
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
-import eu.siacs.conversations.databinding.MagicCreateBinding;
+import eu.siacs.conversations.databinding.ActivityMagicCreateBinding;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.utils.InstallReferrerUtils;
import eu.siacs.conversations.xmpp.Jid;
+import java.security.SecureRandom;
+
public class MagicCreateActivity extends XmppActivity implements TextWatcher {
public static final String EXTRA_DOMAIN = "domain";
public static final String EXTRA_PRE_AUTH = "pre_auth";
public static final String EXTRA_USERNAME = "username";
- private MagicCreateBinding binding;
+ private ActivityMagicCreateBinding binding;
private String domain;
private String username;
private String preAuth;
@Override
- protected void refreshUiReal() {
-
- }
+ protected void refreshUiReal() {}
@Override
- void onBackendConnected() {
-
- }
-
- @Override
- public void onStart() {
- super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- }
- }
+ void onBackendConnected() {}
@Override
protected void onCreate(final Bundle savedInstanceState) {
@@ -60,7 +47,8 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
super.onCreate(savedInstanceState);
- this.binding = DataBindingUtil.setContentView(this, R.layout.magic_create);
+ this.binding = DataBindingUtil.setContentView(this, R.layout.activity_magic_create);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(this.binding.toolbar);
configureActionBar(getSupportActionBar(), this.domain == null);
if (username != null && domain != null) {
@@ -72,51 +60,64 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
} else if (domain != null) {
binding.instructions.setText(getString(R.string.magic_create_text_on_x, domain));
}
- binding.createAccount.setOnClickListener(v -> {
- try {
- final String username = binding.username.getText().toString();
- final Jid jid;
- final boolean fixedUsername;
- if (this.domain != null && this.username != null) {
- fixedUsername = true;
- jid = Jid.ofLocalAndDomainEscaped(this.username, this.domain);
- } else if (this.domain != null) {
- fixedUsername = false;
- jid = Jid.ofLocalAndDomainEscaped(username, this.domain);
- } else {
- fixedUsername = false;
- jid = Jid.ofLocalAndDomainEscaped(username, Config.MAGIC_CREATE_DOMAIN);
- }
- if (!jid.getEscapedLocal().equals(jid.getLocal()) || (this.username == null && username.length() < 3)) {
- binding.username.setError(getString(R.string.invalid_username));
- binding.username.requestFocus();
- } else {
- binding.username.setError(null);
- Account account = xmppConnectionService.findAccountByJid(jid);
- if (account == null) {
- account = new Account(jid, CryptoHelper.createPassword(new SecureRandom()));
- account.setOption(Account.OPTION_REGISTER, true);
- account.setOption(Account.OPTION_DISABLED, true);
- account.setOption(Account.OPTION_MAGIC_CREATE, true);
- account.setOption(Account.OPTION_FIXED_USERNAME, fixedUsername);
- if (this.preAuth != null) {
- account.setKey(Account.KEY_PRE_AUTH_REGISTRATION_TOKEN, this.preAuth);
+ binding.createAccount.setOnClickListener(
+ v -> {
+ try {
+ final String username = binding.username.getText().toString();
+ final Jid jid;
+ final boolean fixedUsername;
+ if (this.domain != null && this.username != null) {
+ fixedUsername = true;
+ jid = Jid.ofLocalAndDomainEscaped(this.username, this.domain);
+ } else if (this.domain != null) {
+ fixedUsername = false;
+ jid = Jid.ofLocalAndDomainEscaped(username, this.domain);
+ } else {
+ fixedUsername = false;
+ jid = Jid.ofLocalAndDomainEscaped(username, Config.MAGIC_CREATE_DOMAIN);
}
- xmppConnectionService.createAccount(account);
+ if (!jid.getEscapedLocal().equals(jid.getLocal())
+ || (this.username == null && username.length() < 3)) {
+ binding.usernameLayout.setError(getString(R.string.invalid_username));
+ binding.username.requestFocus();
+ } else {
+ binding.usernameLayout.setError(null);
+ Account account = xmppConnectionService.findAccountByJid(jid);
+ if (account == null) {
+ account =
+ new Account(
+ jid,
+ CryptoHelper.createPassword(new SecureRandom()));
+ account.setOption(Account.OPTION_REGISTER, true);
+ account.setOption(Account.OPTION_DISABLED, true);
+ account.setOption(Account.OPTION_MAGIC_CREATE, true);
+ account.setOption(Account.OPTION_FIXED_USERNAME, fixedUsername);
+ if (this.preAuth != null) {
+ account.setKey(
+ Account.KEY_PRE_AUTH_REGISTRATION_TOKEN, this.preAuth);
+ }
+ xmppConnectionService.createAccount(account);
+ }
+ Intent intent =
+ new Intent(MagicCreateActivity.this, EditAccountActivity.class);
+ intent.putExtra("jid", account.getJid().asBareJid().toString());
+ intent.putExtra("init", true);
+ intent.setFlags(
+ Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ Toast.makeText(
+ MagicCreateActivity.this,
+ R.string.secure_password_generated,
+ Toast.LENGTH_SHORT)
+ .show();
+ StartConversationActivity.addInviteUri(intent, getIntent());
+ startActivity(intent);
+ }
+ } catch (final IllegalArgumentException e) {
+ binding.usernameLayout.setError(getString(R.string.invalid_username));
+ binding.username.requestFocus();
}
- Intent intent = new Intent(MagicCreateActivity.this, EditAccountActivity.class);
- intent.putExtra("jid", account.getJid().asBareJid().toString());
- intent.putExtra("init", true);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
- Toast.makeText(MagicCreateActivity.this, R.string.secure_password_generated, Toast.LENGTH_SHORT).show();
- StartConversationActivity.addInviteUri(intent, getIntent());
- startActivity(intent);
- }
- } catch (IllegalArgumentException e) {
- binding.username.setError(getString(R.string.invalid_username));
- binding.username.requestFocus();
- }
- });
+ });
binding.username.addTextChangedListener(this);
}
@@ -127,14 +128,10 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
}
@Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
- }
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
-
- }
+ public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(final Editable s) {
@@ -153,8 +150,10 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
} else {
jid = Jid.ofLocalAndDomainEscaped(username, this.domain);
}
- binding.fullJid.setText(getString(R.string.your_full_jid_will_be, jid.toEscapedString()));
- } catch (IllegalArgumentException e) {
+ binding.fullJid.setText(
+ getString(R.string.your_full_jid_will_be, jid.toEscapedString()));
+ binding.usernameLayout.setError(null);
+ } catch (final IllegalArgumentException e) {
binding.fullJid.setVisibility(View.INVISIBLE);
}
}
diff --git a/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java
index 4446acefe..1a04210dd 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java
@@ -1,10 +1,14 @@
package eu.siacs.conversations.ui;
+import static eu.siacs.conversations.utils.PermissionUtils.allGranted;
+import static eu.siacs.conversations.utils.PermissionUtils.writeGranted;
+
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.security.KeyChain;
import android.security.KeyChainAliasCallback;
+import android.util.Log;
import android.util.Pair;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -12,23 +16,17 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView.AdapterContextMenuInfo;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.ListView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
-import androidx.appcompat.app.AlertDialog;
+import androidx.databinding.DataBindingUtil;
-import org.openintents.openpgp.util.OpenPgpApi;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
+import com.google.common.base.Strings;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.databinding.ActivityManageAccountsBinding;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
@@ -37,10 +35,17 @@ import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.XmppConnection;
-import static eu.siacs.conversations.utils.PermissionUtils.allGranted;
-import static eu.siacs.conversations.utils.PermissionUtils.writeGranted;
+import org.openintents.openpgp.util.OpenPgpApi;
-public class ManageAccountActivity extends XmppActivity implements OnAccountUpdate, KeyChainAliasCallback, XmppConnectionService.OnAccountCreated, AccountAdapter.OnTglAccountState {
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class ManageAccountActivity extends XmppActivity
+ implements OnAccountUpdate,
+ KeyChainAliasCallback,
+ XmppConnectionService.OnAccountCreated,
+ AccountAdapter.OnTglAccountState {
private final String STATE_SELECTED_ACCOUNT = "selected_account";
@@ -50,7 +55,6 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
protected Jid selectedAccountJid = null;
protected final List accountList = new ArrayList<>();
- protected ListView accountListView;
protected AccountAdapter mAccountAdapter;
protected AtomicBoolean mInvokedAddAccount = new AtomicBoolean(false);
@@ -67,7 +71,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
accountList.clear();
accountList.addAll(xmppConnectionService.getAccounts());
}
- ActionBar actionBar = getSupportActionBar();
+ final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(this.accountList.size() > 0);
actionBar.setDisplayHomeAsUpEnabled(this.accountList.size() > 0);
@@ -81,8 +85,11 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_manage_accounts);
- setSupportActionBar(findViewById(R.id.toolbar));
+ ActivityManageAccountsBinding binding =
+ DataBindingUtil.setContentView(this, R.layout.activity_manage_accounts);
+
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
+ setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
if (savedInstanceState != null) {
String jid = savedInstanceState.getString(STATE_SELECTED_ACCOUNT);
@@ -95,26 +102,19 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
}
}
- accountListView = findViewById(R.id.account_list);
this.mAccountAdapter = new AccountAdapter(this, accountList);
- accountListView.setAdapter(this.mAccountAdapter);
- accountListView.setOnItemClickListener((arg0, view, position, arg3) -> switchToAccount(accountList.get(position)));
- registerForContextMenu(accountListView);
+ binding.accountList.setAdapter(this.mAccountAdapter);
+ binding.accountList.setOnItemClickListener(
+ (arg0, view, position, arg3) -> switchToAccount(accountList.get(position)));
+ registerForContextMenu(binding.accountList);
}
- @Override
- protected void onStart() {
- super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- }
- }
@Override
- public void onSaveInstanceState(final Bundle savedInstanceState) {
+ public void onSaveInstanceState(@NonNull final Bundle savedInstanceState) {
if (selectedAccount != null) {
- savedInstanceState.putString(STATE_SELECTED_ACCOUNT, selectedAccount.getJid().asBareJid().toEscapedString());
+ savedInstanceState.putString(
+ STATE_SELECTED_ACCOUNT, selectedAccount.getJid().asBareJid().toEscapedString());
}
super.onSaveInstanceState(savedInstanceState);
}
@@ -122,8 +122,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
- ManageAccountActivity.this.getMenuInflater().inflate(
- R.menu.manageaccounts_context, menu);
+ ManageAccountActivity.this.getMenuInflater().inflate(R.menu.manageaccounts_context, menu);
AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;
this.selectedAccount = accountList.get(acmi.position);
if (this.selectedAccount.isEnabled()) {
@@ -144,9 +143,10 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
}
refreshUiReal();
if (this.mPostponedActivityResult != null) {
- this.onActivityResult(mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second);
+ this.onActivityResult(
+ mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second);
}
- if (Config.X509_VERIFICATION && this.accountList.size() == 0) {
+ if (Config.X509_VERIFICATION && this.accountList.isEmpty()) {
if (mInvokedAddAccount.compareAndSet(false, true)) {
addAccountFromKey();
}
@@ -233,9 +233,9 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
return super.onOptionsItemSelected(item);
}
-
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ public void onRequestPermissionsResult(
+ int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (grantResults.length > 0) {
if (allGranted(grantResults)) {
@@ -258,13 +258,14 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
@Override
public boolean onNavigateUp() {
if (xmppConnectionService.getConversations().size() == 0) {
- Intent contactsIntent = new Intent(this,
- StartConversationActivity.class);
+ Intent contactsIntent = new Intent(this, StartConversationActivity.class);
contactsIntent.setFlags(
// if activity exists in stack, pop the stack and go back to it
- Intent.FLAG_ACTIVITY_CLEAR_TOP |
+ Intent.FLAG_ACTIVITY_CLEAR_TOP
+ |
// otherwise, make a new task for it
- Intent.FLAG_ACTIVITY_NEW_TASK |
+ Intent.FLAG_ACTIVITY_NEW_TASK
+ |
// don't use the new activity animation; finish
// animation runs instead
Intent.FLAG_ACTIVITY_NO_ANIMATION);
@@ -286,16 +287,17 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
}
private void addAccountFromKey() {
+ Log.d(Config.LOGTAG, "add account from key");
try {
KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
- } catch (ActivityNotFoundException e) {
- Toast.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG).show();
+ } catch (final ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG)
+ .show();
}
}
private void publishAvatar(Account account) {
- Intent intent = new Intent(getApplicationContext(),
- PublishProfilePictureActivity.class);
+ Intent intent = new Intent(getApplicationContext(), PublishProfilePictureActivity.class);
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toEscapedString());
startActivity(intent);
}
@@ -377,7 +379,6 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
}
}
-
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@@ -385,7 +386,8 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
if (xmppConnectionServiceBound) {
if (requestCode == REQUEST_CHOOSE_PGP_ID) {
if (data.getExtras().containsKey(OpenPgpApi.EXTRA_SIGN_KEY_ID)) {
- selectedAccount.setPgpSignId(data.getExtras().getLong(OpenPgpApi.EXTRA_SIGN_KEY_ID));
+ selectedAccount.setPgpSignId(
+ data.getExtras().getLong(OpenPgpApi.EXTRA_SIGN_KEY_ID));
announcePgp(selectedAccount, null, null, onOpenPGPKeyPublished);
} else {
choosePgpSignId(selectedAccount);
@@ -402,9 +404,17 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
@Override
public void alias(final String alias) {
- if (alias != null) {
- xmppConnectionService.createAccountFromKey(alias, this);
+ if (Strings.isNullOrEmpty(alias)) {
+ runOnUiThread(
+ () ->
+ Toast.makeText(
+ this,
+ R.string.no_certificate_selected,
+ Toast.LENGTH_LONG)
+ .show());
+ return;
}
+ xmppConnectionService.createAccountFromKey(alias, this);
}
@Override
@@ -417,6 +427,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
@Override
public void informUser(final int r) {
- runOnUiThread(() -> Toast.makeText(ManageAccountActivity.this, r, Toast.LENGTH_LONG).show());
+ runOnUiThread(
+ () -> Toast.makeText(ManageAccountActivity.this, r, Toast.LENGTH_LONG).show());
}
}
diff --git a/src/conversations/java/eu/siacs/conversations/ui/PickServerActivity.java b/src/conversations/java/eu/siacs/conversations/ui/PickServerActivity.java
index 06320d33d..cbdd21b36 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/PickServerActivity.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/PickServerActivity.java
@@ -26,15 +26,6 @@ public class PickServerActivity extends XmppActivity {
}
- @Override
- public void onStart() {
- super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- }
- }
-
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
@@ -53,7 +44,8 @@ public class PickServerActivity extends XmppActivity {
}
@Override
- public void onNewIntent(Intent intent) {
+ public void onNewIntent(final Intent intent) {
+ super.onNewIntent(intent);
if (intent != null) {
setIntent(intent);
}
@@ -66,6 +58,7 @@ public class PickServerActivity extends XmppActivity {
}
super.onCreate(savedInstanceState);
ActivityPickServerBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_pick_server);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
binding.useCim.setOnClickListener(v -> {
@@ -81,7 +74,7 @@ public class PickServerActivity extends XmppActivity {
if (accounts.size() == 1) {
intent.putExtra("jid", accounts.get(0).getJid().asBareJid().toString());
intent.putExtra("init", true);
- } else if (accounts.size() >= 1) {
+ } else if (!accounts.isEmpty()) {
intent = new Intent(this, ManageAccountActivity.class);
}
addInviteUri(intent);
diff --git a/src/conversations/java/eu/siacs/conversations/ui/ShareViaAccountActivity.java b/src/conversations/java/eu/siacs/conversations/ui/ShareViaAccountActivity.java
index 762dfbb42..66ed355c4 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/ShareViaAccountActivity.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/ShareViaAccountActivity.java
@@ -56,15 +56,6 @@ public class ShareViaAccountActivity extends XmppActivity {
});
}
- @Override
- protected void onStart() {
- super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- }
- }
-
@Override
void onBackendConnected() {
final int numAccounts = xmppConnectionService.getAccounts().size();
diff --git a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java
index d61c64a9c..24528fc16 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java
@@ -34,7 +34,10 @@ import eu.siacs.conversations.xmpp.Jid;
import static eu.siacs.conversations.utils.PermissionUtils.allGranted;
import static eu.siacs.conversations.utils.PermissionUtils.writeGranted;
-public class WelcomeActivity extends XmppActivity implements XmppConnectionService.OnAccountCreated, KeyChainAliasCallback {
+import com.google.common.base.Strings;
+
+public class WelcomeActivity extends XmppActivity
+ implements XmppConnectionService.OnAccountCreated, KeyChainAliasCallback {
private static final int REQUEST_IMPORT_BACKUP = 0x63fb;
@@ -66,7 +69,8 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
final Intent intent;
if (xmppUri.isAction(XmppUri.ACTION_REGISTER)) {
intent = SignupUtils.getTokenRegistrationIntent(this, jid, preAuth);
- } else if (xmppUri.isAction(XmppUri.ACTION_ROSTER) && "y".equals(xmppUri.getParameter(XmppUri.PARAMETER_IBR))) {
+ } else if (xmppUri.isAction(XmppUri.ACTION_ROSTER)
+ && "y".equals(xmppUri.getParameter(XmppUri.PARAMETER_IBR))) {
intent = SignupUtils.getTokenRegistrationIntent(this, jid.getDomain(), preAuth);
intent.putExtra(StartConversationActivity.EXTRA_INVITE_URI, xmppUri.toString());
} else {
@@ -81,22 +85,14 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
}
@Override
- protected void refreshUiReal() {
-
- }
+ protected void refreshUiReal() {}
@Override
- void onBackendConnected() {
-
- }
+ void onBackendConnected() {}
@Override
public void onStart() {
super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- }
new InstallReferrerUtils(this);
}
@@ -119,42 +115,44 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
super.onCreate(savedInstanceState);
- ActivityWelcomeBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_welcome);
+ ActivityWelcomeBinding binding =
+ DataBindingUtil.setContentView(this, R.layout.activity_welcome);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar(), false);
- binding.registerNewAccount.setOnClickListener(v -> {
- final Intent intent = new Intent(this, PickServerActivity.class);
- addInviteUri(intent);
- startActivity(intent);
- });
- binding.useExisting.setOnClickListener(v -> {
- final List accounts = xmppConnectionService.getAccounts();
- Intent intent = new Intent(WelcomeActivity.this, EditAccountActivity.class);
- intent.putExtra(EditAccountActivity.EXTRA_FORCE_REGISTER, false);
- if (accounts.size() == 1) {
- intent.putExtra("jid", accounts.get(0).getJid().asBareJid().toString());
- intent.putExtra("init", true);
- } else if (accounts.size() >= 1) {
- intent = new Intent(WelcomeActivity.this, ManageAccountActivity.class);
- }
- addInviteUri(intent);
- startActivity(intent);
- });
-
+ setTitle(null);
+ binding.registerNewAccount.setOnClickListener(
+ v -> {
+ final Intent intent = new Intent(this, PickServerActivity.class);
+ addInviteUri(intent);
+ startActivity(intent);
+ });
+ binding.useExisting.setOnClickListener(
+ v -> {
+ final List accounts = xmppConnectionService.getAccounts();
+ Intent intent = new Intent(this, EditAccountActivity.class);
+ intent.putExtra(EditAccountActivity.EXTRA_FORCE_REGISTER, false);
+ if (accounts.size() == 1) {
+ intent.putExtra("jid", accounts.get(0).getJid().asBareJid().toString());
+ intent.putExtra("init", true);
+ } else if (!accounts.isEmpty()) {
+ intent = new Intent(this, ManageAccountActivity.class);
+ }
+ addInviteUri(intent);
+ startActivity(intent);
+ });
}
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
+ public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.welcome_menu, menu);
final MenuItem scan = menu.findItem(R.id.action_scan_qr_code);
scan.setVisible(Compatibility.hasFeatureCamera(this));
return super.onCreateOptionsMenu(menu);
}
-
-
@Override
- public boolean onOptionsItemSelected(MenuItem item) {
+ public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case R.id.action_import_backup:
if (hasStoragePermission(REQUEST_IMPORT_BACKUP)) {
@@ -174,16 +172,25 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
private void addAccountFromKey() {
try {
KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
- } catch (ActivityNotFoundException e) {
- Toast.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG).show();
+ } catch (final ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG)
+ .show();
}
}
@Override
public void alias(final String alias) {
- if (alias != null) {
- xmppConnectionService.createAccountFromKey(alias, this);
+ if (Strings.isNullOrEmpty(alias)) {
+ runOnUiThread(
+ () ->
+ Toast.makeText(
+ this,
+ R.string.no_certificate_selected,
+ Toast.LENGTH_LONG)
+ .show());
+ return;
}
+ xmppConnectionService.createAccountFromKey(alias, this);
}
@Override
@@ -201,7 +208,8 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
}
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ public void onRequestPermissionsResult(
+ int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
UriHandlerActivity.onRequestPermissionResult(this, requestCode, grantResults);
if (grantResults.length > 0) {
@@ -211,7 +219,8 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
startActivity(new Intent(this, ImportBackupActivity.class));
break;
}
- } else if (Arrays.asList(permissions).contains(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
+ } else if (Arrays.asList(permissions)
+ .contains(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
}
}
@@ -232,5 +241,4 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
to.putExtra(StartConversationActivity.EXTRA_INVITE_URI, this.inviteUri.toString());
}
}
-
}
diff --git a/src/conversations/java/eu/siacs/conversations/ui/adapter/BackupFileAdapter.java b/src/conversations/java/eu/siacs/conversations/ui/adapter/BackupFileAdapter.java
index 9857dcd8a..9f32352ee 100644
--- a/src/conversations/java/eu/siacs/conversations/ui/adapter/BackupFileAdapter.java
+++ b/src/conversations/java/eu/siacs/conversations/ui/adapter/BackupFileAdapter.java
@@ -22,7 +22,7 @@ import java.util.List;
import java.util.concurrent.RejectedExecutionException;
import eu.siacs.conversations.R;
-import eu.siacs.conversations.databinding.AccountRowBinding;
+import eu.siacs.conversations.databinding.ItemAccountBinding;
import eu.siacs.conversations.services.AvatarService;
import eu.siacs.conversations.services.ImportBackupService;
import eu.siacs.conversations.utils.BackupFileHeader;
@@ -39,7 +39,7 @@ public class BackupFileAdapter extends RecyclerView.Adapter(imageView);
DisplayMetrics metrics = imageView.getContext().getResources().getDisplayMetrics();
this.size = ((int) (48 * metrics.density));
@@ -146,8 +146,7 @@ public class BackupFileAdapter extends RecyclerView.Adapter
-
+
-
+
+
+
+
+
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:layout_marginHorizontal="16dp"
+ android:text="@string/share" />
diff --git a/src/conversations/res/layout/activity_import_backup.xml b/src/conversations/res/layout/activity_import_backup.xml
index 5435c0f72..7e7c9efc4 100644
--- a/src/conversations/res/layout/activity_import_backup.xml
+++ b/src/conversations/res/layout/activity_import_backup.xml
@@ -2,22 +2,30 @@
-
-
+
+
+
+
+
+
+ android:gravity="center"
+ android:visibility="gone">
+
-
+ android:layout_height="match_parent">
diff --git a/src/conversations/res/layout/magic_create.xml b/src/conversations/res/layout/activity_magic_create.xml
similarity index 64%
rename from src/conversations/res/layout/magic_create.xml
rename to src/conversations/res/layout/activity_magic_create.xml
index f6e0436a5..923bd8113 100644
--- a/src/conversations/res/layout/magic_create.xml
+++ b/src/conversations/res/layout/activity_magic_create.xml
@@ -7,7 +7,18 @@
android:layout_height="match_parent"
android:orientation="vertical">
-
+
+
+
+
+
+ android:layout_height="wrap_content">
+ android:textAppearance="?textAppearanceTitleLarge" />
+ android:textAppearance="?textAppearanceBodyMedium" />
-
+ android:hint="@string/username_hint">
+
+
+
+ android:layout_gravity="end"
+ android:text="@string/next" />
+ android:layout_alignParentStart="true">
-
+
+
+
+
+
+ android:layout_height="wrap_content">
+ android:textAppearance="?textAppearanceTitleLarge" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:layout_gravity="end"
+ android:text="@string/use_conversations.im" />
+ android:layout_gravity="end"
+ android:text="@string/use_own_provider" />
+ android:layout_alignParentStart="true">
-
+
+
+
+
+
+ android:layout_height="wrap_content">
+ android:textAppearance="?textAppearanceTitleLarge" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:layout_gravity="end"
+ android:text="@string/create_new_account" />
+ android:layout_gravity="end"
+ android:text="@string/i_already_have_an_account" />
+ android:layout_alignParentStart="true">
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ app:endIconMode="password_toggle">
-
+
diff --git a/src/conversations/res/menu/easy_onboarding_invite.xml b/src/conversations/res/menu/easy_onboarding_invite.xml
index 0e086b515..89c8ff179 100644
--- a/src/conversations/res/menu/easy_onboarding_invite.xml
+++ b/src/conversations/res/menu/easy_onboarding_invite.xml
@@ -4,7 +4,7 @@
\ No newline at end of file
diff --git a/src/conversations/res/menu/manageaccounts.xml b/src/conversations/res/menu/manageaccounts.xml
index 5a26beaf9..583f91f6f 100644
--- a/src/conversations/res/menu/manageaccounts.xml
+++ b/src/conversations/res/menu/manageaccounts.xml
@@ -1,32 +1,31 @@
\ No newline at end of file
diff --git a/src/conversations/res/menu/welcome_menu.xml b/src/conversations/res/menu/welcome_menu.xml
index f07a2b91e..9757cd935 100644
--- a/src/conversations/res/menu/welcome_menu.xml
+++ b/src/conversations/res/menu/welcome_menu.xml
@@ -3,7 +3,7 @@
-
+
+ #006E1C
+ #FFFFFF
+ #98F994
+ #002204
+ #52634F
+ #FFFFFF
+ #D5E8CF
+ #111F0F
+ #38656A
+ #FFFFFF
+ #BCEBF0
+ #002023
+ #BA1A1A
+ #FFDAD6
+ #FFFFFF
+ #410002
+ #FCFDF6
+ #1A1C19
+ #FCFDF6
+ #1A1C19
+ #DEE5D8
+ #424940
+ #72796F
+ #F0F1EB
+ #2F312D
+ #7DDC7A
+ #000000
+ #006E1C
+ #C2C9BD
+ #000000
+ #7DDC7A
+ #00390A
+ #005313
+ #98F994
+ #BACCB3
+ #253423
+ #3B4B38
+ #D5E8CF
+ #A0CFD4
+ #00363B
+ #1F4D52
+ #BCEBF0
+ #FFB4AB
+ #93000A
+ #690005
+ #FFDAD6
+ #1A1C19
+ #E2E3DD
+ #1A1C19
+ #E2E3DD
+ #424940
+ #C2C9BD
+ #8C9388
+ #1A1C19
+ #E2E3DD
+ #006E1C
+ #000000
+ #7DDC7A
+ #424940
+ #000000
+
\ No newline at end of file
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index b6e8a6457..624ff4640 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -47,7 +47,7 @@
-
+
-
+
@@ -180,14 +182,14 @@
+ android:theme="@style/Theme.Conversations3.Dialog" />
+ android:theme="@style/Theme.Conversations3.SplashScreen">
@@ -202,7 +204,7 @@
+ android:label="@string/title_activity_choose_contact"/>
+ android:label="@string/title_activity_block_list"/>
@@ -351,7 +353,7 @@
+ android:label="@string/media_browser"/>
+ android:label="@string/group_chat_members"/>
+ android:label="@string/discover_channels"/>
isDynamicColorsDesired(activity))
+ .build();
+ DynamicColors.applyToActivitiesIfAvailable(this, dynamicColorsOptions);
+ }
+
+ public static int getDesiredNightMode(final Context context) {
+ final var sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
+ if (sharedPreferences == null) {
+ return AppCompatDelegate.getDefaultNightMode();
+ }
+ return getDesiredNightMode(context, sharedPreferences);
+ }
+
+ public static boolean isDynamicColorsDesired(final Context context) {
+ final var preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ return preferences.getBoolean("dynamic_colors", false);
+ }
+
+ private static int getDesiredNightMode(
+ final Context context, final SharedPreferences sharedPreferences) {
+ final String theme =
+ sharedPreferences.getString("theme", context.getString(R.string.theme));
+ return getDesiredNightMode(theme);
+ }
+
+ public static int getDesiredNightMode(final String theme) {
+ if ("automatic".equals(theme)) {
+ return AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
+ } else if ("light".equals(theme)) {
+ return AppCompatDelegate.MODE_NIGHT_NO;
+ } else {
+ return AppCompatDelegate.MODE_NIGHT_YES;
+ }
+ }
+}
diff --git a/src/main/java/eu/siacs/conversations/entities/RtpSessionStatus.java b/src/main/java/eu/siacs/conversations/entities/RtpSessionStatus.java
index 87a2e0601..d32d585fd 100644
--- a/src/main/java/eu/siacs/conversations/entities/RtpSessionStatus.java
+++ b/src/main/java/eu/siacs/conversations/entities/RtpSessionStatus.java
@@ -41,18 +41,18 @@ public class RtpSessionStatus {
return new RtpSessionStatus(made, duration);
}
- public static @DrawableRes int getDrawable(final boolean received, final boolean successful, final boolean darkTheme) {
+ public static @DrawableRes int getDrawable(final boolean received, final boolean successful) {
if (received) {
if (successful) {
- return darkTheme ? R.drawable.ic_call_received_white_18dp : R.drawable.ic_call_received_black_18dp;
+ return R.drawable.ic_call_received_24dp;
} else {
- return darkTheme ? R.drawable.ic_call_missed_white_18dp : R.drawable.ic_call_missed_black_18dp;
+ return R.drawable.ic_call_missed_24db;
}
} else {
if (successful) {
- return darkTheme ? R.drawable.ic_call_made_white_18dp : R.drawable.ic_call_made_black_18dp;
+ return R.drawable.ic_call_made_24dp;
} else {
- return darkTheme ? R.drawable.ic_call_missed_outgoing_white_18dp : R.drawable.ic_call_missed_outgoing_black_18dp;
+ return R.drawable.ic_call_missed_outgoing_24dp;
}
}
}
diff --git a/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java b/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java
index 582998aa2..497ed52a7 100644
--- a/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java
+++ b/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java
@@ -48,7 +48,11 @@ public class BarcodeProvider extends ContentProvider implements ServiceConnectio
return Uri.parse("content://" + packageId + AUTHORITY + "/" + account.getJid().asBareJid() + ".png");
}
- public static Bitmap create2dBarcodeBitmap(String input, int size) {
+ public static Bitmap create2dBarcodeBitmap(final String input, final int size) {
+ return create2dBarcodeBitmap(input, size, Color.BLACK, Color.WHITE);
+ }
+
+ public static Bitmap create2dBarcodeBitmap(final String input, final int size, final int black, final int white) {
try {
final QRCodeWriter barcodeWriter = new QRCodeWriter();
final Hashtable hints = new Hashtable<>();
@@ -61,14 +65,14 @@ public class BarcodeProvider extends ContentProvider implements ServiceConnectio
for (int y = 0; y < height; y++) {
final int offset = y * width;
for (int x = 0; x < width; x++) {
- pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.WHITE;
+ pixels[offset + x] = result.get(x, y) ? black : white;
}
}
final Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
return bitmap;
} catch (final Exception e) {
- e.printStackTrace();
+ Log.e(Config.LOGTAG,"could not generate QR code image",e);
return null;
}
}
diff --git a/src/main/java/eu/siacs/conversations/services/ExportBackupService.java b/src/main/java/eu/siacs/conversations/services/ExportBackupService.java
index 1462b5614..1a7ac070e 100644
--- a/src/main/java/eu/siacs/conversations/services/ExportBackupService.java
+++ b/src/main/java/eu/siacs/conversations/services/ExportBackupService.java
@@ -266,7 +266,7 @@ public class ExportBackupService extends Service {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(getBaseContext(), "backup");
mBuilder.setContentTitle(getString(R.string.notification_create_backup_title))
- .setSmallIcon(R.drawable.ic_archive_white_24dp)
+ .setSmallIcon(R.drawable.ic_archive_24dp)
.setProgress(1, 0, false);
startForeground(NOTIFICATION_ID, mBuilder.build());
int count = 0;
@@ -420,11 +420,11 @@ public class ExportBackupService extends Service {
.getAbsolutePath())))
.setAutoCancel(true)
.setContentIntent(openFolderIntent)
- .setSmallIcon(R.drawable.ic_archive_white_24dp);
+ .setSmallIcon(R.drawable.ic_archive_24dp);
if (shareFilesIntent != null) {
mBuilder.addAction(
- R.drawable.ic_share_white_24dp,
+ R.drawable.ic_share_24dp,
getString(R.string.share_backup_files),
shareFilesIntent);
}
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index e054fe54a..c6763de38 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -475,7 +475,7 @@ public class NotificationService {
new Builder(mXmppConnectionService, "delivery_failed")
.setContentTitle(conversation.getName())
.setAutoCancel(true)
- .setSmallIcon(R.drawable.ic_error_white_24dp)
+ .setSmallIcon(R.drawable.ic_error_24dp)
.setContentText(
mXmppConnectionService
.getResources()
@@ -495,7 +495,7 @@ public class NotificationService {
.getQuantityText(
R.plurals.some_messages_could_not_be_delivered,
1024))
- .setSmallIcon(R.drawable.ic_error_white_24dp)
+ .setSmallIcon(R.drawable.ic_error_24dp)
.setGroup("delivery_failed")
.setGroupSummary(true)
.setAutoCancel(true)
@@ -569,11 +569,11 @@ public class NotificationService {
new NotificationCompat.Builder(
mXmppConnectionService, INCOMING_CALLS_NOTIFICATION_CHANNEL);
if (media.contains(Media.VIDEO)) {
- builder.setSmallIcon(R.drawable.ic_videocam_white_24dp);
+ builder.setSmallIcon(R.drawable.ic_videocam_24dp);
builder.setContentTitle(
mXmppConnectionService.getString(R.string.rtp_state_incoming_video_call));
} else {
- builder.setSmallIcon(R.drawable.ic_call_white_24dp);
+ builder.setSmallIcon(R.drawable.ic_call_24dp);
builder.setContentTitle(
mXmppConnectionService.getString(R.string.rtp_state_incoming_call));
}
@@ -596,7 +596,7 @@ public class NotificationService {
builder.setOngoing(true);
builder.addAction(
new NotificationCompat.Action.Builder(
- R.drawable.ic_call_end_white_48dp,
+ R.drawable.ic_call_end_24dp,
mXmppConnectionService.getString(R.string.dismiss_call),
createCallAction(
id.sessionId,
@@ -605,7 +605,7 @@ public class NotificationService {
.build());
builder.addAction(
new NotificationCompat.Action.Builder(
- R.drawable.ic_call_white_24dp,
+ R.drawable.ic_call_24dp,
mXmppConnectionService.getString(R.string.answer_call),
createPendingRtpSession(
id, RtpSessionActivity.ACTION_ACCEPT_CALL, 103))
@@ -622,7 +622,7 @@ public class NotificationService {
final NotificationCompat.Builder builder =
new NotificationCompat.Builder(mXmppConnectionService, "ongoing_calls");
if (ongoingCall.media.contains(Media.VIDEO)) {
- builder.setSmallIcon(R.drawable.ic_videocam_white_24dp);
+ builder.setSmallIcon(R.drawable.ic_videocam_24dp);
if (ongoingCall.reconnecting) {
builder.setContentTitle(
mXmppConnectionService.getString(R.string.reconnecting_video_call));
@@ -631,7 +631,7 @@ public class NotificationService {
mXmppConnectionService.getString(R.string.ongoing_video_call));
}
} else {
- builder.setSmallIcon(R.drawable.ic_call_white_24dp);
+ builder.setSmallIcon(R.drawable.ic_call_24dp);
if (ongoingCall.reconnecting) {
builder.setContentTitle(
mXmppConnectionService.getString(R.string.reconnecting_call));
@@ -647,7 +647,7 @@ public class NotificationService {
builder.setOngoing(true);
builder.addAction(
new NotificationCompat.Action.Builder(
- R.drawable.ic_call_end_white_48dp,
+ R.drawable.ic_call_end_24dp,
mXmppConnectionService.getString(R.string.hang_up),
createCallAction(
id.sessionId, XmppConnectionService.ACTION_END_CALL, 104))
@@ -826,7 +826,7 @@ public class NotificationService {
}
private void markAsReadIfHasDirectReply(final ArrayList messages) {
- if (messages != null && messages.size() > 0) {
+ if (messages != null && !messages.isEmpty()) {
Message last = messages.get(messages.size() - 1);
if (last.getStatus() != Message.STATUS_RECEIVED) {
if (mXmppConnectionService.markRead((Conversation) last.getConversation(), false)) {
@@ -837,7 +837,8 @@ public class NotificationService {
}
private void setNotificationColor(final Builder mBuilder) {
- mBuilder.setColor(ContextCompat.getColor(mXmppConnectionService, R.color.green600));
+ // TODO can we use themed colors?
+ mBuilder.setColor(ContextCompat.getColor(mXmppConnectionService, R.color.md_theme_light_primary));
}
public void updateNotification() {
@@ -1035,7 +1036,7 @@ public class NotificationService {
if (!publicVersion) {
builder.setContentText(Joiner.on(", ").join(names));
}
- builder.setSmallIcon(R.drawable.ic_call_missed_white_24db);
+ builder.setSmallIcon(R.drawable.ic_call_missed_24db);
builder.setGroupSummary(true);
builder.setGroup(MISSED_CALLS_GROUP);
builder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN);
@@ -1085,7 +1086,7 @@ public class NotificationService {
name));
builder.setContentText(name);
}
- builder.setSmallIcon(R.drawable.ic_call_missed_white_24db);
+ builder.setSmallIcon(R.drawable.ic_call_missed_24db);
builder.setGroup(MISSED_CALLS_GROUP);
builder.setCategory(NotificationCompat.CATEGORY_CALL);
builder.setWhen(info.getLastTime());
@@ -1221,7 +1222,7 @@ public class NotificationService {
PendingIntent markAsReadPendingIntent = createReadPendingIntent(conversation);
NotificationCompat.Action markReadAction =
new NotificationCompat.Action.Builder(
- R.drawable.ic_drafts_white_24dp,
+ R.drawable.ic_mark_chat_read_24dp,
mXmppConnectionService.getString(R.string.mark_as_read),
markAsReadPendingIntent)
.setSemanticAction(
@@ -1232,7 +1233,7 @@ public class NotificationService {
final String lastMessageUuid = Iterables.getLast(messages).getUuid();
final NotificationCompat.Action replyAction =
new NotificationCompat.Action.Builder(
- R.drawable.ic_send_text_offline,
+ R.drawable.ic_send_24dp,
replyLabel,
createReplyIntent(conversation, lastMessageUuid, false))
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_REPLY)
@@ -1241,7 +1242,7 @@ public class NotificationService {
.build();
final NotificationCompat.Action wearReplyAction =
new NotificationCompat.Action.Builder(
- R.drawable.ic_wear_reply,
+ R.drawable.ic_reply_24dp,
replyLabel,
createReplyIntent(conversation, lastMessageUuid, true))
.addRemoteInput(remoteInput)
@@ -1260,7 +1261,7 @@ public class NotificationService {
PendingIntent pendingSnoozeIntent = createSnoozeIntent(conversation);
NotificationCompat.Action snoozeAction =
new NotificationCompat.Action.Builder(
- R.drawable.ic_notifications_paused_white_24dp,
+ R.drawable.ic_notifications_paused_24dp,
label,
pendingSnoozeIntent)
.build();
@@ -1279,7 +1280,7 @@ public class NotificationService {
.getString(R.string.show_location);
NotificationCompat.Action locationAction =
new NotificationCompat.Action.Builder(
- R.drawable.ic_room_white_24dp,
+ R.drawable.ic_location_pin_24dp,
label,
pendingShowLocationIntent)
.build();
@@ -1303,7 +1304,7 @@ public class NotificationService {
createDownloadIntent(firstDownloadableMessage);
NotificationCompat.Action downloadAction =
new NotificationCompat.Action.Builder(
- R.drawable.ic_file_download_white_24dp,
+ R.drawable.ic_download_24dp,
label,
pendingDownloadIntent)
.build();
@@ -1761,21 +1762,21 @@ public class NotificationService {
.setPriority(Notification.PRIORITY_MIN)
.setSmallIcon(
connected > 0
- ? R.drawable.ic_link_white_24dp
- : R.drawable.ic_link_off_white_24dp)
+ ? R.drawable.ic_link_24dp
+ : R.drawable.ic_link_off_24dp)
.setLocalOnly(true);
if (Compatibility.runsTwentySix()) {
mBuilder.setChannelId("foreground");
mBuilder.addAction(
- R.drawable.ic_logout_white_24dp,
+ R.drawable.ic_logout_24dp,
mXmppConnectionService.getString(R.string.log_out),
pendingServiceIntent(
mXmppConnectionService,
XmppConnectionService.ACTION_TEMPORARILY_DISABLE,
87));
mBuilder.addAction(
- R.drawable.ic_notifications_off_white_24dp,
+ R.drawable.ic_notifications_off_24dp,
mXmppConnectionService.getString(R.string.hide_notification),
pendingNotificationSettingsIntent(mXmppConnectionService));
}
@@ -1853,7 +1854,7 @@ public class NotificationService {
}
try {
mBuilder.addAction(
- R.drawable.ic_autorenew_white_24dp,
+ R.drawable.ic_autorenew_24dp,
mXmppConnectionService.getString(R.string.try_again),
pendingServiceIntent(
mXmppConnectionService, XmppConnectionService.ACTION_TRY_AGAIN, 45));
@@ -1871,7 +1872,7 @@ public class NotificationService {
if (torNotAvailable) {
if (TorServiceUtils.isOrbotInstalled(mXmppConnectionService)) {
mBuilder.addAction(
- R.drawable.ic_play_circle_filled_white_48dp,
+ R.drawable.ic_play_circle_24dp,
mXmppConnectionService.getString(R.string.start_orbot),
PendingIntent.getActivity(
mXmppConnectionService,
@@ -1883,7 +1884,7 @@ public class NotificationService {
: PendingIntent.FLAG_UPDATE_CURRENT));
} else {
mBuilder.addAction(
- R.drawable.ic_file_download_white_24dp,
+ R.drawable.ic_download_24dp,
mXmppConnectionService.getString(R.string.install_orbot),
PendingIntent.getActivity(
mXmppConnectionService,
@@ -1896,7 +1897,7 @@ public class NotificationService {
}
}
mBuilder.setVisibility(Notification.VISIBILITY_PRIVATE);
- mBuilder.setSmallIcon(R.drawable.ic_warning_white_24dp);
+ mBuilder.setSmallIcon(R.drawable.ic_warning_24dp);
mBuilder.setLocalOnly(true);
mBuilder.setPriority(Notification.PRIORITY_LOW);
final Intent intent;
@@ -1935,7 +1936,7 @@ public class NotificationService {
} else {
builder.setProgress(100, 0, true);
}
- builder.setSmallIcon(R.drawable.ic_hourglass_empty_white_24dp);
+ builder.setSmallIcon(R.drawable.ic_hourglass_top_24dp);
if (message != null) {
builder.setContentIntent(createContentIntent(message.getConversation()));
}
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 4bc85a016..f013bd72a 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -4760,9 +4760,6 @@ public class XmppConnectionService extends Service {
if (Config.QUICKSY_DOMAIN != null) {
hosts.remove(Config.QUICKSY_DOMAIN.toEscapedString()); //we only want to show this when we type a e164 number
}
- if (Config.DOMAIN_LOCK != null) {
- hosts.add(Config.DOMAIN_LOCK);
- }
if (Config.MAGIC_CREATE_DOMAIN != null) {
hosts.add(Config.MAGIC_CREATE_DOMAIN);
}
diff --git a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java
index 917512a02..85c1cdbb1 100644
--- a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java
@@ -1,31 +1,25 @@
package eu.siacs.conversations.ui;
-import android.os.Bundle;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import eu.siacs.conversations.R;
-import eu.siacs.conversations.ui.util.SettingsUtils;
-import eu.siacs.conversations.utils.ThemeHelper;
-
import static eu.siacs.conversations.ui.XmppActivity.configureActionBar;
-public class AboutActivity extends AppCompatActivity {
+import android.os.Bundle;
+
+import androidx.databinding.DataBindingUtil;
+
+import eu.siacs.conversations.R;
+import eu.siacs.conversations.databinding.ActivityAboutBinding;
+
+public class AboutActivity extends BaseActivity {
- @Override
- protected void onResume(){
- super.onResume();
- SettingsUtils.applyScreenshotPreventionSetting(this);
- }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setTheme(ThemeHelper.find(this));
+ final ActivityAboutBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_about);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
- setContentView(R.layout.activity_about);
- setSupportActionBar(findViewById(R.id.toolbar));
+ setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
setTitle(getString(R.string.title_activity_about_x, getString(R.string.app_name)));
}
diff --git a/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java b/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java
index 3db6aa5a1..d57737f61 100644
--- a/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java
@@ -14,6 +14,7 @@ import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
+import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import java.util.ArrayList;
@@ -34,7 +35,7 @@ public abstract class AbstractSearchableListItemActivity extends XmppActivity im
private final MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() {
@Override
- public boolean onMenuItemActionExpand(final MenuItem item) {
+ public boolean onMenuItemActionExpand(@NonNull final MenuItem item) {
mSearchEditText.post(() -> {
mSearchEditText.requestFocus();
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@@ -45,7 +46,7 @@ public abstract class AbstractSearchableListItemActivity extends XmppActivity im
}
@Override
- public boolean onMenuItemActionCollapse(final MenuItem item) {
+ public boolean onMenuItemActionCollapse(@NonNull final MenuItem item) {
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearchEditText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
mSearchEditText.setText("");
@@ -92,6 +93,7 @@ public abstract class AbstractSearchableListItemActivity extends XmppActivity im
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this,R.layout.activity_choose_contact);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
this.binding.chooseContactList.setFastScrollEnabled(true);
diff --git a/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java b/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java
index 8564bcfcb..92f93e539 100644
--- a/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java
@@ -8,7 +8,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
-public abstract class ActionBarActivity extends AppCompatActivity {
+public abstract class ActionBarActivity extends BaseActivity {
public static void configureActionBar(ActionBar actionBar) {
configureActionBar(actionBar, true);
}
diff --git a/src/main/java/eu/siacs/conversations/ui/Activities.java b/src/main/java/eu/siacs/conversations/ui/Activities.java
new file mode 100644
index 000000000..e0753c0ce
--- /dev/null
+++ b/src/main/java/eu/siacs/conversations/ui/Activities.java
@@ -0,0 +1,47 @@
+package eu.siacs.conversations.ui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.os.Build;
+import android.view.View;
+import com.google.android.material.elevation.SurfaceColors;
+
+public final class Activities {
+
+ private Activities() {}
+
+ public static void setStatusAndNavigationBarColors(final Activity activity, final View view) {
+ setStatusAndNavigationBarColors(activity, view, false);
+ }
+
+ public static void setStatusAndNavigationBarColors(
+ final Activity activity, final View view, final boolean raisedStatusBar) {
+ final var isLightMode = isLightMode(activity);
+ final var window = activity.getWindow();
+ final var flags = view.getSystemUiVisibility();
+ // an elevation of 4 matches the MaterialToolbar elevation
+ if (raisedStatusBar) {
+ window.setStatusBarColor(SurfaceColors.SURFACE_5.getColor(activity));
+ } else {
+ window.setStatusBarColor(SurfaceColors.SURFACE_0.getColor(activity));
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ window.setNavigationBarColor(SurfaceColors.SURFACE_1.getColor(activity));
+ if (isLightMode) {
+ view.setSystemUiVisibility(
+ flags
+ | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
+ | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
+ }
+ } else if (isLightMode) {
+ view.setSystemUiVisibility(flags | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+ }
+ }
+
+ private static boolean isLightMode(final Context context) {
+ final int nightModeFlags =
+ context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+ return nightModeFlags != Configuration.UI_MODE_NIGHT_YES;
+ }
+}
diff --git a/src/main/java/eu/siacs/conversations/ui/BaseActivity.java b/src/main/java/eu/siacs/conversations/ui/BaseActivity.java
new file mode 100644
index 000000000..9c8871131
--- /dev/null
+++ b/src/main/java/eu/siacs/conversations/ui/BaseActivity.java
@@ -0,0 +1,53 @@
+package eu.siacs.conversations.ui;
+
+import android.util.Log;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.app.AppCompatDelegate;
+
+import eu.siacs.conversations.Conversations;
+import eu.siacs.conversations.ui.util.SettingsUtils;
+
+public abstract class BaseActivity extends AppCompatActivity {
+ private Boolean isDynamicColors;
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ final int desiredNightMode = Conversations.getDesiredNightMode(this);
+ if (setDesiredNightMode(desiredNightMode)) {
+ return;
+ }
+ final boolean isDynamicColors = Conversations.isDynamicColorsDesired(this);
+ setDynamicColors(isDynamicColors);
+ }
+
+ @Override
+ protected void onResume(){
+ super.onResume();
+ SettingsUtils.applyScreenshotPreventionSetting(this);
+ }
+
+ public void setDynamicColors(final boolean isDynamicColors) {
+ if (this.isDynamicColors == null) {
+ this.isDynamicColors = isDynamicColors;
+ } else {
+ if (this.isDynamicColors != isDynamicColors) {
+ Log.i(
+ "Recreating {} because dynamic color setting has changed",
+ getClass().getSimpleName());
+ recreate();
+ }
+ }
+ }
+
+ public boolean setDesiredNightMode(final int desiredNightMode) {
+ if (desiredNightMode == AppCompatDelegate.getDefaultNightMode()) {
+ return false;
+ }
+ AppCompatDelegate.setDefaultNightMode(desiredNightMode);
+ Log.i("Recreating {} because desired night mode has changed", getClass().getSimpleName());
+ recreate();
+ return true;
+ }
+}
diff --git a/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java
index 986aeb563..755221ded 100644
--- a/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java
+++ b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java
@@ -7,6 +7,8 @@ import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.DialogBlockContactBinding;
import eu.siacs.conversations.entities.Blockable;
@@ -19,7 +21,7 @@ public final class BlockContactDialog {
show(xmppActivity, blockable, null);
}
public static void show(final XmppActivity xmppActivity, final Blockable blockable, final String serverMsgId) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(xmppActivity);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(xmppActivity);
final boolean isBlocked = blockable.isBlocked();
builder.setNegativeButton(R.string.cancel, null);
DialogBlockContactBinding binding = DataBindingUtil.inflate(xmppActivity.getLayoutInflater(), R.layout.dialog_block_contact, null, false);
diff --git a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java
index c2a334821..cf48a1259 100644
--- a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java
@@ -3,86 +3,84 @@ package eu.siacs.conversations.ui;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
import android.widget.Toast;
+import androidx.databinding.DataBindingUtil;
+
import com.google.android.material.textfield.TextInputLayout;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.databinding.ActivityChangePasswordBinding;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.widget.DisabledActionModeCallback;
public class ChangePasswordActivity extends XmppActivity implements XmppConnectionService.OnAccountPasswordChanged {
- private Button mChangePasswordButton;
+ private ActivityChangePasswordBinding binding;
+
private final View.OnClickListener mOnChangePasswordButtonClicked = new View.OnClickListener() {
@Override
- public void onClick(View view) {
- if (mAccount != null) {
- final String currentPassword = mCurrentPassword.getText().toString();
- final String newPassword = mNewPassword.getText().toString();
- if (!mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) && !currentPassword.equals(mAccount.getPassword())) {
- mCurrentPassword.requestFocus();
- mCurrentPasswordLayout.setError(getString(R.string.account_status_unauthorized));
- removeErrorsOnAllBut(mCurrentPasswordLayout);
- } else if (newPassword.trim().isEmpty()) {
- mNewPassword.requestFocus();
- mNewPasswordLayout.setError(getString(R.string.password_should_not_be_empty));
- removeErrorsOnAllBut(mNewPasswordLayout);
- } else {
- mCurrentPasswordLayout.setError(null);
- mNewPasswordLayout.setError(null);
- xmppConnectionService.updateAccountPasswordOnServer(mAccount, newPassword, ChangePasswordActivity.this);
- mChangePasswordButton.setEnabled(false);
- mChangePasswordButton.setText(R.string.updating);
- }
+ public void onClick(final View view) {
+ final var account = mAccount;
+ if (account == null) {
+ return;
}
+ final String currentPassword = binding.currentPassword.getText().toString();
+ final String newPassword = binding.newPassword.getText().toString();
+ if (!account.isOptionSet(Account.OPTION_MAGIC_CREATE) && !currentPassword.equals(account.getPassword())) {
+ binding.currentPassword.requestFocus();
+ binding.currentPasswordLayout.setError(getString(R.string.account_status_unauthorized));
+ removeErrorsOnAllBut(binding.currentPasswordLayout);
+ } else if (newPassword.trim().isEmpty()) {
+ binding.newPassword.requestFocus();
+ binding.newPasswordLayout.setError(getString(R.string.password_should_not_be_empty));
+ removeErrorsOnAllBut(binding.newPasswordLayout);
+ } else {
+ binding.currentPasswordLayout.setError(null);
+ binding.newPasswordLayout.setError(null);
+ xmppConnectionService.updateAccountPasswordOnServer(account, newPassword, ChangePasswordActivity.this);
+ binding.changePasswordButton.setEnabled(false);
+ binding.changePasswordButton.setText(R.string.updating);
+ }
}
};
- private EditText mCurrentPassword;
- private EditText mNewPassword;
- private TextInputLayout mNewPasswordLayout;
- private TextInputLayout mCurrentPasswordLayout;
+
+
+
private Account mAccount;
@Override
void onBackendConnected() {
this.mAccount = extractAccount(getIntent());
if (this.mAccount != null && this.mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) {
- this.mCurrentPasswordLayout.setVisibility(View.GONE);
+ this.binding.currentPasswordLayout.setVisibility(View.GONE);
} else {
- this.mCurrentPassword.setVisibility(View.VISIBLE);
+ this.binding.currentPasswordLayout.setVisibility(View.VISIBLE);
}
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_change_password);
- setSupportActionBar(findViewById(R.id.toolbar));
+ this.binding = DataBindingUtil.setContentView(this, R.layout.activity_change_password);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
+ setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
- Button mCancelButton = findViewById(R.id.left_button);
- mCancelButton.setOnClickListener(view -> finish());
- this.mChangePasswordButton = findViewById(R.id.right_button);
- this.mChangePasswordButton.setOnClickListener(this.mOnChangePasswordButtonClicked);
- this.mCurrentPassword = findViewById(R.id.current_password);
- this.mCurrentPassword.setCustomSelectionActionModeCallback(new DisabledActionModeCallback());
- this.mNewPassword = findViewById(R.id.new_password);
- this.mNewPassword.setCustomSelectionActionModeCallback(new DisabledActionModeCallback());
- this.mCurrentPasswordLayout = findViewById(R.id.current_password_layout);
- this.mNewPasswordLayout = findViewById(R.id.new_password_layout);
+ binding.cancelButton.setOnClickListener(view -> finish());
+ binding.changePasswordButton.setOnClickListener(this.mOnChangePasswordButtonClicked);
+ binding.currentPassword.setCustomSelectionActionModeCallback(new DisabledActionModeCallback());
+ binding.newPassword.setCustomSelectionActionModeCallback(new DisabledActionModeCallback());
}
@Override
- protected void onStart() {
+ public void onStart() {
super.onStart();
Intent intent = getIntent();
String password = intent != null ? intent.getStringExtra("password") : null;
if (password != null) {
- this.mNewPassword.getEditableText().clear();
- this.mNewPassword.getEditableText().append(password);
+ binding.newPassword.getEditableText().clear();
+ binding.newPassword.getEditableText().append(password);
}
}
@@ -97,21 +95,21 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti
@Override
public void onPasswordChangeFailed() {
runOnUiThread(() -> {
- mNewPasswordLayout.setError(getString(R.string.could_not_change_password));
- mChangePasswordButton.setEnabled(true);
- mChangePasswordButton.setText(R.string.change_password);
+ binding.newPasswordLayout.setError(getString(R.string.could_not_change_password));
+ binding.changePasswordButton.setEnabled(true);
+ binding.changePasswordButton.setText(R.string.change_password);
});
}
private void removeErrorsOnAllBut(TextInputLayout exception) {
- if (this.mCurrentPasswordLayout != exception) {
- this.mCurrentPasswordLayout.setErrorEnabled(false);
- this.mCurrentPasswordLayout.setError(null);
+ if (this.binding.currentPasswordLayout != exception) {
+ this.binding.currentPasswordLayout.setErrorEnabled(false);
+ this.binding.currentPasswordLayout.setError(null);
}
- if (this.mNewPasswordLayout != exception) {
- this.mNewPasswordLayout.setErrorEnabled(false);
- this.mNewPasswordLayout.setError(null);
+ if (this.binding.newPasswordLayout != exception) {
+ this.binding.newPasswordLayout.setErrorEnabled(false);
+ this.binding.newPasswordLayout.setError(null);
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java b/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java
index 1b21cfb77..8d780d0d7 100644
--- a/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java
@@ -19,8 +19,11 @@ import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.color.MaterialColors;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.common.base.Strings;
import java.util.Collections;
@@ -39,7 +42,6 @@ import eu.siacs.conversations.services.QuickConversationsService;
import eu.siacs.conversations.ui.adapter.ChannelSearchResultAdapter;
import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
-import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.xmpp.Jid;
@@ -81,6 +83,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_channel_discovery);
setSupportActionBar(binding.toolbar);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
configureActionBar(getSupportActionBar(), true);
binding.list.setAdapter(this.adapter);
this.adapter.setOnChannelSearchResultSelectedListener(this);
@@ -155,7 +158,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
private void toggleLoadingScreen() {
adapter.submitList(Collections.emptyList());
binding.progressBar.setVisibility(View.VISIBLE);
- binding.list.setBackgroundColor(StyledAttributes.getColor(this, R.attr.color_background_primary));
+ binding.list.setBackgroundColor(MaterialColors.getColor(binding.list, com.google.android.material.R.attr.colorSurface));
}
@Override
@@ -163,13 +166,13 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
super.onStart();
this.method = getMethod(this);
if (!optedIn && method == ChannelDiscoveryService.Method.JABBER_NETWORK) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.channel_discovery_opt_in_title);
builder.setMessage(Html.fromHtml(getString(R.string.channel_discover_opt_in_message)));
builder.setNegativeButton(R.string.cancel, (dialog, which) -> finish());
builder.setPositiveButton(R.string.confirm, (dialog, which) -> optIn());
builder.setOnCancelListener(dialog -> finish());
- final AlertDialog dialog = builder.create();
+ final androidx.appcompat.app.AlertDialog dialog = builder.create();
dialog.setOnShowListener(d -> {
final TextView textView = dialog.findViewById(android.R.id.message);
if (textView == null) {
@@ -186,7 +189,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
private void holdLoading() {
adapter.submitList(Collections.emptyList());
binding.progressBar.setVisibility(View.GONE);
- binding.list.setBackgroundColor(StyledAttributes.getColor(this, R.attr.color_background_primary));
+ binding.list.setBackgroundColor(MaterialColors.getColor(binding.list, com.google.android.material.R.attr.colorSurface));
}
@Override
@@ -220,10 +223,10 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
runOnUiThread(() -> {
adapter.submitList(results);
binding.progressBar.setVisibility(View.GONE);
- if (results.size() == 0) {
- binding.list.setBackground(StyledAttributes.getDrawable(this, R.attr.activity_primary_background_no_results));
+ if (results.isEmpty()) {
+ binding.list.setBackground(ContextCompat.getDrawable(this,R.drawable.background_no_results));
} else {
- binding.list.setBackgroundColor(StyledAttributes.getColor(this, R.attr.color_background_primary));
+ binding.list.setBackgroundColor(MaterialColors.getColor(binding.list, com.google.android.material.R.attr.colorSurface));
}
});
@@ -234,11 +237,11 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
final List accounts = AccountUtils.getEnabledAccounts(xmppConnectionService);
if (accounts.size() == 1) {
joinChannelSearchResult(accounts.get(0), result);
- } else if (accounts.size() == 0) {
+ } else if (accounts.isEmpty()) {
Toast.makeText(this, R.string.please_enable_an_account, Toast.LENGTH_LONG).show();
} else {
final AtomicReference account = new AtomicReference<>(accounts.get(0));
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.choose_account);
builder.setSingleChoiceItems(accounts.toArray(new CharSequence[0]), 0, (dialog, which) -> account.set(accounts.get(which)));
builder.setPositiveButton(R.string.join, (dialog, which) -> joinChannelSearchResult(account.get(), result));
@@ -271,10 +274,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
}
public void joinChannelSearchResult(final String selectedAccount, final Room result) {
- final Jid jid =
- Config.DOMAIN_LOCK == null
- ? Jid.ofEscaped(selectedAccount)
- : Jid.ofLocalAndDomainEscaped(selectedAccount, Config.DOMAIN_LOCK);
+ final Jid jid = Jid.ofEscaped(selectedAccount);
final boolean syncAutoJoin = getBooleanPreference("autojoin", R.bool.autojoin);
final Account account = xmppConnectionService.findAccountByJid(jid);
final Conversation conversation =
diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java
index af1fb7656..41a894403 100644
--- a/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java
@@ -3,20 +3,21 @@ package eu.siacs.conversations.ui;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
-import android.widget.ListView;
import android.widget.Toast;
+import androidx.databinding.DataBindingUtil;
+
+import eu.siacs.conversations.R;
+import eu.siacs.conversations.databinding.ActivityManageAccountsBinding;
+import eu.siacs.conversations.entities.Account;
+import eu.siacs.conversations.ui.adapter.AccountAdapter;
+
import java.util.ArrayList;
import java.util.List;
-import eu.siacs.conversations.R;
-import eu.siacs.conversations.entities.Account;
-import eu.siacs.conversations.ui.adapter.AccountAdapter;
-
public class ChooseAccountForProfilePictureActivity extends XmppActivity {
protected final List accountList = new ArrayList<>();
- protected ListView accountListView;
protected AccountAdapter mAccountAdapter;
@Override
@@ -28,25 +29,21 @@ public class ChooseAccountForProfilePictureActivity extends XmppActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_manage_accounts);
- setSupportActionBar(findViewById(R.id.toolbar));
+ final ActivityManageAccountsBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_manage_accounts);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
+ setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar(), false);
- accountListView = findViewById(R.id.account_list);
this.mAccountAdapter = new AccountAdapter(this, accountList, false);
- accountListView.setAdapter(this.mAccountAdapter);
- accountListView.setOnItemClickListener((arg0, view, position, arg3) -> {
+ binding.accountList.setAdapter(this.mAccountAdapter);
+ binding.accountList.setOnItemClickListener((arg0, view, position, arg3) -> {
final Account account = accountList.get(position);
goToProfilePictureActivity(account);
});
}
@Override
- protected void onStart() {
+ public void onStart() {
super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- }
}
@Override
diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java
index 246e39855..2aacf8927 100644
--- a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java
@@ -9,6 +9,7 @@ import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.SoundEffectConstants;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView.MultiChoiceModeListener;
@@ -51,7 +52,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
public static final String EXTRA_SHOW_ENTER_JID = "extra_show_enter_jid";
public static final String EXTRA_CONVERSATION = "extra_conversation";
private static final String EXTRA_FILTERED_CONTACTS = "extra_filtered_contacts";
- private final List mActivatedAccounts = new ArrayList<>();
+ private final ArrayList mActivatedAccounts = new ArrayList<>();
private final Set selected = new HashSet<>();
private Set filterContacts;
@@ -130,7 +131,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
if (this.showEnterJid) {
this.binding.fab.show();
} else {
- binding.fab.setImageResource(R.drawable.ic_forward_white_24dp);
+ binding.fab.setImageResource(R.drawable.ic_navigate_next_24dp);
}
final SharedPreferences preferences = getPreferences();
@@ -139,7 +140,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
}
private void onFabClicked(View v) {
- if (selected.size() == 0) {
+ if (selected.isEmpty()) {
showEnterJidDialog(null);
} else {
submitSelection();
@@ -154,7 +155,8 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.setTitle(getTitleFromIntent());
- binding.fab.setImageResource(R.drawable.ic_forward_white_24dp);
+ binding.chooseContactList.setFastScrollEnabled(false);
+ binding.fab.setImageResource(R.drawable.ic_navigate_next_24dp);
binding.fab.show();
final View view = getSearchEditText();
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@@ -166,12 +168,13 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
@Override
public void onDestroyActionMode(ActionMode mode) {
- this.binding.fab.setImageResource(R.drawable.ic_person_add_white_24dp);
+ this.binding.fab.setImageResource(R.drawable.ic_person_add_24dp);
if (this.showEnterJid) {
this.binding.fab.show();
} else {
this.binding.fab.hide();
}
+ binding.chooseContactList.setFastScrollEnabled(true);
selected.clear();
}
@@ -199,8 +202,9 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
if (selected.size() != 0) {
- getListView().playSoundEffect(0);
+ getListView().playSoundEffect(SoundEffectConstants.CLICK);
}
+ getListItemAdapter().notifyDataSetChanged();
Contact item = (Contact) getListItems().get(position);
if (checked) {
selected.add(item.getJid().toString());
@@ -361,13 +365,9 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
void onBackendConnected() {
filterContacts();
this.mActivatedAccounts.clear();
- for (Account account : xmppConnectionService.getAccounts()) {
+ for (final Account account : xmppConnectionService.getAccounts()) {
if (account.isEnabled()) {
- if (Config.DOMAIN_LOCK != null) {
- this.mActivatedAccounts.add(account.getJid().getEscapedLocal());
- } else {
- this.mActivatedAccounts.add(account.getJid().asBareJid().toEscapedString());
- }
+ this.mActivatedAccounts.add(account.getJid().asBareJid().toEscapedString());
}
}
ActivityResult activityResult = this.postponedActivityResult.pop();
diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
index 47debf9c1..6d0bc7928 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
@@ -55,6 +55,8 @@ import me.drakeet.support.toast.ToastCompat;
import static eu.siacs.conversations.entities.Bookmark.printableValue;
import static eu.siacs.conversations.utils.StringUtils.changed;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnConfigurationPushed, XmppConnectionService.OnRoomDestroy, TextWatcher, OnMediaLoaded {
public static final String ACTION_VIEW_MUC = "view_muc";
@@ -97,7 +99,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
private final OnClickListener mNotifyStatusClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
- AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ConferenceDetailsActivity.this);
builder.setTitle(R.string.pref_notification_settings);
String[] choices = {
getString(R.string.notify_on_all_messages),
@@ -130,7 +132,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
@Override
public void onClick(View v) {
final MucOptions mucOptions = mConversation.getMucOptions();
- AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ConferenceDetailsActivity.this);
MucConfiguration configuration = MucConfiguration.get(ConferenceDetailsActivity.this, mAdvancedMode, mucOptions);
builder.setTitle(configuration.title);
final boolean[] values = configuration.values;
@@ -168,6 +170,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_details);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
this.binding.changeConferenceButton.setOnClickListener(this.mChangeConferenceSettings);
setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
@@ -216,12 +219,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
@Override
- protected void onStart() {
+ public void onStart() {
super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- }
binding.mediaWrapper.setVisibility(Compatibility.hasStoragePermission(this) ? View.VISIBLE : View.GONE);
}
@@ -277,7 +276,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
final MucOptions mucOptions = mConversation.getMucOptions();
this.binding.mucEditor.setVisibility(View.VISIBLE);
this.binding.mucDisplay.setVisibility(View.GONE);
- this.binding.editMucNameButton.setImageResource(getThemeResource(R.attr.icon_cancel, R.drawable.ic_cancel_black_24dp));
+ this.binding.editMucNameButton.setImageResource(R.drawable.ic_cancel_24dp);
final String name = mucOptions.getName();
this.binding.mucEditTitle.setText("");
final boolean owner = mucOptions.getSelf().getAffiliation().ranks(MucOptions.Affiliation.OWNER);
@@ -311,7 +310,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
private void hideEditor() {
this.binding.mucEditor.setVisibility(View.GONE);
this.binding.mucDisplay.setVisibility(View.VISIBLE);
- this.binding.editMucNameButton.setImageResource(getThemeResource(R.attr.icon_edit_body, R.drawable.ic_edit_black_24dp));
+ this.binding.editMucNameButton.setImageResource(R.drawable.ic_edit_24dp);
}
private void onMucInfoUpdated(String subject, String name) {
@@ -384,7 +383,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
protected void destroyRoom() {
final boolean groupChat = mConversation != null && mConversation.isPrivateAndNonAnonymous();
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(groupChat ? R.string.destroy_room : R.string.destroy_channel);
builder.setMessage(groupChat ? R.string.destroy_room_dialog : R.string.destroy_channel_dialog);
builder.setPositiveButton(R.string.ok, (dialog, which) -> {
@@ -434,12 +433,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
final MucOptions mucOptions = mConversation.getMucOptions();
final User self = mucOptions.getSelf();
- String account;
- if (Config.DOMAIN_LOCK != null) {
- account = mConversation.getAccount().getJid().getEscapedLocal();
- } else {
- account = mConversation.getAccount().getJid().asBareJid().toEscapedString();
- }
+ final String account = mConversation.getAccount().getJid().asBareJid().toEscapedString();
setTitle(mucOptions.isPrivateAndNonAnonymous() ? R.string.action_muc_details : R.string.channel_details);
this.binding.editMucNameButton.setVisibility((self.getAffiliation().ranks(MucOptions.Affiliation.OWNER) || mucOptions.canChangeSubject()) ? View.VISIBLE : View.GONE);
this.binding.detailsAccount.setText(getString(R.string.using_account, account));
@@ -469,7 +463,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
StylingHelper.format(spannable, this.binding.mucSubject.getCurrentTextColor());
MyLinkify.addLinks(spannable, false);
this.binding.mucSubject.setText(spannable);
- this.binding.mucSubject.setTextAppearance(this, subject.length() > (hasTitle ? 128 : 196) ? R.style.TextAppearance_Conversations_Body1_Linkified : R.style.TextAppearance_Conversations_Subhead);
+ this.binding.mucSubject.setTextAppearance( subject.length() > (hasTitle ? 128 : 196) ? com.google.android.material.R.style.TextAppearance_Material3_BodyMedium : com.google.android.material.R.style.TextAppearance_Material3_BodyLarge);
this.binding.mucSubject.setAutoLinkMask(0);
this.binding.mucSubject.setVisibility(View.VISIBLE);
this.binding.mucSubject.setMovementMethod(LinkMovementMethod.getInstance());
@@ -507,24 +501,19 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
this.binding.mucSettings.setVisibility(View.GONE);
}
- int ic_notifications = getThemeResource(R.attr.icon_notifications, R.drawable.ic_notifications_black_24dp);
- int ic_notifications_off = getThemeResource(R.attr.icon_notifications_off, R.drawable.ic_notifications_off_black_24dp);
- int ic_notifications_paused = getThemeResource(R.attr.icon_notifications_paused, R.drawable.ic_notifications_paused_black_24dp);
- int ic_notifications_none = getThemeResource(R.attr.icon_notifications_none, R.drawable.ic_notifications_none_black_24dp);
-
- long mutedTill = mConversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL, 0);
+ final long mutedTill = mConversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL, 0);
if (mutedTill == Long.MAX_VALUE) {
this.binding.notificationStatusText.setText(R.string.notify_never);
- this.binding.notificationStatusButton.setImageResource(ic_notifications_off);
+ this.binding.notificationStatusButton.setImageResource(R.drawable.ic_notifications_off_24dp);
} else if (System.currentTimeMillis() < mutedTill) {
this.binding.notificationStatusText.setText(R.string.notify_paused);
- this.binding.notificationStatusButton.setImageResource(ic_notifications_paused);
+ this.binding.notificationStatusButton.setImageResource(R.drawable.ic_notifications_paused_24dp);
} else if (mConversation.alwaysNotify()) {
this.binding.notificationStatusText.setText(R.string.notify_on_all_messages);
- this.binding.notificationStatusButton.setImageResource(ic_notifications);
+ this.binding.notificationStatusButton.setImageResource(R.drawable.ic_notifications_24dp);
} else {
this.binding.notificationStatusText.setText(R.string.notify_only_when_highlighted);
- this.binding.notificationStatusButton.setImageResource(ic_notifications_none);
+ this.binding.notificationStatusButton.setImageResource(R.drawable.ic_notifications_none_24dp);
}
final List users = mucOptions.getUsers();
Collections.sort(users, (a, b) -> {
@@ -629,9 +618,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
boolean subjectChanged = changed(binding.mucEditSubject.getEditableText().toString(), mucOptions.getSubject());
boolean nameChanged = changed(binding.mucEditTitle.getEditableText().toString(), mucOptions.getName());
if (subjectChanged || nameChanged) {
- this.binding.editMucNameButton.setImageResource(getThemeResource(R.attr.icon_save, R.drawable.ic_save_black_24dp));
+ this.binding.editMucNameButton.setImageResource(R.drawable.ic_save_24dp);
} else {
- this.binding.editMucNameButton.setImageResource(getThemeResource(R.attr.icon_cancel, R.drawable.ic_cancel_black_24dp));
+ this.binding.editMucNameButton.setImageResource(R.drawable.ic_cancel_24dp);
}
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index 394331452..24dd3cafd 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -30,6 +30,9 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.color.MaterialColors;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import org.openintents.openpgp.util.OpenPgpUtils;
import java.util.Collection;
@@ -144,7 +147,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
} else {
value = jid.toEscapedString();
}
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(getString(R.string.action_add_phone_book));
builder.setMessage(getString(R.string.add_phone_book_text, value));
builder.setNegativeButton(getString(R.string.cancel), null);
@@ -215,6 +218,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
}
this.messageFingerprint = getIntent().getStringExtra("fingerprint");
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_contact_details);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
@@ -238,14 +242,9 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
@Override
public void onStart() {
super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- } else {
- final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
- this.showDynamicTags = preferences.getBoolean(SettingsActivity.SHOW_DYNAMIC_TAGS, false);
- this.showLastSeen = preferences.getBoolean("last_activity", false);
- }
+ final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
+ this.showDynamicTags = preferences.getBoolean(SettingsActivity.SHOW_DYNAMIC_TAGS, false);
+ this.showLastSeen = preferences.getBoolean("last_activity", false);
binding.mediaWrapper.setVisibility(Compatibility.hasStoragePermission(this) ? View.VISIBLE : View.GONE);
mMediaAdapter.setAttachments(Collections.emptyList());
}
@@ -268,8 +267,6 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
if (MenuDoubleTabUtil.shouldIgnoreTap()) {
return false;
}
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setNegativeButton(getString(R.string.cancel), null);
switch (menuItem.getItemId()) {
case android.R.id.home:
finish();
@@ -281,6 +278,8 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
shareLink(false);
break;
case R.id.action_delete_contact:
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
+ builder.setNegativeButton(getString(R.string.cancel), null);
builder.setTitle(getString(R.string.action_delete_contact))
.setMessage(JidDialog.style(this, R.string.remove_contact_text, contact.getJid().toEscapedString()))
.setPositiveButton(getString(R.string.delete),
@@ -431,12 +430,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
}
binding.detailsContactjid.setText(IrregularUnicodeDetector.style(this, contact.getJid()));
- String account;
- if (Config.DOMAIN_LOCK != null) {
- account = contact.getAccount().getJid().getEscapedLocal();
- } else {
- account = contact.getAccount().getJid().asBareJid().toEscapedString();
- }
+ final String account = contact.getAccount().getJid().asBareJid().toEscapedString();
binding.detailsAccount.setText(getString(R.string.using_account, account));
AvatarWorkerTask.loadAvatar(contact, binding.detailsContactBadge, R.dimen.avatar_on_details_screen_size);
binding.detailsContactBadge.setOnClickListener(this::onBadgeClick);
@@ -498,7 +492,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
TextView keyType = view.findViewById(R.id.key_type);
keyType.setText(R.string.openpgp_key_id);
if ("pgp".equals(messageFingerprint)) {
- keyType.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight);
+ keyType.setTextColor(MaterialColors.getColor(keyType, com.google.android.material.R.attr.colorPrimaryVariant));
}
key.setText(OpenPgpUtils.convertKeyIdToHex(contact.getPgpKeyId()));
final OnClickListener openKey = v -> launchOpenKeyChain(contact.getPgpKeyId());
@@ -510,7 +504,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
binding.keysWrapper.setVisibility(hasKeys ? View.VISIBLE : View.GONE);
List tagList = contact.getTags(this);
- if (tagList.size() == 0 || !this.showDynamicTags) {
+ if (tagList.isEmpty() || !this.showDynamicTags) {
binding.tags.setVisibility(View.GONE);
} else {
binding.tags.setVisibility(View.VISIBLE);
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 2d9fe91ae..da5231357 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -16,10 +16,4 @@ public class ConversationActivity extends AppCompatActivity {
startActivity(new Intent(this, ConversationsActivity.class));
finish();
}
-
- @Override
- protected void onResume(){
- super.onResume();
- SettingsUtils.applyScreenshotPreventionSetting(this);
- }
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index ae46b8075..41900b906 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -22,6 +22,7 @@ import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
+import android.content.res.ColorStateList;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -63,6 +64,7 @@ import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.view.inputmethod.InputContentInfoCompat;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
@@ -1062,7 +1064,7 @@ public class ConversationFragment extends XmppFragment
};
if (conversation == null
|| conversation.getMode() == Conversation.MODE_MULTI
- || Attachment.canBeSendInband(attachments)
+ || Attachment.canBeSendInBand(attachments)
|| (conversation.getAccount().httpUploadAvailable()
&& FileBackend.allFilesUnderSize(
getActivity(), attachments, getMaxHttpUploadSize(conversation)))) {
@@ -1934,8 +1936,8 @@ public class ConversationFragment extends XmppFragment
@SuppressLint("InflateParams")
protected void clearHistoryDialog(final Conversation conversation) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
- builder.setTitle(getString(R.string.clear_conversation_history));
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
+ builder.setTitle(R.string.clear_conversation_history);
final View dialogView =
requireActivity().getLayoutInflater().inflate(R.layout.dialog_clear_history, null);
final CheckBox endConversationCheckBox =
@@ -1958,7 +1960,7 @@ public class ConversationFragment extends XmppFragment
}
protected void muteConversationDialog(final Conversation conversation) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setTitle(R.string.disable_notifications);
final int[] durations = getResources().getIntArray(R.array.mute_options_durations);
final CharSequence[] labels = new CharSequence[durations.length];
@@ -2132,7 +2134,7 @@ public class ConversationFragment extends XmppFragment
}
private void showErrorMessage(final Message message) {
- AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setTitle(R.string.error_message);
final String errorMessage = message.getErrorMessage();
final String[] errorMessageParts =
@@ -2159,7 +2161,7 @@ public class ConversationFragment extends XmppFragment
}
private void deleteFile(final Message message) {
- AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setNegativeButton(R.string.cancel, null);
builder.setTitle(R.string.delete_file_dialog);
builder.setMessage(R.string.delete_file_dialog_msg);
@@ -2921,10 +2923,11 @@ public class ConversationFragment extends XmppFragment
status = Presence.Status.OFFLINE;
}
this.binding.textSendButton.setTag(action);
+ this.binding.textSendButton.setIconResource(SendButtonTool.getSendButtonImageResource(action));
+ this.binding.textSendButton.setIconTint(ColorStateList.valueOf(SendButtonTool.getSendButtonColor(this.binding.textSendButton, status)));
+ // TODO send button color
final Activity activity = getActivity();
if (activity != null) {
- this.binding.textSendButton.setImageResource(
- SendButtonTool.getSendButtonImageResource(activity, action, status));
}
}
@@ -3247,9 +3250,8 @@ public class ConversationFragment extends XmppFragment
});
}
- public void showNoPGPKeyDialog(boolean plural, DialogInterface.OnClickListener listener) {
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- builder.setIconAttribute(android.R.attr.alertDialogIcon);
+ public void showNoPGPKeyDialog(final boolean plural, final DialogInterface.OnClickListener listener) {
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
if (plural) {
builder.setTitle(getString(R.string.no_pgp_keys));
builder.setMessage(getText(R.string.contacts_have_no_pgp_keys));
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java
index 94801c688..92329c666 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java
@@ -59,18 +59,18 @@ import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import org.openintents.openpgp.util.OpenPgpApi;
import java.util.Arrays;
import java.util.List;
-import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.OmemoSetting;
import eu.siacs.conversations.databinding.ActivityConversationsBinding;
-import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Conversational;
@@ -80,11 +80,11 @@ import eu.siacs.conversations.ui.interfaces.OnConversationArchived;
import eu.siacs.conversations.ui.interfaces.OnConversationRead;
import eu.siacs.conversations.ui.interfaces.OnConversationSelected;
import eu.siacs.conversations.ui.interfaces.OnConversationsListItemUpdated;
-import eu.siacs.conversations.ui.util.ActionBarUtil;
import eu.siacs.conversations.ui.util.ActivityResult;
import eu.siacs.conversations.ui.util.ConversationMenuConfigurator;
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.PendingItem;
+import eu.siacs.conversations.ui.util.ToolbarUtils;
import eu.siacs.conversations.utils.ExceptionHelper;
import eu.siacs.conversations.utils.SignupUtils;
import eu.siacs.conversations.utils.XmppUri;
@@ -227,10 +227,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
}
private boolean openBatteryOptimizationDialogIfNeeded() {
- if (isOptimizingBattery()
- && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M
- && getPreferences().getBoolean(getBatteryOptimizationPreferenceKey(), true)) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ if (isOptimizingBattery() && getPreferences().getBoolean(getBatteryOptimizationPreferenceKey(), true)) {
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.battery_optimizations_enabled);
builder.setMessage(getString(R.string.battery_optimizations_enabled_dialog, getString(R.string.app_name)));
builder.setPositiveButton(R.string.next, (dialog, which) -> {
@@ -372,6 +370,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
ConversationMenuConfigurator.reloadFeatures(this);
OmemoSetting.load(this);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_conversations);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
this.getFragmentManager().addOnBackStackChangedListener(this::invalidateActionBarTitle);
@@ -466,9 +465,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
conversationFragment.reInit(conversation, extras == null ? new Bundle() : extras);
if (mainNeedsRefresh) {
refreshFragment(R.id.main_fragment);
- } else {
- invalidateActionBarTitle();
}
+ invalidateActionBarTitle();
}
private static void executePendingTransactions(final FragmentManager fragmentManager) {
@@ -546,15 +544,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
}
@Override
- protected void onStart() {
+ public void onStart() {
super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- this.mSkipBackgroundBinding = true;
- recreate();
- } else {
- this.mSkipBackgroundBinding = false;
- }
mRedirectInProcess.set(false);
}
@@ -630,21 +621,31 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
}
final FragmentManager fragmentManager = getFragmentManager();
final Fragment mainFragment = fragmentManager.findFragmentById(R.id.main_fragment);
- if (mainFragment instanceof ConversationFragment) {
- final Conversation conversation = ((ConversationFragment) mainFragment).getConversation();
+ if (mainFragment instanceof ConversationFragment conversationFragment) {
+ final Conversation conversation = conversationFragment.getConversation();
if (conversation != null) {
actionBar.setTitle(conversation.getName());
actionBar.setDisplayHomeAsUpEnabled(true);
- ActionBarUtil.setActionBarOnClickListener(
+ ToolbarUtils.setActionBarOnClickListener(
binding.toolbar,
(v) -> openConversationDetails(conversation)
);
return;
}
}
- actionBar.setTitle(R.string.app_name);
+ final Fragment secondaryFragment = fragmentManager.findFragmentById(R.id.secondary_fragment);
+ if (secondaryFragment instanceof ConversationFragment conversationFragment) {
+ final Conversation conversation = conversationFragment.getConversation();
+ if (conversation != null) {
+ actionBar.setTitle(conversation.getName());
+ } else {
+ actionBar.setTitle(R.string.app_name);
+ }
+ } else {
+ actionBar.setTitle(R.string.app_name);
+ }
actionBar.setDisplayHomeAsUpEnabled(false);
- ActionBarUtil.resetActionBarOnClickListeners(binding.toolbar);
+ ToolbarUtils.resetActionBarOnClickListeners(binding.toolbar);
}
private void openConversationDetails(final Conversation conversation) {
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java
index b673260ad..51230a6be 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java
@@ -50,6 +50,8 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
+import com.google.android.material.color.MaterialColors;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import com.google.common.collect.Collections2;
@@ -72,10 +74,8 @@ import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.PendingActionHelper;
import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.ScrollState;
-import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.EasyOnboardingInvite;
-import eu.siacs.conversations.utils.ThemeHelper;
import static androidx.recyclerview.widget.ItemTouchHelper.LEFT;
import static androidx.recyclerview.widget.ItemTouchHelper.RIGHT;
@@ -111,7 +111,7 @@ public class ConversationsOverviewFragment extends XmppFragment {
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
if(actionState != ItemTouchHelper.ACTION_STATE_IDLE){
Paint paint = new Paint();
- paint.setColor(StyledAttributes.getColor(activity,R.attr.conversations_overview_background));
+ paint.setColor(MaterialColors.getColor(viewHolder.itemView, com.google.android.material.R.attr.colorSecondaryFixedDim));
paint.setStyle(Paint.Style.FILL);
c.drawRect(viewHolder.itemView.getLeft(),viewHolder.itemView.getTop()
,viewHolder.itemView.getRight(),viewHolder.itemView.getBottom(), paint);
@@ -196,8 +196,6 @@ public class ConversationsOverviewFragment extends XmppFragment {
activity.xmppConnectionService.archiveConversation(c);
}
});
-
- ThemeHelper.fix(snackbar);
snackbar.show();
}
};
@@ -381,14 +379,14 @@ public class ConversationsOverviewFragment extends XmppFragment {
private void selectAccountToStartEasyInvite() {
final List accounts = EasyOnboardingInvite.getSupportingAccounts(activity.xmppConnectionService);
- if (accounts.size() == 0) {
+ if (accounts.isEmpty()) {
//This can technically happen if opening the menu item races with accounts reconnecting or something
Toast.makeText(getActivity(),R.string.no_active_accounts_support_this, Toast.LENGTH_LONG).show();
} else if (accounts.size() == 1) {
openEasyInviteScreen(accounts.get(0));
} else {
final AtomicReference selectedAccount = new AtomicReference<>(accounts.get(0));
- final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity);
+ final MaterialAlertDialogBuilder alertDialogBuilder = new MaterialAlertDialogBuilder(activity);
alertDialogBuilder.setTitle(R.string.choose_account);
final String[] asStrings = Collections2.transform(accounts, a -> a.getJid().asBareJid().toEscapedString()).toArray(new String[0]);
alertDialogBuilder.setSingleChoiceItems(asStrings, 0, (dialog, which) -> selectedAccount.set(accounts.get(which)));
diff --git a/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java b/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java
index 6e4098264..ae3406a2d 100644
--- a/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java
+++ b/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java
@@ -3,18 +3,20 @@ package eu.siacs.conversations.ui;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
-import android.widget.Spinner;
+import android.widget.AutoCompleteTextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import java.util.ArrayList;
import java.util.List;
import eu.siacs.conversations.R;
-import eu.siacs.conversations.databinding.CreateConferenceDialogBinding;
+import eu.siacs.conversations.databinding.DialogCreateConferenceBinding;
import eu.siacs.conversations.ui.util.DelayedHintHelper;
public class CreatePrivateGroupChatDialog extends DialogFragment {
@@ -39,9 +41,9 @@ public class CreatePrivateGroupChatDialog extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setTitle(R.string.create_private_group_chat);
- CreateConferenceDialogBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.create_conference_dialog, null, false);
+ final DialogCreateConferenceBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.dialog_create_conference, null, false);
ArrayList mActivatedAccounts = getArguments().getStringArrayList(ACCOUNTS_LIST_KEY);
StartConversationActivity.populateAccountSpinner(getActivity(), mActivatedAccounts, binding.account);
builder.setView(binding.getRoot());
@@ -57,7 +59,7 @@ public class CreatePrivateGroupChatDialog extends DialogFragment {
public interface CreateConferenceDialogListener {
- void onCreateDialogPositiveClick(Spinner spinner, String subject);
+ void onCreateDialogPositiveClick(AutoCompleteTextView spinner, String subject);
}
@Override
diff --git a/src/main/java/eu/siacs/conversations/ui/CreatePublicChannelDialog.java b/src/main/java/eu/siacs/conversations/ui/CreatePublicChannelDialog.java
index 8f5e2e6d2..b20db451d 100644
--- a/src/main/java/eu/siacs/conversations/ui/CreatePublicChannelDialog.java
+++ b/src/main/java/eu/siacs/conversations/ui/CreatePublicChannelDialog.java
@@ -17,13 +17,14 @@ import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
-import java.security.SecureRandom;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import eu.siacs.conversations.R;
-import eu.siacs.conversations.databinding.CreatePublicChannelDialogBinding;
+import eu.siacs.conversations.databinding.DialogCreatePublicChannelBinding;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
@@ -44,7 +45,7 @@ public class CreatePublicChannelDialog extends DialogFragment implements OnBacke
private boolean nameEntered = false;
private boolean skipTetxWatcher = false;
- public static CreatePublicChannelDialog newInstance(List accounts) {
+ public static CreatePublicChannelDialog newInstance(final List accounts) {
CreatePublicChannelDialog dialog = new CreatePublicChannelDialog();
Bundle bundle = new Bundle();
bundle.putStringArrayList(ACCOUNTS_LIST_KEY, (ArrayList) accounts);
@@ -63,9 +64,9 @@ public class CreatePublicChannelDialog extends DialogFragment implements OnBacke
public Dialog onCreateDialog(Bundle savedInstanceState) {
jidWasModified = savedInstanceState != null && savedInstanceState.getBoolean("jid_was_modified_false", false);
nameEntered = savedInstanceState != null && savedInstanceState.getBoolean("name_entered", false);
- final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setTitle(R.string.create_public_channel);
- final CreatePublicChannelDialogBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.create_public_channel_dialog, null, false);
+ final DialogCreatePublicChannelBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.dialog_create_public_channel, null, false);
binding.account.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView> parent, View view, int position, long id) {
@@ -107,7 +108,7 @@ public class CreatePublicChannelDialog extends DialogFragment implements OnBacke
builder.setPositiveButton(nameEntered ? R.string.create : R.string.next, null);
builder.setNegativeButton(nameEntered ? R.string.back : R.string.cancel, null);
DelayedHintHelper.setHint(R.string.channel_bare_jid_example, binding.jid);
- this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.simple_list_item);
+ this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.item_autocomplete);
binding.jid.setAdapter(knownHostsAdapter);
final AlertDialog dialog = builder.create();
binding.groupChatName.setOnEditorActionListener((v, actionId, event) -> {
@@ -121,7 +122,7 @@ public class CreatePublicChannelDialog extends DialogFragment implements OnBacke
return dialog;
}
- private void updateJidSuggestion(CreatePublicChannelDialogBinding binding) {
+ private void updateJidSuggestion(final DialogCreatePublicChannelBinding binding) {
if (jidWasModified) {
return;
}
@@ -138,7 +139,7 @@ public class CreatePublicChannelDialog extends DialogFragment implements OnBacke
super.onSaveInstanceState(outState);
}
- private static String getJidSuggestion(CreatePublicChannelDialogBinding binding) {
+ private static String getJidSuggestion(final DialogCreatePublicChannelBinding binding) {
final Account account = StartConversationActivity.getSelectedAccount(binding.getRoot().getContext(), binding.account);
final XmppConnection connection = account == null ? null : account.getXmppConnection();
if (connection == null) {
@@ -169,7 +170,7 @@ public class CreatePublicChannelDialog extends DialogFragment implements OnBacke
return name.replaceAll("\\s+","-");
}
- private void goBack(AlertDialog dialog, CreatePublicChannelDialogBinding binding) {
+ private void goBack(AlertDialog dialog, DialogCreatePublicChannelBinding binding) {
if (nameEntered) {
nameEntered = false;
updateInputs(binding, true);
@@ -179,7 +180,7 @@ public class CreatePublicChannelDialog extends DialogFragment implements OnBacke
}
}
- private void submit(AlertDialog dialog, CreatePublicChannelDialogBinding binding) {
+ private void submit(AlertDialog dialog, DialogCreatePublicChannelBinding binding) {
final Context context = binding.getRoot().getContext();
final Editable nameText = binding.groupChatName.getText();
final String name = nameText == null ? "" : nameText.toString().trim();
@@ -227,7 +228,7 @@ public class CreatePublicChannelDialog extends DialogFragment implements OnBacke
}
- private void updateInputs(CreatePublicChannelDialogBinding binding, boolean requestFocus) {
+ private void updateInputs(final DialogCreatePublicChannelBinding binding, final boolean requestFocus) {
binding.xmppAddressLayout.setVisibility(nameEntered ? View.VISIBLE : View.GONE);
binding.nameLayout.setVisibility(nameEntered ? View.GONE : View.VISIBLE);
if (!requestFocus) {
@@ -265,7 +266,7 @@ public class CreatePublicChannelDialog extends DialogFragment implements OnBacke
}
@Override
- public void onAttach(Context context) {
+ public void onAttach(@NonNull Context context) {
super.onAttach(context);
try {
mListener = (CreatePublicChannelDialogListener) context;
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
index 741cbcce5..be8caa986 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -33,9 +33,10 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AlertDialog.Builder;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.color.MaterialColors;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.textfield.TextInputLayout;
import com.google.common.base.CharMatcher;
@@ -98,7 +99,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private Jid jidToEdit;
private boolean mInitMode = false;
private Boolean mForceRegister = null;
- private boolean mUsernameMode = Config.DOMAIN_LOCK != null;
+ private boolean mUsernameMode = false;
private boolean mShowOptions = false;
private Account mAccount;
private final OnClickListener mCancelButtonClickListener = v -> {
@@ -609,6 +610,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mSavedInstanceInit = savedInstanceState.getBoolean("initMode", false);
}
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_edit_account);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
binding.accountJid.addTextChangedListener(this.mTextWatcher);
binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener);
@@ -697,13 +699,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
@Override
- protected void onStart() {
+ public void onStart() {
super.onStart();
final Intent intent = getIntent();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- } else if (intent != null) {
+ if (intent != null) {
try {
this.jidToEdit = Jid.ofEscaped(intent.getStringExtra("jid"));
} catch (final IllegalArgumentException | NullPointerException ignored) {
@@ -758,7 +757,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
private void displayVerificationWarningDialog(final XmppUri xmppUri) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.verify_omemo_keys);
View view = getLayoutInflater().inflate(R.layout.dialog_verify_fingerprints, null);
final CheckBox isTrustedSource = view.findViewById(R.id.trusted_source);
@@ -773,7 +772,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
});
builder.setNegativeButton(R.string.cancel, (dialog, which) -> finish());
- AlertDialog dialog = builder.create();
+ final var dialog = builder.create();
dialog.setCanceledOnTouchOutside(false);
dialog.setOnCancelListener(d -> finish());
dialog.show();
@@ -835,7 +834,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.binding.accountJidLayout.setHint(getString(R.string.username_hint));
} else {
final KnownHostsAdapter mKnownHostsAdapter = new KnownHostsAdapter(this,
- R.layout.simple_list_item,
+ R.layout.item_autocomplete,
xmppConnectionService.getKnownHosts());
this.binding.accountJid.setAdapter(mKnownHostsAdapter);
}
@@ -853,7 +852,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (mAccount != null && mAccount.getJid().getDomain() != null) {
return mAccount.getServer();
} else {
- return Config.DOMAIN_LOCK;
+ return null;
}
}
@@ -940,7 +939,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private void changePresence() {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean manualStatus = sharedPreferences.getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, getResources().getBoolean(R.bool.manually_change_presence));
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
final DialogPresenceBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.dialog_presence, null, false);
String current = mAccount.getPresenceStatusMessage();
if (current != null && !current.trim().isEmpty()) {
@@ -949,7 +948,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
setAvailabilityRadioButton(mAccount.getPresenceStatus(), binding);
binding.show.setVisibility(manualStatus ? View.VISIBLE : View.GONE);
List templates = xmppConnectionService.getPresenceTemplates(mAccount);
- PresenceTemplateAdapter presenceTemplateAdapter = new PresenceTemplateAdapter(this, R.layout.simple_list_item, templates);
+ PresenceTemplateAdapter presenceTemplateAdapter = new PresenceTemplateAdapter(this, R.layout.item_autocomplete, templates);
binding.statusMessage.setAdapter(presenceTemplateAdapter);
binding.statusMessage.setOnItemClickListener((parent, view, position, id) -> {
PresenceTemplate template = (PresenceTemplate) parent.getItemAtPosition(position);
@@ -1144,7 +1143,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.binding.pgpFingerprint.setText(OpenPgpUtils.convertKeyIdToHex(pgpKeyId));
this.binding.pgpFingerprint.setOnClickListener(openPgp);
if ("pgp".equals(messageFingerprint)) {
- this.binding.pgpFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight);
+ this.binding.pgpFingerprintDesc.setTextColor(MaterialColors.getColor(binding.pgpFingerprintDesc, com.google.android.material.R.attr.colorPrimaryVariant));
}
this.binding.pgpFingerprintDesc.setOnClickListener(openPgp);
this.binding.actionDeletePgp.setOnClickListener(delete);
@@ -1155,10 +1154,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (ownAxolotlFingerprint != null && Config.supportOmemo()) {
this.binding.axolotlFingerprintBox.setVisibility(View.VISIBLE);
if (ownAxolotlFingerprint.equals(messageFingerprint)) {
- this.binding.ownFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight);
+ this.binding.ownFingerprintDesc.setTextColor(MaterialColors.getColor(binding.ownFingerprintDesc, com.google.android.material.R.attr.colorPrimaryVariant));
this.binding.ownFingerprintDesc.setText(R.string.omemo_fingerprint_selected_message);
} else {
- this.binding.ownFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption);
+ this.binding.ownFingerprintDesc.setTextColor(MaterialColors.getColor(binding.ownFingerprintDesc, com.google.android.material.R.attr.colorOnSurface));
this.binding.ownFingerprintDesc.setText(R.string.omemo_fingerprint);
}
this.binding.axolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(ownAxolotlFingerprint.substring(2)));
@@ -1222,10 +1221,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private void updateDisplayName(String displayName) {
if (TextUtils.isEmpty(displayName)) {
this.binding.yourName.setText(R.string.no_name_set_instructions);
- this.binding.yourName.setTextAppearance(this, R.style.TextAppearance_Conversations_Body1_Tertiary);
+ this.binding.yourName.setTextColor(MaterialColors.getColor(binding.yourName, com.google.android.material.R.attr.colorOnSurfaceVariant));
} else {
this.binding.yourName.setText(displayName);
- this.binding.yourName.setTextAppearance(this, R.style.TextAppearance_Conversations_Body1);
+ this.binding.yourName.setTextColor(MaterialColors.getColor(binding.yourName, com.google.android.material.R.attr.colorOnSurfaceVariant));
}
}
@@ -1249,7 +1248,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
private void showDeletePgpDialog() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.unpublish_pgp);
builder.setMessage(R.string.unpublish_pgp_message);
builder.setNegativeButton(R.string.cancel, null);
@@ -1279,7 +1278,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
Toast.makeText(EditAccountActivity.this, getString(R.string.device_does_not_support_data_saver, getString(R.string.app_name)), Toast.LENGTH_SHORT).show();
}
});
- } else if (showBatteryWarning && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
+ } else if (showBatteryWarning) {
this.binding.osOptimizationDisable.setText(R.string.disable);
this.binding.osOptimizationHeadline.setText(R.string.battery_optimizations_enabled);
this.binding.osOptimizationBody.setText(getString(R.string.battery_optimizations_enabled_explained, getString(R.string.app_name)));
@@ -1297,7 +1296,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
public void showWipePepDialog() {
- Builder builder = new Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(getString(R.string.clear_other_devices));
builder.setIconAttribute(android.R.attr.alertDialogIcon);
builder.setMessage(getString(R.string.clear_other_devices_desc));
@@ -1324,7 +1323,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (mCaptchaDialog != null && mCaptchaDialog.isShowing()) {
mCaptchaDialog.dismiss();
}
- final Builder builder = new Builder(EditAccountActivity.this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(EditAccountActivity.this);
final View view = getLayoutInflater().inflate(R.layout.captcha, null);
final ImageView imageView = view.findViewById(R.id.captcha);
final EditText input = view.findViewById(R.id.input);
@@ -1372,7 +1371,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (mFetchingMamPrefsToast != null) {
mFetchingMamPrefsToast.cancel();
}
- Builder builder = new Builder(EditAccountActivity.this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(EditAccountActivity.this);
builder.setTitle(R.string.server_side_mam_prefs);
String defaultAttr = prefs.getAttribute("default");
final List defaults = Arrays.asList("never", "roster", "always");
diff --git a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java
index 9ffd9c673..787203f0c 100644
--- a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java
+++ b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java
@@ -13,15 +13,17 @@ import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+import com.google.common.base.Strings;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
-import eu.siacs.conversations.databinding.EnterJidDialogBinding;
+import eu.siacs.conversations.databinding.DialogEnterJidBinding;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
import eu.siacs.conversations.ui.interfaces.OnBackendConnected;
@@ -46,28 +48,28 @@ public class EnterJidDialog extends DialogFragment implements OnBackendConnected
private KnownHostsAdapter knownHostsAdapter;
private Collection whitelistedDomains = Collections.emptyList();
- private EnterJidDialogBinding binding;
+ private DialogEnterJidBinding binding;
private AlertDialog dialog;
private boolean sanityCheckJid = false;
private boolean issuedWarning = false;
public static EnterJidDialog newInstance(
- final List activatedAccounts,
+ final ArrayList activatedAccounts,
final String title,
final String positiveButton,
final String prefilledJid,
final String account,
boolean allowEditJid,
final boolean sanity_check_jid) {
- EnterJidDialog dialog = new EnterJidDialog();
+ final EnterJidDialog dialog = new EnterJidDialog();
Bundle bundle = new Bundle();
bundle.putString(TITLE_KEY, title);
bundle.putString(POSITIVE_BUTTON_KEY, positiveButton);
bundle.putString(PREFILLED_JID_KEY, prefilledJid);
bundle.putString(ACCOUNT_KEY, account);
bundle.putBoolean(ALLOW_EDIT_JID_KEY, allowEditJid);
- bundle.putStringArrayList(ACCOUNTS_LIST_KEY, (ArrayList) activatedAccounts);
+ bundle.putStringArrayList(ACCOUNTS_LIST_KEY, activatedAccounts);
bundle.putBoolean(SANITY_CHECK_JID, sanity_check_jid);
dialog.setArguments(bundle);
return dialog;
@@ -91,16 +93,16 @@ public class EnterJidDialog extends DialogFragment implements OnBackendConnected
@NonNull
@Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- builder.setTitle(getArguments().getString(TITLE_KEY));
+ public Dialog onCreateDialog(final Bundle savedInstanceState) {
+ final var arguments = getArguments();
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
+ builder.setTitle(arguments.getString(TITLE_KEY));
binding =
- DataBindingUtil.inflate(
- getActivity().getLayoutInflater(), R.layout.enter_jid_dialog, null, false);
- this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.simple_list_item);
+ DataBindingUtil.inflate(requireActivity().getLayoutInflater(), R.layout.dialog_enter_jid, null, false);
+ this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.item_autocomplete);
binding.jid.setAdapter(this.knownHostsAdapter);
binding.jid.addTextChangedListener(this);
- String prefilledJid = getArguments().getString(PREFILLED_JID_KEY);
+ final String prefilledJid = arguments.getString(PREFILLED_JID_KEY);
if (prefilledJid != null) {
binding.jid.append(prefilledJid);
if (!getArguments().getBoolean(ALLOW_EDIT_JID_KEY)) {
@@ -114,18 +116,18 @@ public class EnterJidDialog extends DialogFragment implements OnBackendConnected
DelayedHintHelper.setHint(R.string.account_settings_example_jabber_id, binding.jid);
- String account = getArguments().getString(ACCOUNT_KEY);
- if (account == null) {
+ final String account = getArguments().getString(ACCOUNT_KEY);
+ if (Strings.isNullOrEmpty(account)) {
StartConversationActivity.populateAccountSpinner(
getActivity(),
- getArguments().getStringArrayList(ACCOUNTS_LIST_KEY),
+ arguments.getStringArrayList(ACCOUNTS_LIST_KEY),
binding.account);
} else {
- ArrayAdapter adapter =
- new ArrayAdapter<>(
- getActivity(), R.layout.simple_list_item, new String[] {account});
+ final ArrayAdapter adapter =
+ new ArrayAdapter<>(requireActivity(), R.layout.item_autocomplete, new String[] {account});
+ binding.account.setText(account);
binding.account.setEnabled(false);
- adapter.setDropDownViewResource(R.layout.simple_list_item);
+ adapter.setDropDownViewResource(R.layout.item_autocomplete);
binding.account.setAdapter(adapter);
}
@@ -135,9 +137,7 @@ public class EnterJidDialog extends DialogFragment implements OnBackendConnected
this.dialog = builder.create();
View.OnClickListener dialogOnClick =
- v -> {
- handleEnter(binding, account);
- };
+ v -> handleEnter(binding, account);
binding.jid.setOnEditorActionListener(
(v, actionId, event) -> {
@@ -150,21 +150,13 @@ public class EnterJidDialog extends DialogFragment implements OnBackendConnected
return dialog;
}
- private void handleEnter(EnterJidDialogBinding binding, String account) {
+ private void handleEnter(DialogEnterJidBinding binding, String account) {
final Jid accountJid;
if (!binding.account.isEnabled() && account == null) {
return;
}
try {
- if (Config.DOMAIN_LOCK != null) {
- accountJid =
- Jid.ofEscaped(
- (String) binding.account.getSelectedItem(),
- Config.DOMAIN_LOCK,
- null);
- } else {
- accountJid = Jid.ofEscaped((String) binding.account.getSelectedItem());
- }
+ accountJid = Jid.ofEscaped((String) binding.account.getEditableText().toString());
} catch (final IllegalArgumentException e) {
return;
}
diff --git a/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java b/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java
index e17aab3a4..7ed3fbd9d 100644
--- a/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java
+++ b/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java
@@ -13,6 +13,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.textfield.TextInputLayout;
import java.util.ArrayList;
@@ -50,11 +51,11 @@ public class JoinConferenceDialog extends DialogFragment implements OnBackendCon
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setTitle(R.string.join_public_channel);
- DialogJoinConferenceBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.dialog_join_conference, null, false);
+ final DialogJoinConferenceBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.dialog_join_conference, null, false);
DelayedHintHelper.setHint(R.string.channel_full_jid_example, binding.jid);
- this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.simple_list_item);
+ this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.item_autocomplete);
binding.jid.setAdapter(knownHostsAdapter);
String prefilledJid = getArguments().getString(PREFILLED_JID_KEY);
if (prefilledJid != null) {
@@ -117,6 +118,6 @@ public class JoinConferenceDialog extends DialogFragment implements OnBackendCon
}
public interface JoinConferenceDialogListener {
- void onJoinDialogPositiveClick(Dialog dialog, Spinner spinner, TextInputLayout jidLayout, AutoCompleteTextView jid, boolean isBookmarkChecked);
+ void onJoinDialogPositiveClick(Dialog dialog, AutoCompleteTextView spinner, TextInputLayout jidLayout, AutoCompleteTextView jid, boolean isBookmarkChecked);
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java
index 2627e0e59..0e5ec7156 100644
--- a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java
@@ -40,7 +40,6 @@ import eu.siacs.conversations.ui.util.LocationHelper;
import eu.siacs.conversations.ui.widget.Marker;
import eu.siacs.conversations.ui.widget.MyLocation;
import eu.siacs.conversations.ui.util.SettingsUtils;
-import eu.siacs.conversations.utils.ThemeHelper;
public abstract class LocationActivity extends ActionBarActivity implements LocationListener {
protected LocationManager locationManager;
@@ -78,7 +77,6 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Context ctx = getApplicationContext();
- setTheme(ThemeHelper.find(this));
final PackageManager packageManager = ctx.getPackageManager();
hasLocationFeature = packageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION) ||
@@ -90,7 +88,7 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
// Ask for location permissions if location services are enabled and we're
// just starting the activity (we don't want to keep pestering them on every
// screen rotation or if there's no point because it's disabled anyways).
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && savedInstanceState == null) {
+ if (savedInstanceState == null) {
requestPermissions(REQUEST_CODE_CREATE);
}
@@ -224,7 +222,6 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca
@Override
protected void onResume() {
super.onResume();
- SettingsUtils.applyScreenshotPreventionSetting(this);
Configuration.getInstance().load(this, getPreferences());
map.onResume();
this.setMyLoc(null);
diff --git a/src/main/java/eu/siacs/conversations/ui/MediaBrowserActivity.java b/src/main/java/eu/siacs/conversations/ui/MediaBrowserActivity.java
index 3793203dd..f8d60d557 100644
--- a/src/main/java/eu/siacs/conversations/ui/MediaBrowserActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/MediaBrowserActivity.java
@@ -29,6 +29,7 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this,R.layout.activity_media_browser);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
diff --git a/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java b/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java
index 23f3c82d8..56913b2a1 100644
--- a/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java
@@ -33,6 +33,8 @@ import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -40,7 +42,6 @@ import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.MTMDecision;
import eu.siacs.conversations.services.MemorizingTrustManager;
import eu.siacs.conversations.ui.util.SettingsUtils;
-import eu.siacs.conversations.utils.ThemeHelper;
public class MemorizingActivity extends AppCompatActivity implements OnClickListener, OnCancelListener {
@@ -53,10 +54,7 @@ public class MemorizingActivity extends AppCompatActivity implements OnClickList
@Override
public void onCreate(Bundle savedInstanceState) {
LOGGER.log(Level.FINE, "onCreate");
- setTheme(ThemeHelper.find(this));
super.onCreate(savedInstanceState);
- getLayoutInflater().inflate(R.layout.toolbar, findViewById(android.R.id.content));
- setSupportActionBar(findViewById(R.id.toolbar));
}
@Override
@@ -69,7 +67,7 @@ public class MemorizingActivity extends AppCompatActivity implements OnClickList
int titleId = i.getIntExtra(MemorizingTrustManager.DECISION_TITLE_ID, R.string.mtm_accept_cert);
String cert = i.getStringExtra(MemorizingTrustManager.DECISION_INTENT_CERT);
LOGGER.log(Level.FINE, "onResume with " + i.getExtras() + " decId=" + decisionId + " data: " + i.getData());
- dialog = new AlertDialog.Builder(this).setTitle(titleId)
+ dialog = new MaterialAlertDialogBuilder(this).setTitle(titleId)
.setMessage(cert)
.setPositiveButton(R.string.always, this)
.setNeutralButton(R.string.once, this)
diff --git a/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java b/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java
index e759ee18e..f6eae81cf 100644
--- a/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java
@@ -102,8 +102,9 @@ public class MucUsersActivity extends XmppActivity implements XmppConnectionServ
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- ActivityMucUsersBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_users);
+ final ActivityMucUsersBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_users);
setSupportActionBar(binding.toolbar);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
configureActionBar(getSupportActionBar(), true);
this.userAdapter = new UserAdapter(getPreferences().getBoolean("advanced_muc_mode", false));
binding.list.setAdapter(this.userAdapter);
diff --git a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java
index 44af0d0b2..ac7559769 100644
--- a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java
@@ -11,6 +11,9 @@ import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.color.MaterialColors;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
@@ -33,10 +36,7 @@ public abstract class OmemoActivity extends XmppActivity {
Object account = v.getTag(R.id.TAG_ACCOUNT);
Object fingerprint = v.getTag(R.id.TAG_FINGERPRINT);
Object fingerprintStatus = v.getTag(R.id.TAG_FINGERPRINT_STATUS);
- if (account != null
- && fingerprint != null
- && account instanceof Account
- && fingerprintStatus != null
+ if (account instanceof Account
&& fingerprint instanceof String
&& fingerprintStatus instanceof FingerprintStatus) {
getMenuInflater().inflate(R.menu.omemo_key_context, menu);
@@ -130,8 +130,8 @@ public abstract class OmemoActivity extends XmppActivity {
binding.tglTrust.setChecked(status.isTrusted());
if (status.isActive()) {
- binding.key.setTextAppearance(this,R.style.TextAppearance_Conversations_Fingerprint);
- binding.keyType.setTextAppearance(this,R.style.TextAppearance_Conversations_Caption);
+ binding.key.setTextColor(MaterialColors.getColor(binding.key, com.google.android.material.R.attr.colorOnSurface));
+ binding.keyType.setTextColor(MaterialColors.getColor(binding.keyType, com.google.android.material.R.attr.colorOnSurface));
if (status.isVerified()) {
binding.verifiedFingerprint.setVisibility(View.VISIBLE);
binding.verifiedFingerprint.setAlpha(1.0f);
@@ -157,8 +157,8 @@ public abstract class OmemoActivity extends XmppActivity {
toast = v -> hideToast();
}
} else {
- binding.key.setTextAppearance(this,R.style.TextAppearance_Conversations_Fingerprint_Disabled);
- binding.keyType.setTextAppearance(this,R.style.TextAppearance_Conversations_Caption_Disabled);
+ binding.key.setTextColor(MaterialColors.getColor(binding.key, com.google.android.material.R.attr.colorOnSurfaceVariant));
+ binding.keyType.setTextColor(MaterialColors.getColor(binding.keyType, com.google.android.material.R.attr.colorOnSurfaceVariant));
toast = v -> replaceToast(getString(R.string.this_device_is_no_longer_in_use), false);
if (status.isVerified()) {
binding.tglTrust.setVisibility(View.GONE);
@@ -181,7 +181,7 @@ public abstract class OmemoActivity extends XmppActivity {
binding.keyType.setVisibility(View.GONE);
}
if (highlight) {
- binding.keyType.setTextAppearance(this,R.style.TextAppearance_Conversations_Caption_Highlight);
+ binding.keyType.setTextColor(MaterialColors.getColor(binding.keyType, com.google.android.material.R.attr.colorPrimaryVariant));
binding.keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509_selected_message : R.string.omemo_fingerprint_selected_message));
} else {
binding.keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509 : R.string.omemo_fingerprint));
@@ -191,7 +191,7 @@ public abstract class OmemoActivity extends XmppActivity {
}
public void showPurgeKeyDialog(final Account account, final String fingerprint) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.distrust_omemo_key);
builder.setMessage(R.string.distrust_omemo_key_text);
builder.setNegativeButton(getString(R.string.cancel), null);
diff --git a/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java
index 658567aa6..aaef09978 100644
--- a/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java
@@ -91,6 +91,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_publish_profile_picture);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(this.binding.toolbar);
configureActionBar(getSupportActionBar());
this.binding.cancelButton.setOnClickListener((v) -> this.finish());
@@ -114,6 +115,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
final CropImage.ActivityResult result = CropImage.getActivityResult(data);
if (resultCode == RESULT_OK) {
diff --git a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
index b6822b301..2c972734c 100644
--- a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
@@ -18,6 +18,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
+import androidx.databinding.DataBindingUtil;
import com.canhub.cropper.CropImage;
@@ -25,6 +26,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.databinding.ActivityPublishProfilePictureBinding;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.interfaces.OnAvatarPublication;
@@ -77,7 +79,6 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
public void onAvatarPublicationFailed(int res) {
runOnUiThread(() -> {
hintOrWarning.setText(res);
- hintOrWarning.setTextAppearance(this,R.style.TextAppearance_Conversations_Body1_Warning);
hintOrWarning.setVisibility(View.VISIBLE);
publishing = false;
togglePublishButton(true, R.string.publish);
@@ -87,8 +88,12 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_publish_profile_picture);
- setSupportActionBar(findViewById(R.id.toolbar));
+
+ ActivityPublishProfilePictureBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_publish_profile_picture);
+
+ setSupportActionBar(binding.toolbar);
+
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
this.avatar = findViewById(R.id.account_image);
this.cancelButton = findViewById(R.id.cancel_button);
@@ -220,7 +225,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
}
@Override
- protected void onStart() {
+ public void onStart() {
super.onStart();
final Intent intent = getIntent();
this.mInitialAccountSetup = intent != null && intent.getBooleanExtra("setup", false);
@@ -261,7 +266,6 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
if (bm == null) {
togglePublishButton(false, R.string.publish);
this.hintOrWarning.setVisibility(View.VISIBLE);
- this.hintOrWarning.setTextAppearance(this,R.style.TextAppearance_Conversations_Body1_Warning);
this.hintOrWarning.setText(R.string.error_publish_avatar_converting);
return;
}
@@ -272,7 +276,6 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
} else {
togglePublishButton(false, R.string.publish);
this.hintOrWarning.setVisibility(View.VISIBLE);
- this.hintOrWarning.setTextAppearance(this,R.style.TextAppearance_Conversations_Body1_Warning);
if (account.getStatus() == Account.State.ONLINE) {
this.hintOrWarning.setText(R.string.error_publish_avatar_no_server_support);
} else {
diff --git a/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java b/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java
index 1179de143..7c13b54fa 100644
--- a/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java
@@ -15,6 +15,7 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
+import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import com.google.common.collect.ImmutableSet;
@@ -33,10 +34,9 @@ import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.ActivityRecordingBinding;
import eu.siacs.conversations.ui.util.SettingsUtils;
-import eu.siacs.conversations.utils.ThemeHelper;
import eu.siacs.conversations.utils.TimeFrameUtils;
-public class RecordingActivity extends Activity implements View.OnClickListener {
+public class RecordingActivity extends BaseActivity implements View.OnClickListener {
private ActivityRecordingBinding binding;
@@ -61,7 +61,6 @@ public class RecordingActivity extends Activity implements View.OnClickListener
@Override
protected void onCreate(Bundle savedInstanceState) {
- setTheme(ThemeHelper.findDialog(this));
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_recording);
this.binding.cancelButton.setOnClickListener(this);
@@ -69,19 +68,13 @@ public class RecordingActivity extends Activity implements View.OnClickListener
this.setFinishOnTouchOutside(false);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
-
@Override
- protected void onResume() {
- super.onResume();
- SettingsUtils.applyScreenshotPreventionSetting(this);
- }
-
- @Override
- protected void onStart() {
+ public void onStart() {
super.onStart();
if (!startRecording()) {
this.binding.shareButton.setEnabled(false);
- this.binding.timer.setTextAppearance(this, R.style.TextAppearance_Conversations_Title);
+ this.binding.timer.setTextAppearance(com.google.android.material.R.style.TextAppearance_Material3_BodyMedium);
+ // TODO reset font family. make red?
this.binding.timer.setText(R.string.unable_to_start_recording);
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java
index 97b2ccb52..75c9468f9 100644
--- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java
@@ -179,6 +179,7 @@ public class RtpSessionActivity extends XmppActivity
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_rtp_session);
setSupportActionBar(binding.toolbar);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
}
@Override
@@ -920,34 +921,34 @@ public class RtpSessionActivity extends XmppActivity
} else if (state == RtpEndUserState.INCOMING_CALL) {
this.binding.rejectCall.setContentDescription(getString(R.string.dismiss_call));
this.binding.rejectCall.setOnClickListener(this::rejectCall);
- this.binding.rejectCall.setImageResource(R.drawable.ic_call_end_white_48dp);
+ this.binding.rejectCall.setImageResource(R.drawable.ic_call_end_24dp);
this.binding.rejectCall.setVisibility(View.VISIBLE);
this.binding.endCall.setVisibility(View.INVISIBLE);
this.binding.acceptCall.setContentDescription(getString(R.string.answer_call));
this.binding.acceptCall.setOnClickListener(this::acceptCall);
- this.binding.acceptCall.setImageResource(R.drawable.ic_call_white_48dp);
+ this.binding.acceptCall.setImageResource(R.drawable.ic_call_24dp);
this.binding.acceptCall.setVisibility(View.VISIBLE);
} else if (state == RtpEndUserState.INCOMING_CONTENT_ADD) {
this.binding.rejectCall.setContentDescription(
getString(R.string.reject_switch_to_video));
this.binding.rejectCall.setOnClickListener(this::rejectContentAdd);
- this.binding.rejectCall.setImageResource(R.drawable.ic_clear_white_48dp);
+ this.binding.rejectCall.setImageResource(R.drawable.ic_clear_24dp);
this.binding.rejectCall.setVisibility(View.VISIBLE);
this.binding.endCall.setVisibility(View.INVISIBLE);
this.binding.acceptCall.setContentDescription(getString(R.string.accept));
this.binding.acceptCall.setOnClickListener((v -> acceptContentAdd(contentAddition)));
- this.binding.acceptCall.setImageResource(R.drawable.ic_baseline_check_24);
+ this.binding.acceptCall.setImageResource(R.drawable.ic_check_24dp);
this.binding.acceptCall.setVisibility(View.VISIBLE);
} else if (asList(RtpEndUserState.DECLINED_OR_BUSY, RtpEndUserState.CONTACT_OFFLINE)
.contains(state)) {
this.binding.rejectCall.setContentDescription(getString(R.string.exit));
this.binding.rejectCall.setOnClickListener(this::exit);
- this.binding.rejectCall.setImageResource(R.drawable.ic_clear_white_48dp);
+ this.binding.rejectCall.setImageResource(R.drawable.ic_clear_24dp);
this.binding.rejectCall.setVisibility(View.VISIBLE);
this.binding.endCall.setVisibility(View.INVISIBLE);
this.binding.acceptCall.setContentDescription(getString(R.string.record_voice_mail));
this.binding.acceptCall.setOnClickListener(this::recordVoiceMail);
- this.binding.acceptCall.setImageResource(R.drawable.ic_voicemail_white_24dp);
+ this.binding.acceptCall.setImageResource(R.drawable.ic_voicemail_24dp);
this.binding.acceptCall.setVisibility(View.VISIBLE);
} else if (asList(
RtpEndUserState.CONNECTIVITY_ERROR,
@@ -958,18 +959,18 @@ public class RtpSessionActivity extends XmppActivity
.contains(state)) {
this.binding.rejectCall.setContentDescription(getString(R.string.exit));
this.binding.rejectCall.setOnClickListener(this::exit);
- this.binding.rejectCall.setImageResource(R.drawable.ic_clear_white_48dp);
+ this.binding.rejectCall.setImageResource(R.drawable.ic_clear_24dp);
this.binding.rejectCall.setVisibility(View.VISIBLE);
this.binding.endCall.setVisibility(View.INVISIBLE);
this.binding.acceptCall.setContentDescription(getString(R.string.try_again));
this.binding.acceptCall.setOnClickListener(this::retry);
- this.binding.acceptCall.setImageResource(R.drawable.ic_replay_white_48dp);
+ this.binding.acceptCall.setImageResource(R.drawable.ic_replay_24dp);
this.binding.acceptCall.setVisibility(View.VISIBLE);
} else {
this.binding.rejectCall.setVisibility(View.INVISIBLE);
this.binding.endCall.setContentDescription(getString(R.string.hang_up));
this.binding.endCall.setOnClickListener(this::endCall);
- this.binding.endCall.setImageResource(R.drawable.ic_call_end_white_48dp);
+ this.binding.endCall.setImageResource(R.drawable.ic_call_end_24dp);
this.binding.endCall.setVisibility(View.VISIBLE);
this.binding.acceptCall.setVisibility(View.INVISIBLE);
}
@@ -1038,7 +1039,7 @@ public class RtpSessionActivity extends XmppActivity
switch (selectedAudioDevice) {
case EARPIECE -> {
this.binding.inCallActionRight.setImageResource(
- R.drawable.ic_volume_off_black_24dp);
+ R.drawable.ic_volume_off_24dp);
if (numberOfChoices >= 2) {
this.binding.inCallActionRight.setOnClickListener(this::switchToSpeaker);
} else {
@@ -1047,12 +1048,12 @@ public class RtpSessionActivity extends XmppActivity
}
}
case WIRED_HEADSET -> {
- this.binding.inCallActionRight.setImageResource(R.drawable.ic_headset_black_24dp);
+ this.binding.inCallActionRight.setImageResource(R.drawable.ic_headset_mic_24dp);
this.binding.inCallActionRight.setOnClickListener(null);
this.binding.inCallActionRight.setClickable(false);
}
case SPEAKER_PHONE -> {
- this.binding.inCallActionRight.setImageResource(R.drawable.ic_volume_up_black_24dp);
+ this.binding.inCallActionRight.setImageResource(R.drawable.ic_volume_up_24dp);
if (numberOfChoices >= 2) {
this.binding.inCallActionRight.setOnClickListener(this::switchToEarpiece);
} else {
@@ -1062,7 +1063,7 @@ public class RtpSessionActivity extends XmppActivity
}
case BLUETOOTH -> {
this.binding.inCallActionRight.setImageResource(
- R.drawable.ic_bluetooth_audio_black_24dp);
+ R.drawable.ic_bluetooth_audio_24dp);
this.binding.inCallActionRight.setOnClickListener(null);
this.binding.inCallActionRight.setClickable(false);
}
@@ -1076,17 +1077,17 @@ public class RtpSessionActivity extends XmppActivity
this.binding.inCallActionRight.setVisibility(View.VISIBLE);
if (isCameraSwitchable) {
this.binding.inCallActionFarRight.setImageResource(
- R.drawable.ic_flip_camera_android_black_24dp);
+ R.drawable.ic_flip_camera_android_24dp);
this.binding.inCallActionFarRight.setVisibility(View.VISIBLE);
this.binding.inCallActionFarRight.setOnClickListener(this::switchCamera);
} else {
this.binding.inCallActionFarRight.setVisibility(View.GONE);
}
if (videoEnabled) {
- this.binding.inCallActionRight.setImageResource(R.drawable.ic_videocam_black_24dp);
+ this.binding.inCallActionRight.setImageResource(R.drawable.ic_videocam_24dp);
this.binding.inCallActionRight.setOnClickListener(this::disableVideo);
} else {
- this.binding.inCallActionRight.setImageResource(R.drawable.ic_videocam_off_black_24dp);
+ this.binding.inCallActionRight.setImageResource(R.drawable.ic_videocam_off_24dp);
this.binding.inCallActionRight.setOnClickListener(this::enableVideo);
}
}
@@ -1140,10 +1141,10 @@ public class RtpSessionActivity extends XmppActivity
@SuppressLint("RestrictedApi")
private void updateInCallButtonConfigurationMicrophone(final boolean microphoneEnabled) {
if (microphoneEnabled) {
- this.binding.inCallActionLeft.setImageResource(R.drawable.ic_mic_black_24dp);
+ this.binding.inCallActionLeft.setImageResource(R.drawable.ic_mic_24dp);
this.binding.inCallActionLeft.setOnClickListener(this::disableMicrophone);
} else {
- this.binding.inCallActionLeft.setImageResource(R.drawable.ic_mic_off_black_24dp);
+ this.binding.inCallActionLeft.setImageResource(R.drawable.ic_mic_off_24dp);
this.binding.inCallActionLeft.setOnClickListener(this::enableMicrophone);
}
this.binding.inCallActionLeft.setVisibility(View.VISIBLE);
diff --git a/src/main/java/eu/siacs/conversations/ui/ScanActivity.java b/src/main/java/eu/siacs/conversations/ui/ScanActivity.java
index 95505647d..bb0a69c7e 100644
--- a/src/main/java/eu/siacs/conversations/ui/ScanActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ScanActivity.java
@@ -182,7 +182,6 @@ public final class ScanActivity extends Activity implements SurfaceTextureListen
@Override
protected void onResume() {
super.onResume();
- SettingsUtils.applyScreenshotPreventionSetting(this);
maybeOpenCamera();
}
diff --git a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java
index ec279f58e..d49d7d23d 100644
--- a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java
@@ -42,8 +42,10 @@ import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
+import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.color.MaterialColors;
import com.google.common.base.Strings;
import java.lang.ref.WeakReference;
@@ -64,7 +66,6 @@ import eu.siacs.conversations.ui.util.DateSeparator;
import eu.siacs.conversations.ui.util.ListViewUtils;
import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.ShareUtil;
-import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.FtsUtils;
import eu.siacs.conversations.utils.MessageUtils;
@@ -95,6 +96,7 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc
}
super.onCreate(bundle);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_search);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(this.binding.toolbar);
configureActionBar(getSupportActionBar());
this.messageListAdapter = new MessageAdapter(this, this.messages, uuid == null);
@@ -223,12 +225,12 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc
private void changeBackground(boolean hasSearch, boolean hasResults) {
if (hasSearch) {
if (hasResults) {
- binding.searchResults.setBackgroundColor(StyledAttributes.getColor(this, R.attr.color_background_secondary));
+ binding.searchResults.setBackgroundColor(MaterialColors.getColor(binding.searchResults, com.google.android.material.R.attr.colorSurface));
} else {
- binding.searchResults.setBackground(StyledAttributes.getDrawable(this, R.attr.activity_background_no_results));
+ binding.searchResults.setBackgroundResource(R.drawable.background_no_results);
}
} else {
- binding.searchResults.setBackground(StyledAttributes.getDrawable(this, R.attr.activity_background_search));
+ binding.searchResults.setBackgroundResource(R.drawable.background_search);
}
}
@@ -248,14 +250,14 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc
if (!currentSearch.watch(term)) {
return;
}
- if (term.size() > 0) {
- xmppConnectionService.search(term, uuid,this);
- } else {
+ if (term.isEmpty()) {
MessageSearchTask.cancelRunningTasks();
this.messages.clear();
messageListAdapter.setHighlightedTerm(null);
messageListAdapter.notifyDataSetChanged();
changeBackground(false, false);
+ } else {
+ xmppConnectionService.search(term, uuid,this);
}
}
@@ -267,7 +269,7 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc
DateSeparator.addAll(messages);
this.messages.addAll(messages);
messageListAdapter.notifyDataSetChanged();
- changeBackground(true, messages.size() > 0);
+ changeBackground(true, !messages.isEmpty());
ListViewUtils.scrollToBottom(this.binding.searchResults);
});
}
diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
index b9eaf32af..0e80fa1d5 100644
--- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
@@ -22,7 +22,10 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
+import androidx.databinding.DataBindingUtil;
+import com.google.android.material.color.DynamicColors;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
@@ -37,8 +40,10 @@ import java.util.Collections;
import java.util.List;
import eu.siacs.conversations.Config;
+import eu.siacs.conversations.Conversations;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.OmemoSetting;
+import eu.siacs.conversations.databinding.ActivitySettingsBinding;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.services.ExportBackupService;
@@ -46,10 +51,8 @@ import eu.siacs.conversations.services.MemorizingTrustManager;
import eu.siacs.conversations.services.QuickConversationsService;
import eu.siacs.conversations.services.UnifiedPushDistributor;
import eu.siacs.conversations.ui.util.SettingsUtils;
-import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.GeoHelper;
import eu.siacs.conversations.utils.TimeFrameUtils;
-import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.Jid;
public class SettingsActivity extends XmppActivity implements OnSharedPreferenceChangeListener {
@@ -74,7 +77,7 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_settings);
+ final ActivitySettingsBinding binding = DataBindingUtil.setContentView(this,R.layout.activity_settings);
FragmentManager fm = getFragmentManager();
mSettingsFragment = (SettingsFragment) fm.findFragmentById(R.id.settings_content);
if (mSettingsFragment == null
@@ -83,13 +86,8 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
fm.beginTransaction().replace(R.id.settings_content, mSettingsFragment).commit();
}
mSettingsFragment.setActivityIntent(getIntent());
- this.mTheme = findTheme();
- setTheme(this.mTheme);
- getWindow()
- .getDecorView()
- .setBackgroundColor(
- StyledAttributes.getColor(this, R.attr.color_background_primary));
- setSupportActionBar(findViewById(R.id.toolbar));
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
+ setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
}
@@ -185,6 +183,12 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
}
}
+ final PreferenceCategory uiPreferenceCategory = (PreferenceCategory) mSettingsFragment.findPreference("ui");
+ final Preference dynamicColorsPreference = mSettingsFragment.findPreference("dynamic_colors");
+ if (dynamicColorsPreference != null && !DynamicColors.isDynamicColorAvailable()) {
+ uiPreferenceCategory.removePreference(dynamicColorsPreference);
+ }
+
ListPreference automaticMessageDeletionList =
(ListPreference) mSettingsFragment.findPreference(AUTOMATIC_MESSAGE_DELETION);
if (automaticMessageDeletionList != null) {
@@ -204,36 +208,6 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
automaticMessageDeletionList.setEntryValues(entryValues);
}
- boolean removeLocation =
- new Intent("eu.siacs.conversations.location.request")
- .resolveActivity(getPackageManager())
- == null;
- boolean removeVoice =
- new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION)
- .resolveActivity(getPackageManager())
- == null;
-
- ListPreference quickAction =
- (ListPreference) mSettingsFragment.findPreference("quick_action");
- if (quickAction != null && (removeLocation || removeVoice)) {
- ArrayList entries =
- new ArrayList<>(Arrays.asList(quickAction.getEntries()));
- ArrayList entryValues =
- new ArrayList<>(Arrays.asList(quickAction.getEntryValues()));
- int index = entryValues.indexOf("location");
- if (index > 0 && removeLocation) {
- entries.remove(index);
- entryValues.remove(index);
- }
- index = entryValues.indexOf("voice");
- if (index > 0 && removeVoice) {
- entries.remove(index);
- entryValues.remove(index);
- }
- quickAction.setEntries(entries.toArray(new CharSequence[entries.size()]));
- quickAction.setEntryValues(entryValues.toArray(new CharSequence[entryValues.size()]));
- }
-
final Preference removeCertsPreference =
mSettingsFragment.findPreference("remove_trusted_certificates");
if (removeCertsPreference != null) {
@@ -242,17 +216,16 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
final MemorizingTrustManager mtm =
xmppConnectionService.getMemorizingTrustManager();
final ArrayList aliases = Collections.list(mtm.getCertificates());
- if (aliases.size() == 0) {
+ if (aliases.isEmpty()) {
displayToast(getString(R.string.toast_no_trusted_certs));
return true;
}
final ArrayList selectedItems = new ArrayList<>();
- final AlertDialog.Builder dialogBuilder =
- new AlertDialog.Builder(SettingsActivity.this);
+ final MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(SettingsActivity.this);
dialogBuilder.setTitle(
getResources().getString(R.string.dialog_manage_certs_title));
dialogBuilder.setMultiChoiceItems(
- aliases.toArray(new CharSequence[aliases.size()]),
+ aliases.toArray(new CharSequence[0]),
null,
(dialog, indexSelected, isChecked) -> {
if (isChecked) {
@@ -262,7 +235,7 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
}
((AlertDialog) dialog)
.getButton(DialogInterface.BUTTON_POSITIVE)
- .setEnabled(selectedItems.size() > 0);
+ .setEnabled(!selectedItems.isEmpty());
});
dialogBuilder.setPositiveButton(
@@ -273,13 +246,12 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
if (count > 0) {
for (int i = 0; i < count; i++) {
try {
- Integer item =
- Integer.valueOf(
+ final int item =
+ Integer.parseInt(
selectedItems.get(i).toString());
String alias = aliases.get(item);
mtm.deleteCertificate(alias);
- } catch (KeyStoreException e) {
- e.printStackTrace();
+ } catch (final KeyStoreException e) {
displayToast("Error: " + e.getLocalizedMessage());
}
}
@@ -372,10 +344,8 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
private boolean isCallable(final Intent i) {
return i != null
- && getPackageManager()
- .queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY)
- .size()
- > 0;
+ && !getPackageManager()
+ .queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY).isEmpty();
}
private boolean cleanCache() {
@@ -413,7 +383,7 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
}
private boolean deleteOmemoIdentities() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.pref_delete_omemo_identities);
final List accounts = new ArrayList<>();
for (Account account : xmppConnectionService.getAccounts()) {
@@ -502,10 +472,12 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
} else if (name.equals(AUTOMATIC_MESSAGE_DELETION)) {
xmppConnectionService.expireOldMessages(true);
} else if (name.equals(THEME)) {
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- }
+ final var value = preferences.getString(THEME,getString(R.string.theme));
+ final int desiredNightMode = Conversations.getDesiredNightMode(value);
+ setDesiredNightMode(desiredNightMode);
+ } else if (name.equals("dynamic_colors")) {
+ final var value = preferences.getBoolean("dynamic_colors",false);
+ setDynamicColors(value);
} else if (name.equals(PREVENT_SCREENSHOTS)) {
SettingsUtils.applyScreenshotPreventionSetting(this);
} else if (UnifiedPushDistributor.PREFERENCES.contains(name)) {
@@ -572,7 +544,7 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
private void createBackup() {
ContextCompat.startForegroundService(this, new Intent(this, ExportBackupService.class));
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setMessage(R.string.backup_started_message);
builder.setPositiveButton(R.string.ok, null);
builder.create().show();
diff --git a/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java
index 7e53fe897..c7ddcc01c 100644
--- a/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java
@@ -5,7 +5,6 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
-import android.os.Build;
import android.os.Bundle;
import android.view.View;
@@ -15,11 +14,6 @@ import androidx.databinding.DataBindingUtil;
import com.google.android.material.snackbar.Snackbar;
import com.google.common.math.DoubleMath;
-import org.osmdroid.api.IGeoPoint;
-import org.osmdroid.util.GeoPoint;
-
-import java.math.RoundingMode;
-
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.ActivityShareLocationBinding;
@@ -27,7 +21,11 @@ import eu.siacs.conversations.ui.util.LocationHelper;
import eu.siacs.conversations.ui.widget.Marker;
import eu.siacs.conversations.ui.widget.MyLocation;
import eu.siacs.conversations.utils.LocationProvider;
-import eu.siacs.conversations.utils.ThemeHelper;
+
+import org.osmdroid.api.IGeoPoint;
+import org.osmdroid.util.GeoPoint;
+
+import java.math.RoundingMode;
public class ShareLocationActivity extends LocationActivity implements LocationListener {
@@ -58,6 +56,7 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_share_location);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
setupMapView(binding.map, LocationProvider.getGeoPoint(this));
@@ -71,13 +70,12 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
this.snackBar.setAction(R.string.enable, view -> {
if (isLocationEnabledAndAllowed()) {
updateUi();
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !hasLocationPermissions()) {
+ } else if (!hasLocationPermissions()) {
requestPermissions(REQUEST_CODE_SNACKBAR_PRESSED);
} else if (!isLocationEnabled()) {
startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}
});
- ThemeHelper.fix(this.snackBar);
this.binding.shareButton.setOnClickListener(this::shareLocation);
@@ -87,7 +85,7 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
if (!marker_fixed_to_loc) {
if (!isLocationEnabled()) {
startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ } else {
requestPermissions(REQUEST_CODE_FAB_PRESSED);
}
}
@@ -117,16 +115,9 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
@NonNull final int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- if (grantResults.length > 0 &&
- grantResults[0] != PackageManager.PERMISSION_GRANTED &&
- Build.VERSION.SDK_INT >= 23 &&
- permissions.length > 0 &&
- (
- Manifest.permission.LOCATION_HARDWARE.equals(permissions[0]) ||
- Manifest.permission.ACCESS_FINE_LOCATION.equals(permissions[0]) ||
- Manifest.permission.ACCESS_COARSE_LOCATION.equals(permissions[0])
- ) &&
- !shouldShowRequestPermissionRationale(permissions[0])) {
+ if (grantResults.length > 0 && grantResults[0] != PackageManager.PERMISSION_GRANTED && permissions.length > 0 && (
+ Manifest.permission.LOCATION_HARDWARE.equals(permissions[0]) || Manifest.permission.ACCESS_FINE_LOCATION.equals(permissions[0]) || Manifest.permission.ACCESS_COARSE_LOCATION.equals(permissions[0])
+ ) && !shouldShowRequestPermissionRationale(permissions[0])) {
noAskAgain = true;
}
@@ -172,7 +163,7 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
}
@Override
- public void onLocationChanged(final Location location) {
+ public void onLocationChanged(@NonNull final Location location) {
if (this.myLoc == null) {
this.marker_fixed_to_loc = true;
}
@@ -206,7 +197,7 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
}
private boolean isLocationEnabledAndAllowed() {
- return this.hasLocationFeature && (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || this.hasLocationPermissions()) && this.isLocationEnabled();
+ return this.hasLocationFeature && this.hasLocationPermissions() && this.isLocationEnabled();
}
private void toggleFixedLocation() {
@@ -229,8 +220,8 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
if (isLocationEnabledAndAllowed()) {
this.binding.fab.setVisibility(View.VISIBLE);
runOnUiThread(() -> {
- this.binding.fab.setImageResource(marker_fixed_to_loc ? R.drawable.ic_gps_fixed_white_24dp :
- R.drawable.ic_gps_not_fixed_white_24dp);
+ this.binding.fab.setImageResource(marker_fixed_to_loc ? R.drawable.ic_gps_fixed_24dp :
+ R.drawable.ic_gps_not_fixed_24dp);
this.binding.fab.setContentDescription(getResources().getString(
marker_fixed_to_loc ? R.string.action_unfix_from_location : R.string.action_fix_to_location
));
diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
index d03928c8c..0f1cb4f68 100644
--- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
@@ -9,21 +9,24 @@ import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
+import androidx.annotation.NonNull;
+import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import java.util.ArrayList;
-import java.util.List;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.databinding.ActivityShareWithBinding;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.adapter.ConversationAdapter;
import eu.siacs.conversations.xmpp.Jid;
-public class ShareWithActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate {
+import java.util.ArrayList;
+import java.util.List;
+
+public class ShareWithActivity extends XmppActivity
+ implements XmppConnectionService.OnConversationUpdate {
private static final int REQUEST_STORAGE_PERMISSION = 0x733f32;
private Conversation mPendingConversation = null;
@@ -48,11 +51,10 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
private ConversationAdapter mAdapter;
private final List mConversations = new ArrayList<>();
-
- protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
+ protected void onActivityResult(
+ final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == REQUEST_START_NEW_CONVERSATION
- && resultCode == RESULT_OK) {
+ if (requestCode == REQUEST_START_NEW_CONVERSATION && resultCode == RESULT_OK) {
share.contact = data.getStringExtra("contact");
share.account = data.getStringExtra(EXTRA_ACCOUNT);
}
@@ -65,7 +67,10 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
}
@Override
- public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ public void onRequestPermissionsResult(
+ final int requestCode,
+ @NonNull final String[] permissions,
+ @NonNull final int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (grantResults.length > 0)
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
@@ -77,27 +82,35 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
}
}
} else {
- Toast.makeText(this, getString(R.string.no_storage_permission, getString(R.string.app_name)), Toast.LENGTH_SHORT).show();
+ Toast.makeText(
+ this,
+ getString(
+ R.string.no_storage_permission,
+ getString(R.string.app_name)),
+ Toast.LENGTH_SHORT)
+ .show();
}
}
@Override
- protected void onCreate(Bundle savedInstanceState) {
+ protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_share_with);
- setSupportActionBar(findViewById(R.id.toolbar));
- if (getSupportActionBar() != null) {
- getSupportActionBar().setDisplayHomeAsUpEnabled(false);
- getSupportActionBar().setHomeButtonEnabled(false);
+ final ActivityShareWithBinding binding =
+ DataBindingUtil.setContentView(this, R.layout.activity_share_with);
+ setSupportActionBar(binding.toolbar);
+ final var actionBar = getSupportActionBar();
+ if (actionBar != null) {
+ actionBar.setDisplayHomeAsUpEnabled(false);
+ actionBar.setHomeButtonEnabled(false);
}
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
+ setTitle(R.string.title_activity_share_with);
- setTitle(getString(R.string.title_activity_sharewith));
-
- RecyclerView mListView = findViewById(R.id.choose_conversation_list);
mAdapter = new ConversationAdapter(this, this.mConversations);
- mListView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
- mListView.setAdapter(mAdapter);
+ binding.chooseConversationList.setLayoutManager(
+ new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
+ binding.chooseConversationList.setAdapter(mAdapter);
mAdapter.setConversationClickListener((view, conversation) -> share(conversation));
this.share = new Share();
}
@@ -112,8 +125,9 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case R.id.action_add:
- final Intent intent = new Intent(getApplicationContext(), ChooseContactActivity.class);
- intent.putExtra("direct_search",true);
+ final Intent intent =
+ new Intent(getApplicationContext(), ChooseContactActivity.class);
+ intent.putExtra("direct_search", true);
startActivityForResult(intent, REQUEST_START_NEW_CONVERSATION);
return true;
}
@@ -133,7 +147,8 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
if (Intent.ACTION_SEND.equals(action)) {
final String text = intent.getStringExtra(Intent.EXTRA_TEXT);
final Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
- final boolean asQuote = intent.getBooleanExtra(ConversationsActivity.EXTRA_AS_QUOTE, false);
+ final boolean asQuote =
+ intent.getBooleanExtra(ConversationsActivity.EXTRA_AS_QUOTE, false);
if (data != null && "geo".equals(data.getScheme())) {
this.share.uris.clear();
@@ -151,14 +166,16 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
this.share.uris = uris == null ? new ArrayList<>() : uris;
}
if (xmppConnectionServiceBound) {
- xmppConnectionService.populateWithOrderedConversations(mConversations, this.share.uris.size() == 0, false);
+ xmppConnectionService.populateWithOrderedConversations(
+ mConversations, this.share.uris.isEmpty(), false);
}
-
}
@Override
void onBackendConnected() {
- if (xmppConnectionServiceBound && share != null && ((share.contact != null && share.account != null))) {
+ if (xmppConnectionServiceBound
+ && share != null
+ && ((share.contact != null && share.account != null))) {
share();
return;
}
@@ -167,32 +184,34 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
private void share() {
final Conversation conversation;
- Account account;
- try {
- account = xmppConnectionService.findAccountByJid(Jid.ofEscaped(share.account));
- } catch (final IllegalArgumentException e) {
- account = null;
- }
- if (account == null) {
- return;
- }
+ Account account;
+ try {
+ account = xmppConnectionService.findAccountByJid(Jid.ofEscaped(share.account));
+ } catch (final IllegalArgumentException e) {
+ account = null;
+ }
+ if (account == null) {
+ return;
+ }
- try {
- conversation = xmppConnectionService.findOrCreateConversation(account, Jid.of(share.contact), false, true);
- } catch (final IllegalArgumentException e) {
- return;
- }
+ try {
+ conversation =
+ xmppConnectionService.findOrCreateConversation(
+ account, Jid.of(share.contact), false, true);
+ } catch (final IllegalArgumentException e) {
+ return;
+ }
share(conversation);
}
private void share(final Conversation conversation) {
- if (share.uris.size() != 0 && !hasStoragePermission(REQUEST_STORAGE_PERMISSION)) {
+ if (!share.uris.isEmpty() && !hasStoragePermission(REQUEST_STORAGE_PERMISSION)) {
mPendingConversation = conversation;
return;
}
- Intent intent = new Intent(this, ConversationsActivity.class);
+ final Intent intent = new Intent(this, ConversationsActivity.class);
intent.putExtra(ConversationsActivity.EXTRA_CONVERSATION, conversation.getUuid());
- if (share.uris.size() > 0) {
+ if (!share.uris.isEmpty()) {
intent.setAction(Intent.ACTION_SEND_MULTIPLE);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, share.uris);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
@@ -207,15 +226,20 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
try {
startActivity(intent);
} catch (SecurityException e) {
- Toast.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
+ Toast.makeText(
+ this,
+ R.string.sharing_application_not_grant_permission,
+ Toast.LENGTH_SHORT)
+ .show();
return;
}
finish();
}
public void refreshUiReal() {
- //TODO inject desired order to not resort on refresh
- xmppConnectionService.populateWithOrderedConversations(mConversations, this.share != null && this.share.uris.size() == 0, false);
+ // TODO inject desired order to not resort on refresh
+ xmppConnectionService.populateWithOrderedConversations(
+ mConversations, this.share != null && this.share.uris.isEmpty(), false);
mAdapter.notifyDataSetChanged();
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java b/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java
index ff935beae..66b3fb886 100644
--- a/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java
@@ -45,7 +45,7 @@ public class ShortcutActivity extends AbstractSearchableListItemActivity {
}
@Override
- protected void onStart() {
+ public void onStart() {
super.onStart();
ActionBar bar = getSupportActionBar();
if(bar != null){
diff --git a/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java b/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java
index d4b6a2e30..eaba70799 100644
--- a/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java
@@ -49,6 +49,8 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_show_location);
setSupportActionBar(binding.toolbar);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
+
configureActionBar(getSupportActionBar());
setupMapView(this.binding.map, this.loc);
diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
index 1e54f2205..28b3688bb 100644
--- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
@@ -6,7 +6,6 @@ import android.app.Dialog;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
@@ -55,7 +54,10 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
+import com.google.android.material.color.MaterialColors;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.textfield.TextInputLayout;
+import com.google.common.collect.Iterables;
import com.leinardi.android.speeddial.SpeedDialActionItem;
import com.leinardi.android.speeddial.SpeedDialView;
@@ -109,7 +111,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
private ListItemAdapter mContactsAdapter;
private final List conferences = new ArrayList<>();
private ListItemAdapter mConferenceAdapter;
- private final List mActivatedAccounts = new ArrayList<>();
+ private final ArrayList mActivatedAccounts = new ArrayList<>();
private EditText mSearchEditText;
private final AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false);
private final AtomicBoolean mOpenedFab = new AtomicBoolean(false);
@@ -220,19 +222,20 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
}
};
- public static void populateAccountSpinner(Context context, List accounts, Spinner spinner) {
- if (accounts.size() > 0) {
- ArrayAdapter adapter = new ArrayAdapter<>(context, R.layout.simple_list_item, accounts);
- adapter.setDropDownViewResource(R.layout.simple_list_item);
- spinner.setAdapter(adapter);
- spinner.setEnabled(true);
- } else {
+ public static void populateAccountSpinner(final Context context, final List accounts, final AutoCompleteTextView spinner) {
+ if (accounts.isEmpty()) {
ArrayAdapter adapter = new ArrayAdapter<>(context,
- R.layout.simple_list_item,
+ R.layout.item_autocomplete,
Collections.singletonList(context.getString(R.string.no_accounts)));
- adapter.setDropDownViewResource(R.layout.simple_list_item);
+ adapter.setDropDownViewResource(R.layout.item_autocomplete);
spinner.setAdapter(adapter);
spinner.setEnabled(false);
+ } else {
+ final ArrayAdapter adapter = new ArrayAdapter<>(context, R.layout.item_autocomplete, accounts);
+ adapter.setDropDownViewResource(R.layout.item_autocomplete);
+ spinner.setAdapter(adapter);
+ spinner.setEnabled(true);
+ spinner.setText(Iterables.getFirst(accounts,null),false);
}
}
@@ -273,6 +276,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_start_conversation);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar());
@@ -363,7 +367,8 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
}
final SpeedDialActionItem actionItem = new SpeedDialActionItem.Builder(menuItem.getItemId(), menuItem.getIcon())
.setLabel(menuItem.getTitle() != null ? menuItem.getTitle().toString() : null)
- .setFabImageTintColor(ContextCompat.getColor(this, R.color.white))
+ .setFabImageTintColor(MaterialColors.getColor(speedDialView, com.google.android.material.R.attr.colorOnSurface))
+ .setFabBackgroundColor(MaterialColors.getColor(speedDialView, com.google.android.material.R.attr.colorSurfaceContainerHighest))
.create();
speedDialView.addActionItem(actionItem);
}
@@ -394,13 +399,8 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
@Override
public void onStart() {
super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- } else {
- if (pendingViewIntent.peek() == null) {
- askForContactsPermissions();
- }
+ if (pendingViewIntent.peek() == null) {
+ askForContactsPermissions();
}
mConferenceAdapter.refreshSettings();
mContactsAdapter.refreshSettings();
@@ -490,7 +490,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
protected void deleteContact() {
final int position = contact_context_id;
final Contact contact = (Contact) contacts.get(position);
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setNegativeButton(R.string.cancel, null);
builder.setTitle(R.string.action_delete_contact);
builder.setMessage(JidDialog.style(this, R.string.remove_contact_text, contact.getJid().toEscapedString()));
@@ -506,7 +506,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
final Bookmark bookmark = (Bookmark) conferences.get(position);
final var conversation = bookmark.getConversation();
final boolean hasConversation = conversation != null;
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setNegativeButton(R.string.cancel, null);
builder.setTitle(R.string.delete_bookmark);
if (hasConversation) {
@@ -611,18 +611,14 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
dialog.show(ft, FRAGMENT_TAG_DIALOG);
}
- public static Account getSelectedAccount(Context context, Spinner spinner) {
+ public static Account getSelectedAccount(final Context context, final AutoCompleteTextView spinner) {
if (spinner == null || !spinner.isEnabled()) {
return null;
}
if (context instanceof XmppActivity) {
- Jid jid;
+ final Jid jid;
try {
- if (Config.DOMAIN_LOCK != null) {
- jid = Jid.ofEscaped((String) spinner.getSelectedItem(), Config.DOMAIN_LOCK, null);
- } else {
- jid = Jid.ofEscaped((String) spinner.getSelectedItem());
- }
+ jid = Jid.ofEscaped(spinner.getText().toString());
} catch (final IllegalArgumentException e) {
return null;
}
@@ -792,7 +788,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
if (requiresConsent
|| shouldShowRequestPermissionRationale(
Manifest.permission.READ_CONTACTS)) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
final AtomicBoolean requestPermission = new AtomicBoolean(false);
if (QuickConversationsService.isQuicksy()) {
builder.setTitle(R.string.quicksy_wants_your_consent);
@@ -1007,7 +1003,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
}
private void displayVerificationWarningDialog(final Contact contact, final Invite invite) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.verify_omemo_keys);
View view = getLayoutInflater().inflate(R.layout.dialog_verify_fingerprints, null);
final CheckBox isTrustedSource = view.findViewById(R.id.trusted_source);
@@ -1104,7 +1100,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
}
@Override
- public void onCreateDialogPositiveClick(Spinner spinner, String name) {
+ public void onCreateDialogPositiveClick(AutoCompleteTextView spinner, String name) {
if (!xmppConnectionServiceBound) {
return;
}
@@ -1122,7 +1118,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
}
@Override
- public void onJoinDialogPositiveClick(Dialog dialog, Spinner spinner, TextInputLayout layout, AutoCompleteTextView jid, boolean isBookmarkChecked) {
+ public void onJoinDialogPositiveClick(Dialog dialog, AutoCompleteTextView spinner, TextInputLayout layout, AutoCompleteTextView jid, boolean isBookmarkChecked) {
if (!xmppConnectionServiceBound) {
return;
}
diff --git a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
index d5a95b7bf..d0f3f761e 100644
--- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
@@ -14,14 +14,7 @@ import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.databinding.DataBindingUtil;
-import org.whispersystems.libsignal.IdentityKey;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
@@ -40,6 +33,14 @@ import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
+import org.whispersystems.libsignal.IdentityKey;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdated {
private final Map ownKeysToTrust = new HashMap<>();
@@ -70,12 +71,14 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_trust_keys);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
this.contactJids = new ArrayList<>();
- for (String jid : getIntent().getStringArrayExtra("contacts")) {
+ final var intent = getIntent();
+ final String[] contacts = intent == null ? null : intent.getStringArrayExtra("contacts");
+ for (final String jid : (contacts == null ? new String[0] : contacts)) {
try {
this.contactJids.add(Jid.of(jid));
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
+ } catch (final IllegalArgumentException ignored) {
}
}
@@ -100,7 +103,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.trust_keys, menu);
MenuItem scanQrCode = menu.findItem(R.id.action_scan_qr_code);
- scanQrCode.setVisible((ownKeysToTrust.size() > 0 || foreignActuallyHasKeys()) && isCameraFeatureAvailable());
+ scanQrCode.setVisible((!ownKeysToTrust.isEmpty() || foreignActuallyHasKeys()) && isCameraFeatureAvailable());
return super.onCreateOptionsMenu(menu);
}
@@ -191,7 +194,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
}
);
}
- if (fingerprints.size() == 0) {
+ if (fingerprints.isEmpty()) {
keysCardBinding.noKeysToAccept.setVisibility(View.VISIBLE);
if (hasNoOtherTrustedKeys(jid)) {
if (!mAccount.getRoster().getContact(jid).mutualPresenceSubscription()) {
@@ -254,8 +257,8 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
}
}
- private void disableEncryptionDialog(View view) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ private void disableEncryptionDialog(final View view) {
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(R.string.disable_encryption);
builder.setMessage(R.string.disable_encryption_message);
builder.setPositiveButton(R.string.disable_now, (dialog, which) -> {
@@ -279,7 +282,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
private boolean foreignActuallyHasKeys() {
synchronized (this.foreignKeysToTrust) {
for (Map.Entry> entry : foreignKeysToTrust.entrySet()) {
- if (entry.getValue().size() > 0) {
+ if (!entry.getValue().isEmpty()) {
return true;
}
}
@@ -305,7 +308,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
foreignKeysToTrust.clear();
for (Jid jid : contactJids) {
Set foreignKeysSet = service.getKeysWithTrust(FingerprintStatus.createActiveUndecided(), jid);
- if (hasNoOtherTrustedKeys(jid) && ownKeysSet.size() == 0) {
+ if (hasNoOtherTrustedKeys(jid) && ownKeysSet.isEmpty()) {
foreignKeysSet.addAll(service.getKeysWithTrust(FingerprintStatus.createActive(false), jid));
}
Map foreignFingerprints = new HashMap<>();
@@ -315,7 +318,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
foreignFingerprints.put(fingerprint, false);
}
}
- if (foreignFingerprints.size() > 0 || !acceptedTargets.contains(jid)) {
+ if (!foreignFingerprints.isEmpty() || !acceptedTargets.contains(jid)) {
foreignKeysToTrust.put(jid, foreignFingerprints);
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java
index de284264d..35f7a3bd1 100644
--- a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java
@@ -42,7 +42,7 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class UriHandlerActivity extends AppCompatActivity {
+public class UriHandlerActivity extends BaseActivity {
public static final String ACTION_SCAN_QR_CODE = "scan_qr_code";
private static final String EXTRA_ALLOW_PROVISIONING = "extra_allow_provisioning";
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 9190697a8..c7302ae2e 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -2,7 +2,6 @@ package eu.siacs.conversations.ui;
import android.Manifest;
import android.annotation.SuppressLint;
-import android.annotation.TargetApi;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
@@ -17,10 +16,10 @@ import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
-import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
@@ -50,10 +49,11 @@ import androidx.annotation.BoolRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AlertDialog.Builder;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.databinding.DataBindingUtil;
+import com.google.android.material.color.MaterialColors;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.common.base.Strings;
import eu.siacs.conversations.BuildConfig;
@@ -80,7 +80,6 @@ import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.Compatibility;
import eu.siacs.conversations.utils.ExceptionHelper;
import eu.siacs.conversations.utils.SignupUtils;
-import eu.siacs.conversations.utils.ThemeHelper;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
@@ -106,7 +105,6 @@ public abstract class XmppActivity extends ActionBarActivity {
private boolean isCameraFeatureAvailable = false;
- protected int mTheme;
protected boolean mUsingEnterKey = false;
protected boolean mUseTor = false;
protected Toast mToast;
@@ -154,7 +152,6 @@ public abstract class XmppActivity extends ActionBarActivity {
}
};
- public boolean mSkipBackgroundBinding = false;
public static boolean cancelPotentialWork(Message message, ImageView imageView) {
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
@@ -212,14 +209,10 @@ public abstract class XmppActivity extends ActionBarActivity {
abstract protected void refreshUiReal();
@Override
- protected void onStart() {
+ public void onStart() {
super.onStart();
if (!xmppConnectionServiceBound) {
- if (this.mSkipBackgroundBinding) {
- Log.d(Config.LOGTAG, "skipping background binding");
- } else {
- connectToBackend();
- }
+ connectToBackend();
} else {
this.registerListeners();
this.onBackendConnected();
@@ -255,7 +248,7 @@ public abstract class XmppActivity extends ActionBarActivity {
}
public void showInstallPgpDialog() {
- Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(getString(R.string.openkeychain_required));
builder.setIconAttribute(android.R.attr.alertDialogIcon);
builder.setMessage(Html.fromHtml(getString(R.string.openkeychain_required_long, getString(R.string.app_name))));
@@ -298,7 +291,7 @@ public abstract class XmppActivity extends ActionBarActivity {
}
protected void deleteAccount(final Account account, final Runnable postDelete) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
final View dialogView = getLayoutInflater().inflate(R.layout.dialog_delete_account, null);
final CheckBox deleteFromServer =
dialogView.findViewById(R.id.delete_from_server);
@@ -495,28 +488,12 @@ public abstract class XmppActivity extends ActionBarActivity {
ExceptionHelper.init(getApplicationContext());
EmojiInitializationService.execute(this);
this.isCameraFeatureAvailable = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY);
- this.mTheme = findTheme();
- setTheme(this.mTheme);
}
protected boolean isCameraFeatureAvailable() {
return this.isCameraFeatureAvailable;
}
- public boolean isDarkTheme() {
- return ThemeHelper.isDark(mTheme);
- }
-
- public int getThemeResource(int r_attr_name, int r_drawable_def) {
- int[] attrs = {r_attr_name};
- TypedArray ta = this.getTheme().obtainStyledAttributes(attrs);
-
- int res = ta.getResourceId(0, r_drawable_def);
- ta.recycle();
-
- return res;
- }
-
protected boolean isOptimizingBattery() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
final PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
@@ -698,21 +675,10 @@ public abstract class XmppActivity extends ActionBarActivity {
}
}
- @SuppressWarnings("deprecation")
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
- protected void setListItemBackgroundOnView(View view) {
- int sdk = android.os.Build.VERSION.SDK_INT;
- if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
- view.setBackgroundDrawable(getResources().getDrawable(R.drawable.greybackground));
- } else {
- view.setBackground(getResources().getDrawable(R.drawable.greybackground));
- }
- }
-
- protected void choosePgpSignId(Account account) {
- xmppConnectionService.getPgpEngine().chooseKey(account, new UiCallback() {
+ protected void choosePgpSignId(final Account account) {
+ xmppConnectionService.getPgpEngine().chooseKey(account, new UiCallback<>() {
@Override
- public void success(Account account1) {
+ public void success(final Account a) {
}
@Override
@@ -733,8 +699,7 @@ public abstract class XmppActivity extends ActionBarActivity {
protected void displayErrorDialog(final int errorCode) {
runOnUiThread(() -> {
- Builder builder = new Builder(XmppActivity.this);
- builder.setIconAttribute(android.R.attr.alertDialogIcon);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(XmppActivity.this);
builder.setTitle(getString(R.string.error));
builder.setMessage(errorCode);
builder.setNeutralButton(R.string.accept, null);
@@ -744,7 +709,7 @@ public abstract class XmppActivity extends ActionBarActivity {
}
protected void showAddToRosterDialog(final Contact contact) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(contact.getJid().toString());
builder.setMessage(getString(R.string.not_in_roster));
builder.setNegativeButton(getString(R.string.cancel), null);
@@ -753,7 +718,7 @@ public abstract class XmppActivity extends ActionBarActivity {
}
private void showAskForPresenceDialog(final Contact contact) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setTitle(contact.getJid().toString());
builder.setMessage(R.string.request_presence_updates);
builder.setNegativeButton(R.string.cancel, null);
@@ -787,8 +752,8 @@ public abstract class XmppActivity extends ActionBarActivity {
final @StringRes int hint,
boolean password,
boolean permitEmpty) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- DialogQuickeditBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.dialog_quickedit, null, false);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
+ final DialogQuickeditBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.dialog_quickedit, null, false);
if (password) {
binding.inputEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
}
@@ -829,7 +794,7 @@ public abstract class XmppActivity extends ActionBarActivity {
}
protected boolean hasStoragePermission(int requestCode) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, requestCode);
return false;
@@ -911,10 +876,6 @@ public abstract class XmppActivity extends ActionBarActivity {
SettingsUtils.applyScreenshotPreventionSetting(this);
}
- protected int findTheme() {
- return ThemeHelper.find(this);
- }
-
@Override
public void onPause() {
super.onPause();
@@ -936,14 +897,26 @@ public abstract class XmppActivity extends ActionBarActivity {
if (uri == null || uri.isEmpty()) {
return;
}
- Point size = new Point();
+ final Point size = new Point();
getWindowManager().getDefaultDisplay().getSize(size);
- final int width = (size.x < size.y ? size.x : size.y);
- Bitmap bitmap = BarcodeProvider.create2dBarcodeBitmap(uri, width);
- ImageView view = new ImageView(this);
- view.setBackgroundColor(Color.WHITE);
+ final int width = Math.min(size.x, size.y);
+ final boolean nightMode = (this.getResources().getConfiguration().uiMode
+ & Configuration.UI_MODE_NIGHT_MASK)
+ == Configuration.UI_MODE_NIGHT_YES;
+ final int black;
+ final int white;
+ if (nightMode) {
+ black = MaterialColors.getColor(this, com.google.android.material.R.attr.colorSurfaceContainerHighest,"No surface color configured");
+ white = MaterialColors.getColor(this, com.google.android.material.R.attr.colorSurfaceInverse,"No inverse surface color configured");
+ } else {
+ black = MaterialColors.getColor(this, com.google.android.material.R.attr.colorSurfaceInverse,"No inverse surface color configured");
+ white = MaterialColors.getColor(this, com.google.android.material.R.attr.colorSurfaceContainerHighest,"No surface color configured");
+ }
+ final var bitmap = BarcodeProvider.create2dBarcodeBitmap(uri, width, black, white);
+ final ImageView view = new ImageView(this);
+ view.setBackgroundColor(white);
view.setImageBitmap(bitmap);
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setView(view);
builder.create().show();
}
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
index 038f255ea..88475c580 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
@@ -8,15 +8,16 @@ import android.widget.ArrayAdapter;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
-import java.util.List;
+import com.google.android.material.color.MaterialColors;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
-import eu.siacs.conversations.databinding.AccountRowBinding;
+import eu.siacs.conversations.databinding.ItemAccountBinding;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.ui.XmppActivity;
import eu.siacs.conversations.ui.util.AvatarWorkerTask;
-import eu.siacs.conversations.ui.util.StyledAttributes;
+
+import java.util.List;
public class AccountAdapter extends ArrayAdapter {
@@ -35,36 +36,33 @@ public class AccountAdapter extends ArrayAdapter {
this.showStateButton = true;
}
+ @NonNull
@Override
public View getView(int position, View view, @NonNull ViewGroup parent) {
final Account account = getItem(position);
final ViewHolder viewHolder;
if (view == null) {
- AccountRowBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.account_row, parent, false);
+ ItemAccountBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_account, parent, false);
view = binding.getRoot();
viewHolder = new ViewHolder(binding);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
- if (Config.DOMAIN_LOCK != null) {
- viewHolder.binding.accountJid.setText(account.getJid().getLocal());
- } else {
- viewHolder.binding.accountJid.setText(account.getJid().asBareJid().toEscapedString());
- }
+ viewHolder.binding.accountJid.setText(account.getJid().asBareJid().toEscapedString());
AvatarWorkerTask.loadAvatar(account, viewHolder.binding.accountImage, R.dimen.avatar);
viewHolder.binding.accountStatus.setText(getContext().getString(account.getStatus().getReadableId()));
switch (account.getStatus()) {
case ONLINE:
- viewHolder.binding.accountStatus.setTextColor(StyledAttributes.getColor(activity, R.attr.TextColorOnline));
+ viewHolder.binding.accountStatus.setTextColor(MaterialColors.getColor(viewHolder.binding.accountStatus, com.google.android.material.R.attr.colorPrimary));
break;
case DISABLED:
case LOGGED_OUT:
case CONNECTING:
- viewHolder.binding.accountStatus.setTextColor(StyledAttributes.getColor(activity, android.R.attr.textColorSecondary));
+ viewHolder.binding.accountStatus.setTextColor(MaterialColors.getColor(viewHolder.binding.accountStatus, com.google.android.material.R.attr.colorOnSurfaceVariant));
break;
default:
- viewHolder.binding.accountStatus.setTextColor(StyledAttributes.getColor(activity, R.attr.TextColorError));
+ viewHolder.binding.accountStatus.setTextColor(MaterialColors.getColor(viewHolder.binding.accountStatus, com.google.android.material.R.attr.colorError));
break;
}
final boolean isDisabled = (account.getStatus() == Account.State.DISABLED);
@@ -84,9 +82,9 @@ public class AccountAdapter extends ArrayAdapter {
}
private static class ViewHolder {
- private final AccountRowBinding binding;
+ private final ItemAccountBinding binding;
- private ViewHolder(AccountRowBinding binding) {
+ private ViewHolder(ItemAccountBinding binding) {
this.binding = binding;
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java
index ae9a67f6b..aa6fd1b78 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java
@@ -13,18 +13,18 @@ import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.ListAdapter;
import androidx.recyclerview.widget.RecyclerView;
-import java.util.Locale;
-
import eu.siacs.conversations.R;
-import eu.siacs.conversations.databinding.SearchResultItemBinding;
+import eu.siacs.conversations.databinding.ItemChannelDiscoveryBinding;
import eu.siacs.conversations.entities.Room;
import eu.siacs.conversations.ui.XmppActivity;
import eu.siacs.conversations.ui.util.AvatarWorkerTask;
import eu.siacs.conversations.xmpp.Jid;
+import java.util.Locale;
+
public class ChannelSearchResultAdapter extends ListAdapter implements View.OnCreateContextMenuListener {
- private static final DiffUtil.ItemCallback DIFF = new DiffUtil.ItemCallback() {
+ private static final DiffUtil.ItemCallback DIFF = new DiffUtil.ItemCallback<>() {
@Override
public boolean areItemsTheSame(@NonNull Room a, @NonNull Room b) {
return a.address != null && a.address.equals(b.address);
@@ -45,7 +45,7 @@ public class ChannelSearchResultAdapter extends ListAdapter {
@@ -48,7 +48,7 @@ public class ConversationAdapter
return new ConversationViewHolder(
DataBindingUtil.inflate(
LayoutInflater.from(parent.getContext()),
- R.layout.conversation_list_row,
+ R.layout.item_conversation,
parent,
false));
}
@@ -68,14 +68,13 @@ public class ConversationAdapter
}
if (conversation == ConversationFragment.getConversation(activity)) {
- viewHolder.binding.frame.setBackgroundColor(
- StyledAttributes.getColor(activity, R.attr.color_background_tertiary));
+ viewHolder.binding.frame.setBackgroundResource(R.drawable.background_selected_item_conversation);
+ //viewHolder.binding.frame.setBackgroundColor(MaterialColors.getColor(viewHolder.binding.frame, com.google.android.material.R.attr.colorSurfaceDim));
} else {
- viewHolder.binding.frame.setBackgroundColor(
- StyledAttributes.getColor(activity, R.attr.color_background_primary));
+ viewHolder.binding.frame.setBackgroundColor(MaterialColors.getColor(viewHolder.binding.frame, com.google.android.material.R.attr.colorSurface));
}
- Message message = conversation.getLatestMessage();
+ final Message message = conversation.getLatestMessage();
final int unreadCount = conversation.unreadCount();
final boolean isRead = conversation.isRead();
final Conversation.Draft draft = isRead ? conversation.getDraft() : null;
@@ -106,68 +105,9 @@ public class ConversationAdapter
&& (message.isFileOrImage()
|| message.treatAsDownloadable()
|| message.isGeoUri())) {
- final int imageResource;
- if (message.isGeoUri()) {
- imageResource =
- activity.getThemeResource(
- R.attr.ic_attach_location, R.drawable.ic_attach_location);
- showPreviewText = false;
- } else {
- // TODO move this into static MediaPreview method and use same icons as in
- // MediaAdapter
- final String mime = message.getMimeType();
- if (MimeUtils.AMBIGUOUS_CONTAINER_FORMATS.contains(mime)) {
- final Message.FileParams fileParams = message.getFileParams();
- if (fileParams.width > 0 && fileParams.height > 0) {
- imageResource =
- activity.getThemeResource(
- R.attr.ic_attach_videocam,
- R.drawable.ic_attach_videocam);
- showPreviewText = false;
- } else if (fileParams.runtime > 0) {
- imageResource =
- activity.getThemeResource(
- R.attr.ic_attach_record, R.drawable.ic_attach_record);
- showPreviewText = false;
- } else {
- imageResource =
- activity.getThemeResource(
- R.attr.ic_attach_document,
- R.drawable.ic_attach_document);
- showPreviewText = true;
- }
- } else {
- switch (Strings.nullToEmpty(mime).split("/")[0]) {
- case "image":
- imageResource =
- activity.getThemeResource(
- R.attr.ic_attach_photo, R.drawable.ic_attach_photo);
- showPreviewText = false;
- break;
- case "video":
- imageResource =
- activity.getThemeResource(
- R.attr.ic_attach_videocam,
- R.drawable.ic_attach_videocam);
- showPreviewText = false;
- break;
- case "audio":
- imageResource =
- activity.getThemeResource(
- R.attr.ic_attach_record,
- R.drawable.ic_attach_record);
- showPreviewText = false;
- break;
- default:
- imageResource =
- activity.getThemeResource(
- R.attr.ic_attach_document,
- R.drawable.ic_attach_document);
- showPreviewText = true;
- break;
- }
- }
- }
+ final var attachment = Attachment.of(message);
+ final @DrawableRes int imageResource = MediaAdapter.getImageDrawable(attachment);
+ showPreviewText = false;
viewHolder.binding.conversationLastmsgImg.setImageResource(imageResource);
viewHolder.binding.conversationLastmsgImg.setVisibility(View.VISIBLE);
} else {
@@ -231,36 +171,21 @@ public class ConversationAdapter
if (ongoingCall.isPresent()) {
viewHolder.binding.notificationStatus.setVisibility(View.VISIBLE);
- final int ic_ongoing_call =
- activity.getThemeResource(
- R.attr.ic_ongoing_call_hint, R.drawable.ic_phone_in_talk_black_18dp);
- viewHolder.binding.notificationStatus.setImageResource(ic_ongoing_call);
+ viewHolder.binding.notificationStatus.setImageResource(R.drawable.ic_phone_in_talk_24dp);
} else {
final long muted_till =
conversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL, 0);
if (muted_till == Long.MAX_VALUE) {
viewHolder.binding.notificationStatus.setVisibility(View.VISIBLE);
- int ic_notifications_off =
- activity.getThemeResource(
- R.attr.icon_notifications_off,
- R.drawable.ic_notifications_off_black_24dp);
- viewHolder.binding.notificationStatus.setImageResource(ic_notifications_off);
+ viewHolder.binding.notificationStatus.setImageResource(R.drawable.ic_notifications_off_24dp);
} else if (muted_till >= System.currentTimeMillis()) {
viewHolder.binding.notificationStatus.setVisibility(View.VISIBLE);
- int ic_notifications_paused =
- activity.getThemeResource(
- R.attr.icon_notifications_paused,
- R.drawable.ic_notifications_paused_black_24dp);
- viewHolder.binding.notificationStatus.setImageResource(ic_notifications_paused);
+ viewHolder.binding.notificationStatus.setImageResource(R.drawable.ic_notifications_paused_24dp);
} else if (conversation.alwaysNotify()) {
viewHolder.binding.notificationStatus.setVisibility(View.GONE);
} else {
viewHolder.binding.notificationStatus.setVisibility(View.VISIBLE);
- int ic_notifications_none =
- activity.getThemeResource(
- R.attr.icon_notifications_none,
- R.drawable.ic_notifications_none_black_24dp);
- viewHolder.binding.notificationStatus.setImageResource(ic_notifications_none);
+ viewHolder.binding.notificationStatus.setImageResource(R.drawable.ic_notifications_none_24dp);
}
}
@@ -307,9 +232,9 @@ public class ConversationAdapter
}
static class ConversationViewHolder extends RecyclerView.ViewHolder {
- private final ConversationListRowBinding binding;
+ private final ItemConversationBinding binding;
- private ConversationViewHolder(ConversationListRowBinding binding) {
+ private ConversationViewHolder(final ItemConversationBinding binding) {
super(binding.getRoot());
this.binding = binding;
}
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java
index 08f8fcd32..b085cb964 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java
@@ -6,32 +6,35 @@ import android.widget.Filter;
import androidx.annotation.NonNull;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Locale;
-import java.util.regex.Pattern;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Ordering;
import eu.siacs.conversations.Config;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Locale;
+import java.util.regex.Pattern;
+
public class KnownHostsAdapter extends ArrayAdapter {
private static final Pattern E164_PATTERN = Pattern.compile("^\\+[1-9]\\d{1,14}$");
- private ArrayList domains;
+ private List domains;
private final Filter domainFilter = new Filter() {
@Override
- protected FilterResults performFiltering(CharSequence constraint) {
- final ArrayList suggestions = new ArrayList<>();
+ protected FilterResults performFiltering(final CharSequence constraint) {
+ final ImmutableList.Builder builder = new ImmutableList.Builder<>();
final String[] split = constraint == null ? new String[0] : constraint.toString().split("@");
if (split.length == 1) {
final String local = split[0].toLowerCase(Locale.ENGLISH);
if (Config.QUICKSY_DOMAIN != null && E164_PATTERN.matcher(local).matches()) {
- suggestions.add(local + '@' + Config.QUICKSY_DOMAIN.toEscapedString());
+ builder.add(local + '@' + Config.QUICKSY_DOMAIN.toEscapedString());
} else {
for (String domain : domains) {
- suggestions.add(local + '@' + domain);
+ builder.add(local + '@' + domain);
}
}
} else if (split.length == 2) {
@@ -40,45 +43,49 @@ public class KnownHostsAdapter extends ArrayAdapter {
if (domains.contains(domainPart)) {
return new FilterResults();
}
- for (String domain : domains) {
+ for (final String domain : domains) {
if (domain.contains(domainPart)) {
- suggestions.add(localPart + "@" + domain);
+ builder.add(localPart + "@" + domain);
}
}
} else {
return new FilterResults();
}
- FilterResults filterResults = new FilterResults();
+ final var suggestions = builder.build();
+ final FilterResults filterResults = new FilterResults();
filterResults.values = suggestions;
filterResults.count = suggestions.size();
return filterResults;
}
@Override
- protected void publishResults(CharSequence constraint, FilterResults results) {
- ArrayList filteredList = (ArrayList) results.values;
- if (results.count > 0) {
- clear();
- addAll(filteredList);
- notifyDataSetChanged();
+ protected void publishResults(final CharSequence constraint, final FilterResults results) {
+ final ImmutableList.Builder suggestions = new ImmutableList.Builder<>();
+ if (results.values instanceof Collection> collection) {
+ for(final Object item : collection) {
+ if (item instanceof String string) {
+ suggestions.add(string);
+ }
+ }
}
+ clear();
+ addAll(suggestions.build());
+ notifyDataSetChanged();
}
};
- public KnownHostsAdapter(Context context, int viewResourceId, Collection mKnownHosts) {
+ public KnownHostsAdapter(final Context context, final int viewResourceId, final Collection knownHosts) {
super(context, viewResourceId, new ArrayList<>());
- domains = new ArrayList<>(mKnownHosts);
- Collections.sort(domains);
+ domains = Ordering.natural().sortedCopy(knownHosts);
}
- public KnownHostsAdapter(Context context, int viewResourceId) {
+ public KnownHostsAdapter(final Context context, final int viewResourceId) {
super(context, viewResourceId, new ArrayList<>());
- domains = new ArrayList<>();
+ domains = ImmutableList.of();
}
- public void refresh(Collection knownHosts) {
- domains = new ArrayList<>(knownHosts);
- Collections.sort(domains);
+ public void refresh(final Collection knownHosts) {
+ this.domains = Ordering.natural().sortedCopy(knownHosts);
notifyDataSetChanged();
}
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
index 5d6d72684..2ecf230d9 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
@@ -2,6 +2,7 @@ package eu.siacs.conversations.ui.adapter;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -9,30 +10,30 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import com.wefika.flowlayout.FlowLayout;
-import java.util.List;
-
+import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
-import eu.siacs.conversations.databinding.ContactBinding;
+import eu.siacs.conversations.databinding.ItemContactBinding;
import eu.siacs.conversations.entities.ListItem;
import eu.siacs.conversations.ui.SettingsActivity;
import eu.siacs.conversations.ui.XmppActivity;
import eu.siacs.conversations.ui.util.AvatarWorkerTask;
-import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.IrregularUnicodeDetector;
import eu.siacs.conversations.xmpp.Jid;
+import java.util.List;
+
public class ListItemAdapter extends ArrayAdapter {
protected XmppActivity activity;
private boolean showDynamicTags = false;
private OnTagClickedListener mOnTagClickedListener = null;
private final View.OnClickListener onTagTvClick = view -> {
- if (view instanceof TextView && mOnTagClickedListener != null) {
- TextView tv = (TextView) view;
+ if (view instanceof TextView tv && mOnTagClickedListener != null) {
final String tag = tv.getText().toString();
mOnTagClickedListener.onTagClicked(tag);
}
@@ -49,22 +50,25 @@ public class ListItemAdapter extends ArrayAdapter {
this.showDynamicTags = preferences.getBoolean(SettingsActivity.SHOW_DYNAMIC_TAGS, false);
}
+ @NonNull
@Override
- public View getView(int position, View view, ViewGroup parent) {
+ public View getView(int position, View view, @NonNull ViewGroup parent) {
LayoutInflater inflater = activity.getLayoutInflater();
ListItem item = getItem(position);
ViewHolder viewHolder;
if (view == null) {
- ContactBinding binding = DataBindingUtil.inflate(inflater,R.layout.contact,parent,false);
+ final ItemContactBinding binding = DataBindingUtil.inflate(inflater,R.layout.item_contact,parent,false);
viewHolder = ViewHolder.get(binding);
view = binding.getRoot();
} else {
viewHolder = (ViewHolder) view.getTag();
}
- view.setBackground(StyledAttributes.getDrawable(view.getContext(),R.attr.list_item_background));
-
- List tags = item.getTags(activity);
- if (tags.size() == 0 || !this.showDynamicTags) {
+ if (view.isActivated()) {
+ Log.d(Config.LOGTAG,"item "+item.getDisplayName()+" is activated");
+ }
+ //view.setBackground(StyledAttributes.getDrawable(view.getContext(),R.attr.list_item_background));
+ final List tags = item.getTags(activity);
+ if (tags.isEmpty() || !this.showDynamicTags) {
viewHolder.tags.setVisibility(View.GONE);
} else {
viewHolder.tags.setVisibility(View.VISIBLE);
@@ -108,7 +112,7 @@ public class ListItemAdapter extends ArrayAdapter {
}
- public static ViewHolder get(ContactBinding binding) {
+ public static ViewHolder get(final ItemContactBinding binding) {
ViewHolder viewHolder = new ViewHolder();
viewHolder.name = binding.contactDisplayName;
viewHolder.jid = binding.contactJid;
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java
index 2683876c7..86f8948c9 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java
@@ -1,47 +1,50 @@
package eu.siacs.conversations.ui.adapter;
-import android.content.Context;
+import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Bitmap;
+import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.ImageView;
-import androidx.annotation.AttrRes;
import androidx.annotation.DimenRes;
+import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
+import androidx.core.widget.ImageViewCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
+import com.google.android.material.color.MaterialColors;
+import com.google.common.base.Strings;
+
+import eu.siacs.conversations.R;
+import eu.siacs.conversations.databinding.ItemMediaBinding;
+import eu.siacs.conversations.services.ExportBackupService;
+import eu.siacs.conversations.ui.XmppActivity;
+import eu.siacs.conversations.ui.util.Attachment;
+import eu.siacs.conversations.ui.util.ViewUtil;
+
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.RejectedExecutionException;
-import eu.siacs.conversations.Config;
-import eu.siacs.conversations.R;
-import eu.siacs.conversations.databinding.MediaBinding;
-import eu.siacs.conversations.services.ExportBackupService;
-import eu.siacs.conversations.ui.XmppActivity;
-import eu.siacs.conversations.ui.util.Attachment;
-import eu.siacs.conversations.ui.util.StyledAttributes;
-import eu.siacs.conversations.ui.util.ViewUtil;
-
public class MediaAdapter extends RecyclerView.Adapter {
- public static final List DOCUMENT_MIMES = Arrays.asList(
- "application/pdf",
- "application/vnd.oasis.opendocument.text",
- "application/msword",
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
- "text/x-tex",
- "text/plain"
- );
+ public static final List DOCUMENT_MIMES =
+ Arrays.asList(
+ "application/pdf",
+ "application/vnd.oasis.opendocument.text",
+ "application/msword",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ "text/x-tex",
+ "text/plain");
+ public static final List CODE_MIMES = Arrays.asList("text/html", "text/xml");
private final ArrayList attachments = new ArrayList<>();
@@ -55,58 +58,77 @@ public class MediaAdapter extends RecyclerView.Adapter ViewUtil.view(activity, attachment));
}
- public void setAttachments(List attachments) {
+ public void setAttachments(final List attachments) {
this.attachments.clear();
this.attachments.addAll(attachments);
notifyDataSetChanged();
@@ -167,16 +188,21 @@ public class MediaAdapter extends RecyclerView.Adapter {
+public class MediaPreviewAdapter
+ extends RecyclerView.Adapter {
private final ArrayList mediaPreviews = new ArrayList<>();
@@ -43,8 +46,9 @@ public class MediaPreviewAdapter extends RecyclerView.Adapter {
- final int pos = mediaPreviews.indexOf(attachment);
- mediaPreviews.remove(pos);
- notifyItemRemoved(pos);
- conversationFragment.toggleInputMethod();
- });
+ holder.binding.deleteButton.setOnClickListener(
+ v -> {
+ final int pos = mediaPreviews.indexOf(attachment);
+ mediaPreviews.remove(pos);
+ notifyItemRemoved(pos);
+ conversationFragment.toggleInputMethod();
+ });
holder.binding.mediaPreview.setOnClickListener(v -> view(context, attachment));
}
@@ -76,9 +81,14 @@ public class MediaPreviewAdapter extends RecyclerView.Adapter 0;
+ return !mediaPreviews.isEmpty();
}
public ArrayList getAttachments() {
@@ -153,9 +173,9 @@ public class MediaPreviewAdapter extends RecyclerView.Adapter {
return this.getItemViewType(getItem(position));
}
- private int getMessageTextColor(boolean onDark, boolean primary) {
- if (onDark) {
- return ContextCompat.getColor(activity, primary ? R.color.white : R.color.white70);
- } else {
- return ContextCompat.getColor(activity, primary ? R.color.black87 : R.color.black54);
- }
- }
-
- private void displayStatus(ViewHolder viewHolder, Message message, int type, boolean darkBackground) {
+ private void displayStatus(ViewHolder viewHolder, Message message, int type, final BubbleColor bubbleColor) {
String filesize = null;
String info = null;
boolean error = false;
@@ -179,8 +179,7 @@ public class MessageAdapter extends ArrayAdapter {
if (viewHolder.edit_indicator != null) {
if (message.edited()) {
viewHolder.edit_indicator.setVisibility(View.VISIBLE);
- viewHolder.edit_indicator.setImageResource(darkBackground ? R.drawable.ic_mode_edit_white_18dp : R.drawable.ic_mode_edit_black_18dp);
- viewHolder.edit_indicator.setAlpha(darkBackground ? 0.7f : 0.57f);
+ setImageTint(viewHolder.edit_indicator, bubbleColor);
} else {
viewHolder.edit_indicator.setVisibility(View.GONE);
}
@@ -211,8 +210,7 @@ public class MessageAdapter extends ArrayAdapter {
break;
case Message.STATUS_SEND_RECEIVED:
case Message.STATUS_SEND_DISPLAYED:
- viewHolder.indicatorReceived.setImageResource(darkBackground ? R.drawable.ic_done_white_18dp : R.drawable.ic_done_black_18dp);
- viewHolder.indicatorReceived.setAlpha(darkBackground ? 0.7f : 0.57f);
+ setImageTint(viewHolder.indicatorReceived, bubbleColor);
viewHolder.indicatorReceived.setVisibility(View.VISIBLE);
break;
case Message.STATUS_SEND_FAILED:
@@ -245,18 +243,9 @@ public class MessageAdapter extends ArrayAdapter {
break;
}
if (error && type == SENT) {
- if (darkBackground) {
- viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_Warning_OnDark);
- } else {
- viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_Warning);
- }
+ viewHolder.time.setTextColor(MaterialColors.getColor(viewHolder.time, com.google.android.material.R.attr.colorError));
} else {
- if (darkBackground) {
- viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_OnDark);
- } else {
- viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption);
- }
- viewHolder.time.setTextColor(this.getMessageTextColor(darkBackground, false));
+ setTextColor(viewHolder.time,bubbleColor);
}
if (message.getEncryption() == Message.ENCRYPTION_NONE) {
viewHolder.indicator.setVisibility(View.GONE);
@@ -271,15 +260,11 @@ public class MessageAdapter extends ArrayAdapter {
}
}
if (verified) {
- viewHolder.indicator.setImageResource(darkBackground ? R.drawable.ic_verified_user_white_18dp : R.drawable.ic_verified_user_black_18dp);
+ viewHolder.indicator.setImageResource(R.drawable.ic_verified_user_24dp);
} else {
- viewHolder.indicator.setImageResource(darkBackground ? R.drawable.ic_lock_white_18dp : R.drawable.ic_lock_black_18dp);
- }
- if (darkBackground) {
- viewHolder.indicator.setAlpha(0.7f);
- } else {
- viewHolder.indicator.setAlpha(0.57f);
+ viewHolder.indicator.setImageResource(R.drawable.ic_lock_24dp);
}
+ setImageTint(viewHolder.indicator, bubbleColor);
viewHolder.indicator.setVisibility(View.VISIBLE);
}
@@ -313,37 +298,29 @@ public class MessageAdapter extends ArrayAdapter {
}
}
- private void displayInfoMessage(ViewHolder viewHolder, CharSequence text, boolean darkBackground) {
+ private void displayInfoMessage(ViewHolder viewHolder, CharSequence text, final BubbleColor bubbleColor) {
viewHolder.download_button.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.image.setVisibility(View.GONE);
viewHolder.messageBody.setVisibility(View.VISIBLE);
viewHolder.messageBody.setText(text);
- if (darkBackground) {
- viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary_OnDark);
- } else {
- viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary);
- }
+ viewHolder.messageBody.setTextColor(bubbleToOnSurfaceVariant(viewHolder.messageBody,bubbleColor));
viewHolder.messageBody.setTextIsSelectable(false);
}
- private void displayEmojiMessage(final ViewHolder viewHolder, final String body, final boolean darkBackground) {
+ private void displayEmojiMessage(final ViewHolder viewHolder, final String body, final BubbleColor bubbleColor) {
viewHolder.download_button.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.image.setVisibility(View.GONE);
viewHolder.messageBody.setVisibility(View.VISIBLE);
- if (darkBackground) {
- viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Emoji_OnDark);
- } else {
- viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Emoji);
- }
- Spannable span = new SpannableString(body);
+ setTextColor(viewHolder.messageBody, bubbleColor);
+ final Spannable span = new SpannableString(body);
float size = Emoticons.isEmoji(body) ? 3.0f : 2.0f;
span.setSpan(new RelativeSizeSpan(size), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
viewHolder.messageBody.setText(span);
}
- private void applyQuoteSpan(SpannableStringBuilder body, int start, int end, boolean darkBackground) {
+ private void applyQuoteSpan(final TextView textView, SpannableStringBuilder body, int start, int end, final BubbleColor bubbleColor) {
if (start > 1 && !"\n\n".equals(body.subSequence(start - 2, start).toString())) {
body.insert(start++, "\n");
body.setSpan(new DividerSpan(false), start - 2, start, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
@@ -353,17 +330,15 @@ public class MessageAdapter extends ArrayAdapter {
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.green700_desaturated);
- DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
- body.setSpan(new QuoteSpan(color, metrics), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
+ body.setSpan(new QuoteSpan(bubbleToOnSurfaceVariant(textView, bubbleColor), metrics), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
/**
* Applies QuoteSpan to group of lines which starts with > or » characters.
* Appends likebreaks and applies DividerSpan to them to show a padding between quote and text.
*/
- private boolean handleTextQuotes(SpannableStringBuilder body, boolean darkBackground) {
+ private boolean handleTextQuotes(final TextView textView, final SpannableStringBuilder body, final BubbleColor bubbleColor) {
boolean startsWithQuote = false;
int quoteDepth = 1;
while (QuoteHelper.bodyContainsQuoteStart(body) && quoteDepth <= Config.QUOTE_MAX_DEPTH) {
@@ -382,7 +357,7 @@ public class MessageAdapter extends ArrayAdapter {
if (i == 0) startsWithQuote = true;
} else if (quoteStart >= 0) {
// Line start without quote, apply spans there
- applyQuoteSpan(body, quoteStart, i - 1, darkBackground);
+ applyQuoteSpan(textView, body, quoteStart, i - 1, bubbleColor);
quoteStart = -1;
}
}
@@ -407,26 +382,19 @@ public class MessageAdapter extends ArrayAdapter {
}
if (quoteStart >= 0) {
// Apply spans to finishing open quote
- applyQuoteSpan(body, quoteStart, body.length(), darkBackground);
+ applyQuoteSpan(textView, body, quoteStart, body.length(), bubbleColor);
}
quoteDepth++;
}
return startsWithQuote;
}
- private void displayTextMessage(final ViewHolder viewHolder, final Message message, boolean darkBackground, int type) {
+ private void displayTextMessage(final ViewHolder viewHolder, final Message message, final BubbleColor bubbleColor, int type) {
viewHolder.download_button.setVisibility(View.GONE);
viewHolder.image.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.messageBody.setVisibility(View.VISIBLE);
-
- if (darkBackground) {
- viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_OnDark);
- } else {
- viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1);
- }
- viewHolder.messageBody.setHighlightColor(ContextCompat.getColor(activity, darkBackground
- ? (type == SENT || !mUseGreenBackground ? R.color.black26 : R.color.grey800) : R.color.grey500));
+ setTextColor(viewHolder.messageBody, bubbleColor);
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
if (message.getBody() != null) {
@@ -446,7 +414,7 @@ public class MessageAdapter extends ArrayAdapter {
int end = body.getSpanEnd(mergeSeparator);
body.setSpan(new DividerSpan(true), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
- boolean startsWithQuote = handleTextQuotes(body, darkBackground);
+ boolean startsWithQuote = handleTextQuotes(viewHolder.messageBody, body, bubbleColor);
if (!message.isPrivateMessage()) {
if (hasMeCommand) {
body.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), 0, nick.length(),
@@ -469,7 +437,7 @@ public class MessageAdapter extends ArrayAdapter {
} else {
body.insert(privateMarkerIndex, " ");
}
- body.setSpan(new ForegroundColorSpan(getMessageTextColor(darkBackground, false)), 0, privateMarkerIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ body.setSpan(new ForegroundColorSpan(bubbleToOnSurfaceVariant(viewHolder.messageBody, bubbleColor)), 0, privateMarkerIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
body.setSpan(new StyleSpan(Typeface.BOLD), 0, privateMarkerIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
if (hasMeCommand) {
body.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), privateMarkerIndex + 1,
@@ -477,8 +445,7 @@ public class MessageAdapter extends ArrayAdapter {
}
}
if (message.getConversation().getMode() == Conversation.MODE_MULTI && message.getStatus() == Message.STATUS_RECEIVED) {
- if (message.getConversation() instanceof Conversation) {
- final Conversation conversation = (Conversation) message.getConversation();
+ if (message.getConversation() instanceof Conversation conversation) {
Pattern pattern = NotificationService.generateNickHighlightPattern(conversation.getMucOptions().getActualNick());
Matcher matcher = pattern.matcher(body);
while (matcher.find()) {
@@ -495,7 +462,7 @@ public class MessageAdapter extends ArrayAdapter {
StylingHelper.format(body, viewHolder.messageBody.getCurrentTextColor());
if (highlightedTerm != null) {
- StylingHelper.highlight(activity, body, highlightedTerm, StylingHelper.isDarkText(viewHolder.messageBody));
+ StylingHelper.highlight(viewHolder.messageBody, body, highlightedTerm);
}
MyLinkify.addLinks(body, true);
viewHolder.messageBody.setAutoLinkMask(0);
@@ -507,45 +474,54 @@ public class MessageAdapter extends ArrayAdapter {
}
}
- private void displayDownloadableMessage(ViewHolder viewHolder, final Message message, String text, final boolean darkBackground) {
- toggleWhisperInfo(viewHolder, message, darkBackground);
+ private void displayDownloadableMessage(ViewHolder viewHolder, final Message message, String text, final BubbleColor bubbleColor) {
+ toggleWhisperInfo(viewHolder, message, bubbleColor);
viewHolder.image.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.download_button.setVisibility(View.VISIBLE);
viewHolder.download_button.setText(text);
+ final var attachment = Attachment.of(message);
+ final @DrawableRes int imageResource = MediaAdapter.getImageDrawable(attachment);
+ viewHolder.download_button.setIconResource(imageResource);
viewHolder.download_button.setOnClickListener(v -> ConversationFragment.downloadFile(activity, message));
}
- private void displayOpenableMessage(ViewHolder viewHolder, final Message message, final boolean darkBackground) {
- toggleWhisperInfo(viewHolder, message, darkBackground);
+ private void displayOpenableMessage(ViewHolder viewHolder, final Message message, final BubbleColor bubbleColor) {
+ toggleWhisperInfo(viewHolder, message, bubbleColor);
viewHolder.image.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.download_button.setVisibility(View.VISIBLE);
viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message)));
+ final var attachment = Attachment.of(message);
+ final @DrawableRes int imageResource = MediaAdapter.getImageDrawable(attachment);
+ viewHolder.download_button.setIconResource(imageResource);
viewHolder.download_button.setOnClickListener(v -> openDownloadable(message));
}
- private void displayLocationMessage(ViewHolder viewHolder, final Message message, final boolean darkBackground) {
- toggleWhisperInfo(viewHolder, message, darkBackground);
+ private void displayLocationMessage(ViewHolder viewHolder, final Message message, final BubbleColor bubbleColor) {
+ toggleWhisperInfo(viewHolder, message, bubbleColor);
viewHolder.image.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.download_button.setVisibility(View.VISIBLE);
viewHolder.download_button.setText(R.string.show_location);
+ final var attachment = Attachment.of(message);
+ final @DrawableRes int imageResource = MediaAdapter.getImageDrawable(attachment);
+ viewHolder.download_button.setIconResource(imageResource);
viewHolder.download_button.setOnClickListener(v -> showLocation(message));
}
- private void displayAudioMessage(ViewHolder viewHolder, Message message, boolean darkBackground) {
- toggleWhisperInfo(viewHolder, message, darkBackground);
+ private void displayAudioMessage(ViewHolder viewHolder, Message message, final BubbleColor bubbleColor) {
+ toggleWhisperInfo(viewHolder, message, bubbleColor);
viewHolder.image.setVisibility(View.GONE);
viewHolder.download_button.setVisibility(View.GONE);
final RelativeLayout audioPlayer = viewHolder.audioPlayer;
audioPlayer.setVisibility(View.VISIBLE);
- AudioPlayer.ViewHolder.get(audioPlayer).setDarkBackground(darkBackground);
+ AudioPlayer.ViewHolder.get(audioPlayer).setBubbleColor(bubbleColor);
this.audioPlayer.init(audioPlayer, message);
}
- private void displayMediaPreviewMessage(ViewHolder viewHolder, final Message message, final boolean darkBackground) {
- toggleWhisperInfo(viewHolder, message, darkBackground);
+ private void displayMediaPreviewMessage(ViewHolder viewHolder, final Message message, final BubbleColor bubbleColor) {
+ toggleWhisperInfo(viewHolder, message, bubbleColor);
viewHolder.download_button.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.image.setVisibility(View.VISIBLE);
@@ -573,7 +549,7 @@ public class MessageAdapter extends ArrayAdapter {
viewHolder.image.setOnClickListener(v -> openDownloadable(message));
}
- private void toggleWhisperInfo(ViewHolder viewHolder, final Message message, final boolean darkBackground) {
+ private void toggleWhisperInfo(ViewHolder viewHolder, final Message message, final BubbleColor bubbleColor) {
if (message.isPrivateMessage()) {
final String privateMarker;
if (message.getStatus() <= Message.STATUS_RECEIVED) {
@@ -583,7 +559,7 @@ public class MessageAdapter extends ArrayAdapter {
privateMarker = activity.getString(R.string.private_message_to, Strings.nullToEmpty(cp == null ? null : cp.getResource()));
}
final SpannableString body = new SpannableString(privateMarker);
- body.setSpan(new ForegroundColorSpan(getMessageTextColor(darkBackground, false)), 0, privateMarker.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ body.setSpan(new ForegroundColorSpan(bubbleToOnSurfaceVariant(viewHolder.messageBody, bubbleColor)), 0, privateMarker.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
body.setSpan(new StyleSpan(Typeface.BOLD), 0, privateMarker.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
viewHolder.messageBody.setText(body);
viewHolder.messageBody.setVisibility(View.VISIBLE);
@@ -611,7 +587,7 @@ public class MessageAdapter extends ArrayAdapter {
}
@Override
- public View getView(int position, View view, ViewGroup parent) {
+ public View getView(final int position, View view, final @NonNull ViewGroup parent) {
final Message message = getItem(position);
final boolean omemoEncryption = message.getEncryption() == Message.ENCRYPTION_AXOLOTL;
final boolean isInValidSession = message.isValidInSession() && (!omemoEncryption || message.isTrusted());
@@ -623,19 +599,18 @@ public class MessageAdapter extends ArrayAdapter {
viewHolder = new ViewHolder();
switch (type) {
case DATE_SEPARATOR:
- view = activity.getLayoutInflater().inflate(R.layout.message_date_bubble, parent, false);
+ view = activity.getLayoutInflater().inflate(R.layout.item_message_date_bubble, parent, false);
viewHolder.status_message = view.findViewById(R.id.message_body);
viewHolder.message_box = view.findViewById(R.id.message_box);
- viewHolder.indicatorReceived = view.findViewById(R.id.indicator_received);
break;
case RTP_SESSION:
- view = activity.getLayoutInflater().inflate(R.layout.message_rtp_session, parent, false);
+ view = activity.getLayoutInflater().inflate(R.layout.item_message_rtp_session, parent, false);
viewHolder.status_message = view.findViewById(R.id.message_body);
viewHolder.message_box = view.findViewById(R.id.message_box);
viewHolder.indicatorReceived = view.findViewById(R.id.indicator_received);
break;
case SENT:
- view = activity.getLayoutInflater().inflate(R.layout.message_sent, parent, false);
+ view = activity.getLayoutInflater().inflate(R.layout.item_message_sent, parent, false);
viewHolder.message_box = view.findViewById(R.id.message_box);
viewHolder.contact_picture = view.findViewById(R.id.message_photo);
viewHolder.download_button = view.findViewById(R.id.download_button);
@@ -648,7 +623,7 @@ public class MessageAdapter extends ArrayAdapter {
viewHolder.audioPlayer = view.findViewById(R.id.audio_player);
break;
case RECEIVED:
- view = activity.getLayoutInflater().inflate(R.layout.message_received, parent, false);
+ view = activity.getLayoutInflater().inflate(R.layout.item_message_received, parent, false);
viewHolder.message_box = view.findViewById(R.id.message_box);
viewHolder.contact_picture = view.findViewById(R.id.message_photo);
viewHolder.download_button = view.findViewById(R.id.download_button);
@@ -662,7 +637,7 @@ public class MessageAdapter extends ArrayAdapter {
viewHolder.audioPlayer = view.findViewById(R.id.audio_player);
break;
case STATUS:
- view = activity.getLayoutInflater().inflate(R.layout.message_status, parent, false);
+ view = activity.getLayoutInflater().inflate(R.layout.item_message_status, parent, false);
viewHolder.contact_picture = view.findViewById(R.id.message_photo);
viewHolder.status_message = view.findViewById(R.id.status_message);
viewHolder.load_more_messages = view.findViewById(R.id.load_more_messages);
@@ -678,7 +653,17 @@ public class MessageAdapter extends ArrayAdapter {
}
}
- boolean darkBackground = type == RECEIVED && (!isInValidSession || mUseGreenBackground) || activity.isDarkTheme();
+ final boolean colorfulBackground = mUseGreenBackground;
+ final BubbleColor bubbleColor;
+ if (type == RECEIVED) {
+ if (isInValidSession) {
+ bubbleColor = colorfulBackground ? BubbleColor.TERTIARY : BubbleColor.SURFACE;
+ } else {
+ bubbleColor = BubbleColor.WARNING;
+ }
+ } else {
+ bubbleColor = colorfulBackground ? BubbleColor.SECONDARY : BubbleColor.SURFACE;
+ }
if (type == DATE_SEPARATOR) {
if (UIHelper.today(message.getTimeSent())) {
@@ -688,10 +673,15 @@ public class MessageAdapter extends ArrayAdapter {
} else {
viewHolder.status_message.setText(DateUtils.formatDateTime(activity, message.getTimeSent(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR));
}
- viewHolder.message_box.setBackgroundResource(activity.isDarkTheme() ? R.drawable.date_bubble_grey : R.drawable.date_bubble_white);
+ if (colorfulBackground) {
+ setBackgroundTint(viewHolder.message_box,BubbleColor.PRIMARY);
+ setTextColor(viewHolder.status_message, BubbleColor.PRIMARY);
+ } else {
+ setBackgroundTint(viewHolder.message_box,BubbleColor.SURFACE);
+ setTextColor(viewHolder.status_message, BubbleColor.SURFACE);
+ }
return view;
} else if (type == RTP_SESSION) {
- final boolean isDarkTheme = activity.isDarkTheme();
final boolean received = message.getStatus() <= Message.STATUS_RECEIVED;
final RtpSessionStatus rtpSessionStatus = RtpSessionStatus.of(message.getBody());
final long duration = rtpSessionStatus.duration;
@@ -710,9 +700,16 @@ public class MessageAdapter extends ArrayAdapter {
viewHolder.status_message.setText(activity.getString(R.string.outgoing_call_timestamp, UIHelper.readableTimeDifferenceFull(activity, message.getTimeSent())));
}
}
- viewHolder.indicatorReceived.setImageResource(RtpSessionStatus.getDrawable(received, rtpSessionStatus.successful, isDarkTheme));
- viewHolder.indicatorReceived.setAlpha(isDarkTheme ? 0.7f : 0.57f);
- viewHolder.message_box.setBackgroundResource(isDarkTheme ? R.drawable.date_bubble_grey : R.drawable.date_bubble_white);
+ if (colorfulBackground) {
+ setBackgroundTint(viewHolder.message_box,BubbleColor.TERTIARY);
+ setTextColor(viewHolder.status_message, BubbleColor.TERTIARY);
+ setImageTint(viewHolder.indicatorReceived, BubbleColor.TERTIARY);
+ } else {
+ setBackgroundTint(viewHolder.message_box,BubbleColor.SURFACE);
+ setTextColor(viewHolder.status_message, BubbleColor.SURFACE);
+ setImageTint(viewHolder.indicatorReceived, BubbleColor.SURFACE);
+ }
+ viewHolder.indicatorReceived.setImageResource(RtpSessionStatus.getDrawable(received, rtpSessionStatus.successful));
return view;
} else if (type == STATUS) {
if ("LOAD_MORE".equals(message.getBody())) {
@@ -769,43 +766,43 @@ public class MessageAdapter extends ArrayAdapter {
final boolean unInitiatedButKnownSize = MessageUtils.unInitiatedButKnownSize(message);
if (unInitiatedButKnownSize || message.isDeleted() || (transferable != null && transferable.getStatus() != Transferable.STATUS_UPLOADING)) {
if (unInitiatedButKnownSize || transferable != null && transferable.getStatus() == Transferable.STATUS_OFFER) {
- displayDownloadableMessage(viewHolder, message, activity.getString(R.string.download_x_file, UIHelper.getFileDescriptionString(activity, message)), darkBackground);
+ displayDownloadableMessage(viewHolder, message, activity.getString(R.string.download_x_file, UIHelper.getFileDescriptionString(activity, message)), bubbleColor);
} else if (transferable != null && transferable.getStatus() == Transferable.STATUS_OFFER_CHECK_FILESIZE) {
- displayDownloadableMessage(viewHolder, message, activity.getString(R.string.check_x_filesize, UIHelper.getFileDescriptionString(activity, message)), darkBackground);
+ displayDownloadableMessage(viewHolder, message, activity.getString(R.string.check_x_filesize, UIHelper.getFileDescriptionString(activity, message)), bubbleColor);
} else {
- displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first, darkBackground);
+ displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first, bubbleColor);
}
} else if (message.isFileOrImage() && message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED) {
if (message.getFileParams().width > 0 && message.getFileParams().height > 0) {
- displayMediaPreviewMessage(viewHolder, message, darkBackground);
+ displayMediaPreviewMessage(viewHolder, message, bubbleColor);
} else if (message.getFileParams().runtime > 0) {
- displayAudioMessage(viewHolder, message, darkBackground);
+ displayAudioMessage(viewHolder, message, bubbleColor);
} else {
- displayOpenableMessage(viewHolder, message, darkBackground);
+ displayOpenableMessage(viewHolder, message, bubbleColor);
}
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) {
if (account.isPgpDecryptionServiceConnected()) {
if (conversation instanceof Conversation && !account.hasPendingPgpIntent((Conversation) conversation)) {
- displayInfoMessage(viewHolder, activity.getString(R.string.message_decrypting), darkBackground);
+ displayInfoMessage(viewHolder, activity.getString(R.string.message_decrypting), bubbleColor);
} else {
- displayInfoMessage(viewHolder, activity.getString(R.string.pgp_message), darkBackground);
+ displayInfoMessage(viewHolder, activity.getString(R.string.pgp_message), bubbleColor);
}
} else {
- displayInfoMessage(viewHolder, activity.getString(R.string.install_openkeychain), darkBackground);
+ displayInfoMessage(viewHolder, activity.getString(R.string.install_openkeychain), bubbleColor);
viewHolder.message_box.setOnClickListener(this::promptOpenKeychainInstall);
viewHolder.messageBody.setOnClickListener(this::promptOpenKeychainInstall);
}
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
- displayInfoMessage(viewHolder, activity.getString(R.string.decryption_failed), darkBackground);
+ displayInfoMessage(viewHolder, activity.getString(R.string.decryption_failed), bubbleColor);
} else if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL_NOT_FOR_THIS_DEVICE) {
- displayInfoMessage(viewHolder, activity.getString(R.string.not_encrypted_for_this_device), darkBackground);
+ displayInfoMessage(viewHolder, activity.getString(R.string.not_encrypted_for_this_device), bubbleColor);
} else if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL_FAILED) {
- displayInfoMessage(viewHolder, activity.getString(R.string.omemo_decryption_failed), darkBackground);
+ displayInfoMessage(viewHolder, activity.getString(R.string.omemo_decryption_failed), bubbleColor);
} else {
if (message.isGeoUri()) {
- displayLocationMessage(viewHolder, message, darkBackground);
+ displayLocationMessage(viewHolder, message, bubbleColor);
} else if (message.bodyIsOnlyEmojis() && message.getType() != Message.TYPE_PRIVATE) {
- displayEmojiMessage(viewHolder, message.getBody().trim(), darkBackground);
+ displayEmojiMessage(viewHolder, message.getBody().trim(), bubbleColor);
} else if (message.treatAsDownloadable()) {
try {
final URI uri = new URI(message.getBody());
@@ -814,31 +811,27 @@ public class MessageAdapter extends ArrayAdapter {
activity.getString(R.string.check_x_filesize_on_host,
UIHelper.getFileDescriptionString(activity, message),
uri.getHost()),
- darkBackground);
+ bubbleColor);
} catch (Exception e) {
displayDownloadableMessage(viewHolder,
message,
activity.getString(R.string.check_x_filesize,
UIHelper.getFileDescriptionString(activity, message)),
- darkBackground);
+ bubbleColor);
}
} else {
- displayTextMessage(viewHolder, message, darkBackground, type);
+ displayTextMessage(viewHolder, message, bubbleColor, type);
}
}
+ setBackgroundTint(viewHolder.message_box, bubbleColor);
+ setTextColor(viewHolder.messageBody, bubbleColor);
+
if (type == RECEIVED) {
+ setTextColor(viewHolder.encryption, bubbleColor);
if (isInValidSession) {
- int bubble;
- if (!mUseGreenBackground) {
- bubble = activity.getThemeResource(R.attr.message_bubble_received_monochrome, R.drawable.message_bubble_received_white);
- } else {
- bubble = activity.getThemeResource(R.attr.message_bubble_received_green, R.drawable.message_bubble_received);
- }
- viewHolder.message_box.setBackgroundResource(bubble);
viewHolder.encryption.setVisibility(View.GONE);
} else {
- viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning);
viewHolder.encryption.setVisibility(View.VISIBLE);
if (omemoEncryption && !message.isTrusted()) {
viewHolder.encryption.setText(R.string.not_trusted);
@@ -848,7 +841,7 @@ public class MessageAdapter extends ArrayAdapter {
}
}
- displayStatus(viewHolder, message, type, darkBackground);
+ displayStatus(viewHolder, message, type, bubbleColor);
return view;
}
@@ -911,13 +904,68 @@ public class MessageAdapter extends ArrayAdapter {
void onContactPictureLongClicked(View v, Message message);
}
+ private static void setBackgroundTint(final View view, final BubbleColor bubbleColor) {
+ view.setBackgroundTintList(bubbleToColorStateList(view, bubbleColor));
+ }
+
+ private static ColorStateList bubbleToColorStateList(final View view, final BubbleColor bubbleColor) {
+ final @AttrRes int colorAttributeResId = switch (bubbleColor) {
+ case SURFACE -> com.google.android.material.R.attr.colorSurfaceContainerHigh;
+ case PRIMARY -> com.google.android.material.R.attr.colorPrimaryContainer;
+ case SECONDARY -> com.google.android.material.R.attr.colorSecondaryContainer;
+ case TERTIARY -> com.google.android.material.R.attr.colorTertiaryContainer;
+ case WARNING -> com.google.android.material.R.attr.colorErrorContainer;
+ };
+ return ColorStateList.valueOf(MaterialColors.getColor(view,colorAttributeResId));
+ }
+
+ public static void setImageTint(final ImageView imageView, final BubbleColor bubbleColor) {
+ ImageViewCompat.setImageTintList(imageView,bubbleToOnSurfaceColorStateList(imageView, bubbleColor));
+ }
+
+ public static void setTextColor(final TextView textView, final BubbleColor bubbleColor) {
+ textView.setTextColor(bubbleToOnSurfaceColor(textView, bubbleColor));
+ }
+
+ private static @ColorInt int bubbleToOnSurfaceVariant(final View view, final BubbleColor bubbleColor) {
+ final @AttrRes int colorAttributeResId;
+ if (bubbleColor == BubbleColor.SURFACE) {
+ colorAttributeResId = com.google.android.material.R.attr.colorOnSurfaceVariant;
+ } else {
+ colorAttributeResId = bubbleToOnSurface(bubbleColor);
+ }
+ return MaterialColors.getColor(view,colorAttributeResId);
+ }
+
+ private static @ColorInt int bubbleToOnSurfaceColor(final View view, final BubbleColor bubbleColor) {
+ return MaterialColors.getColor(view, bubbleToOnSurface(bubbleColor));
+ }
+
+ public static ColorStateList bubbleToOnSurfaceColorStateList(final View view, final BubbleColor bubbleColor) {
+ return ColorStateList.valueOf(bubbleToOnSurfaceColor(view, bubbleColor));
+ }
+
+ private static @AttrRes int bubbleToOnSurface(final BubbleColor bubbleColor) {
+ return switch (bubbleColor) {
+ case SURFACE -> com.google.android.material.R.attr.colorOnSurface;
+ case PRIMARY -> com.google.android.material.R.attr.colorOnPrimaryContainer;
+ case SECONDARY -> com.google.android.material.R.attr.colorOnSecondaryContainer;
+ case TERTIARY -> com.google.android.material.R.attr.colorOnTertiaryContainer;
+ case WARNING -> com.google.android.material.R.attr.colorOnErrorContainer;
+ };
+ }
+
+ public enum BubbleColor {
+ SURFACE, PRIMARY, SECONDARY, TERTIARY, WARNING
+ }
+
private static class ViewHolder {
- public Button load_more_messages;
+ public MaterialButton load_more_messages;
public ImageView edit_indicator;
public RelativeLayout audioPlayer;
protected LinearLayout message_box;
- protected Button download_button;
+ protected MaterialButton download_button;
protected ImageView image;
protected ImageView indicator;
protected ImageView indicatorReceived;
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java
index de3216908..6463412dd 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java
@@ -17,7 +17,7 @@ import org.openintents.openpgp.util.OpenPgpUtils;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
-import eu.siacs.conversations.databinding.ContactBinding;
+import eu.siacs.conversations.databinding.ItemContactBinding;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.MucOptions;
import eu.siacs.conversations.services.XmppConnectionService;
@@ -62,7 +62,7 @@ public class UserAdapter extends ListAdapter implements View.OnCreateContextMenuListener {
+public class UserPreviewAdapter extends ListAdapter
+ implements View.OnCreateContextMenuListener {
private MucOptions.User selectedUser = null;
@@ -28,29 +29,43 @@ public class UserPreviewAdapter extends ListAdapter {
- final XmppActivity activity = XmppActivity.find(v);
- if (activity != null) {
- activity.highlightInMuc(user.getConversation(), user.getName());
- }
- });
+ viewHolder
+ .binding
+ .getRoot()
+ .setOnClickListener(
+ v -> {
+ final XmppActivity activity = XmppActivity.find(v);
+ if (activity != null) {
+ activity.highlightInMuc(user.getConversation(), user.getName());
+ }
+ });
viewHolder.binding.getRoot().setOnCreateContextMenuListener(this);
viewHolder.binding.getRoot().setTag(user);
- viewHolder.binding.getRoot().setOnLongClickListener(v -> {
- selectedUser = user;
- return false;
- });
+ viewHolder
+ .binding
+ .getRoot()
+ .setOnLongClickListener(
+ v -> {
+ selectedUser = user;
+ return false;
+ });
}
@Override
- public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ public void onCreateContextMenu(
+ ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
MucDetailsContextMenuHelper.onCreateContextMenu(menu, v);
}
@@ -60,9 +75,9 @@ public class UserPreviewAdapter extends ListAdapter getValues() {
- List values = new ArrayList<>();
- values.add(Boolean.toString(checkBox.isChecked()));
- return values;
- }
-
- @Override
- protected void setValues(List values) {
- if (values.size() == 0) {
- checkBox.setChecked(false);
- } else {
- checkBox.setChecked(Boolean.parseBoolean(values.get(0)));
- }
- }
-
- @Override
- public boolean validates() {
- if (checkBox.isChecked() || !field.isRequired()) {
- return true;
- } else {
- checkBox.setError(context.getString(R.string.this_field_is_required));
- checkBox.requestFocus();
- return false;
- }
- }
-
- @Override
- public boolean edited() {
- if (field.getValues().size() == 0) {
- return checkBox.isChecked();
- } else {
- return super.edited();
- }
- }
-
- @Override
- protected int getLayoutResource() {
- return R.layout.form_boolean;
- }
-
- @Override
- void setReadOnly(boolean readOnly) {
- checkBox.setEnabled(!readOnly);
- }
-}
diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormFieldFactory.java b/src/main/java/eu/siacs/conversations/ui/forms/FormFieldFactory.java
deleted file mode 100644
index ee3064726..000000000
--- a/src/main/java/eu/siacs/conversations/ui/forms/FormFieldFactory.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package eu.siacs.conversations.ui.forms;
-
-import android.content.Context;
-
-import java.util.Hashtable;
-
-import eu.siacs.conversations.xmpp.forms.Field;
-
-
-
-public class FormFieldFactory {
-
- private static final Hashtable typeTable = new Hashtable<>();
-
- static {
- typeTable.put("text-single", FormTextFieldWrapper.class);
- typeTable.put("text-multi", FormTextFieldWrapper.class);
- typeTable.put("text-private", FormTextFieldWrapper.class);
- typeTable.put("jid-single", FormJidSingleFieldWrapper.class);
- typeTable.put("boolean", FormBooleanFieldWrapper.class);
- }
-
- protected static FormFieldWrapper createFromField(Context context, Field field) {
- Class clazz = typeTable.get(field.getType());
- if (clazz == null) {
- clazz = FormTextFieldWrapper.class;
- }
- return FormFieldWrapper.createFromField(clazz, context, field);
- }
-}
diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java
deleted file mode 100644
index 4dcef5432..000000000
--- a/src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package eu.siacs.conversations.ui.forms;
-
-import android.content.Context;
-import android.text.SpannableString;
-import android.text.style.ForegroundColorSpan;
-import android.text.style.StyleSpan;
-import android.view.LayoutInflater;
-import android.view.View;
-
-import java.util.List;
-
-import eu.siacs.conversations.ui.util.StyledAttributes;
-import eu.siacs.conversations.xmpp.forms.Field;
-
-public abstract class FormFieldWrapper {
-
- protected final Context context;
- protected final Field field;
- protected final View view;
- OnFormFieldValuesEdited onFormFieldValuesEditedListener;
-
- FormFieldWrapper(Context context, Field field) {
- this.context = context;
- this.field = field;
- LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- this.view = inflater.inflate(getLayoutResource(), null);
- String label = field.getLabel();
- if (label == null) {
- label = field.getFieldName();
- }
- setLabel(label, field.isRequired());
- }
-
- public final void submit() {
- this.field.setValues(getValues());
- }
-
- public final View getView() {
- return view;
- }
-
- protected abstract void setLabel(String label, boolean required);
-
- abstract List getValues();
-
- protected abstract void setValues(List values);
-
- abstract boolean validates();
-
- abstract protected int getLayoutResource();
-
- abstract void setReadOnly(boolean readOnly);
-
- protected SpannableString createSpannableLabelString(String label, boolean required) {
- SpannableString spannableString = new SpannableString(label + (required ? " *" : ""));
- if (required) {
- int start = label.length();
- int end = label.length() + 2;
- spannableString.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), start, end, 0);
- spannableString.setSpan(new ForegroundColorSpan(StyledAttributes.getColor(context, androidx.appcompat.R.attr.colorAccent)), start, end, 0);
- }
- return spannableString;
- }
-
- protected void invokeOnFormFieldValuesEdited() {
- if (this.onFormFieldValuesEditedListener != null) {
- this.onFormFieldValuesEditedListener.onFormFieldValuesEdited();
- }
- }
-
- public boolean edited() {
- return !field.getValues().equals(getValues());
- }
-
- public void setOnFormFieldValuesEditedListener(OnFormFieldValuesEdited listener) {
- this.onFormFieldValuesEditedListener = listener;
- }
-
- protected static FormFieldWrapper createFromField(Class c, Context context, Field field) {
- try {
- F fieldWrapper = c.getDeclaredConstructor(Context.class, Field.class).newInstance(context,field);
- fieldWrapper.setValues(field.getValues());
- return fieldWrapper;
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-
- public interface OnFormFieldValuesEdited {
- void onFormFieldValuesEdited();
- }
-}
diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java
deleted file mode 100644
index 00f0899c1..000000000
--- a/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package eu.siacs.conversations.ui.forms;
-
-import android.content.Context;
-import android.text.InputType;
-
-import java.util.List;
-
-import eu.siacs.conversations.R;
-import eu.siacs.conversations.xmpp.Jid;
-import eu.siacs.conversations.xmpp.forms.Field;
-
-public class FormJidSingleFieldWrapper extends FormTextFieldWrapper {
-
- protected FormJidSingleFieldWrapper(Context context, Field field) {
- super(context, field);
- editText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
- editText.setHint(R.string.account_settings_example_jabber_id);
- }
-
- @Override
- public boolean validates() {
- String value = getValue();
- if (!value.isEmpty()) {
- try {
- Jid.of(value);
- } catch (IllegalArgumentException e) {
- editText.setError(context.getString(R.string.invalid_jid));
- editText.requestFocus();
- return false;
- }
- }
- return super.validates();
- }
-
- @Override
- protected void setValues(List values) {
- StringBuilder builder = new StringBuilder();
- for(String value : values) {
- builder.append(value);
- }
- editText.setText(builder.toString());
- }
-}
diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java
deleted file mode 100644
index 81fbb2e2e..000000000
--- a/src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package eu.siacs.conversations.ui.forms;
-
-import android.content.Context;
-import android.text.Editable;
-import android.text.InputType;
-import android.text.TextWatcher;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import eu.siacs.conversations.R;
-import eu.siacs.conversations.xmpp.forms.Field;
-
-public class FormTextFieldWrapper extends FormFieldWrapper {
-
- protected EditText editText;
-
- protected FormTextFieldWrapper(Context context, Field field) {
- super(context, field);
- editText = view.findViewById(R.id.field);
- editText.setSingleLine(!"text-multi".equals(field.getType()));
- if ("text-private".equals(field.getType())) {
- editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
- }
- editText.addTextChangedListener(new TextWatcher() {
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- editText.setError(null);
- invokeOnFormFieldValuesEdited();
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- }
- });
- }
-
- @Override
- protected void setLabel(String label, boolean required) {
- TextView textView = view.findViewById(R.id.label);
- textView.setText(createSpannableLabelString(label, required));
- }
-
- protected String getValue() {
- return editText.getText().toString();
- }
-
- @Override
- public List getValues() {
- List values = new ArrayList<>();
- for (String line : getValue().split("\\n")) {
- if (line.length() > 0) {
- values.add(line);
- }
- }
- return values;
- }
-
- @Override
- protected void setValues(List values) {
- StringBuilder builder = new StringBuilder();
- for(int i = 0; i < values.size(); ++i) {
- builder.append(values.get(i));
- if (i < values.size() - 1 && "text-multi".equals(field.getType())) {
- builder.append("\n");
- }
- }
- editText.setText(builder.toString());
- }
-
- @Override
- public boolean validates() {
- if (getValue().trim().length() > 0 || !field.isRequired()) {
- return true;
- } else {
- editText.setError(context.getString(R.string.this_field_is_required));
- editText.requestFocus();
- return false;
- }
- }
-
- @Override
- protected int getLayoutResource() {
- return R.layout.form_text;
- }
-
- @Override
- void setReadOnly(boolean readOnly) {
- editText.setEnabled(!readOnly);
- }
-}
diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormWrapper.java
deleted file mode 100644
index eafe95cc8..000000000
--- a/src/main/java/eu/siacs/conversations/ui/forms/FormWrapper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package eu.siacs.conversations.ui.forms;
-
-import android.content.Context;
-import android.widget.LinearLayout;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import eu.siacs.conversations.xmpp.forms.Data;
-import eu.siacs.conversations.xmpp.forms.Field;
-
-public class FormWrapper {
-
- private final LinearLayout layout;
-
- private final Data form;
-
- private final List fieldWrappers = new ArrayList<>();
-
- private FormWrapper(Context context, LinearLayout linearLayout, Data form) {
- this.form = form;
- this.layout = linearLayout;
- this.layout.removeAllViews();
- for(Field field : form.getFields()) {
- FormFieldWrapper fieldWrapper = FormFieldFactory.createFromField(context,field);
- if (fieldWrapper != null) {
- layout.addView(fieldWrapper.getView());
- fieldWrappers.add(fieldWrapper);
- }
- }
- }
-
- public Data submit() {
- for(FormFieldWrapper fieldWrapper : fieldWrappers) {
- fieldWrapper.submit();
- }
- this.form.submit();
- return this.form;
- }
-
- public boolean validates() {
- boolean validates = true;
- for(FormFieldWrapper fieldWrapper : fieldWrappers) {
- validates &= fieldWrapper.validates();
- }
- return validates;
- }
-
- public void setOnFormFieldValuesEditedListener(FormFieldWrapper.OnFormFieldValuesEdited listener) {
- for(FormFieldWrapper fieldWrapper : fieldWrappers) {
- fieldWrapper.setOnFormFieldValuesEditedListener(listener);
- }
- }
-
- public void setReadOnly(boolean b) {
- for(FormFieldWrapper fieldWrapper : fieldWrappers) {
- fieldWrapper.setReadOnly(b);
- }
- }
-
- public boolean edited() {
- boolean edited = false;
- for(FormFieldWrapper fieldWrapper : fieldWrappers) {
- edited |= fieldWrapper.edited();
- }
- return edited;
- }
-
- public static FormWrapper createInLayout(Context context, LinearLayout layout, Data form) {
- return new FormWrapper(context, layout, form);
- }
-}
diff --git a/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java b/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java
index 8475688a6..90fc5d082 100644
--- a/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java
+++ b/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java
@@ -22,11 +22,6 @@ import android.widget.TextView;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
-import java.lang.ref.WeakReference;
-import java.util.Locale;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Message;
@@ -36,7 +31,17 @@ import eu.siacs.conversations.ui.adapter.MessageAdapter;
import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.utils.WeakReferenceSet;
-public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompletionListener, SeekBar.OnSeekBarChangeListener, Runnable, SensorEventListener {
+import java.lang.ref.WeakReference;
+import java.util.Locale;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+public class AudioPlayer
+ implements View.OnClickListener,
+ MediaPlayer.OnCompletionListener,
+ SeekBar.OnSeekBarChangeListener,
+ Runnable,
+ SensorEventListener {
private static final int REFRESH_INTERVAL = 250;
private static final Object LOCK = new Object();
@@ -57,33 +62,43 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
final Context context = adapter.getContext();
this.messageAdapter = adapter;
this.sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
- this.proximitySensor = this.sensorManager == null ? null : this.sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
+ this.proximitySensor =
+ this.sensorManager == null
+ ? null
+ : this.sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
initializeProximityWakeLock(context);
synchronized (AudioPlayer.LOCK) {
if (AudioPlayer.player != null) {
AudioPlayer.player.setOnCompletionListener(this);
if (AudioPlayer.player.isPlaying() && sensorManager != null) {
- sensorManager.registerListener(this, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL);
+ sensorManager.registerListener(
+ this, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL);
}
}
}
}
private static String formatTime(int ms) {
- return String.format(Locale.ENGLISH, "%d:%02d", ms / 60000, Math.min(Math.round((ms % 60000) / 1000f), 59));
+ return String.format(
+ Locale.ENGLISH,
+ "%d:%02d",
+ ms / 60000,
+ Math.min(Math.round((ms % 60000) / 1000f), 59));
}
private void initializeProximityWakeLock(Context context) {
- if (Build.VERSION.SDK_INT >= 21) {
- synchronized (AudioPlayer.LOCK) {
- if (AudioPlayer.wakeLock == null) {
- final PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
- AudioPlayer.wakeLock = powerManager == null ? null : powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, AudioPlayer.class.getSimpleName());
- AudioPlayer.wakeLock.setReferenceCounted(false);
- }
+ synchronized (AudioPlayer.LOCK) {
+ if (AudioPlayer.wakeLock == null) {
+ final PowerManager powerManager =
+ (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ AudioPlayer.wakeLock =
+ powerManager == null
+ ? null
+ : powerManager.newWakeLock(
+ PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK,
+ AudioPlayer.class.getSimpleName());
+ AudioPlayer.wakeLock.setReferenceCounted(false);
}
- } else {
- AudioPlayer.wakeLock = null;
}
}
@@ -92,41 +107,39 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
audioPlayer.setTag(message);
if (init(ViewHolder.get(audioPlayer), message)) {
this.audioPlayerLayouts.addWeakReferenceTo(audioPlayer);
- executor.execute(()-> this.stopRefresher(true));
+ executor.execute(() -> this.stopRefresher(true));
} else {
this.audioPlayerLayouts.removeWeakReferenceTo(audioPlayer);
}
}
}
- private boolean init(ViewHolder viewHolder, Message message) {
- if (viewHolder.darkBackground) {
- viewHolder.runtime.setTextAppearance(this.messageAdapter.getContext(), R.style.TextAppearance_Conversations_Caption_OnDark);
- } else {
- viewHolder.runtime.setTextAppearance(this.messageAdapter.getContext(), R.style.TextAppearance_Conversations_Caption);
- }
+ private boolean init(final ViewHolder viewHolder, final Message message) {
+ MessageAdapter.setTextColor(viewHolder.runtime, viewHolder.bubbleColor);
viewHolder.progress.setOnSeekBarChangeListener(this);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- ColorStateList color = ContextCompat.getColorStateList(messageAdapter.getContext(), viewHolder.darkBackground ? R.color.white70 : R.color.green700_desaturated);
- viewHolder.progress.setThumbTintList(color);
- viewHolder.progress.setProgressTintList(color);
- }
- viewHolder.playPause.setAlpha(viewHolder.darkBackground ? 0.7f : 0.57f);
+ final ColorStateList color =
+ MessageAdapter.bubbleToOnSurfaceColorStateList(
+ viewHolder.progress, viewHolder.bubbleColor);
+ viewHolder.progress.setThumbTintList(color);
+ viewHolder.progress.setProgressTintList(color);
viewHolder.playPause.setOnClickListener(this);
final Context context = viewHolder.playPause.getContext();
if (message == currentlyPlayingMessage) {
if (AudioPlayer.player != null && AudioPlayer.player.isPlaying()) {
- viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_pause_white_36dp : R.drawable.ic_pause_black_36dp);
+ viewHolder.playPause.setImageResource(R.drawable.ic_pause_24dp);
+ MessageAdapter.setImageTint(viewHolder.playPause, viewHolder.bubbleColor);
viewHolder.playPause.setContentDescription(context.getString(R.string.pause_audio));
viewHolder.progress.setEnabled(true);
} else {
viewHolder.playPause.setContentDescription(context.getString(R.string.play_audio));
- viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_play_arrow_white_36dp : R.drawable.ic_play_arrow_black_36dp);
+ viewHolder.playPause.setImageResource(R.drawable.ic_play_arrow_24dp);
+ MessageAdapter.setImageTint(viewHolder.playPause, viewHolder.bubbleColor);
viewHolder.progress.setEnabled(false);
}
return true;
} else {
- viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_play_arrow_white_36dp : R.drawable.ic_play_arrow_black_36dp);
+ viewHolder.playPause.setImageResource(R.drawable.ic_play_arrow_24dp);
+ MessageAdapter.setImageTint(viewHolder.playPause, viewHolder.bubbleColor);
viewHolder.playPause.setContentDescription(context.getString(R.string.play_audio));
viewHolder.runtime.setText(formatTime(message.getFileParams().runtime));
viewHolder.progress.setProgress(0);
@@ -145,9 +158,16 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
}
private void startStop(ImageButton playPause) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU && ContextCompat.checkSelfPermission(messageAdapter.getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU
+ && ContextCompat.checkSelfPermission(
+ messageAdapter.getActivity(),
+ Manifest.permission.WRITE_EXTERNAL_STORAGE)
+ != PackageManager.PERMISSION_GRANTED) {
pendingOnClickView.push(new WeakReference<>(playPause));
- ActivityCompat.requestPermissions(messageAdapter.getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, ConversationsActivity.REQUEST_PLAY_PAUSE);
+ ActivityCompat.requestPermissions(
+ messageAdapter.getActivity(),
+ new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE},
+ ConversationsActivity.REQUEST_PLAY_PAUSE);
return;
}
initializeProximityWakeLock(playPause.getContext());
@@ -163,13 +183,13 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
private boolean playPauseCurrent(final ViewHolder viewHolder) {
final Context context = viewHolder.playPause.getContext();
- viewHolder.playPause.setAlpha(viewHolder.darkBackground ? 0.7f : 0.57f);
if (player.isPlaying()) {
viewHolder.progress.setEnabled(false);
player.pause();
messageAdapter.flagScreenOff();
releaseProximityWakeLock();
- viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_play_arrow_white_36dp : R.drawable.ic_play_arrow_black_36dp);
+ viewHolder.playPause.setImageResource(R.drawable.ic_play_arrow_24dp);
+ MessageAdapter.setImageTint(viewHolder.playPause,viewHolder.bubbleColor);
viewHolder.playPause.setContentDescription(context.getString(R.string.play_audio));
} else {
viewHolder.progress.setEnabled(true);
@@ -177,7 +197,8 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
messageAdapter.flagScreenOn();
acquireProximityWakeLock();
this.stopRefresher(true);
- viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_pause_white_36dp : R.drawable.ic_pause_black_36dp);
+ viewHolder.playPause.setImageResource(R.drawable.ic_pause_24dp);
+ MessageAdapter.setImageTint(viewHolder.playPause,viewHolder.bubbleColor);
viewHolder.playPause.setContentDescription(context.getString(R.string.pause_audio));
}
return false;
@@ -193,19 +214,24 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
AudioPlayer.player = new MediaPlayer();
try {
AudioPlayer.currentlyPlayingMessage = message;
- AudioPlayer.player.setAudioStreamType(earpiece ? AudioManager.STREAM_VOICE_CALL : AudioManager.STREAM_MUSIC);
- AudioPlayer.player.setDataSource(messageAdapter.getFileBackend().getFile(message).getAbsolutePath());
+ AudioPlayer.player.setAudioStreamType(
+ earpiece ? AudioManager.STREAM_VOICE_CALL : AudioManager.STREAM_MUSIC);
+ AudioPlayer.player.setDataSource(
+ messageAdapter.getFileBackend().getFile(message).getAbsolutePath());
AudioPlayer.player.setOnCompletionListener(this);
AudioPlayer.player.prepare();
AudioPlayer.player.start();
messageAdapter.flagScreenOn();
acquireProximityWakeLock();
viewHolder.progress.setEnabled(true);
- viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_pause_white_36dp : R.drawable.ic_pause_black_36dp);
- viewHolder.playPause.setContentDescription(viewHolder.playPause.getContext().getString(R.string.pause_audio));
- sensorManager.registerListener(this, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL);
+ viewHolder.playPause.setImageResource(R.drawable.ic_pause_24dp);
+ MessageAdapter.setImageTint(viewHolder.playPause,viewHolder.bubbleColor);
+ viewHolder.playPause.setContentDescription(
+ viewHolder.playPause.getContext().getString(R.string.pause_audio));
+ sensorManager.registerListener(
+ this, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL);
return true;
- } catch (Exception e) {
+ } catch (final Exception e) {
messageAdapter.flagScreenOff();
releaseProximityWakeLock();
AudioPlayer.currentlyPlayingMessage = null;
@@ -251,14 +277,16 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
}
}
- private void resetPlayerUi(RelativeLayout audioPlayer) {
+ private void resetPlayerUi(final RelativeLayout audioPlayer) {
if (audioPlayer == null) {
return;
}
final ViewHolder viewHolder = ViewHolder.get(audioPlayer);
final Message message = (Message) audioPlayer.getTag();
- viewHolder.playPause.setContentDescription(viewHolder.playPause.getContext().getString(R.string.play_audio));
- viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_play_arrow_white_36dp : R.drawable.ic_play_arrow_black_36dp);
+ viewHolder.playPause.setContentDescription(
+ viewHolder.playPause.getContext().getString(R.string.play_audio));
+ viewHolder.playPause.setImageResource(R.drawable.ic_play_arrow_24dp);
+ MessageAdapter.setImageTint(viewHolder.playPause,viewHolder.bubbleColor);
if (message != null) {
viewHolder.runtime.setText(formatTime(message.getFileParams().runtime));
}
@@ -297,14 +325,10 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
}
@Override
- public void onStartTrackingTouch(SeekBar seekBar) {
-
- }
+ public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
- public void onStopTrackingTouch(SeekBar seekBar) {
-
- }
+ public void onStopTrackingTouch(SeekBar seekBar) {}
public void stop() {
synchronized (AudioPlayer.LOCK) {
@@ -361,7 +385,8 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
} else {
viewHolder.progress.setProgress(current * 100 / duration);
}
- viewHolder.runtime.setText(String.format("%s / %s", formatTime(current), formatTime(duration)));
+ viewHolder.runtime.setText(
+ String.format("%s / %s", formatTime(current), formatTime(duration)));
return true;
}
@@ -391,7 +416,11 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
try {
ViewHolder currentViewHolder = getCurrentViewHolder();
if (currentViewHolder != null) {
- play(currentViewHolder, currentlyPlayingMessage, streamType == AudioManager.STREAM_VOICE_CALL, progress);
+ play(
+ currentViewHolder,
+ currentlyPlayingMessage,
+ streamType == AudioManager.STREAM_VOICE_CALL,
+ progress);
}
} catch (Exception e) {
Log.w(Config.LOGTAG, e);
@@ -401,8 +430,7 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
}
@Override
- public void onAccuracyChanged(Sensor sensor, int i) {
- }
+ public void onAccuracyChanged(Sensor sensor, int i) {}
private void acquireProximityWakeLock() {
synchronized (AudioPlayer.LOCK) {
@@ -435,22 +463,24 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
private TextView runtime;
private SeekBar progress;
private ImageButton playPause;
- private boolean darkBackground = false;
+ private MessageAdapter.BubbleColor bubbleColor = MessageAdapter.BubbleColor.SURFACE;
- public static ViewHolder get(RelativeLayout audioPlayer) {
- ViewHolder viewHolder = (ViewHolder) audioPlayer.getTag(R.id.TAG_AUDIO_PLAYER_VIEW_HOLDER);
- if (viewHolder == null) {
- viewHolder = new ViewHolder();
- viewHolder.runtime = audioPlayer.findViewById(R.id.runtime);
- viewHolder.progress = audioPlayer.findViewById(R.id.progress);
- viewHolder.playPause = audioPlayer.findViewById(R.id.play_pause);
- audioPlayer.setTag(R.id.TAG_AUDIO_PLAYER_VIEW_HOLDER, viewHolder);
+ public static ViewHolder get(final RelativeLayout audioPlayer) {
+ final var existingViewHolder =
+ (ViewHolder) audioPlayer.getTag(R.id.TAG_AUDIO_PLAYER_VIEW_HOLDER);
+ if (existingViewHolder != null) {
+ return existingViewHolder;
}
+ final ViewHolder viewHolder = new ViewHolder();
+ viewHolder.runtime = audioPlayer.findViewById(R.id.runtime);
+ viewHolder.progress = audioPlayer.findViewById(R.id.progress);
+ viewHolder.playPause = audioPlayer.findViewById(R.id.play_pause);
+ audioPlayer.setTag(R.id.TAG_AUDIO_PLAYER_VIEW_HOLDER, viewHolder);
return viewHolder;
}
- public void setDarkBackground(boolean darkBackground) {
- this.darkBackground = darkBackground;
+ public void setBubbleColor(final MessageAdapter.BubbleColor bubbleColor) {
+ this.bubbleColor = bubbleColor;
}
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/util/ActionBarUtil.java b/src/main/java/eu/siacs/conversations/ui/util/ActionBarUtil.java
deleted file mode 100644
index 80f0ae93e..000000000
--- a/src/main/java/eu/siacs/conversations/ui/util/ActionBarUtil.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package eu.siacs.conversations.ui.util;
-
-import android.content.Context;
-import android.view.View;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-import java.lang.reflect.Field;
-
-public class ActionBarUtil {
-
- public static void resetActionBarOnClickListeners(@NonNull View view) {
- final View title = findActionBarTitle(view);
- final View subtitle = findActionBarSubTitle(view);
- if (title != null) {
- title.setOnClickListener(null);
- }
- if (subtitle != null) {
- subtitle.setOnClickListener(null);
- }
- }
-
- public static void setActionBarOnClickListener(@NonNull View view,
- @NonNull final View.OnClickListener onClickListener) {
- final View title = findActionBarTitle(view);
- final View subtitle = findActionBarSubTitle(view);
- if (title != null) {
- title.setOnClickListener(onClickListener);
- }
- if (subtitle != null) {
- subtitle.setOnClickListener(onClickListener);
- }
- }
-
- private static @Nullable View findActionBarTitle(@NonNull View root) {
- return findActionBarItem(root, "action_bar_title", "mTitleTextView");
- }
-
- private static @Nullable
- View findActionBarSubTitle(@NonNull View root) {
- return findActionBarItem(root, "action_bar_subtitle", "mSubtitleTextView");
- }
-
- private static @Nullable View findActionBarItem(@NonNull View root,
- @NonNull String resourceName,
- @NonNull String toolbarFieldName) {
- View result = findViewSupportOrAndroid(root, resourceName);
-
- if (result == null) {
- View actionBar = findViewSupportOrAndroid(root, "action_bar");
- if (actionBar != null) {
- result = reflectiveRead(actionBar, toolbarFieldName);
- }
- }
- if (result == null && root.getClass().getName().endsWith("widget.Toolbar")) {
- result = reflectiveRead(root, toolbarFieldName);
- }
- return result;
- }
-
- @SuppressWarnings("ConstantConditions")
- private static @Nullable View findViewSupportOrAndroid(@NonNull View root,
- @NonNull String resourceName) {
- Context context = root.getContext();
- View result = null;
- if (result == null) {
- int supportID = context.getResources().getIdentifier(resourceName, "id", context.getPackageName());
- result = root.findViewById(supportID);
- }
- if (result == null) {
- int androidID = context.getResources().getIdentifier(resourceName, "id", "android");
- result = root.findViewById(androidID);
- }
- return result;
- }
-
- @SuppressWarnings("unchecked")
- private static T reflectiveRead(@NonNull Object object, @NonNull String fieldName) {
- try {
- Field field = object.getClass().getDeclaredField(fieldName);
- field.setAccessible(true);
- return (T) field.get(object);
- } catch (final Exception ex) {
- return null;
- }
- }
-}
diff --git a/src/main/java/eu/siacs/conversations/ui/util/Attachment.java b/src/main/java/eu/siacs/conversations/ui/util/Attachment.java
index e68bcc534..b341ba39b 100644
--- a/src/main/java/eu/siacs/conversations/ui/util/Attachment.java
+++ b/src/main/java/eu/siacs/conversations/ui/util/Attachment.java
@@ -38,6 +38,9 @@ import android.os.Parcelable;
import com.google.common.base.MoreObjects;
+import eu.siacs.conversations.entities.Message;
+import eu.siacs.conversations.utils.MimeUtils;
+
import org.jetbrains.annotations.NotNull;
import java.io.File;
@@ -46,9 +49,6 @@ import java.util.Collections;
import java.util.List;
import java.util.UUID;
-import eu.siacs.conversations.utils.Compatibility;
-import eu.siacs.conversations.utils.MimeUtils;
-
public class Attachment implements Parcelable {
Attachment(Parcel in) {
@@ -71,17 +71,18 @@ public class Attachment implements Parcelable {
return 0;
}
- public static final Creator CREATOR = new Creator() {
- @Override
- public Attachment createFromParcel(Parcel in) {
- return new Attachment(in);
- }
+ public static final Creator CREATOR =
+ new Creator() {
+ @Override
+ public Attachment createFromParcel(Parcel in) {
+ return new Attachment(in);
+ }
- @Override
- public Attachment[] newArray(int size) {
- return new Attachment[size];
- }
- };
+ @Override
+ public Attachment[] newArray(int size) {
+ return new Attachment[size];
+ }
+ };
public String getMime() {
return mime;
@@ -103,7 +104,10 @@ public class Attachment implements Parcelable {
}
public enum Type {
- FILE, IMAGE, LOCATION, RECORDING
+ FILE,
+ IMAGE,
+ LOCATION,
+ RECORDING
}
private final Uri uri;
@@ -125,8 +129,8 @@ public class Attachment implements Parcelable {
this.uuid = UUID.randomUUID();
}
- public static boolean canBeSendInband(final List attachments) {
- for (Attachment attachment : attachments) {
+ public static boolean canBeSendInBand(final List attachments) {
+ for (final Attachment attachment : attachments) {
if (attachment.type != Type.LOCATION) {
return false;
}
@@ -135,10 +139,30 @@ public class Attachment implements Parcelable {
}
public static List of(final Context context, Uri uri, Type type) {
- final String mime = type == Type.LOCATION ? null : MimeUtils.guessMimeTypeFromUri(context, uri);
+ final String mime =
+ type == Type.LOCATION ? null : MimeUtils.guessMimeTypeFromUri(context, uri);
return Collections.singletonList(new Attachment(uri, type, mime));
}
+ public static Attachment of(final Message message) {
+ final UUID uuid = UUID.fromString(message.getUuid());
+ if (message.isGeoUri()) {
+ return new Attachment(uuid, Uri.EMPTY, Type.LOCATION, null);
+ }
+ final String mime = message.getMimeType();
+ if (MimeUtils.AMBIGUOUS_CONTAINER_FORMATS.contains(mime)) {
+ final Message.FileParams fileParams = message.getFileParams();
+ if (fileParams.width > 0 && fileParams.height > 0) {
+ return new Attachment(uuid, Uri.EMPTY, Type.FILE, "video/*");
+ } else if (fileParams.runtime > 0) {
+ return new Attachment(uuid, Uri.EMPTY, Type.FILE, "audio/*");
+ } else {
+ return new Attachment(uuid, Uri.EMPTY, Type.FILE, "application/octet-stream");
+ }
+ }
+ return new Attachment(uuid, Uri.EMPTY, Type.FILE, mime);
+ }
+
public static List of(final Context context, List uris, final String type) {
final List attachments = new ArrayList<>();
for (final Uri uri : uris) {
@@ -146,16 +170,25 @@ public class Attachment implements Parcelable {
continue;
}
final String mime = MimeUtils.guessMimeTypeFromUriAndMime(context, uri, type);
- attachments.add(new Attachment(uri, mime != null && isImage(mime) ? Type.IMAGE : Type.FILE, mime));
+ attachments.add(
+ new Attachment(
+ uri, mime != null && isImage(mime) ? Type.IMAGE : Type.FILE, mime));
}
return attachments;
}
public static Attachment of(UUID uuid, final File file, String mime) {
- return new Attachment(uuid, Uri.fromFile(file), mime != null && (isImage(mime) || mime.startsWith("video/")) ? Type.IMAGE : Type.FILE, mime);
+ return new Attachment(
+ uuid,
+ Uri.fromFile(file),
+ mime != null && (isImage(mime) || mime.startsWith("video/"))
+ ? Type.IMAGE
+ : Type.FILE,
+ mime);
}
- public static List extractAttachments(final Context context, final Intent intent, Type type) {
+ public static List extractAttachments(
+ final Context context, final Intent intent, Type type) {
List uris = new ArrayList<>();
if (intent == null) {
return uris;
@@ -167,7 +200,8 @@ public class Attachment implements Parcelable {
if (clipData != null) {
for (int i = 0; i < clipData.getItemCount(); ++i) {
final Uri uri = clipData.getItemAt(i).getUri();
- final String mime = MimeUtils.guessMimeTypeFromUriAndMime(context, uri, contentType);
+ final String mime =
+ MimeUtils.guessMimeTypeFromUriAndMime(context, uri, contentType);
uris.add(new Attachment(uri, type, mime));
}
}
@@ -179,13 +213,12 @@ public class Attachment implements Parcelable {
}
public boolean renderThumbnail() {
- return type == Type.IMAGE || (type == Type.FILE && mime != null && renderFileThumbnail(mime));
+ return type == Type.IMAGE
+ || (type == Type.FILE && mime != null && renderFileThumbnail(mime));
}
private static boolean renderFileThumbnail(final String mime) {
- return mime.startsWith("video/")
- || isImage(mime)
- || "application/pdf".equals(mime);
+ return mime.startsWith("video/") || isImage(mime) || "application/pdf".equals(mime);
}
public Uri getUri() {
diff --git a/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java b/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java
index 900246591..83bc80e7b 100644
--- a/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java
+++ b/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java
@@ -102,14 +102,16 @@ public class ConversationMenuConfigurator {
return;
}
- if (conversation.getNextEncryption() != Message.ENCRYPTION_NONE) {
- menuSecure.setIcon(R.drawable.ic_lock_white_24dp);
+ if (next == Message.ENCRYPTION_NONE) {
+ menuSecure.setIcon(R.drawable.ic_lock_open_outline_24dp);
+ } else {
+ menuSecure.setIcon(R.drawable.ic_lock_24dp);
}
pgp.setVisible(Config.supportOpenPgp());
none.setVisible(Config.supportUnencrypted() || conversation.getMode() == Conversation.MODE_MULTI);
axolotl.setVisible(Config.supportOmemo());
- switch (conversation.getNextEncryption()) {
+ switch (next) {
case Message.ENCRYPTION_PGP:
menuSecure.setTitle(R.string.encrypted_with_openpgp);
pgp.setChecked(true);
diff --git a/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java b/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java
index da1ac7a44..6b5ea13c8 100644
--- a/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java
+++ b/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java
@@ -12,6 +12,8 @@ import android.view.View;
import androidx.appcompat.app.AlertDialog;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
@@ -200,7 +202,7 @@ public final class MucDetailsContextMenuHelper {
activity.xmppConnectionService.changeRoleInConference(conversation, user.getName(), MucOptions.Role.NONE);
}
} else {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
builder.setTitle(R.string.ban_from_conference);
String jid = user.getRealJid().asBareJid().toString();
SpannableString message = new SpannableString(activity.getString(R.string.removing_from_public_conference, jid));
diff --git a/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java b/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java
index d9cda665a..a26d02810 100644
--- a/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java
+++ b/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java
@@ -36,6 +36,8 @@ import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -72,7 +74,7 @@ public class PresenceSelector {
private static void showPresenceSelectionDialog(final Activity activity, final Contact contact, final String[] resourceArray, final OnFullJidSelected onFullJidSelected) {
final Presences presences = contact.getPresences();
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
builder.setTitle(activity.getString(R.string.choose_presence));
Pair
diff --git a/src/main/res/layout/actionview_search.xml b/src/main/res/layout/actionview_search.xml
index 90783b776..c02d4b7cb 100644
--- a/src/main/res/layout/actionview_search.xml
+++ b/src/main/res/layout/actionview_search.xml
@@ -8,10 +8,10 @@
diff --git a/src/main/res/layout/activity_about.xml b/src/main/res/layout/activity_about.xml
index 159472af1..81960647f 100644
--- a/src/main/res/layout/activity_about.xml
+++ b/src/main/res/layout/activity_about.xml
@@ -1,40 +1,40 @@
-
+
-
-
-
+ android:layout_height="match_parent"
+ android:orientation="vertical">
-
-
+ android:minHeight="?attr/actionBarSize" />
+
+
+
+
+
-
-
-
-
\ No newline at end of file
+ android:textAppearance="?textAppearanceBodyMedium"
+ android:typeface="monospace" />
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_change_password.xml b/src/main/res/layout/activity_change_password.xml
index 51f26920a..b5c9b2162 100644
--- a/src/main/res/layout/activity_change_password.xml
+++ b/src/main/res/layout/activity_change_password.xml
@@ -1,106 +1,106 @@
-
+
-
+
-
-
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+ android:layout_marginLeft="@dimen/activity_horizontal_margin"
+ android:layout_marginTop="@dimen/activity_vertical_margin"
+ android:layout_marginRight="@dimen/activity_horizontal_margin"
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
-
-
+ android:orientation="vertical"
+ android:padding="@dimen/card_padding_regular">
-
-
+ app:endIconMode="password_toggle">
-
+
+
-
-
+ app:endIconMode="password_toggle">
+
+
+
+
-
-
+
-
-
-
+ android:layout_alignParentStart="true"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentBottom="true"
+ android:paddingHorizontal="16dp"
+ android:paddingVertical="8dp">
-
+
-
-
-
\ No newline at end of file
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_channel_discovery.xml b/src/main/res/layout/activity_channel_discovery.xml
index 42761cdeb..a41888cdc 100644
--- a/src/main/res/layout/activity_channel_discovery.xml
+++ b/src/main/res/layout/activity_channel_discovery.xml
@@ -6,12 +6,19 @@
-
+
+
+
+
+
+ android:layout_height="match_parent">
diff --git a/src/main/res/layout/activity_choose_contact.xml b/src/main/res/layout/activity_choose_contact.xml
index b937f6d19..fd3a891df 100644
--- a/src/main/res/layout/activity_choose_contact.xml
+++ b/src/main/res/layout/activity_choose_contact.xml
@@ -1,36 +1,42 @@
-
+
-
+
+
+
+
+
+ android:layout_height="match_parent">
+ android:dividerHeight="0dp" />
+ android:src="@drawable/ic_person_add_24dp"
+ android:visibility="gone" />
\ No newline at end of file
diff --git a/src/main/res/layout/activity_contact_details.xml b/src/main/res/layout/activity_contact_details.xml
index fc7219ee1..8a3c62412 100644
--- a/src/main/res/layout/activity_contact_details.xml
+++ b/src/main/res/layout/activity_contact_details.xml
@@ -6,12 +6,19 @@
-
+
+
+
+
+
-
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
+ android:scaleType="centerCrop"
+ app:riv_corner_radius="8dp" />
+ android:textAppearance="?textAppearanceTitleMedium" />
+ android:layout_marginBottom="4dp"
+ android:orientation="horizontal" />
+ android:textAppearance="?textAppearanceTitleSmall"
+ tools:text="@string/just_now" />
+ android:textAppearance="?textAppearanceBodyMedium"
+ tools:text="Hey there! I’m using Conversations" />
+ android:text="@string/send_presence_updates" />
+ android:text="@string/receive_presence_updates" />
+ android:textAppearance="?textAppearanceLabelMedium" />
-
+
-
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
+ android:paddingEnd="@dimen/card_padding_regular"
+ android:paddingBottom="@dimen/card_padding_list" />
+ android:layout_margin="16dp">
+ android:text="@string/view_media" />
-
+
-
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
+ android:padding="@dimen/card_padding_list" />
+
+ android:layout_marginHorizontal="@dimen/list_padding"
+ android:text="@string/contact_uses_unverified_keys"
+ android:textAppearance="?textAppearanceBodyMedium"
+ android:textColor="?colorOnSurfaceVariant" />
+ android:text="@string/scan_qr_code" />
+ android:text="@string/show_inactive_devices" />
-
+
diff --git a/src/main/res/layout/activity_conversations.xml b/src/main/res/layout/activity_conversations.xml
index 1c56e05ec..e05d29ca1 100644
--- a/src/main/res/layout/activity_conversations.xml
+++ b/src/main/res/layout/activity_conversations.xml
@@ -1,32 +1,4 @@
-
-
+
+
+
+
+
+ android:layout_height="match_parent" />
diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml
index 7e5a92969..99cd61e96 100644
--- a/src/main/res/layout/activity_edit_account.xml
+++ b/src/main/res/layout/activity_edit_account.xml
@@ -5,18 +5,26 @@
+ android:layout_height="match_parent">
-
+
+
+
+
+
+ android:layout_below="@id/app_bar_layout">
-
+ android:hint="@string/account_settings_jabber_id">
-
+ android:padding="16dp" />
@@ -77,21 +83,14 @@
android:id="@+id/account_password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error"
- app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint"
- app:passwordToggleDrawable="@drawable/visibility_toggle_drawable"
- app:passwordToggleEnabled="true"
- app:passwordToggleTint="?android:textColorSecondary">
+ android:hint="@string/password"
+ app:endIconMode="password_toggle">
+ android:inputType="textPassword" />
+ android:hint="@string/account_settings_hostname">
@@ -135,13 +131,10 @@
android:id="@+id/port_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:hint="@string/account_settings_port"
- app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error"
- app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint">
+ android:hint="@string/account_settings_port">
-
+
-
+ android:textAppearance="?textAppearanceTitleLarge" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:layout_gravity="end"
+ android:gravity="end"
+ android:layout_marginHorizontal="16dp"
+ android:layout_marginBottom="16dp">
+ android:text="@string/disable" />
-
+
-
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -283,7 +273,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_pep"
- android:textAppearance="@style/TextAppearance.Conversations.Body1" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -305,7 +295,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_blocking"
- android:textAppearance="@style/TextAppearance.Conversations.Body1" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -327,7 +317,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_stream_management"
- android:textAppearance="@style/TextAppearance.Conversations.Body1" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -349,7 +339,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_external_service_discovery"
- android:textAppearance="@style/TextAppearance.Conversations.Body1" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -371,7 +361,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_roster_version"
- android:textAppearance="@style/TextAppearance.Conversations.Body1" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -393,7 +383,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_carbon_messages"
- android:textAppearance="@style/TextAppearance.Conversations.Body1" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -415,7 +405,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_mam"
- android:textAppearance="@style/TextAppearance.Conversations.Body1" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -437,7 +427,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_csi"
- android:textAppearance="@style/TextAppearance.Conversations.Body1" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -460,7 +450,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_push"
- android:textAppearance="@style/TextAppearance.Conversations.Body1" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -503,9 +493,9 @@
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceLabelMedium" />
@@ -545,35 +534,35 @@
+ android:fontFamily="monospace"
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceLabelMedium" />
@@ -586,29 +575,30 @@
+ android:fontFamily="monospace"
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceLabelMedium" />
@@ -616,30 +606,28 @@
android:id="@+id/show_qr_code_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:alpha="?attr/icon_alpha"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/copy_omemo_clipboard_description"
android:padding="@dimen/image_button_padding"
- android:src="?attr/icon_qr_code"
+ android:src="@drawable/ic_qr_code_24dp"
android:visibility="visible" />
-
+
-
+ android:textAppearance="?textAppearanceTitleLarge" />
+
+ android:textAppearance="?textAppearanceBodyMedium"
+ android:textColor="?colorOnSurfaceVariant" />
+ android:text="@string/scan_qr_code" />
+ android:text="@string/clear_other_devices" />
-
+
-
+ android:layout_alignParentBottom="true"
+ android:paddingHorizontal="16dp"
+ android:paddingVertical="8dp">
-
-
+
diff --git a/src/main/res/layout/activity_manage_accounts.xml b/src/main/res/layout/activity_manage_accounts.xml
index 8ea0bc31e..15e5d35d9 100644
--- a/src/main/res/layout/activity_manage_accounts.xml
+++ b/src/main/res/layout/activity_manage_accounts.xml
@@ -1,18 +1,29 @@
-
+
-
-
-
-
+ android:layout_height="fill_parent"
+ android:orientation="vertical">
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_media_browser.xml b/src/main/res/layout/activity_media_browser.xml
index 57e12be9b..8975af5c0 100644
--- a/src/main/res/layout/activity_media_browser.xml
+++ b/src/main/res/layout/activity_media_browser.xml
@@ -4,21 +4,29 @@
-
+
+
+
+
+
+
+ android:scrollbars="vertical" />
\ No newline at end of file
diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml
index eb3898319..d08320659 100644
--- a/src/main/res/layout/activity_muc_details.xml
+++ b/src/main/res/layout/activity_muc_details.xml
@@ -6,12 +6,19 @@
-
+
+
+
+
+
-
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
+ app:riv_corner_radius="8dp" />
+ android:orientation="vertical">
+ android:orientation="vertical">
+ android:textAppearance="?textAppearanceTitleLarge" />
+ android:textAppearance="?textAppearanceTitleMedium" />
@@ -96,36 +98,28 @@
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/edit_muc_name_button"
android:orientation="vertical"
- android:visibility="gone"
- android:layout_alignParentLeft="true"
- android:layout_toLeftOf="@+id/edit_muc_name_button">
+ android:visibility="gone">
+ android:layout_height="wrap_content">
+ android:hint="@string/group_chat_name" />
+ android:layout_height="wrap_content">
+ android:hint="@string/topic" />
@@ -134,13 +128,11 @@
android:id="@+id/edit_muc_name_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
- android:alpha="?attr/icon_alpha"
+ android:layout_alignParentEnd="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/image_button_padding"
- android:src="?attr/icon_edit_body"
- android:layout_alignParentRight="true" />
+ android:src="@drawable/ic_edit_24dp" />
@@ -157,9 +149,7 @@
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/change_conference_button"
- android:textAppearance="@style/TextAppearance.Conversations.Body1"
- android:layout_alignParentLeft="true"
- android:layout_toLeftOf="@+id/change_conference_button" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:src="@drawable/ic_settings_24dp" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:paddingLeft="4dp"
+ android:textAppearance="?textAppearanceBodyMedium" />
@@ -214,18 +202,19 @@
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="32dp"
- android:textAppearance="@style/TextAppearance.Conversations.Caption"/>
+ android:textAppearance="?textAppearanceLabelMedium"
+ tools:text="foo@bar.tld" />
-
+
-
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
+ android:textAppearance="?textAppearanceBodyMedium"
+ android:textColor="?colorOnSurfaceVariant" />
+ android:paddingEnd="@dimen/card_padding_regular"
+ android:paddingBottom="@dimen/card_padding_list" />
+ android:layout_gravity="end"
+ android:orientation="horizontal">
+ android:text="@string/invite" />
+ tools:text="View n Participants" />
-
+
-
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:src="@drawable/ic_edit_24dp" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:src="@drawable/ic_notifications_24dp" />
+ android:textAppearance="?textAppearanceLabelMedium" />
-
-
+
+
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
+ android:paddingEnd="@dimen/card_padding_regular"
+ android:paddingBottom="@dimen/card_padding_list" />
+ android:layout_gravity="end"
+ android:layout_margin="16dp"
+ android:orientation="horizontal">
+ android:text="@string/view_media" />
-
+
diff --git a/src/main/res/layout/activity_muc_users.xml b/src/main/res/layout/activity_muc_users.xml
index 3fc73d02c..f581a1c1a 100644
--- a/src/main/res/layout/activity_muc_users.xml
+++ b/src/main/res/layout/activity_muc_users.xml
@@ -2,29 +2,32 @@
-
-
+
+
+
+
+ android:layout_height="match_parent">
diff --git a/src/main/res/layout/activity_publish_profile_picture.xml b/src/main/res/layout/activity_publish_profile_picture.xml
index aa9e9dc8f..a6c7c1fc0 100644
--- a/src/main/res/layout/activity_publish_profile_picture.xml
+++ b/src/main/res/layout/activity_publish_profile_picture.xml
@@ -3,19 +3,30 @@
+ android:layout_height="match_parent">
-
+
-
+
+
+
+
+
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
+ android:layout_marginBottom="8dp"
+ android:background="@drawable/background_account_profile_picture">
+ android:layout_height="@dimen/publish_avatar_size" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:layout_marginBottom="8dp"
+ android:textAppearance="?textAppearanceBodyMedium"
+ android:textColor="?colorError" />
-
+
-
+ android:paddingHorizontal="16dp"
+ android:paddingVertical="8dp">
-
-
+ android:layout_alignParentStart="true"
+ android:layout_centerInParent="true"
+ android:text="@string/cancel" />
-
+ android:text="@string/publish" />
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_recording.xml b/src/main/res/layout/activity_recording.xml
index c30abd06c..81e63812f 100644
--- a/src/main/res/layout/activity_recording.xml
+++ b/src/main/res/layout/activity_recording.xml
@@ -3,38 +3,38 @@
+ android:layout_height="wrap_content">
-
+ android:layout_below="@+id/timer"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentEnd="true"
+ android:paddingHorizontal="16dp"
+ android:paddingVertical="8dp">
+ android:layout_alignParentStart="true"
+ android:layout_centerInParent="true"
+ android:text="@string/cancel" />
-
-
+ android:layout_alignParentEnd="true"
+ android:layout_centerInParent="true"
+ android:text="@string/attach" />
+
+
+ android:fontFamily="monospace"
+ android:textAppearance="?textAppearanceDisplayLarge" />
\ No newline at end of file
diff --git a/src/main/res/layout/activity_rtp_session.xml b/src/main/res/layout/activity_rtp_session.xml
index 7c52cf8a2..7cb17111f 100644
--- a/src/main/res/layout/activity_rtp_session.xml
+++ b/src/main/res/layout/activity_rtp_session.xml
@@ -5,14 +5,13 @@
+ android:layout_height="match_parent">
@@ -23,15 +22,16 @@
android:layout_height="wrap_content"
android:indeterminate="true"
android:indeterminateOnly="true"
- android:indeterminateTint="@color/white"
+ android:indeterminateTint="@android:color/white"
android:visibility="gone" />
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:src="@drawable/ic_warning_24dp"
+ android:visibility="gone"
+ app:tint="@android:color/white" />
-
+ android:layout_height="?attr/actionBarSize" />
+
+ android:layout_height="32dp" />
@@ -89,7 +84,8 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/rtp_session_duration_top_margin"
- android:textAppearance="@style/TextAppearance.Conversations.Title.Monospace"
+ android:fontFamily="monospace"
+ android:textAppearance="?textAppearanceTitleLarge"
tools:text="01:23" />
@@ -132,14 +128,15 @@
+ android:src="@drawable/ic_verified_user_24dp"
+ app:tint="@color/light_green_600" />
+ app:tint="@android:color/white" />
+ android:visibility="gone" />
+ app:maxImageSize="36dp"
+ app:tint="?colorOnError" />
+ android:visibility="gone" />
+ android:visibility="gone" />
+ android:textAppearance="?textAppearanceLabelMedium" />
diff --git a/src/main/res/layout/activity_search.xml b/src/main/res/layout/activity_search.xml
index 150ab2d36..d2612d728 100644
--- a/src/main/res/layout/activity_search.xml
+++ b/src/main/res/layout/activity_search.xml
@@ -1,32 +1,4 @@
-
@@ -35,19 +7,26 @@
android:layout_height="match_parent"
android:orientation="vertical">
-
+
+
+
+
+ android:stackFromBottom="true" />
\ No newline at end of file
diff --git a/src/main/res/layout/activity_settings.xml b/src/main/res/layout/activity_settings.xml
index 9c0f95a0e..a5865f2fa 100644
--- a/src/main/res/layout/activity_settings.xml
+++ b/src/main/res/layout/activity_settings.xml
@@ -1,12 +1,26 @@
-
+
-
-
-
-
\ No newline at end of file
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_share_location.xml b/src/main/res/layout/activity_share_location.xml
index 754503f2a..7f925aa35 100644
--- a/src/main/res/layout/activity_share_location.xml
+++ b/src/main/res/layout/activity_share_location.xml
@@ -1,5 +1,4 @@
@@ -8,9 +7,18 @@
android:layout_height="match_parent"
tools:context=".ui.ShareLocationActivity">
-
+
+
+
+
+
+ android:layout_below="@id/app_bar_layout">
+ android:src="@drawable/ic_gps_fixed_24dp" />
-
-
+ android:paddingHorizontal="16dp"
+ android:paddingVertical="8dp">
-
-
-
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_share_with.xml b/src/main/res/layout/activity_share_with.xml
index 7f9460cdf..993b84ff5 100644
--- a/src/main/res/layout/activity_share_with.xml
+++ b/src/main/res/layout/activity_share_with.xml
@@ -1,19 +1,33 @@
-
+
-
-
-
+ android:orientation="vertical">
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_show_location.xml b/src/main/res/layout/activity_show_location.xml
index ab9bafa1a..84f72ab22 100644
--- a/src/main/res/layout/activity_show_location.xml
+++ b/src/main/res/layout/activity_show_location.xml
@@ -1,35 +1,38 @@
-
+
+ android:layout_height="match_parent">
-
+
+
+
+
+
+ android:layout_below="@id/app_bar_layout" />
+ android:src="@drawable/ic_directions_24dp" />
\ No newline at end of file
diff --git a/src/main/res/layout/activity_start_conversation.xml b/src/main/res/layout/activity_start_conversation.xml
index d4c2f5b57..7659c9018 100644
--- a/src/main/res/layout/activity_start_conversation.xml
+++ b/src/main/res/layout/activity_start_conversation.xml
@@ -6,30 +6,33 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
-
-
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
+
+ android:layout_below="@id/app_bar_layout">
@@ -38,8 +41,7 @@
android:id="@+id/overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_below="@id/tab_layout"
- android:background="?color_background_overlay" />
+ android:layout_below="@id/app_bar_layout" />
diff --git a/src/main/res/layout/activity_trust_keys.xml b/src/main/res/layout/activity_trust_keys.xml
index 03f002149..701ea5438 100644
--- a/src/main/res/layout/activity_trust_keys.xml
+++ b/src/main/res/layout/activity_trust_keys.xml
@@ -1,101 +1,112 @@
-
+
+ android:layout_height="match_parent">
-
+
+
+
+
+
+ android:layout_above="@+id/button_bar"
+ android:layout_below="@id/app_bar_layout">
-
-
-
+ android:orientation="vertical"
+ android:padding="@dimen/card_padding_regular">
-
-
-
-
-
+
-
+
+
+
+
+
+
+
-
+ android:layout_gravity="end"
+ android:gravity="end">
+
+
+
-
+
-
+ android:textAppearance="?textAppearanceTitleLarge" />
+ android:orientation="vertical" />
-
+
-
+ android:layout_alignParentBottom="true"
+ android:paddingHorizontal="16dp"
+ android:paddingVertical="8dp">
+ android:layout_alignParentStart="true"
+ android:layout_centerInParent="true"
+ android:text="@string/cancel" />
-
-
+ android:layout_alignParentEnd="true"
+ android:layout_centerInParent="true"
+ android:enabled="false"
+ android:text="@string/save" />
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_uri_handler.xml b/src/main/res/layout/activity_uri_handler.xml
index 9eda73c87..bc543076b 100644
--- a/src/main/res/layout/activity_uri_handler.xml
+++ b/src/main/res/layout/activity_uri_handler.xml
@@ -4,7 +4,7 @@
+ android:indeterminateTint="?colorOnPrimaryContainer" />
diff --git a/src/main/res/layout/captcha.xml b/src/main/res/layout/captcha.xml
index 019c952d8..591bc3f0c 100644
--- a/src/main/res/layout/captcha.xml
+++ b/src/main/res/layout/captcha.xml
@@ -3,21 +3,21 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:padding="16dp" >
+ android:padding="?dialogPreferredPadding">
+ android:layout_gravity="center_horizontal" />
+
+ android:inputType="textNoSuggestions">
diff --git a/src/main/res/layout/contact_key.xml b/src/main/res/layout/contact_key.xml
index ecf907a24..447396ab5 100644
--- a/src/main/res/layout/contact_key.xml
+++ b/src/main/res/layout/contact_key.xml
@@ -1,18 +1,19 @@
-
+
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:textAppearance="?textAppearanceLabelMedium" />
@@ -45,34 +47,33 @@
android:id="@+id/button_remove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:alpha="?attr/icon_alpha"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/image_button_padding"
- android:src="?attr/icon_remove"
- android:visibility="gone"/>
+ android:src="@drawable/ic_delete_24dp"
+ android:visibility="gone" />
+ android:src="@drawable/ic_new_releases_24dp"
+ android:visibility="gone" />
+ android:layout_width="40dp"
+ android:layout_height="40dp"
+ android:src="@drawable/ic_verified_user_24dp"
+ android:visibility="gone"
+ app:tint="@color/light_green_600" />
+ android:visibility="gone" />
diff --git a/src/main/res/layout/create_conference_dialog.xml b/src/main/res/layout/create_conference_dialog.xml
deleted file mode 100644
index 3883a0f5e..000000000
--- a/src/main/res/layout/create_conference_dialog.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/res/layout/dialog_block_contact.xml b/src/main/res/layout/dialog_block_contact.xml
index 9ba24b621..89e3d422a 100644
--- a/src/main/res/layout/dialog_block_contact.xml
+++ b/src/main/res/layout/dialog_block_contact.xml
@@ -5,24 +5,20 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:paddingBottom="?attr/dialog_vertical_padding"
- android:paddingLeft="?attr/dialog_horizontal_padding"
- android:paddingRight="?attr/dialog_horizontal_padding"
- android:paddingTop="?attr/dialog_vertical_padding">
+ android:padding="?dialogPreferredPadding">
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:text="@string/report_jid_as_spammer" />
\ No newline at end of file
diff --git a/src/main/res/layout/dialog_clear_history.xml b/src/main/res/layout/dialog_clear_history.xml
index e66429827..9dd4bd104 100644
--- a/src/main/res/layout/dialog_clear_history.xml
+++ b/src/main/res/layout/dialog_clear_history.xml
@@ -1,26 +1,22 @@
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="?dialogPreferredPadding">
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:text="@string/also_end_conversation" />
\ No newline at end of file
diff --git a/src/main/res/layout/dialog_create_conference.xml b/src/main/res/layout/dialog_create_conference.xml
new file mode 100644
index 000000000..91e2bd7f2
--- /dev/null
+++ b/src/main/res/layout/dialog_create_conference.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/res/layout/create_public_channel_dialog.xml b/src/main/res/layout/dialog_create_public_channel.xml
similarity index 60%
rename from src/main/res/layout/create_public_channel_dialog.xml
rename to src/main/res/layout/dialog_create_public_channel.xml
index 2dcd8f3d8..66d0ede61 100644
--- a/src/main/res/layout/create_public_channel_dialog.xml
+++ b/src/main/res/layout/dialog_create_public_channel.xml
@@ -1,6 +1,5 @@
-
+
-
+ android:hint="@string/your_account">
+
+
+
-
+ android:layout_marginTop="8dp">
+ android:imeOptions="actionNext|flagNoExtractUi" />
+
+ android:visibility="gone">
+ android:padding="16dp" />
diff --git a/src/main/res/layout/dialog_delete_account.xml b/src/main/res/layout/dialog_delete_account.xml
index e39054efe..10f651124 100644
--- a/src/main/res/layout/dialog_delete_account.xml
+++ b/src/main/res/layout/dialog_delete_account.xml
@@ -1,26 +1,22 @@
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="?dialogPreferredPadding">
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:text="@string/delete_from_server" />
\ No newline at end of file
diff --git a/src/main/res/layout/dialog_enter_jid.xml b/src/main/res/layout/dialog_enter_jid.xml
new file mode 100644
index 000000000..c3ae367fc
--- /dev/null
+++ b/src/main/res/layout/dialog_enter_jid.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/res/layout/dialog_join_conference.xml b/src/main/res/layout/dialog_join_conference.xml
index f526ffd99..7cfec64c0 100644
--- a/src/main/res/layout/dialog_join_conference.xml
+++ b/src/main/res/layout/dialog_join_conference.xml
@@ -1,51 +1,50 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ android:paddingBottom="8dp">
-
+ android:hint="@string/your_account">
-
+
+
+ android:hint="@string/xmpp_address">
-
+ android:imeOptions="actionDone|flagNoExtractUi"
+ android:inputType="textEmailAddress" />
+ android:text="@string/save_as_group_chat" />
diff --git a/src/main/res/layout/dialog_presence.xml b/src/main/res/layout/dialog_presence.xml
index 35a7df7ac..2caf23927 100644
--- a/src/main/res/layout/dialog_presence.xml
+++ b/src/main/res/layout/dialog_presence.xml
@@ -1,65 +1,54 @@
-
+
+ android:padding="?dialogPreferredPadding">
+ android:layout_height="wrap_content">
+ android:text="@string/presence_online" />
+ android:text="@string/presence_away" />
+ android:text="@string/presence_xa" />
+ android:text="@string/presence_dnd" />
+ android:layout_height="wrap_content">
+ android:inputType="textShortMessage" />
diff --git a/src/main/res/layout/dialog_quickedit.xml b/src/main/res/layout/dialog_quickedit.xml
index 6255cf0e4..7e3b25209 100644
--- a/src/main/res/layout/dialog_quickedit.xml
+++ b/src/main/res/layout/dialog_quickedit.xml
@@ -1,6 +1,6 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ app:errorEnabled="true">
-
+
diff --git a/src/main/res/layout/dialog_verify_fingerprints.xml b/src/main/res/layout/dialog_verify_fingerprints.xml
index 87c39950f..98b15466c 100644
--- a/src/main/res/layout/dialog_verify_fingerprints.xml
+++ b/src/main/res/layout/dialog_verify_fingerprints.xml
@@ -3,21 +3,19 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:paddingLeft="?attr/dialog_horizontal_padding"
- android:paddingRight="?attr/dialog_horizontal_padding"
- android:paddingBottom="?attr/dialog_vertical_padding"
- android:paddingTop="?attr/dialog_vertical_padding">
+ android:padding="?dialogPreferredPadding">
+ android:textAppearance="?textAppearanceBodyMedium" />
+
\ No newline at end of file
diff --git a/src/main/res/layout/enter_jid_dialog.xml b/src/main/res/layout/enter_jid_dialog.xml
deleted file mode 100644
index cacb98a6f..000000000
--- a/src/main/res/layout/enter_jid_dialog.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/res/layout/form_boolean.xml b/src/main/res/layout/form_boolean.xml
deleted file mode 100644
index db0f0d4bc..000000000
--- a/src/main/res/layout/form_boolean.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/form_text.xml b/src/main/res/layout/form_text.xml
deleted file mode 100644
index 583544c74..000000000
--- a/src/main/res/layout/form_text.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/fragment_conversation.xml b/src/main/res/layout/fragment_conversation.xml
index 4b862b752..f12ec5911 100644
--- a/src/main/res/layout/fragment_conversation.xml
+++ b/src/main/res/layout/fragment_conversation.xml
@@ -4,8 +4,7 @@
+ android:layout_height="match_parent">
+ tools:listitem="@layout/item_message_sent" />
+ android:paddingHorizontal="8dp"
+ android:paddingVertical="6dp">
+ android:background="@drawable/background_message_bubble"
+ android:backgroundTint="?colorSecondaryContainer"
+ android:orientation="vertical"
+ android:paddingHorizontal="16dp"
+ android:paddingVertical="8dp">
+ android:textAppearance="?textAppearanceBodySmall"
+ android:textColor="?colorOnSecondaryContainer"
+ android:visibility="visible"
+ tools:text="@string/private_message_to" />
+ tools:listitem="@layout/item_media_preview">
+ android:minHeight="32dp"
+ android:minLines="1">
-
+ app:icon="@drawable/ic_send_24dp"
+ app:iconSize="32dp" />
+ android:visibility="visible">
+ android:textColor="?colorOnSurfaceInverse"
+ tools:text="@string/conference_kicked" />
+ android:textColor="?colorOnSurfaceInverse"
+ android:textStyle="bold"
+ tools:text="@string/leave" />
diff --git a/src/main/res/layout/fragment_conversations_overview.xml b/src/main/res/layout/fragment_conversations_overview.xml
index e51238e93..51eb3398d 100644
--- a/src/main/res/layout/fragment_conversations_overview.xml
+++ b/src/main/res/layout/fragment_conversations_overview.xml
@@ -1,27 +1,24 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ android:scrollbars="vertical" />
-
+ android:text="@string/start_chat"
+ app:icon="@drawable/ic_chat_24dp" />
\ No newline at end of file
diff --git a/src/main/res/layout/account_row.xml b/src/main/res/layout/item_account.xml
similarity index 76%
rename from src/main/res/layout/account_row.xml
rename to src/main/res/layout/item_account.xml
index 5bf98a8bc..eebd434dc 100644
--- a/src/main/res/layout/account_row.xml
+++ b/src/main/res/layout/item_account.xml
@@ -1,12 +1,13 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools">
@@ -14,7 +15,7 @@
android:id="@+id/account_image"
android:layout_width="48dp"
android:layout_height="48dp"
- android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
android:contentDescription="@string/account_image_description"
app:riv_corner_radius="6dp" />
@@ -22,33 +23,33 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
- android:layout_toRightOf="@+id/account_image"
+ android:layout_toEndOf="@+id/account_image"
android:orientation="vertical"
- android:paddingLeft="@dimen/avatar_item_distance"
- android:layout_toLeftOf="@+id/tgl_account_status"
+ android:layout_marginStart="@dimen/avatar_item_distance"
android:layout_toStartOf="@+id/tgl_account_status">
+ android:textAppearance="?textAppearanceBodyLarge" />
+ android:textAppearance="?textAppearanceBodyMedium" />
diff --git a/src/main/res/layout/item_autocomplete.xml b/src/main/res/layout/item_autocomplete.xml
new file mode 100644
index 000000000..b6cb3ad2d
--- /dev/null
+++ b/src/main/res/layout/item_autocomplete.xml
@@ -0,0 +1,11 @@
+
+
diff --git a/src/main/res/layout/search_result_item.xml b/src/main/res/layout/item_channel_discovery.xml
similarity index 69%
rename from src/main/res/layout/search_result_item.xml
rename to src/main/res/layout/item_channel_discovery.xml
index 338114472..ec4bc5fb4 100644
--- a/src/main/res/layout/search_result_item.xml
+++ b/src/main/res/layout/item_channel_discovery.xml
@@ -13,33 +13,33 @@
android:id="@+id/avatar"
android:layout_width="48dp"
android:layout_height="48dp"
- android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
android:scaleType="centerCrop"
app:riv_corner_radius="6dp" />
+ android:layout_marginStart="@dimen/avatar_item_distance"
+ android:layout_toEndOf="@+id/avatar">
+ android:textAppearance="?textAppearanceTitleMedium"
+ tools:text="Prosody IM chatroom" />
+ android:textAppearance="?textAppearanceBodyMedium"
+ tools:text="Prosody XMPP server support and related discussions (i.e. otters)" />
+ android:textAppearance="?textAppearanceBodyMedium"
+ android:textColor="?colorOnSurfaceVariant"
+ tools:text="prosody@conference.prosody.im" />
diff --git a/src/main/res/layout/contact.xml b/src/main/res/layout/item_contact.xml
similarity index 61%
rename from src/main/res/layout/contact.xml
rename to src/main/res/layout/item_contact.xml
index d8fb128a7..24d45fd3f 100644
--- a/src/main/res/layout/contact.xml
+++ b/src/main/res/layout/item_contact.xml
@@ -1,57 +1,60 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools">
+ app:riv_corner_radius="6dp" />
+ android:layout_marginStart="@dimen/avatar_item_distance"
+ android:layout_toEndOf="@+id/contact_photo"
+ android:orientation="vertical">
+ android:textAppearance="?textAppearanceBodyLarge"
+ tools:text="Juliet Capulet" />
+ android:textAppearance="?textAppearanceBodyMedium"
+ tools:text="juliet@capulet.example" />
-
+ android:layout_marginStart="-2dp"
+ android:orientation="horizontal"/>
+ android:fontFamily="monospace"
+ android:textAppearance="?textAppearanceBodyMedium"
+ android:visibility="gone" />
diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/item_conversation.xml
similarity index 59%
rename from src/main/res/layout/conversation_list_row.xml
rename to src/main/res/layout/item_conversation.xml
index 01c118779..ef64db6ae 100644
--- a/src/main/res/layout/conversation_list_row.xml
+++ b/src/main/res/layout/item_conversation.xml
@@ -1,5 +1,6 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools">
+ android:layout_height="wrap_content">
@@ -31,19 +31,20 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
- android:layout_toRightOf="@+id/conversation_image"
- android:paddingLeft="@dimen/avatar_item_distance">
+ android:layout_marginStart="@dimen/avatar_item_distance"
+ android:layout_toEndOf="@+id/conversation_image">
+ android:maxLines="1"
+ tools:text="Juliet Capulet" />
+ android:layout_centerVertical="true"
+ android:layout_toStartOf="@+id/notification_status"
+ android:layout_toEndOf="@id/sender_name"
+ android:orientation="horizontal">
+ android:layout_width="18sp"
+ android:layout_height="18sp"
+ android:layout_marginEnd="5sp"
+ app:tint="?colorControlNormal" />
+ android:gravity="center_vertical"
+ android:maxLines="1"
+ android:minHeight="18sp"
+ android:scrollHorizontally="false"
+ tools:text="Hi. What’s up?" />
+ android:layout_marginStart="4dp"
+ android:layout_toStartOf="@+id/pinned_on_top"
+ android:src="@drawable/ic_notifications_24dp"
+ android:visibility="visible" />
+ android:layout_marginStart="4dp"
+ android:layout_toStartOf="@+id/unread_count"
+ android:src="@drawable/ic_star_24dp"
+ android:visibility="visible" />
+ app:backgroundColor="?colorTertiaryContainer"
+ app:textColor="?colorOnTertiaryContainer" />
+ tools:text="23:42" />
diff --git a/src/main/res/layout/media.xml b/src/main/res/layout/item_media.xml
similarity index 69%
rename from src/main/res/layout/media.xml
rename to src/main/res/layout/item_media.xml
index eb2d5223c..a5cd3cf7a 100644
--- a/src/main/res/layout/media.xml
+++ b/src/main/res/layout/item_media.xml
@@ -1,15 +1,17 @@
+
+ android:background="?selectableItemBackgroundBorderless"
+ android:padding="2dp">
+
+ android:background="?colorSurfaceContainerHighest"
+ android:scaleType="centerInside" />
diff --git a/src/main/res/layout/media_preview.xml b/src/main/res/layout/item_media_preview.xml
similarity index 74%
rename from src/main/res/layout/media_preview.xml
rename to src/main/res/layout/item_media_preview.xml
index 2262467aa..7f2394e0b 100644
--- a/src/main/res/layout/media_preview.xml
+++ b/src/main/res/layout/item_media_preview.xml
@@ -1,25 +1,26 @@
+
+
+ android:layout_margin="12dp"
+ android:background="?colorSurfaceContainerHighest"
+ android:scaleType="center" />
+
+ android:src="@drawable/ic_cancel_24dp" />
diff --git a/src/main/res/layout/item_message_content.xml b/src/main/res/layout/item_message_content.xml
new file mode 100644
index 000000000..889c90507
--- /dev/null
+++ b/src/main/res/layout/item_message_content.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/item_message_date_bubble.xml b/src/main/res/layout/item_message_date_bubble.xml
new file mode 100644
index 000000000..1985089af
--- /dev/null
+++ b/src/main/res/layout/item_message_date_bubble.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/item_message_received.xml b/src/main/res/layout/item_message_received.xml
new file mode 100644
index 000000000..9b59b87f4
--- /dev/null
+++ b/src/main/res/layout/item_message_received.xml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/item_message_rtp_session.xml b/src/main/res/layout/item_message_rtp_session.xml
new file mode 100644
index 000000000..a1f3e06ec
--- /dev/null
+++ b/src/main/res/layout/item_message_rtp_session.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/item_message_sent.xml b/src/main/res/layout/item_message_sent.xml
new file mode 100644
index 000000000..4d6464259
--- /dev/null
+++ b/src/main/res/layout/item_message_sent.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/item_message_status.xml b/src/main/res/layout/item_message_status.xml
new file mode 100644
index 000000000..fc124414f
--- /dev/null
+++ b/src/main/res/layout/item_message_status.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/user_preview.xml b/src/main/res/layout/item_user_preview.xml
similarity index 71%
rename from src/main/res/layout/user_preview.xml
rename to src/main/res/layout/item_user_preview.xml
index dc665907f..0ddc784a7 100644
--- a/src/main/res/layout/user_preview.xml
+++ b/src/main/res/layout/item_user_preview.xml
@@ -1,17 +1,18 @@
+
+ android:background="?selectableItemBackgroundBorderless"
+ android:padding="2dp">
+
+ android:scaleType="centerInside"
+ app:riv_corner_radius="6dp" />
diff --git a/src/main/res/layout/keys_card.xml b/src/main/res/layout/keys_card.xml
index 54eaaabc0..8fb865d8b 100644
--- a/src/main/res/layout/keys_card.xml
+++ b/src/main/res/layout/keys_card.xml
@@ -1,15 +1,14 @@
-
+ android:layout_marginBottom="@dimen/activity_vertical_margin">
+ android:layout_margin="@dimen/list_padding"
+ android:textAppearance="?textAppearanceTitleLarge" />
-
+ android:orientation="vertical" />
+ android:textAppearance="?textAppearanceBodyMedium" />
-
+
\ No newline at end of file
diff --git a/src/main/res/layout/list_item_tag.xml b/src/main/res/layout/list_item_tag.xml
index 63df8571d..2ff9a09b6 100644
--- a/src/main/res/layout/list_item_tag.xml
+++ b/src/main/res/layout/list_item_tag.xml
@@ -1,13 +1,12 @@
\ No newline at end of file
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="2dp"
+ android:maxLines="1"
+ android:paddingLeft="4dp"
+ android:paddingTop="1dp"
+ android:paddingRight="4dp"
+ android:paddingBottom="1dp"
+ android:textAllCaps="true"
+ android:textAppearance="?textAppearanceLabelLarge" />
\ No newline at end of file
diff --git a/src/main/res/layout/message_content.xml b/src/main/res/layout/message_content.xml
deleted file mode 100644
index 05af4e42c..000000000
--- a/src/main/res/layout/message_content.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/message_date_bubble.xml b/src/main/res/layout/message_date_bubble.xml
deleted file mode 100644
index 5e5cd0c4d..000000000
--- a/src/main/res/layout/message_date_bubble.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/message_received.xml b/src/main/res/layout/message_received.xml
deleted file mode 100644
index a2bb5e496..000000000
--- a/src/main/res/layout/message_received.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/message_rtp_session.xml b/src/main/res/layout/message_rtp_session.xml
deleted file mode 100644
index ad7f06d6a..000000000
--- a/src/main/res/layout/message_rtp_session.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml
deleted file mode 100644
index 6c2e8943f..000000000
--- a/src/main/res/layout/message_sent.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/message_status.xml b/src/main/res/layout/message_status.xml
deleted file mode 100644
index f0ba01f24..000000000
--- a/src/main/res/layout/message_status.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/presence_template.xml b/src/main/res/layout/presence_template.xml
deleted file mode 100644
index e8a757fa4..000000000
--- a/src/main/res/layout/presence_template.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/simple_list_item.xml b/src/main/res/layout/simple_list_item.xml
deleted file mode 100644
index 2944632e8..000000000
--- a/src/main/res/layout/simple_list_item.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
diff --git a/src/main/res/layout/toolbar.xml b/src/main/res/layout/toolbar.xml
deleted file mode 100644
index ebee72b0a..000000000
--- a/src/main/res/layout/toolbar.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
diff --git a/src/main/res/menu/activity_conversations.xml b/src/main/res/menu/activity_conversations.xml
index bcf227ee5..4410ebe59 100644
--- a/src/main/res/menu/activity_conversations.xml
+++ b/src/main/res/menu/activity_conversations.xml
@@ -1,7 +1,7 @@
diff --git a/src/main/res/menu/contact_details.xml b/src/main/res/menu/contact_details.xml
index bee63581b..c7d330d11 100644
--- a/src/main/res/menu/contact_details.xml
+++ b/src/main/res/menu/contact_details.xml
@@ -4,14 +4,14 @@
-
diff --git a/src/main/res/menu/editaccount.xml b/src/main/res/menu/editaccount.xml
index 103aebb5d..d7dcf571a 100644
--- a/src/main/res/menu/editaccount.xml
+++ b/src/main/res/menu/editaccount.xml
@@ -3,13 +3,13 @@
-
diff --git a/src/main/res/menu/fragment_conversation.xml b/src/main/res/menu/fragment_conversation.xml
index 1e12f91c1..56eb366f7 100644
--- a/src/main/res/menu/fragment_conversation.xml
+++ b/src/main/res/menu/fragment_conversation.xml
@@ -3,30 +3,30 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
-
-
@@ -46,7 +46,7 @@
-
@@ -54,32 +54,32 @@
@@ -90,7 +90,7 @@
app:showAsAction="never" />
diff --git a/src/main/res/menu/import_backup.xml b/src/main/res/menu/import_backup.xml
index 0d8a14497..0f16ace5e 100644
--- a/src/main/res/menu/import_backup.xml
+++ b/src/main/res/menu/import_backup.xml
@@ -4,7 +4,7 @@
diff --git a/src/main/res/menu/menu_show_location.xml b/src/main/res/menu/menu_show_location.xml
index 28f80ffa7..eb0c128eb 100644
--- a/src/main/res/menu/menu_show_location.xml
+++ b/src/main/res/menu/menu_show_location.xml
@@ -5,10 +5,10 @@
app:showAsAction="ifRoom"
android:showAsAction="ifRoom"
android:title="@string/action_share_location"
- android:icon="?attr/icon_share"/>
+ android:icon="@drawable/ic_share_24dp"/>
\ No newline at end of file
diff --git a/src/main/res/menu/muc_details.xml b/src/main/res/menu/muc_details.xml
index 4bd5fa4ee..4c515ce67 100644
--- a/src/main/res/menu/muc_details.xml
+++ b/src/main/res/menu/muc_details.xml
@@ -4,9 +4,9 @@
-
diff --git a/src/main/res/menu/share_with.xml b/src/main/res/menu/share_with.xml
index 28b82937d..b15e22f78 100644
--- a/src/main/res/menu/share_with.xml
+++ b/src/main/res/menu/share_with.xml
@@ -4,7 +4,7 @@
diff --git a/src/main/res/menu/start_conversation.xml b/src/main/res/menu/start_conversation.xml
index f4a88bd7f..2398b2f3f 100644
--- a/src/main/res/menu/start_conversation.xml
+++ b/src/main/res/menu/start_conversation.xml
@@ -4,13 +4,13 @@
diff --git a/src/main/res/menu/start_conversation_fab_submenu.xml b/src/main/res/menu/start_conversation_fab_submenu.xml
index 2cf545d68..f6d7326b2 100644
--- a/src/main/res/menu/start_conversation_fab_submenu.xml
+++ b/src/main/res/menu/start_conversation_fab_submenu.xml
@@ -2,22 +2,22 @@
-
+
\ No newline at end of file
diff --git a/src/main/res/menu/trust_keys.xml b/src/main/res/menu/trust_keys.xml
index 5619ada61..abc58cc4d 100644
--- a/src/main/res/menu/trust_keys.xml
+++ b/src/main/res/menu/trust_keys.xml
@@ -6,5 +6,5 @@
android:id="@+id/action_scan_qr_code"
android:title="@string/scan_qr_code"
app:showAsAction="always"
- android:icon="?attr/icon_scan_qr_code"/>
+ android:icon="@drawable/ic_qr_code_scanner_24dp"/>
\ No newline at end of file
diff --git a/src/main/res/values-ar/strings.xml b/src/main/res/values-ar/strings.xml
index b651815a9..ee93f3f9c 100644
--- a/src/main/res/values-ar/strings.xml
+++ b/src/main/res/values-ar/strings.xml
@@ -20,7 +20,6 @@
إلغاء حجب المشارِك
إدارة الحسابات
إعدادات
- مشاركة مع محادثة
ابدأ محادثة
إختيار جهة إتصال
إختار جهات الإتصال
@@ -432,8 +431,6 @@
الخصوصية
السمة
إختر اللون المناسب
- خلفية خضراء
- إستخدم خلفية خضراء للرسائل المُستَلَمة
لم يعُد هذا الجهاز مُستعمَلًا
كمبيوتر
هاتف نقال
@@ -555,12 +552,8 @@
المسودة:
التعمية بـ OMEMO
سوف يُستخدَم OMEMO افتراضيا في المحادثات الجديدة.
- حجم الخط
نشِط مبدئيًا
معطل مبدئيًا
- صغير
- متوسط
- كبير
تراجع
مشاركة الموقع معطّلة
نسخ الموقع
diff --git a/src/main/res/values-bg/strings.xml b/src/main/res/values-bg/strings.xml
index 3778e236e..17f43ddf0 100644
--- a/src/main/res/values-bg/strings.xml
+++ b/src/main/res/values-bg/strings.xml
@@ -20,7 +20,6 @@
Деблокиране на участника
Управление на профилите
Настройки
- Споделяне в разговора
Започване на разговор
Изберете контакт
Изберете контакти
@@ -565,8 +564,6 @@
Автоматично
Светла
Тъмна
- Зелен фон
- Получените съобщения ще бъдат на зелен фон
Свързването с OpenKeychain е невъзможно
Това устройство вече не се използва
Компютър
@@ -703,13 +700,8 @@
OMEMO ще се използва по подразбиране за новите разговори.
OMEMO ще трябва да се включва изрично за новите разговори.
Създаване на пряк път
- Размер на шрифта
- Относителен размер на шрифта в приложението.
ВКЛ по подразбиране
ИЗКЛ по подразбиране
- Малък
- Среден
- Голям
Съобщението не е било шифровано за това устройство.
Съобщението OMEMO не може да бъде дешифровано.
отмяна
diff --git a/src/main/res/values-bn-rIN/strings.xml b/src/main/res/values-bn-rIN/strings.xml
index d4a0639a9..0ce5c6600 100644
--- a/src/main/res/values-bn-rIN/strings.xml
+++ b/src/main/res/values-bn-rIN/strings.xml
@@ -20,7 +20,6 @@
ব্যক্তিটিকে ব্লক্ করার আর দরকার নেই
অ্যকাউন্টগুলো নিয়ন্ত্রণ করা যাক
সেটিংস
- Conversations-এর মাধ্যমে share করা হোক
কথোপকথন শুরু করা যাক
Contact নির্বাচন করুন
Contact সমূহ নির্বাচন করুন
diff --git a/src/main/res/values-ca/strings.xml b/src/main/res/values-ca/strings.xml
index 15859ec69..10c5f925d 100644
--- a/src/main/res/values-ca/strings.xml
+++ b/src/main/res/values-ca/strings.xml
@@ -20,7 +20,6 @@
Desbloquejar participant
Gestiona els comptes
Configuració
- Compartir amb Conversations
Comença una conversa
Tria el contacte
Seleccionar contactes
@@ -551,8 +550,6 @@
Automàtic
Clar
Fosc
- Fons verd
- Utilitzeu fons verd per als missatges rebuts
No s\'ha pogut connectar amb OpenKeychain
Aquest dispositiu ja no està en ús
Ordinador
@@ -687,13 +684,8 @@ que l\'administrador del servidor llegeixi els missatges, però pot ser l\'únic
OMEMO s\'utilitzarà per defecte per a les noves converses.
OMEMO haurà de ser activat explícitament per a noves converses.
Crear accés directe
- Grandària de la font
- La grandària relativa de la font utilitzada dins de l\'aplicació.
Activat per defecte
Desactivat per defecte
- Petita
- Mitjana
- Gran
El missatge no està xifrat per a aquest dispositiu.
No s\'ha pogut desxifrar el missatge OMEMO.
desfer
diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml
index 62ec6018e..ce9ab8c08 100644
--- a/src/main/res/values-cs/strings.xml
+++ b/src/main/res/values-cs/strings.xml
@@ -20,7 +20,6 @@
Odblokovat účatníka
Nastavení účtů
Nastavení
- Sdílet s konverzací
Začít konverzaci
Vybrat kontakt
Vybrat kontakty
@@ -572,8 +571,6 @@
Automaticky
Světlý vzhled
Tmavý vzhled
- Zelené pozadí
- Použít zelené pozadí pro přijaté zprávy
Nelze se spojit s OpenKeychain
Tento přístoj již není používán
Počítač
@@ -720,13 +717,8 @@
OMEMO bude použito jako výchozí pro nové konverzace.
OMEMO bude nutné zapnout ručně pro každou novou konverzaci.
Vytvořit zástupce
- Velikost písma
- Relativní velikost písma v aplikaci.
Zapnuto jako výchozí
Vypnuto jako výchozí
- Malé
- Střední
- Velké
Zpráva nebyla pro toto zařízení zašifrována.
Chyba při dešifrování OMEMO zprávy.
zpět
diff --git a/src/main/res/values-da-rDK/strings.xml b/src/main/res/values-da-rDK/strings.xml
index 29d0e054e..232b5a01f 100644
--- a/src/main/res/values-da-rDK/strings.xml
+++ b/src/main/res/values-da-rDK/strings.xml
@@ -20,7 +20,6 @@
Frigiv deltager
Håndter konti
Indstillinger
- Del med Conversation
Start Conversation
Vælg kontakt
Vælg kontakter
@@ -573,8 +572,6 @@
Automatisk
Lys
Mørk
- Grøn baggrund
- Brug grøn baggrund til modtaget beskeder
Kunne ikke forbinde til OpenKeychain
Denne enhed er ikke længere i brug
Computer
@@ -713,13 +710,8 @@
OMEMO vil blive brugt som standard for nye samtaler.
OMEMO skal være tændt udtrykkeligt for nye samtaler.
Opret genvej
- Skriftstørrelse
- Den relative skriftstørrelse brugt inde i appen.
Til som standard
Fra som standard
- Lille
- Mellem
- Stor
Besked var ikke krypteret på denne enhed.
Dekryptering af OMEMO-besked mislykkes.
fortryd
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 06e9f8283..3b276e798 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -20,7 +20,6 @@
Teilnehmer entsperren
Konten verwalten
Einstellungen
- Mit Unterhaltung teilen
Unterhaltung beginnen
Kontakt auswählen
Kontakte auswählen
@@ -574,8 +573,6 @@
Automatisch
Hell
Dunkel
- Grüner Hintergrund
- Für empfangene Nachrichten grünen Hintergrund verwenden
Verbindung zu OpenKeychain konnte nicht hergestellt werden
Dieses Gerät ist nicht länger in Benutzung
Computer
@@ -714,13 +711,8 @@
OMEMO wird standardmäßig für neue Unterhaltungen verwendet.
OMEMO muss für neue Unterhaltungen explizit eingeschaltet werden.
Verknüpfung erstellen
- Schriftgröße
- Die verwendete relative Schriftgröße innerhalb der App.
Standardmäßig eingeschaltet
Standardmäßig ausgeschaltet
- Klein
- Mittel
- Groß
Die Nachricht wurde nicht für dieses Gerät verschlüsselt.
OMEMO-Nachricht konnte nicht entschlüsselt werden.
rückgängig
@@ -1032,5 +1024,4 @@
Möchtest du das Lesezeichen für %s entfernen und die Unterhaltung schließen?
Löschen & Schließen
Willst du das Lesezeichen für %s entfernen?
- Die Channelsuche verwendet einen Drittanbieterservice namens <a href=https://search.jabber.network>search.jabber.network</a>.<br><br>Wenn du diese Funktion verwendest, werden deine IP-Adresse und deine Suchbegriffe an diesen Dienst übertragen. Weitere Informationen findest du in der <a href=https://search.jabber.network/privacy>Datenschutzerklärung</a>.
\ No newline at end of file
diff --git a/src/main/res/values-el/strings.xml b/src/main/res/values-el/strings.xml
index 771dbb28d..ce9f937ec 100644
--- a/src/main/res/values-el/strings.xml
+++ b/src/main/res/values-el/strings.xml
@@ -20,7 +20,6 @@
Άρση αποκλεισμού συμμετέχοντα
Διαχείριση Λογαριασμών
Ρυθμίσεις
- Διαμοιρασμός με Συζήτηση
Έναρξη Συζήτησης
Επιλογή επαφής
Επιλογή επαφών
@@ -564,8 +563,6 @@
Αυτόματο
Ανοιχτόχρωμο
Σκουρόχρωμο
- Πράσινο φόντο
- Χρήση πράσινου φόντου για εισερχόμενα μηνύματα
Αδυναμία σύνδεσης στο OpenKeychain
Αυτή η συσκευή δεν χρησιμοποιείται πλέον
Υπολογιστής
@@ -704,13 +701,8 @@
Η κρυπτογράφηση OMEMO θα προεπιλέγεται για νέες συζητήσεις.
Η κρυπτογράφηση OMEMO θα πρέπει να επιλεγεί χειροκίνητα για νέες συζητήσεις.
Δημιουργία συντόμευσης
- Μέγεθος γραμματοσειράς
- Το σχετικό μέγεθος γραμματοσειράς που χρησιμοποιείται στην εφαρμογή.
Ενεργοποιημένο από προεπιλογή
Απενεργοποιημένο από προεπιλογή
- Μικρό
- Μεσαίο
- Μεγάλο
Το μήνυμα δεν κρυπτογραφήθηκε για αυτή τη συσκευή.
Αποτυχία αποκρυπτογράφησης μηνύματος OMEMO.
αναίρεση
diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml
index 542185f64..b6e4211d1 100644
--- a/src/main/res/values-es/strings.xml
+++ b/src/main/res/values-es/strings.xml
@@ -20,7 +20,6 @@
Desbloquear participante
Gestionar Cuentas
Ajustes
- Compartir con Conversación
Nueva Conversación
Seleccionar Contacto
Seleccionar Contactos
@@ -577,8 +576,6 @@
Automático
Claro
Oscuro
- Fondo verde
- Usar fondo verde para mensajes recibidos
No se ha podido conectar a OpenKeychain
Este dispositivo ya no está en uso
Ordenador
@@ -723,13 +720,8 @@
OMEMO será usado por defecto para nuevas conversaciones.
OMEMO tendrá que ser explícitamente activado para nuevas conversaciones.
Crear acceso directo
- Tamaño de fuente
- Tamaño de fuente usado en la aplicación.
Activo por defecto
Desactivado por defecto
- Pequeño
- Mediano
- Grande
El mensaje no fue cifrado para este dispositivo.
Error al descifrar el mensaje cifrado con OMEMO.
deshacer
@@ -1043,7 +1035,6 @@
Sin permiso para llamar por teléfono
Contacto no disponible
¡Sin integración de llamadas!
- El observador de canales utiliza un servicio de terceros llamado <a href=https://search.jabber.network>search.jabber.network</a>.<br><br>El uso de esta función transmitirá a ese servicio su dirección IP. y términos de búsqueda. Para obtener más detalles, consulte su <a href=https://search.jabber.network/privacy>Política de privacidad</a>.
Borrar y cerrar
¿Quieres eliminar el marcador de %s ?
¿Quieres eliminar el marcador de %s y cerrar la conversación?
diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml
index 1a1292630..b1baec333 100644
--- a/src/main/res/values-eu/strings.xml
+++ b/src/main/res/values-eu/strings.xml
@@ -19,7 +19,6 @@
Parte-hartzaileari blokeoa kendu
Kontuak kudeatu
Ezarpenak
- Elkarrizketa batekin partekatu
Elkarrizketa hasi
Kontaktua hautatu
Kontaktuak hautatu
@@ -460,8 +459,6 @@
Gaia
Kolore paleta hautatu
Automatikoa
- Atzealde berdea
- Atzealde berdea erabili jasotako mezuentzat
Gailu hau ez da gehiago erabiltzen
Ordenagailua
Mugikorra
@@ -578,13 +575,8 @@
OMEMO elkarrizketa berrietan lehenetsi bezala erabiliko da
OMEMO esplizituki piztu beharko da elkarrizketa berrietarako
Lasterbidea sortu
- Letraren neurria
- Aplikazioaren barruan erabiliko den letraren neurri erlatiboa.
Piztuta lehenetsi bezala
Itzalita lehenetsi bezala
- Txikia
- Ertaina
- Handia
Mezua ez da enkriptatu gailu honentzat.
Ezin izan da OMEMO mezua desenkriptatu.
desegin
diff --git a/src/main/res/values-fa-rIR/strings.xml b/src/main/res/values-fa-rIR/strings.xml
index a29c7ca72..2c7680756 100644
--- a/src/main/res/values-fa-rIR/strings.xml
+++ b/src/main/res/values-fa-rIR/strings.xml
@@ -15,7 +15,6 @@
باز کردن دامنه
مدیریت حساب ها
تنظیمات
- به اشتراک گذاری با Conversation
شروع گفتگو
انتخاب مخاطب
انتخاب مخاطبین
@@ -148,12 +147,8 @@
متوسط
تأییدیهٔ امنیتی ناشناخته پذیرفته شود؟
هم اکنون غیرفعال کن
- اندازهٔ قلم
فعال به صورت پیشفرض
غیرفعال به صورت پیشفرض
- کوچک
- متوسط
- بزرگ
پیام برای این دستگاه رمز نشده.
کپی موقعیت مکانی
همرسانی موقعیت مکانی
@@ -962,13 +957,11 @@
رمزگشایی دوباره
تنها مالک میتواند تصویر نمایهٔ گفتگوی عمومی را عوض کند
این نوع از اعلان وقتی نمایش مییابد که در اتصال یک حساب مشکلی وجود داشته باشد.
- برای پیامهای ورودی پسزمینهٔ سبز بگذار
تصویر نمایهٔ Conversations
پرونده با %s همرسانی شد
تبلت
دیدن رسانه
به %1$s اجازهٔ دسترسی به میکروفن بده
- پسزمینهٔ سبز
ارائهٔ نام اختیاری است
همرسانی به شکل پیوند HTTP
این سرور مسئول این دامنه نیست
@@ -995,7 +988,6 @@
افزونهٔ همرسانی موقعیت مکانی
شما همهٔ کلیدهای OMEMO را که در اختیارتان است تأیید کردهاید
ساخت پروندهٔ موقتی ممکن نبود
- اندازهٔ نسبی قلم به کار رفته در برنامه.
نکته: این مشکل را میتوان گاهی با افزودن متقابل به فهرست مخاطبانتان حل کرد.
آیا میخواهید تأیید این دستگاه را بردارید؟
\nاین دستگاه و پیغامها از آن به عنوان اعتمادنشده علامتگذاری خواهند شد.
diff --git a/src/main/res/values-fi/strings.xml b/src/main/res/values-fi/strings.xml
index 61bf523f5..4cc945d73 100644
--- a/src/main/res/values-fi/strings.xml
+++ b/src/main/res/values-fi/strings.xml
@@ -546,8 +546,6 @@
Automaattinen
Vaalea
Tumma
- Vihreä tausta
- Näytä vastaanotetut viestit vihreällä taustalla
OpenKeychainiin ei saatu yhteyttä
Laite ei ole enää käytössä
Tietokone
@@ -674,13 +672,8 @@
OMEMO-salaus
Uusissa keskusteluissa OMEMO otetaan oletuksena käyttöön.
Luo pikakuvake
- Kirjasinkoko
- Kirjasimen suhteellinen koko sovelluksen sisällä.
Käytössä oletuksena
Oletuksena pois käytöstä
- Pieni
- Keksikokoinen
- Suuri
Viestiä ei salattu tälle laitteelle.
OMEMO-salatun viestin purku epäonnistui.
peru
diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml
index 936857932..2fb53ad59 100644
--- a/src/main/res/values-fr/strings.xml
+++ b/src/main/res/values-fr/strings.xml
@@ -20,7 +20,6 @@
Débloquer le participant
Gestion des comptes
Paramètres
- Partager avec Conversations
Démarrer une conversation
Choisir un contact
Choisir les contacts
@@ -572,8 +571,6 @@
Automatique
Clair
Sombre
- Fond vert
- Utiliser un fond vert pour les messages reçus
Impossible de se connecter à OpenKeyChain
Cet appareil n\'est plus utilisé
Ordinateur
@@ -716,13 +713,8 @@
OMEMO sera utilisé par défaut pour les nouvelles discussions.
OMEMO devra être activé manuellement pour chaque nouvelle discussion.
Créer un raccourci
- Taille de police
- La taille de police relative utilisée dans l\'application.
Activé par défaut
Désactivé par défaut
- Petite
- Moyenne
- Grande
Le message n\'était pas chiffré pour cet appareil.
Échec de déchiffrement du message OMEMO.
annuler
diff --git a/src/main/res/values-gl/strings.xml b/src/main/res/values-gl/strings.xml
index 2cddf75b4..1a4a402ac 100644
--- a/src/main/res/values-gl/strings.xml
+++ b/src/main/res/values-gl/strings.xml
@@ -20,7 +20,6 @@
Desbloquear persoa
Xestionar Contas
Axustes
- Compartir na conversa
Iniciar conversa
Escoller Contacto
Seleccionar contactos
@@ -576,8 +575,6 @@
Automático
Claro
Escuro
- Fondo verde
- Utilizar fondo verde para mensaxes recibidas
Non se puido conectar con OpenKeychain
Este dispositivo xa non está en uso
Computadora
@@ -717,13 +714,8 @@
OMEMO utilizarase por defecto para as novas conversas.
OMEMO terá que ser activado explícitamente para novas conversacións.
Crear acceso directo
- Tamaño da letra
- O tamaño relativo da letra que utiliza a app.
Activado por defecto
Desactivado por defecto
- Pequena
- Mediana
- Grande
A mensaxe non foi cifrada para este disposivivo.
Fallo ao descifrar a mensaxe OMEMO.
desfacer
@@ -1035,5 +1027,4 @@
Queres eliminar o marcador para %s e pechar a conversa?
Queres eliminar o marcador para %s?
Eliminar e Pechar
- O descubrimento de canles usa un servicio alleo chamado <a href=https://search.jabber.network>search.jabber.network</a>.<br><br>Ao usar esta ferramenta transmites o teu enderezo IP e os termos de busca a ese servizo. Le a súa <a href=https://search.jabber.network/privacy>Política de Privacidade</a> para saber máis.
\ No newline at end of file
diff --git a/src/main/res/values-hr/strings.xml b/src/main/res/values-hr/strings.xml
index 37dec2d45..91f64c173 100644
--- a/src/main/res/values-hr/strings.xml
+++ b/src/main/res/values-hr/strings.xml
@@ -20,7 +20,6 @@
Deblokiraj sudionika
Upravljanje računima
Postavke
- Dijeli s Conversation
Započni razgovor
Odaberite Kontakt
Odaberite kontakte
diff --git a/src/main/res/values-hu/strings.xml b/src/main/res/values-hu/strings.xml
index 72ebc8e40..4df39a16c 100644
--- a/src/main/res/values-hu/strings.xml
+++ b/src/main/res/values-hu/strings.xml
@@ -20,7 +20,6 @@
Résztvevő tiltásának feloldása
Fiókok kezelése
Beállítások
- Megosztás a Conversations alkalmazással
Beszélgetés indítása
Partner kiválasztása
Partnerek kiválasztása
@@ -541,8 +540,6 @@
Automatikus
Világos
Sötét
- Zöld háttér
- Zöld háttér használata a fogadott üzenetekhez
Ez az eszköz többé nincs használatban
Számítógép
Mobiltelefon
@@ -669,13 +666,8 @@
Az OMEMO lesz alapértelmezetten használva az új beszélgetésekhez.
Az OMEMO-t kifejezetten be kell majd kapcsolni az új beszélgetésekhez.
Gyorsbillentyű létrehozása
- Betűméret
- Az alkalmazáson belül használt relatív betűméret.
Alapértelmezetten be
Alapértelmezetten ki
- Kicsi
- Közepes
- Nagy
Az üzenet nem volt titkosított ehhez az eszközhöz.
Nem sikerült az OMEMO üzenet visszafejtése.
visszavonás
diff --git a/src/main/res/values-id/strings.xml b/src/main/res/values-id/strings.xml
index 16ee09fbc..038eb074c 100644
--- a/src/main/res/values-id/strings.xml
+++ b/src/main/res/values-id/strings.xml
@@ -20,7 +20,6 @@
Buka blok partisipan
Pengaturan Akun
Pengaturan
- Bagikan dengan Conversation
Mulai Percakapan
Pilih kontak
Pilih beberapa kontak
@@ -420,8 +419,6 @@
Privasi
Tema
Otomatis
- Latar Hijau
- Gunakan latar hijau untuk pesan masuk
Perangkat ini tidak dipergunakan lagi
Komputer
Ponsel
@@ -452,9 +449,6 @@
Kontak diblokir
sebagian
Pesan disalin ke clipboard
- Kecil
- Sedang
- Besar
Bagikan Lokasi
Bagikan lokasi
Tampilkan lokasi
diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml
index 555c3cf89..48e57fd97 100644
--- a/src/main/res/values-it/strings.xml
+++ b/src/main/res/values-it/strings.xml
@@ -20,7 +20,6 @@
Sblocca partecipante
Gestisci profili
Impostazioni
- Condividi con Conversation
Inizia una conversazione
Scegli un contatto
Scegli i contatti
@@ -578,8 +577,6 @@
Automatico
Chiaro
Scuro
- Sfondo verde
- Usa uno sfondo verde per i messaggi ricevuti
Impossibile connettersi a OpenKeychain
Questo dispositivo non è più in uso
Computer
@@ -724,13 +721,8 @@
OMEMO verrà usato in modo predefinito nelle nuove conversazioni.
OMEMO dovrà essere attivato a mano nelle nuove conversazioni.
Crea scorciatoia
- Dimensione dei caratteri
- La dimensione dei caratteri usata all\'interno dell\'app.
On in modo predefinito
Off in modo predefinito
- Piccolo
- Medio
- Grande
Il messaggio non è stato criptato per questo dispositivo.
Decifrazione del messaggio OMEMO fallita.
annulla
diff --git a/src/main/res/values-iw/strings.xml b/src/main/res/values-iw/strings.xml
index 5d36f5872..aff2d6b64 100644
--- a/src/main/res/values-iw/strings.xml
+++ b/src/main/res/values-iw/strings.xml
@@ -13,7 +13,6 @@
בטל חסימת דומיין
נהל חשבונות
הגדרות
- שתף בעזרת Conversations
התחל דיון
רשימת חסימה
ממש עכשיו
diff --git a/src/main/res/values-ja/strings.xml b/src/main/res/values-ja/strings.xml
index a146ca409..5bbc9cf92 100644
--- a/src/main/res/values-ja/strings.xml
+++ b/src/main/res/values-ja/strings.xml
@@ -20,7 +20,6 @@
参加者のブロックを解除
アカウントを管理
設定
- 会話で共有
会話を開始
連絡先を選択
連絡先を選択
@@ -568,8 +567,6 @@
自動
明
暗
- 緑の背景
- 受信したメッセージに緑の背景を使用します
OpenKeychain に接続できません
このデバイスは、現在使用されていません
コンピューター
@@ -703,13 +700,8 @@
デフォルトで新しい会話で OMEMO を使用します。
新しい会話をするためには、OMEMOを明示的にオンにする必要があります。
ショートカットを作成
- フォントの大きさ
- このアプリで使用される相対的なフォントの大きさ
デフォルトでオン
デフォルトでオフ
- 小
- 中
- 大
このデバイス向けにメッセージは暗号化されませんでした。
OMEMO メッセージの復号に失敗しました。
元に戻す
@@ -1014,7 +1006,6 @@
電話をかける権限がありません
%s のブックマークを削除して会話を閉じますか ?
%s のブックマークを削除しますか ?
- 談話室の探索には <a href=https://search.jabber.network>search.jabber.network</a> というサードパーティのサービスを利用します。<br><br>この機能を使用すると、IP アドレスと検索語がこのサービスに送信されます。詳細は、<a href=https://search.jabber.network/privacy>プライバシーポリシー</a>をご覧ください。
通話の統合は利用できません。
連絡先は利用できません
削除して閉じる
diff --git a/src/main/res/values-ko/strings.xml b/src/main/res/values-ko/strings.xml
index cce479592..aea66786f 100644
--- a/src/main/res/values-ko/strings.xml
+++ b/src/main/res/values-ko/strings.xml
@@ -14,7 +14,6 @@
도메인 차단 해제
계정 관리
설정
- 대화 공유
대화 시작
목록 차단
방금
@@ -362,8 +361,6 @@
프라이버시
테마
색상 팔레트를 선택
- 초록색 배경
- 받은 메시지에 녹색 배경을 사용합니다
이 장치는 현재 사용되고 있지 않습니다
컴퓨터
휴대폰
@@ -395,7 +392,6 @@
OMEMO 키를 검증
설정된 기간보다 오래된 메시지를 장치에서 자동으로 삭제합니다.
메세지가 클립보드에 복사되었습니다
- 중간
위치 표시
바쁨
\ No newline at end of file
diff --git a/src/main/res/values-nb-rNO/strings.xml b/src/main/res/values-nb-rNO/strings.xml
index 75c1ee1de..1b16da338 100644
--- a/src/main/res/values-nb-rNO/strings.xml
+++ b/src/main/res/values-nb-rNO/strings.xml
@@ -15,7 +15,6 @@
Avblokker domene
Kontobehandling
Innstillinger
- Del med Conversation
Start samtale
Velg kontakt
Del via konto
@@ -394,8 +393,6 @@
Personvern
Drakt
Velg fargepalett
- Grønn bakgrunn
- Bruk grønn bakgrunn for mottatte meldinger
Denne enheten er ikke lenger i bruk
Datamaskin
Mobiltelefon
@@ -462,7 +459,6 @@
Private meldinger er skrudd av
Beskyttede programmer
For å motta merknader, selv når skjermen er skrudd av, må du legge til Conversations i listen over beskyttede programmer.
- Middels
Vis plasseringsdata
Gruppesludringsnavn
Opprett gruppesludring
diff --git a/src/main/res/values-night/colors.xml b/src/main/res/values-night/colors.xml
deleted file mode 100644
index 7275c9cbe..000000000
--- a/src/main/res/values-night/colors.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- #ff424242
- #ff282828
-
diff --git a/src/main/res/values-night/themes.xml b/src/main/res/values-night/themes.xml
new file mode 100644
index 000000000..6b7be2f47
--- /dev/null
+++ b/src/main/res/values-night/themes.xml
@@ -0,0 +1,32 @@
+
+
+
+
diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml
index d19629bc3..f4509f357 100644
--- a/src/main/res/values-nl/strings.xml
+++ b/src/main/res/values-nl/strings.xml
@@ -20,7 +20,6 @@
Deelnemer deblokkeren
Accounts beheren
Instellingen
- Delen in gesprek
Gesprek starten
Contact kiezen
Contacten kiezen
@@ -498,8 +497,6 @@
Thema
Kies het kleurenpalet
Automatisch
- Groene achtergrond
- Gebruik groene achtergrond voor ontvangen berichten
Dit apparaat wordt niet meer gebruikt
Computer
Mobiele telefoon
@@ -616,13 +613,8 @@
OMEMO zal standaard gebruikt worden voor nieuwe gesprekken.
OMEMO zal uitdrukkelijk ingeschakeld moeten worden voor nieuwe gesprekken.
Snelkoppeling aanmaken
- Lettergrootte
- De relatieve lettergrootte in de app.
Standaard aan
Standaard uit
- Klein
- Gemiddeld
- Groot
Bericht is niet versleuteld voor dit apparaat.
Kan OMEMO-bericht niet ontsleutelen.
ongedaan maken
diff --git a/src/main/res/values-pl/strings.xml b/src/main/res/values-pl/strings.xml
index db8b08592..f9bc62f1d 100644
--- a/src/main/res/values-pl/strings.xml
+++ b/src/main/res/values-pl/strings.xml
@@ -20,7 +20,6 @@
Odblokuj użytkownika
Zarządzaj kontami
Ustawienia
- Udostępnij w konwersacji
Rozpocznij konwersację
Wybierz kontakt
Wybierz kontakty
@@ -584,8 +583,6 @@
Automatycznie
Jasny
Ciemny
- Zielone tło
- Używaj zielonego tła dla otrzymanych wiadomości
Nie można połączyć się z OpenKeychain
Urządzenie to nie jest już używane
Komputer
@@ -737,13 +734,8 @@
OMEMO będzie używane domyślnie dla nowych rozmów.
OMEMO będzie musiało być włączone ręcznie dla nowych rozmów.
Utwórz Skrót
- Rozmiar Czcionki
- Relatywny rozmiar czcionki używany wewnątrz aplikacji.
Włączone domyślnie
Wyłączone domyślnie
- Mała
- Średnia
- Duża
Wiadomość nie była zaszyfrowana dla tego urządzenia.
Błąd odszyfrowywania wiadomości OMEMO.
cofnij
@@ -1062,7 +1054,6 @@
Quicksy pyta o pozwolenie na użycie twoich danych
Brak pozwolenia na wypisanie numeru telefonu
Integracja połączeń nie jest dostępna!
- Odkrywanie kanałów używa usługi firmy trzeciej <a href=https://search.jabber.network>search.jabber.network</a>.<br><br>Używanie tej funkcji spowoduje transmisję twojego adresu IP oraz kryteriów wyszukiwania. Sprawdź ich <a href=https://search.jabber.network/privacy>politykę prywatności</a> aby uzyskać więcej informacji.
Czy chcesz usunąć zakładkę dla %s?
Usuń i zamknij
Czy chcesz usunąć zakładkę dla %s i zamknąć rozmowę?
diff --git a/src/main/res/values-pt-rBR/strings.xml b/src/main/res/values-pt-rBR/strings.xml
index f34bb847c..a131195fe 100644
--- a/src/main/res/values-pt-rBR/strings.xml
+++ b/src/main/res/values-pt-rBR/strings.xml
@@ -20,7 +20,6 @@
Desbloquear participante
Gerenciar contas
Configurações
- Compartilhar com a conversa
Conversar
Selecione o contato
Selecionar Contatos
@@ -572,8 +571,6 @@
Automático
Claro
Escuro
- Fundo verde
- Usa um fundo verde no recebimento de mensagens.
Não foi possível conectar ao OpenKeychain
Este dispositivo não está mais em uso
Computador
@@ -718,13 +715,8 @@
OMEMO será utilizado por padrão em novas conversas.
OMEMO deverá ser explicitamente ativado para novas conversas.
Criar atalho
- Tamanho da fonte
- O tamanho relativo da fonte utilizada no app.
Ligado por padrão
Desligado por padrão
- Pequena
- Média
- Grande
A mensagem não foi criptografada para este dispositivo.
Não foi possível descriptografar a mensagem OMEMO.
desfazer
diff --git a/src/main/res/values-pt/strings.xml b/src/main/res/values-pt/strings.xml
index 34c36151a..aad1a637d 100644
--- a/src/main/res/values-pt/strings.xml
+++ b/src/main/res/values-pt/strings.xml
@@ -14,7 +14,6 @@
Desbloquear domínio
Gerir contas
Definições
- Compartilhar conversa
Iniciar conversa
Escolher contacto
Escolher contactos
@@ -390,8 +389,6 @@
Privacidade
Tema
Escolher a palete de cores
- Fundo Verde
- Usar fundo verde para mensagens recebidas
Este dispositivo já não está em uso
Computador
Telefone móvel
@@ -409,7 +406,6 @@
Mensagem de Erro
Poupança de dados ligada
Mensagem copiada para a área de transferência
- Médio
Exibir localização
Ocupado
\ No newline at end of file
diff --git a/src/main/res/values-ro-rRO/strings.xml b/src/main/res/values-ro-rRO/strings.xml
index d0e849912..c4b3f2a57 100644
--- a/src/main/res/values-ro-rRO/strings.xml
+++ b/src/main/res/values-ro-rRO/strings.xml
@@ -20,7 +20,6 @@
Deblochează participant
Configurează conturile
Setări
- Partajează într-o conversație
Pornește o conversație
Alegeți contactul
Alegeți contactele
@@ -582,8 +581,6 @@
Automată
Luminoasă
Întunecată
- Fundal verde
- Pentru mesajele primite
Nu s-a putut face conectarea la OpenKeychain
Acest dispozitiv nu mai este în uz
PC
@@ -728,13 +725,8 @@
Va fi folosită în mod implicit pentru discuțiile noi.
Va trebui să fie pornită în mod explicit pentru discuțiile noi.
Creează scurtătură
- Mărime text
- Dimensiunea relativă a fontului folosită în aplicație.
Activată implicit
Dezactivată implicit
- Mică
- Medie
- Mare
Mesajul nu a fost criptat pentru acest dispozitiv.
Nu s-a reușit decriptarea mesajului OMEMO.
anulează
@@ -1051,5 +1043,4 @@
Ați dori să ștergeți semnul de carte pentru %s și să închideți conversația?
Ați dori să ștergeți semnul de carte pentru %s?
Șterge și închide
- Descoperirea de canale publice folosește un serviciu terț numit <a href=https://search.jabber.network>search.jabber.network</a>.<br><br>Folosind această funcție se va transmite adresa dumneavoastră IP și cuvintele căutate către acest serviciu. Pentru mai multe informații citiți <a href=https://search.jabber.network/privacy>Politica de confidențialitate</a> a serviciului.
\ No newline at end of file
diff --git a/src/main/res/values-ru/strings.xml b/src/main/res/values-ru/strings.xml
index fe2a4ba9e..e0acc3ca2 100644
--- a/src/main/res/values-ru/strings.xml
+++ b/src/main/res/values-ru/strings.xml
@@ -20,7 +20,6 @@
Разблокировать участника
Управление аккаунтами
Настройки
- Поделиться
Начать беседу
Выберите контакт
Выберите контакты
@@ -574,8 +573,6 @@
Автоматически
Светлая
Темная
- Зелёный фон
- Использовать зелёный фон для полученных сообщений
Не удалось подключиться к OpenKeyChain
Данное устройство больше не используется
Компьютер
@@ -725,13 +722,8 @@
OMEMO будет использоваться по умолчанию для новых бесед.
OMEMO нужно будет явно включать для новых бесед.
Создать ярлык
- Размер шрифта
- Относительный размер шрифта, используемый в приложении.
Включено по умолчанию
Выключено по умолчанию
- Маленький
- Средний
- Большой
Сообщение не зашифровано для этого устройства.
Не удалось расшифровать OMEMO-сообщение.
отменить
@@ -1060,6 +1052,5 @@
Нет разрешения на телефонный звонок
Вы хотите удалить закладку для «%s»?
Закрыть и удалить
- Обзор каналов использует сторонний сервис <a href=https://search.jabber.network>search.jabber.network</a>.<br><br>Эта функция передаст Ваш IP-адрес и ваш поисковый запрос этому сервису. Ознакомьтесь с его <a href=https://search.jabber.network/privacy>Политикой конфиденциальности</a> для получения подробностей.
Вы хотите удалить закладку для %s и закрыть беседу?
\ No newline at end of file
diff --git a/src/main/res/values-sk/strings.xml b/src/main/res/values-sk/strings.xml
index bfa4210ae..27e5da601 100644
--- a/src/main/res/values-sk/strings.xml
+++ b/src/main/res/values-sk/strings.xml
@@ -20,7 +20,6 @@
Odblokovať účastníka
Nastavenie účtov
Nastavenia
- Zdieľať s konverzáciou
Začať konverzáciu
Vybrať Kontakt
Vyberte Kontakty
@@ -446,8 +445,6 @@
Súkromie
Téma
Zvoľte si farebnú schému
- Zelené pozadie
- Použiť zelené pozadie pre prijaté správy
Vymazať OMEMO identifikátory
Re-generuje vaše kľúče OMEMO. Všetky vaše kontakty vás budú musieť znova overiť. Použite to ako poslednú možnosť.
Odstrániť označené kľúče
@@ -466,7 +463,6 @@
OMEMO šifrovanie
OMEMO bude vždy používané pre individuálne a súkromné skupinové rozhovory.
OMEMO bude predvolene zapnuté pre všetky rozhovory.
- Veľkosť písma
Predvolene zapnuté
Predvolene vypnuté
Nepodarilo sa dešifrovať OMEMO správu.
diff --git a/src/main/res/values-sq-rAL/strings.xml b/src/main/res/values-sq-rAL/strings.xml
index 90915fbae..bc4974ce7 100644
--- a/src/main/res/values-sq-rAL/strings.xml
+++ b/src/main/res/values-sq-rAL/strings.xml
@@ -18,7 +18,6 @@
Zhbllokoje pjesëmarrësin
Administroni Llogari
Formësime
- Jepe përmes Conversation
Nisni Bisedë
Zgjidhni Kontakt
Zgjidhni Kontakte
@@ -450,7 +449,6 @@
Automatike
E çelët
E errët
- Sfond i gjelbër
S’u lidh dot te OpenKeychain
Kjo pajisje s’është më në përdorim
Kompjuter
@@ -545,11 +543,8 @@
Skicë:
Fshehtëzim OMEMO
Krijoni Shkurtore
- Madhësi Shkronjash
On, si parazgjedhje
Off, si parazgjedhje
- Mesatare
- E madhe
Mesazhi s’qe fshehtëzuar për këtë pajisje.
S’’u arrit të shfshehtëzohet mesazh fshehtëzuar me OMEMO.
zhbëje
@@ -932,7 +927,6 @@
\nRekomandohet të çaktivizohen ato.
Pajisja juaj nuk mbulon zgjedhjen e lënies jashtë nga optimizim baterie
Bëjuni të ditur kontakteve tuaj, kur përdorni Conversations
- Për mesazhe të marrë përdor sfond të gjelbër
Riprodhoni kyçet tuaj OMEMO. Krejt kontakteve tuaj do t’ju duhet t’ju verifikojnë sërish. Këtë përdoreni si zgjidhjen e fundit.
Që të bëni publik avatarin tuaj, duhet të jeni i lidhur.
Kursyesi i të dhënave u aktivizua
@@ -958,7 +952,6 @@
OMEMO do të përdoret përherë për fjalosje tek-për-tek dhe në grup.
OMEMO do të përdoret për biseda të reja, si parazgjedhje.
OMEMO do të duhet të aktivizohet shprehimisht për biseda të reja.
- Madhësia relative e shkronjave të përdorura brenda aplikacionit.
Te skena “Nisni Bisedë” hapni tastierën dhe vendoseni kursorin te fusha e kërkimeve
Streha nuk mbulon avatarë fjalosjeje në grup
Vetëm i zoti mund të ndryshyjë avatarin e një fjalosje në grup
@@ -1040,7 +1033,6 @@
S’ka integrim thirrjesh!
Pa leje për bërje thirrjesh
U kalua në version të mëparshëm SASL-i
- Pikasja e kanaleve përdor një shërbim palë të tretë të quajtur <a href=https://search.jabber.network>search.jabber.network</a>.<br><br>Përdorim i kësaj veçorie do t’i transmetojë atij shërbimi adresën tuaj IP dhe terma kërkimesh. Për më tepër hollësi, shihni <a href=https://search.jabber.network/privacy>Rregullat e tyre mbi Privatësinë</a>.
Doni të hiqet faqerojtësi për %s dhe të mbyllet biseda?
Fshije & Mbylle
Doni të hiqet faqerojtësi për %s?
diff --git a/src/main/res/values-sr/strings.xml b/src/main/res/values-sr/strings.xml
index 82ed6360a..81b24b378 100644
--- a/src/main/res/values-sr/strings.xml
+++ b/src/main/res/values-sr/strings.xml
@@ -20,7 +20,6 @@
Одблокирај учесника
Управљање налозима
Поставке
- Подели у преписци
Почни преписку
Изабери контакт
Изабери контакте
@@ -550,8 +549,6 @@
Аутопатски
Светла
Тамна
- Зелена позадина
- Зелена позадина за примљене поруке
Не могу да се повежем са Отвореним кључарником
Овај уређај више није у употреби
Рачунар
@@ -648,10 +645,8 @@
Нацрт:
ОМЕМО ће увек бити у употреби за један-на-један и приватна групна ћаскања.
Направи пречицу
- Величина фонта
Подразумевано укључено
Подразумевано искључено
- Средњи
врати
Дељење локације је искључено
Копирај локацију
diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml
index dc98cfe6a..9c511ba95 100644
--- a/src/main/res/values-sv/strings.xml
+++ b/src/main/res/values-sv/strings.xml
@@ -20,7 +20,6 @@
Avblockera deltagare
Hantera konton
Inställningar
- Dela med konversation
Starta konversation
Välj kontakt
Välj kontakter
@@ -587,8 +586,6 @@
Automatisk
Ljus
Mörk
- Grön bakgrund
- Använd grön bakgrund för mottagna meddelanden
Det gick inte att ansluta till OpenKeychain
Den här enheten används inte längre
Dator
@@ -730,13 +727,8 @@
OMEMO kommer att användas som standard för nya konversationer.
OMEMO måste manuellt aktiveras för varje ny konversation.
Skapa genväg
- Textstorlek
- Den relativa teckenstorleken som används i appen.
På som standard
Av som standard
- Liten
- Medium
- Stor
Meddelandet krypterades inte för den här enheten.
Det gick inte att dekryptera OMEMO-meddelandet.
ångra
diff --git a/src/main/res/values-szl/strings.xml b/src/main/res/values-szl/strings.xml
index 71f2abdd3..9967bebf1 100644
--- a/src/main/res/values-szl/strings.xml
+++ b/src/main/res/values-szl/strings.xml
@@ -20,7 +20,6 @@
Ôdblokuj kōntakt
Sztelōnki kōnt
Sztelōnki
- Udostympnij we godce
Zacznij godka
Ôbier kōntakt
Ôbier kōntakty
@@ -593,8 +592,6 @@
Autōmatycznie
Jasny
Ciymny
- Zielōny zadek
- Używej zielōnego zadku dlo dostanych wiadōmości
Niy idzie sie połōnczyć z OpenKeychain
Ta maszina juz niy je używano
Kōmputer
@@ -742,13 +739,8 @@
OMEMO bydzie używane wychodnie przi nowych godkach.
OMEMO bydzie musiało być włōnczōne ryncznie przi nowych godkach.
Stwōrz Skrōt
- Srogość czciōnki
- Relatywno srogość czciōnki używanyj we aplikacyji.
Włōnczōne wychodnie
Zastawiōne wychodnie
- Mało
- Strzednio
- Srogo
Wiadōmość niy była zaszyfrowano dlo tyj masziny.
Niy szło ôdszyfrować wiadōmości OMEMO.
cofnij
diff --git a/src/main/res/values-tr-rTR/strings.xml b/src/main/res/values-tr-rTR/strings.xml
index eec089f97..11f5dd781 100644
--- a/src/main/res/values-tr-rTR/strings.xml
+++ b/src/main/res/values-tr-rTR/strings.xml
@@ -20,7 +20,6 @@
Katılımcının engelini kaldır
Hesapları yönet
Ayarlar
- Konuşmayla paylaş
Konuşma Başlat
Kişi Seç
Kişi Seç
@@ -578,8 +577,6 @@
Otomatik
Aydınlık
Karanlık
- Yeşil arka plan
- Gelen iletiler için yeşil arka plan kullan
OpenKeychain\'e bağlanılamadı
Bu aygıt artık kullanılmıyor
Bilgisayar
@@ -719,13 +716,8 @@
Yeni konuşmalarda OMEMO varsayılan olarak kullanılacak.
Özellikle yeni konuşmalarda OMEMO aktif hale getirilecek.
Kısayol oluştur
- Yazı tipi boyutu
- Uygulamaya kıyasla kullanılan yazı tipi boyutu.
Varsayılan olarak aktif
Varsayılan olarak devre dışı
- Küçük
- Orta
- Büyük
İleti bu cihaz için şifrelenmedi.
OMEMO mesajı çözümlenemedi.
geri al
diff --git a/src/main/res/values-uk/strings.xml b/src/main/res/values-uk/strings.xml
index 10348d6ce..c008db5a0 100644
--- a/src/main/res/values-uk/strings.xml
+++ b/src/main/res/values-uk/strings.xml
@@ -19,7 +19,6 @@
Розблокувати учасника
Мої облікові записи
Налаштування
- Поділитися розмовою
Почати розмову
Вибрати контакт
Вибрати контакти
@@ -561,8 +560,6 @@
Автоматично
Світла
Темна
- Зелене тло
- Використовувати зелене тло для отриманих повідомлень
Не вдалося зв\'язатися з OpenKeychain
Цей пристрій більше не використовується
Комп\'ютер
@@ -709,13 +706,8 @@
Типово для нових розмов використовуватиметься OMEMO.
OMEMO потрібно буде вмикати окремо для кожної нової розмови.
Створити ярлик
- Розмір шрифту
- Розмір шрифту в застосунку.
Типово ввімкнено
Типово вимкнено
- Малий
- Середній
- Великий
Повідомлення не було зашифровано для цього пристрою.
Не вдалося розшифрувати повідомлення OMEMO.
скасувати
@@ -1081,7 +1073,6 @@
Контакт недоступний
Інтеграція викликів недоступна!
Видалити і закрити
- Пошук каналів використовує сторонній сервіс <a href=https://search.jabber.network>search.jabber.network</a>.<br><br>Використання цієї функції передає Вашу IP-адресу та пошукові запити цьому сервісу. Перегляньте їхню <a href=https://search.jabber.network/privacy>Політику конфіденційності</a>, щоб отримати більше інформації.
Бажаєте видалити закладку %s і закрити розмову?
Бажаєте видалити закладку %s?
\ No newline at end of file
diff --git a/src/main/res/values-vi/strings.xml b/src/main/res/values-vi/strings.xml
index 9b0112df9..325cec1d8 100644
--- a/src/main/res/values-vi/strings.xml
+++ b/src/main/res/values-vi/strings.xml
@@ -20,7 +20,6 @@
Bỏ chặn thành viên
Quản lý tài khoản
Cài đặt
- Chia sẻ qua Conversation
Khởi chạy Conversation
Chọn liên hệ
Chọn liên hệ
@@ -568,8 +567,6 @@
Tự động
Sáng
Tối
- Nền xanh lá cây
- Dùng nền xanh lá cây cho tin nhắn nhận được
Không thể kết nối với OpenKeychain
Thiết bị này không còn được dùng nữa
Máy tính
@@ -700,13 +697,8 @@
OMEMO sẽ được sử dụng theo mặc định cho các cuộc hội thoại mới.
OMEMO sẽ phải được bật một cách rõ ràng cho các cuộc hội thoại mới.
Tạo lối tắt
- Cỡ chữ
- Cỡ chữ tương đối được sử dụng trong ứng dụng.
Bật theo mặc định
Tắt theo mặc định
- Nhỏ
- Trung bình
- Lớn
Tin nhắn đã không được mã hoá cho thiết bị này.
Giải mã tin nhắn OMEMO thất bại.
hoàn tác
diff --git a/src/main/res/values-zh-rCN/strings.xml b/src/main/res/values-zh-rCN/strings.xml
index 62235d15f..a1668ec97 100644
--- a/src/main/res/values-zh-rCN/strings.xml
+++ b/src/main/res/values-zh-rCN/strings.xml
@@ -20,7 +20,6 @@
解除屏蔽参与者
管理账号
设置
- 分享至对话
开始对话
选择联系人
选择联系人
@@ -591,8 +590,6 @@
自动
浅色
深色
- 绿色背景
- 对收到的消息使用绿色背景
无法连接到 OpenKeychain
此设备已不再使用
电脑
@@ -728,13 +725,8 @@
默认情况下,新对话将使用 OMEMO 加密。
对于新对话,必须明确地打开 OMEMO 加密。
创建快捷方式
- 字体大小
- 应用内使用的相对字体大小。
默认开启
默认关闭
- 小
- 中
- 大
消息未对本设备加密。
解密 OMEMO 消息失败。
撤销
@@ -1041,5 +1033,4 @@
是否移除 %s 的书签并关闭对话?
是否移除 %s 的书签?
删除 & 关闭
- 频道发现使用称为 <a href=https://search.jabber.network>search.jabber.network</a> 的第三方服务。<br><br>使用此功能会将您的 IP 地址和搜索词传输到此服务。请参阅其 <a href=https://search.jabber.network/privacy>隐私政策</a> 以获取更多信息。
\ No newline at end of file
diff --git a/src/main/res/values-zh-rTW/strings.xml b/src/main/res/values-zh-rTW/strings.xml
index 5d955366d..22d245f45 100644
--- a/src/main/res/values-zh-rTW/strings.xml
+++ b/src/main/res/values-zh-rTW/strings.xml
@@ -20,7 +20,6 @@
解除封鎖參與者
管理帳戶
設定
- 分享至會話
開始會話
選擇聯絡人
選擇聯絡人
@@ -539,8 +538,6 @@
自動
淺色
深色
- 綠色背景
- 為接收的訊息使用綠色背景
無法連線至 OpenKeychain
此裝置已不再使用
電腦
@@ -658,13 +655,8 @@
OMEMO 將預設用於新會話。
OMEMO 將明確用於新會話。
建立捷徑
- 字型大小
- 應用程式中使用的相對字型大小。
預設開啟
預設關閉
- 小
- 中
- 大
訊息未對此裝置加密。
無法解密 OMEMO 訊息。
復原
diff --git a/src/main/res/values/arrays.xml b/src/main/res/values/arrays.xml
index 64865db75..6dc8caca6 100644
--- a/src/main/res/values/arrays.xml
+++ b/src/main/res/values/arrays.xml
@@ -94,17 +94,6 @@
- @string/default_on
- @string/default_off
-
- - small
- - medium
- - large
-
-
- - @string/small
- - @string/medium
- - @string/large
-
-
- 360
- 720
diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml
index 89d64f98d..a26eef720 100644
--- a/src/main/res/values/attrs.xml
+++ b/src/main/res/values/attrs.xml
@@ -1,132 +1,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
\ No newline at end of file
diff --git a/src/main/res/values/colors-md.xml b/src/main/res/values/colors-md.xml
new file mode 100644
index 000000000..acf5c69d0
--- /dev/null
+++ b/src/main/res/values/colors-md.xml
@@ -0,0 +1,43 @@
+
+
+
+ #c04CAF50
+
+ #ff2196f3
+
+ #ff8BC34A
+ #ff7CB342
+
+ #ffC8E6C9
+ #ffA5D6A7
+ #ff4CAF50
+ #ff388E3C
+ #ff2E7D32
+
+ #ffFFECB3
+ #ffFFE082
+ #ffFFA000
+ #ffFF8F00
+
+ #ffFFE0B2
+ #ffFFCC80
+ #ffff9800
+ #ffF57C00
+ #ffEF6C00
+
+ #ffFFCDD2
+ #ffEF9A9A
+ #ffF44336
+ #ffD32F2F
+ #ffC62828
+
+
+ #ff9e9e9e
+ #ff757575
+ #ff616161
+ #ff424242
+ #ff212121
+
+ #de000000
+ #8a000000
+
\ No newline at end of file
diff --git a/src/main/res/values/colors.xml b/src/main/res/values/colors.xml
deleted file mode 100644
index 0bbba7c0a..000000000
--- a/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
- #ff000000
- #de000000
- #8a000000
- #42000000
- #1f000000
- #ffffffff
- #deffffff
- #b2ffffff
- #1fffffff
- #fffafafa
- #ffeeeeee
- #ffe0e0e0
- #66e0e0e0
- #ff9e9e9e
- #ff616161
- #66616161
- #ff424242
- #ff282828
- #fff44336
- #ffD32F2F
- #ffd50000
- #ffff8a80
- #ffc62828
- #ffff9800
- #ff82B1FF
- #ff448AFF
- #ff2979FF
- #ff2962FF
- #ff4CAF50
- #ff43A047
- #ff388E3C
- #ff2E7D32
- #ff1B5E20
-
- #ff4d8e50
- #ff295e2d
-
-
- #c04CAF50
-
- #fffafafa
- #ffe0e0e0
-
- #ff2196f3
-
\ No newline at end of file
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index cee84bfd3..b9a106bd4 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -20,7 +20,7 @@
Unblock participant
Manage Accounts
Settings
- Share with Conversation
+ Share with…
Start Conversation
Choose Contact
Choose Contacts
@@ -581,8 +581,8 @@
Automatic
Light
Dark
- Green Background
- Use green background for received messages
+ Colorful chat bubbles
+ Colorful chat bubbles help to distinguish send and received messages
Could not connect to OpenKeychain
This device is no longer in use
Computer
@@ -723,13 +723,10 @@
OMEMO will be used by default for new conversations.
OMEMO will have to be turned on explicitly for new conversations.
Create Shortcut
- Font Size
- The relative font size used within the app.
On by default
Off by default
- Small
- Medium
- Large
+ Dynamic colors
+ System colors (Material You)
Message was not encrypted for this device.
Failed to decrypt OMEMO message.
undo
@@ -810,7 +807,7 @@
Resend SMS
Resend SMS (%s)
Please wait (%s)
- back
+ Back
Automatically pasted possible pin from clipboard.
Please enter your 6 digit pin.
Are you sure you want to abort the registration procedure?
@@ -1030,4 +1027,6 @@
Contact list integration is not available
Call integration not available!
Delete & Close
+ Start chat
+ No client certificate selected!
diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml
deleted file mode 100644
index b6b8b76b0..000000000
--- a/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml
index d73f1c8de..c217f57c9 100644
--- a/src/main/res/values/themes.xml
+++ b/src/main/res/values/themes.xml
@@ -1,416 +1,52 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index b9ea7e871..cde8240a2 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -1,6 +1,5 @@
-
+
-
-
-
+
+
+
+
-
{
diff --git a/src/quicksy/java/eu/siacs/conversations/ui/TosActivity.java b/src/quicksy/java/eu/siacs/conversations/ui/TosActivity.java
index e5dd0f0a7..a15bb2c9c 100644
--- a/src/quicksy/java/eu/siacs/conversations/ui/TosActivity.java
+++ b/src/quicksy/java/eu/siacs/conversations/ui/TosActivity.java
@@ -7,12 +7,12 @@ import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Html;
import android.text.method.LinkMovementMethod;
-import android.widget.Button;
-import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
+import androidx.databinding.DataBindingUtil;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.databinding.ActivityTosBinding;
public class TosActivity extends XmppActivity {
@@ -26,15 +26,6 @@ public class TosActivity extends XmppActivity {
}
- @Override
- public void onStart() {
- super.onStart();
- final int theme = findTheme();
- if (this.mTheme != theme) {
- recreate();
- }
- }
-
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
@@ -49,16 +40,15 @@ public class TosActivity extends XmppActivity {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_tos);
- setSupportActionBar(findViewById(R.id.toolbar));
+ final ActivityTosBinding binding = DataBindingUtil.setContentView(this,R.layout.activity_tos);
+ setSupportActionBar(binding.toolbar);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
final ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayShowHomeEnabled(false);
ab.setDisplayHomeAsUpEnabled(false);
}
- final Button agreeButton = findViewById(R.id.agree);
- final TextView welcomeText = findViewById(R.id.welcome_text);
- agreeButton.setOnClickListener(v -> {
+ binding.agree.setOnClickListener(v -> {
final Intent intent = new Intent(this, EnterPhoneNumberActivity.class);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
preferences.edit().putBoolean("tos", true).apply();
@@ -66,8 +56,8 @@ public class TosActivity extends XmppActivity {
startActivity(intent);
finish();
});
- welcomeText.setText(Html.fromHtml(getString(R.string.welcome_text_quicksy_static)));
- welcomeText.setMovementMethod(LinkMovementMethod.getInstance());
+ binding.welcomeText.setText(Html.fromHtml(getString(R.string.welcome_text_quicksy_static)));
+ binding.welcomeText.setMovementMethod(LinkMovementMethod.getInstance());
}
diff --git a/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java b/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java
index 1e388ce8f..04de01603 100644
--- a/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java
+++ b/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java
@@ -10,6 +10,8 @@ import androidx.databinding.DataBindingUtil;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
+
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.widget.Toolbar;
import android.text.Html;
@@ -100,7 +102,8 @@ public class VerifyActivity extends XmppActivity implements ClipboardManager.OnP
this.retrySmsAfter = savedInstanceState != null ? savedInstanceState.getLong(EXTRA_RETRY_SMS_AFTER, 0L) : 0L;
this.retryVerificationAfter = savedInstanceState != null ? savedInstanceState.getLong(EXTRA_RETRY_VERIFICATION_AFTER, 0L) : 0L;
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_verify);
- setSupportActionBar((Toolbar) this.binding.toolbar);
+ Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
+ setSupportActionBar(this.binding.toolbar);
this.pinEntryWrapper = new PinEntryWrapper(binding.pinBox);
if (pin != null) {
this.pinEntryWrapper.setPin(pin);
@@ -120,7 +123,7 @@ public class VerifyActivity extends XmppActivity implements ClipboardManager.OnP
}
final Intent intent = new Intent(this, EnterPhoneNumberActivity.class);
if (this.account != null) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setMessage(R.string.abort_registration_procedure);
builder.setPositiveButton(R.string.yes, (dialog, which) -> {
xmppConnectionService.deleteAccount(account);
diff --git a/src/quicksy/java/eu/siacs/conversations/ui/drawable/TextDrawable.java b/src/quicksy/java/eu/siacs/conversations/ui/drawable/TextDrawable.java
index 39ec59235..bb26c5c70 100644
--- a/src/quicksy/java/eu/siacs/conversations/ui/drawable/TextDrawable.java
+++ b/src/quicksy/java/eu/siacs/conversations/ui/drawable/TextDrawable.java
@@ -24,9 +24,12 @@ import android.text.Editable;
import android.text.TextWatcher;
import android.widget.TextView;
+import com.google.android.material.color.MaterialColors;
+
import java.lang.ref.WeakReference;
-import eu.siacs.conversations.ui.util.StyledAttributes;
+import eu.siacs.conversations.R;
+
public class TextDrawable extends Drawable implements TextWatcher {
private WeakReference ref;
@@ -64,7 +67,7 @@ public class TextDrawable extends Drawable implements TextWatcher {
*/
public TextDrawable(TextView tv, String initialText, boolean bindToViewsText, boolean bindToViewsPaint) {
this(tv.getPaint(), initialText);
- mPaint.setColor(StyledAttributes.getColor(tv.getContext(), android.R.attr.textColorPrimary));
+ mPaint.setColor(MaterialColors.getColor(tv, com.google.android.material.R.attr.colorOnSurface));
ref = new WeakReference<>(tv);
if (bindToViewsText || bindToViewsPaint) {
if (bindToViewsText) {
diff --git a/src/quicksy/res/layout/activity_choose_country.xml b/src/quicksy/res/layout/activity_choose_country.xml
index 47ba167b1..13dc3de7c 100644
--- a/src/quicksy/res/layout/activity_choose_country.xml
+++ b/src/quicksy/res/layout/activity_choose_country.xml
@@ -4,21 +4,29 @@
-
+
+
+
+
+
+
+ android:scrollbars="vertical" />
diff --git a/src/quicksy/res/layout/activity_enter_name.xml b/src/quicksy/res/layout/activity_enter_name.xml
index d2b8b60f6..4a8a5649a 100644
--- a/src/quicksy/res/layout/activity_enter_name.xml
+++ b/src/quicksy/res/layout/activity_enter_name.xml
@@ -6,9 +6,18 @@
android:layout_height="match_parent"
android:orientation="vertical">
-
+
+
+
+
+
+
+ android:textAppearance="?textAppearanceBodyMedium" />
-
+ android:hint="@string/your_name">
+
+
+
+
+
+ android:layout_margin="16dp"
+ android:text="@string/next" />
diff --git a/src/quicksy/res/layout/activity_enter_number.xml b/src/quicksy/res/layout/activity_enter_number.xml
index b6898d875..5abe98b5d 100644
--- a/src/quicksy/res/layout/activity_enter_number.xml
+++ b/src/quicksy/res/layout/activity_enter_number.xml
@@ -7,9 +7,16 @@
android:layout_height="match_parent"
android:orientation="vertical">
-
+
+
+
+
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:longClickable="false"
+ app:drawableTint="?android:attr/textColorPrimary" />
+ android:layout_margin="16dp"
+ android:text="@string/next" />
-
+
diff --git a/src/quicksy/res/layout/activity_tos.xml b/src/quicksy/res/layout/activity_tos.xml
index 461032e65..ff58b068d 100644
--- a/src/quicksy/res/layout/activity_tos.xml
+++ b/src/quicksy/res/layout/activity_tos.xml
@@ -1,77 +1,93 @@
-
+
-
-
-
-
+ android:orientation="vertical">
-
+
+
-
-
+ android:minHeight="?attr/actionBarSize" />
+
+
+
-
-
-
-
-
-
+
+
+ android:layout_alignParentStart="true"
+ android:layout_alignParentBottom="true"
+ android:minHeight="256dp"
+ android:orientation="vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/quicksy/res/layout/activity_verify.xml b/src/quicksy/res/layout/activity_verify.xml
index 4ecc349c1..aadf3e0f0 100644
--- a/src/quicksy/res/layout/activity_verify.xml
+++ b/src/quicksy/res/layout/activity_verify.xml
@@ -4,12 +4,18 @@
-
+
+
+
+
+ android:textAppearance="?textAppearanceBodyLarge" />
+ android:textAppearance="?textAppearanceBodyMedium" />
+ android:layout_margin="16dp"
+ android:text="@string/back" />
+ android:text="@string/resend_sms" />
-
+
+ android:textAppearance="?textAppearanceTitleLarge"
+ tools:text="Germany" />
+ android:textAppearance="?textAppearanceBodyLarge"
+ tools:text="+49" />
diff --git a/src/quicksy/res/menu/choose_country.xml b/src/quicksy/res/menu/item_choose_country.xml
similarity index 88%
rename from src/quicksy/res/menu/choose_country.xml
rename to src/quicksy/res/menu/item_choose_country.xml
index 209bb27e0..5794fe73a 100644
--- a/src/quicksy/res/menu/choose_country.xml
+++ b/src/quicksy/res/menu/item_choose_country.xml
@@ -5,7 +5,7 @@
diff --git a/src/quicksy/res/values/colors-themed.xml b/src/quicksy/res/values/colors-themed.xml
new file mode 100644
index 000000000..60c985a6f
--- /dev/null
+++ b/src/quicksy/res/values/colors-themed.xml
@@ -0,0 +1,64 @@
+
+
+ #004D40
+ #006B5A
+ #FFFFFF
+ #7AF8DB
+ #00201A
+ #4B635C
+ #FFFFFF
+ #CDE8DF
+ #06201A
+ #984718
+ #FFFFFF
+ #FFDBCC
+ #351000
+ #BA1A1A
+ #FFDAD6
+ #FFFFFF
+ #410002
+ #FAFDFA
+ #191C1B
+ #FAFDFA
+ #191C1B
+ #DBE5E0
+ #3F4945
+ #6F7975
+ #EFF1EF
+ #2E3130
+ #5BDBBF
+ #000000
+ #006B5A
+ #BFC9C4
+ #000000
+ #5BDBBF
+ #00382E
+ #005143
+ #7AF8DB
+ #B1CCC3
+ #1D352F
+ #334B45
+ #CDE8DF
+ #FFB693
+ #562000
+ #7A3001
+ #FFDBCC
+ #FFB4AB
+ #93000A
+ #690005
+ #FFDAD6
+ #191C1B
+ #E1E3E0
+ #191C1B
+ #E1E3E0
+ #3F4945
+ #BFC9C4
+ #89938F
+ #191C1B
+ #E1E3E0
+ #006B5A
+ #000000
+ #5BDBBF
+ #3F4945
+ #000000
+