Created
April 19, 2021 21:15
-
-
Save fvilarino/54de4aeeb602844e55a13386edc36f14 to your computer and use it in GitHub Desktop.
Forecast Fragment Layout
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
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:bind="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<data> | |
<variable | |
name="state" | |
type="com.francescsoftware.weathersample.presentation.feature.weather.tabs.forecast.ForecastState" /> | |
</data> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<com.google.android.material.progressindicator.CircularProgressIndicator | |
android:id="@+id/progress" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:indeterminate="true" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent" | |
bind:animatedVisibility="@{state.loading}" /> | |
<TextView | |
android:id="@+id/error_label" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_marginBottom="@dimen/margin_single" | |
android:text="@{state.errorMessage}" | |
android:textAppearance="?textAppearanceBody1" | |
android:textColor="?android:textColorPrimary" | |
app:layout_constraintBottom_toTopOf="@+id/retry_button" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintVertical_bias=".4" | |
app:layout_constraintVertical_chainStyle="packed" | |
tools:text="Failed to load weather" /> | |
<Button | |
android:id="@+id/retry_button" | |
style="?attr/materialButtonOutlinedStyle" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="@dimen/margin_single" | |
android:text="@string/retry" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toBottomOf="@+id/error_label" /> | |
<androidx.constraintlayout.widget.Group | |
android:id="@+id/retry_group" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
app:constraint_referenced_ids="error_label, retry_button" | |
bind:animatedVisibility="@{state.loadError}" /> | |
<androidx.recyclerview.widget.RecyclerView | |
android:id="@+id/forecast_list" | |
recyclerViewTypedItems="@{state.forecast}" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:clipToPadding="false" | |
android:paddingHorizontal="@dimen/margin_single" | |
android:paddingVertical="@dimen/margin_quad" | |
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintWidth_max="@dimen/max_forecast_card_width" | |
bind:animatedVisibility="@{state.loaded}" | |
tools:listitem="@layout/viewholder_forecast_card" /> | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
</layout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment