[M2] 走马灯

This commit is contained in:
wangmingjun
2023-03-11 01:03:57 +08:00
parent 91299cb6f4
commit 37d04c8c05
5 changed files with 36 additions and 70 deletions

View File

@@ -4,6 +4,9 @@ import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager.stepInDayMode
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
@@ -17,7 +20,7 @@ import com.mogo.och.bus.passenger.ui.PM2BaseFragment
* Created on 2022/3/29
*/
@Route(path = BusPassengerConst.PATH)
class MogoOCHBusPassenger : IMogoOCH {
class MogoOCHBusPassenger : IMogoOCH, IMogoStatusChangedListener {
private var mActivity: FragmentActivity? = null
private var mContainerId = 0
private var mPM2Fragment: PM2BaseFragment? = null
@@ -25,7 +28,12 @@ class MogoOCHBusPassenger : IMogoOCH {
override fun createCoverage(activity: FragmentActivity?, containerId: Int?): Fragment? {
mActivity = activity
mContainerId = containerId!!
showFragment()
// if (MogoStatusManager.getInstance().isScreenCoverDismiss){
showFragment()
// }else{
// MogoStatusManager.getInstance()
// .registerStatusChangedListener("ochM2Passenger", StatusDescriptor.SCREEN_COVER, this)
// }
return null
}
@@ -71,4 +79,14 @@ class MogoOCHBusPassenger : IMogoOCH {
companion object {
private val TAG = MogoOCHBusPassenger::class.java.simpleName
}
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
if (descriptor == StatusDescriptor.SCREEN_COVER){
if (isTrue){
showFragment()
}else{
hideFragment()
}
}
}
}

View File

@@ -48,7 +48,8 @@ class PM2DrivingInfoFragment :
speed_tv.onClick {
context?.let { it -> ToggleDebugView.toggleDebugView.toggle(it) }
}
current_time_tv.onClick {
// current_time_tv.onClick {
// //测试V2X消息
// CallerMsgBoxManager.saveMsgBox(
@@ -70,7 +71,7 @@ class PM2DrivingInfoFragment :
// MsgBoxType.NOTICE, noticeFromCloudMsg)
// )
// BPRouteDataTestUtils.converToRouteData()
}
// }
updateCurrentTime()
timeHandler = TimeHandler(this)
timeHandler?.sendEmptyMessageDelayed(WHAT_TIME_CURRENT, LOOP_TIME_TEXT)

View File

@@ -20,7 +20,7 @@ class AdvanceGSYVideoPlayer: StandardGSYVideoPlayer {
init {
hideWidget()
GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL)
GSYVideoType.setRenderType(GSYVideoType.GLSURFACE)
GSYVideoType.setRenderType(GSYVideoType.TEXTURE)
}
override fun hideAllWidget() {

View File

@@ -33,7 +33,7 @@
android:src="@drawable/img_drive_bg"/>
<!-- 行车卡片-->
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/speed_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -44,10 +44,9 @@
android:layout_marginTop="@dimen/dp_36"
app:layout_constraintLeft_toLeftOf="@+id/img_drive_bg"
android:layout_marginLeft="@dimen/dp_48"
app:layout_constraintTop_toTopOf="@+id/img_drive_bg"
tools:ignore="SpUsage" />
app:layout_constraintTop_toTopOf="@+id/img_drive_bg"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_8"
@@ -122,18 +121,21 @@
app:layout_constraintLeft_toLeftOf="@+id/speed_tv"
android:textColor="@color/m2_next_tv_color"/>
<com.mogo.och.common.module.wigets.MoreFocusMarqueeTextView
<com.mogo.och.common.module.wigets.MarqueeTextView
android:id="@+id/station_name_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:text="@string/m2_p_empty_tv"
android:textSize="@dimen/dp_22"
android:layout_marginTop="@dimen/dp_8"
app:layout_constraintRight_toRightOf="@+id/img_line_location_bg"
app:layout_constraintTop_toBottomOf="@+id/station_name_title_tv"
app:layout_constraintLeft_toLeftOf="@+id/speed_tv"
android:textColor="@color/m2_next_tv_color"/>
android:textColor="@color/m2_line_name_tv_color"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/remain_mt"
@@ -180,11 +182,14 @@
android:textColor="@color/m2_next_tv_color"/>
<com.mogo.och.common.module.wigets.MoreFocusMarqueeTextView
<com.mogo.och.common.module.wigets.MarqueeTextView
android:id="@+id/line_name_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:layout_marginTop="@dimen/dp_40"
android:textSize="@dimen/dp_22"
app:layout_constraintRight_toRightOf="@+id/img_line_location_bg"

View File

@@ -1,58 +0,0 @@
package com.mogo.och.common.module.wigets;
import android.content.Context;
import android.graphics.Rect;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.ViewDebug;
public class MoreFocusMarqueeTextView extends androidx.appcompat.widget.AppCompatTextView{
public MoreFocusMarqueeTextView(Context context) {
this(context, null);
}
public MoreFocusMarqueeTextView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MoreFocusMarqueeTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
//设置文字内容超过textView宽度时候以跑马灯的形式
setEllipsize(TextUtils.TruncateAt.MARQUEE);
//设置焦点
setFocusable(true);
//设置触摸模式下是否可以获得焦点
setFocusableInTouchMode(true);
//设置跑马灯循环次数 -1为always 无限循环 3就是3次 4就是4次 0没试过
setMarqueeRepeatLimit(-1);
}
@Override
@ViewDebug.ExportedProperty(category = "focus")
public boolean isFocused() {
return true;
}
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
if (focused)
super.onFocusChanged(true, direction, previouslyFocusedRect);
}
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
if (hasWindowFocus){}
super.onWindowFocusChanged(true);
}
@Override
@ViewDebug.ExportedProperty
public boolean isSelected() {
return true;
}
}