每次从桌面进入都会到首页的配置修改

关闭视频播放页不再通过startActivity传递(防止中间黑屏)
This commit is contained in:
yangyakun
2022-07-15 19:03:03 +08:00
parent 56f4882509
commit b93bf36bf5
13 changed files with 94 additions and 34 deletions

View File

@@ -7,4 +7,6 @@ interface ICallback {
void onResult(long meters, long timeInSecond,float speed);
void postEvent(int type);
}

View File

@@ -130,7 +130,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
});
findViewById(R.id.iv_temp).setOnClickListener(view -> {
OverlayLeftViewUtils.INSTANCE.showOverlayView(getActivity());
OverlayLeftViewUtils.INSTANCE.showOverlayView(getActivity(),0,true,-1,true);
OverlayLeftViewUtils.INSTANCE.addDragTarget(vOpenLeft);
//showOrHideArrivedEndLayout(true, "北京北京北京", "1527481606997577728");
//showOrHidePressengerCheckPager(true, "开始站点开", "开始站点开始站点开始", "2", "京A888888", "18811539480");
@@ -258,7 +258,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
if (ochServingOrderFragment == null){
ochServingOrderFragment = new TaxiPassengerServingOrderFragment().newInstance();
}
OverlayLeftViewUtils.INSTANCE.showOverlayView(getActivity());
OverlayLeftViewUtils.INSTANCE.showOverlayView(getActivity(),0,true,-1,true);
OverlayLeftViewUtils.INSTANCE.addDragTarget(vOpenLeft);
if (ochServingOrderFragment.isHidden()){
transaction.show(ochServingOrderFragment).commitAllowingStateLoss();

View File

@@ -225,6 +225,18 @@ object LeftMenuOpen {
icallbacks.finishBroadcast()
}
fun invoKeyByEventType(typeID:Int){
val len = icallbacks.beginBroadcast()
for (i in 0 until len) {
try {
icallbacks.getBroadcastItem(i).postEvent(typeID)
} catch (e: RemoteException) {
e.printStackTrace()
}
}
icallbacks.finishBroadcast()
}
/**
* 主进程、video进程都得调用
* 主进程在显示是主动调用

View File

@@ -42,9 +42,7 @@ class ListAdapter(private val context: Context,val list: MutableList<LeftMenuMod
for (i in list.indices) {
if(index==i){
if(!list[i].isChecked){
if(needStartActivity) {
list[i].selectListener.onSelect()
}
list[i].selectListener.onSelect(needStartActivity)
OverlayLeftViewUtils.transmissionIndex(index)
}
}
@@ -54,7 +52,7 @@ class ListAdapter(private val context: Context,val list: MutableList<LeftMenuMod
}
interface OnTabSelectListener {
fun onSelect()
fun onSelect(isCurrentProcess:Boolean)
}
}

View File

@@ -19,9 +19,11 @@ import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.ui.leftmenu.model.LeftMenuModel
import com.mogo.och.taxi.passenger.mulprocess.EmptyService
import com.mogo.och.taxi.passenger.ui.video.VideoActivity
import com.mogo.och.taxi.passenger.ui.video.event.FinishActivity
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import org.greenrobot.eventbus.EventBus
import java.util.concurrent.TimeUnit
/**
@@ -58,7 +60,7 @@ object OverlayLeftViewUtils {
* 添加覆盖View在Activity上面
*/
@JvmOverloads
fun showOverlayView(context: Activity,checkIndex:Int = LIVE,isOpen: Boolean=true, ani: Int = -1) {
fun showOverlayView(context: Activity,checkIndex:Int = LIVE,isOpen: Boolean=true, ani: Int = -1,isMainProcess: Boolean = false) {
if (isShowing) {
return
}
@@ -96,32 +98,50 @@ object OverlayLeftViewUtils {
val integers = mutableListOf<LeftMenuModel>()
val liveSelected = object :ListAdapter.OnTabSelectListener{
override fun onSelect() {
close(view, windowManager)
VideoActivity.startActivity(context,VideoActivity.VIDEOTYPE_CLOSE)
override fun onSelect(isCurrentProcess:Boolean) {
if(isCurrentProcess) {
close(view, windowManager)
EventBus.getDefault().post(FinishActivity())
}else {
LeftMenuOpen.invoKeyByEventType(VideoActivity.EVENT_FINISH)
}
if(isMainProcess){
//主进程 建议Eventbus实现
}
}
}
val overViewSelected = object :ListAdapter.OnTabSelectListener{
override fun onSelect() {
close(view, windowManager)
ToastUtils.showShort("全程概览")
VideoActivity.startActivity(context,VideoActivity.VIDEOTYPE_CLOSE)
// TODO: 添加全程概览的代码
override fun onSelect(isCurrentProcess:Boolean) {
if(isCurrentProcess) {
close(view, windowManager)
ToastUtils.showShort("全程概览")
EventBus.getDefault().post(FinishActivity())
}else {
LeftMenuOpen.invoKeyByEventType(VideoActivity.EVENT_FINISH)
}
if(isMainProcess){
//主进程 建议Eventbus实现
// TODO: 需要在主进程中 添加全程概览的代码
}
}
}
val consultSelect = object :ListAdapter.OnTabSelectListener{
override fun onSelect() {
close(view, windowManager)
VideoActivity.startActivity(context,VideoActivity.VIDEOTYPE_CONSULT)
override fun onSelect(isCurrentProcess:Boolean) {
if(isCurrentProcess) {
close(view, windowManager)
VideoActivity.startActivity(context, VideoActivity.VIDEOTYPE_CONSULT)
}
}
}
val entertainmentSelect = object :ListAdapter.OnTabSelectListener{
override fun onSelect() {
close(view, windowManager)
VideoActivity.startActivity(context,VideoActivity.VIDEOTYPE_MOIES)
override fun onSelect(isCurrentProcess:Boolean) {
if(isCurrentProcess) {
close(view, windowManager)
VideoActivity.startActivity(context, VideoActivity.VIDEOTYPE_MOIES)
}
}
}
@@ -322,7 +342,7 @@ object OverlayLeftViewUtils {
}
// 管理的要关闭都得关闭
if(isMain) {
VideoActivity.startActivity(overlayView!!.context, VideoActivity.VIDEOTYPE_CLOSE)
LeftMenuOpen.invoKeyByEventType(VideoActivity.EVENT_FINISH)
}
subscribe = null
LeftMenuOpen.clearValue()

View File

@@ -24,6 +24,7 @@ import com.mogo.och.taxi.passenger.bean.TaxiPassengerVideoPlay
import com.mogo.och.taxi.passenger.mulprocess.ICallback
import com.mogo.och.taxi.passenger.ui.leftmenu.LeftMenuOpen
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils
import com.mogo.och.taxi.passenger.ui.video.event.FinishActivity
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselLayoutManager
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselZoomPostLayoutListener
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CenterScrollListener
@@ -35,6 +36,9 @@ import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorOrientation
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorSlideMode
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorStyle
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.*
import kotlin.math.floor
@@ -57,6 +61,8 @@ class VideoActivity : AppCompatActivity() {
const val VIDEOTYPE_MOIES = 1
const val VIDEOTYPE_CLOSE = 2
const val EVENT_FINISH = 0
fun startActivity(context:Context,videoType:Int){
val intent = Intent(context, VideoActivity::class.java)
intent.putExtra(VIDEOTYPE, videoType)
@@ -97,10 +103,20 @@ class VideoActivity : AppCompatActivity() {
FloatingDistanceInfoUtils.setSpeed(speed)
}
}
override fun postEvent(type: Int) {
when (type) {
EVENT_FINISH -> {
finish()
}
else -> {}
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
EventBus.getDefault().register(this)
configPage()
}
@@ -128,10 +144,6 @@ class VideoActivity : AppCompatActivity() {
tvTitle.text = "影视娱乐"
initMoviesData()
}
VIDEOTYPE_CLOSE ->{
finish()
return
}
}
initListener()
initData()
@@ -294,6 +306,9 @@ class VideoActivity : AppCompatActivity() {
vOpenLeft = findViewById(R.id.v_open_left)
acivTitleIcon = findViewById(R.id.aciv_title_icon)
tvTitle = findViewById(R.id.tv_mogo_consult)
acivTitleIcon.setOnClickListener {
finish()
}
}
@@ -372,11 +387,15 @@ class VideoActivity : AppCompatActivity() {
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun finishActivity(event: FinishActivity){
finish()
}
override fun onDestroy() {
super.onDestroy()
if(videotype!=VIDEOTYPE_CLOSE){
LeftMenuOpen.unregisterCallback(callBack)
}
EventBus.getDefault().unregister(this)
LeftMenuOpen.unregisterCallback(callBack)
releaseOnNewInstance()
OverlayLeftViewUtils.dismissOverlayView(false)
FloatingDistanceInfoUtils.dismissOverlayView()

View File

@@ -0,0 +1,4 @@
package com.mogo.och.taxi.passenger.ui.video.event;
public class FinishActivity {
}

View File

@@ -48,6 +48,7 @@
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent
</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowEnterAnimation">@null</item>
<item name="android:windowExitAnimation">@null</item>
<item name="android:windowAnimationStyle">@null</item>

View File

@@ -18,7 +18,7 @@ project.android.productFlavors {
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '2'
//高德地图鉴权信息
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue, CHANNEL_VALUE: "fPadLenovoOchBus"]
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue, CHANNEL_VALUE: "fPadLenovoOchBus",ACTIVITY_ROOT:true]
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'

View File

@@ -16,7 +16,7 @@ project.android.productFlavors {
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '2'
//高德地图鉴权信息
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue, CHANNEL_VALUE: "fPadLenovoOchBusPassenger"]
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue, CHANNEL_VALUE: "fPadLenovoOchBusPassenger",ACTIVITY_ROOT:true]
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'

View File

@@ -19,7 +19,7 @@ project.android.productFlavors {
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '2'
//高德地图鉴权信息
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue, CHANNEL_VALUE: "fPadLenovoOchTaxi"]
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue, CHANNEL_VALUE: "fPadLenovoOchTaxi",ACTIVITY_ROOT:true]
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'

View File

@@ -18,7 +18,7 @@ project.android.productFlavors {
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '2'
//高德地图鉴权信息
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue, CHANNEL_VALUE: "fPadLenovoOchTaxiPassenger"]
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue, CHANNEL_VALUE: "fPadLenovoOchTaxiPassenger",ACTIVITY_ROOT:false]
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'

View File

@@ -34,7 +34,7 @@
-->
<activity
android:name="com.mogo.eagle.core.function.main.MainLauncherActivity"
android:clearTaskOnLaunch="true"
android:clearTaskOnLaunch="${ACTIVITY_ROOT}"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
android:enabled="true"
android:launchMode="singleTop"
@@ -63,6 +63,10 @@
</intent-filter>
</activity>
<meta-data
android:name="MAP_SDK_VERSION111111"
android:value="${MAP_SDK_VERSION}" />
<service
android:name="com.mogo.eagle.core.function.main.service.MogoMainService"
android:enabled="true"