feat(main): 迁移到 MVVM 并升级构建配置
- MainActivity/TestActivity 改用 DataBinding 和 ViewModel - 移除 ButterKnife 和旧的 MVP Contact 类 - 升级 Gradle、Kotlin 及构建脚本 - 配置 CMake 以支持 16KB 页面大小
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
project("native-lib")
|
||||
|
||||
# Creates and names a library, sets it as either STATIC
|
||||
# or SHARED, and provides the relative paths to its source code.
|
||||
# You can define multiple libraries, and CMake builds them for you.
|
||||
@@ -41,4 +43,6 @@ target_link_libraries( # Specifies the target library.
|
||||
|
||||
# Links the target library to the log library
|
||||
# included in the NDK.
|
||||
${log-lib} )
|
||||
${log-lib} )
|
||||
|
||||
set_target_properties(native-lib PROPERTIES LINK_FLAGS "-Wl,-z,max-page-size=16384")
|
||||
196
app/build.gradle
196
app/build.gradle
@@ -1,10 +1,12 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: "com.tencent.android.tpns"
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
// id 'kotlin-kapt'
|
||||
id 'com.tencent.android.tpns'
|
||||
}
|
||||
|
||||
def appName() {
|
||||
return "TT"
|
||||
return "TTSTDUtils"
|
||||
}
|
||||
|
||||
def releaseTime() {
|
||||
@@ -12,20 +14,25 @@ def releaseTime() {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.1"
|
||||
namespace "com.ttstd.ttutils"
|
||||
|
||||
compileSdkVersion 36
|
||||
buildToolsVersion "36.0.0"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.ttstd.ttutils"
|
||||
//https://github.com/flutter/flutter/issues/58758
|
||||
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 30
|
||||
targetSdkVersion 36
|
||||
|
||||
// versionCode 1
|
||||
// versionName "1.0"
|
||||
multiDexEnabled true
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
multiDexEnabled true
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/DEPENDENCIES'
|
||||
exclude 'META-INF/LICENSE'
|
||||
@@ -38,20 +45,41 @@ android {
|
||||
//添加
|
||||
exclude 'META-INF/rxjava.properties'
|
||||
}
|
||||
|
||||
ndk {
|
||||
//选择要添加的对应 cpu 类型的 .so 库。
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
// 还可以添加 'armeabi' , 'x86', 'x86_64', 'mips', 'mips64'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
// Or, if you prefer, you can continue to check for errors in release builds,
|
||||
// but continue the build even when errors are found:
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
manifestPlaceholders = [
|
||||
XG_ACCESS_ID : "1500026407",
|
||||
XG_ACCESS_KEY: "AQ6C6W1O19LT",
|
||||
]
|
||||
|
||||
dataBinding {
|
||||
enabled true
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
// 添加 Kotlin 编译选项
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
dataBinding true
|
||||
buildConfig true
|
||||
aidl true
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
@@ -60,18 +88,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
jumboMode true
|
||||
}
|
||||
|
||||
//多版本
|
||||
productFlavors {
|
||||
@@ -312,9 +328,31 @@ android {
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
BCM310 {
|
||||
storeFile file("keystore/BCM310.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "bcm310"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
BCM310Debug.initWith(debug)
|
||||
BCM310Debug {
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.BCM310
|
||||
buildConfigField "String", "platform", '"HL500"'
|
||||
}
|
||||
|
||||
BCM310Release.initWith(release)
|
||||
BCM310Release {
|
||||
signingConfig signingConfigs.BCM310
|
||||
buildConfigField "String", "platform", '"HL500"'
|
||||
}
|
||||
|
||||
MT6789Debug.initWith(debug)
|
||||
MT6789Debug {
|
||||
buildConfigField "String", "platform", '"G12NL"'
|
||||
@@ -568,49 +606,28 @@ android {
|
||||
|
||||
debug {
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
// 不显示Log
|
||||
//buildConfigField "boolean", "LOG_DEBUG", "false"
|
||||
//
|
||||
versionNameSuffix "-debug"
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
//Zipalign优化
|
||||
zipAlignEnabled true
|
||||
versionNameSuffix "_debug"
|
||||
signingConfig signingConfigs.xueshibao
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null) {
|
||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType.name}.apk"
|
||||
output.outputFileName = fileName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
//混淆
|
||||
minifyEnabled false
|
||||
//前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
//Zipalign优化
|
||||
zipAlignEnabled true
|
||||
//签名
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.xueshibao
|
||||
//将release版本的包名重命名,加上版本及日期
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = ""
|
||||
if (outputFile != null) {
|
||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${productFlavors[0].name}_${buildType.name}.apk"
|
||||
output.outputFileName = fileName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.all { output -> // 改为 all
|
||||
def buildType = variant.buildType.name
|
||||
if (buildType.contains("debug")) {
|
||||
outputFileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk"
|
||||
} else {
|
||||
outputFileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -624,6 +641,8 @@ dependencies {
|
||||
implementation project(':viewlibrary')
|
||||
implementation project(path: ':niceimageview')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
// activity_main.xml 直接使用了 com.suke.widget.SwitchButton,需在本模块声明依赖
|
||||
implementation 'com.github.zcweng:switch-button:0.0.3@aar'
|
||||
implementation 'androidx.core:core-ktx:1.6.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
@@ -650,6 +669,9 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
//内存泄漏检测
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'
|
||||
|
||||
////三方
|
||||
//RxJava
|
||||
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
|
||||
@@ -666,14 +688,13 @@ dependencies {
|
||||
implementation 'com.trello.rxlifecycle4:rxlifecycle-android-lifecycle:4.0.2'
|
||||
|
||||
//okhttp
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
||||
implementation 'com.squareup.moshi:moshi:1.9.3'
|
||||
implementation 'com.squareup.okhttp3:okhttp:5.4.0'
|
||||
//4.9.3最后一个4.x版本
|
||||
//Retrofit
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
|
||||
// implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
|
||||
implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
|
||||
implementation "com.squareup.retrofit2:adapter-rxjava3:3.0.0"
|
||||
//磁盘缓存
|
||||
implementation 'com.jakewharton:disklrucache:2.0.2'
|
||||
//Google
|
||||
@@ -684,34 +705,27 @@ dependencies {
|
||||
//Jackson
|
||||
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
|
||||
implementation 'org.codehaus.jackson:jackson-core-asl:1.9.13'
|
||||
//view绑定
|
||||
implementation 'com.jakewharton:butterknife:10.2.3'
|
||||
// If you are using Kotlin, replace annotationProcessor with kapt.
|
||||
// annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
|
||||
|
||||
//MMKV
|
||||
implementation 'com.tencent:mmkv-static:1.2.13'
|
||||
implementation 'com.tencent:mmkv-static:2.4.0'
|
||||
//Bugly
|
||||
implementation 'com.tencent.bugly:crashreport:4.0.0'
|
||||
implementation 'com.tencent.bugly:crashreport:4.1.9.3'
|
||||
//腾讯移动推送 TPNS
|
||||
implementation 'com.tencent.tpns:tpns:1.2.2.0-release'
|
||||
implementation "com.tencent.tpns:tpns:1.4.4.11-release"
|
||||
|
||||
//内存泄漏检测
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
|
||||
////图片加载框架
|
||||
//Glide
|
||||
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
||||
//Fresco
|
||||
implementation 'com.facebook.fresco:fresco:2.2.0'
|
||||
implementation 'com.facebook.fresco:fresco:3.7.0'
|
||||
//Picasso
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
|
||||
|
||||
//个人
|
||||
//utilcode工具类
|
||||
implementation 'com.blankj:utilcodex:1.30.6'
|
||||
implementation 'com.blankj:utilcodex:1.31.1'
|
||||
//更换字体框架
|
||||
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
|
||||
//屏幕适配方案
|
||||
@@ -722,17 +736,17 @@ dependencies {
|
||||
//滑动返回
|
||||
implementation 'com.github.bingoogolapple:BGASwipeBackLayout-Android:2.0.2'
|
||||
//圆角
|
||||
implementation 'de.hdodenhof:circleimageview:2.2.0'
|
||||
implementation 'de.hdodenhof:circleimageview:3.1.0'
|
||||
// 圆角ImageView
|
||||
// implementation 'com.github.zane618:NiceImageView:1.0.0'
|
||||
// 权限请求框架:https://github.com/getActivity/XXPermissions
|
||||
implementation 'com.github.getActivity:XXPermissions:12.3'
|
||||
implementation 'com.github.getActivity:XXPermissions:28.3'
|
||||
// 吐司框架:https://github.com/getActivity/Toaster
|
||||
implementation 'com.github.getActivity:Toaster:12.6'
|
||||
//动态权限框架
|
||||
implementation 'com.yanzhenjie:permission:2.0.3'
|
||||
//沉浸状态栏
|
||||
implementation 'com.gitee.zackratos:UltimateBarX:0.8.0'
|
||||
implementation 'com.gitee.zackratos:UltimateBarX:0.8.1'
|
||||
|
||||
// implementation 'com.gyf.barlibrary:barlibrary:2.2.8'
|
||||
// 基础依赖包,必须要依赖
|
||||
@@ -746,24 +760,12 @@ dependencies {
|
||||
|
||||
}
|
||||
|
||||
preBuild {
|
||||
doLast {
|
||||
def imlFile = file(project.name + ".iml")
|
||||
println 'Change ' + project.name + '.iml order'
|
||||
try {
|
||||
def parsedXml = (new XmlParser()).parse(imlFile)
|
||||
def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
|
||||
parsedXml.component[1].remove(jdkNode)
|
||||
def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
|
||||
println 'what' + sdkString
|
||||
new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
|
||||
groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
|
||||
} catch (FileNotFoundException e) {
|
||||
// nop, iml not found
|
||||
println "no iml found"
|
||||
}
|
||||
// 在 dependencies 之后添加
|
||||
project.afterEvaluate {
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.javaCompileProvider.get().options.bootstrapClasspath = files(
|
||||
file('libs/framework.jar'),
|
||||
android.getBootClasspath()
|
||||
)
|
||||
}
|
||||
//https://www.pianshen.com/article/93481144911/
|
||||
//https://blog.csdn.net/dhl_1986/article/details/102856026
|
||||
//使用系统编译后的framework.jar
|
||||
}
|
||||
|
||||
BIN
app/keystore/BCM310.keystore
Normal file
BIN
app/keystore/BCM310.keystore
Normal file
Binary file not shown.
@@ -24,6 +24,7 @@
|
||||
<permission
|
||||
android:name="com.ttstd.ttutils.permission.XGPUSH_RECEIVE"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<uses-permission android:name="com.ttstd.ttutils.permission.XGPUSH_RECEIVE" />
|
||||
<!-- 【必须】 移动推送 TPNS SDK所需权限 -->
|
||||
@@ -38,7 +39,7 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<!-- Optional for location -->
|
||||
<!-- <uses-permission android:name="android.permission.VIBRATE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.VIBRATE" />-->
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
@@ -52,49 +53,60 @@
|
||||
<uses-permission android:name="com.jiaoguanyi.appstore.permissions.INSTALL_APK" />
|
||||
|
||||
<application
|
||||
android:name="com.ttstd.ttutils.base.KotlinApplication"
|
||||
android:name=".base.KotlinApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/ImmerseTheme">
|
||||
<activity android:name="com.ttstd.ttutils.activity.aoleyuntest.AoleyunTestActivity">
|
||||
<activity
|
||||
android:name=".activity.aoleyuntest.AoleyunTestActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.ttstd.ttutils.activity.main.MainActivity"
|
||||
<activity
|
||||
android:name=".activity.main.MainActivity"
|
||||
android:exported="true">
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||
<!-- </intent-filter>-->
|
||||
</activity>
|
||||
<activity android:name="com.ttstd.ttutils.activity.KotlinMainActivity">
|
||||
<activity
|
||||
android:name=".activity.KotlinMainActivity"
|
||||
android:exported="true">
|
||||
<!-- <intent-filter> -->
|
||||
<!-- <action android:name="android.intent.action.MAIN" /> -->
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
|
||||
<!-- </intent-filter> -->
|
||||
</activity>
|
||||
<activity android:name="com.ttstd.ttutils.activity.test.TestActivity">
|
||||
<activity
|
||||
android:name=".activity.test.TestActivity"
|
||||
android:exported="true">
|
||||
|
||||
<!-- <intent-filter> -->
|
||||
<!-- <action android:name="android.intent.action.MAIN" /> -->
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
|
||||
<!-- </intent-filter> -->
|
||||
</activity>
|
||||
<activity android:name="com.ttstd.ttutils.activity.retrofit.RetrofitActivity" />
|
||||
<activity android:name="com.ttstd.ttutils.activity.PackageActivity" />
|
||||
<activity
|
||||
android:name=".activity.retrofit.RetrofitActivity"
|
||||
android:exported="true" />
|
||||
<activity
|
||||
android:name=".activity.PackageActivity"
|
||||
android:exported="true" />
|
||||
|
||||
<service
|
||||
android:name="com.ttstd.ttutils.server.main.MainService"
|
||||
android:name=".server.main.MainService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<receiver
|
||||
android:name="com.ttstd.ttutils.receiver.PackageReceiver"
|
||||
android:name=".receiver.PackageReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
@@ -106,7 +118,7 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="com.ttstd.ttutils.receiver.BootReceiver"
|
||||
android:name=".receiver.BootReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
@@ -155,7 +167,8 @@
|
||||
|
||||
<!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
|
||||
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
|
||||
<receiver android:name="com.ttstd.ttutils.tpush.MessageReceiver">
|
||||
<receiver android:name=".tpush.MessageReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
|
||||
<!-- 接收消息透传 -->
|
||||
|
||||
@@ -9,17 +9,17 @@ import android.os.Environment
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.notepad.uiui.INoteAidlInterface
|
||||
import com.ttstd.ttutils.R
|
||||
import com.ttstd.ttutils.utils.java.DevicesUtils
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import me.jessyan.autosize.internal.CancelAdapt
|
||||
import java.io.File
|
||||
|
||||
|
||||
class KotlinMainActivity : AppCompatActivity(), CancelAdapt {
|
||||
lateinit var button: Button
|
||||
lateinit var textView: TextView
|
||||
private val INSTALLAPK_ACTION = "JGY_INSTALLAPK_ACTION"
|
||||
private val INSTALLAPK_PREMISSIONS = "com.jiaoguanyi.appstore.permissions.INSTALL_APK"
|
||||
lateinit var filePath: String
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.ttstd.ttutils.activity.main;
|
||||
|
||||
import com.ttstd.ttutils.mvp.BasePresenter;
|
||||
import com.ttstd.ttutils.mvp.BaseView;
|
||||
|
||||
public class MainAContact {
|
||||
public interface MainView extends BaseView {
|
||||
void testRetrofit();
|
||||
}
|
||||
|
||||
public interface Presenter extends BasePresenter<MainView> {
|
||||
void testRetrofitFinish();
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.ttstd.ttutils.activity.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
|
||||
/**
|
||||
* MainActivity 的 Presenter
|
||||
*
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainAPresenter implements MainAContact.Presenter {
|
||||
private static final String TAG = "MainAPresenter";
|
||||
private MainAContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
private final String DEFAULT_INFO = "暂无信息";
|
||||
private final int OK = 200;
|
||||
|
||||
public MainAPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
Log.e(TAG, "MainSPresenter: " + context.getClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Lifecycle start
|
||||
*/
|
||||
|
||||
/*1*/
|
||||
private LifecycleProvider<ActivityEvent> provider;
|
||||
|
||||
public void setProvider(LifecycleProvider<ActivityEvent> provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public LifecycleProvider<ActivityEvent> getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
/*2*/
|
||||
private BehaviorSubject<ActivityEvent> lifecycle;
|
||||
|
||||
public void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
public BehaviorSubject<ActivityEvent> getLifecycle() {
|
||||
return lifecycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lifecycle end
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void attachView(@androidx.annotation.NonNull MainAContact.MainView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testRetrofitFinish() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import android.widget.Toast;
|
||||
import com.jiaoguanyi.appstore.IGetLicenseInterface;
|
||||
import com.notepad.uiui.INoteAidlInterface;
|
||||
import com.ttstd.ttutils.base.mvvm.BaseMvvmActivity;
|
||||
import com.ttstd.ttutils.databinding.ActivityMainBinding;
|
||||
import com.ttstd.ttutils.server.main.MainService;
|
||||
import com.ttstd.ttutils.R;
|
||||
import com.ttstd.ttutils.utils.java.CmdUtil;
|
||||
@@ -36,77 +37,8 @@ import com.uiui.sn.IGetInfoInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class MainActivity extends BaseMvvmActivity {
|
||||
@BindView(R.id.tv_qch_Developeroptions)
|
||||
TextView tv_qch_Developeroptions;
|
||||
@BindView(R.id.tv_development_settings_enabled)
|
||||
TextView tv_development_settings_enabled;
|
||||
@BindView(R.id.tv_adb_enabled)
|
||||
TextView tv_adb_enabled;
|
||||
@BindView(R.id.textView)
|
||||
TextView textView;
|
||||
@BindView(R.id.button)
|
||||
Button button;
|
||||
@BindView(R.id.none)
|
||||
Button none;
|
||||
@BindView(R.id.adb)
|
||||
Button adb;
|
||||
@BindView(R.id.rndis)
|
||||
Button rndis;
|
||||
@BindView(R.id.mtp)
|
||||
Button mtp;
|
||||
@BindView(R.id.ptp)
|
||||
Button ptp;
|
||||
@BindView(R.id.audio_source)
|
||||
Button audio_source;
|
||||
@BindView(R.id.midi)
|
||||
Button midi;
|
||||
@BindView(R.id.accessory)
|
||||
Button accessory;
|
||||
|
||||
@BindView(R.id.icon_off)
|
||||
Button icon_off;
|
||||
@BindView(R.id.icon_on)
|
||||
Button icon_on;
|
||||
@BindView(R.id.icon_look)
|
||||
Button icon_look;
|
||||
|
||||
@BindView(R.id.bt_bar_show)
|
||||
Button bt_bar_show;
|
||||
@BindView(R.id.bt_bar_hide)
|
||||
Button bt_bar_hide;
|
||||
|
||||
@BindView(R.id.bt_statusbar_show)
|
||||
Button bt_statusbar_show;
|
||||
@BindView(R.id.bt_statusbar_hide)
|
||||
Button bt_statusbar_hide;
|
||||
|
||||
|
||||
@BindView(R.id.bt_bc_boot)
|
||||
Button bt_bc_boot;
|
||||
@BindView(R.id.bt_start_jgy)
|
||||
Button bt_start_jgy;
|
||||
|
||||
@BindView(R.id.tv_statu)
|
||||
TextView tv_statu;
|
||||
@BindView(R.id.bt_camera_close)
|
||||
Button bt_camera_close;
|
||||
@BindView(R.id.bt_camera_open)
|
||||
Button bt_camera_open;
|
||||
@BindView(R.id.bt_camera_refresh)
|
||||
Button bt_camera_refresh;
|
||||
|
||||
@BindView(R.id.tv_net_statu)
|
||||
TextView tv_net_statu;
|
||||
@BindView(R.id.bt_net_close)
|
||||
Button bt_net_close;
|
||||
@BindView(R.id.bt_net_open)
|
||||
Button bt_net_open;
|
||||
@BindView(R.id.bt_net_refresh)
|
||||
Button bt_net_refresh;
|
||||
public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBinding> {
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
private ServiceConnection mServiceConnection;
|
||||
private INoteAidlInterface noteAidlInterface;
|
||||
@@ -114,7 +46,6 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
private IGetLicenseInterface getLicenseInterface;
|
||||
private ServiceConnection mIGetInfoConnection;
|
||||
private IGetInfoInterface getInfoInterface;
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
private UsbManager mUsbManager;
|
||||
|
||||
@@ -133,8 +64,6 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
|
||||
View decorView = getWindow().getDecorView();
|
||||
// Hide both the navigation bar and the status bar.
|
||||
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
|
||||
@@ -150,18 +79,18 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
||||
|
||||
// mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_NONE, true);
|
||||
none.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_NONE, true));
|
||||
mViewDataBinding.none.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_NONE, true));
|
||||
//报错
|
||||
adb.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_ADB, true));
|
||||
rndis.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_RNDIS, true));
|
||||
mtp.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_MTP, true));
|
||||
ptp.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_PTP, true));
|
||||
mViewDataBinding.adb.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_ADB, true));
|
||||
mViewDataBinding.rndis.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_RNDIS, true));
|
||||
mViewDataBinding.mtp.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_MTP, true));
|
||||
mViewDataBinding.ptp.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_PTP, true));
|
||||
//报错
|
||||
audio_source.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_AUDIO_SOURCE, true));
|
||||
midi.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_MIDI, true));
|
||||
mViewDataBinding.audioSource.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_AUDIO_SOURCE, true));
|
||||
mViewDataBinding.midi.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_MIDI, true));
|
||||
//报错
|
||||
accessory.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_ACCESSORY, true));
|
||||
icon_off.setOnClickListener(view -> {
|
||||
mViewDataBinding.accessory.setOnClickListener(view -> mUsbManager.setCurrentFunction(UsbManager.USB_FUNCTION_ACCESSORY, true));
|
||||
mViewDataBinding.iconOff.setOnClickListener(view -> {
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_deskclock", 1);
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_soundrecorder", 1);
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_music", 1);
|
||||
@@ -170,7 +99,7 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_browser", 1);
|
||||
});
|
||||
|
||||
icon_on.setOnClickListener(view -> {
|
||||
mViewDataBinding.iconOn.setOnClickListener(view -> {
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_deskclock", 0);
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_soundrecorder", 0);
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_music", 0);
|
||||
@@ -178,7 +107,7 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_filemanager", 0);
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_browser", 0);
|
||||
});
|
||||
icon_look.setOnClickListener(view -> {
|
||||
mViewDataBinding.iconLook.setOnClickListener(view -> {
|
||||
int qch_app_deskclock = Settings.System.getInt(getContentResolver(), "qch_app_deskclock", 0);
|
||||
Log.e(TAG, "debugTest: qch_app_deskclock = " + qch_app_deskclock);
|
||||
int qch_app_soundrecorder = Settings.System.getInt(getContentResolver(), "qch_app_soundrecorder", 0);
|
||||
@@ -192,30 +121,30 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
int qch_app_browser = Settings.System.getInt(getContentResolver(), "qch_app_browser", 0);
|
||||
Log.e(TAG, "debugTest: qch_app_browser = " + qch_app_browser);
|
||||
});
|
||||
bt_bar_show.setOnClickListener(v -> {
|
||||
mViewDataBinding.btBarShow.setOnClickListener(v -> {
|
||||
String navigationStatus = "aole_show_NavigationBar";
|
||||
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
||||
sendBroadcast(navIntent);
|
||||
});
|
||||
bt_bar_hide.setOnClickListener(v -> {
|
||||
mViewDataBinding.btBarHide.setOnClickListener(v -> {
|
||||
String navigationStatus = "aole_hide_NavigationBar";
|
||||
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
||||
sendBroadcast(navIntent);
|
||||
});
|
||||
bt_statusbar_show.setOnClickListener(view -> {
|
||||
mViewDataBinding.btStatusbarShow.setOnClickListener(view -> {
|
||||
String statusbarStatus = "aole_show_statusBar";
|
||||
Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
sendBroadcast(statusIntent);
|
||||
});
|
||||
bt_statusbar_hide.setOnClickListener(view -> {
|
||||
mViewDataBinding.btStatusbarHide.setOnClickListener(view -> {
|
||||
String statusbarStatus = "aole_hide_statusBar";
|
||||
Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
sendBroadcast(statusIntent);
|
||||
});
|
||||
|
||||
bt_bc_boot.setOnClickListener(view -> CmdUtil.execute("am broadcast -a android.intent.action.BOOT_COMPLETED"));
|
||||
mViewDataBinding.btBcBoot.setOnClickListener(view -> CmdUtil.execute("am broadcast -a android.intent.action.BOOT_COMPLETED"));
|
||||
|
||||
bt_start_jgy.setOnClickListener(view -> {
|
||||
mViewDataBinding.btStartJgy.setOnClickListener(view -> {
|
||||
JgyUtils.getInstance().wakeUpAppstore();
|
||||
JgyUtils.getInstance().wakeUpDeviceInfo();
|
||||
JgyUtils.getInstance().wakeUpNotify();
|
||||
@@ -294,8 +223,8 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
// intent.setComponent(new ComponentName("com.notepad.uiui", "com.notepad.uiui.service.NoteService"));
|
||||
// startService(intent);
|
||||
|
||||
textView.setText(ndks);
|
||||
textView.setOnClickListener(new View.OnClickListener() {
|
||||
mViewDataBinding.textView.setText(ndks);
|
||||
mViewDataBinding.textView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// open();
|
||||
@@ -318,7 +247,7 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
|
||||
}
|
||||
});
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
mViewDataBinding.button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// ApkUtils.openApp(JMainActivity.this, "com.info.sn");
|
||||
@@ -360,14 +289,14 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
}
|
||||
});
|
||||
|
||||
bt_camera_refresh.setOnClickListener(new View.OnClickListener() {
|
||||
mViewDataBinding.btCameraRefresh.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int code = Settings.System.getInt(getContentResolver(), "qch_app_camera", 0);
|
||||
tv_statu.setText("状态:" + code);
|
||||
mViewDataBinding.tvStatu.setText("状态:" + code);
|
||||
}
|
||||
});
|
||||
bt_camera_close.setOnClickListener(new View.OnClickListener() {
|
||||
mViewDataBinding.btCameraClose.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_camera", 1);
|
||||
@@ -375,7 +304,7 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
sendBroadcast(cameraIntent);
|
||||
}
|
||||
});
|
||||
bt_camera_open.setOnClickListener(new View.OnClickListener() {
|
||||
mViewDataBinding.btCameraOpen.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Settings.System.putInt(getContentResolver(), "qch_app_camera", 0);
|
||||
@@ -384,7 +313,7 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
}
|
||||
});
|
||||
|
||||
bt_net_close.setOnClickListener(new View.OnClickListener() {
|
||||
mViewDataBinding.btNetClose.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Settings.System.putString(getContentResolver(), "app_web_white_list",
|
||||
@@ -394,7 +323,7 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
|
||||
}
|
||||
});
|
||||
bt_net_open.setOnClickListener(new View.OnClickListener() {
|
||||
mViewDataBinding.btNetOpen.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Settings.System.putString(getContentResolver(), "app_web_white_list", "null");
|
||||
@@ -407,11 +336,11 @@ public class MainActivity extends BaseMvvmActivity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Log.e(TAG, "onResume: " + Settings.System.getInt(getContentResolver(), "qch_Developeroptions", 0));
|
||||
tv_qch_Developeroptions.setText("qch_Developeroptions: " + Settings.System.getInt(getContentResolver(), "qch_Developeroptions", 0));
|
||||
mViewDataBinding.tvQchDeveloperoptions.setText("qch_Developeroptions: " + Settings.System.getInt(getContentResolver(), "qch_Developeroptions", 0));
|
||||
Log.e(TAG, "onResume: " + Settings.Global.getInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0));
|
||||
tv_development_settings_enabled.setText("development_settings_enabled: " + Settings.Global.getInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0));
|
||||
mViewDataBinding.tvDevelopmentSettingsEnabled.setText("development_settings_enabled: " + Settings.Global.getInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0));
|
||||
Log.e(TAG, "onResume: " + Settings.Global.getInt(getContentResolver(), Settings.Global.ADB_ENABLED, 0));
|
||||
tv_adb_enabled.setText("development_settings_enabled: " + Settings.Global.getInt(getContentResolver(), Settings.Global.ADB_ENABLED, 0));
|
||||
mViewDataBinding.tvAdbEnabled.setText("development_settings_enabled: " + Settings.Global.getInt(getContentResolver(), Settings.Global.ADB_ENABLED, 0));
|
||||
}
|
||||
|
||||
private HideAppReceiver hideAppReceiver;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ttstd.ttutils.activity.main;
|
||||
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.ttstd.ttutils.base.mvvm.BaseViewModel;
|
||||
import com.ttstd.ttutils.databinding.ActivityMainBinding;
|
||||
|
||||
public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEvent> {
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,20 @@
|
||||
package com.ttstd.ttutils.activity.test;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.ttstd.ttutils.R;
|
||||
import com.ttstd.ttutils.base.BaseDataBindingActivity;
|
||||
import com.ttstd.ttutils.base.mvvm.BaseMvvmActivity;
|
||||
import com.ttstd.ttutils.databinding.ActivityTestBinding;
|
||||
import com.ttstd.ttutils.utils.java.TTUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class TestActivity extends BaseMvvmActivity {
|
||||
private String TAG = "TestActivity";
|
||||
|
||||
@BindView(R.id.bt1)
|
||||
Button bt1;
|
||||
@BindView(R.id.bt2)
|
||||
Button bt2;
|
||||
@BindView(R.id.bt3)
|
||||
Button bt3;
|
||||
public class TestActivity extends BaseMvvmActivity<TestViewModel, ActivityTestBinding> {
|
||||
private static final String TAG = "TestActivity";
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -45,14 +31,13 @@ public class TestActivity extends BaseMvvmActivity {
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
ButterKnife.bind(this);
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
TTUtils.getExtrax(intent);
|
||||
}
|
||||
bt1.setOnClickListener(view -> setDefault("com.aoleyunos.dop1"));
|
||||
bt2.setOnClickListener(view -> setDefault("com.aoleyunos.dop2"));
|
||||
bt3.setOnClickListener(view -> setDefault("com.aoleyun.os"));
|
||||
mViewDataBinding.bt1.setOnClickListener(view -> setDefault("com.aoleyunos.dop1"));
|
||||
mViewDataBinding.bt2.setOnClickListener(view -> setDefault("com.aoleyunos.dop2"));
|
||||
mViewDataBinding.bt3.setOnClickListener(view -> setDefault("com.aoleyun.os"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ttstd.ttutils.activity.test;
|
||||
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.ttstd.ttutils.base.mvvm.BaseViewModel;
|
||||
import com.ttstd.ttutils.databinding.ActivityTestBinding;
|
||||
|
||||
public class TestViewModel extends BaseViewModel <ActivityTestBinding, ActivityEvent>{
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import java.lang.reflect.ParameterizedType;
|
||||
|
||||
public abstract class BaseMvvmActivity<VM extends ViewModel, VDB extends ViewDataBinding> extends BaseTransparentActivity {
|
||||
|
||||
private static final String TAG = "BaseMvvmActivity";
|
||||
private static final String TAG = BaseMvvmActivity.class.getSimpleName();
|
||||
|
||||
protected VM mViewModel;
|
||||
protected VDB mViewDataBinding;
|
||||
@@ -31,10 +31,19 @@ public abstract class BaseMvvmActivity<VM extends ViewModel, VDB extends ViewDat
|
||||
//ViewModel
|
||||
vmClass = (Class<VM>) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
|
||||
boolean isAbstract = Modifier.isAbstract(vmClass.getModifiers());
|
||||
Log.e(TAG, "isLocalClass:" + vmClass.getSimpleName().equals("ViewModel") + " isAbstract:" + isAbstract);
|
||||
Log.e(TAG, "isLocalClass:" + vmClass.getSimpleName().equals(ViewModel.class.getSimpleName()) + " isAbstract:" + isAbstract);
|
||||
if (!isAbstract) {//不是一个抽象类
|
||||
mViewModel = new ViewModelProvider(this).get(vmClass);
|
||||
}
|
||||
|
||||
// 自动初始化 BaseViewModel 属性,减少子类模板代码
|
||||
if (mViewModel instanceof BaseViewModel) {
|
||||
BaseViewModel<?, ?> baseVm = (BaseViewModel<?, ?>) mViewModel;
|
||||
baseVm.setVDBinding(mViewDataBinding);
|
||||
baseVm.setCtx(this);
|
||||
baseVm.setLifecycle(getLifecycleSubject());
|
||||
}
|
||||
|
||||
initDataBinding();
|
||||
initView();
|
||||
initData();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.ttstd.ttutils.network.interceptor;
|
||||
|
||||
import static okhttp3.internal._UtilCommonKt.closeQuietly;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
@@ -20,7 +22,6 @@ import okhttp3.internal.http.HttpHeaders;
|
||||
import okio.Buffer;
|
||||
import okio.BufferedSource;
|
||||
|
||||
import static okhttp3.internal.Util.closeQuietly;
|
||||
|
||||
public class PostCacheInterceptor implements Interceptor {
|
||||
final DiskLruCacheHelper cache;
|
||||
|
||||
@@ -1,284 +1,291 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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:fitsSystemWindows="true"
|
||||
tools:context=".activity.main.MainActivity">
|
||||
|
||||
<ScrollView
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_statu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_close"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="关闭" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_open"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="打开" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_refresh"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="刷新"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_net_statu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_close"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="黑名单" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_open"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="清除" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_refresh"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="刷新"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_statu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_close"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="关闭" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_open"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="打开" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_refresh"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="刷新"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
android:id="@+id/tv_qch_Developeroptions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_net_statu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:id="@+id/tv_development_settings_enabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_adb_enabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_close"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/bt_bar_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="黑名单" />
|
||||
android:text="nav_bar_show"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_open"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/bt_bar_hide"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="清除" />
|
||||
android:text="nav_bar_hide"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_refresh"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/bt_statusbar_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="刷新"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
android:text="status_bar_show"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar_hide"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="status_bar_hide"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<com.ttstd.viewlibrary.ToggleButton2
|
||||
android:id="@+id/disable_switch"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.ttstd.viewlibrary.ToggleButton
|
||||
android:id="@+id/toggleButton"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/disable_switch" />
|
||||
|
||||
<com.suke.widget.SwitchButton
|
||||
android:id="@+id/switch_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toggleButton" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.311" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Button"
|
||||
app:layout_constraintEnd_toEndOf="@+id/textView"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/none"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="none"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/adb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="adb"
|
||||
app:layout_constraintStart_toEndOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rndis"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="rndis"
|
||||
app:layout_constraintStart_toEndOf="@+id/adb" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/mtp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="mtp"
|
||||
app:layout_constraintStart_toEndOf="@+id/rndis" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/ptp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ptp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/audio_source"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="audio_source"
|
||||
app:layout_constraintStart_toEndOf="@+id/ptp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/midi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="midi"
|
||||
app:layout_constraintStart_toEndOf="@+id/audio_source"
|
||||
app:layout_constraintTop_toTopOf="@+id/audio_source" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/accessory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="accessory"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ptp"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_off"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_off"
|
||||
app:layout_constraintStart_toEndOf="@+id/accessory"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_on"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_on"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_off"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_look"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_look"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_bc_boot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="broadcast"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_start_jgy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start JGY APP"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_qch_Developeroptions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_development_settings_enabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_adb_enabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_bar_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="nav_bar_show"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_bar_hide"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="nav_bar_hide"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="status_bar_show"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar_hide"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="status_bar_hide"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<com.ttstd.viewlibrary.ToggleButton2
|
||||
android:id="@+id/disable_switch"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.ttstd.viewlibrary.ToggleButton
|
||||
android:id="@+id/toggleButton"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/disable_switch" />
|
||||
|
||||
<com.suke.widget.SwitchButton
|
||||
android:id="@+id/switch_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toggleButton" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.311" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Button"
|
||||
app:layout_constraintEnd_toEndOf="@+id/textView"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/none"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="none"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/adb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="adb"
|
||||
app:layout_constraintStart_toEndOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rndis"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="rndis"
|
||||
app:layout_constraintStart_toEndOf="@+id/adb" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/mtp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="mtp"
|
||||
app:layout_constraintStart_toEndOf="@+id/rndis" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/ptp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ptp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/audio_source"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="audio_source"
|
||||
app:layout_constraintStart_toEndOf="@+id/ptp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/midi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="midi"
|
||||
app:layout_constraintStart_toEndOf="@+id/audio_source"
|
||||
app:layout_constraintTop_toTopOf="@+id/audio_source" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/accessory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="accessory"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ptp"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_off"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_off"
|
||||
app:layout_constraintStart_toEndOf="@+id/accessory"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_on"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_on"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_off"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_look"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_look"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_bc_boot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="broadcast"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_start_jgy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start JGY APP"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@@ -1,284 +1,291 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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:fitsSystemWindows="true"
|
||||
tools:context=".activity.main.MainActivity">
|
||||
|
||||
<ScrollView
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_statu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_close"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="关闭" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_open"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="打开" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_refresh"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="刷新"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_net_statu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_close"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="黑名单" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_open"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="清除" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_refresh"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="刷新"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_statu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_close"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="关闭" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_open"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="打开" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_camera_refresh"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="刷新"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
android:id="@+id/tv_qch_Developeroptions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_net_statu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:id="@+id/tv_development_settings_enabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_adb_enabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_close"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/bt_bar_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="黑名单" />
|
||||
android:text="nav_bar_show"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_open"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/bt_bar_hide"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="清除" />
|
||||
android:text="nav_bar_hide"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_net_refresh"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/bt_statusbar_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="刷新"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
android:text="status_bar_show"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar_hide"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="status_bar_hide"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<com.ttstd.viewlibrary.ToggleButton2
|
||||
android:id="@+id/disable_switch"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.ttstd.viewlibrary.ToggleButton
|
||||
android:id="@+id/toggleButton"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/disable_switch" />
|
||||
|
||||
<com.suke.widget.SwitchButton
|
||||
android:id="@+id/switch_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toggleButton" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.311" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Button"
|
||||
app:layout_constraintEnd_toEndOf="@+id/textView"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/none"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="none"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/adb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="adb"
|
||||
app:layout_constraintStart_toEndOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rndis"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="rndis"
|
||||
app:layout_constraintStart_toEndOf="@+id/adb" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/mtp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="mtp"
|
||||
app:layout_constraintStart_toEndOf="@+id/rndis" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/ptp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ptp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/audio_source"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="audio_source"
|
||||
app:layout_constraintStart_toEndOf="@+id/ptp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/midi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="midi"
|
||||
app:layout_constraintStart_toEndOf="@+id/audio_source"
|
||||
app:layout_constraintTop_toTopOf="@+id/audio_source" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/accessory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="accessory"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ptp"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_off"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_off"
|
||||
app:layout_constraintStart_toEndOf="@+id/accessory"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_on"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_on"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_off"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_look"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_look"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_bc_boot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="broadcast"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_start_jgy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start JGY APP"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_qch_Developeroptions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_development_settings_enabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_adb_enabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_bar_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="nav_bar_show"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_bar_hide"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="nav_bar_hide"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="status_bar_show"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar_hide"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="status_bar_hide"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<com.ttstd.viewlibrary.ToggleButton2
|
||||
android:id="@+id/disable_switch"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.ttstd.viewlibrary.ToggleButton
|
||||
android:id="@+id/toggleButton"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/disable_switch" />
|
||||
|
||||
<com.suke.widget.SwitchButton
|
||||
android:id="@+id/switch_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toggleButton" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.311" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Button"
|
||||
app:layout_constraintEnd_toEndOf="@+id/textView"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/none"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="none"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/adb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="adb"
|
||||
app:layout_constraintStart_toEndOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rndis"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="rndis"
|
||||
app:layout_constraintStart_toEndOf="@+id/adb" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/mtp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="mtp"
|
||||
app:layout_constraintStart_toEndOf="@+id/rndis" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/ptp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ptp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/audio_source"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="audio_source"
|
||||
app:layout_constraintStart_toEndOf="@+id/ptp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/none" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/midi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="midi"
|
||||
app:layout_constraintStart_toEndOf="@+id/audio_source"
|
||||
app:layout_constraintTop_toTopOf="@+id/audio_source" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/accessory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="accessory"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ptp"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_off"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_off"
|
||||
app:layout_constraintStart_toEndOf="@+id/accessory"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_on"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_on"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_off"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/icon_look"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="icon_look"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_bc_boot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="broadcast"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_start_jgy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start JGY APP"
|
||||
app:layout_constraintStart_toEndOf="@+id/icon_on"
|
||||
app:layout_constraintTop_toTopOf="@+id/accessory" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@@ -1,35 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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"
|
||||
tools:context=".activity.test.TestActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="com.aoleyunos.dop1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<data>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="com.aoleyunos.dop2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bt1" />
|
||||
</data>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="com.aoleyun.os"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bt2" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="com.aoleyunos.dop1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="com.aoleyunos.dop2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bt1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="com.aoleyun.os"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bt2" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
29
build.gradle
29
build.gradle
@@ -1,19 +1,21 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
ext.kotlin_version = "1.4.10"
|
||||
ext.kotlin_version = "2.4.0"
|
||||
|
||||
repositories {
|
||||
google()
|
||||
// mavenCentral()
|
||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||
maven { url "https://jitpack.io" }
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://maven.google.com' }
|
||||
maven { url 'https://developer.huawei.com/repo/' }
|
||||
maven { url 'https://developer.hihonor.com/repo' }
|
||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
||||
maven { url "https://maven.aliyun.com/repository/jcenter" }
|
||||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:3.6.4"
|
||||
classpath 'com.android.tools.build:gradle:8.13.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
classpath "com.tencent.android.tpns:tpnsplugin:1.8.0"
|
||||
@@ -31,21 +33,24 @@ allprojects {
|
||||
force 'androidx.annotation:annotation:1.3.0'
|
||||
// 统一 lifecycle-runtime
|
||||
force 'androidx.lifecycle:lifecycle-runtime:2.3.1'
|
||||
// 统一 Kotlin 标准库
|
||||
force 'org.jetbrains.kotlin:kotlin-stdlib:1.5.10'
|
||||
// 统一 Kotlin 标准库(需与 kotlin_version 保持一致,否则运行时会缺 EnumEntriesKt 等类)
|
||||
force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
// mavenCentral()
|
||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||
maven { url "https://jitpack.io" }
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://maven.google.com' }
|
||||
maven { url 'https://developer.huawei.com/repo/' }
|
||||
maven { url 'https://developer.hihonor.com/repo' }
|
||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
||||
maven { url "https://maven.aliyun.com/repository/jcenter" }
|
||||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile) {
|
||||
//设置jar相对包路径或绝对路径
|
||||
|
||||
@@ -18,5 +18,4 @@ android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
android.useDeprecatedNdk=true
|
||||
kotlin.code.style=official
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
namespace "com.shehuan.niv"
|
||||
|
||||
compileSdkVersion 28
|
||||
|
||||
defaultConfig {
|
||||
@@ -11,6 +13,8 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
BCM310Debug {}
|
||||
BCM310Release {}
|
||||
MT6789Debug {}
|
||||
MT6789Release {}
|
||||
QZ15Debug {}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.shehuan.niv" />
|
||||
<manifest package="com.shehuan.niv" />
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
namespace "com.ttstd.viewlibrary"
|
||||
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 30
|
||||
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@@ -25,6 +27,8 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
BCM310Debug {}
|
||||
BCM310Release {}
|
||||
MT6789Debug {}
|
||||
MT6789Release {}
|
||||
QZ15Debug {}
|
||||
@@ -75,5 +79,5 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
implementation 'com.facebook.rebound:rebound:0.3.6'
|
||||
// implementation 'com.zcw:togglebutton-library:1.0.0'
|
||||
implementation 'com.github.zcweng:switch-button:0.0.3@aar'
|
||||
api 'com.github.zcweng:switch-button:0.0.3@aar'
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.ttstd.viewlibrary" />
|
||||
<manifest package="com.ttstd.viewlibrary" />
|
||||
|
||||
Reference in New Issue
Block a user