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 3e42973c5fe..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,8 +4,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import android.view.View -import android.widget.CheckBox -import android.widget.TextView +import android.widget.EditText import androidx.core.content.IntentCompat import androidx.core.os.BundleCompat import androidx.core.view.isVisible @@ -16,6 +15,7 @@ import com.fsck.k9.Identity import com.fsck.k9.Preferences import com.fsck.k9.ui.R import com.fsck.k9.ui.base.K9Activity +import com.google.android.material.checkbox.MaterialCheckBox import org.koin.android.ext.android.inject class EditIdentity : K9Activity() { @@ -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 signatureUse: CheckBox - private lateinit var signature: 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: 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/activity/setup/AccountSetupComposition.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupComposition.java index cdbbefde10e..038fefb8a7d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupComposition.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupComposition.java @@ -6,16 +6,17 @@ import android.view.MenuItem; import android.view.View; import android.widget.CompoundButton; -import android.widget.CheckBox; import android.widget.EditText; import android.widget.LinearLayout; -import android.widget.RadioButton; import androidx.annotation.NonNull; import com.fsck.k9.Account; import com.fsck.k9.Preferences; import com.fsck.k9.ui.R; import com.fsck.k9.ui.base.K9Activity; +import com.google.android.material.checkbox.MaterialCheckBox; +import com.google.android.material.radiobutton.MaterialRadioButton; + public class AccountSetupComposition extends K9Activity { @@ -27,9 +28,9 @@ public class AccountSetupComposition extends K9Activity { private EditText mAccountEmail; private EditText mAccountAlwaysBcc; private EditText mAccountName; - private CheckBox mAccountSignatureUse; - private RadioButton mAccountSignatureBeforeLocation; - private RadioButton mAccountSignatureAfterLocation; + private MaterialCheckBox mAccountSignatureUse; + private MaterialRadioButton mAccountSignatureBeforeLocation; + private MaterialRadioButton mAccountSignatureAfterLocation; private LinearLayout mAccountSignatureLayout; 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 a757e449662..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,14 +4,14 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.CheckBox -import android.widget.TextView import androidx.fragment.app.Fragment import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.ViewHolder 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 @@ -47,7 +47,7 @@ class ChangelogFragment : Fragment() { } private fun setUpShowRecentChangesCheckbox(view: View) { - val showRecentChangesCheckBox = view.findViewById(R.id.show_recent_changes_checkbox) + val showRecentChangesCheckBox = view.findViewById(R.id.show_recent_changes_checkbox) var isInitialValue = true viewModel.showRecentChangesState.observe(viewLifecycleOwner) { showRecentChanges -> showRecentChangesCheckBox.isChecked = showRecentChanges @@ -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 c55613365a2..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 @@ -12,11 +12,9 @@ import android.util.AttributeSet import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.Button 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 +28,8 @@ import com.fsck.k9.ui.messageview.MessageContainerView.OnRenderingFinishedListen 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,15 +44,15 @@ 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 private lateinit var containerView: ViewGroup - private lateinit var downloadRemainderButton: Button + private lateinit var downloadRemainderButton: MaterialButton private lateinit var attachmentCallback: AttachmentViewCallback private lateinit var extraHeaderContainer: View - private lateinit var showPicturesButton: Button + private lateinit var showPicturesButton: MaterialButton private var isShowingProgress = false private var showPicturesButtonClicked = false @@ -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 247f9ca740b..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,8 +9,6 @@ import android.provider.Settings import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.Button -import android.widget.TextView import android.widget.Toast import androidx.annotation.RequiresApi import androidx.core.view.isVisible @@ -18,6 +16,8 @@ import androidx.fragment.app.Fragment 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,14 +36,14 @@ 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( R.string.push_info_notification_explanation_text, configureNotificationText, ) - val configureNotificationButton = view.findViewById