Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.mogo.launcher;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
@@ -9,7 +8,6 @@ import android.util.Log;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.auto.zhidao.logsdk.CrashSystem;
|
||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.elegant.utils.WindowUtil;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
@@ -18,7 +16,6 @@ import com.mogo.module.back.BackToLauncherConst;
|
||||
import com.mogo.module.carchatting.card.CallChatConstant;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.guide.GuideConstant;
|
||||
import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.media.MediaConstants;
|
||||
import com.mogo.module.push.base.PushUIConstants;
|
||||
@@ -67,7 +64,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
Logger.init( BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF );
|
||||
|
||||
if ( DebugConfig.isLoadGuideModule() ) {
|
||||
MogoModulePaths.addModule(new MogoModule(PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME));
|
||||
MogoModulePaths.addModule( new MogoModule( PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME ) );
|
||||
}
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_AGREEMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
|
||||
|
||||
@@ -140,14 +137,16 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
prepareBaseService( 2_000L );
|
||||
final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||
prepareBaseService( apis, 2_000L );
|
||||
// installSkinManager( this, apis );
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础服务:passport、location、socket
|
||||
*/
|
||||
private void prepareBaseService( long delay ) {
|
||||
final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||
private void prepareBaseService( IMogoServiceApis apis, long delay ) {
|
||||
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
// 第三方平台的sn是服务端生成的,所以必须在返回后才能开启
|
||||
if ( TextUtils.isEmpty( Utils.getSn() ) ) {
|
||||
@@ -159,7 +158,6 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
prepareSocketAndLocationServices( apis );
|
||||
}
|
||||
}, delay );
|
||||
installSkinManager( this, apis );
|
||||
}
|
||||
|
||||
private void preparePassportEnvironment( IMogoServiceApis apis, Runnable after ) {
|
||||
@@ -191,10 +189,6 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
} );
|
||||
}
|
||||
|
||||
private void installSkinManager( Application application, IMogoServiceApis apis ) {
|
||||
apis.getSkinSupportInstallerApi().install( application );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext( Context base ) {
|
||||
super.attachBaseContext( base );
|
||||
|
||||
@@ -29,6 +29,7 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
beforeSetContentView(savedInstanceState);
|
||||
if ( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD ) {
|
||||
requestWindowFeature( Window.FEATURE_NO_TITLE );
|
||||
getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN );
|
||||
@@ -39,6 +40,10 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
getLifecycle().addObserver( mPresenter );
|
||||
}
|
||||
|
||||
protected void beforeSetContentView(Bundle savedInstanceState){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局资源
|
||||
*
|
||||
|
||||
@@ -5,9 +5,6 @@ import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.MapView;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MogoBaseMapView;
|
||||
|
||||
@@ -19,6 +16,8 @@ import com.mogo.map.MogoBaseMapView;
|
||||
*/
|
||||
public class AMapBaseMapView extends MogoBaseMapView {
|
||||
|
||||
private static final String TAG = "AMapBaseMapView";
|
||||
|
||||
public AMapBaseMapView( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
@@ -33,9 +32,6 @@ public class AMapBaseMapView extends MogoBaseMapView {
|
||||
|
||||
@Override
|
||||
protected IMogoMapView createMapView( Context context ) {
|
||||
if ( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD ) {
|
||||
return new AMapViewWrapper( new MapView( context ) );
|
||||
}
|
||||
return new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
return AMapViewHandler.getMapView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mogo.map.impl.amap;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
|
||||
public
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class AMapViewHandler {
|
||||
|
||||
private static IMogoMapView sMapView;
|
||||
|
||||
public static void createMapView( Context context ) {
|
||||
if ( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE ) {
|
||||
sMapView = new AMapViewWrapper( new TextureMapView( context ) );
|
||||
} else {
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView() {
|
||||
return sMapView;
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
sMapView = null;
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,10 @@ import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.AMapUtils;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.MapView;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.CameraPositionCreator;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
@@ -71,7 +73,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
private static final String TAG = "AMapViewWrapper";
|
||||
|
||||
private final MapView mMapView;
|
||||
private final TextureMapView mMapView;
|
||||
private IMogoMap mIMap;
|
||||
|
||||
private AMapMarkerClickHandler mMarkerClickHandler;
|
||||
@@ -86,7 +88,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
|
||||
public AMapViewWrapper( MapView mapView ) {
|
||||
public AMapViewWrapper( TextureMapView mapView ) {
|
||||
this.mMapView = mapView;
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView.getContext(), this );
|
||||
try {
|
||||
@@ -477,16 +479,41 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
Logger.d( TAG, "锁车" );
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
Location target = NaviClient.getInstance( getContext() ).getCarLocation2();
|
||||
if ( target != null ) {
|
||||
mMapView.getMap().animateCamera( CameraUpdateFactory.newCameraPosition(
|
||||
new CameraPosition( new LatLng( target.getLatitude(), target.getLongitude() ),
|
||||
mDefaultZoomLevel,
|
||||
0,
|
||||
0
|
||||
)
|
||||
), new AMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
changeMyLocationStyle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
changeMyLocationStyle();
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
changeMyLocationStyle();
|
||||
}
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW );
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
mIsCarLocked = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void changeMyLocationStyle() {
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
}
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW );
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loseLockMode() {
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/10
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface IMogoMapViewInstanceHandler extends IDestroyable {
|
||||
|
||||
void createMapViewInstance( Context context );
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.impl.amap.AMapViewHandler;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/10
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoMapViewInstanceHandler implements IMogoMapViewInstanceHandler {
|
||||
|
||||
private static volatile MogoMapViewInstanceHandler sInstance;
|
||||
|
||||
private MogoMapViewInstanceHandler(){}
|
||||
|
||||
public static MogoMapViewInstanceHandler getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( MogoMapViewInstanceHandler.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new MogoMapViewInstanceHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMapViewInstance( Context context ) {
|
||||
AMapViewHandler.createMapView( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
AMapViewHandler.destroy();
|
||||
}
|
||||
}
|
||||
@@ -198,13 +198,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.recoverLockMode();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
if (!mStatusManager.isV2XShow()) {
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.setLockZoom(16);
|
||||
mMApUIController.changeZoom(16.0f);
|
||||
}
|
||||
}, 1_000L);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -32,7 +32,10 @@ class GuideStageFiveFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
super.onResume()
|
||||
containerFragment?.invisibleRight()
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_five), object : IMogoVoiceCmdCallBack {
|
||||
override fun onTTSEnd(ttsId: String?, tts: String?) {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if(!isVisible){
|
||||
return
|
||||
}
|
||||
containerFragment?.closeGuideFragment()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -30,9 +30,13 @@ class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
containerFragment?.visibleLeft()
|
||||
containerFragment?.visibleRight()
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_four), object : IMogoVoiceCmdCallBack {
|
||||
override fun onTTSEnd(ttsId: String?, tts: String?) {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if(!isVisible){
|
||||
return
|
||||
}
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -36,7 +36,10 @@ class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
super.onResume()
|
||||
containerFragment?.invisibleLeft()
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_one), object : IMogoVoiceCmdCallBack {
|
||||
override fun onTTSEnd(ttsId: String?, tts: String?) {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if(!isVisible){
|
||||
return
|
||||
}
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -30,8 +30,13 @@ class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
containerFragment?.visibleLeft()
|
||||
containerFragment?.visibleRight()
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_three), object : IMogoVoiceCmdCallBack {
|
||||
override fun onTTSEnd(ttsId: String?, tts: String?) {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if(!isVisible){
|
||||
return
|
||||
}
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -31,8 +31,12 @@ class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
containerFragment?.visibleLeft()
|
||||
containerFragment?.visibleRight()
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_two), object : IMogoVoiceCmdCallBack {
|
||||
override fun onTTSEnd(ttsId: String?, tts: String?) {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if(!isVisible){
|
||||
return
|
||||
}
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_guide_page_right"
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="@dimen/dp_87"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginRight="@dimen/dp_92"
|
||||
android:visibility="gone"
|
||||
android:src="@mipmap/module_guide_right_page"
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_guide_page_left"
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="@dimen/dp_87"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginLeft="@dimen/dp_92"
|
||||
android:visibility="gone"
|
||||
android:src="@mipmap/module_guide_left_page"
|
||||
|
||||
@@ -52,6 +52,7 @@ dependencies {
|
||||
api rootProject.ext.dependencies.moduleservice
|
||||
api rootProject.ext.dependencies.moduleapps
|
||||
api rootProject.ext.dependencies.moduleextensions
|
||||
compileOnly rootProject.ext.dependencies.skinsupport
|
||||
} else {
|
||||
api project(":foudations:mogo-utils")
|
||||
api project(":foudations:mogo-commons")
|
||||
@@ -62,6 +63,7 @@ dependencies {
|
||||
api project(':services:mogo-service')
|
||||
api project(':modules:mogo-module-apps')
|
||||
api project(':modules:mogo-module-extensions')
|
||||
compileOnly project(':skin:mogo-skin-support')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,23 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
return R.layout.module_main_activity_main;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeSetContentView( Bundle savedInstanceState ) {
|
||||
init();
|
||||
installSkinManager( savedInstanceState );
|
||||
}
|
||||
|
||||
/**
|
||||
* 安装皮肤支持
|
||||
*
|
||||
* @param savedInstanceState
|
||||
*/
|
||||
private void installSkinManager( Bundle savedInstanceState ) {
|
||||
mServiceApis.getMapServiceApi().getMapViewInstanceHandler().createMapViewInstance( this );
|
||||
mServiceApis.getSkinSupportInstallerApi().install( getApplication() );
|
||||
mServiceApis.getSkinSupportInstallerApi().onCompensateActivityCreated( this, savedInstanceState );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
@@ -113,7 +130,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
init();
|
||||
mPresenter.postLoadModuleMsg();
|
||||
}
|
||||
|
||||
@@ -326,6 +342,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoMapService = null;
|
||||
mMogoMapUIController = null;
|
||||
mMogoFragmentManager = null;
|
||||
mServiceApis.getMapServiceApi().getMapViewInstanceHandler().destroy();
|
||||
AdasConfigApiController.getInstance().release();
|
||||
mServiceApis.getAdasControllerApi().release();
|
||||
Logger.d( TAG, "destroy." );
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft"
|
||||
android:padding="@dimen/module_main_entrance_fragment_container_padding" />
|
||||
android:padding="@dimen/module_event_fragment_container_padding" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_message_history_fragment_container"
|
||||
|
||||
@@ -25,5 +25,6 @@
|
||||
|
||||
<dimen name="module_main_id_left_panel_fragment_container_width">635px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_width">1263px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">20px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -25,4 +25,5 @@
|
||||
|
||||
<dimen name="module_main_id_left_panel_fragment_container_width">340px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_width">1313px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">20px</dimen>
|
||||
</resources>
|
||||
@@ -25,5 +25,6 @@
|
||||
<dimen name="module_main_entrance_fragment_container_padding">16px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_padding_top">16px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_width">658px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">8px</dimen>
|
||||
|
||||
</resources>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="24px" />
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#5CC1FF"
|
||||
android:startColor="#256BFF"/>
|
||||
</shape>
|
||||
@@ -3,7 +3,7 @@
|
||||
<item >
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="135" android:endColor="#ff2a2b38" android:startColor="#ff3f4057" android:type="linear" android:useLevel="true" />
|
||||
<corners android:radius="@dimen/dp_20" />
|
||||
<corners android:radius="@dimen/dp_10" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -3,7 +3,7 @@
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="90" android:endColor="#ff5cc1ff" android:startColor="#ff256bff" android:type="linear" android:useLevel="true" />
|
||||
<corners android:bottomLeftRadius="@dimen/dp_11" android:bottomRightRadius="0dp" android:topLeftRadius="0dp" android:topRightRadius="0dp" />
|
||||
<corners android:bottomLeftRadius="@dimen/dp_10" android:bottomRightRadius="0dp" android:topLeftRadius="0dp" android:topRightRadius="0dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -3,8 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#88000000">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ivDialogBg"
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/event_share_load_status"
|
||||
android:layout_width="220px"
|
||||
android:layout_width="@dimen/v2x_share_btn_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="12px"
|
||||
android:paddingBottom="12px"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/bg_v2x_event_share_type_blue"
|
||||
android:background="@drawable/v2xt_dw_common_corner_bkg_light"
|
||||
android:text="查看更早记录"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="18px" />
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -76,6 +76,7 @@
|
||||
android:overScrollMode="never"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rgTabSelect" />
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
android:gravity="bottom"
|
||||
android:text="你还没有分享过道路事件,快去试试吧"
|
||||
android:textColor="@color/v2x_FFF_333"
|
||||
android:textSize="@dimen/v2x_share_btn_size" />
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -41,7 +41,7 @@
|
||||
android:onClick="shareEventAction"
|
||||
android:text="去分享"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/v2x_share_btn_size" />
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<View
|
||||
android:id="@+id/center"
|
||||
@@ -57,7 +57,7 @@
|
||||
android:background="@drawable/v2xt_dw_common_corner_bkg_light"
|
||||
android:text="刷新"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/v2x_share_btn_size" />
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20px"
|
||||
android:layout_marginTop="12px"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:background="@drawable/bg_v2x_event_type_read"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="5px"
|
||||
android:paddingTop="3px"
|
||||
android:paddingRight="5px"
|
||||
android:paddingBottom="3px"
|
||||
android:paddingLeft="@dimen/dp_10"
|
||||
android:paddingTop="@dimen/dp_3"
|
||||
android:paddingRight="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_3"
|
||||
android:text="道路类型"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14px" />
|
||||
android:textSize="@dimen/dp_28" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/road_case_useless_num"
|
||||
@@ -32,10 +32,11 @@
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:paddingRight="20px"
|
||||
android:paddingRight="@dimen/dp_24"
|
||||
android:paddingLeft="@dimen/dp_24"
|
||||
android:text="100"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="18px" />
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<com.mogo.module.v2x.view.HeartUnLikeView
|
||||
android:id="@+id/road_case_useless"
|
||||
@@ -54,10 +55,11 @@
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_toLeftOf="@id/road_case_useless"
|
||||
android:gravity="center"
|
||||
android:paddingRight="26px"
|
||||
android:paddingRight="@dimen/dp_24"
|
||||
android:paddingLeft="@dimen/dp_24"
|
||||
android:text="100"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="18px" />
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<com.mogo.module.v2x.view.HeartLikeView
|
||||
android:id="@+id/road_case_uselful"
|
||||
@@ -80,20 +82,20 @@
|
||||
android:lines="1"
|
||||
android:paddingTop="2px"
|
||||
android:text="东城区北三环附近维多欧美"
|
||||
android:textColor="@color/share_event_address_color"
|
||||
android:textSize="18px" />
|
||||
android:textColor="@color/v2x_FFF_333"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/road_case_share_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/road_case_address"
|
||||
android:layout_marginLeft="20px"
|
||||
android:layout_marginBottom="11px"
|
||||
android:layout_alignLeft="@id/road_case_style"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_24"
|
||||
android:alpha="0.5"
|
||||
android:gravity="left"
|
||||
android:paddingTop="2px"
|
||||
android:text="时间:"
|
||||
android:textColor="@color/share_event_share_time_color"
|
||||
android:textSize="16px" />
|
||||
android:textColor="@color/v2x_FFF_666"
|
||||
android:textSize="@dimen/dp_30" />
|
||||
</RelativeLayout>
|
||||
@@ -32,7 +32,7 @@
|
||||
android:paddingTop="14px"
|
||||
android:text="正在获取信息…"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/v2x_share_btn_size"
|
||||
android:textSize="@dimen/dp_34"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/loading_imageview"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
@@ -48,7 +48,7 @@
|
||||
android:background="@drawable/v2xt_dw_common_corner_bkg_light"
|
||||
android:text="刷新"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/v2x_share_btn_size"
|
||||
android:textSize="@dimen/dp_34"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/loading_imageview" />
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
<dimen name="v2x_loading_ani_width">200px</dimen>
|
||||
<dimen name="v2x_share_btn_width">150px</dimen>
|
||||
<dimen name="v2x_share_btn_height">48px</dimen>
|
||||
<dimen name="v2x_share_btn_size">18px</dimen>
|
||||
<dimen name="v2x_index_rating_top">17px</dimen>
|
||||
<dimen name="share_top_text_size">16px</dimen>
|
||||
<dimen name="share_des_num_size">36px</dimen>
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
<dimen name="v2x_loading_ani_width">400px</dimen>
|
||||
<dimen name="v2x_share_btn_width">281px</dimen>
|
||||
<dimen name="v2x_share_btn_height">90px</dimen>
|
||||
<dimen name="v2x_share_btn_size">33.75px</dimen>
|
||||
<dimen name="v2x_index_rating_top">28px</dimen>
|
||||
<dimen name="share_top_text_size">30px</dimen>
|
||||
<dimen name="share_des_num_size">67.5px</dimen>
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
<color name="v2x_white_refresh">#FFFFFF</color>
|
||||
<color name="transparent_white_30">#B3FFFFFF</color>
|
||||
<color name="surrounding_item_bottom_color">#1F2131</color>
|
||||
<color name="share_event_share_time_color">#FFFFFF</color>
|
||||
<color name="share_event_address_color">#FFFFFF</color>
|
||||
<color name="panel_shadow_shape_color">#10121E</color>
|
||||
<color name="share_event_no_more_color">#99FFFFFF</color>
|
||||
<color name="v2x_FFF_999">#FFFFFF</color>
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
<dimen name="v2x_loading_ani_width">200px</dimen>
|
||||
<dimen name="v2x_share_btn_width">150px</dimen>
|
||||
<dimen name="v2x_share_btn_height">48px</dimen>
|
||||
<dimen name="v2x_share_btn_size">18px</dimen>
|
||||
<dimen name="v2x_index_rating_top">17px</dimen>
|
||||
<dimen name="share_top_text_size">16px</dimen>
|
||||
<dimen name="share_des_num_size">36px</dimen>
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.service.map;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.IMogoMapViewInstanceHandler;
|
||||
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
@@ -111,4 +112,11 @@ public interface IMogoMapService extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoRoadSearch getRoadSearchApi();
|
||||
|
||||
/**
|
||||
* 地图实例
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMapViewInstanceHandler getMapViewInstanceHandler();
|
||||
}
|
||||
|
||||
@@ -3,15 +3,17 @@ package com.mogo.service.impl.map;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoRoadSearch;
|
||||
import com.mogo.map.IMogoMapViewInstanceHandler;
|
||||
import com.mogo.map.MogoGeoSearch;
|
||||
import com.mogo.map.MogoInputtipsSearch;
|
||||
import com.mogo.map.MogoLocationClient;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMapViewInstanceHandler;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.MogoNavi;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
import com.mogo.map.MogoPoiSearch;
|
||||
import com.mogo.map.MogoRoadSearch;
|
||||
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||
import com.mogo.map.listener.MogoHosListenerRegister;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
@@ -92,7 +94,13 @@ public class MogoMapService implements IMogoMapService {
|
||||
return new MogoRoadSearch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapViewInstanceHandler getMapViewInstanceHandler() {
|
||||
return MogoMapViewInstanceHandler.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -3,6 +3,7 @@ package com.mogo.skin.support.impl;
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatCallback;
|
||||
@@ -15,6 +16,7 @@ import com.mogo.skin.support.SkinMode;
|
||||
import com.mogo.skin.support.SkinSupportInstallerConstants;
|
||||
|
||||
import skin.support.SkinCompatManager;
|
||||
import skin.support.app.SkinActivityLifecycle;
|
||||
import skin.support.app.SkinAppCompatViewInflater;
|
||||
import skin.support.app.SkinCardViewInflater;
|
||||
import skin.support.constraint.app.SkinConstraintViewInflater;
|
||||
@@ -60,10 +62,15 @@ class SkinSupportInstaller implements IMogoSkinSupportInstaller {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppCompatDelegate getSkinAppCompatDelegate( AppCompatActivity activity,AppCompatDelegate superDelegate, AppCompatCallback callback ) {
|
||||
public AppCompatDelegate getSkinAppCompatDelegate( AppCompatActivity activity, AppCompatDelegate superDelegate, AppCompatCallback callback ) {
|
||||
return SkinAppCompatDelegateImpl.get( activity, callback );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompensateActivityCreated( Activity activity, Bundle savedInstanceState ) {
|
||||
SkinActivityLifecycle.init( activity.getApplication() ).onCompensateActivityCreated( activity, savedInstanceState );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.mogo.skin.support.noop;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatCallback;
|
||||
@@ -40,6 +42,11 @@ class SkinSupportInstaller implements IMogoSkinSupportInstaller {
|
||||
return superDelegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompensateActivityCreated( Activity activity, Bundle savedInstanceState ) {
|
||||
Logger.d( TAG, "noop - onCompensateActivityCreated" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.mogo.skin.support;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatCallback;
|
||||
@@ -21,5 +23,7 @@ interface IMogoSkinSupportInstaller extends IProvider {
|
||||
|
||||
void loadSkin( SkinMode skinMode );
|
||||
|
||||
AppCompatDelegate getSkinAppCompatDelegate( AppCompatActivity activity,AppCompatDelegate superDelegate, AppCompatCallback callback );
|
||||
AppCompatDelegate getSkinAppCompatDelegate( AppCompatActivity activity, AppCompatDelegate superDelegate, AppCompatCallback callback );
|
||||
|
||||
void onCompensateActivityCreated( Activity activity, Bundle savedInstanceState );
|
||||
}
|
||||
|
||||
@@ -26,128 +26,135 @@ import static skin.support.widget.SkinCompatHelper.checkResourceId;
|
||||
public class SkinActivityLifecycle implements Application.ActivityLifecycleCallbacks {
|
||||
private static final String TAG = "SkinActivityLifecycle";
|
||||
private static volatile SkinActivityLifecycle sInstance = null;
|
||||
private WeakHashMap<Context, SkinCompatDelegate> mSkinDelegateMap;
|
||||
private WeakHashMap<Context, LazySkinObserver> mSkinObserverMap;
|
||||
private WeakHashMap< Context, SkinCompatDelegate > mSkinDelegateMap;
|
||||
private WeakHashMap< Context, LazySkinObserver > mSkinObserverMap;
|
||||
/**
|
||||
* 用于记录当前Activity,在换肤后,立即刷新当前Activity以及非Activity创建的View。
|
||||
*/
|
||||
private WeakReference<Activity> mCurActivityRef;
|
||||
private WeakReference< Activity > mCurActivityRef;
|
||||
|
||||
public static SkinActivityLifecycle init(Application application) {
|
||||
if (sInstance == null) {
|
||||
synchronized (SkinActivityLifecycle.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new SkinActivityLifecycle(application);
|
||||
public static SkinActivityLifecycle init( Application application ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( SkinActivityLifecycle.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new SkinActivityLifecycle( application );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private SkinActivityLifecycle(Application application) {
|
||||
application.registerActivityLifecycleCallbacks(this);
|
||||
installLayoutFactory(application);
|
||||
SkinCompatManager.getInstance().addObserver(getObserver(application));
|
||||
private SkinActivityLifecycle( Application application ) {
|
||||
application.registerActivityLifecycleCallbacks( this );
|
||||
installLayoutFactory( application );
|
||||
SkinCompatManager.getInstance().addObserver( getObserver( application ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
if (isContextSkinEnable(activity)) {
|
||||
installLayoutFactory(activity);
|
||||
updateWindowBackground(activity);
|
||||
if (activity instanceof SkinCompatSupportable) {
|
||||
((SkinCompatSupportable) activity).applySkin();
|
||||
public void onActivityCreated( Activity activity, Bundle savedInstanceState ) {
|
||||
onCompensateActivityCreated( activity, savedInstanceState );
|
||||
}
|
||||
|
||||
/**
|
||||
* 补偿启动页的 create 回调
|
||||
*/
|
||||
public void onCompensateActivityCreated( Activity activity, Bundle savedInstanceState ) {
|
||||
if ( isContextSkinEnable( activity ) ) {
|
||||
installLayoutFactory( activity );
|
||||
updateWindowBackground( activity );
|
||||
if ( activity instanceof SkinCompatSupportable ) {
|
||||
( ( SkinCompatSupportable ) activity ).applySkin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
public void onActivityStarted( Activity activity ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed(Activity activity) {
|
||||
mCurActivityRef = new WeakReference<>(activity);
|
||||
if (isContextSkinEnable(activity)) {
|
||||
LazySkinObserver observer = getObserver(activity);
|
||||
SkinCompatManager.getInstance().addObserver(observer);
|
||||
public void onActivityResumed( Activity activity ) {
|
||||
mCurActivityRef = new WeakReference<>( activity );
|
||||
if ( isContextSkinEnable( activity ) ) {
|
||||
LazySkinObserver observer = getObserver( activity );
|
||||
SkinCompatManager.getInstance().addObserver( observer );
|
||||
observer.updateSkinIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(Activity activity) {
|
||||
public void onActivityPaused( Activity activity ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
public void onActivityStopped( Activity activity ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
|
||||
public void onActivitySaveInstanceState( Activity activity, Bundle outState ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
if (isContextSkinEnable(activity)) {
|
||||
SkinCompatManager.getInstance().deleteObserver(getObserver(activity));
|
||||
mSkinObserverMap.remove(activity);
|
||||
mSkinDelegateMap.remove(activity);
|
||||
public void onActivityDestroyed( Activity activity ) {
|
||||
if ( isContextSkinEnable( activity ) ) {
|
||||
SkinCompatManager.getInstance().deleteObserver( getObserver( activity ) );
|
||||
mSkinObserverMap.remove( activity );
|
||||
mSkinDelegateMap.remove( activity );
|
||||
}
|
||||
}
|
||||
|
||||
private void installLayoutFactory(Context context) {
|
||||
private void installLayoutFactory( Context context ) {
|
||||
try {
|
||||
LayoutInflater layoutInflater = LayoutInflater.from(context);
|
||||
LayoutInflaterCompat.setFactory2(layoutInflater, getSkinDelegate(context));
|
||||
} catch (Throwable e) {
|
||||
Slog.i("SkinActivity", "A factory has already been set on this LayoutInflater");
|
||||
LayoutInflater layoutInflater = LayoutInflater.from( context );
|
||||
LayoutInflaterCompat.setFactory2( layoutInflater, getSkinDelegate( context ) );
|
||||
} catch ( Throwable e ) {
|
||||
Slog.i( "SkinActivity", "A factory has already been set on this LayoutInflater" );
|
||||
}
|
||||
}
|
||||
|
||||
private SkinCompatDelegate getSkinDelegate(Context context) {
|
||||
if (mSkinDelegateMap == null) {
|
||||
private SkinCompatDelegate getSkinDelegate( Context context ) {
|
||||
if ( mSkinDelegateMap == null ) {
|
||||
mSkinDelegateMap = new WeakHashMap<>();
|
||||
}
|
||||
|
||||
SkinCompatDelegate mSkinDelegate = mSkinDelegateMap.get(context);
|
||||
if (mSkinDelegate == null) {
|
||||
mSkinDelegate = SkinCompatDelegate.create(context);
|
||||
mSkinDelegateMap.put(context, mSkinDelegate);
|
||||
SkinCompatDelegate mSkinDelegate = mSkinDelegateMap.get( context );
|
||||
if ( mSkinDelegate == null ) {
|
||||
mSkinDelegate = SkinCompatDelegate.create( context );
|
||||
mSkinDelegateMap.put( context, mSkinDelegate );
|
||||
}
|
||||
return mSkinDelegate;
|
||||
}
|
||||
|
||||
private LazySkinObserver getObserver(final Context context) {
|
||||
if (mSkinObserverMap == null) {
|
||||
private LazySkinObserver getObserver( final Context context ) {
|
||||
if ( mSkinObserverMap == null ) {
|
||||
mSkinObserverMap = new WeakHashMap<>();
|
||||
}
|
||||
LazySkinObserver observer = mSkinObserverMap.get(context);
|
||||
if (observer == null) {
|
||||
observer = new LazySkinObserver(context);
|
||||
mSkinObserverMap.put(context, observer);
|
||||
LazySkinObserver observer = mSkinObserverMap.get( context );
|
||||
if ( observer == null ) {
|
||||
observer = new LazySkinObserver( context );
|
||||
mSkinObserverMap.put( context, observer );
|
||||
}
|
||||
return observer;
|
||||
}
|
||||
|
||||
private void updateWindowBackground(Activity activity) {
|
||||
if (SkinCompatManager.getInstance().isSkinWindowBackgroundEnable()) {
|
||||
int windowBackgroundResId = SkinCompatThemeUtils.getWindowBackgroundResId(activity);
|
||||
if (checkResourceId(windowBackgroundResId) != INVALID_ID) {
|
||||
Drawable drawable = SkinCompatResources.getDrawable(activity, windowBackgroundResId);
|
||||
if (drawable != null) {
|
||||
activity.getWindow().setBackgroundDrawable(drawable);
|
||||
private void updateWindowBackground( Activity activity ) {
|
||||
if ( SkinCompatManager.getInstance().isSkinWindowBackgroundEnable() ) {
|
||||
int windowBackgroundResId = SkinCompatThemeUtils.getWindowBackgroundResId( activity );
|
||||
if ( checkResourceId( windowBackgroundResId ) != INVALID_ID ) {
|
||||
Drawable drawable = SkinCompatResources.getDrawable( activity, windowBackgroundResId );
|
||||
if ( drawable != null ) {
|
||||
activity.getWindow().setBackgroundDrawable( drawable );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isContextSkinEnable(Context context) {
|
||||
private boolean isContextSkinEnable( Context context ) {
|
||||
return SkinCompatManager.getInstance().isSkinAllActivityEnable()
|
||||
|| context.getClass().getAnnotation(Skinable.class) != null
|
||||
|| context.getClass().getAnnotation( Skinable.class ) != null
|
||||
|| context instanceof SkinCompatSupportable;
|
||||
}
|
||||
|
||||
@@ -155,16 +162,16 @@ public class SkinActivityLifecycle implements Application.ActivityLifecycleCallb
|
||||
private final Context mContext;
|
||||
private boolean mMarkNeedUpdate = false;
|
||||
|
||||
LazySkinObserver(Context context) {
|
||||
LazySkinObserver( Context context ) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSkin(SkinObservable observable, Object o) {
|
||||
public void updateSkin( SkinObservable observable, Object o ) {
|
||||
// 当前Activity,或者非Activity,立即刷新,否则延迟到下次onResume方法中刷新。
|
||||
if (mCurActivityRef == null
|
||||
if ( mCurActivityRef == null
|
||||
|| mContext == mCurActivityRef.get()
|
||||
|| !(mContext instanceof Activity)) {
|
||||
|| !( mContext instanceof Activity ) ) {
|
||||
updateSkinForce();
|
||||
} else {
|
||||
mMarkNeedUpdate = true;
|
||||
@@ -172,24 +179,24 @@ public class SkinActivityLifecycle implements Application.ActivityLifecycleCallb
|
||||
}
|
||||
|
||||
void updateSkinIfNeeded() {
|
||||
if (mMarkNeedUpdate) {
|
||||
if ( mMarkNeedUpdate ) {
|
||||
updateSkinForce();
|
||||
}
|
||||
}
|
||||
|
||||
void updateSkinForce() {
|
||||
if (Slog.DEBUG) {
|
||||
Slog.i(TAG, "Context: " + mContext + " updateSkinForce");
|
||||
if ( Slog.DEBUG ) {
|
||||
Slog.i( TAG, "Context: " + mContext + " updateSkinForce" );
|
||||
}
|
||||
if (mContext == null) {
|
||||
if ( mContext == null ) {
|
||||
return;
|
||||
}
|
||||
if (mContext instanceof Activity && isContextSkinEnable(mContext)) {
|
||||
updateWindowBackground((Activity) mContext);
|
||||
if ( mContext instanceof Activity && isContextSkinEnable( mContext ) ) {
|
||||
updateWindowBackground( ( Activity ) mContext );
|
||||
}
|
||||
getSkinDelegate(mContext).applySkin();
|
||||
if (mContext instanceof SkinCompatSupportable) {
|
||||
((SkinCompatSupportable) mContext).applySkin();
|
||||
getSkinDelegate( mContext ).applySkin();
|
||||
if ( mContext instanceof SkinCompatSupportable ) {
|
||||
( ( SkinCompatSupportable ) mContext ).applySkin();
|
||||
}
|
||||
mMarkNeedUpdate = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user