-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Refactor RetryCardView as composable"
This reverts commit ebb4826.
- Loading branch information
Showing
8 changed files
with
101 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/src/main/java/com/weatherxm/ui/components/RetryCardView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.weatherxm.ui.components | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.LayoutInflater | ||
import androidx.constraintlayout.widget.ConstraintLayout | ||
import com.weatherxm.databinding.ViewRetryCardBinding | ||
|
||
class RetryCardView : ConstraintLayout { | ||
|
||
private lateinit var binding: ViewRetryCardBinding | ||
|
||
constructor(context: Context) : super(context) { | ||
onCreate(context) | ||
} | ||
|
||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { | ||
onCreate(context) | ||
} | ||
|
||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( | ||
context, attrs, defStyleAttr | ||
) { | ||
onCreate(context) | ||
} | ||
|
||
private fun onCreate(context: Context) { | ||
binding = ViewRetryCardBinding.inflate(LayoutInflater.from(context), this) | ||
} | ||
|
||
|
||
fun listener(listener: () -> Unit) = binding.retryCard.setOnClickListener { listener.invoke() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<merge xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:animateLayoutChanges="true"> | ||
|
||
<com.google.android.material.card.MaterialCardView | ||
android:id="@+id/retryCard" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:cardCornerRadius="0dp" | ||
app:cardElevation="0dp" | ||
app:contentPadding="0dp" | ||
app:contentPaddingBottom="@dimen/padding_normal_to_large" | ||
app:contentPaddingTop="@dimen/padding_normal_to_large"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:orientation="vertical"> | ||
|
||
<ImageView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:adjustViewBounds="true" | ||
android:importantForAccessibility="no" | ||
android:scaleType="centerCrop" | ||
android:src="@drawable/ic_retry" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/margin_normal_to_large" | ||
android:gravity="center" | ||
android:text="@string/error_generic_message" | ||
android:textAppearance="@style/TextAppearance.WeatherXM.Default.BodyLarge" | ||
android:textStyle="bold" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/margin_small" | ||
android:gravity="center" | ||
android:text="@string/tap_to_retry" | ||
android:textAppearance="@style/TextAppearance.WeatherXM.Default.BodyLarge" /> | ||
|
||
</LinearLayout> | ||
|
||
</com.google.android.material.card.MaterialCardView> | ||
|
||
</merge> |