add shimmer for highlight in home screen, update agp to version 7.3.0
This commit is contained in:
parent
5cd3d25ebe
commit
001141337d
|
@ -166,6 +166,10 @@ class HomeFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable the shimmer effect and hide the shimmer layouts
|
// disable the shimmer effect and hide the shimmer layouts
|
||||||
|
binding.shimmerLayoutHighlight.apply {
|
||||||
|
stopShimmer()
|
||||||
|
isVisible = false
|
||||||
|
}
|
||||||
binding.shimmerLayoutUpNext.apply {
|
binding.shimmerLayoutUpNext.apply {
|
||||||
stopShimmer()
|
stopShimmer()
|
||||||
isVisible = false
|
isVisible = false
|
||||||
|
@ -186,9 +190,14 @@ class HomeFragment : Fragment() {
|
||||||
stopShimmer()
|
stopShimmer()
|
||||||
isVisible = false
|
isVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make highlights layout visible again
|
||||||
|
binding.linearHighlight.isVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindUiStateLoading() {
|
private fun bindUiStateLoading() {
|
||||||
|
// hide highlights layout
|
||||||
|
binding.linearHighlight.isVisible = false
|
||||||
binding.root.children.filter { it is ShimmerFrameLayout }.forEach {
|
binding.root.children.filter { it is ShimmerFrameLayout }.forEach {
|
||||||
it as ShimmerFrameLayout
|
it as ShimmerFrameLayout
|
||||||
it.startShimmer()
|
it.startShimmer()
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="?shapeTextBackground"/>
|
||||||
|
<size
|
||||||
|
android:width="1920px"
|
||||||
|
android:height="1080px"/>
|
||||||
|
</shape>
|
|
@ -17,6 +17,16 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.facebook.shimmer.ShimmerFrameLayout
|
||||||
|
android:id="@+id/shimmer_layout_highlight"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:visibility="gone">
|
||||||
|
|
||||||
|
<include layout="@layout/item_highlight_shimmer" />
|
||||||
|
|
||||||
|
</com.facebook.shimmer.ShimmerFrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/linear_highlight"
|
android:id="@+id/linear_highlight"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?themePrimary">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/shimmer_image_highlight"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:src="@drawable/placeholder_image"
|
||||||
|
app:layout_constraintDimensionRatio="H,16:9"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/shimmer_linear_highlight"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?themePrimary"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="7dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/shimmer_image_highlight">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/shimmer_text_highlight_title"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="7dp"
|
||||||
|
android:background="?shapeTextBackground"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="7dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/shimmer_text_highlight_my_list"
|
||||||
|
android:layout_width="64dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:drawableTint="?shapeTextBackground"
|
||||||
|
app:drawableTopCompat="@drawable/ic_baseline_add_24" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/shimmer_button_play_highlight"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:backgroundTint="?shapeTextBackground" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/shimmer_text_highlight_info"
|
||||||
|
android:layout_width="64dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
app:drawableTint="?shapeTextBackground"
|
||||||
|
app:drawableTopCompat="@drawable/ic_outline_info_24" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -8,7 +8,7 @@ buildscript {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.2.2'
|
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|
Loading…
Reference in New Issue