Skip to content

Commit

Permalink
type:修改Demo样式
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOnlyone committed Jun 1, 2022
1 parent edea679 commit bd34885
Show file tree
Hide file tree
Showing 45 changed files with 1,753 additions and 366 deletions.
8 changes: 2 additions & 6 deletions Android/app/src/debug/java/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:allowBackup">
<activity android:name=".MainDebugActivityOkhttpV3">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<activity android:name=".old.MainDebugActivityOkhttpV3">

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<!-- <activity-->
Expand Down Expand Up @@ -58,4 +54,4 @@

</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.didichuxing.doraemondemo.dokit.DemoKit
import com.didichuxing.doraemondemo.dokit.TestSimpleDokitFloatViewKit
import com.didichuxing.doraemondemo.dokit.TestSimpleDokitFragmentKit
import com.didichuxing.doraemondemo.mc.SlideBar
import com.didichuxing.doraemondemo.module.http.CustomInterceptor
import com.didichuxing.doraemonkit.DoKit
import com.didichuxing.doraemonkit.DoKitCallBack
import com.didichuxing.doraemonkit.kit.AbstractKit
Expand Down
35 changes: 26 additions & 9 deletions Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,51 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">

<activity
android:name=".MainDoKitActivity"
android:theme="@style/NoTitleTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".mc.NetMainActivity"
android:exported="false" />
<activity android:name=".WebViewNormalActivity" />
<activity android:name=".WebViewSystemActivity" />
<activity android:name=".WebViewX5Activity" />
<activity android:name=".SecondActivity" />
<activity android:name=".LeakActivity" />
<activity android:name=".MapActivity" />
<activity android:name=".EmptyActivity" />
<activity android:name=".module.bigbitmap.BigBitmapActivity" />
<activity android:name=".module.leak.LeakActivity" />
<activity android:name=".mc.MCActivity" />
<activity android:name="com.amap.api.navi.AmapRouteActivity" />
<activity
android:name=".comm.CommFragmentActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> <!-- 高德定位服务 -->
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<!-- 高德定位服务 -->


<service android:name="com.amap.api.location.APSService" />

<meta-data
android:name="com.amap.api.v2.apikey"
android:value="11f9728ee0c2a141663fc4b784c42a33" /> <!-- 腾讯定位服务 -->
android:value="11f9728ee0c2a141663fc4b784c42a33" />
<!-- 腾讯定位服务 -->
<meta-data
android:name="TencentMapSDK"
android:value="ECSBZ-ZDNCF-4K3J4-JNWQ2-TWW37-XOFNQ" /> <!-- 百度地图key -->
android:value="ECSBZ-ZDNCF-4K3J4-JNWQ2-TWW37-XOFNQ" />
<!-- 百度地图key -->
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="UhPZI3aQQ7un6RP8evAkXxFCtlvItawi" /> <!-- 百度地图定位服务 -->
android:value="UhPZI3aQQ7un6RP8evAkXxFCtlvItawi" />
<!-- 百度地图定位服务 -->
<service
android:name="com.baidu.location.f"
android:enabled="true"
android:process=":remote" /> <!-- Dokit targetApi为 29 Android Q时截屏的前台服务 -->
android:process=":remote" />
<!-- Dokit targetApi为 29 Android Q时截屏的前台服务 -->
<service
android:name="com.didichuxing.doraemonkit.kit.colorpick.ScreenRecorderService"
android:enabled="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.didichuxing.doraemondemo;

import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
* didi Create on 2022/5/25 .
* <p>
* Copyright (c) 2022/5/25 by didiglobal.com.
*
* @author <a href="[email protected]">zhangjun</a>
* @version 1.0
* @Date 2022/5/25 5:55 下午
* @Description 用一句话说明文件功能
*/

public class BaseStatusBarActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
preUpdateStatusBar(this);
}


private void preUpdateStatusBar(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimary));
}
}

private void setLightStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}

private void setNotLightStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.blankj.utilcode.util.ToastUtils
import com.didichuxing.doraemondemo.db.room.PersonDBHelper
import com.didichuxing.doraemondemo.db.PersonDBHelper
import kotlinx.coroutines.*

