Commit 533c8c3a authored by shohboz's avatar shohboz

[UPD] MUS-191 Feature, updated settings screens scrolling and home page scrolling

parent f9d9b438
...@@ -123,6 +123,6 @@ dependencies { ...@@ -123,6 +123,6 @@ dependencies {
implementation 'io.github.everythingme:overscroll-decor-android:1.1.1' implementation 'io.github.everythingme:overscroll-decor-android:1.1.1'
// implementation 'com.github.woxingxiao:BounceScrollView:1.5-androidx' implementation 'com.github.woxingxiao:BounceScrollView:1.5-androidx'
} }
\ No newline at end of file
...@@ -18,6 +18,7 @@ import com.mobiuz.app.dev.network.model.Customer ...@@ -18,6 +18,7 @@ import com.mobiuz.app.dev.network.model.Customer
import com.mobiuz.app.dev.network.model.UiStateObject import com.mobiuz.app.dev.network.model.UiStateObject
import com.mobiuz.app.dev.ui.base.BaseFragment import com.mobiuz.app.dev.ui.base.BaseFragment
import com.mobiuz.app.dev.utils.extensions.* import com.mobiuz.app.dev.utils.extensions.*
import com.xw.repo.widget.BounceScrollView
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
...@@ -62,40 +63,40 @@ class HomeFragment : BaseFragment(R.layout.fragment_home) { ...@@ -62,40 +63,40 @@ class HomeFragment : BaseFragment(R.layout.fragment_home) {
btnAddSum.setOnClickListener { btnAddSum.setOnClickListener {
// navController.navigate(R.id.billingFragment) // navController.navigate(R.id.billingFragment)
} }
txtMyNumber.text = pref.userPhone.customMasketHome().replace("-", " ")
toolbarMyNumber.text = pref.userPhone.customMasketHome().replace("-", " ")
toolbar.setNavigationOnClickListener { toolbar.setNavigationOnClickListener {
mainViewModel.openDrawer(System.currentTimeMillis()) mainViewModel.openDrawer(System.currentTimeMillis())
} }
scrollView.viewTreeObserver.addOnScrollChangedListener { bounceScrollView.setOnOverScrollListener { fromStart, overScrolledDistance ->
if (scrollView.scrollY < 100) { if (overScrolledDistance > 120.52632) {
if (!isProgressing) {
vibrate(requireContext())
viewModel.mainIndex()
}
}
}
bounceScrollView.setOnScrollListener { _, scrollY ->
if (scrollY < 1.0) {
lottie.isVisible = false
}
if (scrollY < 100) {
toolbarInsideLayout.isVisible = false toolbarInsideLayout.isVisible = false
topDiv.setBackgroundColor(Color.TRANSPARENT) topDiv.setBackgroundColor(Color.TRANSPARENT)
toolbar.setBackgroundColor(Color.TRANSPARENT) toolbar.setBackgroundColor(Color.TRANSPARENT)
} }
if (scrollView.scrollY > 20) { if (scrollY > 20) {
toolbar.setBackgroundColor(getColorCompat(R.color.primary100)) toolbar.setBackgroundColor(getColorCompat(R.color.primary100))
topDiv.setBackgroundColor(getColorCompat(R.color.primary100)) topDiv.setBackgroundColor(getColorCompat(R.color.primary100))
} }
if (scrollView.scrollY > 100) { if (scrollY > 90) {
toolbarInsideLayout.isVisible = true toolbarInsideLayout.isVisible = true
} }
}
val decor = OverScrollDecoratorHelper.setUpOverScroll(scrollView)
decor.setOverScrollUpdateListener { _, _, offset ->
if (offset > 150.52632) {
if (!isProgressing) {
vibrate(requireContext())
viewModel.mainIndex()
}
}
if (offset < 1.0) {
lottie.isVisible = false
}
} }
} }
} }
...@@ -152,9 +153,6 @@ class HomeFragment : BaseFragment(R.layout.fragment_home) { ...@@ -152,9 +153,6 @@ class HomeFragment : BaseFragment(R.layout.fragment_home) {
txtTypeSms.text = it?.ITEM?.unit ?: "sms" txtTypeSms.text = it?.ITEM?.unit ?: "sms"
} }
mainViewModel.setUserName(customer?.customer?.name ?: "Unnamed User") mainViewModel.setUserName(customer?.customer?.name ?: "Unnamed User")
txtMyNumber.text = pref.userPhone.customMasketHome().replace("-", " ")
toolbarMyNumber.text = pref.userPhone.customMasketHome().replace("-", " ")
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
......
...@@ -96,7 +96,7 @@ class ServiceFragment : BaseFragment(R.layout.fragment_service) { ...@@ -96,7 +96,7 @@ class ServiceFragment : BaseFragment(R.layout.fragment_service) {
private fun navigateToServiceScreen(key: ServiceData) { private fun navigateToServiceScreen(key: ServiceData) {
navController.navigate(R.id.servicesFragmentActivity, bundleOf(CONSTANTS.SERVICE to Gson().toJson(key))) navController.navigate(R.id.ussdFragment, bundleOf(CONSTANTS.SERVICE to Gson().toJson(key)))
mainViewModel.bottomSheet(false) mainViewModel.bottomSheet(false)
} }
......
...@@ -9,7 +9,7 @@ import com.google.android.material.tabs.TabLayout.MODE_SCROLLABLE ...@@ -9,7 +9,7 @@ import com.google.android.material.tabs.TabLayout.MODE_SCROLLABLE
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import com.google.gson.Gson import com.google.gson.Gson
import com.mobiuz.app.R import com.mobiuz.app.R
import com.mobiuz.app.databinding.ActivityServicesBinding import com.mobiuz.app.databinding.FragmentUssdBinding
import com.mobiuz.app.dev.model.ServiceData import com.mobiuz.app.dev.model.ServiceData
import com.mobiuz.app.dev.model.SharedPref import com.mobiuz.app.dev.model.SharedPref
import com.mobiuz.app.dev.ui.base.BaseFragment import com.mobiuz.app.dev.ui.base.BaseFragment
...@@ -19,9 +19,9 @@ import dagger.hilt.android.AndroidEntryPoint ...@@ -19,9 +19,9 @@ import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject import javax.inject.Inject
@AndroidEntryPoint @AndroidEntryPoint
class ServicesFragmentActivity : BaseFragment(R.layout.activity_services) { class UssdFragment : BaseFragment(R.layout.fragment_ussd) {
private var _bn: ActivityServicesBinding? = null private var _bn: FragmentUssdBinding? = null
private val bn get() = _bn ?: throw NullPointerException("cannot inflate") private val bn get() = _bn ?: throw NullPointerException("cannot inflate")
@Inject @Inject
...@@ -41,7 +41,7 @@ class ServicesFragmentActivity : BaseFragment(R.layout.activity_services) { ...@@ -41,7 +41,7 @@ class ServicesFragmentActivity : BaseFragment(R.layout.activity_services) {
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
_bn = ActivityServicesBinding.bind(view) _bn = FragmentUssdBinding.bind(view)
setUpUI() setUpUI()
collects() collects()
} }
...@@ -63,7 +63,7 @@ class ServicesFragmentActivity : BaseFragment(R.layout.activity_services) { ...@@ -63,7 +63,7 @@ class ServicesFragmentActivity : BaseFragment(R.layout.activity_services) {
tabLayout.tabMode = MODE_SCROLLABLE tabLayout.tabMode = MODE_SCROLLABLE
} }
adapter = FragmentPagerAdapter(this@ServicesFragmentActivity, it) adapter = FragmentPagerAdapter(this@UssdFragment, it)
viewPager.adapter = adapter viewPager.adapter = adapter
TabLayoutMediator(bn.tabLayout, bn.viewPager) { tab, pos -> TabLayoutMediator(bn.tabLayout, bn.viewPager) { tab, pos ->
......
...@@ -39,8 +39,6 @@ class SupportFragment : BaseFragment(R.layout.fragment_support) { ...@@ -39,8 +39,6 @@ class SupportFragment : BaseFragment(R.layout.fragment_support) {
navController.navigateUp() navController.navigateUp()
} }
OverScrollDecoratorHelper.setUpOverScroll(bn.scrollView)
txtPhone1.text = CONSTANTS.PHONE1 txtPhone1.text = CONSTANTS.PHONE1
txtPhone2.text = CONSTANTS.PHONE2 txtPhone2.text = CONSTANTS.PHONE2
txtPhone3.text = CONSTANTS.PHONE3 txtPhone3.text = CONSTANTS.PHONE3
......
...@@ -37,6 +37,7 @@ class SafetyFragment : BaseFragment(R.layout.fragment_safety) { ...@@ -37,6 +37,7 @@ class SafetyFragment : BaseFragment(R.layout.fragment_safety) {
override fun setUpUI() { override fun setUpUI() {
bn.apply { bn.apply {
toolbar.setNavigationOnClickListener { toolbar.setNavigationOnClickListener {
navController.navigateUp() navController.navigateUp()
} }
...@@ -63,27 +64,6 @@ class SafetyFragment : BaseFragment(R.layout.fragment_safety) { ...@@ -63,27 +64,6 @@ class SafetyFragment : BaseFragment(R.layout.fragment_safety) {
navController.navigate(R.id.changePasswordFragment, bundleOf(CONSTANTS.TYPE_PASSWORD to CONSTANTS.CURRENT_PASSWORD),Utils.navOptions()) navController.navigate(R.id.changePasswordFragment, bundleOf(CONSTANTS.TYPE_PASSWORD to CONSTANTS.CURRENT_PASSWORD),Utils.navOptions())
} }
}) })
btn4.setOnClickListener(object : ButtonClick(){
override fun onSingleClick(v: View?) {
}
})
btn5.setOnClickListener(object : ButtonClick(){
override fun onSingleClick(v: View?) {
}
})
seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {
}
override fun onStopTrackingTouch(seekBar: SeekBar?) {
showMessage("${seekBar}")
}
})
} }
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.xw.repo.widget.BounceScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -16,4 +16,4 @@ ...@@ -16,4 +16,4 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_ussd" /> tools:listitem="@layout/item_ussd" />
</LinearLayout> </com.xw.repo.widget.BounceScrollView>
\ No newline at end of file \ No newline at end of file
...@@ -75,8 +75,9 @@ ...@@ -75,8 +75,9 @@
app:lottie_rawRes="@raw/rifki_loading" app:lottie_rawRes="@raw/rifki_loading"
app:lottie_speed="1" app:lottie_speed="1"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<ScrollView
android:id="@+id/scrollView" <com.xw.repo.widget.BounceScrollView
android:id="@+id/bounce_scrollView"
android:clipToPadding="true" android:clipToPadding="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
...@@ -393,7 +394,7 @@ ...@@ -393,7 +394,7 @@
</LinearLayout> </LinearLayout>
</ScrollView> </com.xw.repo.widget.BounceScrollView>
</FrameLayout> </FrameLayout>
......
...@@ -14,103 +14,114 @@ ...@@ -14,103 +14,114 @@
app:title="@string/language_app" /> app:title="@string/language_app" />
<LinearLayout <com.xw.repo.widget.BounceScrollView
android:id="@+id/uzbek_lang"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent">
android:layout_marginTop="27dp"
android:background="?android:selectableItemBackground" <LinearLayout
android:paddingHorizontal="@dimen/_16sdp" android:layout_width="match_parent"
android:paddingVertical="@dimen/_12sdp"> android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content" <LinearLayout
android:layout_height="wrap_content" android:id="@+id/uzbek_lang"
android:src="@drawable/ic_uzbekistan" /> android:layout_width="match_parent"
android:layout_height="wrap_content"
<TextView android:layout_marginTop="27dp"
android:layout_width="0dp" android:background="?android:selectableItemBackground"
android:layout_height="wrap_content" android:paddingHorizontal="@dimen/_16sdp"
android:layout_marginStart="@dimen/_12sdp" android:paddingVertical="@dimen/_12sdp">
android:layout_weight="1"
android:text="@string/uzbek" <ImageView
android:textColor="@color/black100" android:layout_width="wrap_content"
android:textSize="16sp" android:layout_height="wrap_content"
android:textStyle="bold" /> android:src="@drawable/ic_uzbekistan" />
<ImageView <TextView
android:id="@+id/image_uzbek" android:layout_width="0dp"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_marginStart="@dimen/_12sdp"
android:layout_gravity="center" android:layout_weight="1"
android:src="@drawable/ic_vector_checked" android:text="@string/uzbek"
android:visibility="invisible" /> android:textColor="@color/black100"
</LinearLayout> android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/russian_lang" <ImageView
android:layout_width="match_parent" android:id="@+id/image_uzbek"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginVertical="@dimen/_12sdp" android:layout_height="wrap_content"
android:background="?android:selectableItemBackground" android:layout_gravity="center"
android:paddingHorizontal="@dimen/_16sdp" android:src="@drawable/ic_vector_checked"
android:paddingVertical="@dimen/_12sdp"> android:visibility="invisible" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content" <LinearLayout
android:layout_height="wrap_content" android:id="@+id/russian_lang"
android:src="@drawable/ic_russia" /> android:layout_width="match_parent"
android:layout_height="wrap_content"
<TextView android:layout_marginVertical="@dimen/_12sdp"
android:layout_width="0dp" android:background="?android:selectableItemBackground"
android:layout_height="wrap_content" android:paddingHorizontal="@dimen/_16sdp"
android:layout_marginStart="@dimen/_12sdp" android:paddingVertical="@dimen/_12sdp">
android:layout_weight="1"
android:text="@string/russian" <ImageView
android:textColor="@color/black100" android:layout_width="wrap_content"
android:textSize="16sp" android:layout_height="wrap_content"
android:textStyle="bold" /> android:src="@drawable/ic_russia" />
<ImageView <TextView
android:id="@+id/image_russian" android:layout_width="0dp"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_marginStart="@dimen/_12sdp"
android:layout_gravity="center" android:layout_weight="1"
android:src="@drawable/ic_vector_checked" android:text="@string/russian"
android:visibility="invisible" /> android:textColor="@color/black100"
</LinearLayout> android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/english_lang" <ImageView
android:layout_width="match_parent" android:id="@+id/image_russian"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:background="?android:selectableItemBackground" android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/_16sdp" android:layout_gravity="center"
android:paddingVertical="@dimen/_12sdp"> android:src="@drawable/ic_vector_checked"
android:visibility="invisible" />
<ImageView </LinearLayout>
android:layout_width="wrap_content"
android:layout_height="wrap_content" <LinearLayout
android:src="@drawable/ic_united_kingdom" /> android:id="@+id/english_lang"
android:layout_width="match_parent"
<TextView android:layout_height="wrap_content"
android:layout_width="0dp" android:background="?android:selectableItemBackground"
android:layout_height="wrap_content" android:paddingHorizontal="@dimen/_16sdp"
android:layout_marginStart="@dimen/_12sdp" android:paddingVertical="@dimen/_12sdp">
android:layout_weight="1"
android:text="@string/english" <ImageView
android:textColor="@color/black100" android:layout_width="wrap_content"
android:textSize="16sp" android:layout_height="wrap_content"
android:textStyle="bold" /> android:src="@drawable/ic_united_kingdom" />
<ImageView <TextView
android:id="@+id/image_english" android:layout_width="0dp"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_marginStart="@dimen/_12sdp"
android:layout_gravity="center" android:layout_weight="1"
android:src="@drawable/ic_vector_checked" android:text="@string/english"
android:visibility="invisible" /> android:textColor="@color/black100"
</LinearLayout> android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/image_english"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_vector_checked"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
</com.xw.repo.widget.BounceScrollView>
</LinearLayout> </LinearLayout>
\ No newline at end of file
This diff is collapsed.
...@@ -15,9 +15,8 @@ ...@@ -15,9 +15,8 @@
app:navigationIcon="@drawable/ic_baseline_arrow_back" app:navigationIcon="@drawable/ic_baseline_arrow_back"
/> />
<ScrollView <com.xw.repo.widget.BounceScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:id="@+id/scrollView"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -223,7 +222,7 @@ ...@@ -223,7 +222,7 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </com.xw.repo.widget.BounceScrollView>
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
<androidx.viewpager2.widget.ViewPager2 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager" android:id="@+id/view_pager"
android:scrollbars="none"
android:overScrollMode="never"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
android:name="com.mobiuz.app.dev.ui.service.ServiceFragment" android:name="com.mobiuz.app.dev.ui.service.ServiceFragment"
android:label="MotionFragment" /> android:label="MotionFragment" />
<fragment <fragment
android:id="@+id/servicesFragmentActivity" android:id="@+id/ussdFragment"
android:name="com.mobiuz.app.dev.ui.service.ServicesFragmentActivity" android:name="com.mobiuz.app.dev.ui.service.UssdFragment"
android:label="ServicesFragmentActivity" /> android:label="ServicesFragmentActivity" />
</navigation> </navigation>
\ No newline at end of file
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
android:name="com.mobiuz.app.dev.ui.service.ServiceFragment" android:name="com.mobiuz.app.dev.ui.service.ServiceFragment"
android:label="MotionFragment" /> android:label="MotionFragment" />
<fragment <fragment
android:id="@+id/servicesFragmentActivity" android:id="@+id/ussdFragment"
android:name="com.mobiuz.app.dev.ui.service.ServicesFragmentActivity" tools:layout="@layout/fragment_ussd"
android:name="com.mobiuz.app.dev.ui.service.UssdFragment"
android:label="ServicesFragmentActivity" /> android:label="ServicesFragmentActivity" />
<fragment <fragment
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment