Skip to content

Commit 762ee9b

Browse files
png assets migrated to vector. Added shimmer effect
1 parent 92c889a commit 762ee9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+795
-64
lines changed

app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,6 @@ dependencies {
8484

8585
implementation "com.github.bumptech.glide:glide:$versions.glide"
8686
annotationProcessor "com.github.bumptech.glide:compiler:$versions.glide"
87+
88+
implementation "com.facebook.shimmer:shimmer:$versions.shimmer"
8789
}

app/src/main/java/com/github/code/gambit/ui/MainActivity.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class MainActivity : AppCompatActivity() {
5252
binding.bottomNavContainer.bottomNavHide()
5353
}
5454
R.id.homeFragment -> {
55-
binding.bottomNavContainer.bottomNavShow()
55+
// info bottomNav is hiddent until data is loading in homeFragment
56+
// binding.bottomNavContainer.bottomNavShow()
5657
}
5758
R.id.authFragment -> {
5859
binding.bottomNavContainer.bottomNavHide()
@@ -113,7 +114,7 @@ class MainActivity : AppCompatActivity() {
113114
}
114115

115116
fun animateBottomNav(offset: Float) {
116-
if (this::_binding.isInitialized) {
117+
if (this::_binding.isInitialized && offset.isFinite()) {
117118
binding.bottomLayout.animate().alpha(offset).scaleX(offset).scaleY(offset)
118119
.setDuration(0).start()
119120
}

app/src/main/java/com/github/code/gambit/ui/fragment/HomeFragment.kt

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.code.gambit.ui.fragment
22

33
import android.os.Bundle
4+
import android.os.Handler
45
import android.view.View
56
import androidx.core.view.isVisible
67
import androidx.fragment.app.Fragment
@@ -42,12 +43,10 @@ class HomeFragment : Fragment(R.layout.fragment_home) {
4243
registerFilterComponents()
4344

4445
binding.filterButton.setOnClickListener {
45-
requireMainActivity().animateBottomNav(0f)
4646
showFilter()
4747
}
4848

4949
binding.searchButton.setOnClickListener {
50-
requireMainActivity().hideBottomNav()
5150
showSearch()
5251
}
5352

@@ -58,40 +57,59 @@ class HomeFragment : Fragment(R.layout.fragment_home) {
5857
searchBinding.homeButton.setOnClickListener {
5958
requireMainActivity().onBackPressed()
6059
}
60+
61+
Handler().postDelayed(
62+
{
63+
requireMainActivity().showBottomNav()
64+
binding.shimmerLayout.stopShimmer()
65+
binding.shimmerLayout.visibility = View.GONE
66+
binding.topContainer.visibility = View.VISIBLE
67+
binding.swipeRefresh.visibility = View.VISIBLE
68+
},
69+
5000
70+
)
6171
}
6272

6373
private fun registerFilterComponents() {
6474
val bottomSheetBehavior = BottomSheetBehavior.from(filterBinding.bottomSheetContainer)
6575
bottomSheetBehavior.peekHeight = 0
66-
bottomSheetBehavior.isHideable = false
76+
bottomSheetBehavior.isHideable = true
77+
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
6778
bottomSheetBehavior.addBottomSheetCallback(object : BottomSheetCallback() {
6879
override fun onStateChanged(bottomSheet: View, newState: Int) {
69-
if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
80+
if (newState == BottomSheetBehavior.STATE_COLLAPSED || newState == BottomSheetBehavior.STATE_HIDDEN) {
7081
binding.overlay.hide()
7182
}
7283
}
7384

7485
override fun onSlide(bottomSheet: View, slideOffset: Float) {
75-
binding.overlay.show()
7686
binding.overlay.animate().alpha(slideOffset).setDuration(0).start()
7787
requireMainActivity().animateBottomNav(1 - slideOffset)
7888
}
7989
})
8090
}
8191

82-
private fun showFilter() = setState(true)
83-
fun closeFilter() = setState(false)
92+
private fun showFilter() {
93+
requireMainActivity().animateBottomNav(0f)
94+
binding.overlay.show()
95+
filterBinding.root.show()
96+
setState(true)
97+
}
98+
99+
fun closeFilter() {
100+
setState(false)
101+
requireMainActivity().animateBottomNav(1f)
102+
binding.overlay.hide()
103+
filterBinding.root.hide()
104+
}
84105

85106
private fun showSearch() {
86-
if (!searchBinding.root.isVisible) {
87-
searchBinding.root.show()
88-
}
107+
requireMainActivity().hideBottomNav()
108+
searchBinding.root.show()
89109
}
90110

91111
fun closeSearch() {
92-
if (searchBinding.root.isVisible) {
93-
searchBinding.root.hide()
94-
}
112+
searchBinding.root.hide()
95113
requireMainActivity().showBottomNav()
96114
}
97115

app/src/main/java/com/github/code/gambit/utility/AppConstant.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.code.gambit.utility
22

33
object AppConstant {
4+
const val AUTH_ATTRIBUTE_CUSTOM_PROFILE = "custom:profile_image"
45
object RequestCode {
56
const val PERMISSIONS = 101
67
}

app/src/main/java/com/github/code/gambit/utility/SystemManager.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import android.app.Activity
44
import android.content.Context
55
import android.content.Intent
66
import android.content.pm.PackageManager
7+
import android.net.ConnectivityManager
8+
import android.net.NetworkCapabilities
79
import android.net.Uri
810
import android.provider.MediaStore
911
import androidx.activity.result.ActivityResultLauncher
@@ -64,4 +66,25 @@ constructor(val ctx: Context, @Named(AppConstant.Named.PERMISSION_ARRAY)val perm
6466
fun launchActivity(launcher: ActivityResultLauncher<Intent>) {
6567
launcher.launch(Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI))
6668
}
69+
70+
fun isOnline(): Boolean {
71+
val connectivityManager =
72+
ctx.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
73+
val capabilities =
74+
connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork)
75+
if (capabilities != null) {
76+
when {
77+
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> {
78+
return true
79+
}
80+
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> {
81+
return true
82+
}
83+
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> {
84+
return true
85+
}
86+
}
87+
}
88+
return false
89+
}
6790
}

app/src/main/java/com/github/code/gambit/utility/extension.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,15 @@ fun View.anim(delay: Long) {
5656
}
5757

5858
fun View.hide() {
59-
this.visibility = View.GONE
59+
if (visibility != View.GONE) {
60+
this.visibility = View.GONE
61+
}
6062
}
6163

6264
fun View.show() {
63-
this.visibility = View.VISIBLE
65+
if (visibility != View.VISIBLE) {
66+
this.visibility = View.VISIBLE
67+
}
6468
}
6569

6670
fun View.toggleVisibility() {
@@ -107,7 +111,7 @@ fun AuthSignUpOptions.Builder<*>.defaultBuilder(authData: AuthData): AuthSignUpO
107111
mutableListOf
108112
(
109113
AuthUserAttribute(AuthUserAttributeKey.email(), authData.email),
110-
AuthUserAttribute(AuthUserAttributeKey.custom("custom:profile_image"), authData.thumbnail),
114+
AuthUserAttribute(AuthUserAttributeKey.custom(AppConstant.AUTH_ATTRIBUTE_CUSTOM_PROFILE), authData.thumbnail),
111115
AuthUserAttribute(AuthUserAttributeKey.name(), authData.fullname)
112116
)
113117
).build()
-12.4 KB
Binary file not shown.
-8.41 KB
Binary file not shown.
-10.4 KB
Binary file not shown.
-4.96 KB
Binary file not shown.

0 commit comments

Comments
 (0)