add indicator

This commit is contained in:
unknown
2020-09-08 16:46:20 +08:00
parent b697ebe600
commit 52ea58f2f5
10 changed files with 43 additions and 0 deletions

View File

@@ -84,6 +84,7 @@ targetSdkVersion : 22,
// material
material : 'com.google.android.material:material:1.1.0',
indicator : 'com.github.zhpanvip:viewpagerindicator:1.0.4',
// modules
moduletanlu : "com.mogo.module:module-tanlu:${MOGO_MODULE_TANLU_VERSION}",

View File

@@ -52,6 +52,7 @@ dependencies {
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.aspectj
implementation rootProject.ext.dependencies.indicator
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogoutils

View File

@@ -1,13 +1,17 @@
package com.mogo.module.guide.fragment
import androidx.recyclerview.widget.RecyclerView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.GuideBizManager
import com.mogo.module.guide.R
import com.mogo.module.guide.util.speak
import com.mogo.utils.logger.Logger
import com.zhpan.indicator.enums.IndicatorSlideMode
import com.zhpan.indicator.enums.IndicatorStyle
import kotlinx.android.synthetic.main.module_guide_fragment.*
class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideConstract.View {
companion object {
@@ -28,6 +32,12 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
Logger.d(TAG, "init Views")
adapter = GuideAdapter(this)
moduleGuideViewPager.adapter = adapter
(moduleGuideViewPager.getChildAt(0) as RecyclerView).layoutManager!!.isItemPrefetchEnabled = false
moduleGuideIndicator.setSliderColor(context!!.resources.getColor(R.color.module_guide_indicator_dark),context!!.resources.getColor(R.color.module_guide_indicator_white))
.setSliderWidth(context!!.resources.getDimension(R.dimen.dp_11))
.setSlideMode(IndicatorSlideMode.NORMAL)
.setIndicatorStyle(IndicatorStyle.CIRCLE)
.setupWithViewPager(moduleGuideViewPager)
}
fun moveToNext() {

View File

@@ -29,6 +29,10 @@ class GuideStageFiveFragment : MvpFragment<IView, Presenter<IView>>, View.OnClic
override fun initViews() {
module_guide_page_left.setOnClickListener(this)
module_guide_tv_jump.setOnClickListener(this)
}
override fun onResume() {
super.onResume()
speak(context!!,context!!.resources.getString(R.string.module_guide_voice_page_five),object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.closeGuideFragment()

View File

@@ -30,6 +30,10 @@ class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>>, View.OnClic
module_guide_page_left.setOnClickListener(this)
module_guide_page_right.setOnClickListener(this)
module_guide_tv_jump.setOnClickListener(this)
}
override fun onResume() {
super.onResume()
speak(context!!,context!!.resources.getString(R.string.module_guide_voice_page_four),object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.moveToNext()

View File

@@ -33,6 +33,10 @@ class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>>, View.OnClick
AnalyticsUtil.track(INVOKE_TRACK_SHOW, hashMapOf("pages_num" to 1))
module_guide_page_right.setOnClickListener(this)
module_guide_tv_jump.setOnClickListener(this)
}
override fun onResume() {
super.onResume()
speak(context!!,context!!.resources.getString(R.string.module_guide_voice_page_one),object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.moveToNext()

View File

@@ -30,6 +30,10 @@ class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>>, View.OnCli
module_guide_page_left.setOnClickListener(this)
module_guide_page_right.setOnClickListener(this)
module_guide_tv_jump.setOnClickListener(this)
}
override fun onResume() {
super.onResume()
speak(context!!,context!!.resources.getString(R.string.module_guide_voice_page_three),object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.moveToNext()

View File

@@ -30,6 +30,10 @@ class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>>, View.OnClick
module_guide_page_left.setOnClickListener(this)
module_guide_page_right.setOnClickListener(this)
module_guide_tv_jump.setOnClickListener(this)
}
override fun onResume() {
super.onResume()
speak(context!!,context!!.resources.getString(R.string.module_guide_voice_page_two),object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.moveToNext()

View File

@@ -12,4 +12,13 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.zhpan.indicator.IndicatorView
android:id="@+id/moduleGuideIndicator"
android:layout_width="@dimen/dp_30"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_84"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_guide_blue_3B91FF">#3B91FF</color>
<color name="module_guide_indicator_dark">#ccffffff</color>
<color name="module_guide_indicator_white">#ffffff</color>
</resources>