This commit is contained in:
unknown
2020-09-09 14:11:56 +08:00
parent 7e6c96c8d6
commit 099d45d7cf
14 changed files with 58 additions and 160 deletions

View File

@@ -1,6 +1,8 @@
package com.mogo.module.guide.fragment
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.GuideBizManager
@@ -10,6 +12,7 @@ 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.*
import kotlinx.android.synthetic.main.module_guide_item_include.*
class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideConstract.View {
@@ -34,10 +37,36 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
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))
.setSliderWidth(context!!.resources.getDimension(R.dimen.dp_22))
.setSlideMode(IndicatorSlideMode.NORMAL)
.setIndicatorStyle(IndicatorStyle.CIRCLE)
.setupWithViewPager(moduleGuideViewPager)
visibleRight()
module_guide_page_left.setOnClickListener {
moveToBack()
}
module_guide_page_right.setOnClickListener {
moveToNext()
}
module_guide_tv_jump.setOnClickListener {
closeGuideFragment()
}
}
fun visibleLeft(){
module_guide_page_left.visibility = View.VISIBLE
}
fun invisibleLeft(){
module_guide_page_left.visibility = View.GONE
}
fun visibleRight(){
module_guide_page_right.visibility = View.VISIBLE
}
fun invisibleRight(){
module_guide_page_right.visibility = View.GONE
}
fun moveToNext() {
@@ -47,10 +76,10 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
}
}
fun moveToBack() {
private fun moveToBack() {
val count = adapter?.itemCount
val backCount = moduleGuideViewPager.currentItem - 1
if (moduleGuideViewPager.currentItem != count && backCount != 0) {
if (moduleGuideViewPager.currentItem != count) {
moduleGuideViewPager.currentItem = backCount
}
}

View File

@@ -1,6 +1,5 @@
package com.mogo.module.guide.guide
import android.view.View
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
@@ -8,9 +7,8 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_five.*
class GuideStageFiveFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
class GuideStageFiveFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
@@ -27,30 +25,19 @@ 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 {
containerFragment?.invisibleRight()
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_five), object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.closeGuideFragment()
}
})
}
override fun onClick(v: View) {
when (v.id) {
R.id.module_guide_page_left -> {
containerFragment?.moveToBack()
}
R.id.module_guide_tv_jump -> {
containerFragment?.closeGuideFragment()
}
}
}
class GuideLocationPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)

View File

@@ -1,6 +1,5 @@
package com.mogo.module.guide.guide
import android.view.View
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
@@ -8,9 +7,8 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_include.*
class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
@@ -27,34 +25,19 @@ class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>>, View.OnClic
}
override fun initViews() {
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 {
containerFragment?.visibleRight()
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_four), object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.moveToNext()
}
})
}
override fun onClick(v: View) {
when (v.id) {
R.id.module_guide_page_left -> {
containerFragment?.moveToBack()
}
R.id.module_guide_page_right -> {
containerFragment?.moveToNext()
}
R.id.module_guide_tv_jump -> {
containerFragment?.closeGuideFragment()
}
}
}
class GuideNavigationPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)

View File

@@ -1,6 +1,5 @@
package com.mogo.module.guide.guide
import android.view.View
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
@@ -10,10 +9,9 @@ import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.AnalyticsUtil
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_SHOW
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_one.*
class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
@@ -31,30 +29,19 @@ class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>>, View.OnClick
override fun initViews() {
AnalyticsUtil.track(INVOKE_TRACK_SHOW, hashMapOf("pages_num" to 1))
module_guide_page_right.setOnClickListener(this)
module_guide_tv_jump.setOnClickListener(this)
containerFragment?.visibleRight()
}
override fun onResume() {
super.onResume()
speak(context!!,context!!.resources.getString(R.string.module_guide_voice_page_one),object : IMogoVoiceCmdCallBack {
containerFragment?.invisibleLeft()
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_one), object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.moveToNext()
}
})
}
override fun onClick(v: View) {
when (v.id) {
R.id.module_guide_page_right -> {
containerFragment?.moveToNext()
}
R.id.module_guide_tv_jump -> {
containerFragment?.closeGuideFragment()
}
}
}
class GuideStartPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)

