From e4b900ce005983f879e664a037ee1072b494e669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf-Martell=20Montw=C3=A9?= Date: Wed, 29 May 2024 12:40:17 +0200 Subject: [PATCH] Change TextView to MaterialTextView --- .../com/fsck/k9/activity/AccountList.java | 9 ++-- .../activity/AlternateRecipientAdapter.java | 22 ++++----- .../java/com/fsck/k9/activity/EditIdentity.kt | 28 ++++++------ .../com/fsck/k9/activity/MessageCompose.java | 14 +++--- .../java/com/fsck/k9/activity/MessageList.kt | 6 +-- .../fsck/k9/activity/UpgradeDatabases.java | 4 +- .../k9/activity/compose/IdentityAdapter.java | 17 +++---- .../k9/activity/compose/RecipientAdapter.java | 10 ++--- .../fsck/k9/ui/changelog/ChangelogFragment.kt | 8 ++-- .../fsck/k9/ui/choosefolder/FolderListItem.kt | 4 +- .../endtoend/AutocryptKeyTransferActivity.kt | 6 +-- .../k9/ui/managefolders/FolderListItem.kt | 4 +- .../k9/ui/messagedetails/CryptoStatusItem.kt | 6 +-- .../k9/ui/messagedetails/FolderNameItem.kt | 4 +- .../k9/ui/messagedetails/MessageDateItem.kt | 4 +- .../k9/ui/messagedetails/ParticipantItem.kt | 6 +-- .../k9/ui/messagedetails/SectionHeaderItem.kt | 6 +-- .../k9/ui/messagelist/MessageListAdapter.kt | 3 +- .../k9/ui/messagelist/MessageListFragment.kt | 4 +- .../messagelist/MessageListSwipeCallback.kt | 6 +-- .../ui/messagelist/MessageListViewHolder.kt | 12 ++--- .../messagesource/MessageHeadersFragment.kt | 6 +-- .../k9/ui/messageview/AttachmentView.java | 6 +-- .../k9/ui/messageview/MessageContainerView.kt | 17 ++++++- .../fsck/k9/ui/messageview/MessageTopView.kt | 6 +-- .../k9/ui/messageview/RecipientNamesView.kt | 8 ++-- .../com/fsck/k9/ui/push/PushInfoFragment.kt | 4 +- .../com/fsck/k9/ui/settings/AboutFragment.kt | 8 ++-- .../com/fsck/k9/ui/settings/AccountItem.kt | 6 +-- .../fsck/k9/ui/settings/SettingsActionItem.kt | 4 +- .../k9/ui/settings/SettingsDividerItem.kt | 4 +- .../com/fsck/k9/ui/settings/UrlActionItem.kt | 4 +- .../account/AccountSelectionSpinner.kt | 10 ++--- .../AutocryptPreferEncryptDialogFragment.kt | 6 +-- .../account/OpenPgpAppSelectDialog.java | 3 +- .../account/VibrationDialogFragment.kt | 4 +- .../settings/export/SettingsExportFragment.kt | 8 +++- .../export/SettingsExportListItems.kt | 6 +-- .../java/com/fsck/k9/view/MessageHeader.java | 9 ++-- .../com/fsck/k9/view/RecipientSelectView.java | 20 ++++----- .../src/main/res/layout/about_library.xml | 4 +- .../src/main/res/layout/account_list_item.xml | 4 +- .../res/layout/account_setup_composition.xml | 10 ++--- .../layout/account_spinner_dropdown_item.xml | 4 +- .../main/res/layout/account_spinner_item.xml | 4 +- .../src/main/res/layout/accounts_item.xml | 4 +- .../res/layout/changelog_list_change_item.xml | 4 +- .../layout/changelog_list_release_item.xml | 4 +- .../main/res/layout/choose_account_item.xml | 2 +- .../main/res/layout/choose_identity_item.xml | 4 +- .../main/res/layout/crypto_key_transfer.xml | 16 +++---- .../dialog_autocrypt_prefer_encrypt.xml | 8 ++-- .../res/layout/dialog_openkeychain_info.xml | 2 +- .../src/main/res/layout/edit_identity.xml | 12 ++--- .../main/res/layout/empty_message_view.xml | 4 +- .../src/main/res/layout/folder_list_item.xml | 2 +- .../src/main/res/layout/fragment_about.xml | 30 ++++++------- .../main/res/layout/fragment_changelog.xml | 2 +- .../main/res/layout/fragment_push_info.xml | 4 +- .../res/layout/fragment_settings_export.xml | 2 +- app/ui/legacy/src/main/res/layout/message.xml | 2 +- .../main/res/layout/message_bottom_sheet.xml | 2 +- .../res/layout/message_compose_attachment.xml | 4 +- .../res/layout/message_compose_recipients.xml | 13 +++--- .../src/main/res/layout/message_container.xml | 4 +- .../message_content_crypto_cancelled.xml | 4 +- .../layout/message_content_crypto_error.xml | 6 +-- .../message_content_crypto_incomplete.xml | 6 +-- .../message_content_crypto_no_provider.xml | 4 +- .../res/layout/message_crypto_info_dialog.xml | 45 ------------------- .../message_details_crypto_status_item.xml | 4 +- .../res/layout/message_details_date_item.xml | 3 +- .../message_details_folder_name_item.xml | 2 +- .../message_details_participant_item.xml | 4 +- .../message_details_section_header_item.xml | 4 +- .../src/main/res/layout/message_list.xml | 4 +- .../main/res/layout/message_list_error.xml | 2 +- .../src/main/res/layout/message_list_item.xml | 8 ++-- .../res/layout/message_list_item_footer.xml | 4 +- .../res/layout/message_view_attachment.xml | 4 +- .../layout/message_view_attachment_locked.xml | 4 +- .../main/res/layout/message_view_header.xml | 4 +- .../main/res/layout/message_view_headers.xml | 4 +- .../layout/openpgp_enabled_error_dialog.xml | 4 +- .../openpgp_encrypt_description_dialog.xml | 8 ++-- .../main/res/layout/openpgp_inline_dialog.xml | 10 ++--- .../res/layout/openpgp_sign_only_dialog.xml | 12 ++--- .../preference_vibration_switch_item.xml | 2 +- .../preference_vibration_times_item.xml | 4 +- .../res/layout/recipient_alternate_item.xml | 8 ++-- .../res/layout/recipient_dropdown_item.xml | 6 ++- .../src/main/res/layout/recipient_names.xml | 4 +- .../main/res/layout/recipient_token_item.xml | 2 +- .../settings_export_account_list_item.xml | 4 +- .../settings_export_general_list_item.xml | 2 +- .../src/main/res/layout/swipe_left_action.xml | 2 +- .../main/res/layout/swipe_right_action.xml | 2 +- .../res/layout/text_divider_list_item.xml | 3 +- .../main/res/layout/text_icon_list_item.xml | 2 +- .../src/main/res/layout/upgrade_databases.xml | 2 +- .../java/com/fsck/k9/ViewTestExtensions.kt | 6 --- .../ui/messagelist/MessageListAdapterTest.kt | 14 +++--- .../settings/import/ui/OAuthFlowActivity.kt | 4 +- .../import/ui/PasswordPromptDialogFragment.kt | 13 +++--- .../import/ui/SettingsImportFragment.kt | 4 +- .../import/ui/SettingsImportListItems.kt | 4 +- .../main/res/layout/account_setup_oauth.xml | 4 +- .../res/layout/fragment_settings_import.xml | 2 +- .../res/layout/password_prompt_dialog.xml | 6 +-- .../settings_import_account_list_item.xml | 2 +- .../settings_import_general_list_item.xml | 2 +- 111 files changed, 352 insertions(+), 375 deletions(-) delete mode 100644 app/ui/legacy/src/main/res/layout/message_crypto_info_dialog.xml delete mode 100644 app/ui/legacy/src/test/java/com/fsck/k9/ViewTestExtensions.kt diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/AccountList.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/AccountList.java index 61fd87fb671..eaf791f6d18 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/AccountList.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/AccountList.java @@ -1,5 +1,6 @@ package com.fsck.k9.activity; + import java.util.ArrayList; import java.util.List; @@ -11,14 +12,14 @@ import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; -import android.widget.TextView; import com.fsck.k9.Account; import com.fsck.k9.BaseAccount; import com.fsck.k9.K9; import com.fsck.k9.Preferences; -import com.fsck.k9.ui.R; import com.fsck.k9.search.SearchAccount; +import com.fsck.k9.ui.R; +import com.google.android.material.textview.MaterialTextView; /** @@ -138,8 +139,8 @@ public View getView(int position, View convertView, ViewGroup parent) { } class AccountViewHolder { - public TextView description; - public TextView email; + public MaterialTextView description; + public MaterialTextView email; public View chip; } } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/AlternateRecipientAdapter.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/AlternateRecipientAdapter.java index 46c4bf04046..23f36904eea 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/AlternateRecipientAdapter.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/AlternateRecipientAdapter.java @@ -8,8 +8,6 @@ import android.graphics.PorterDuff.Mode; import android.graphics.Typeface; import android.graphics.drawable.Drawable; -import androidx.annotation.AttrRes; -import androidx.annotation.DrawableRes; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -17,14 +15,16 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; -import android.widget.TextView; +import androidx.annotation.AttrRes; +import androidx.annotation.DrawableRes; import androidx.appcompat.widget.TooltipCompat; import com.fsck.k9.activity.compose.RecipientAdapter; import com.fsck.k9.ui.ContactBadge; import com.fsck.k9.ui.R; import com.fsck.k9.view.RecipientSelectView.Recipient; import com.fsck.k9.view.ThemeUtils; +import com.google.android.material.textview.MaterialTextView; public class AlternateRecipientAdapter extends BaseAdapter { @@ -124,10 +124,10 @@ public void bindHeaderView(View view, Recipient recipient) { holder.headerName.setText(recipient.getNameOrUnknown(context)); if (!TextUtils.isEmpty(recipient.addressLabel)) { - holder.headerAddressLabel.setText(recipient.addressLabel); - holder.headerAddressLabel.setVisibility(View.VISIBLE); + holder.headerLabel.setText(recipient.addressLabel); + holder.headerLabel.setVisibility(View.VISIBLE); } else { - holder.headerAddressLabel.setVisibility(View.GONE); + holder.headerLabel.setVisibility(View.GONE); } RecipientAdapter.setContactPhotoOrPlaceholder(context, holder.headerPhoto, recipient); @@ -236,13 +236,13 @@ public void setShowAdvancedInfo(boolean showAdvancedInfo) { private static class RecipientTokenHolder { public final View layoutHeader, layoutItem; - public final TextView headerName; - public final TextView headerAddressLabel; + public final MaterialTextView headerName; + public final MaterialTextView headerLabel; public final ContactBadge headerPhoto; public final View headerRemove; public final View copyEmailAddress; - public final TextView itemAddress; - public final TextView itemAddressLabel; + public final MaterialTextView itemAddress; + public final MaterialTextView itemAddressLabel; public final View itemCryptoStatus; public final ImageView itemCryptoStatusIcon; public final ImageView itemCryptoStatusSimple; @@ -253,7 +253,7 @@ public RecipientTokenHolder(View view) { layoutItem = view.findViewById(R.id.alternate_container_item); headerName = view.findViewById(R.id.alternate_header_name); - headerAddressLabel = view.findViewById(R.id.alternate_header_label); + headerLabel = view.findViewById(R.id.alternate_header_label); headerPhoto = view.findViewById(R.id.alternate_contact_photo); headerRemove = view.findViewById(R.id.alternate_remove); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/EditIdentity.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/EditIdentity.kt index 0c6d26c67aa..7e97fafda33 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/EditIdentity.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/EditIdentity.kt @@ -4,7 +4,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import android.view.View -import android.widget.TextView +import android.widget.EditText import androidx.core.content.IntentCompat import androidx.core.os.BundleCompat import androidx.core.view.isVisible @@ -24,12 +24,12 @@ class EditIdentity : K9Activity() { private lateinit var account: Account private lateinit var identity: Identity - private lateinit var description: TextView - private lateinit var name: TextView - private lateinit var email: TextView - private lateinit var replyTo: TextView + private lateinit var description: EditText + private lateinit var name: EditText + private lateinit var email: EditText + private lateinit var replyTo: EditText private lateinit var signatureUse: MaterialCheckBox - private lateinit var signature: TextView + private lateinit var signature: EditText private lateinit var signatureLayout: View private var identityIndex: Int = 0 @@ -67,23 +67,23 @@ class EditIdentity : K9Activity() { signature = findViewById(R.id.signature) signatureLayout = findViewById(R.id.signature_layout) - description.text = identity.description - name.text = identity.name - email.text = identity.email - replyTo.text = identity.replyTo + description.setText(identity.description) + name.setText(identity.name) + email.setText(identity.email) + replyTo.setText(identity.replyTo) signatureUse.isChecked = identity.signatureUse signatureUse.setOnCheckedChangeListener { _, isChecked -> if (isChecked) { signatureLayout.isVisible = true - signature.text = identity.signature + signature.setText(identity.signature) } else { signatureLayout.isVisible = false } } if (signatureUse.isChecked) { - signature.text = identity.signature + signature.setText(identity.signature) } else { signatureLayout.isVisible = false } @@ -104,11 +104,11 @@ class EditIdentity : K9Activity() { invalidateOptionsMenu() } - private fun isValidEmailAddress(textView: TextView): Boolean { + private fun isValidEmailAddress(textView: EditText): Boolean { return emailAddressValidator.isValidAddressOnly(textView.text.trim()) } - private fun isValidEmailAddressOrEmpty(textView: TextView): Boolean { + private fun isValidEmailAddressOrEmpty(textView: EditText): Boolean { return textView.text.isBlank() || isValidEmailAddress(textView) } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java index 634eb4a5cf2..fdf17848fb4 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java @@ -38,7 +38,6 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; @@ -117,6 +116,7 @@ import com.fsck.k9.ui.helper.SizeFormatter; import com.fsck.k9.ui.messagelist.DefaultFolderProvider; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.textview.MaterialTextView; import org.openintents.openpgp.OpenPgpApiManager; import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpIntentStarter; @@ -224,7 +224,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, private boolean requestReadReceipt = false; - private TextView chooseIdentityButton; + private MaterialTextView chooseIdentityView; private EditText subjectView; private EditText signatureView; private EditText messageContentView; @@ -298,8 +298,8 @@ public void onCreate(Bundle savedInstanceState) { return; } - chooseIdentityButton = findViewById(R.id.identity); - chooseIdentityButton.setOnClickListener(this); + chooseIdentityView = findViewById(R.id.identity); + chooseIdentityView.setOnClickListener(this); ReplyToView replyToView = new ReplyToView(this); replyToPresenter = new ReplyToPresenter(replyToView); @@ -937,7 +937,7 @@ private void switchToIdentity(Identity identity) { } private void updateFrom() { - chooseIdentityButton.setText(identity.getEmail()); + chooseIdentityView.setText(identity.getEmail()); } private void updateSignature() { @@ -1828,7 +1828,7 @@ public void updateAttachmentView(Attachment attachment) { throw new IllegalArgumentException(); } - TextView nameView = view.findViewById(R.id.attachment_name); + MaterialTextView nameView = view.findViewById(R.id.attachment_name); boolean hasMetadata = (attachment.state != Attachment.LoadingState.URI_ONLY); if (hasMetadata) { nameView.setText(attachment.name); @@ -1837,7 +1837,7 @@ public void updateAttachmentView(Attachment attachment) { } if (attachment.size != null && attachment.size >= 0) { - TextView sizeView = view.findViewById(R.id.attachment_size); + MaterialTextView sizeView = view.findViewById(R.id.attachment_size); sizeView.setText(sizeFormatter.formatSize(attachment.size)); } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 2c302eaf3bb..5adcad19d1e 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -12,7 +12,6 @@ import android.view.MenuItem import android.view.View import android.view.animation.AnimationUtils import android.widget.ProgressBar -import android.widget.TextView import androidx.appcompat.app.ActionBar import androidx.appcompat.view.ActionMode import androidx.appcompat.widget.SearchView @@ -61,6 +60,7 @@ import com.fsck.k9.ui.messageview.MessageViewFragment.MessageViewFragmentListene import com.fsck.k9.ui.messageview.PlaceholderFragment import com.fsck.k9.view.ViewSwitcher import com.fsck.k9.view.ViewSwitcher.OnSwitchCompleteListener +import com.google.android.material.textview.MaterialTextView import com.mikepenz.materialdrawer.util.getOptimalDrawerWidth import org.koin.android.ext.android.inject import org.koin.core.component.KoinComponent @@ -934,8 +934,8 @@ open class MessageList : } private fun setActionBarTitle(title: String, subtitle: String? = null) { - findViewById(R.id.toolbarTitle).text = title - findViewById(R.id.toolbarSubtitle).apply { + findViewById(R.id.toolbarTitle).text = title + findViewById(R.id.toolbarSubtitle).apply { if (subtitle != null) { text = subtitle isGone = false diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/UpgradeDatabases.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/UpgradeDatabases.java index a3b1e083e6a..d9491ce861d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/UpgradeDatabases.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/UpgradeDatabases.java @@ -8,7 +8,6 @@ import android.content.IntentFilter; import android.content.SharedPreferences; import android.os.Bundle; -import android.widget.TextView; import androidx.core.content.IntentCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; @@ -20,6 +19,7 @@ import com.fsck.k9.service.DatabaseUpgradeService; import com.fsck.k9.ui.R; import com.fsck.k9.ui.base.K9Activity; +import com.google.android.material.textview.MaterialTextView; /** @@ -96,7 +96,7 @@ public static boolean actionUpgradeDatabases(Context context, Intent startIntent private Intent mStartIntent; - private TextView mUpgradeText; + private MaterialTextView mUpgradeText; private LocalBroadcastManager mLocalBroadcastManager; private UpgradeDatabaseBroadcastReceiver mBroadcastReceiver; diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/IdentityAdapter.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/IdentityAdapter.java index 702d9d1d6f8..3c79f0487e9 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/IdentityAdapter.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/IdentityAdapter.java @@ -1,11 +1,15 @@ package com.fsck.k9.activity.compose; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; -import android.widget.TextView; import com.fsck.k9.Account; import com.fsck.k9.DI; @@ -13,10 +17,7 @@ import com.fsck.k9.Preferences; import com.fsck.k9.ui.R; import com.fsck.k9.ui.identity.IdentityFormatter; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +import com.google.android.material.textview.MaterialTextView; /** * Adapter for the Choose identity list view. @@ -140,12 +141,12 @@ public static class IdentityContainer { } static class AccountHolder { - public TextView name; + public MaterialTextView name; public View chip; } static class IdentityHolder { - public TextView name; - public TextView description; + public MaterialTextView name; + public MaterialTextView description; } } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientAdapter.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientAdapter.java index f033c9d8166..e82e980a681 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientAdapter.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientAdapter.java @@ -7,8 +7,6 @@ import android.content.Context; import android.graphics.drawable.Drawable; -import androidx.core.content.ContextCompat; -import androidx.core.graphics.drawable.DrawableCompat; import android.text.Spannable; import android.text.style.ForegroundColorSpan; import android.view.LayoutInflater; @@ -18,13 +16,15 @@ import android.widget.Filter; import android.widget.Filterable; import android.widget.ImageView; -import android.widget.TextView; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; import com.fsck.k9.activity.misc.ContactPicture; import com.fsck.k9.ui.R; import com.fsck.k9.view.RecipientSelectView.Recipient; import com.fsck.k9.view.RecipientSelectView.RecipientCryptoStatus; import com.fsck.k9.view.ThemeUtils; +import com.google.android.material.textview.MaterialTextView; public class RecipientAdapter extends BaseAdapter implements Filterable { @@ -185,8 +185,8 @@ public void setShowAdvancedInfo(boolean showAdvancedInfo) { private static class RecipientTokenHolder { - public final TextView name; - public final TextView email; + public final MaterialTextView name; + public final MaterialTextView email; final ImageView photo; final View cryptoStatus; final ImageView cryptoStatusIcon; diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/changelog/ChangelogFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/changelog/ChangelogFragment.kt index f56f1a1a3d7..4e872fdcef6 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/changelog/ChangelogFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/changelog/ChangelogFragment.kt @@ -4,7 +4,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.TextView import androidx.fragment.app.Fragment import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.ViewHolder @@ -12,6 +11,7 @@ import app.k9mail.core.android.common.compat.BundleCompat import com.fsck.k9.ui.R import com.fsck.k9.ui.base.loader.observeLoading import com.google.android.material.checkbox.MaterialCheckBox +import com.google.android.material.textview.MaterialTextView import de.cketti.changelog.ReleaseItem import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.core.parameter.parametersOf @@ -108,10 +108,10 @@ class ChangelogAdapter(releaseItems: List) : RecyclerView.Adapter(view) { - private val titleTextView = view.findViewById(R.id.crypto_status_title) - private val descriptionTextView = view.findViewById(R.id.crypto_status_description) + private val titleTextView = view.findViewById(R.id.crypto_status_title) + private val descriptionTextView = view.findViewById(R.id.crypto_status_description) private val imageView = view.findViewById(R.id.crypto_status_icon) private val originalBackground = view.background diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/FolderNameItem.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/FolderNameItem.kt index deb3b30bfb8..a79fdd65ec8 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/FolderNameItem.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/FolderNameItem.kt @@ -2,9 +2,9 @@ package com.fsck.k9.ui.messagedetails import android.view.View import android.widget.ImageView -import android.widget.TextView import androidx.annotation.DrawableRes import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.items.AbstractItem @@ -19,7 +19,7 @@ internal class FolderNameItem( class ViewHolder(view: View) : FastAdapter.ViewHolder(view) { private val folderIcon: ImageView = view.findViewById(R.id.folder_icon) - private val folderName = view.findViewById(R.id.folder_name) + private val folderName = view.findViewById(R.id.folder_name) override fun bindView(item: FolderNameItem, payloads: List) { folderName.text = item.displayName diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/MessageDateItem.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/MessageDateItem.kt index 0c5a52d7f35..16f54a250fb 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/MessageDateItem.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/MessageDateItem.kt @@ -1,8 +1,8 @@ package com.fsck.k9.ui.messagedetails import android.view.View -import android.widget.TextView import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.items.AbstractItem @@ -13,7 +13,7 @@ internal class MessageDateItem(private val date: String) : AbstractItem(view) { - private val textView = view.findViewById(R.id.date) + private val textView = view.findViewById(R.id.date) override fun bindView(item: MessageDateItem, payloads: List) { textView.text = item.date diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/ParticipantItem.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/ParticipantItem.kt index efe066d200c..3e16c7c01df 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/ParticipantItem.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/ParticipantItem.kt @@ -2,11 +2,11 @@ package com.fsck.k9.ui.messagedetails import android.view.View import android.widget.ImageView -import android.widget.TextView import androidx.appcompat.widget.TooltipCompat import androidx.core.view.isVisible import com.fsck.k9.contacts.ContactPictureLoader import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.items.AbstractItem @@ -26,8 +26,8 @@ internal class ParticipantItem( val menuOverflow: View = view.findViewById(R.id.menu_overflow) private val contactPicture: ImageView = view.findViewById(R.id.contact_picture) - private val name = view.findViewById(R.id.name) - private val email = view.findViewById(R.id.email) + private val name = view.findViewById(R.id.name) + private val email = view.findViewById(R.id.email) private val originalBackground = view.background init { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/SectionHeaderItem.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/SectionHeaderItem.kt index 0e2e7846ef9..639bfc994b8 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/SectionHeaderItem.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagedetails/SectionHeaderItem.kt @@ -1,8 +1,8 @@ package com.fsck.k9.ui.messagedetails import android.view.View -import android.widget.TextView import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.items.AbstractItem @@ -16,8 +16,8 @@ internal class SectionHeaderItem( override fun getViewHolder(v: View) = ViewHolder(v) class ViewHolder(view: View) : FastAdapter.ViewHolder(view) { - private val textView = view.findViewById(R.id.title) - private val extraTextView = view.findViewById(R.id.extra) + private val textView = view.findViewById(R.id.title) + private val extraTextView = view.findViewById(R.id.extra) override fun bindView(item: SectionHeaderItem, payloads: List) { textView.text = item.title diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt index 1943b2e1d4e..bb697e6904d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt @@ -33,6 +33,7 @@ import com.fsck.k9.mail.Address import com.fsck.k9.ui.R import com.fsck.k9.ui.helper.RelativeDateTimeFormatter import com.fsck.k9.ui.resolveColorAttribute +import com.google.android.material.textview.MaterialTextView import kotlin.math.max private const val FOOTER_ID = 1L @@ -437,7 +438,7 @@ class MessageListAdapter internal constructor( holder.text.text = footerText } - private fun formatPreviewText(preview: TextView, beforePreviewText: CharSequence, messageRead: Boolean) { + private fun formatPreviewText(preview: MaterialTextView, beforePreviewText: CharSequence, messageRead: Boolean) { val previewText = preview.text as Spannable val beforePreviewLength = beforePreviewText.length diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListFragment.kt index d2c287c0155..483ae9cad5f 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListFragment.kt @@ -11,7 +11,6 @@ import android.view.Menu import android.view.MenuItem import android.view.View import android.view.ViewGroup -import android.widget.TextView import android.widget.Toast import androidx.annotation.StringRes import androidx.appcompat.view.ActionMode @@ -57,6 +56,7 @@ import com.fsck.k9.ui.messagelist.MessageListFragment.MessageListFragmentListene import com.google.android.material.floatingactionbutton.FloatingActionButton import com.google.android.material.snackbar.BaseTransientBottomBar.BaseCallback import com.google.android.material.snackbar.Snackbar +import com.google.android.material.textview.MaterialTextView import java.util.concurrent.Future import kotlinx.datetime.Clock import net.jcip.annotations.GuardedBy @@ -268,7 +268,7 @@ class MessageListFragment : } private fun initializeErrorLayout(view: View) { - val errorMessageView = view.findViewById(R.id.message_list_error_message) + val errorMessageView = view.findViewById(R.id.message_list_error_message) errorMessageView.text = getString(error!!.errorText) } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListSwipeCallback.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListSwipeCallback.kt index c4b846a15d5..a64a6cf049f 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListSwipeCallback.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListSwipeCallback.kt @@ -9,7 +9,6 @@ import android.view.LayoutInflater import android.view.View import android.view.View.MeasureSpec import android.widget.ImageView -import android.widget.TextView import androidx.core.graphics.withTranslation import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.ViewHolder @@ -17,6 +16,7 @@ import app.k9mail.ui.utils.itemtouchhelper.ItemTouchHelper import com.fsck.k9.SwipeAction import com.fsck.k9.ui.R import com.google.android.material.color.ColorRoles +import com.google.android.material.textview.MaterialTextView import kotlin.math.abs @SuppressLint("InflateParams") @@ -35,10 +35,10 @@ class MessageListSwipeCallback( private val swipeRightLayout: View private val swipeRightIcon: ImageView - private val swipeRightText: TextView + private val swipeRightText: MaterialTextView private val swipeLeftLayout: View private val swipeLeftIcon: ImageView - private val swipeLeftText: TextView + private val swipeLeftText: MaterialTextView private val swipeRightConfig: SwipeActionConfig private val swipeLeftConfig: SwipeActionConfig diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListViewHolder.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListViewHolder.kt index 95247ae6aef..114fc0cfb51 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListViewHolder.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListViewHolder.kt @@ -2,9 +2,9 @@ package com.fsck.k9.ui.messagelist import android.view.View import android.widget.ImageView -import android.widget.TextView import androidx.recyclerview.widget.RecyclerView.ViewHolder import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView sealed class MessageListViewHolder(view: View) : ViewHolder(view) @@ -13,11 +13,11 @@ class MessageViewHolder(view: View) : MessageListViewHolder(view) { val selected: View = view.findViewById(R.id.selected) val contactPicture: ImageView = view.findViewById(R.id.contact_picture) - val subject: TextView = view.findViewById(R.id.subject) - val preview: TextView = view.findViewById(R.id.preview) - val date: TextView = view.findViewById(R.id.date) + val subject: MaterialTextView = view.findViewById(R.id.subject) + val preview: MaterialTextView = view.findViewById(R.id.preview) + val date: MaterialTextView = view.findViewById(R.id.date) val chip: ImageView = view.findViewById(R.id.account_color_chip) - val threadCount: TextView = view.findViewById(R.id.thread_count) + val threadCount: MaterialTextView = view.findViewById(R.id.thread_count) val star: ImageView = view.findViewById(R.id.star) val starClickArea: View = view.findViewById(R.id.star_click_area) val attachment: ImageView = view.findViewById(R.id.attachment) @@ -25,5 +25,5 @@ class MessageViewHolder(view: View) : MessageListViewHolder(view) { } class FooterViewHolder(view: View) : MessageListViewHolder(view) { - val text: TextView = view.findViewById(R.id.main_text) + val text: MaterialTextView = view.findViewById(R.id.main_text) } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagesource/MessageHeadersFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagesource/MessageHeadersFragment.kt index b66020578e6..74f6e6eaae2 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagesource/MessageHeadersFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagesource/MessageHeadersFragment.kt @@ -8,7 +8,6 @@ import android.text.style.StyleSpan import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.TextView import androidx.fragment.app.Fragment import com.fsck.k9.controller.MessageReference import com.fsck.k9.mail.Header @@ -16,6 +15,7 @@ import com.fsck.k9.mail.internet.MimeUtility import com.fsck.k9.ui.R import com.fsck.k9.ui.base.loader.observeLoading import com.fsck.k9.ui.withArguments +import com.google.android.material.textview.MaterialTextView import org.koin.androidx.viewmodel.ext.android.viewModel class MessageHeadersFragment : Fragment() { @@ -33,7 +33,7 @@ class MessageHeadersFragment : Fragment() { val messageReference = MessageReference.parse(messageReferenceString) ?: error("Invalid message reference: $messageReferenceString") - val messageHeaderView = view.findViewById(R.id.message_source) + val messageHeaderView = view.findViewById(R.id.message_source) messageHeadersViewModel.loadHeaders(messageReference).observeLoading( owner = this, @@ -45,7 +45,7 @@ class MessageHeadersFragment : Fragment() { } } - private fun populateHeadersList(messageHeaderView: TextView, headers: List
) { + private fun populateHeadersList(messageHeaderView: MaterialTextView, headers: List
) { val sb = SpannableStringBuilder() var first = true for ((name, value) in headers) { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java index 1d56b97a03f..2c6ec3a0c3a 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java @@ -8,7 +8,6 @@ import android.view.View.OnClickListener; import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.TextView; import app.k9mail.core.ui.legacy.designsystem.atom.icon.Icons; import com.bumptech.glide.Glide; @@ -18,6 +17,7 @@ import com.fsck.k9.ui.R; import com.fsck.k9.ui.helper.ContextHelper; import com.fsck.k9.ui.helper.SizeFormatter; +import com.google.android.material.textview.MaterialTextView; public class AttachmentView extends FrameLayout implements OnClickListener { @@ -78,7 +78,7 @@ private void displayAttachmentInformation() { cardView.setOnClickListener(this); saveButton.setOnClickListener(this); - TextView attachmentName = findViewById(R.id.attachment_name); + MaterialTextView attachmentName = findViewById(R.id.attachment_name); attachmentName.setText(attachment.displayName); setAttachmentSize(attachment.size); @@ -94,7 +94,7 @@ private void displayAttachmentInformation() { } private void setAttachmentSize(long size) { - TextView attachmentSize = findViewById(R.id.attachment_size); + MaterialTextView attachmentSize = findViewById(R.id.attachment_size); if (size == AttachmentViewInfo.UNKNOWN_SIZE) { attachmentSize.setText(""); } else { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.kt index 0fe80c2757c..c1c377027f7 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.kt @@ -21,7 +21,6 @@ import android.view.ViewGroup import android.webkit.WebView import android.webkit.WebView.HitTestResult import android.widget.LinearLayout -import android.widget.TextView import android.widget.Toast import androidx.core.app.ShareCompat.IntentBuilder import androidx.core.view.isGone @@ -38,6 +37,7 @@ import com.fsck.k9.ui.R import com.fsck.k9.view.MessageWebView import com.fsck.k9.view.MessageWebView.OnPageFinishedListener import com.fsck.k9.view.WebViewConfigProvider +import com.google.android.material.textview.MaterialTextView import org.koin.core.component.KoinComponent import org.koin.core.component.inject import org.koin.core.qualifier.named @@ -58,7 +58,7 @@ class MessageContainerView(context: Context, attrs: AttributeSet?) : private lateinit var attachmentsContainer: ViewGroup private lateinit var unsignedTextContainer: View private lateinit var unsignedTextDivider: View - private lateinit var unsignedText: TextView + private lateinit var unsignedText: MaterialTextView private var isShowingPictures = false private var currentHtmlText: String? = null @@ -101,15 +101,19 @@ class MessageContainerView(context: Context, attrs: AttributeSet?) : HitTestResult.SRC_ANCHOR_TYPE -> { createLinkMenu(menu, webView, linkUrl = hitTestResult.extra) } + HitTestResult.IMAGE_TYPE -> { createImageMenu(menu, imageUrl = hitTestResult.extra) } + HitTestResult.SRC_IMAGE_ANCHOR_TYPE -> { createImageLinkMenu(menu, webView, imageUrl = hitTestResult.extra) } + HitTestResult.PHONE_TYPE -> { createPhoneNumberMenu(menu, phoneNumber = hitTestResult.extra) } + HitTestResult.EMAIL_TYPE -> { createEmailMenu(menu, email = hitTestResult.extra) } @@ -130,16 +134,19 @@ class MessageContainerView(context: Context, attrs: AttributeSet?) : val intent = Intent(Intent.ACTION_VIEW, Uri.parse(linkUrl)) startActivityIfAvailable(context, intent) } + MENU_ITEM_LINK_SHARE -> { IntentBuilder(context) .setType("text/plain") .setText(linkUrl) .startChooser() } + MENU_ITEM_LINK_COPY -> { val label = context.getString(R.string.webview_contextmenu_link_clipboard_label) clipboardManager.setText(label, linkUrl) } + MENU_ITEM_LINK_TEXT_COPY -> { val message = linkTextHandler.obtainMessage() webView.requestFocusNodeHref(message) @@ -202,6 +209,7 @@ class MessageContainerView(context: Context, attrs: AttributeSet?) : startActivityIfAvailable(context, intent) } } + MENU_ITEM_IMAGE_SAVE -> { if (inlineImage) { attachmentCallback.onSaveAttachment(attachmentViewInfo) @@ -209,6 +217,7 @@ class MessageContainerView(context: Context, attrs: AttributeSet?) : downloadImage(imageUri) } } + MENU_ITEM_IMAGE_COPY -> { val label = context.getString(R.string.webview_contextmenu_image_clipboard_label) clipboardManager.setText(label, imageUri.toString()) @@ -270,10 +279,12 @@ class MessageContainerView(context: Context, attrs: AttributeSet?) : val intent = Intent(Intent.ACTION_VIEW, uri) startActivityIfAvailable(context, intent) } + MENU_ITEM_PHONE_SAVE -> { val intent = ContactIntentHelper.getAddPhoneContactIntent(phoneNumber) startActivityIfAvailable(context, intent) } + MENU_ITEM_PHONE_COPY -> { val label = context.getString(R.string.webview_contextmenu_phone_clipboard_label) clipboardManager.setText(label, phoneNumber) @@ -316,10 +327,12 @@ class MessageContainerView(context: Context, attrs: AttributeSet?) : val intent = Intent(Intent.ACTION_VIEW, uri) startActivityIfAvailable(context, intent) } + MENU_ITEM_EMAIL_SAVE -> { val intent = ContactIntentHelper.getAddEmailContactIntent(Address(email)) startActivityIfAvailable(context, intent) } + MENU_ITEM_EMAIL_COPY -> { val label = context.getString(R.string.webview_contextmenu_email_clipboard_label) clipboardManager.setText(label, email) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.kt index ea07a6402c8..957ee803cb6 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.kt @@ -15,7 +15,6 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.LinearLayout import android.widget.ProgressBar -import android.widget.TextView import app.k9mail.core.android.common.contact.ContactRepository import app.k9mail.core.common.mail.EmailAddress import app.k9mail.core.common.mail.toEmailAddressOrNull @@ -30,6 +29,7 @@ import com.fsck.k9.view.MessageHeader import com.fsck.k9.view.ThemeUtils import com.fsck.k9.view.ToolableViewAnimator import com.google.android.material.button.MaterialButton +import com.google.android.material.textview.MaterialTextView import org.koin.core.component.KoinComponent import org.koin.core.component.inject @@ -44,7 +44,7 @@ class MessageTopView( private lateinit var viewAnimator: ToolableViewAnimator private lateinit var progressBar: ProgressBar - private lateinit var progressText: TextView + private lateinit var progressText: MaterialTextView lateinit var messageHeaderView: MessageHeader @@ -152,7 +152,7 @@ class MessageTopView( resetAndPrepareMessageView(messageViewInfo) val view = layoutInflater.inflate(R.layout.message_content_crypto_error, containerView, false) setCryptoProviderIcon(providerIcon, view) - val cryptoErrorText = view.findViewById(R.id.crypto_error_text) + val cryptoErrorText = view.findViewById(R.id.crypto_error_text) val openPgpError = messageViewInfo.cryptoResultAnnotation.openPgpError if (openPgpError != null) { val errorText = openPgpError.message diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/RecipientNamesView.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/RecipientNamesView.kt index a5b4226c3ce..b62233ce459 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/RecipientNamesView.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/RecipientNamesView.kt @@ -5,9 +5,9 @@ import android.util.AttributeSet import android.util.TypedValue import android.view.LayoutInflater import android.view.ViewGroup -import android.widget.TextView import androidx.core.view.isGone import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView private const val MAX_NUMBER_OF_RECIPIENT_NAMES = 5 @@ -30,8 +30,8 @@ class RecipientNamesView(context: Context, attrs: AttributeSet?) : ViewGroup(con private val recipientLayoutCreator: RecipientLayoutCreator - private val recipientNameTextView: TextView - private val recipientCountTextView: TextView + private val recipientNameTextView: MaterialTextView + private val recipientCountTextView: MaterialTextView private val additionRecipientSpacing: Int init { @@ -53,7 +53,7 @@ class RecipientNamesView(context: Context, attrs: AttributeSet?) : ViewGroup(con return measureWidth(recipientCountTextView, text) } - private fun measureWidth(textView: TextView, text: CharSequence): Int { + private fun measureWidth(textView: MaterialTextView, text: CharSequence): Int { textView.text = text val widthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/push/PushInfoFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/push/PushInfoFragment.kt index bfbf52acde1..819878195a5 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/push/PushInfoFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/push/PushInfoFragment.kt @@ -9,7 +9,6 @@ import android.provider.Settings import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.TextView import android.widget.Toast import androidx.annotation.RequiresApi import androidx.core.view.isVisible @@ -18,6 +17,7 @@ import com.fsck.k9.controller.push.PushController import com.fsck.k9.notification.NotificationChannelManager import com.fsck.k9.ui.R import com.google.android.material.button.MaterialButton +import com.google.android.material.textview.MaterialTextView import org.koin.android.ext.android.inject private const val LEARN_MORE_URL = "https://k9mail.app/go/push-info" @@ -36,7 +36,7 @@ class PushInfoFragment : Fragment() { } private fun initializeNotificationSection(view: View) { - val notificationTextView = view.findViewById(R.id.notificationText) + val notificationTextView = view.findViewById(R.id.notificationText) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val configureNotificationText = getString(R.string.push_info_configure_notification_text) notificationTextView.text = getString( diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/AboutFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/AboutFragment.kt index 7b1b6e3c76f..98e78ab2115 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/AboutFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/AboutFragment.kt @@ -9,13 +9,13 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.TextView import android.widget.Toast import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView import timber.log.Timber class AboutFragment : Fragment() { @@ -26,7 +26,7 @@ class AboutFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - val versionTextView = view.findViewById(R.id.version) + val versionTextView = view.findViewById(R.id.version) versionTextView.text = getVersionNumber() val versionLayout = view.findViewById(R.id.versionLayout) @@ -192,8 +192,8 @@ private class LibrariesAdapter(private val dataset: Array) : RecyclerView.Adapter() { class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { - val name: TextView = view.findViewById(R.id.name) - val license: TextView = view.findViewById(R.id.license) + val name: MaterialTextView = view.findViewById(R.id.name) + val license: MaterialTextView = view.findViewById(R.id.license) } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/AccountItem.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/AccountItem.kt index b119822dcd1..62c70279c8e 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/AccountItem.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/AccountItem.kt @@ -3,12 +3,12 @@ package com.fsck.k9.ui.settings import android.view.MotionEvent import android.view.View import android.widget.ImageView -import android.widget.TextView import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import com.fsck.k9.Account import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.drag.IDraggable import com.mikepenz.fastadapter.items.AbstractItem @@ -27,8 +27,8 @@ internal class AccountItem( override fun getViewHolder(v: View) = ViewHolder(v) class ViewHolder(view: View) : FastAdapter.ViewHolder(view) { - val name: TextView = view.findViewById(R.id.name) - val email: TextView = view.findViewById(R.id.email) + val name: MaterialTextView = view.findViewById(R.id.name) + val email: MaterialTextView = view.findViewById(R.id.email) val dragHandle: ImageView = view.findViewById(R.id.drag_handle) override fun bindView(item: AccountItem, payloads: List) { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsActionItem.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsActionItem.kt index 32b3bd986b2..0a31d9fa506 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsActionItem.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsActionItem.kt @@ -2,10 +2,10 @@ package com.fsck.k9.ui.settings import android.view.View import android.widget.ImageView -import android.widget.TextView import androidx.annotation.DrawableRes import androidx.annotation.IdRes import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.items.AbstractItem @@ -22,7 +22,7 @@ internal class SettingsActionItem( override fun getViewHolder(v: View) = ViewHolder(v) class ViewHolder(view: View) : FastAdapter.ViewHolder(view) { - val text: TextView = view.findViewById(R.id.text) + val text: MaterialTextView = view.findViewById(R.id.text) val icon: ImageView = view.findViewById(R.id.icon) override fun bindView(item: SettingsActionItem, payloads: List) { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsDividerItem.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsDividerItem.kt index 4fad2b75f29..178716c6cd9 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsDividerItem.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/SettingsDividerItem.kt @@ -1,8 +1,8 @@ package com.fsck.k9.ui.settings import android.view.View -import android.widget.TextView import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.items.AbstractItem @@ -17,7 +17,7 @@ internal class SettingsDividerItem( override fun getViewHolder(v: View) = ViewHolder(v) class ViewHolder(view: View) : FastAdapter.ViewHolder(view) { - val text: TextView = view.findViewById(R.id.text) + val text: MaterialTextView = view.findViewById(R.id.text) override fun bindView(item: SettingsDividerItem, payloads: List) { text.text = item.text diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/UrlActionItem.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/UrlActionItem.kt index 28ffb0ca574..db13c5a6144 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/UrlActionItem.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/UrlActionItem.kt @@ -2,9 +2,9 @@ package com.fsck.k9.ui.settings import android.view.View import android.widget.ImageView -import android.widget.TextView import androidx.annotation.DrawableRes import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.items.AbstractItem @@ -21,7 +21,7 @@ internal class UrlActionItem( override fun getViewHolder(v: View) = ViewHolder(v) class ViewHolder(view: View) : FastAdapter.ViewHolder(view) { - val text: TextView = view.findViewById(R.id.text) + val text: MaterialTextView = view.findViewById(R.id.text) val icon: ImageView = view.findViewById(R.id.icon) override fun bindView(item: UrlActionItem, payloads: List) { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSelectionSpinner.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSelectionSpinner.kt index 83b4eeecf60..cf42c999c4f 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSelectionSpinner.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSelectionSpinner.kt @@ -7,11 +7,11 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ArrayAdapter -import android.widget.TextView import androidx.appcompat.widget.AppCompatSpinner import androidx.core.view.isVisible import com.fsck.k9.Account import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView class AccountSelectionSpinner : AppCompatSpinner { var selection: Account @@ -60,8 +60,8 @@ class AccountSelectionSpinner : AppCompatSpinner { val view = convertView ?: LayoutInflater.from(context).inflate(R.layout.account_spinner_item, parent, false) - val name: TextView = view.findViewById(R.id.name) - val email: TextView = view.findViewById(R.id.email) + val name: MaterialTextView = view.findViewById(R.id.name) + val email: MaterialTextView = view.findViewById(R.id.email) return view.apply { name.text = title @@ -75,8 +75,8 @@ class AccountSelectionSpinner : AppCompatSpinner { val view = convertView ?: LayoutInflater.from(context).inflate(R.layout.account_spinner_dropdown_item, parent, false) - val name: TextView = view.findViewById(R.id.name) - val email: TextView = view.findViewById(R.id.email) + val name: MaterialTextView = view.findViewById(R.id.name) + val email: MaterialTextView = view.findViewById(R.id.email) return view.apply { val accountName = account.name diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AutocryptPreferEncryptDialogFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AutocryptPreferEncryptDialogFragment.kt index 42d3c7455e6..a1cc9b15a99 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AutocryptPreferEncryptDialogFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AutocryptPreferEncryptDialogFragment.kt @@ -4,11 +4,11 @@ import android.app.Dialog import android.os.Bundle import android.text.method.LinkMovementMethod import android.view.View -import android.widget.TextView import androidx.preference.PreferenceDialogFragmentCompat import com.fsck.k9.ui.R import com.google.android.material.checkbox.MaterialCheckBox import com.google.android.material.dialog.MaterialAlertDialogBuilder +import com.google.android.material.textview.MaterialTextView import com.fsck.k9.ui.base.R as BaseR class AutocryptPreferEncryptDialogFragment : PreferenceDialogFragmentCompat() { @@ -20,7 +20,7 @@ class AutocryptPreferEncryptDialogFragment : PreferenceDialogFragmentCompat() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val view = layoutInflater.inflate(R.layout.dialog_autocrypt_prefer_encrypt, null) - view.findViewById(R.id.prefer_encrypt_learn_more).makeLinksClickable() + view.findViewById(R.id.prefer_encrypt_learn_more).makeLinksClickable() preferEncryptCheckbox = view.findViewById(R.id.prefer_encrypt_check).apply { isChecked = preferEncryptPreference.isPreferEncryptEnabled @@ -43,7 +43,7 @@ class AutocryptPreferEncryptDialogFragment : PreferenceDialogFragmentCompat() { } } - private fun TextView.makeLinksClickable() { + private fun MaterialTextView.makeLinksClickable() { this.movementMethod = LinkMovementMethod.getInstance() } } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java index 434d1b151bf..a40f1008c0f 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java @@ -14,7 +14,6 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; -import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; @@ -234,7 +233,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity()); builder.setTitle(R.string.dialog_openkeychain_info_title); - builder.setView(LayoutInflater.from(getActivity()).inflate( + builder.setView(getLayoutInflater().inflate( R.layout.dialog_openkeychain_info, null, false)); builder.setNegativeButton(com.fsck.k9.ui.base.R.string.cancel_action, new OnClickListener() { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/VibrationDialogFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/VibrationDialogFragment.kt index cfd733d9c74..784abaea607 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/VibrationDialogFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/VibrationDialogFragment.kt @@ -9,7 +9,6 @@ import android.widget.BaseAdapter import android.widget.CheckedTextView import android.widget.SeekBar import android.widget.SeekBar.OnSeekBarChangeListener -import android.widget.TextView import androidx.appcompat.widget.SwitchCompat import androidx.preference.PreferenceDialogFragmentCompat import com.fsck.k9.NotificationVibration @@ -18,6 +17,7 @@ import com.fsck.k9.ui.R import com.fsck.k9.ui.base.bundle.getEnum import com.fsck.k9.ui.base.bundle.putEnum import com.google.android.material.dialog.MaterialAlertDialogBuilder +import com.google.android.material.textview.MaterialTextView import org.koin.android.ext.android.inject import com.fsck.k9.ui.base.R as BaseR @@ -167,7 +167,7 @@ class VibrationDialogFragment : PreferenceDialogFragmentCompat() { private fun getVibrationTimesView(convertView: View?, parent: ViewGroup?): View { return convertView.orInflate(R.layout.preference_vibration_times_item, parent).apply { - val vibrationTimesValue = findViewById(R.id.vibrationTimesValue) + val vibrationTimesValue = findViewById(R.id.vibrationTimesValue) vibrationTimesValue.text = vibrationTimes.toString() val vibrationTimesSeekBar = findViewById(R.id.vibrationTimesSeekBar).apply { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/export/SettingsExportFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/export/SettingsExportFragment.kt index 1a003479f5d..664d3eaa11e 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/export/SettingsExportFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/export/SettingsExportFragment.kt @@ -7,12 +7,12 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.TextView import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.recyclerview.widget.RecyclerView import com.fsck.k9.ui.R import com.fsck.k9.ui.base.livedata.observeNotNull +import com.google.android.material.textview.MaterialTextView import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.adapters.ItemAdapter import org.koin.androidx.viewmodel.ext.android.viewModel @@ -66,10 +66,12 @@ class SettingsExportFragment : Fragment() { exportButton.isVisible = true exportButton.isEnabled = false } + ButtonState.ENABLED -> { exportButton.isVisible = true exportButton.isEnabled = true } + ButtonState.INVISIBLE -> exportButton.visibility = View.INVISIBLE ButtonState.GONE -> exportButton.visibility = View.GONE } @@ -83,10 +85,12 @@ class SettingsExportFragment : Fragment() { statusText.isVisible = true statusText.text = getString(R.string.settings_export_success_generic) } + StatusText.PROGRESS -> { statusText.isVisible = true statusText.text = getString(R.string.settings_export_progress_text) } + StatusText.EXPORT_FAILURE -> { statusText.isVisible = true statusText.text = getString(R.string.settings_export_failure) @@ -166,6 +170,6 @@ private class ViewHolder(view: View) { val exportButton: View = view.findViewById(R.id.exportButton) val shareButton: View = view.findViewById(R.id.shareButton) val progressBar: View = view.findViewById(R.id.progressBar) - val statusText: TextView = view.findViewById(R.id.statusText) + val statusText: MaterialTextView = view.findViewById(R.id.statusText) val settingsExportList: RecyclerView = view.findViewById(R.id.settingsExportList) } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/export/SettingsExportListItems.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/export/SettingsExportListItems.kt index 1ca6f2133d0..147cfe407d0 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/export/SettingsExportListItems.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/export/SettingsExportListItems.kt @@ -1,8 +1,8 @@ package com.fsck.k9.ui.settings.export import android.view.View -import android.widget.TextView import com.fsck.k9.ui.R +import com.google.android.material.textview.MaterialTextView private const val GENERAL_SETTINGS_ID = 0L private const val ACCOUNT_ITEMS_ID_OFFSET = 1L @@ -15,8 +15,8 @@ class GeneralSettingsItem : CheckBoxItem(GENERAL_SETTINGS_ID } class AccountViewHolder(view: View) : CheckBoxViewHolder(view) { - val accountDisplayName: TextView = view.findViewById(R.id.accountDisplayName) - val accountEmail: TextView = view.findViewById(R.id.accountEmail) + val accountDisplayName: MaterialTextView = view.findViewById(R.id.accountDisplayName) + val accountEmail: MaterialTextView = view.findViewById(R.id.accountEmail) } class AccountItem(account: SettingsListItem.Account) : diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java b/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java index aa9abf53ba4..466ccdc772f 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java @@ -11,7 +11,6 @@ import android.view.View.OnLongClickListener; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.TextView; import android.widget.Toast; import androidx.annotation.DrawableRes; @@ -34,6 +33,7 @@ import com.fsck.k9.message.ReplyActionStrategy; import com.fsck.k9.message.ReplyActions; import com.fsck.k9.ui.R; +import com.fsck.k9.ui.helper.BottomBaselineTextView; import com.fsck.k9.ui.helper.RelativeDateTimeFormatter; import com.fsck.k9.ui.messageview.DisplayRecipients; import com.fsck.k9.ui.messageview.DisplayRecipientsExtractor; @@ -41,6 +41,7 @@ import com.fsck.k9.ui.messageview.MessageViewRecipientFormatter; import com.fsck.k9.ui.messageview.RecipientNamesView; import com.google.android.material.chip.Chip; +import com.google.android.material.textview.MaterialTextView; public class MessageHeader extends LinearLayout implements OnClickListener, OnLongClickListener { @@ -52,13 +53,13 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo private final FontSizes fontSizes = K9.getFontSizes(); private Chip accountNameView; - private TextView subjectView; + private BottomBaselineTextView subjectView; private ImageView starView; private ImageView contactPictureView; - private TextView fromView; + private MaterialTextView fromView; private ImageView cryptoStatusIcon; private RecipientNamesView recipientNamesView; - private TextView dateView; + private MaterialTextView dateView; private ImageView menuPrimaryActionView; private RelativeDateTimeFormatter relativeDateTimeFormatter; diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/view/RecipientSelectView.java b/app/ui/legacy/src/main/java/com/fsck/k9/view/RecipientSelectView.java index 2fad4e61dbc..fde5eab35dc 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/view/RecipientSelectView.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/view/RecipientSelectView.java @@ -16,11 +16,6 @@ import android.os.Bundle; import android.os.Handler; import android.provider.ContactsContract.Contacts; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.loader.app.LoaderManager; -import androidx.loader.app.LoaderManager.LoaderCallbacks; -import androidx.loader.content.Loader; import android.text.Editable; import android.text.TextUtils; import android.util.AttributeSet; @@ -31,22 +26,27 @@ import android.view.inputmethod.InputMethodManager; import android.widget.ListPopupWindow; import android.widget.ListView; -import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.loader.app.LoaderManager; +import androidx.loader.app.LoaderManager.LoaderCallbacks; +import androidx.loader.content.Loader; import com.fsck.k9.DI; import com.fsck.k9.K9; -import com.fsck.k9.ui.R; -import com.fsck.k9.helper.ClipboardManager; import com.fsck.k9.activity.AlternateRecipientAdapter; import com.fsck.k9.activity.AlternateRecipientAdapter.AlternateRecipientListener; import com.fsck.k9.activity.compose.RecipientAdapter; import com.fsck.k9.activity.compose.RecipientLoader; +import com.fsck.k9.helper.ClipboardManager; import com.fsck.k9.mail.Address; +import com.fsck.k9.ui.R; import com.fsck.k9.ui.compose.RecipientCircleImageView; import com.fsck.k9.view.RecipientSelectView.Recipient; +import com.google.android.material.textview.MaterialTextView; import com.tokenautocomplete.TokenCompleteTextView; -import timber.log.Timber; import de.hdodenhof.circleimageview.CircleImageView; +import timber.log.Timber; import static com.fsck.k9.FontSizes.FONT_DEFAULT; @@ -627,7 +627,7 @@ private void relayoutView() { } private static class RecipientTokenViewHolder { - final TextView vName; + final MaterialTextView vName; final CircleImageView vContactPhoto; final View cryptoStatusRed; final View cryptoStatusOrange; diff --git a/app/ui/legacy/src/main/res/layout/about_library.xml b/app/ui/legacy/src/main/res/layout/about_library.xml index 4177de52c13..499e4c4ac70 100644 --- a/app/ui/legacy/src/main/res/layout/about_library.xml +++ b/app/ui/legacy/src/main/res/layout/about_library.xml @@ -12,7 +12,7 @@ android:paddingRight="16dp" android:paddingBottom="12dp"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -