不实用换肤模式,后面采用别的换肤方案

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-09-18 19:02:36 +08:00
parent 2da2047f1e
commit bb4926a7ee
17 changed files with 114 additions and 249 deletions

View File

@@ -15,8 +15,6 @@ import androidx.core.content.ContextCompat;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.view.LiveRoundLayout;
import com.mogo.skin.support.IMogoSkinCompatSupportable;
import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
import com.mogo.utils.logger.Logger;
import com.tencent.rtmp.ITXLivePlayListener;
import com.tencent.rtmp.TXLiveConstants;
@@ -27,7 +25,7 @@ import com.tencent.rtmp.ui.TXCloudVideoView;
/**
* V2XLiveGSYVideoView
*/
public class CameraLiveGSYVideoView extends LiveRoundLayout implements IMogoSkinCompatSupportable {
public class CameraLiveGSYVideoView extends LiveRoundLayout {
private static final String TAG = "CameraLiveGSYVideoView";
private TXCloudVideoView mTxcVideoView;
private ProgressBar mLoading;
@@ -35,7 +33,6 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout implements IMogoSkin
private ConstraintLayout mClLoadError;
private TextView mTvRefreshButton;
private MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper;
private String mLiveUrl;
@@ -51,8 +48,6 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout implements IMogoSkin
super(context, attrs, defStyleAttr);
initView(context);
mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
private void initView(Context context) {
@@ -175,10 +170,4 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout implements IMogoSkin
super.onDetachedFromWindow();
}
@Override
public void applySkin() {
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
}

View File

@@ -8,17 +8,13 @@ import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import com.mogo.module.extensions.R;
import com.mogo.skin.support.IMogoSkinCompatSupportable;
import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
public class LiveRoundLayout extends RelativeLayout implements IMogoSkinCompatSupportable {
public class LiveRoundLayout extends RelativeLayout {
private float roundLayoutRadius = 14f;
private Path roundPath;
private RectF rectF;
private MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper;
public LiveRoundLayout(Context context) {
this(context, null);
@@ -37,8 +33,6 @@ public class LiveRoundLayout extends RelativeLayout implements IMogoSkinCompatSu
init();
mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
@@ -75,11 +69,5 @@ public class LiveRoundLayout extends RelativeLayout implements IMogoSkinCompatSu
super.draw(canvas);
}
@Override
public void applySkin() {
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
}

View File

@@ -12,9 +12,6 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import com.mogo.skin.support.IMogoSkinCompatSupportable;
import com.mogo.skin.support.helper.MogoSkinCompatTextHelperDelegate;
import java.lang.reflect.Field;
/**
@@ -22,9 +19,8 @@ import java.lang.reflect.Field;
*
* @author tongchenfei
*/
public class StrokeTextView extends AppCompatTextView implements IMogoSkinCompatSupportable {
public class StrokeTextView extends AppCompatTextView {
private MogoSkinCompatTextHelperDelegate textHelperDelegate;
public StrokeTextView(Context context) {
this(context,null);
@@ -36,13 +32,11 @@ public class StrokeTextView extends AppCompatTextView implements IMogoSkinCompat
public StrokeTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
textHelperDelegate = new MogoSkinCompatTextHelperDelegate(this);
}
@Override
public void setTextAppearance(Context context, int resId) {
super.setTextAppearance(context, resId);
textHelperDelegate.onSetTextAppearance(context, resId);
}
@Override
@@ -94,8 +88,4 @@ public class StrokeTextView extends AppCompatTextView implements IMogoSkinCompat
}
}
@Override
public void applySkin() {
textHelperDelegate.applySkin();
}
}

View File

@@ -56,7 +56,7 @@ dependencies {
api project(':modules:mogo-module-common')
api project(':services:mogo-service-api')
api project(':services:mogo-service')
compileOnly project(':skin:mogo-skin-support')
// compileOnly project(':skin:mogo-skin-support')
implementation project(':core:mogo-core-data')

View File

@@ -1,5 +1,7 @@
package com.mogo.module.main;
import static com.mogo.module.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
@@ -7,7 +9,6 @@ import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -37,7 +38,6 @@ import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.skin.support.SkinMode;
import com.mogo.utils.NetworkUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.permissions.PermissionsDialogUtils;
@@ -47,8 +47,6 @@ import com.zhidao.autopilot.support.api.AutopilotServiceManage;
import java.util.List;
import static com.mogo.module.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
/**
* @author congtaowang
* @since 2019-12-23
@@ -107,8 +105,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
*/
private void installSkinManager(Bundle savedInstanceState) {
mServiceApis.getMapServiceApi().getMapViewInstanceHandler().createMapViewInstance(this);
mServiceApis.getSkinSupportInstallerApi().install(getApplication());
mServiceApis.getSkinSupportInstallerApi().onCompensateActivityCreated(this, savedInstanceState);
}
@Override
@@ -311,10 +307,8 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
public void onMapUiModeChanged(EnumMapUI mapUI) {
switch (mapUI) {
case Type_Night:
mServiceApis.getSkinSupportInstallerApi().loadSkin(SkinMode.Night);
break;
case Type_Light:
mServiceApis.getSkinSupportInstallerApi().loadSkin(SkinMode.Light);
break;
}
}
@@ -422,7 +416,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
SchemeIntent.getInstance().clear();
FloatingViewHandler.clear();
mServiceApis.getShareManager().releaseContext();
mServiceApis.getSkinSupportInstallerApi().onDestroy();
}
@Override

View File

@@ -10,8 +10,6 @@ import android.util.AttributeSet;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.module.v2x.R;
import com.mogo.skin.support.IMogoSkinCompatSupportable;
import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
/**
* author : donghongyu
@@ -20,12 +18,11 @@ import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
* desc :
* version: 1.0
*/
public class RoundConstraintLayout extends ConstraintLayout implements IMogoSkinCompatSupportable {
public class RoundConstraintLayout extends ConstraintLayout {
private float roundLayoutRadius = 14f;
private Path roundPath;
private RectF rectF;
private MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper;
public RoundConstraintLayout(Context context) {
this(context, null);
@@ -42,8 +39,6 @@ public class RoundConstraintLayout extends ConstraintLayout implements IMogoSkin
public RoundConstraintLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
@@ -80,11 +75,4 @@ public class RoundConstraintLayout extends ConstraintLayout implements IMogoSkin
super.draw(canvas);
}
@Override
public void applySkin() {
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
}

View File

@@ -9,8 +9,6 @@ import android.util.AttributeSet;
import android.widget.RelativeLayout;
import com.mogo.module.v2x.R;
import com.mogo.skin.support.IMogoSkinCompatSupportable;
import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
/**
* author : donghongyu
@@ -19,11 +17,10 @@ import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
* desc :
* version: 1.0
*/
public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSupportable {
public class RoundLayout extends RelativeLayout {
private float roundLayoutRadius = 14f;
private Path roundPath;
private RectF rectF;
private MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper;
public RoundLayout(Context context) {
this(context, null);
@@ -42,8 +39,6 @@ public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSuppor
init();
mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
@@ -80,19 +75,5 @@ public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSuppor
super.draw(canvas);
}
@Override
public void setBackgroundResource(int resId) {
super.setBackgroundResource(resId);
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.onSetBackgroundResource(resId);
}
}
@Override
public void applySkin() {
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
}

View File

@@ -1,5 +1,7 @@
package com.mogo.module.v2x.view;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
@@ -16,13 +18,10 @@ import androidx.core.content.ContextCompat;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.entity.MarkerCarInfo;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.skin.support.IMogoSkinCompatSupportable;
import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.tencent.rtmp.ITXLivePlayListener;
@@ -31,8 +30,6 @@ import com.tencent.rtmp.TXLivePlayConfig;
import com.tencent.rtmp.TXLivePlayer;
import com.tencent.rtmp.ui.TXCloudVideoView;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
@@ -40,7 +37,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc :
* version: 1.0
*/
public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatSupportable {
public class V2XLiveGSYVideoView extends RoundLayout {
private final String TAG = "V2XLiveGSYVideoView";
private TXCloudVideoView mTxcVideoView;
@@ -48,8 +45,6 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
private TXLivePlayer mLivePlayer;
private ConstraintLayout mClLoadError;
private final MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper;
private MarkerCarInfo.CarLiveInfo mCarLiveInfo;
// 重新刷新直播流
private final V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() {
@@ -75,14 +70,12 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
super(context, attrs, defStyleAttr);
initView(context);
mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
private void initView(Context context) {
LayoutInflater.from(context)
.inflate(R.layout.view_video_layout_normal, this);
//mPlayerView 即 step1 中添加的界面 view
//mPlayerView 即 step1 中添加的界面 view
mTxcVideoView = findViewById(R.id.txcVideoView);
//创建 player 对象
mLivePlayer = new TXLivePlayer(context);
@@ -145,10 +138,10 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
mLivePlayer.setPlayListener(new ITXLivePlayListener() {
@Override
public void onPlayEvent(int event, Bundle bundle) {
// Logger.i(MODULE_NAME,
// "直播信息= " + GsonUtil.jsonFromObject(carLiveInfo) +
// "\n播放器onPlayEvent==" + event +
// "\nbundle===" + bundle);
// Logger.i(MODULE_NAME,
// "直播信息= " + GsonUtil.jsonFromObject(carLiveInfo) +
// "\n播放器onPlayEvent==" + event +
// "\nbundle===" + bundle);
if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) {
mLoading.setVisibility(VISIBLE);
mClLoadError.setVisibility(GONE);
@@ -171,7 +164,7 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
@Override
public void onNetStatus(Bundle bundle) {
// Logger.i(MODULE_NAME, "播放器onNetStatus===bundle===" + bundle);
// Logger.i(MODULE_NAME, "播放器onNetStatus===bundle===" + bundle);
}
});
}
@@ -192,24 +185,24 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
mLivePlayer.stopPlay(true);
mTxcVideoView.onDestroy();
// if (carLiveInfo.getVideoUrl() != null) {
// return;
// }
// if (carLiveInfo.getVideoUrl() != null) {
// return;
// }
// 停止推流
// V2XServiceManager
// .getV2XRefreshModel()
// .livePush(new V2XRefreshCallback<V2XLivePushVoRes>() {
// @Override
// public void onSuccess(V2XLivePushVoRes result) {
// Logger.d(MODULE_NAME, "播放器:" + result);
// }
//
// @Override
// public void onFail(String msg) {
// Logger.e(MODULE_NAME, "播放器:" + msg);
// }
// }, carLiveInfo.getVideoSn(), 1);
// V2XServiceManager
// .getV2XRefreshModel()
// .livePush(new V2XRefreshCallback<V2XLivePushVoRes>() {
// @Override
// public void onSuccess(V2XLivePushVoRes result) {
// Logger.d(MODULE_NAME, "播放器:" + result);
// }
//
// @Override
// public void onFail(String msg) {
// Logger.e(MODULE_NAME, "播放器:" + msg);
// }
// }, carLiveInfo.getVideoSn(), 1);
} catch (Exception e) {
e.printStackTrace();
}
@@ -234,10 +227,4 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
super.onDetachedFromWindow();
}
@Override
public void applySkin() {
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
}