提交 b51592d0 编写于 作者: J jackjintai

android:适配AGP 4.0

上级 b91f42e4
......@@ -65,9 +65,9 @@ android {
abortOnError false
}
dataBinding {
enabled = true
}
// dataBinding {
// enabled = true
// }
}
......
if (rootProject.ext.config["applyPlugin"]) {
// 引用插件
apply plugin: 'com.didi.dokit.debug'
// apply plugin: 'com.didi.dokit'
//apply plugin: 'com.didi.dokit'
// 这里引用正常库
dependencies {
//外部平台依赖
......
......@@ -24,8 +24,6 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!--用于获取wifi的获取权限,wifi信息会用来进行网络定位-->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!--用于访问网络,网络定位需要上网-->
<uses-permission android:name="android.permission.INTERNET" />
<!--用于读取手机当前的状态-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!--用于写入缓存数据到扩展存储卡-->
......
......@@ -26,17 +26,16 @@ ext {
versionName : "3.1.7",
glide_version : "4.9.0",
kotlin_version : "1.3.72",
booster_version : "2.0.0"
booster_version : "2.1.0"
]
dependencies = [// ###### android library start ######
"multidex" : 'androidx.multidex:multidex:2.0.0',
"appcompat" : 'androidx.appcompat:appcompat:1.0.0',
"appcompat" : 'androidx.appcompat:appcompat:1.1.0',
"cardview" : 'androidx.cardview:cardview:1.0.0',
"recyclerview" : 'androidx.recyclerview:recyclerview:1.0.0',
"databinding" : 'androidx.databinding:3.2.0-alpha11',
"design" : 'com.google.android.material:material:1.0.0',
"recyclerview" : 'androidx.recyclerview:recyclerview:1.1.0',
"design" : 'com.google.android.material:material:1.1.0',
"kotlin" : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${android["kotlin_version"]}",
"core-ktx" : "androidx.core:core-ktx:1.2.0",
"core-ktx" : "androidx.core:core-ktx:1.3.0",
//constraintLayout
"constraintLayout" : 'androidx.constraintlayout:constraintlayout:1.1.3',
//test
......@@ -54,7 +53,7 @@ ext {
//将urlconnection代理到okhttp
//"okhttp_urlconnection" : "com.squareup.okhttp3:okhttp-urlconnection:3.12.1",
//"okio" : "com.squareup.okio:okio:1.15.0",
"utilcode" : 'com.blankj:utilcodex:1.28.4',
"utilcode" : 'com.blankj:utilcodex:1.29.0',
"glide" : "com.github.bumptech.glide:glide:${android["glide_version"]}",
"glide_v3" : 'com.github.bumptech.glide:glide:3.8.0',
"glide_okhttp3" : "com.github.bumptech.glide:okhttp3-integration:${android["glide_version"]}",
......
......@@ -101,17 +101,18 @@ configurations.all {
//这里指定需要统一的依赖版本 比如我的需要配置成27.1.1
details.useVersion '3.14.7'
}
} else if (requested.group == 'androidx.core') {
if (requested.name == "core") {
//这里指定需要统一的依赖版本 比如我的需要配置成27.1.1
details.useVersion '1.2.0'
}
} else if (requested.group == 'androidx.versionedparcelable') {
if (requested.name == "versionedparcelable") {
//这里指定需要统一的依赖版本 比如我的需要配置成27.1.1
details.useVersion '1.1.0'
}
}
// else if (requested.group == 'androidx.core') {
// if (requested.name == "core") {
// //这里指定需要统一的依赖版本 比如我的需要配置成27.1.1
// details.useVersion '1.2.0'
// }
// } else if (requested.group == 'androidx.versionedparcelable') {
// if (requested.name == "versionedparcelable") {
// //这里指定需要统一的依赖版本 比如我的需要配置成27.1.1
// details.useVersion '1.1.0'
// }
// }
}
}
......
......@@ -71,7 +71,7 @@ import java.util.*
* Created by jintai on 2019/12/18.
* DoraemonKit 真正执行的类 不建议外部app调用
*/
object DoraemonKitReal {
internal object DoraemonKitReal {
private const val TAG = "Doraemon"
/**
......
......@@ -62,7 +62,7 @@ public class GpsMockFragment extends BaseFragment implements SettingItemAdapter.
}
private void initWebView() {
mWebView = findViewById(R.id.web_view);
mWebView = findViewById(R.id.webview);
WebUtil.webViewLoadLocalHtml(mWebView, "html/map.html");
mWebView.addInvokeListener(this);
}
......
......@@ -33,7 +33,7 @@ public class WebDoorDefaultFragment extends BaseFragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mWebView = findViewById(R.id.web_view);
mWebView = findViewById(R.id.webview);
mWebView.loadUrl(mUrl);
}
......
package com.didichuxing.doraemonkit.widget.webview;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
......@@ -23,20 +25,35 @@ public class MyWebView extends WebView {
private MyWebViewClient mMyWebViewClient;
public MyWebView(Context context) {
super(context);
super(getFixedContext(context));
init(context);
}
public MyWebView(Context context, AttributeSet attrs) {
super(context, attrs);
super(getFixedContext(context), attrs);
init(context);
}
public MyWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
super(getFixedContext(context), attrs, defStyleAttr);
init(context);
}
/**
* 参考: https://www.jianshu.com/p/d86de6a1e791
*
* @param context
* @return
*/
@SuppressLint("ObsoleteSdkInt")
private static Context getFixedContext(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return context.createConfigurationContext(new Configuration());
} else {
return context;
}
}
private Activity mContainerActivity;
private void init(Context context) {
......
......@@ -18,7 +18,7 @@
android:layout_below="@id/title_bar">
<com.didichuxing.doraemonkit.widget.webview.MyWebView
android:id="@+id/web_view"
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
......
......@@ -4,7 +4,7 @@
android:layout_height="match_parent">
<com.didichuxing.doraemonkit.widget.webview.MyWebView
android:id="@+id/web_view"
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册