提交 7d41d980 编写于 作者: A Alvince

Merge branch 'kotlin/weex' into dev-kotlin

......@@ -21,12 +21,12 @@ import com.didichuxing.doraemonkit.kit.core.DokitViewManager
* ================================================
*/
class DemoDokitView : AbsDokitView() {
override fun onCreate(context: Context?) {}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreate(context: Context) {}
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_demo, rootView, false)
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
val tvClose = findViewById<TextView>(R.id.tv_close)
tvClose.setOnClickListener { DokitViewManager.instance.detach(this@DemoDokitView) }
}
......
......@@ -73,7 +73,7 @@ ext {
"haha" : 'com.squareup.haha:haha:2.0.4',
"debug-db" : "com.amitshekhar.android:debug-db:1.0.6",
"debug-db-encrypt" : "com.amitshekhar.android:debug-db-encrypt:1.0.6",
"weex_inspector" : "com.taobao.android:weex_inspector:0.24.2.11",
"weex_inspector" : "com.taobao.android:weex_inspector:0.28.0-alpha-1",
"weex_sdk" : "com.taobao.android:weex_sdk:0.26.0",
"brvah" : 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.2',
"easy_refresh_layout": 'com.github.anzaizai:EasyRefreshLayout:1.3.1',
......
# http://editorconfig.org
[*]
charset = utf-8
indent_style = space
end_of_line = lf
insert_final_newline = true
/build
\ No newline at end of file
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation rootProject.ext.dependencies["kotlin"]
implementation rootProject.ext.dependencies["appcompat"]
implementation rootProject.ext.dependencies["core-ktx"]
implementation rootProject.ext.dependencies["constraintLayout"]
implementation rootProject.ext.dependencies["design"]
implementation rootProject.ext.dependencies["utilcode"]
implementation rootProject.ext.dependencies["zxing"]
implementation rootProject.ext.dependencies["zxing-lite"]
if (rootProject.ext.config["uploadArchives"]) {
implementation "com.didichuxing.doraemonkit:doraemonkit:${rootProject.ext.android["jcenterArchivesVersionName"]}"
} else {
implementation project(':doraemonkit')
}
compileOnly rootProject.ext.dependencies["weex_inspector"]
compileOnly rootProject.ext.dependencies["weex_sdk"]
testImplementation rootProject.ext.dependencies["junit"]
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
if (getProperty('dokit.weex.upload') as int == 1) {
apply from: './upload.gradle'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.didichuxing.doraemonkit.weex
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.didichuxing.doraemonkit.weex.test", appContext.packageName)
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.didichuxing.doraemonkit.weex">
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application>
<activity
android:name=".devtool.DevToolActivity"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
<activity
android:name=".devtool.DevToolScanActivity"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
<activity
android:name=".common.DKCommonActivity"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
</application>
</manifest>
package com.didichuxing.doraemonkit.weex.common
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.didichuxing.doraemonkit.kit.core.BaseActivity
import com.didichuxing.doraemonkit.kit.core.BaseFragment
/**
* Transformed by alvince on 2020/6/30
*
* @author haojianglong
* @date 2019-06-18
*/
class DKCommonActivity : BaseActivity() {
companion object {
private const val CLASSNAME = "className"
@JvmStatic
fun startWith(context: Context, clazz: Class<out BaseFragment>) {
val intent = Intent(context, DKCommonActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.putExtra(CLASSNAME, clazz)
context.startActivity(intent)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
intent.extras
?: run {
finish()
return
}
(intent.getSerializableExtra(CLASSNAME) as? Class<BaseFragment>)
?.also { showContent(it) }
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.devtool
import android.Manifest
import android.app.Activity
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.didichuxing.doraemonkit.weex.util.launchActivity
import com.king.zxing.Intents
import com.taobao.weex.WXEnvironment
import com.taobao.weex.WXSDKEngine
/**
* Transformed by alvince on 2020/7/1
*
* @author haojianglong
* @date 2019-06-25
*/
class DevToolActivity : AppCompatActivity() {
companion object {
private const val REQUEST_CODE_CAMERA = 197
private const val REQUEST_CODE_SCAN = 392
private const val TAG = "DevToolActivity"
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
startScan()
return
}
if (checkSelfPermission(Manifest.permission.CAMERA) == PackageManager.PERMISSION_DENIED) {
requestPermissions(arrayOf(Manifest.permission.CAMERA), REQUEST_CODE_CAMERA)
} else {
startScan()
}
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
grantResults.takeIf { requestCode == REQUEST_CODE_CAMERA }
?.also { results ->
permissions.takeIf { it.isNotEmpty() }?.forEachIndexed { index, s ->
if (s == Manifest.permission.CAMERA
&& results[index] == PackageManager.PERMISSION_GRANTED
) {
startScan()
return@also
}
}
finish()
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
data?.also { result ->
result.takeIf {
requestCode == REQUEST_CODE_SCAN && resultCode == Activity.RESULT_OK
}
?.getStringExtra(Intents.Scan.RESULT)
?.takeIf { it.isNotEmpty() }
?.let {
try {
Uri.parse(it)
} catch (ex: Exception) {
Log.e(TAG, "Fail to parse scan result: $it", ex)
null
}
}
?.also { handleScanResult(it) }
?: handleNoResult()
}
}
private fun startScan() {
launchActivity(
Intent(this, DevToolScanActivity::class.java),
REQUEST_CODE_SCAN
)
}
private fun handleNoResult() {
Toast.makeText(applicationContext, "没有扫描到任何内容>_<", Toast.LENGTH_SHORT).show()
finish()
}
private fun handleScanResult(uri: Uri) {
if (WXEnvironment.isApkDebugable()) {
val devToolUrl = uri.getQueryParameter("_wx_devtool")
if (!TextUtils.isEmpty(devToolUrl)) {
WXEnvironment.sRemoteDebugProxyUrl = devToolUrl
WXEnvironment.sDebugServerConnectable = true
WXSDKEngine.reload(applicationContext, false)
}
}
finish()
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.devtool
import android.view.ViewGroup
import android.widget.FrameLayout
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.util.containerView
import com.didichuxing.doraemonkit.weex.util.getColorCompat
import com.didichuxing.doraemonkit.weex.util.getDimensionPixel
import com.didichuxing.doraemonkit.widget.titlebar.HomeTitleBar
import com.king.zxing.CaptureActivity
/**
* Created by alvince on 2020/7/1
*
* @author alvince.zy@gmail.com
*/
class DevToolScanActivity : CaptureActivity() {
override fun initUI() {
// init title
HomeTitleBar(this).apply {
setBackgroundColor(getColorCompat(R.color.foreground_wtf))
setTitle(R.string.dk_dev_tool_title)
setIcon(R.mipmap.dk_close_icon)
setListener(object : HomeTitleBar.OnTitleBarClickListener {
override fun onRightClick() {
finish()
}
})
}.also { titleBar ->
containerView()?.addView(
titleBar,
FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
getDimensionPixel(R.dimen.dk_home_title_height)
)
)
}
super.initUI()
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.devtool
import android.content.Context
import android.content.Intent
import com.didichuxing.doraemonkit.kit.AbstractKit
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.util.launchActivity
/**
* Transformed by alvince on 2020/7/1
*
* @author haojianglong
* @date 2019-06-11
*/
class WeexDevToolKit : AbstractKit() {
override val name: Int
get() = R.string.dk_dev_tool_name
override val icon: Int
get() = R.mipmap.dk_custom
override val isInnerKit: Boolean
get() = true
override fun onAppInit(context: Context?) {
}
override fun onClick(context: Context?) {
context?.also {
Intent(it, DevToolActivity::class.java)
.apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
.also { intent ->
it.launchActivity(intent)
}
}
}
override fun innerKitId(): String = "dokit_sdk_weex_ck_devtool"
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.info
/**
* Transformed by alvince on 2020/6/30
*
* @author haojianglong
* @date 2019-06-25
*/
class WeexInfo(var key: String, var value: String)
package com.didichuxing.doraemonkit.weex.info
import android.os.Bundle
import android.view.View
import android.widget.ListView
import com.didichuxing.doraemonkit.kit.core.BaseFragment
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.info.adapter.WeexInfoAdapter
import com.didichuxing.doraemonkit.widget.titlebar.HomeTitleBar
/**
* Transformed by alvince on 2020/6/30
*
* @author haojianglong
* @date 2019-06-18
*/
class WeexInfoFragment : BaseFragment() {
private var adapter: WeexInfoAdapter? = null
override fun onRequestLayout(): Int = R.layout.dk_fragment_info
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
findViewById<HomeTitleBar>(R.id.title_bar)
.setListener(object : HomeTitleBar.OnTitleBarClickListener {
override fun onRightClick() {
activity?.finish()
}
})
findViewById<ListView>(R.id.info_list).apply {
adapter = WeexInfoAdapter(requireContext()).also {
it.setWeexInfos(WeexInfoHacker.getWeexInfos())
}
}
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.info
import com.taobao.weex.WXEnvironment
/**
* Transformed by alvince on 2020/6/30
*
* @author haojianglong
* @date 2019-06-25
*/
object WeexInfoHacker {
fun getWeexInfos(): List<WeexInfo> = mutableListOf<WeexInfo>()
.apply {
WXEnvironment.getConfig()
.filter { entry -> !entry.key.isNullOrEmpty() }
.map { entry -> WeexInfo(entry.key, entry.value ?: "") }
.forEach { info -> add(info) }
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.info
import android.content.Context
import com.didichuxing.doraemonkit.kit.AbstractKit
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.common.DKCommonActivity
/**
* Transformed by alvince on 2020/6/30
*
* @author haojianglong
* @date 2019-06-11
*/
class WeexInfoKit : AbstractKit() {
override val name: Int
get() = R.string.dk_weex_info_name
override val icon: Int
get() = R.mipmap.dk_sys_info
override val isInnerKit: Boolean
get() = true
override fun onAppInit(context: Context?) {
}
override fun onClick(context: Context?) {
context?.also {
DKCommonActivity.startWith(it, WeexInfoFragment::class.java)
}
}
override fun innerKitId(): String = "dokit_sdk_weex_ck_info"
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.info.adapter
import android.content.Context
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.RelativeLayout
import android.widget.TextView
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.info.WeexInfo
import com.didichuxing.doraemonkit.weex.util.getDimensionPixel
/**
* Transformed by alvince on 2020/6/30
*
* @author haojianglong
* @date 2019-06-25
*/
class WeexInfoAdapter(private val context: Context) : BaseAdapter() {
private val weexInfoList = mutableListOf<WeexInfo>()
override fun getItem(position: Int): WeexInfo? = position
.takeIf { it in 0 until count }
?.let { weexInfoList[it] }
override fun getItemId(position: Int): Long = 0L
override fun getCount(): Int = weexInfoList.size
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
val view = convertView
?: LayoutInflater.from(context).inflate(R.layout.dk_fragment_info_item, null)
return view.also { v ->
val holder = v.tag
?.let { it as? ViewHolder }
?: ViewHolder().apply {
keyText = v.findViewById(R.id.info_item_key)
valueText = v.findViewById(R.id.info_item_value)
v.tag = this
}
holder.apply {
getItem(position)?.also { info ->
keyText?.bind(info.key)
valueText?.bind(info.value)
}
v.layoutParams = RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
context.getDimensionPixel(R.dimen.dk_title_height)
)
}
}
}
fun setWeexInfos(list: List<WeexInfo>) {
weexInfoList.apply {
clear()
addAll(list)
}
}
private fun TextView.bind(text: String?) {
(text ?: "").also { t ->
if (TextUtils.isEmpty(text)) {
visibility = View.GONE
} else {
visibility = View.VISIBLE
this.text = t
}
}
}
internal class ViewHolder {
var keyText: TextView? = null
var valueText: TextView? = null
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.log
import android.content.Context
import com.didichuxing.doraemonkit.kit.AbstractKit
import com.didichuxing.doraemonkit.kit.core.DokitIntent
import com.didichuxing.doraemonkit.kit.core.DokitViewManager
import com.didichuxing.doraemonkit.kit.loginfo.LogInfoManager
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.log.widget.WeexLogInfoDokitView
/**
* Transformed by alvince on 2020/6/30
*
* @author haojianglong
* @date 2019-06-11
*/
class WeexLogKit : AbstractKit() {
override val name: Int
get() = R.string.dk_console_log_name
override val icon: Int
get() = R.mipmap.dk_log_info
override val isInnerKit: Boolean
get() = true
override fun onAppInit(context: Context?) {
}
override fun onClick(context: Context?) {
DokitIntent(WeexLogInfoDokitView::class.java)
.apply {
mode = DokitIntent.MODE_SINGLE_INSTANCE
}
.also { intent ->
DokitViewManager.instance.attach(intent)
}
//开启日志服务
LogInfoManager.start()
}
override fun innerKitId(): String = "dokit_sdk_weex_ck_log"
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.log.widget
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import com.didichuxing.doraemonkit.kit.loginfo.LogInfoDokitView
import com.didichuxing.doraemonkit.kit.loginfo.LogInfoManager
import com.didichuxing.doraemonkit.kit.loginfo.LogLine
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.widget.titlebar.LogTitleBar
import com.taobao.weex.utils.WXLogUtils.WEEX_TAG
/**
* Transformed by alvince on 2020/6/30
*
* @author haojianglong
* @date 2019-06-25
*/
class WeexLogInfoDokitView : LogInfoDokitView() {
override fun onCreateView(context: Context, rootView: FrameLayout): View =
LayoutInflater.from(context).inflate(R.layout.dk_weex_float_log_info, null)
override fun onViewCreated(rootView: FrameLayout) {
findViewById<LogTitleBar>(R.id.dokit_title_bar)
.setListener(object : LogTitleBar.OnTitleBarClickListener {
override fun onRightClick() {
LogInfoManager.also {
//关闭日志服务
it.stop()
//清空回调
it.removeListener()
detach()
}
}
override fun onLeftClick() {
minimize()
}
})
}
override fun onLogCatch(logLines: List<LogLine>) {
logLines.takeIf { it.isNotEmpty() }
?.filter { line ->
line.tag?.contains(WEEX_TAG) == true
}
?.also {
super.onLogCatch(it)
}
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.storage
import android.app.Application
import android.content.Context
import android.database.Cursor
import android.database.sqlite.SQLiteDatabase
import android.os.Handler
import android.os.Looper
import android.util.Log
import com.taobao.weex.WXSDKEngine
import com.taobao.weex.appfram.storage.DefaultWXStorage
import com.taobao.weex.appfram.storage.IWXStorageAdapter
import com.taobao.weex.appfram.storage.WXSQLiteOpenHelper
import java.util.concurrent.Executors
/**
* Transformed by alvince on 2020/7/1
*
* @author haojianglong
* @date 2019-06-18
*/
class StorageHacker(context: Context, private val isDebug: Boolean) {
interface OnLoadListener {
fun onLoad(list: List<StorageInfo>)
}
interface OnRemoveListener {
fun onRemoved(status: Boolean)
}
companion object {
const val TAG = "StorageHacker"
}
private val handler by lazy { Handler(Looper.getMainLooper()) }
private val executor by lazy {
Executors.newCachedThreadPool { runnable -> Thread(runnable, "wx_analyzer_storage_dumper") }
}
private var storageAdapter: IWXStorageAdapter? = WXSDKEngine.getIWXStorageAdapter()
private var hackerContext: Context = context
.let {
if (it is Application) it else it.applicationContext
}
private var disposed = false
fun destroy() {
if (disposed) {
return
}
handler.removeCallbacksAndMessages(null)
executor.takeIf { !it.isShutdown }?.shutdown()
disposed = true
}
fun isDestroy(): Boolean = disposed || executor.isShutdown
fun fetch(listener: OnLoadListener) {
if (storageAdapter == null
|| storageAdapter !is DefaultWXStorage
) {
listener.onLoad(emptyList())
return
}
if (isDestroy()) {
listener.onLoad(emptyList())
return
}
executor.execute {
var sqliteHelper: WXSQLiteOpenHelper? = null
try {
sqliteHelper = WXSQLiteOpenHelper::class.java.getDeclaredConstructor(Context::class.java)
.let { constructor ->
constructor.isAccessible = true
constructor.newInstance(hackerContext)
}
WXSQLiteOpenHelper::class.java.getDeclaredMethod("getDatabase")
.let { method ->
method.isAccessible = true
method.invoke(sqliteHelper) as? SQLiteDatabase
}
?.also { database ->
val result = mutableListOf<StorageInfo>()
database.query(
"default_wx_storage", arrayOf("key", "value", "timestamp"),
null, null, null, null, null
).use { cursor ->
if (isDebug) {
Log.d("weex-analyzer", "start dump weex storage")
}
while (cursor.moveToNext()) {
StorageInfo().apply {
key = cursor.stringAt("key")
value = cursor.stringAt("value")
timestamp = cursor.stringAt("timestamp")
}.also { info ->
if (isDebug) {
Log.d("weex-analyzer", "weex storage[${info.key} | ${info.value}]")
}
result.add(info)
}
}
if (isDebug) {
Log.d("weex-analyzer", "end dump weex storage")
}
}
handler.post { listener.onLoad(result) }
}
} catch (ex: Exception) {
Log.e(TAG, "", ex)
} finally {
sqliteHelper?.closeDatabase()
}
}
}
fun remove(key: String, listener: OnRemoveListener) {
if (key.isEmpty()) {
return
}
if (storageAdapter == null
|| storageAdapter !is DefaultWXStorage
) {
listener.onRemoved(false)
return
}
if (isDestroy()) {
listener.onRemoved(false)
return
}
executor.execute {
(storageAdapter as? DefaultWXStorage)?.also { storage ->
try {
storage.javaClass.getDeclaredMethod("performRemoveItem", String::class.java)
.also { method ->
method.isAccessible = true
method.invoke(storage, key)
?.let { it as? Boolean }
?.also { result ->
handler.post {
listener.onRemoved(result)
}
}
method.isAccessible = false
}
} catch (ex: Exception) {
Log.d(TAG, "Fail to resolve storage method: performRemoveItem(String)", ex)
}
}
}
}
private fun Cursor.stringAt(column: String): String {
if (column.isEmpty()) {
return ""
}
return getColumnIndex(column)
.takeIf { it != -1 }
?.let { index -> getString(index) }
?: ""
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.storage
import java.io.Serializable
/**
* Transformed by alvince on 2020/7/1
*
* @author haojianglong
* @date 2019-06-18
*/
class StorageInfo(
var key: String = "",
var value: String = ""
) : Serializable {
var timestamp: String? = null
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.storage
import android.content.Context
import com.didichuxing.doraemonkit.kit.AbstractKit
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.common.DKCommonActivity.Companion.startWith
import com.didichuxing.doraemonkit.weex.storage.fragment.StorageFragment
/**
* Created by alvince on 2020/7/1
*
* @author alvince.zy@gmail.com
*/
class WeexStorageKit : AbstractKit() {
override val name: Int
get() = R.string.dk_storage_cache_name
override val icon: Int
get() = R.mipmap.dk_file_explorer
override val isInnerKit: Boolean
get() = true
override fun onAppInit(context: Context?) {
}
override fun onClick(context: Context?) {
context?.also {
startWith(it, StorageFragment::class.java)
}
}
override fun innerKitId(): String = "dokit_sdk_weex_ck_storage"
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.storage.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.storage.StorageInfo
import com.didichuxing.doraemonkit.widget.recyclerview.AbsRecyclerAdapter
import com.didichuxing.doraemonkit.widget.recyclerview.AbsViewBinder
/**
* Transformed by alvince on 2020/7/1
*
* @author haojianglong
* @date 2019-06-18
*/
class StorageAdapter(context: Context) : AbsRecyclerAdapter<StorageAdapter.ViewHolder, StorageInfo>(context) {
interface OnItemClickListener {
/** 点击事件 */
fun onItemClick(info: StorageInfo)
}
companion object {
private const val TITLE_BACKGROUND_COLOR: Int = 0xFFBBBBBB.toInt()
private const val NORMAL_BACKGROUND_COLOR: Int = 0xFFCDCDCD.toInt()
private const val PRE_HOLDER_KEY: String = "key"
private const val PRE_HOLDER_VALUE = "value"
}
var onItemClickListener: OnItemClickListener? = null
init {
append(StorageInfo(PRE_HOLDER_KEY, PRE_HOLDER_VALUE))
}
override fun createViewHolder(view: View, viewType: Int): ViewHolder =
ViewHolder(view) {
onItemClickListener?.onItemClick(it)
}
override fun createView(inflater: LayoutInflater, parent: ViewGroup?, viewType: Int): View =
inflater.inflate(R.layout.dk_item_storage_watch, parent, false)
class ViewHolder(itemView: View, private val onHolderSelect: (StorageInfo) -> Unit) :
AbsViewBinder<StorageInfo>(itemView) {
private val keyTextView: TextView?
get() = itemView.findViewById(R.id.tv_tip_key)
private val valueTextView: TextView?
get() = itemView.findViewById(R.id.tv_tip_value)
override fun onBind(data: StorageInfo, position: Int) {
if (adapterPosition == 0) {
TITLE_BACKGROUND_COLOR
} else {
NORMAL_BACKGROUND_COLOR
}.also { color ->
keyTextView?.setBackgroundColor(color)
valueTextView?.setBackgroundColor(color)
}
keyTextView?.text = data.key
valueTextView?.text = data.value
itemView.setOnClickListener {
data.takeIf { adapterPosition != 0 }
?.also {
onHolderSelect.invoke(it)
}
}
}
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.storage.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.storage.StorageInfo
import kotlinx.android.synthetic.main.dk_item_storage_dialog.*
/**
* Transformed by alvince on 2020/7/1
*
* @author alvince.zy@gmail.com
*/
class StorageDialogFragment : DialogFragment() {
companion object {
const val KEY_STORAGE_INFO = "key_storage_info"
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? =
inflater.inflate(R.layout.dk_item_storage_dialog, container)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
arguments?.getSerializable(KEY_STORAGE_INFO)
?.let { it as? StorageInfo }
?.also { info ->
view.apply {
tv_name.text = info.key
tv_value.text = info.value
}
}
}
override fun onStart() {
super.onStart()
dialog?.also {
it.window?.setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
}
}
}
\ No newline at end of file
package com.didichuxing.doraemonkit.weex.storage.fragment
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.didichuxing.doraemonkit.kit.core.BaseFragment
import com.didichuxing.doraemonkit.weex.R
import com.didichuxing.doraemonkit.weex.storage.StorageHacker
import com.didichuxing.doraemonkit.weex.storage.StorageInfo
import com.didichuxing.doraemonkit.weex.storage.adapter.StorageAdapter
import com.didichuxing.doraemonkit.widget.recyclerview.DividerItemDecoration
import com.didichuxing.doraemonkit.widget.titlebar.HomeTitleBar
/**
* Transformed by alvince on 2020/7/1
*
* @author haojianglong
* @date 2019-06-18
*/
class StorageFragment : BaseFragment() {
private var storageHacker: StorageHacker? = null
override fun onRequestLayout(): Int = R.layout.dk_fragment_storage
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
findViewById<HomeTitleBar>(R.id.title_bar)
.apply {
setListener(object : HomeTitleBar.OnTitleBarClickListener {
override fun onRightClick() {
activity?.finish()
}
})
}
findViewById<RecyclerView>(R.id.info_list)
.apply {
layoutManager = LinearLayoutManager(view.context, LinearLayoutManager.VERTICAL, false)
addItemDecoration(DividerItemDecoration(DividerItemDecoration.VERTICAL))
adapter = StorageAdapter(context).apply {
onItemClickListener = object : StorageAdapter.OnItemClickListener {
override fun onItemClick(info: StorageInfo) {
StorageDialogFragment().also {
it.arguments = Bundle().apply {
putSerializable(StorageDialogFragment.KEY_STORAGE_INFO, info)
}
}.also { dialog ->
fragmentManager?.also { fm ->
dialog.show(fm, "dialog")
}
}
}
}
}
storageHacker = StorageHacker(context, true).also {
it.fetch(object : StorageHacker.OnLoadListener {
override fun onLoad(list: List<StorageInfo>) {
(adapter as? StorageAdapter)?.append(list)
}
})
}
}
}
override fun onDestroy() {
storageHacker?.destroy()
super.onDestroy()
}
}
/*
* Activity ktx declaring
*
* @author alvince.zy@gmail.com
*/
package com.didichuxing.doraemonkit.weex.util
import android.app.Activity
import android.os.Build
import android.widget.FrameLayout
/**
* Find the [Activity] content's container [FrameLayout] which has the id `R.id.content`
*/
fun Activity.containerView(): FrameLayout? {
if (isFinishing) {
return null
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed) {
return null
}
return window?.decorView?.findViewById(android.R.id.content)
}
/*
* Context ktx defined
*
* Created by alvince on 2020/7/1
*
* @author alvince.zy@gmail.com
*/
package com.didichuxing.doraemonkit.weex.util
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.Resources
import android.os.Bundle
import android.view.ContextThemeWrapper
import androidx.annotation.ColorRes
import androidx.annotation.DimenRes
import androidx.annotation.Dimension
import androidx.annotation.Dimension.PX
import androidx.core.content.res.ResourcesCompat
/**
* Get color with resource-ID by [Context] compatibly
*/
fun Context.getColorCompat(@ColorRes id: Int, theme: Resources.Theme? = null) =
ResourcesCompat.getColor(resources, id, theme)
/**
* Get dimension with resource-ID by [Context] directly
*/
fun Context.getDimension(@DimenRes id: Int): Float =
resources.getDimension(id)
/**
* Get dimension with resource-ID by [Context] directly
*/
@Dimension(unit = PX)
fun Context.getDimensionPixel(@DimenRes id: Int): Int =
resources.getDimensionPixelSize(id)
/**
* Start [Activity] with target check passed
*
* @param intent for start activity
* @param requestCode `0` if no result needed
* @param option Optional, start options
*/
fun Context.launchActivity(intent: Intent, requestCode: Int = 0, option: Bundle? = null): Boolean =
packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY)
?.let { _ ->
intent.apply {
if (this !is ContextThemeWrapper) {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
}.also {
if (requestCode != 0) {
(this as? Activity)?.apply {
startActivityForResult(it, requestCode, option)
return@also
}
}
startActivity(it, option)
}
true
}
?: false
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.didichuxing.doraemonkit.widget.titlebar.HomeTitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/dk_home_title_height"
app:dkIcon="@mipmap/dk_close_icon_big"
app:dkTitle="@string/dk_weex_info_title" />
<ListView
android:id="@+id/info_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@color/dk_color_CCCCCC"
android:dividerHeight="1px"
android:paddingLeft="@dimen/dk_dp_15"
android:scrollbars="none" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/dk_title_height">
<TextView
android:id="@+id/info_item_key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textColor="@color/dk_color_333333"
android:textSize="@dimen/dk_font_size_16" />
<TextView
android:id="@+id/info_item_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dk_dp_40"
android:layout_marginRight="@dimen/dk_dp_15"
android:layout_toRightOf="@id/info_item_key"
android:gravity="right"
android:textColor="@color/dk_color_666666"
android:textSize="@dimen/dk_font_size_14" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dk_color_FFFFFF"
android:orientation="vertical">
<com.didichuxing.doraemonkit.widget.titlebar.HomeTitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/dk_home_title_height"
app:dkIcon="@mipmap/dk_close_icon_big"
app:dkTitle="@string/dk_storage_cache_title" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/info_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
android:scrollbars="none" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/dk_dp_20"
android:paddingTop="@dimen/dk_dp_40"
android:paddingRight="@dimen/dk_dp_20"
android:paddingBottom="@dimen/dk_dp_40">
<TextView
android:id="@+id/tv_key_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dk_storage_tip_key"
android:textSize="@dimen/dk_font_size_16"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_key_tip"
android:textSize="@dimen/dk_font_size_18" />
<TextView
android:id="@+id/tv_value_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_name"
android:layout_marginTop="10dp"
android:text="@string/dk_storage_tip_value"
android:textSize="@dimen/dk_font_size_16"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_value_tip"
android:textSize="@dimen/dk_font_size_18" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/dk_dp_40"
android:orientation="vertical">
<TextView
android:id="@+id/tv_tip_key"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="center"
android:singleLine="true"
android:textSize="@dimen/dk_font_size_18"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tv_tip_value" />
<TextView
android:id="@+id/tv_tip_value"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="center"
android:singleLine="true"
android:textSize="@dimen/dk_font_size_18"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@+id/tv_tip_key"
app:layout_constraintRight_toRightOf="parent" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="@color/dk_color_999999"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/tv_tip_value"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/log_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dk_color_FFFFFF"
android:orientation="vertical">
<com.didichuxing.doraemonkit.widget.titlebar.LogTitleBar
android:id="@id/dokit_title_bar"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_alignParentTop="true"
android:background="@color/foreground_wtf"
app:dkBack="@string/dk_kit_log_min"
app:dkIcon="@mipmap/dk_close_icon"
app:dkTitle="@string/dk_console_log_title" />
<View
android:id="@+id/view_divider"
style="@style/DK.Shadow.Bottom"
android:layout_below="@id/dokit_title_bar" />
<EditText
android:id="@+id/log_filter"
style="@style/DK.Input"
android:layout_height="50dp"
android:layout_below="@id/view_divider"
android:layout_marginLeft="16dp"
android:layout_marginTop="15dp"
android:layout_marginRight="16dp"
android:background="@drawable/dk_log_filter_background"
android:elevation="1dp"
android:hint="@string/dk_log_info_edt_hint"
android:inputType="text"
android:paddingLeft="15dp"
android:paddingRight="15dp" />
<LinearLayout
android:id="@+id/button_wrap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/log_filter"
android:layout_marginTop="16dp"
android:layout_marginBottom="6dp"
android:orientation="vertical">
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<RadioButton
android:id="@+id/verbose"
style="@style/DK.RadioButton.Left"
android:text="@string/dk_log_info_verbose" />
<RadioButton
android:id="@+id/debug"
style="@style/DK.RadioButton"
android:text="@string/dk_log_info_debug" />
<RadioButton
android:id="@+id/info"
style="@style/DK.RadioButton"
android:text="@string/dk_log_info_info" />
<RadioButton
android:id="@+id/warn"
style="@style/DK.RadioButton"
android:text="@string/dk_log_info_warn" />
<RadioButton
android:id="@+id/error"
style="@style/DK.RadioButton.Right"
android:text="@string/dk_log_info_error" />
</RadioGroup>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<Button
android:id="@+id/btn_clean"
style="@style/DK.RadioButton.Left"
android:text="@string/dk_log_btn_clean" />
<Button
android:id="@+id/btn_export"
style="@style/DK.RadioButton.middle"
android:text="@string/dk_log_btn_export" />
<Button
android:id="@+id/btn_top"
style="@style/DK.RadioButton.middle"
android:text="@string/dk_log_btn_back_top" />
<Button
android:id="@+id/btn_bottom"
style="@style/DK.RadioButton.Right"
android:text="@string/dk_log_btn_to_bottom" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_loading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="horizontal">
<ProgressBar
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="@string/dk_log_text_loading"
android:textColor="@color/dk_color_666666"
android:textSize="@dimen/dk_font_size_14" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/log_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/ll_loading"
android:layout_below="@id/button_wrap"
android:scrollbars="vertical"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="@+id/log_hint"
style="@style/DK.Text.White"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@color/dk_color_337CC4"
android:singleLine="true"
android:text="@string/dk_kit_log_info"
android:visibility="gone" />
</FrameLayout>
\ No newline at end of file
<resources>
<!-- <string name="app_name">weexkit</string>-->
<string name="dk_console_log_name">Log</string>
<string name="dk_console_log_title">Weex Logging</string>
<string name="dk_storage_cache_name">Cache</string>
<string name="dk_storage_cache_title">Storage Information</string>
<string name="dk_weex_info_name">Info</string>
<string name="dk_weex_info_title">Weex Information</string>
<string name="dk_dev_tool_name">DevTool</string>
<string name="dk_dev_tool_title">DevTool</string>
<string name="dk_storage_tip_key">key:</string>
<string name="dk_storage_tip_value">value:</string>
<string name="dk_log_btn_clean">Clear</string>
<string name="dk_log_btn_export">Export</string>
<string name="dk_log_btn_back_top">Top</string>
<string name="dk_log_btn_to_bottom">Bottom</string>
</resources>
<resources>
<!-- <string name="app_name">weexkit</string>-->
<string name="dk_console_log_name">日志</string>
<string name="dk_console_log_title">Weex日志记录</string>
<string name="dk_storage_cache_name">缓存</string>
<string name="dk_storage_cache_title">Storage信息查看</string>
<string name="dk_weex_info_name">信息</string>
<string name="dk_weex_info_title">Weex信息查看</string>
<string name="dk_dev_tool_name">DevTool</string>
<string name="dk_dev_tool_title">DevTool</string>
<string name="dk_storage_tip_key">key:</string>
<string name="dk_storage_tip_value">value:</string>
<string name="dk_log_btn_clean">清空日志</string>
<string name="dk_log_btn_export">导出</string>
<string name="dk_log_btn_back_top">回到顶部</string>
<string name="dk_log_btn_to_bottom">滚至底部</string>
</resources>
<resources>
<!-- <string name="app_name">weexkit</string>-->
<string name="dk_console_log_name">日誌</string>
<string name="dk_console_log_title">Weex日誌記錄</string>
<string name="dk_storage_cache_name">緩存</string>
<string name="dk_storage_cache_title">Storage信息查看</string>
<string name="dk_weex_info_name">信息</string>
<string name="dk_weex_info_title">Weex信息查看</string>
<string name="dk_dev_tool_name">DevTool</string>
<string name="dk_dev_tool_title">DevTool</string>
<string name="dk_storage_tip_key">key:</string>
<string name="dk_storage_tip_value">value:</string>
<string name="dk_log_btn_clean">清空日誌</string>
<string name="dk_log_btn_export">導出</string>
<string name="dk_log_btn_back_top">回到頂部</string>
<string name="dk_log_btn_to_bottom">滾至底部</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="dk_color_333333">#333333</color>
<color name="dk_color_666666">#666666</color>
<color name="dk_color_999999">#999999</color>
<color name="dk_color_33999999">#33999999</color>
<color name="dk_color_CCCCCC">#CCCCCC</color>
<color name="dk_color_E5E5E5">#E5E5E5</color>
<color name="dk_color_F3F4F5">#F3F4F5</color>
<color name="dk_color_FFFFFF">#FFFFFF</color>
<color name="dk_color_DDDDDD">#DDDDDD</color>
<color name="dk_color_33FFFFFF">#33FFFFFF</color>
<color name="dk_color_aa000000">#aa000000</color>
<color name="dk_color_000000">#000000</color>
<color name="dk_color_151515">#151515</color>
<color name="dk_color_2E2E3A">#2E2E3A</color>
<color name="dk_color_7AE5E5E5">#7AE5E5E5</color>
<color name="dk_color_FAD337">#FAD337</color>
<color name="dk_color_55A8FD">#55A8FD</color>
<color name="dk_color_BBBBBB">#BBBBBB</color>
<color name="dk_color_0070BB">#0070BB</color>
<color name="dk_color_000a7a">#000a7a</color>
<color name="dk_color_0099dd">#0099dd</color>
<color name="dk_color_48BB31">#48BB31</color>
<color name="dk_color_BBBB23">#BBBB23</color>
<color name="dk_color_FF0006">#FF0006</color>
<color name="dk_color_8F0005">#8F0005</color>
<color name="dk_color_CC3A4B">#CC3A4B</color>
<color name="dk_color_30CC3A4B">#30CC3A4B</color>
<color name="dk_color_F5F6F7">#F5F6F7</color>
<color name="dk_color_324456">#324456</color>
<color name="dk_color_D26282">#D26282</color>
<color name="dk_color_F4F5F6">#F4F5F6</color>
<color name="dk_color_337CC4">#337CC4</color>
<color name="dk_color_3300E0DC">#3300E0DC</color>
<color name="dk_color_3300BFFF">#3300BFFF</color>
<color name="dk_color_33434352">#33434352</color>
<color name="dk_color_79DE79">#79DE79</color>
<color name="dk_color_7FFFFFFF">#7FFFFFFF</color>
<color name="dk_color_3f3f46">#3f3f46</color>
<color name="dk_color_333339">#333339</color>
<color name="dk_color_4c00C9F4">#4c00C9F4</color>
<color name="dk_color_ff00C9F4">#ff00C9F4</color>
<color name="dk_color_60000000">#60000000</color>
<color name="dk_color_90FFFFFF">#90FFFFFF</color>
<color name="background_wtf">#FF999900</color>
<color name="background_error">#FFCC0000</color>
<color name="background_verbose">#FF666666</color>
<color name="background_debug">#FFFFFF00</color>
<color name="background_info">#FF00CC00</color>
<color name="background_warn">#FF0066CC</color>
<color name="foreground_wtf">#FFFFFFFF</color>
<color name="foreground_error">#FFFFFFFF</color>
<color name="foreground_verbose">#FFCCCCCC</color>
<color name="foreground_debug">#FF333333</color>
<color name="foreground_info">#FF333333</color>
<color name="foreground_warn">#FFCCCCCC</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="dk_dp_15">15dp</dimen>
<dimen name="dk_dp_5">5dp</dimen>
<dimen name="dk_dp_40">40dp</dimen>
<dimen name="dk_dp_20">20dp</dimen>
<dimen name="dk_dp_16">16dp</dimen>
<dimen name="dk_title_height">46.5dp</dimen>
<dimen name="dk_home_title_height">89dp</dimen>
</resources>
<resources>
<!-- <string name="app_name">weexkit</string>-->
<string name="dk_console_log_name">日志</string>
<string name="dk_console_log_title">Weex日志记录</string>
<string name="dk_storage_cache_name">缓存</string>
<string name="dk_storage_cache_title">Storage信息查看</string>
<string name="dk_weex_info_name">信息</string>
<string name="dk_weex_info_title">Weex信息查看</string>
<string name="dk_dev_tool_name">DevTool</string>
<string name="dk_dev_tool_title">DevTool</string>
<string name="dk_storage_tip_key">key:</string>
<string name="dk_storage_tip_value">value:</string>
<!--日志-->
<string name="dk_log_btn_clean">清空日志</string>
<string name="dk_log_btn_export">导出</string>
<string name="dk_log_btn_back_top">回到顶部</string>
<string name="dk_log_btn_to_bottom">滚至底部</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
package com.didichuxing.doraemonkit.weex
import org.junit.Assert.assertEquals
import org.junit.Test
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
def isRemote = rootProject.ext.config["publishPluginToRemote"]
apply plugin: 'maven'
if(isRemote){
uploadArchives {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
version rootProject.ext.android["didiArchivesVersionName"]
}
pom.withXml {
def node = it.asElement()
def nodeList = node.getElementsByTagName('dependency')
nodeList.each {dependency ->
dependency?.each { config ->
if (config?.textContent == 'the-one-sdk') {
config.parentNode.parentNode.removeChild(config.parentNode)
}
if (config?.textContent == 'onecar') {
config.parentNode.parentNode.removeChild(config.parentNode)
}
}
}
}
repository(url: project.RELEASE_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
}
snapshotRepository(url: project.SNAPSHOT_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
}
}
}
}
}else{
def localRepoURL = uri(rootProject.ext.config["localRepoURL"])
uploadArchives {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
version rootProject.ext.android["didiArchivesVersionName"]
}
pom.withXml {
def node = it.asElement()
def nodeList = node.getElementsByTagName('dependency')
nodeList.each { dependency ->
dependency?.each { config ->
if (config?.textContent == 'the-one-sdk') {
config.parentNode.parentNode.removeChild(config.parentNode)
}
if (config?.textContent == 'onecar') {
config.parentNode.parentNode.removeChild(config.parentNode)
}
}
}
}
repository(url: localRepoURL)
}
}
}
}
......@@ -27,7 +27,7 @@ class AlignRulerInfoDokitView : AbsDokitView(), OnAlignRulerMarkerPositionChange
private var mMarker: AlignRulerMarkerDokitView? = null
private var mWindowWidth = 0
private var mWindowHeight = 0
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
mWindowWidth = UIUtils.widthPixels
mWindowHeight = UIUtils.heightPixels
}
......@@ -37,7 +37,7 @@ class AlignRulerInfoDokitView : AbsDokitView(), OnAlignRulerMarkerPositionChange
mMarker?.removePositionChangeListener(this)
}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_align_ruler_info, null)
}
......@@ -51,7 +51,7 @@ class AlignRulerInfoDokitView : AbsDokitView(), OnAlignRulerMarkerPositionChange
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
postDelayed(100, Runnable {
mMarker = DokitViewManager.instance.getDokitView(ActivityUtils.getTopActivity(), AlignRulerMarkerDokitView::class.java.simpleName) as AlignRulerMarkerDokitView?
mMarker?.addPositionChangeListener(this)
......
......@@ -22,13 +22,13 @@ import com.didichuxing.doraemonkit.kit.core.DokitViewManager
class AlignRulerLineDokitView : AbsDokitView(), OnAlignRulerMarkerPositionChangeListener {
private var mMarker: AlignRulerMarkerDokitView? = null
private var mAlignInfoView: AlignLineView? = null
override fun onCreate(context: Context?) {}
override fun onCreate(context: Context) {}
override fun onDestroy() {
super.onDestroy()
mMarker?.removePositionChangeListener(this)
}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_align_ruler_line, rootView, false)
}
......@@ -41,7 +41,7 @@ class AlignRulerLineDokitView : AbsDokitView(), OnAlignRulerMarkerPositionChange
}
override fun onViewCreated(view: FrameLayout?) {
override fun onViewCreated(view: FrameLayout) {
postDelayed(100, Runnable {
mMarker = DokitViewManager.instance.getDokitView(ActivityUtils.getTopActivity(), AlignRulerMarkerDokitView::class.java.simpleName) as AlignRulerMarkerDokitView?
mMarker?.addPositionChangeListener(this@AlignRulerLineDokitView)
......
......@@ -18,11 +18,11 @@ import java.util.*
*/
class AlignRulerMarkerDokitView : AbsDokitView() {
private val mPositionChangeListeners: MutableList<OnAlignRulerMarkerPositionChangeListener> = ArrayList()
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_align_ruler_marker, null)
}
override fun onViewCreated(rootView: FrameLayout?) {}
override fun onViewCreated(rootView: FrameLayout) {}
override fun initDokitViewLayoutParams(params: DokitViewLayoutParams?) {
params?.let {
it.height = DokitViewLayoutParams.WRAP_CONTENT
......@@ -33,7 +33,7 @@ class AlignRulerMarkerDokitView : AbsDokitView() {
}
override fun onCreate(context: Context?) {}
override fun onCreate(context: Context) {}
override fun onDestroy() {
super.onDestroy()
removePositionChangeListeners()
......
......@@ -34,18 +34,18 @@ class ColorPickerDokitView : AbsDokitView() {
private lateinit var coordinate: Coordinate
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
mInfoDokitView = DokitViewManager.instance.getDokitView(ActivityUtils.getTopActivity(), ColorPickerInfoDokitView::class.java.simpleName) as ColorPickerInfoDokitView
if (context != null && bundle != null) {
if (bundle != null) {
mImageCapturer = ImageCapturerImpl(context, bundle!!)
}
}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_color_picker, null)
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
mPickerView = findViewById(R.id.cpv_color_picker_view)
val params = mPickerView.layoutParams
//大小必须是2的倍数
......
......@@ -30,14 +30,14 @@ class ColorPickerInfoDokitView: AbsDokitView() {
private lateinit var mColorHex: TextView
private lateinit var mColor: ImageView
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_color_picker_info, null)
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
mColorHex = findViewById(R.id.tv_info_hex)
mColor = findViewById(R.id.iv_info_color)
findViewById<ImageView>(R.id.iv_info_close).setOnClickListener {
......
......@@ -19,7 +19,7 @@ internal interface DokitView {
*
* @param context
*/
fun onCreate(context: Context?)
fun onCreate(context: Context)
/**
* 传入rootView 用于创建kit控件
......@@ -28,14 +28,14 @@ internal interface DokitView {
* @param rootView
* @return 返回创建的childView
*/
fun onCreateView(context: Context?, rootView: FrameLayout?): View
fun onCreateView(context: Context, rootView: FrameLayout): View
/**
* 将xml中的控件添加到rootView以后调用,在当前方法中可以进行view的一些操作
*
* @param rootView
*/
fun onViewCreated(rootView: FrameLayout?)
fun onViewCreated(rootView: FrameLayout)
/**
* 当前的dokitView添加到根布局里时调用
......
......@@ -16,14 +16,14 @@ import com.didichuxing.doraemonkit.kit.core.DokitViewLayoutParams
* ================================================
*/
class CountDownDokitView : AbsDokitView() {
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
return rootView!!
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return rootView
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
}
override fun initDokitViewLayoutParams(params: DokitViewLayoutParams?) {
......
......@@ -45,7 +45,7 @@ class LayoutLevelDokitView : AbsDokitView() {
}
}
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
resolveActivity(ActivityUtils.getTopActivity())
LifecycleListenerUtil.registerListener(mLifecycleListenerWrapper)
}
......@@ -88,11 +88,11 @@ class LayoutLevelDokitView : AbsDokitView() {
appContentView.addView(mScalpelFrameLayout)
}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_layout_level, rootView, false)
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
findViewById<View>(R.id.iv_layout_close).setOnClickListener {
LayoutManager.instance.close()
}
......
......@@ -27,7 +27,7 @@ import java.util.*
/**
* @author lostjobs created on 2020/6/28
*/
class LogInfoDokitView : AbsDokitView(), LogInfoManager.OnLogCatchListener {
open class LogInfoDokitView : AbsDokitView(), LogInfoManager.OnLogCatchListener {
companion object {
private const val SAVE = 100
......@@ -63,15 +63,15 @@ class LogInfoDokitView : AbsDokitView(), LogInfoManager.OnLogCatchListener {
private var isLoaded: Boolean = false
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
LogInfoManager.registerListener(this)
}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_log_info, null)
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
initView()
}
......@@ -300,11 +300,11 @@ class LogInfoDokitView : AbsDokitView(), LogInfoManager.OnLogCatchListener {
}
}
private fun maximize() {
protected fun maximize() {
changeSize(isMaximize)
}
private fun minimize() {
protected fun minimize() {
changeSize(isMaximize)
}
......
......@@ -15,8 +15,8 @@ import com.didichuxing.doraemonkit.kit.core.DokitViewLayoutParams
* Created by jintai on 2019/09/26.
*/
class MainIconDokitView : AbsDokitView() {
override fun onCreate(context: Context?) {}
override fun onViewCreated(view: FrameLayout?) {
override fun onCreate(context: Context) {}
override fun onViewCreated(view: FrameLayout) {
//设置id便于查找
rootView?.id = R.id.float_icon_id
//设置icon 点击事件
......@@ -26,7 +26,7 @@ class MainIconDokitView : AbsDokitView() {
}
}
override fun onCreateView(context: Context?, view: FrameLayout?): View {
override fun onCreateView(context: Context, view: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_main_launch_icon, view, false)
}
......
......@@ -31,8 +31,8 @@ class PerformanceCloseDokitView : AbsDokitView() {
var mIvClose2: ImageView? = null
var mIvClose3: ImageView? = null
var mPerformanceCloseListener: PerformanceCloseListener? = null
override fun onCreate(context: Context?) {}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreate(context: Context) {}
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_performance_close_wrap, rootView, false)
}
......@@ -51,7 +51,7 @@ class PerformanceCloseDokitView : AbsDokitView() {
closeViewWrap.tag = -1
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
mLlCloseWrap = findViewById(R.id.ll_close_wrap)
mWrap0 = findViewById(R.id.fl_wrap0)
mIvClose0 = findViewById(R.id.iv_close0)
......
......@@ -67,8 +67,8 @@ class PerformanceDokitView : AbsDokitView(), PerformanceCloseListener {
}
}
override fun onCreate(context: Context?) {}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreate(context: Context) {}
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_performance_wrap, rootView, false)
}
......@@ -149,7 +149,7 @@ class PerformanceDokitView : AbsDokitView(), PerformanceCloseListener {
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
mPerformanceWrap = findViewById(R.id.ll_performance_wrap)
mFlWrap0 = findViewById(R.id.fl_chart0)
mFlWrap0!!.visibility = View.GONE
......
......@@ -43,8 +43,8 @@ class PerformanceCloseDokitView : AbsDokitView() {
private var mIvClose2: ImageView? = null
private var mIvClose3: ImageView? = null
private var mPerformanceCloseListener: PerformanceCloseListener? = null
override fun onCreate(context: Context?) {}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreate(context: Context) {}
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_performance_close_wrap, rootView, false)
}
......@@ -69,7 +69,7 @@ class PerformanceCloseDokitView : AbsDokitView() {
closeViewWrap.tag = -1
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
mLlCloseWrap = findViewById(R.id.ll_close_wrap)
mWrap0 = findViewById(R.id.fl_wrap0)
mIvClose0 = findViewById(R.id.iv_close0)
......
......@@ -29,15 +29,15 @@ class ToolPanelDokitView : AbsDokitView() {
private lateinit var mAdapter: ToolPanelAdapter
private var mKits: MutableList<KitWrapItem> = mutableListOf()
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
}
override fun onCreateView(context: Context?, view: FrameLayout?): View {
override fun onCreateView(context: Context, view: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_tool_panel, view, false)
}
override fun onViewCreated(view: FrameLayout?) {
override fun onViewCreated(view: FrameLayout) {
generateKits()
initView()
}
......
......@@ -26,11 +26,11 @@ import com.didichuxing.doraemonkit.model.ViewInfo
*/
class UIPerformanceDisplayDokitView : AbsDokitView(), PerformanceDataListener {
private var mLayoutBorderView: LayoutBorderView? = null
override fun onCreateView(context: Context?, view: FrameLayout?): View {
return LayoutInflater.from(view!!.context).inflate(R.layout.dk_float_ui_performance_display, view, false)
override fun onCreateView(context: Context, view: FrameLayout): View {
return LayoutInflater.from(view.context).inflate(R.layout.dk_float_ui_performance_display, view, false)
}
override fun onViewCreated(view: FrameLayout?) {
override fun onViewCreated(view: FrameLayout) {
mLayoutBorderView = findViewById(R.id.rect_view)
//设置不响应触摸事件
setDokitViewNotResponseTouchEvent(rootView)
......@@ -42,7 +42,7 @@ class UIPerformanceDisplayDokitView : AbsDokitView(), PerformanceDataListener {
params.height = DokitViewLayoutParams.MATCH_PARENT
}
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
instance.addListener(this@UIPerformanceDisplayDokitView)
}
......
......@@ -33,11 +33,11 @@ class UIPerformanceInfoDokitView : AbsDokitView(), PerformanceDataListener {
private var mTotalTimeText: LabelTextView? = null
private var mMaxTimeText: LabelTextView? = null
private var mMaxTimeViewIdText: LabelTextView? = null
override fun onCreateView(context: Context?, view: FrameLayout?): View {
return LayoutInflater.from(view!!.context).inflate(R.layout.dk_float_ui_performance_info, view, false)
override fun onCreateView(context: Context, view: FrameLayout): View {
return LayoutInflater.from(view.context).inflate(R.layout.dk_float_ui_performance_info, view, false)
}
override fun onViewCreated(view: FrameLayout?) {
override fun onViewCreated(view: FrameLayout) {
mClose = findViewById(R.id.close)
mClose!!.setOnClickListener {
DokitViewManager.instance.detach(UIPerformanceDisplayDokitView::class.java.simpleName)
......@@ -57,7 +57,7 @@ class UIPerformanceInfoDokitView : AbsDokitView(), PerformanceDataListener {
params.width = DokitViewLayoutParams.WRAP_CONTENT
}
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
UIPerformanceManager.instance.addListener(this@UIPerformanceInfoDokitView)
}
......
......@@ -28,7 +28,7 @@ class ViewCheckDokitView : AbsDokitView(), LifecycleListenerUtil.LifecycleListen
private lateinit var mTraverHandler: Handler
private val mViewSelectListeners: MutableList<OnViewSelectListener> = ArrayList()
private var mResumedActivity: Activity? = null
override fun onCreate(context: Context?) {
override fun onCreate(context: Context) {
mTraverHandlerThread = HandlerThread(TAG)
mTraverHandlerThread.start()
mTraverHandler = Handler(mTraverHandlerThread.looper)
......@@ -44,7 +44,7 @@ class ViewCheckDokitView : AbsDokitView(), LifecycleListenerUtil.LifecycleListen
LifecycleListenerUtil.unRegisterListener(this)
}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_view_check, null)
}
......@@ -68,7 +68,7 @@ class ViewCheckDokitView : AbsDokitView(), LifecycleListenerUtil.LifecycleListen
preformFindCheckView()
}
override fun onViewCreated(rootView: FrameLayout?) {}
override fun onViewCreated(rootView: FrameLayout) {}
override fun onActivityPaused(activity: Activity?) {}
override fun onFragmentAttached(f: Fragment?) {}
override fun onFragmentDetached(f: Fragment?) {}
......
......@@ -19,14 +19,14 @@ import com.didichuxing.doraemonkit.model.ViewInfo
*/
class ViewCheckDrawDokitView : AbsDokitView(), OnViewSelectListener {
private var mLayoutBorderView: LayoutBorderView? = null
override fun onCreate(context: Context?) {}
override fun onCreate(context: Context) {}
override fun onDestroy() {
super.onDestroy()
val page = DokitViewManager.instance.getDokitView(ActivityUtils.getTopActivity(), ViewCheckDokitView::class.java.simpleName) as ViewCheckDokitView?
page?.removeViewSelectListener(this)
}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_view_check_draw, null)
}
......@@ -39,7 +39,7 @@ class ViewCheckDrawDokitView : AbsDokitView(), OnViewSelectListener {
}
override fun onViewCreated(rootView: FrameLayout?) {
override fun onViewCreated(rootView: FrameLayout) {
mLayoutBorderView = findViewById(R.id.rect_view)
setDokitViewNotResponseTouchEvent(this.rootView)
postDelayed(200, Runnable {
......
......@@ -41,18 +41,18 @@ class ViewCheckInfoDokitView : AbsDokitView(), OnViewSelectListener, View.OnClic
private var mPre: ImageView? = null
private var mNext: ImageView? = null
private var mClose: ImageView? = null
override fun onCreate(context: Context?) {}
override fun onCreate(context: Context) {}
override fun onDestroy() {
super.onDestroy()
val dokitView = DokitViewManager.instance.getDokitView(activity, ViewCheckDokitView::class.java.simpleName) as ViewCheckDokitView?
dokitView?.removeViewSelectListener(this)
}
override fun onCreateView(context: Context?, view: FrameLayout?): View {
override fun onCreateView(context: Context, view: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_view_check_info, null)
}
override fun onViewCreated(view: FrameLayout?) {
override fun onViewCreated(view: FrameLayout) {
mId = findViewById(R.id.id)
mName = findViewById(R.id.name)
mPosition = findViewById(R.id.position)
......
......@@ -24,14 +24,14 @@ class NetWokDokitView : AbsDokitView() {
var mLlSpeedWrap: LinearLayout? = null
var mIvClose: ImageView? = null
override fun onCreate(context: Context?) {}
override fun onCreate(context: Context) {}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View {
override fun onCreateView(context: Context, rootView: FrameLayout): View {
return LayoutInflater.from(context).inflate(R.layout.dk_float_network, rootView, false)
}
override fun onViewCreated(rootView: FrameLayout?) {
rootView?.apply {
override fun onViewCreated(rootView: FrameLayout) {
rootView.apply {
mTvNetWork = findViewById(R.id.tv_net_type)
mTvTimeOutTime = findViewById(R.id.tv_time)
mTvRequestSpeed = findViewById(R.id.tv_request_speed)
......
......@@ -57,7 +57,7 @@ class HomeTitleBar @JvmOverloads constructor(context: Context, attrs: AttributeS
}
}
private fun setIcon(@DrawableRes id: Int) {
fun setIcon(@DrawableRes id: Int) {
if (id == 0) {
return
}
......
rootProject.name = 'Dokit-Kotlin'
include ':app'
include ':doraemonkit'
include ':doraemonkit-no-op'
//include ':doraemonkit-plugin'
include ':doraemonkit-weex'
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册