class SecondActivity : AppCompatActivity() {
class DataBaseActivity : AppCompatActivity() {
companion object {
val TAG = "SecondActivity"
}
Expand Down Expand Up @@ -46,4 +46,4 @@ class SecondActivity : AppCompatActivity() {
return true
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.didichuxing.doraemondemo

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.blankj.utilcode.util.ToastUtils
import com.didichuxing.doraemondemo.db.PersonDBHelper
import kotlinx.coroutines.*

class EmptyActivity : AppCompatActivity() {
companion object {
val TAG = "EmptyActivity"
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_empty)

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
package com.didichuxing.doraemondemo

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.ViewGroup
import androidx.core.view.children
import com.didichuxing.doraemondemo.mc.MCActivity
import com.didichuxing.doraemondemo.module.CrashTest
import com.didichuxing.doraemondemo.module.DoKitItemView
import com.didichuxing.doraemondemo.module.MethodCostTest
import com.didichuxing.doraemondemo.module.bigbitmap.BigBitmapActivity
import com.didichuxing.doraemondemo.module.db.DataBaseTest
import com.didichuxing.doraemondemo.module.http.FileUploadTest
import com.didichuxing.doraemondemo.module.http.OkHttpMock
import com.didichuxing.doraemondemo.module.http.RetrofitMock
import com.didichuxing.doraemondemo.module.http.URLConnectionMock
import com.didichuxing.doraemondemo.module.leak.LeakActivity
import com.didichuxing.doraemondemo.old.MainDebugActivityOkhttpV3
import com.didichuxing.doraemonkit.DoKit
import com.didichuxing.doraemonkit.util.ToastUtils


/**
* didi Create on 2022/5/25 .
*
* Copyright (c) 2022/5/25 by didiglobal.com.
*
* @author <a href="[email protected]">zhangjun</a>
* @version 1.0
* @Date 2022/5/25 6:05 下午
* @Description 用一句话说明文件功能
*/

class MainDoKitActivity : BaseStatusBarActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_dokit_main)
val all: ViewGroup = findViewById<ViewGroup>(R.id.all)

all.children.forEach {
if (it is DoKitItemView) {
val item = it as DoKitItemView
item.setOnClickListener {
onItemClick(item, item.itemText)
}
}
}
}


private fun onItemClick(itemView: DoKitItemView, text: String) {
Log.i("TEST", "onItemClick :$text")
when (text) {
//工具入口
"显示/隐藏快捷入口" -> {
showHideDoKit();
}
"打开工具窗口" -> {
DoKit.showToolPanel()
}
//平台工具
"数据Mock测试" -> {
startActivity(Intent(this, EmptyActivity::class.java))
}
"OkHttp 模拟请求" -> {
OkHttpMock.test()
}
"UrlConnection 模拟请求" -> {
URLConnectionMock.get("https://wanandroid.com/user_article/list/0/json")
}
"retrofit 模拟请求" -> {
RetrofitMock.test()
}
"一机多控测试" -> {
startActivity(Intent(this, MCActivity::class.java))
}
"自动化测试" -> {
startActivity(Intent(this, MCActivity::class.java))
}

//常用工具
"日志测试" -> {
startActivity(Intent(this, EmptyActivity::class.java))
}
"跳转其他Activity" -> {
startActivity(Intent(this, EmptyActivity::class.java))
}

"系统:WebView" -> {
startActivity(Intent(this, WebViewSystemActivity::class.java))
}
"X5:WebView" -> {
startActivity(Intent(this, WebViewX5Activity::class.java))
}

//LBS
"位置模拟" -> {
startActivity(Intent(this, EmptyActivity::class.java))
}
"路径模拟" -> {
startActivity(Intent(this, EmptyActivity::class.java))
}

//性能工具
"模拟内存泄漏" -> {
startActivity(Intent(this, LeakActivity::class.java))
}

"模拟耗时函数调用" -> {
MethodCostTest.test()
}

"崩溃模拟" -> {
CrashTest.test()
}

"创建数据库" -> {
DataBaseTest.test()
}
"文件上传模拟" -> {
FileUploadTest.requestByFile(getActivity(), filesDir, true)
}
"文件下载模拟" -> {
FileUploadTest.requestByFile(getActivity(), filesDir, false)
}
"大图检测模拟" -> {
startActivity(Intent(this, BigBitmapActivity::class.java))
}
//视觉工具
"取色器测试" -> {
startActivity(Intent(this, EmptyActivity::class.java))
}
"标尺对齐测试" -> {
startActivity(Intent(this, EmptyActivity::class.java))
}

//其他工具
"旧版页面入口" -> {
startActivity(Intent(this, MainDebugActivityOkhttpV3::class.java))
}
else -> {
ToastUtils.showShort("$text")
}

}
}


private fun getActivity(): Activity {
return this
}

private fun showHideDoKit() {
if (DoKit.isMainIconShow) {
DoKit.hide()
} else {
DoKit.show()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import androidx.appcompat.app.AppCompatActivity
/**
* Created by jintai on 2018/11/13.
*/
class WebViewNormalActivity : AppCompatActivity() {
class WebViewSystemActivity : AppCompatActivity() {

val TAG = "WebViewActivity"
lateinit var mWebView: WebView
val url = "https://jtsky.gitee.io/dokit-mock/index.html"
val url = "https://xingyun.xiaojukeji.com/docs/dokit"

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -40,7 +41,7 @@ class WebViewNormalActivity : AppCompatActivity() {
webSettings.domStorageEnabled = true
webSettings.cacheMode = WebSettings.LOAD_DEFAULT
webSettings.javaScriptCanOpenWindowsAutomatically = false
// webSettings.allowFileAccessFromFileURLs = true
webSettings.allowFileAccessFromFileURLs = true
webSettings.allowUniversalAccessFromFileURLs = true

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
Expand Down Expand Up @@ -82,12 +83,12 @@ class WebViewNormalActivity : AppCompatActivity() {
val sourceID = consoleMessage.sourceId()
val messageLevel = consoleMessage.message()

// Log.i(
// TAG, String.format(
// "[%s] sourceID: %s lineNumber: %n message: %s",
// messageLevel, sourceID, lineNumber, message
// )
// )
Log.i(
TAG, String.format(
"[%s] sourceID: %s lineNumber: %n message: %s",
messageLevel, sourceID, lineNumber, message
)
)

//Log.i(TAG, "consoleMessage===>${consoleMessage?.message()}")
return super.onConsoleMessage(consoleMessage)
Expand All @@ -104,4 +105,4 @@ class WebViewNormalActivity : AppCompatActivity() {
}
}

}
}
Loading

0 comments on commit bd34885

Please sign in to comment.