View File

@@ -1,6 +1,5 @@
package com.mogo.module.guide.guide
import android.view.View
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
@@ -8,9 +7,8 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_include.*
class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
@@ -27,34 +25,18 @@ class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>>, View.OnCli
}
override fun initViews() {
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 {
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_three), object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.moveToNext()
}
})
}
override fun onClick(v: View) {
when (v.id) {
R.id.module_guide_page_left -> {
containerFragment?.moveToBack()
}
R.id.module_guide_page_right -> {
containerFragment?.moveToNext()
}
R.id.module_guide_tv_jump -> {
containerFragment?.closeGuideFragment()
}
}
}
class GuideOnLineCarPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)

View File

@@ -1,6 +1,5 @@
package com.mogo.module.guide.guide
import android.view.View
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
@@ -8,9 +7,8 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_include.*
class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
@@ -27,34 +25,19 @@ class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>>, View.OnClick
}
override fun initViews() {
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 {
containerFragment?.visibleLeft()
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_two), object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
containerFragment?.moveToNext()
}
})
}
override fun onClick(v: View) {
when (v.id) {
R.id.module_guide_page_left -> {
containerFragment?.moveToBack()
}
R.id.module_guide_page_right -> {
containerFragment?.moveToNext()
}
R.id.module_guide_tv_jump -> {
containerFragment?.closeGuideFragment()
}
}
}
class GuideCardPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)

View File

@@ -21,4 +21,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<include
android:id="@+id/module_guide_include"
layout="@layout/module_guide_item_include" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -9,6 +9,7 @@
android:layout_width="@dimen/dp_52"
android:layout_height="@dimen/dp_87"
android:layout_marginRight="@dimen/dp_92"
android:visibility="gone"
android:src="@mipmap/module_guide_right_page"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
@@ -19,6 +20,7 @@
android:layout_width="@dimen/dp_52"
android:layout_height="@dimen/dp_87"
android:layout_marginLeft="@dimen/dp_92"
android:visibility="gone"
android:src="@mipmap/module_guide_left_page"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"

View File

@@ -1,31 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<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="match_parent"
android:background="@mipmap/module_guide_item_stage_five">
<ImageView
android:id="@+id/module_guide_page_left"
android:layout_width="@dimen/dp_52"
android:layout_height="@dimen/dp_87"
android:layout_marginLeft="@dimen/dp_92"
android:src="@mipmap/module_guide_left_page"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_guide_tv_jump"
android:layout_width="@dimen/dp_159"
android:layout_height="@dimen/dp_64"
android:layout_marginTop="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_55"
android:background="@drawable/module_guide_blue_corner"
android:gravity="center"
android:text="@string/module_guide_skip"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_37"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -3,8 +3,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_four">
<include
android:id="@+id/module_guide_include"
layout="@layout/module_guide_item_include" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,31 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<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="match_parent"
android:background="@mipmap/module_guide_item_stage_one">
<ImageView
android:id="@+id/module_guide_page_right"
android:layout_width="@dimen/dp_52"
android:layout_height="@dimen/dp_87"
android:layout_marginRight="@dimen/dp_92"
android:src="@mipmap/module_guide_right_page"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_guide_tv_jump"
android:layout_width="@dimen/dp_159"
android:layout_height="@dimen/dp_64"
android:layout_marginTop="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_55"
android:background="@drawable/module_guide_blue_corner"
android:gravity="center"
android:text="@string/module_guide_skip"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_37"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -3,8 +3,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_three">
<include
android:id="@+id/module_guide_include"
layout="@layout/module_guide_item_include" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -3,8 +3,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_two">
<include
android:id="@+id/module_guide_include"
layout="@layout/module_guide_item_include" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,6 +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_dark">#33ffffff</color>
<color name="module_guide_indicator_white">#ffffff</color>
</resources>