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 {
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
import com.mobiuz.app.dev.network.model.UiStateObject
import com.mobiuz.app.dev.ui.base.BaseFragment
import com.mobiuz.app.dev.utils.extensions.*
import com.xw.repo.widget.BounceScrollView
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collect
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
......@@ -62,40 +63,40 @@ class HomeFragment : BaseFragment(R.layout.fragment_home) {
btnAddSum.setOnClickListener {
// navController.navigate(R.id.billingFragment)
}
txtMyNumber.text = pref.userPhone.customMasketHome().replace("-", " ")
toolbarMyNumber.text = pref.userPhone.customMasketHome().replace("-", " ")
toolbar.setNavigationOnClickListener {
mainViewModel.openDrawer(System.currentTimeMillis())
}
scrollView.viewTreeObserver.addOnScrollChangedListener {
if (scrollView.scrollY < 100) {
bounceScrollView.setOnOverScrollListener { fromStart, overScrolledDistance ->
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
topDiv.setBackgroundColor(Color.TRANSPARENT)
toolbar.setBackgroundColor(Color.TRANSPARENT)
}
if (scrollView.scrollY > 20) {
if (scrollY > 20) {
toolbar.setBackgroundColor(getColorCompat(R.color.primary100))
topDiv.setBackgroundColor(getColorCompat(R.color.primary100))
}
if (scrollView.scrollY > 100) {
if (scrollY > 90) {
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) {
txtTypeSms.text = it?.ITEM?.unit ?: "sms"
}
mainViewModel.setUserName(customer?.customer?.name ?: "Unnamed User")
txtMyNumber.text = pref.userPhone.customMasketHome().replace("-", " ")
toolbarMyNumber.text = pref.userPhone.customMasketHome().replace("-", " ")
}
}
} catch (e: Exception) {
......
......@@ -96,7 +96,7 @@ class ServiceFragment : BaseFragment(R.layout.fragment_service) {
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)
}
......
......@@ -9,7 +9,7 @@ import com.google.android.material.tabs.TabLayout.MODE_SCROLLABLE
import com.google.android.material.tabs.TabLayoutMediator
import com.google.gson.Gson
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.SharedPref
import com.mobiuz.app.dev.ui.base.BaseFragment
......@@ -19,9 +19,9 @@ import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
@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")
@Inject
......@@ -41,7 +41,7 @@ class ServicesFragmentActivity : BaseFragment(R.layout.activity_services) {
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
_bn = ActivityServicesBinding.bind(view)
_bn = FragmentUssdBinding.bind(view)
setUpUI()
collects()
}
......@@ -63,7 +63,7 @@ class ServicesFragmentActivity : BaseFragment(R.layout.activity_services) {
tabLayout.tabMode = MODE_SCROLLABLE
}
adapter = FragmentPagerAdapter(this@ServicesFragmentActivity, it)
adapter = FragmentPagerAdapter(this@UssdFragment, it)
viewPager.adapter = adapter
TabLayoutMediator(bn.tabLayout, bn.viewPager) { tab, pos ->
......
......@@ -39,8 +39,6 @@ class SupportFragment : BaseFragment(R.layout.fragment_support) {
navController.navigateUp()
}
OverScrollDecoratorHelper.setUpOverScroll(bn.scrollView)
txtPhone1.text = CONSTANTS.PHONE1
txtPhone2.text = CONSTANTS.PHONE2
txtPhone3.text = CONSTANTS.PHONE3
......
......@@ -37,6 +37,7 @@ class SafetyFragment : BaseFragment(R.layout.fragment_safety) {
override fun setUpUI() {
bn.apply {
toolbar.setNavigationOnClickListener {
navController.navigateUp()
}
......@@ -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())
}
})
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"?>
<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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
......@@ -16,4 +16,4 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_ussd" />
</LinearLayout>
\ No newline at end of file
</com.xw.repo.widget.BounceScrollView>
\ No newline at end of file
......@@ -75,8 +75,9 @@
app:lottie_rawRes="@raw/rifki_loading"
app:lottie_speed="1"
tools:ignore="ContentDescription" />
<ScrollView
android:id="@+id/scrollView"
<com.xw.repo.widget.BounceScrollView
android:id="@+id/bounce_scrollView"
android:clipToPadding="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -393,7 +394,7 @@
</LinearLayout>
</ScrollView>
</com.xw.repo.widget.BounceScrollView>
</FrameLayout>
......
......@@ -14,6 +14,15 @@
app:title="@string/language_app" />
<com.xw.repo.widget.BounceScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/uzbek_lang"
android:layout_width="match_parent"
......@@ -111,6 +120,8 @@
android:src="@drawable/ic_vector_checked"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
</com.xw.repo.widget.BounceScrollView>
</LinearLayout>
\ No newline at end of file
......@@ -3,8 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:fitsSystemWindows="false"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
android:orientation="vertical">
<com.google.android.material.appbar.MaterialToolbar
......@@ -16,17 +16,26 @@
app:title="@string/safety" />
<TextView
android:id="@+id/txt_phone_safety"
android:layout_width="wrap_content"
android:background="@color/grey20"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="20dp"
android:background="@color/grey20"
android:gravity="center"
android:paddingHorizontal="24dp"
android:id="@+id/txt_phone_safety"
android:paddingVertical="12dp"
android:textColor="@color/black80"
android:gravity="center"
android:layout_marginHorizontal="12dp"
android:text="@string/settings_safety"
android:layout_height="wrap_content"/>
android:textColor="@color/black80" />
<com.xw.repo.widget.BounceScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/btn_1"
......@@ -61,10 +70,10 @@
</LinearLayout>
<Switch
android:id="@+id/switch_biometria"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/switch_biometria"
tools:ignore="UseSwitchCompatOrMaterialXml" />
......@@ -140,73 +149,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/btn_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:visibility="invisible"
android:background="?android:selectableItemBackground"
android:paddingHorizontal="@dimen/_16sdp"
android:paddingVertical="@dimen/_10sdp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Доверенные устройства"
android:textColor="@color/black100"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_keyboard_arrow_right"
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:visibility="invisible"
android:background="?android:selectableItemBackground"
android:paddingHorizontal="@dimen/_16sdp"
android:paddingVertical="@dimen/_10sdp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Автоблокировка"
android:textColor="@color/black100"
android:textSize="18sp"
android:textStyle="bold" />
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_keyboard_arrow_right"
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout>
<SeekBar
android:layout_width="match_parent"
android:layout_marginTop="48dp"
android:id="@+id/seekbar"
android:visibility="invisible"
android:layout_marginHorizontal="@dimen/_12sdp"
android:layout_height="wrap_content"/>
</com.xw.repo.widget.BounceScrollView>
</LinearLayout>
\ No newline at end of file
......@@ -15,9 +15,8 @@
app:navigationIcon="@drawable/ic_baseline_arrow_back"
/>
<ScrollView
<com.xw.repo.widget.BounceScrollView
android:layout_width="match_parent"
android:id="@+id/scrollView"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
......@@ -223,7 +222,7 @@
</LinearLayout>
</LinearLayout>
</ScrollView>
</com.xw.repo.widget.BounceScrollView>
......
......@@ -35,6 +35,8 @@
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:scrollbars="none"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="match_parent" />
......
......@@ -10,8 +10,8 @@
android:name="com.mobiuz.app.dev.ui.service.ServiceFragment"
android:label="MotionFragment" />
<fragment
android:id="@+id/servicesFragmentActivity"
android:name="com.mobiuz.app.dev.ui.service.ServicesFragmentActivity"
android:id="@+id/ussdFragment"
android:name="com.mobiuz.app.dev.ui.service.UssdFragment"
android:label="ServicesFragmentActivity" />
</navigation>
\ No newline at end of file
......@@ -11,8 +11,9 @@
android:name="com.mobiuz.app.dev.ui.service.ServiceFragment"
android:label="MotionFragment" />
<fragment
android:id="@+id/servicesFragmentActivity"
android:name="com.mobiuz.app.dev.ui.service.ServicesFragmentActivity"
android:id="@+id/ussdFragment"
tools:layout="@layout/fragment_ussd"
android:name="com.mobiuz.app.dev.ui.service.UssdFragment"
android:label="ServicesFragmentActivity" />
<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