解决小地图在联想pad加载异常的问题

This commit is contained in:
董宏宇
2021-05-19 19:53:14 +08:00
parent 2f864fc3d5
commit 3d9db5f491
22 changed files with 263 additions and 556 deletions

View File

@@ -0,0 +1,60 @@
package com.android.internal.policy;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
/**
* @author donghongyu
* @date 12/25/20 5:12 PM
*/
public class MyPhoneLayoutInflater extends LayoutInflater {
private static final String[] sClassPrefixList = {
"android.widget.",
"android.webkit.",
"android.app."
};
/**
* Instead of instantiating directly, you should retrieve an instance
* through {@link Context#getSystemService}
*
* @param context The Context in which in which to find resources and other
* application-specific things.
* @see Context#getSystemService
*/
public MyPhoneLayoutInflater(Context context) {
super(context);
}
protected MyPhoneLayoutInflater(LayoutInflater original, Context newContext) {
super(original, newContext);
}
/**
* Override onCreateView to instantiate names that correspond to the
* widgets known to the Widget factory. If we don't find a match,
* call through to our super class.
*/
@Override
protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
for (String prefix : sClassPrefixList) {
try {
View view = createView(name, prefix, attrs);
if (view != null) {
return view;
}
} catch (ClassNotFoundException e) {
// In this case we want to let the base class take a crack
// at it.
}
}
return super.onCreateView(name, attrs);
}
public LayoutInflater cloneInContext(Context newContext) {
return new MyPhoneLayoutInflater(this, newContext);
}
}

View File

@@ -11,6 +11,8 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.amap.api.navi.AMapNaviView;
import com.android.internal.policy.MyPhoneLayoutInflater;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.device.Devices;
@@ -59,9 +61,17 @@ public abstract class AbsMogoApplication extends Application {
return sApp;
}
public static AMapNaviView aMapNaviView;
public static AMapNaviView getMapNaviView() {
return aMapNaviView;
}
@Override
public void onCreate() {
super.onCreate();
aMapNaviView = new AMapNaviView(this);
aMapNaviView.onCreate(null);
// 在设置皮肤布局填充器之前进行克隆一个出来
mLayoutInflaterNoSkin = LayoutInflater.from(new ContextThemeWrapper(this, R.style.Theme_AppCompat)).cloneInContext(new ContextThemeWrapper(this, R.style.Theme_AppCompat));
sApp = this;

View File

@@ -30,7 +30,6 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
@Override
protected void onCreate( @Nullable Bundle savedInstanceState ) {
hideBottomUIMenu();
super.onCreate( savedInstanceState );
beforeSetContentView(savedInstanceState);
if ( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD ) {
@@ -43,6 +42,12 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
getLifecycle().addObserver( mPresenter );
}
@Override
protected void onResume() {
super.onResume();
hideBottomUIMenu();
}
//隐藏导航栏
protected void hideBottomUIMenu() {
//隐藏虚拟按键