added shimmer
This commit is contained in:
@@ -397,6 +397,9 @@ dependencies {
|
||||
//one tap sms verification
|
||||
implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
|
||||
|
||||
implementation 'com.facebook.shimmer:shimmer:0.5.0'
|
||||
|
||||
|
||||
}
|
||||
|
||||
tasks.withType(Compiler) {
|
||||
|
||||
@@ -81,9 +81,10 @@ class ProfileFragment : BaseFragment(), WidgetCallback {
|
||||
false
|
||||
)
|
||||
initUI()
|
||||
initError(viewModel)
|
||||
initObservers()
|
||||
setupFreshChatUnreadCount()
|
||||
fetchProfileItems()
|
||||
viewModel.fetchProfileItems()
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -93,17 +94,14 @@ class ProfileFragment : BaseFragment(), WidgetCallback {
|
||||
}
|
||||
|
||||
private fun initUI() {
|
||||
|
||||
}
|
||||
|
||||
private fun fetchProfileItems() {
|
||||
showLoader()
|
||||
viewModel.fetchProfileItems()
|
||||
binding.shimmerLayout.startShimmer()
|
||||
}
|
||||
|
||||
private fun initObservers() {
|
||||
viewModel.profileItems.observe(viewLifecycleOwner) { response ->
|
||||
hideLoader()
|
||||
binding.shimmerLayout.stopShimmer()
|
||||
binding.shimmerLayout.visibility = View.GONE
|
||||
binding.rvLAPContent.visibility = View.VISIBLE
|
||||
response?.contentWidget?.let { contentWidget ->
|
||||
updateStatusBar(contentWidget.firstOrNull())
|
||||
binding.rvLAPContent.apply {
|
||||
|
||||
@@ -29,11 +29,7 @@ class ProfileVM @Inject constructor(private val repository: ProfileRepository) :
|
||||
fun fetchProfileItems() {
|
||||
coroutineScope.launch {
|
||||
val response = repository.fetchProfileItems()
|
||||
if (response.error == null && response.errors.isNullOrEmpty()) {
|
||||
_profileItems.value = response.data
|
||||
} else {
|
||||
setErrorData(response.errors, response.error)
|
||||
}
|
||||
_profileItems.value = response.data
|
||||
}
|
||||
}
|
||||
}
|
||||
15
app/src/main/res/drawable/bg_grey_8dp_radius.xml
Normal file
15
app/src/main/res/drawable/bg_grey_8dp_radius.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ /*
|
||||
~ * Copyright © 2019 by Navi Technologies Private Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~ */
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/strokeSecondaryColor" />
|
||||
|
||||
<corners android:radius="@dimen/dp_10" />
|
||||
</shape>
|
||||
@@ -12,10 +12,33 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.facebook.shimmer.ShimmerFrameLayout
|
||||
android:id="@+id/shimmer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include layout="@layout/shimmer_profile_header_layout" />
|
||||
|
||||
<include layout="@layout/shimmer_profile_item_layout" />
|
||||
|
||||
<include layout="@layout/shimmer_profile_item_layout" />
|
||||
|
||||
<include layout="@layout/shimmer_profile_item_layout" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.facebook.shimmer.ShimmerFrameLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvLAPContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/layout_dp_0"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
34
app/src/main/res/layout/shimmer_profile_header_layout.xml
Normal file
34
app/src/main/res/layout/shimmer_profile_header_layout.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ /*
|
||||
~ * Copyright © 2019 by Navi Technologies Private Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~ */
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/backgroundSecondaryColor"
|
||||
android:layout_height="@dimen/dp_100">
|
||||
|
||||
<View
|
||||
android:id="@+id/top_view"
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_76"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/top_view" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
103
app/src/main/res/layout/shimmer_profile_item_layout.xml
Normal file
103
app/src/main/res/layout/shimmer_profile_item_layout.xml
Normal file
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ /*
|
||||
~ * Copyright © 2019 by Navi Technologies Private Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~ */
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content">
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_76"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_130"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_186"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_78"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_134"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_190"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:layout_marginTop="@dimen/dp_78"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:layout_marginTop="@dimen/dp_134"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:layout_marginTop="@dimen/dp_190"
|
||||
android:background="@drawable/bg_grey_8dp_radius"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -37,6 +37,7 @@
|
||||
<dimen name="dp_64">64dp</dimen>
|
||||
<dimen name="dp_68">68dp</dimen>
|
||||
<dimen name="dp_72">72dp</dimen>
|
||||
<dimen name="dp_76">76dp</dimen>
|
||||
<dimen name="dp_80">80dp</dimen>
|
||||
<dimen name="dp_82">82dp</dimen>
|
||||
<dimen name="dp_90">90dp</dimen>
|
||||
@@ -46,10 +47,12 @@
|
||||
<dimen name="dp_126">126dp</dimen>
|
||||
<dimen name="dp_128">128dp</dimen>
|
||||
<dimen name="dp_130">130dp</dimen>
|
||||
<dimen name="dp_134">134dp</dimen>
|
||||
<dimen name="dp_140">140dp</dimen>
|
||||
<dimen name="dp_148">148dp</dimen>
|
||||
<dimen name="dp_150">150dp</dimen>
|
||||
<dimen name="dp_160">160dp</dimen>
|
||||
<dimen name="dp_190">190dp</dimen>
|
||||
<dimen name="dp_220">220dp</dimen>
|
||||
<dimen name="dp_250">250dp</dimen>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user