Switch from AndroidX CardView to MaterialCardView

This commit is contained in:
cketti 2023-01-16 20:13:51 +01:00
parent 3b442f593f
commit 2131bfcd05
6 changed files with 13 additions and 14 deletions

View file

@ -30,7 +30,6 @@ dependencies {
implementation libs.androidx.lifecycle.viewmodel.ktx
implementation libs.androidx.lifecycle.livedata.ktx
implementation libs.androidx.constraintlayout
implementation libs.androidx.cardview
implementation libs.androidx.localbroadcastmanager
implementation libs.androidx.swiperefreshlayout
implementation libs.ckchangelog.core

View file

@ -25,6 +25,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener {
private AttachmentViewInfo attachment;
private AttachmentViewCallback callback;
private View cardView;
private View saveButton;
private ImageView preview;
private ImageView attachmentType;
@ -46,6 +47,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener {
@Override
protected void onFinishInflate() {
super.onFinishInflate();
cardView = findViewById(R.id.attachment_card);
saveButton = findViewById(R.id.save_button);
preview = findViewById(R.id.attachment_preview);
attachmentType = findViewById(R.id.attachment_type);
@ -72,7 +74,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener {
saveButton.setVisibility(View.INVISIBLE);
}
setOnClickListener(this);
cardView.setOnClickListener(this);
saveButton.setOnClickListener(this);
TextView attachmentName = findViewById(R.id.attachment_name);
@ -102,7 +104,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener {
@Override
public void onClick(View view) {
if (view == this) {
if (view.getId() == R.id.attachment_card) {
onViewButtonClick();
} else if (view.getId() == R.id.save_button) {
onSaveButtonClick();

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AttachmentCard"
@ -9,7 +9,6 @@
android:layout_marginBottom="12dp"
android:orientation="vertical"
app:cardBackgroundColor="?attr/attachmentCardBackground"
app:cardCornerRadius="2dp"
app:cardElevation="1dp">
<androidx.constraintlayout.widget.ConstraintLayout
@ -109,4 +108,4 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</com.google.android.material.card.MaterialCardView>

View file

@ -7,16 +7,17 @@
android:paddingBottom="4dp"
android:id="@+id/attachment">
<androidx.cardview.widget.CardView
<com.google.android.material.card.MaterialCardView
android:id="@+id/attachment_card"
style="@style/AttachmentCard"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="12dp"
android:orientation="vertical"
android:foreground="?attr/selectableItemBackground"
android:focusable="true"
android:clickable="true"
app:cardBackgroundColor="?attr/attachmentCardBackground"
app:cardCornerRadius="2dp"
app:cardElevation="1dp">
<androidx.constraintlayout.widget.ConstraintLayout
@ -97,6 +98,6 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</com.google.android.material.card.MaterialCardView>
</com.fsck.k9.ui.messageview.AttachmentView>

View file

@ -8,7 +8,7 @@
android:outAnimation="@anim/fade_out"
app:previewInitialChild="0">
<androidx.cardview.widget.CardView
<com.google.android.material.card.MaterialCardView
style="@style/AttachmentCard"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
@ -16,7 +16,6 @@
android:layout_marginBottom="12dp"
android:orientation="vertical"
app:cardBackgroundColor="?attr/attachmentCardBackground"
app:cardCornerRadius="2dp"
app:cardElevation="1dp">
<androidx.constraintlayout.widget.ConstraintLayout
@ -84,7 +83,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</com.google.android.material.card.MaterialCardView>
<ViewStub
android:layout_width="match_parent"

View file

@ -67,7 +67,6 @@ androidx-fragment = { module = "androidx.fragment:fragment", version.ref = "andr
androidx-localbroadcastmanager = "androidx.localbroadcastmanager:localbroadcastmanager:1.1.0"
androidx-core = { module = "androidx.core:core", version.ref = "androidxCore" }
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidxCore" }
androidx-cardview = "androidx.cardview:cardview:1.0.0"
androidx-preference = { module = "androidx.preference:preference", version.ref = "androidxPreference" }
androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
androidx-test-core = "androidx.test:core:1.5.0"