opt
This commit is contained in:
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@@ -4,7 +4,7 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
@@ -82,6 +82,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,7 @@ class NoticeNormalBroadcastReceiver : BroadcastReceiver() {
|
||||
"https://dataservice-1255510688.cos.ap-beijing.myqcloud.com/carImg/yycp_NoticeDETAIL_location.png",
|
||||
"https://vd2.bdstatic.com/mda-mk1347dzxdmcre0y/sc/cae_h264/1635819498112313003/mda-mk1347dzxdmcre0y.mp4?v_from_s=hkapp-haokan-tucheng&auth_key=1635837585-0-0-5295f6658c7711ba7b4d3ef478a7fbaa&bcevod_channel=searchbox_feed&pd=1&pt=3&abtest=",
|
||||
2)
|
||||
SharedPrefs.getInstance(context).putInt("videoType", 1)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -34,6 +35,7 @@ public class NoticeBannerView extends ConstraintLayout {
|
||||
public NoticeBannerView(@NonNull Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
SharedPrefs.getInstance(context).putInt("videoType", 2); //小的视频播放ui
|
||||
LayoutInflater.from(context).inflate(R.layout.notice_push_top_banner, this);
|
||||
initView();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.getApis
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.gone
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.visible
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs
|
||||
import com.mogo.service.windowview.IMogoTopViewManager
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener
|
||||
import com.mogo.utils.glide.GlideApp
|
||||
@@ -65,6 +66,9 @@ class NoticeFloatView constructor(
|
||||
}
|
||||
pushCheckDialog!!.showCheckDialog(it)
|
||||
}
|
||||
|
||||
//弹框消失
|
||||
hide()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +126,7 @@ class NoticeFloatView constructor(
|
||||
|
||||
init {
|
||||
inflateView(R.layout.notice_push_top_banner)
|
||||
SharedPrefs.getInstance(context).putInt("videoType", 1) //大的播放器
|
||||
}
|
||||
|
||||
private var topViewStatusListener = object : IMogoTopViewStatusListener {
|
||||
|
||||
@@ -17,11 +17,13 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
|
||||
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
|
||||
import com.mogo.eagle.core.function.call.notice.CallerNoticeManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.widget.media.video.NoticeSimpleSmallVideoPlayer;
|
||||
import com.mogo.eagle.core.widget.media.video.NoticeSimpleVideoPlayer;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.BitmapHelper;
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager;
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
|
||||
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack;
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView;
|
||||
@@ -130,6 +132,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
});
|
||||
close = findViewById(R.id.notice_traffic_dialog_close);
|
||||
close.setOnClickListener(v -> {
|
||||
releasePlayer();
|
||||
dismiss();
|
||||
});
|
||||
if (mPushData.getType() == 1) {
|
||||
@@ -324,6 +327,14 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
|
||||
}
|
||||
|
||||
private void releasePlayer() {
|
||||
try {
|
||||
GSYVideoManager.releaseAllVideos();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
android:background="@drawable/notice_connect"
|
||||
android:gravity="center"
|
||||
android:text="连接"
|
||||
android:visibility="gone"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/video_player"
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
package com.mogo.eagle.core.widget.media.video
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.Surface
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs
|
||||
import com.mogo.eagle.core.utilcode.util.TimeTransformUtils
|
||||
import com.mogo.eagle.core.widget.R
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @since 2021/11/3
|
||||
*
|
||||
* 视频播放器,ui定制
|
||||
*/
|
||||
class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer {
|
||||
|
||||
companion object {
|
||||
const val PLAY_EVT_PLAY_LOADING = 1000
|
||||
const val PLAY_EVT_PLAY_BEGIN = 2000
|
||||
const val PLAY_EVT_PLAY_ERROR = 3000
|
||||
}
|
||||
|
||||
private var playListener: PlayListener? = null
|
||||
private lateinit var start: ImageView
|
||||
private lateinit var coverImage: ImageView
|
||||
private lateinit var fullscreen: ImageView
|
||||
private lateinit var currentTimeTextView: TextView
|
||||
private lateinit var totalTimeTextView: TextView
|
||||
|
||||
interface PlayListener {
|
||||
fun onPlayEvent(event: Int)
|
||||
}
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
||||
|
||||
override fun init(context: Context) {
|
||||
super.init(context)
|
||||
start = findViewById(R.id.start)
|
||||
coverImage = findViewById(R.id.thumbImage)
|
||||
fullscreen = findViewById(R.id.fullscreen)
|
||||
currentTimeTextView = findViewById(R.id.current)
|
||||
totalTimeTextView = findViewById(R.id.total)
|
||||
|
||||
if (mThumbImageViewLayout != null
|
||||
&& (mCurrentState == -1 || mCurrentState == CURRENT_STATE_NORMAL || mCurrentState == CURRENT_STATE_ERROR)
|
||||
) {
|
||||
mThumbImageViewLayout.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.item_notice_video_small
|
||||
}
|
||||
|
||||
override fun getGSYVideoManager(): GSYVideoViewBridge {
|
||||
GSYVideoManager.instance().initContext(context.applicationContext)
|
||||
return GSYVideoManager.instance()
|
||||
}
|
||||
|
||||
override fun updateStartImage() {
|
||||
when (mCurrentState) {
|
||||
GSYVideoView.CURRENT_STATE_PLAYING ->
|
||||
start.setImageResource(R.drawable.notice_video_pause)
|
||||
GSYVideoView.CURRENT_STATE_ERROR ->
|
||||
start.setImageResource(R.drawable.notice_video_pause)
|
||||
else -> start.setImageResource(R.drawable.notice_video_play)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setProgressAndTime(
|
||||
progress: Int,
|
||||
secProgress: Int,
|
||||
currentTime: Int,
|
||||
totalTime: Int,
|
||||
forceChange: Boolean
|
||||
) {
|
||||
super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||
mBottomContainer?.visibility = View.VISIBLE
|
||||
mProgressBar?.visibility = View.VISIBLE
|
||||
start?.visibility = View.VISIBLE
|
||||
fullscreen?.visibility = View.GONE
|
||||
//时间显示
|
||||
currentTimeTextView?.text = TimeTransformUtils.stringForTime(currentTime)
|
||||
totalTimeTextView?.text = TimeTransformUtils.stringForTime(totalTime)
|
||||
|
||||
if (progress != 0) {
|
||||
mProgressBar?.progress = progress
|
||||
}
|
||||
}
|
||||
|
||||
fun setPlayListener(listener: PlayListener) {
|
||||
this.playListener = listener
|
||||
}
|
||||
|
||||
override fun changeUiToCompleteShow() {
|
||||
super.changeUiToCompleteShow()
|
||||
}
|
||||
|
||||
override fun hideAllWidget() {
|
||||
super.hideAllWidget()
|
||||
mBottomContainer?.visibility = View.VISIBLE
|
||||
mProgressBar?.visibility = View.VISIBLE
|
||||
start?.visibility = View.VISIBLE
|
||||
start.setImageResource(R.drawable.notice_video_pause)
|
||||
}
|
||||
|
||||
override fun changeUiToPrepareingClear() {
|
||||
super.changeUiToPrepareingClear()
|
||||
mBottomContainer?.visibility = View.INVISIBLE
|
||||
mProgressBar?.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun changeUiToPlayingBufferingClear() {
|
||||
super.changeUiToPlayingBufferingClear()
|
||||
mBottomContainer?.visibility = View.INVISIBLE
|
||||
mProgressBar?.visibility = View.GONE
|
||||
|
||||
}
|
||||
|
||||
override fun changeUiToClear() {
|
||||
super.changeUiToClear()
|
||||
}
|
||||
|
||||
override fun changeUiToCompleteClear() {
|
||||
super.changeUiToCompleteClear()
|
||||
mBottomContainer?.visibility = View.INVISIBLE
|
||||
mProgressBar?.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onAutoCompletion() {
|
||||
super.onAutoCompletion()
|
||||
}
|
||||
|
||||
override fun showWifiDialog() {
|
||||
//直接播放,不显示WIFI对话框
|
||||
startPlayLogic()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
mProgressBar?.progress = 0
|
||||
mFullPauseBitmap = null
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
super.onClick(v)
|
||||
}
|
||||
|
||||
override fun onCompletion() {
|
||||
Logger.d("liyz", "onCompletion ------> ")
|
||||
mBottomContainer?.visibility = View.VISIBLE
|
||||
mProgressBar?.visibility = View.VISIBLE
|
||||
start?.visibility = View.VISIBLE
|
||||
start.setImageResource(R.drawable.notice_video_play)
|
||||
|
||||
isPostBufferUpdate = false
|
||||
}
|
||||
|
||||
override fun onSurfaceUpdated(surface: Surface) {
|
||||
super.onSurfaceUpdated(surface)
|
||||
if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||
mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPrepared() {
|
||||
super.onPrepared()
|
||||
playListener?.onPlayEvent(PLAY_EVT_PLAY_LOADING)
|
||||
}
|
||||
|
||||
private var isPostBufferUpdate = false
|
||||
|
||||
override fun onBufferingUpdate(percent: Int) {
|
||||
super.onBufferingUpdate(percent)
|
||||
if (!isPostBufferUpdate && percent == 0) {
|
||||
isPostBufferUpdate = true
|
||||
playListener?.onPlayEvent(PLAY_EVT_PLAY_BEGIN)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(what: Int, extra: Int) {
|
||||
super.onError(what, extra)
|
||||
playListener?.onPlayEvent(PLAY_EVT_PLAY_ERROR)
|
||||
isPostBufferUpdate = false
|
||||
}
|
||||
|
||||
override fun setViewShowState(view: View?, visibility: Int) {
|
||||
if (view === mThumbImageViewLayout && visibility != View.VISIBLE) {
|
||||
return
|
||||
}
|
||||
super.setViewShowState(view, visibility)
|
||||
}
|
||||
|
||||
override fun onSurfaceAvailable(surface: Surface) {
|
||||
super.onSurfaceAvailable(surface)
|
||||
mProgressBar?.visibility = View.GONE
|
||||
if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
|
||||
if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||
mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs
|
||||
import com.mogo.eagle.core.utilcode.util.TimeTransformUtils
|
||||
import com.mogo.eagle.core.widget.R
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
@@ -61,7 +62,14 @@ class NoticeSimpleVideoPlayer : StandardGSYVideoPlayer {
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.item_notice_video
|
||||
Log.d("liyz", "NoticeSimpleVideoPlayer --- getLayoutId type = " + SharedPrefs.getInstance(context).getInt("videoType", 0))
|
||||
if (SharedPrefs.getInstance(context).getInt("videoType", 0) == 1) { //大播放器
|
||||
return R.layout.item_notice_video
|
||||
}
|
||||
|
||||
return R.layout.item_notice_video_small
|
||||
|
||||
// return R.layout.item_notice_video
|
||||
}
|
||||
|
||||
override fun getGSYVideoManager(): GSYVideoViewBridge {
|
||||
|
||||
@@ -14,14 +14,8 @@
|
||||
<RelativeLayout
|
||||
android:id="@+id/thumb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<!-- android:layout_alignParentStart="true"-->
|
||||
<!-- android:layout_alignParentLeft="true"-->
|
||||
<!-- android:layout_alignParentTop="true"-->
|
||||
<!-- android:layout_alignParentEnd="true"-->
|
||||
<!-- android:layout_alignParentRight="true"-->
|
||||
<!-- android:layout_alignParentBottom="true"-->
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thumbImage"
|
||||
android:layout_width="match_parent"
|
||||
@@ -37,15 +31,15 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="20px"
|
||||
android:layout_marginBottom="@dimen/layout_margin_bottom"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start"
|
||||
android:layout_width="52px"
|
||||
android:layout_height="52px"
|
||||
android:layout_marginLeft="56px"
|
||||
android:layout_marginRight="50px"
|
||||
android:layout_width="@dimen/notice_play_height"
|
||||
android:layout_height="@dimen/notice_play_height"
|
||||
android:layout_marginLeft="@dimen/notice_play_marginleft"
|
||||
android:layout_marginRight="@dimen/notice_play_marginright"
|
||||
android:src="@drawable/notice_video_pause"
|
||||
android:layout_gravity="bottom" />
|
||||
|
||||
@@ -54,16 +48,16 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginRight="30px"
|
||||
android:layout_marginRight="@dimen/notice_current_time_margin"
|
||||
android:layout_marginBottom="5px"
|
||||
android:gravity="center_vertical"
|
||||
android:text="02:23"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="26px" />
|
||||
android:textSize="@dimen/time_textsize" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="990px"
|
||||
android:layout_width="@dimen/notice_seekbar_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
@@ -77,23 +71,23 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginLeft="30px"
|
||||
android:layout_marginLeft="@dimen/notice_current_time_margin"
|
||||
android:layout_marginBottom="5px"
|
||||
android:text="08:66"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="26px" />
|
||||
android:textSize="@dimen/time_textsize" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fullscreen"
|
||||
android:layout_width="60px"
|
||||
android:layout_height="60px"
|
||||
android:layout_width="@dimen/notice_fullscreen_bt"
|
||||
android:layout_height="@dimen/notice_fullscreen_bt"
|
||||
android:scaleType="centerInside" />
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="56px"
|
||||
android:layout_height="56px"
|
||||
android:layout_width="@dimen/notice_loading_bt"
|
||||
android:layout_height="@dimen/notice_loading_bt"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:indeterminateTint="#256BFF"
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/item_video_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/surface_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/thumb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thumbImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!--局部播放器-->
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/layout_margin_bottom"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start"
|
||||
android:layout_width="@dimen/notice_play_height_small"
|
||||
android:layout_height="@dimen/notice_play_height_small"
|
||||
android:layout_marginLeft="@dimen/notice_play_marginleft_small"
|
||||
android:layout_marginRight="@dimen/notice_play_marginright_small"
|
||||
android:src="@drawable/notice_video_pause"
|
||||
android:layout_gravity="bottom" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginRight="@dimen/notice_current_time_margin_small"
|
||||
android:layout_marginBottom="5px"
|
||||
android:gravity="center_vertical"
|
||||
android:text="02:23"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/time_textsize" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="@dimen/notice_seekbar_width_small"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
android:maxHeight="8px"
|
||||
android:minHeight="8px"
|
||||
android:progressDrawable="@drawable/notice_seekbar_style"
|
||||
android:thumb="@drawable/notice_player_ic_circle_nor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/total"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginLeft="@dimen/notice_current_time_margin_small"
|
||||
android:layout_marginBottom="5px"
|
||||
android:text="08:66"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/time_textsize" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fullscreen"
|
||||
android:layout_width="@dimen/notice_fullscreen_bt"
|
||||
android:layout_height="@dimen/notice_fullscreen_bt"
|
||||
android:scaleType="centerInside" />
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="@dimen/notice_loading_bt"
|
||||
android:layout_height="@dimen/notice_loading_bt"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:indeterminateTint="#256BFF"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -40,6 +40,21 @@
|
||||
<dimen name="module_switch_image">35px</dimen>
|
||||
<dimen name="module_switch_image_circle">38px</dimen>
|
||||
|
||||
<!--player-->
|
||||
<dimen name="notice_play_height">52px</dimen>
|
||||
<dimen name="notice_play_marginleft">56px</dimen>
|
||||
<dimen name="notice_play_marginright">50px</dimen>
|
||||
<dimen name="notice_current_time_margin">30px</dimen>
|
||||
<dimen name="notice_seekbar_width">990px</dimen>
|
||||
<dimen name="notice_fullscreen_bt">60px</dimen>
|
||||
<dimen name="notice_loading_bt">56px</dimen>
|
||||
<dimen name="time_textsize">26px</dimen>
|
||||
<dimen name="layout_margin_bottom">20px</dimen>
|
||||
|
||||
<dimen name="notice_play_height_small">52px</dimen>
|
||||
<dimen name="notice_play_marginleft_small">35px</dimen>
|
||||
<dimen name="notice_play_marginright_small">26</dimen>
|
||||
<dimen name="notice_current_time_margin_small">15px</dimen>
|
||||
<dimen name="notice_seekbar_width_small">600px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.mogo.eagle.core.utilcode.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 通用sp处理类
|
||||
*/
|
||||
public class SharedPrefs {
|
||||
|
||||
private static final String File_Name = "app_shared_pref";
|
||||
private static SharedPrefs sInstance;
|
||||
private static SharedPreferences sSharedPrefs;
|
||||
|
||||
public synchronized static SharedPrefs getInstance( @NonNull Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
try {
|
||||
sInstance = new SharedPrefs( context.getApplicationContext() );
|
||||
} catch ( Exception e ) {
|
||||
sInstance = new SharedPrefs();
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private SharedPrefs() {
|
||||
|
||||
}
|
||||
|
||||
private SharedPrefs(Context context ) {
|
||||
try {
|
||||
sSharedPrefs = context.getSharedPreferences( File_Name, Context.MODE_PRIVATE );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void putString( String key, String value ) {
|
||||
try {
|
||||
SharedPreferences.Editor editor = sSharedPrefs.edit();
|
||||
editor.putString( key, value );
|
||||
editor.apply();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
public String getString( String tag ) {
|
||||
try {
|
||||
return sSharedPrefs.getString( tag, "" );
|
||||
} catch ( Exception e ) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String getString( String tag, String defVal ) {
|
||||
try {
|
||||
return sSharedPrefs.getString( tag, defVal );
|
||||
} catch ( Exception e ) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getBoolean( String key, boolean defaultValue ) {
|
||||
try {
|
||||
return sSharedPrefs.getBoolean( key, defaultValue );
|
||||
} catch ( Exception e ) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public long getLong( String key, long defaultValue ) {
|
||||
try {
|
||||
return sSharedPrefs.getLong( key, defaultValue );
|
||||
} catch ( Exception e ) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public float getFloat( String key, float defaultValue ) {
|
||||
try {
|
||||
return sSharedPrefs.getFloat( key, defaultValue );
|
||||
} catch ( Exception e ) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public int getInt( String key, int value ) {
|
||||
try {
|
||||
return sSharedPrefs.getInt( key, value );
|
||||
} catch ( Exception e ) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public void putBoolean( String key, boolean value ) {
|
||||
try {
|
||||
SharedPreferences.Editor editor = sSharedPrefs.edit();
|
||||
editor.putBoolean( key, value );
|
||||
editor.apply();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
public void putLong( String key, long value ) {
|
||||
try {
|
||||
SharedPreferences.Editor editor = sSharedPrefs.edit();
|
||||
editor.putLong( key, value );
|
||||
editor.apply();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
public void putInt( String key, int value ) {
|
||||
try {
|
||||
SharedPreferences.Editor editor = sSharedPrefs.edit();
|
||||
editor.putInt( key, value );
|
||||
editor.apply();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
public void putFloat( String key, float value ) {
|
||||
try {
|
||||
SharedPreferences.Editor editor = sSharedPrefs.edit();
|
||||
editor.putFloat( key, value );
|
||||
editor.apply();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
public void remove( String key ) {
|
||||
try {
|
||||
SharedPreferences.Editor editor = sSharedPrefs.edit();
|
||||
editor.remove( key );
|
||||
editor.apply();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
public void putStringSet( String key, Set< String > values ) {
|
||||
try {
|
||||
SharedPreferences.Editor editor = sSharedPrefs.edit();
|
||||
editor.putStringSet( key, values );
|
||||
editor.apply();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getStringSet( String key ) {
|
||||
return sSharedPrefs.getStringSet( key, null );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user