更换包名为ttstd,增加机型
This commit is contained in:
1 parent
b638e1a9f9
commit
ddde2e481b
99 files changed
+922
-2133
No files matched your search
+166
-14
@@ -16,7 +16,7 @@ android {
|
||||
buildToolsVersion "30.0.1"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.tt.ttutils"
|
||||
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
|
||||
@@ -46,9 +46,6 @@ android {
|
||||
manifestPlaceholders = [
|
||||
XG_ACCESS_ID : "1500026407",
|
||||
XG_ACCESS_KEY: "AQ6C6W1O19LT",
|
||||
JPUSH_PKGNAME: applicationId,
|
||||
JPUSH_APPKEY : "731637f412deca8540a1f873", //JPush 上注册的包名对应的 Appkey.
|
||||
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
|
||||
]
|
||||
}
|
||||
|
||||
@@ -157,6 +154,24 @@ android {
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
zhanruiG10Z {
|
||||
storeFile file("keystore/zhanruiG10Z.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanruiG10Z"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
zhanRui12 {
|
||||
storeFile file("keystore/zhanrui12.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanrui12"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
own {
|
||||
storeFile file("keystore/tt.jks")
|
||||
storePassword "fht19961207"
|
||||
@@ -166,7 +181,7 @@ android {
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G10P{
|
||||
G10P {
|
||||
storeFile file("keystore/G10PMTK11.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "G10PMTK11"
|
||||
@@ -175,7 +190,16 @@ android {
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G10PUserDebug{
|
||||
G11Userdebug {
|
||||
storeFile file("keystore/G11Userdebug.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "G11Userdebug"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G10PUserDebug {
|
||||
storeFile file("keystore/G10PUserDebug.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "G10PUserDebug"
|
||||
@@ -184,7 +208,7 @@ android {
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
Teclast8515{
|
||||
Teclast8515 {
|
||||
storeFile file("keystore/Teclast8515.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "Teclast8515"
|
||||
@@ -201,9 +225,101 @@ android {
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
U807 {
|
||||
storeFile file("keystore/AllwinnerU807.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "u807"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
UnisocS6688 {
|
||||
storeFile file("keystore/UnisocS6688Userdebug.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "unisocs6688userdebug"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
iPlay50P {
|
||||
storeFile file("keystore/iPlay50P.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "iplay50p"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
Huaruian8768 {
|
||||
storeFile file("keystore/Huaruian8768.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "Huaruian8768"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
Huaruian8768Debug.initWith(debug)
|
||||
Huaruian8768Debug {
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.Huaruian8768
|
||||
buildConfigField "String", "platform", '"MT8768"'
|
||||
}
|
||||
|
||||
Huaruian8768Release.initWith(release)
|
||||
Huaruian8768Release {
|
||||
signingConfig signingConfigs.Huaruian8768
|
||||
buildConfigField "String", "platform", '"MT8768"'
|
||||
}
|
||||
|
||||
iPlay50PDebug.initWith(debug)
|
||||
iPlay50PDebug {
|
||||
buildConfigField "String", "platform", '"T1102"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.iPlay50P
|
||||
}
|
||||
|
||||
iPlay50PRelease.initWith(release)
|
||||
iPlay50PRelease {
|
||||
buildConfigField "String", "platform", '"T1102"'
|
||||
signingConfig signingConfigs.iPlay50P
|
||||
}
|
||||
|
||||
UnisocS6688Debug.initWith(debug)
|
||||
UnisocS6688Debug {
|
||||
buildConfigField "String", "platform", '"S6688"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.UnisocS6688
|
||||
}
|
||||
|
||||
UnisocS6688Release.initWith(release)
|
||||
UnisocS6688Release {
|
||||
buildConfigField "String", "platform", '"S6688"'
|
||||
signingConfig signingConfigs.UnisocS6688
|
||||
}
|
||||
|
||||
U807Debug.initWith(debug)
|
||||
U807Debug {
|
||||
buildConfigField "String", "platform", '"U807"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.U807
|
||||
}
|
||||
|
||||
U807Release.initWith(release)
|
||||
U807Release {
|
||||
buildConfigField "String", "platform", '"U807"'
|
||||
signingConfig signingConfigs.U807
|
||||
}
|
||||
|
||||
tuiXinDebug.initWith(debug)
|
||||
tuiXinDebug {
|
||||
versionNameSuffix "-debug"
|
||||
@@ -254,6 +370,14 @@ android {
|
||||
buildConfigField "String", "platform", '"MTK11"'
|
||||
}
|
||||
|
||||
G11Userdebug.initWith(debug)
|
||||
G11Userdebug {
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.G11Userdebug
|
||||
buildConfigField "String", "platform", '"G10P"'
|
||||
}
|
||||
|
||||
G10PUserDebug.initWith(debug)
|
||||
G10PUserDebug {
|
||||
versionNameSuffix "-debug"
|
||||
@@ -290,6 +414,20 @@ android {
|
||||
signingConfig signingConfigs.P20S
|
||||
}
|
||||
|
||||
zhanruiG10ZDebug.initWith(debug)
|
||||
zhanruiG10ZDebug {
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
buildConfigField "String", "platform", '"ZR6016"'
|
||||
signingConfig signingConfigs.zhanruiG10Z
|
||||
}
|
||||
|
||||
zhanruiG10ZRelease.initWith(release)
|
||||
zhanruiG10ZRelease {
|
||||
buildConfigField "String", "platform", '"ZR6016"'
|
||||
signingConfig signingConfigs.zhanruiG10Z
|
||||
}
|
||||
|
||||
zhanRuiDebug.initWith(debug)
|
||||
zhanRuiDebug {
|
||||
versionNameSuffix "-debug"
|
||||
@@ -313,6 +451,20 @@ android {
|
||||
signingConfig signingConfigs.zhanRuiUserdebug
|
||||
}
|
||||
|
||||
zhanRui12Debug.initWith(debug)
|
||||
zhanRui12Debug {
|
||||
debuggable true
|
||||
versionNameSuffix "-debug"
|
||||
buildConfigField "String", "platform", '"AH6016"'
|
||||
signingConfig signingConfigs.zhanRui12
|
||||
}
|
||||
|
||||
zhanRui12Release.initWith(release)
|
||||
zhanRui12Release {
|
||||
buildConfigField "String", "platform", '"AH6016"'
|
||||
signingConfig signingConfigs.zhanRui12
|
||||
}
|
||||
|
||||
debug {
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
// 不显示Log
|
||||
@@ -328,7 +480,7 @@ android {
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null) {
|
||||
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
|
||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType.name}.apk"
|
||||
output.outputFileName = fileName
|
||||
}
|
||||
}
|
||||
@@ -350,7 +502,7 @@ android {
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = ""
|
||||
if (outputFile != null) {
|
||||
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${productFlavors[0].name}-${buildType.name}.apk"
|
||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${productFlavors[0].name}_${buildType.name}.apk"
|
||||
output.outputFileName = fileName
|
||||
}
|
||||
}
|
||||
@@ -393,24 +545,22 @@ dependencies {
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
////三方
|
||||
//极光推送
|
||||
implementation 'cn.jiguang.sdk:jpush:3.8.6' // 此处以JPush 3.7.0 版本为例。
|
||||
implementation 'cn.jiguang.sdk:jcore:2.6.0' // 此处以JCore 2.4.2 版本为例。
|
||||
//RxJava
|
||||
// implementation 'io.reactivex.rxjava2:rxjava:2.2.5'
|
||||
// implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
|
||||
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
|
||||
// Because RxAndroid releases are few and far between, it is recommended you also
|
||||
// explicitly depend on RxJava's latest version for bug fixes and new features.
|
||||
// (see https://github.com/ReactiveX/RxJava/releases for latest 3.x.x version)
|
||||
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
|
||||
|
||||
//rxlifecycle
|
||||
implementation 'com.trello.rxlifecycle4:rxlifecycle:4.0.2'
|
||||
implementation 'com.trello.rxlifecycle4:rxlifecycle-android:4.0.2'
|
||||
implementation 'com.trello.rxlifecycle4:rxlifecycle-components:4.0.2'
|
||||
implementation 'com.trello.rxlifecycle4:rxlifecycle-components-preference:4.0.2'
|
||||
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'
|
||||
@@ -438,6 +588,8 @@ dependencies {
|
||||
|
||||
//MMKV
|
||||
implementation 'com.tencent:mmkv-static:1.2.13'
|
||||
//Bugly
|
||||
implementation 'com.tencent.bugly:crashreport:4.0.0'
|
||||
//腾讯移动推送 TPNS
|
||||
implementation 'com.tencent.tpns:tpns:1.2.2.0-release'
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
package com.ttstd.ttutils
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.ttstd.ttutils", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -1,96 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.tt.ttutils"
|
||||
package="com.ttstd.ttutils"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<!-- 添加快捷方式 -->
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||
<!-- 移除快捷方式 -->
|
||||
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
|
||||
<!-- 查询快捷方式 -->
|
||||
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
|
||||
|
||||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 【必须】 移动推送 TPNS SDK 5.0版本所需权限 -->
|
||||
<permission
|
||||
android:name="com.tt.ttutils.permission.XGPUSH_RECEIVE"
|
||||
android:protectionLevel="signature" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK 5.0版本所需权限 -->
|
||||
<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.tt.ttutils.permission.XGPUSH_RECEIVE" /> <!-- 【必须】 移动推送 TPNS SDK所需权限 -->
|
||||
<uses-permission android:name="com.ttstd.ttutils.permission.XGPUSH_RECEIVE" />
|
||||
<!-- 【必须】 移动推送 TPNS SDK所需权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- 【常用】 移动推送 TPNS SDK所需权限 -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<!-- 【常用】 移动推送 TPNS SDK所需权限 -->
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- Required -->
|
||||
<permission
|
||||
android:name="${applicationId}.permission.JPUSH_MESSAGE"
|
||||
android:protectionLevel="signature" /> <!-- Required 一些系统要求的权限,如访问网络等 -->
|
||||
<uses-permission android:name="${applicationId}.permission.JPUSH_MESSAGE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- Optional for location -->
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
|
||||
|
||||
<!-- Optional for location -->
|
||||
<!-- <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" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <!-- Android Q后台定位权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
<!-- Android Q后台定位权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission android:name="com.jiaoguanyi.appstore.permissions.INSTALL_APK" />
|
||||
|
||||
<application
|
||||
android:name=".base.KotlinApplication"
|
||||
android:name="com.ttstd.ttutils.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=".activity.AoleyunTestActivity">
|
||||
<activity android:name="com.ttstd.ttutils.activity.AoleyunTestActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".activity.main.MainActivity">
|
||||
<activity android:name="com.ttstd.ttutils.activity.main.MainActivity"
|
||||
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=".activity.KotlinMainActivity">
|
||||
<activity android:name="com.ttstd.ttutils.activity.KotlinMainActivity">
|
||||
<!-- <intent-filter> -->
|
||||
<!-- <action android:name="android.intent.action.MAIN" /> -->
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
|
||||
<!-- </intent-filter> -->
|
||||
</activity>
|
||||
<activity android:name=".activity.test.TestActivity">
|
||||
<activity android:name="com.ttstd.ttutils.activity.test.TestActivity">
|
||||
|
||||
<!-- <intent-filter> -->
|
||||
<!-- <action android:name="android.intent.action.MAIN" /> -->
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
|
||||
<!-- </intent-filter> -->
|
||||
</activity>
|
||||
<activity android:name=".activity.retrofit.RetrofitActivity" />
|
||||
<activity android:name=".activity.PackageActivity" />
|
||||
<activity android:name="com.ttstd.ttutils.activity.retrofit.RetrofitActivity" />
|
||||
<activity android:name="com.ttstd.ttutils.activity.PackageActivity" />
|
||||
|
||||
<service
|
||||
android:name=".server.main.MainService"
|
||||
android:name="com.ttstd.ttutils.server.main.MainService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.PackageReceiver"
|
||||
android:name="com.ttstd.ttutils.receiver.PackageReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
@@ -102,7 +106,7 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".receiver.BootReceiver"
|
||||
android:name="com.ttstd.ttutils.receiver.BootReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
@@ -131,69 +135,27 @@
|
||||
<!-- 自定义广播 -->
|
||||
<action android:name="com.jiaoguanyi.appstore.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- -->
|
||||
</receiver>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="{applicationId}.FileProvider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
<!-- 应用的其它配置 -->
|
||||
<uses-library
|
||||
android:name="org.apache.http.legacy"
|
||||
android:required="false" /> <!-- 【必须】 移动推送 TPNS 默认通知 -->
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.TpnsActivity"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="com.tt.ttutils"
|
||||
android:scheme="tpns" />
|
||||
android:required="false" />
|
||||
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity> <!-- 【必须】 移动推送 TPNS receiver广播接收 -->
|
||||
<receiver
|
||||
android:name="com.tencent.android.tpush.XGPushReceiver"
|
||||
android:process=":xg_vip_service">
|
||||
<intent-filter android:priority="0x7fffffff">
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK的内部广播 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.SDK" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.INTERNAL_PUSH_MESSAGE" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.ACTION_SDK_KEEPALIVE" />
|
||||
<!-- 【可选】 系统广播:网络切换 -->
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
<!-- 【可选】 系统广播:开屏 -->
|
||||
<action android:name="android.intent.action.USER_PRESENT" />
|
||||
<!-- 【可选】 一些常用的系统广播,增强移动推送 TPNS service的复活机会,请根据需要选择。当然,您也可以添加App自定义的一些广播让启动service -->
|
||||
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
|
||||
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
|
||||
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- 【必须】移动推送 TPNS service -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.service.XGVipPushService"
|
||||
android:persistent="true"
|
||||
android:process=":xg_vip_service" /> <!-- 【必须】通知 service ,android:name 部分改为包名.XGVIP_PUSH_ACTION -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.rpc.XGRemoteService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
|
||||
<!-- 【必须】请修改为当前APP名包.XGVIP_PUSH_ACTION -->
|
||||
<action android:name="com.tt.ttutils.XGVIP_PUSH_ACTION" />
|
||||
</intent-filter>
|
||||
</service> <!-- 【必须】【注意】authorities 修改为包名.XGVIP_PUSH_AUTH -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGPushProvider"
|
||||
android:authorities="com.tt.ttutils.XGVIP_PUSH_AUTH" /> <!-- 【必须】【注意】authorities 修改为包名.TPUSH_PROVIDER -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.SettingsContentProvider"
|
||||
android:authorities="com.tt.ttutils.TPUSH_PROVIDER" /> <!-- 【可选】用于增强保活能力 -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGVipPushKAProvider"
|
||||
android:authorities="com.tt.ttutils.AUTH_XGPUSH_KEEPALIVE"
|
||||
android:exported="true" /> <!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
|
||||
<!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
|
||||
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
|
||||
<receiver android:name=".tpush.MessageReceiver">
|
||||
<receiver android:name="com.ttstd.ttutils.tpush.MessageReceiver">
|
||||
<intent-filter>
|
||||
|
||||
<!-- 接收消息透传 -->
|
||||
@@ -201,165 +163,18 @@
|
||||
<!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.FEEDBACK" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- MQTT START -->
|
||||
<service
|
||||
android:name="com.tencent.tpns.mqttchannel.services.MqttService"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service" />
|
||||
</receiver>
|
||||
|
||||
|
||||
<provider
|
||||
android:name="com.tencent.tpns.baseapi.base.SettingsContentProvider"
|
||||
android:authorities="com.tt.ttutils.XG_SETTINGS_PROVIDER"
|
||||
android:exported="false" /> <!-- MQTT END -->
|
||||
<!-- 【必须】 请修改为 APP 的 AccessId,“15”开头的10位数字,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_ID"
|
||||
android:value="1500026407" /> <!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
|
||||
android:value="1500026407" />
|
||||
<!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_KEY"
|
||||
android:value="AQ6C6W1O19LT" /> <!-- Rich push 核心功能 since 2.0.6 -->
|
||||
<activity
|
||||
android:name="cn.jpush.android.ui.PopWinActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/MyDialogStyle"
|
||||
tools:replace="android:exported" /> <!-- Required SDK核心功能 -->
|
||||
<activity
|
||||
android:name="cn.jpush.android.ui.PushActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:exported="false"
|
||||
android:theme="@android:style/Theme.NoTitleBar"
|
||||
tools:replace="android:exported">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.ui.PushActivity" />
|
||||
android:value="AQ6C6W1O19LT" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</activity> <!-- Required SDK 核心功能 -->
|
||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||
<service
|
||||
android:name="cn.jpush.android.service.PushService"
|
||||
android:process=":pushcore">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.REGISTER" />
|
||||
<action android:name="cn.jpush.android.intent.REPORT" />
|
||||
<action android:name="cn.jpush.android.intent.PushService" />
|
||||
<action android:name="cn.jpush.android.intent.PUSH_TIME" />
|
||||
</intent-filter>
|
||||
</service> <!-- since 3.0.9 Required SDK 核心功能 -->
|
||||
<provider
|
||||
android:name="cn.jpush.android.service.DataProvider"
|
||||
android:authorities="${applicationId}.DataProvider"
|
||||
android:exported="false"
|
||||
android:process=":pushcore" /> <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
|
||||
<!-- 若不启用该功能可删除该组件,或把 enabled 设置成 false ;App 不会被其他 App 拉起,但会拉起其他的 App。 -->
|
||||
<service
|
||||
android:name="cn.jpush.android.service.DaemonService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.DaemonService" />
|
||||
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</service> <!-- 可选,如果使用静态Activity方式拉起,该组件必须声明 -->
|
||||
<activity
|
||||
android:name="cn.jpush.android.service.DActivity"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:taskAffinity="jpush.custom"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.DActivity" />
|
||||
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</activity> <!-- since 3.1.0 Required SDK 核心功能 -->
|
||||
<provider
|
||||
android:name="cn.jpush.android.service.DownloadProvider"
|
||||
android:authorities="${applicationId}.DownloadProvider"
|
||||
android:exported="true" /> <!-- Required SDK核心功能 -->
|
||||
<receiver
|
||||
android:name="cn.jpush.android.service.PushReceiver"
|
||||
android:enabled="true">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
|
||||
<!-- Required 显示通知栏 -->
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.USER_PRESENT" />
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
<!-- Optional -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED" />
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- Required SDK核心功能 -->
|
||||
<receiver
|
||||
android:name="cn.jpush.android.service.AlarmReceiver"
|
||||
android:exported="false" /> <!-- 3.5.0新增,用于定时展示功能 -->
|
||||
<receiver
|
||||
android:name="cn.jpush.android.service.SchedulerReceiver"
|
||||
android:exported="false" /> <!-- 3.6.7 新增,用于负反馈组件 -->
|
||||
<service android:name="cn.jpush.android.service.MessagingIntentService" /> <!-- User defined. For test only 用户自定义的广播接收器 -->
|
||||
<receiver
|
||||
android:name=".sdk.jpush.jpushdemo.MyReceiver"
|
||||
android:enabled="true">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.REGISTRATION" />
|
||||
<!-- Required 用户注册SDK的intent -->
|
||||
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
|
||||
<!-- Required 用户接收SDK消息的intent -->
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
|
||||
<!-- Required 用户接收SDK通知栏信息的intent -->
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
|
||||
<!-- Required 用户打开自定义通知栏的intent -->
|
||||
<action android:name="cn.jpush.android.intent.CONNECTION" />
|
||||
<!-- 接收网络变化 连接/断开 since 1.6.3 -->
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调 -->
|
||||
<!-- since 3.3.0 接收JPush相关事件 -->
|
||||
<receiver android:name=".sdk.jpush.jpushdemo.PushMessageReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
|
||||
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- since 3.3.0 Required SDK核心功能 -->
|
||||
<activity
|
||||
android:name="cn.jpush.android.service.JNotifyActivity"
|
||||
android:exported="false"
|
||||
android:taskAffinity="jpush.custom"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||
tools:replace="android:exported">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.JNotifyActivity" />
|
||||
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</activity> <!-- since 3.3.0 Required SDK 核心功能 -->
|
||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||
<!-- User defined. For test only 继承自cn.jpush.android.service.JCommonService -->
|
||||
<service
|
||||
android:name=".sdk.jpush.jpushdemo.PushService"
|
||||
android:process=":pushcore">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jiguang.user.service.action" />
|
||||
</intent-filter>
|
||||
</service> <!-- since 3.5.6 新增华硕通道 -->
|
||||
<receiver android:name="cn.jpush.android.asus.AsusPushMessageReceiver" /> <!-- Required . Enable it you can get statistics data with channel -->
|
||||
<!-- 值来自开发者平台取得的AppKey -->
|
||||
<meta-data
|
||||
android:name="JPUSH_CHANNEL"
|
||||
android:value="${JPUSH_CHANNEL}" />
|
||||
<meta-data
|
||||
android:name="JPUSH_APPKEY"
|
||||
android:value="${JPUSH_APPKEY}" />
|
||||
<meta-data
|
||||
android:name="design_width_in_dp"
|
||||
android:value="640" />
|
||||
@@ -367,5 +182,4 @@
|
||||
android:name="design_height_in_dp"
|
||||
android:value="1024" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,133 +0,0 @@
|
||||
package com.tt.ttutils.sdk.jpush.jpushdemo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
|
||||
public class ExampleUtil {
|
||||
public static final String PREFS_NAME = "JPUSH_EXAMPLE";
|
||||
public static final String PREFS_DAYS = "JPUSH_EXAMPLE_DAYS";
|
||||
public static final String PREFS_START_TIME = "PREFS_START_TIME";
|
||||
public static final String PREFS_END_TIME = "PREFS_END_TIME";
|
||||
public static final String KEY_APP_KEY = "JPUSH_APPKEY";
|
||||
|
||||
public static boolean isEmpty(String s) {
|
||||
if (null == s)
|
||||
return true;
|
||||
if (s.length() == 0)
|
||||
return true;
|
||||
if (s.trim().length() == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 只能以 “+” 或者 数字开头;后面的内容只能包含 “-” 和 数字。
|
||||
* */
|
||||
private final static String MOBILE_NUMBER_CHARS = "^[+0-9][-0-9]{1,}$";
|
||||
public static boolean isValidMobileNumber(String s) {
|
||||
if(TextUtils.isEmpty(s)) return true;
|
||||
Pattern p = Pattern.compile(MOBILE_NUMBER_CHARS);
|
||||
Matcher m = p.matcher(s);
|
||||
return m.matches();
|
||||
}
|
||||
// 校验Tag Alias 只能是数字,英文字母和中文
|
||||
public static boolean isValidTagAndAlias(String s) {
|
||||
Pattern p = Pattern.compile("^[\u4E00-\u9FA50-9a-zA-Z_!@#$&*+=.|]+$");
|
||||
Matcher m = p.matcher(s);
|
||||
return m.matches();
|
||||
}
|
||||
|
||||
// 取得AppKey
|
||||
public static String getAppKey(Context context) {
|
||||
Bundle metaData = null;
|
||||
String appKey = null;
|
||||
try {
|
||||
ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
|
||||
context.getPackageName(), PackageManager.GET_META_DATA);
|
||||
if (null != ai)
|
||||
metaData = ai.metaData;
|
||||
if (null != metaData) {
|
||||
appKey = metaData.getString(KEY_APP_KEY);
|
||||
if ((null == appKey) || appKey.length() != 24) {
|
||||
appKey = null;
|
||||
}
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
|
||||
}
|
||||
return appKey;
|
||||
}
|
||||
|
||||
// 取得版本号
|
||||
public static String GetVersion(Context context) {
|
||||
try {
|
||||
PackageInfo manager = context.getPackageManager().getPackageInfo(
|
||||
context.getPackageName(), 0);
|
||||
return manager.versionName;
|
||||
} catch (NameNotFoundException e) {
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
public static void showToast(final String toast, final Context context)
|
||||
{
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Looper.prepare();
|
||||
Toast.makeText(context, toast, Toast.LENGTH_SHORT).show();
|
||||
Looper.loop();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static boolean isConnected(Context context) {
|
||||
ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo info = conn.getActiveNetworkInfo();
|
||||
return (info != null && info.isConnected());
|
||||
}
|
||||
|
||||
public static String getImei(Context context, String imei) {
|
||||
String ret = null;
|
||||
try {
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
ret = telephonyManager.getDeviceId();
|
||||
} catch (Exception e) {
|
||||
Logger.e(ExampleUtil.class.getSimpleName(), e.getMessage());
|
||||
}
|
||||
if (isReadableASCII(ret)){
|
||||
return ret;
|
||||
} else {
|
||||
return imei;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isReadableASCII(CharSequence string){
|
||||
if (TextUtils.isEmpty(string)) return false;
|
||||
try {
|
||||
Pattern p = Pattern.compile("[\\x20-\\x7E]+");
|
||||
return p.matcher(string).matches();
|
||||
} catch (Throwable e){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDeviceId(Context context) {
|
||||
return JPushInterface.getUdid(context);
|
||||
}
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
package com.tt.ttutils.sdk.jpush.jpushdemo;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by efan on 2017/4/14.
|
||||
*/
|
||||
|
||||
public final class LocalBroadcastManager {
|
||||
private static final String TAG = "JIGUANG-Example";
|
||||
private static final boolean DEBUG = false;
|
||||
private final Context mAppContext;
|
||||
private final HashMap<BroadcastReceiver, ArrayList<IntentFilter>> mReceivers = new HashMap<BroadcastReceiver, ArrayList<IntentFilter>>();
|
||||
private final HashMap<String, ArrayList<ReceiverRecord>> mActions = new HashMap<String, ArrayList<ReceiverRecord>> ();
|
||||
private final ArrayList<BroadcastRecord> mPendingBroadcasts = new ArrayList<BroadcastRecord>();
|
||||
static final int MSG_EXEC_PENDING_BROADCASTS = 1;
|
||||
private final Handler mHandler;
|
||||
private static final Object mLock = new Object();
|
||||
private static LocalBroadcastManager mInstance;
|
||||
|
||||
public static LocalBroadcastManager getInstance(Context context) {
|
||||
Object var1 = mLock;
|
||||
synchronized (mLock) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new LocalBroadcastManager(context.getApplicationContext());
|
||||
}
|
||||
|
||||
return mInstance;
|
||||
}
|
||||
}
|
||||
|
||||
private LocalBroadcastManager(Context context) {
|
||||
this.mAppContext = context;
|
||||
this.mHandler = new Handler(context.getMainLooper()) {
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case 1:
|
||||
LocalBroadcastManager.this.executePendingBroadcasts();
|
||||
break;
|
||||
default:
|
||||
super.handleMessage(msg);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
|
||||
HashMap var3 = this.mReceivers;
|
||||
synchronized (this.mReceivers) {
|
||||
ReceiverRecord entry = new ReceiverRecord(filter, receiver);
|
||||
ArrayList filters = (ArrayList) this.mReceivers.get(receiver);
|
||||
if (filters == null) {
|
||||
filters = new ArrayList(1);
|
||||
this.mReceivers.put(receiver, filters);
|
||||
}
|
||||
|
||||
filters.add(filter);
|
||||
|
||||
for (int i = 0; i < filter.countActions(); ++i) {
|
||||
String action = filter.getAction(i);
|
||||
ArrayList entries = (ArrayList) this.mActions.get(action);
|
||||
if (entries == null) {
|
||||
entries = new ArrayList(1);
|
||||
this.mActions.put(action, entries);
|
||||
}
|
||||
|
||||
entries.add(entry);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterReceiver(BroadcastReceiver receiver) {
|
||||
HashMap var2 = this.mReceivers;
|
||||
synchronized (this.mReceivers) {
|
||||
ArrayList filters = (ArrayList) this.mReceivers.remove(receiver);
|
||||
if (filters != null) {
|
||||
for (int i = 0; i < filters.size(); ++i) {
|
||||
IntentFilter filter = (IntentFilter) filters.get(i);
|
||||
|
||||
for (int j = 0; j < filter.countActions(); ++j) {
|
||||
String action = filter.getAction(j);
|
||||
ArrayList receivers = (ArrayList) this.mActions.get(action);
|
||||
if (receivers != null) {
|
||||
for (int k = 0; k < receivers.size(); ++k) {
|
||||
if (((ReceiverRecord) receivers.get(k)).receiver == receiver) {
|
||||
receivers.remove(k);
|
||||
--k;
|
||||
}
|
||||
}
|
||||
|
||||
if (receivers.size() <= 0) {
|
||||
this.mActions.remove(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean sendBroadcast(Intent intent) {
|
||||
HashMap var2 = this.mReceivers;
|
||||
synchronized (this.mReceivers) {
|
||||
String action = intent.getAction();
|
||||
String type = intent.resolveTypeIfNeeded(this.mAppContext.getContentResolver());
|
||||
Uri data = intent.getData();
|
||||
String scheme = intent.getScheme();
|
||||
Set categories = intent.getCategories();
|
||||
boolean debug = (intent.getFlags() & 8) != 0;
|
||||
if (debug) {
|
||||
Logger.v("LocalBroadcastManager", "Resolving type " + type + " scheme " + scheme + " of intent " + intent);
|
||||
}
|
||||
|
||||
ArrayList entries = (ArrayList) this.mActions.get(intent.getAction());
|
||||
if (entries != null) {
|
||||
if (debug) {
|
||||
Logger.v("LocalBroadcastManager", "Action list: " + entries);
|
||||
}
|
||||
|
||||
ArrayList receivers = null;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < entries.size(); ++i) {
|
||||
ReceiverRecord receiver = (ReceiverRecord) entries.get(i);
|
||||
if (debug) {
|
||||
Logger.v("LocalBroadcastManager", "Matching against filter " + receiver.filter);
|
||||
}
|
||||
|
||||
if (receiver.broadcasting) {
|
||||
if (debug) {
|
||||
Logger.v("LocalBroadcastManager", " Filter\'s target already added");
|
||||
}
|
||||
} else {
|
||||
int match = receiver.filter.match(action, type, scheme, data, categories, "LocalBroadcastManager");
|
||||
if (match >= 0) {
|
||||
if (debug) {
|
||||
Logger.v("LocalBroadcastManager", " Filter matched! match=0x" + Integer.toHexString(match));
|
||||
}
|
||||
|
||||
if (receivers == null) {
|
||||
receivers = new ArrayList();
|
||||
}
|
||||
|
||||
receivers.add(receiver);
|
||||
receiver.broadcasting = true;
|
||||
} else if (debug) {
|
||||
String reason;
|
||||
switch (match) {
|
||||
case -4:
|
||||
reason = "category";
|
||||
break;
|
||||
case -3:
|
||||
reason = "action";
|
||||
break;
|
||||
case -2:
|
||||
reason = "data";
|
||||
break;
|
||||
case -1:
|
||||
reason = "type";
|
||||
break;
|
||||
default:
|
||||
reason = "unknown reason";
|
||||
}
|
||||
|
||||
Logger.v("LocalBroadcastManager", " Filter did not match: " + reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (receivers != null) {
|
||||
for (i = 0; i < receivers.size(); ++i) {
|
||||
((ReceiverRecord) receivers.get(i)).broadcasting = false;
|
||||
}
|
||||
|
||||
this.mPendingBroadcasts.add(new BroadcastRecord(intent, receivers));
|
||||
if (!this.mHandler.hasMessages(1)) {
|
||||
this.mHandler.sendEmptyMessage(1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendBroadcastSync(Intent intent) {
|
||||
if (this.sendBroadcast(intent)) {
|
||||
this.executePendingBroadcasts();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void executePendingBroadcasts() {
|
||||
while (true) {
|
||||
BroadcastRecord[] brs = null;
|
||||
HashMap i = this.mReceivers;
|
||||
synchronized (this.mReceivers) {
|
||||
int br = this.mPendingBroadcasts.size();
|
||||
if (br <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
brs = new BroadcastRecord[br];
|
||||
this.mPendingBroadcasts.toArray(brs);
|
||||
this.mPendingBroadcasts.clear();
|
||||
}
|
||||
|
||||
for (int var6 = 0; var6 < brs.length; ++var6) {
|
||||
BroadcastRecord var7 = brs[var6];
|
||||
|
||||
for (int j = 0; j < var7.receivers.size(); ++j) {
|
||||
((ReceiverRecord) var7.receivers.get(j)).receiver.onReceive(this.mAppContext, var7.intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class BroadcastRecord {
|
||||
final Intent intent;
|
||||
final ArrayList<ReceiverRecord> receivers;
|
||||
|
||||
BroadcastRecord(Intent _intent, ArrayList<ReceiverRecord> _receivers) {
|
||||
this.intent = _intent;
|
||||
this.receivers = _receivers;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ReceiverRecord {
|
||||
final IntentFilter filter;
|
||||
final BroadcastReceiver receiver;
|
||||
boolean broadcasting;
|
||||
|
||||
ReceiverRecord(IntentFilter _filter, BroadcastReceiver _receiver) {
|
||||
this.filter = _filter;
|
||||
this.receiver = _receiver;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder(128);
|
||||
builder.append("Receiver{");
|
||||
builder.append(this.receiver);
|
||||
builder.append(" filter=");
|
||||
builder.append(this.filter);
|
||||
builder.append("}");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.tt.ttutils.sdk.jpush.jpushdemo;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.tt.ttutils.BuildConfig;
|
||||
|
||||
/**
|
||||
* Created by efan on 2017/4/13.
|
||||
*/
|
||||
|
||||
public class Logger {
|
||||
|
||||
//设为false关闭日志
|
||||
private static final boolean LOG_ENABLE = BuildConfig.DEBUG;
|
||||
|
||||
public static void i(String tag, String msg){
|
||||
if (LOG_ENABLE){
|
||||
Log.i(tag, msg);
|
||||
}
|
||||
}
|
||||
public static void v(String tag, String msg){
|
||||
if (LOG_ENABLE){
|
||||
Log.v(tag, msg);
|
||||
}
|
||||
}
|
||||
public static void d(String tag, String msg){
|
||||
if (LOG_ENABLE){
|
||||
Log.d(tag, msg);
|
||||
}
|
||||
}
|
||||
public static void w(String tag, String msg){
|
||||
if (LOG_ENABLE){
|
||||
Log.w(tag, msg);
|
||||
}
|
||||
}
|
||||
public static void e(String tag, String msg){
|
||||
if (LOG_ENABLE){
|
||||
Log.e(tag, msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
package com.tt.ttutils.sdk.jpush.jpushdemo;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
|
||||
/**
|
||||
* 自定义接收器
|
||||
*
|
||||
* 如果不定义这个 Receiver,则:
|
||||
* 1) 默认用户会打开主界面
|
||||
* 2) 接收不到自定义消息
|
||||
*/
|
||||
public class MyReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "JIGUANG-Example";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
Bundle bundle = intent.getExtras();
|
||||
Logger.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
|
||||
|
||||
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
|
||||
String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
|
||||
Logger.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
|
||||
//send the Registration Id to your server...
|
||||
|
||||
} else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
|
||||
Logger.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
|
||||
// processCustomMessage(context, bundle);
|
||||
|
||||
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
|
||||
Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知");
|
||||
int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
|
||||
Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
|
||||
|
||||
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
|
||||
Logger.d(TAG, "[MyReceiver] 用户点击打开了通知");
|
||||
|
||||
//打开自定义的Activity
|
||||
Intent i = new Intent(context, TestActivity.class);
|
||||
i.putExtras(bundle);
|
||||
//i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
|
||||
context.startActivity(i);
|
||||
|
||||
} else if(JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
|
||||
boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
|
||||
Logger.w(TAG, "[MyReceiver]" + intent.getAction() +" connected state change to "+connected);
|
||||
} else {
|
||||
Logger.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
|
||||
}
|
||||
} catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 打印所有的 intent extra 数据
|
||||
private static String printBundle(Bundle bundle) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String key : bundle.keySet()) {
|
||||
if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
|
||||
sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
|
||||
}else if(key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)){
|
||||
sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
|
||||
} else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
|
||||
if (TextUtils.isEmpty(bundle.getString(JPushInterface.EXTRA_EXTRA))) {
|
||||
Logger.i(TAG, "This message has no Extra data");
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
|
||||
Iterator<String> it = json.keys();
|
||||
|
||||
while (it.hasNext()) {
|
||||
String myKey = it.next();
|
||||
sb.append("\nkey:" + key + ", value: [" +
|
||||
myKey + " - " +json.optString(myKey) + "]");
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Logger.e(TAG, "Get message extra JSON error!");
|
||||
}
|
||||
|
||||
} else {
|
||||
sb.append("\nkey:" + key + ", value:" + bundle.get(key));
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
//send msg to MainActivity
|
||||
// private void processCustomMessage(Context context, Bundle bundle) {
|
||||
// if (MainActivity.isForeground) {
|
||||
// String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
|
||||
// String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
|
||||
// Intent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);
|
||||
// msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
|
||||
// if (!ExampleUtil.isEmpty(extras)) {
|
||||
// try {
|
||||
// JSONObject extraJson = new JSONObject(extras);
|
||||
// if (extraJson.length() > 0) {
|
||||
// msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
|
||||
// }
|
||||
// } catch (JSONException e) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package com.tt.ttutils.sdk.jpush.jpushdemo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import cn.jpush.android.api.CmdMessage;
|
||||
import cn.jpush.android.api.CustomMessage;
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import cn.jpush.android.api.JPushMessage;
|
||||
import cn.jpush.android.api.NotificationMessage;
|
||||
import cn.jpush.android.service.JPushMessageReceiver;
|
||||
|
||||
public class PushMessageReceiver extends JPushMessageReceiver{
|
||||
private static final String TAG = "PushMessageReceiver";
|
||||
@Override
|
||||
public void onMessage(Context context, CustomMessage customMessage) {
|
||||
Log.e(TAG,"[onMessage] "+customMessage);
|
||||
// processCustomMessage(context,customMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotifyMessageOpened(Context context, NotificationMessage message) {
|
||||
Log.e(TAG,"[onNotifyMessageOpened] "+message);
|
||||
try{
|
||||
//打开自定义的Activity
|
||||
Intent i = new Intent(context, TestActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(JPushInterface.EXTRA_NOTIFICATION_TITLE,message.notificationTitle);
|
||||
bundle.putString(JPushInterface.EXTRA_ALERT,message.notificationContent);
|
||||
i.putExtras(bundle);
|
||||
//i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
|
||||
context.startActivity(i);
|
||||
}catch (Throwable throwable){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMultiActionClicked(Context context, Intent intent) {
|
||||
Log.e(TAG, "[onMultiActionClicked] 用户点击了通知栏按钮");
|
||||
String nActionExtra = intent.getExtras().getString(JPushInterface.EXTRA_NOTIFICATION_ACTION_EXTRA);
|
||||
|
||||
//开发者根据不同 Action 携带的 extra 字段来分配不同的动作。
|
||||
if(nActionExtra==null){
|
||||
Log.d(TAG,"ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null");
|
||||
return;
|
||||
}
|
||||
if (nActionExtra.equals("my_extra1")) {
|
||||
Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮一");
|
||||
} else if (nActionExtra.equals("my_extra2")) {
|
||||
Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮二");
|
||||
} else if (nActionExtra.equals("my_extra3")) {
|
||||
Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮三");
|
||||
} else {
|
||||
Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮未定义");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotifyMessageArrived(Context context, NotificationMessage message) {
|
||||
Log.e(TAG,"[onNotifyMessageArrived] "+message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotifyMessageDismiss(Context context, NotificationMessage message) {
|
||||
Log.e(TAG,"[onNotifyMessageDismiss] "+message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegister(Context context, String registrationId) {
|
||||
Log.e(TAG,"[onRegister] "+registrationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(Context context, boolean isConnected) {
|
||||
Log.e(TAG,"[onConnected] "+isConnected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommandResult(Context context, CmdMessage cmdMessage) {
|
||||
Log.e(TAG,"[onCommandResult] "+cmdMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTagOperatorResult(Context context,JPushMessage jPushMessage) {
|
||||
TagAliasOperatorHelper.getInstance().onTagOperatorResult(context,jPushMessage);
|
||||
super.onTagOperatorResult(context, jPushMessage);
|
||||
}
|
||||
@Override
|
||||
public void onCheckTagOperatorResult(Context context,JPushMessage jPushMessage){
|
||||
TagAliasOperatorHelper.getInstance().onCheckTagOperatorResult(context,jPushMessage);
|
||||
super.onCheckTagOperatorResult(context, jPushMessage);
|
||||
}
|
||||
@Override
|
||||
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
|
||||
TagAliasOperatorHelper.getInstance().onAliasOperatorResult(context,jPushMessage);
|
||||
super.onAliasOperatorResult(context, jPushMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
|
||||
TagAliasOperatorHelper.getInstance().onMobileNumberOperatorResult(context,jPushMessage);
|
||||
super.onMobileNumberOperatorResult(context, jPushMessage);
|
||||
}
|
||||
|
||||
//send msg to MainActivity
|
||||
// private void processCustomMessage(Context context, CustomMessage customMessage) {
|
||||
// if (MainActivity.isForeground) {
|
||||
// String message = customMessage.message;
|
||||
// String extras = customMessage.extra;
|
||||
// Intent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);
|
||||
// msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
|
||||
// if (!ExampleUtil.isEmpty(extras)) {
|
||||
// try {
|
||||
// JSONObject extraJson = new JSONObject(extras);
|
||||
// if (extraJson.length() > 0) {
|
||||
// msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
|
||||
// }
|
||||
// } catch (JSONException e) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onNotificationSettingsCheck(Context context, boolean isOn, int source) {
|
||||
super.onNotificationSettingsCheck(context, isOn, source);
|
||||
Log.e(TAG,"[onNotificationSettingsCheck] isOn:"+isOn+",source:"+source);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.tt.ttutils.sdk.jpush.jpushdemo;
|
||||
|
||||
|
||||
import cn.jpush.android.service.JCommonService;
|
||||
|
||||
public class PushService extends JCommonService {
|
||||
|
||||
}
|
||||
@@ -1,338 +0,0 @@
|
||||
package com.tt.ttutils.sdk.jpush.jpushdemo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import cn.jpush.android.api.JPushMessage;
|
||||
|
||||
/**
|
||||
* 处理tagalias相关的逻辑
|
||||
* */
|
||||
public class TagAliasOperatorHelper {
|
||||
private static final String TAG = "JIGUANG-TagAliasHelper";
|
||||
public static int sequence = 1;
|
||||
/**增加*/
|
||||
public static final int ACTION_ADD = 1;
|
||||
/**覆盖*/
|
||||
public static final int ACTION_SET = 2;
|
||||
/**删除部分*/
|
||||
public static final int ACTION_DELETE = 3;
|
||||
/**删除所有*/
|
||||
public static final int ACTION_CLEAN = 4;
|
||||
/**查询*/
|
||||
public static final int ACTION_GET = 5;
|
||||
|
||||
public static final int ACTION_CHECK = 6;
|
||||
|
||||
public static final int DELAY_SEND_ACTION = 1;
|
||||
|
||||
public static final int DELAY_SET_MOBILE_NUMBER_ACTION = 2;
|
||||
|
||||
private Context context;
|
||||
|
||||
private static TagAliasOperatorHelper mInstance;
|
||||
private TagAliasOperatorHelper(){
|
||||
}
|
||||
public static TagAliasOperatorHelper getInstance(){
|
||||
if(mInstance == null){
|
||||
synchronized (TagAliasOperatorHelper.class){
|
||||
if(mInstance == null){
|
||||
mInstance = new TagAliasOperatorHelper();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
public void init(Context context){
|
||||
if(context != null) {
|
||||
this.context = context.getApplicationContext();
|
||||
}
|
||||
}
|
||||
private SparseArray<Object> setActionCache = new SparseArray<Object>();
|
||||
|
||||
public Object get(int sequence){
|
||||
return setActionCache.get(sequence);
|
||||
}
|
||||
public Object remove(int sequence){
|
||||
return setActionCache.get(sequence);
|
||||
}
|
||||
public void put(int sequence,Object tagAliasBean){
|
||||
setActionCache.put(sequence,tagAliasBean);
|
||||
}
|
||||
private Handler delaySendHandler = new Handler(){
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what){
|
||||
case DELAY_SEND_ACTION:
|
||||
if(msg.obj !=null && msg.obj instanceof TagAliasBean){
|
||||
Logger.i(TAG,"on delay time");
|
||||
sequence++;
|
||||
TagAliasBean tagAliasBean = (TagAliasBean) msg.obj;
|
||||
setActionCache.put(sequence, tagAliasBean);
|
||||
if(context!=null) {
|
||||
handleAction(context, sequence, tagAliasBean);
|
||||
}else{
|
||||
Logger.e(TAG,"#unexcepted - context was null");
|
||||
}
|
||||
}else{
|
||||
Logger.w(TAG,"#unexcepted - msg obj was incorrect");
|
||||
}
|
||||
break;
|
||||
case DELAY_SET_MOBILE_NUMBER_ACTION:
|
||||
if(msg.obj !=null && msg.obj instanceof String) {
|
||||
Logger.i(TAG, "retry set mobile number");
|
||||
sequence++;
|
||||
String mobileNumber = (String) msg.obj;
|
||||
setActionCache.put(sequence, mobileNumber);
|
||||
if(context !=null) {
|
||||
handleAction(context, sequence, mobileNumber);
|
||||
}else {
|
||||
Logger.e(TAG, "#unexcepted - context was null");
|
||||
}
|
||||
}else{
|
||||
Logger.w(TAG,"#unexcepted - msg obj was incorrect");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
public void handleAction(Context context,int sequence,String mobileNumber){
|
||||
put(sequence,mobileNumber);
|
||||
Logger.d(TAG,"sequence:"+sequence+",mobileNumber:"+mobileNumber);
|
||||
JPushInterface.setMobileNumber(context,sequence,mobileNumber);
|
||||
}
|
||||
/**
|
||||
* 处理设置tag
|
||||
* */
|
||||
public void handleAction(Context context,int sequence, TagAliasBean tagAliasBean){
|
||||
init(context);
|
||||
if(tagAliasBean == null){
|
||||
Logger.w(TAG,"tagAliasBean was null");
|
||||
return;
|
||||
}
|
||||
put(sequence,tagAliasBean);
|
||||
if(tagAliasBean.isAliasAction){
|
||||
switch (tagAliasBean.action){
|
||||
case ACTION_GET:
|
||||
JPushInterface.getAlias(context,sequence);
|
||||
break;
|
||||
case ACTION_DELETE:
|
||||
JPushInterface.deleteAlias(context,sequence);
|
||||
break;
|
||||
case ACTION_SET:
|
||||
JPushInterface.setAlias(context,sequence,tagAliasBean.alias);
|
||||
break;
|
||||
default:
|
||||
Logger.w(TAG,"unsupport alias action type");
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
switch (tagAliasBean.action) {
|
||||
case ACTION_ADD:
|
||||
JPushInterface.addTags(context, sequence, tagAliasBean.tags);
|
||||
break;
|
||||
case ACTION_SET:
|
||||
JPushInterface.setTags(context, sequence, tagAliasBean.tags);
|
||||
break;
|
||||
case ACTION_DELETE:
|
||||
JPushInterface.deleteTags(context, sequence, tagAliasBean.tags);
|
||||
break;
|
||||
case ACTION_CHECK:
|
||||
//一次只能check一个tag
|
||||
String tag = (String)tagAliasBean.tags.toArray()[0];
|
||||
JPushInterface.checkTagBindState(context,sequence,tag);
|
||||
break;
|
||||
case ACTION_GET:
|
||||
JPushInterface.getAllTags(context, sequence);
|
||||
break;
|
||||
case ACTION_CLEAN:
|
||||
JPushInterface.cleanTags(context, sequence);
|
||||
break;
|
||||
default:
|
||||
Logger.w(TAG,"unsupport tag action type");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
private boolean RetryActionIfNeeded(int errorCode,TagAliasBean tagAliasBean){
|
||||
if(!ExampleUtil.isConnected(context)){
|
||||
Logger.w(TAG,"no network");
|
||||
return false;
|
||||
}
|
||||
//返回的错误码为6002 超时,6014 服务器繁忙,都建议延迟重试
|
||||
if(errorCode == 6002 || errorCode == 6014){
|
||||
Logger.d(TAG,"need retry");
|
||||
if(tagAliasBean!=null){
|
||||
Message message = new Message();
|
||||
message.what = DELAY_SEND_ACTION;
|
||||
message.obj = tagAliasBean;
|
||||
delaySendHandler.sendMessageDelayed(message,1000*60);
|
||||
String logs =getRetryStr(tagAliasBean.isAliasAction, tagAliasBean.action,errorCode);
|
||||
ExampleUtil.showToast(logs, context);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean RetrySetMObileNumberActionIfNeeded(int errorCode,String mobileNumber){
|
||||
if(!ExampleUtil.isConnected(context)){
|
||||
Logger.w(TAG,"no network");
|
||||
return false;
|
||||
}
|
||||
//返回的错误码为6002 超时,6024 服务器内部错误,建议稍后重试
|
||||
if(errorCode == 6002 || errorCode == 6024){
|
||||
Logger.d(TAG,"need retry");
|
||||
Message message = new Message();
|
||||
message.what = DELAY_SET_MOBILE_NUMBER_ACTION;
|
||||
message.obj = mobileNumber;
|
||||
delaySendHandler.sendMessageDelayed(message,1000*60);
|
||||
String str = "Failed to set mobile number due to %s. Try again after 60s.";
|
||||
str = String.format(Locale.ENGLISH,str,(errorCode == 6002 ? "timeout" : "server internal error”"));
|
||||
ExampleUtil.showToast(str, context);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
private String getRetryStr(boolean isAliasAction,int actionType,int errorCode){
|
||||
String str = "Failed to %s %s due to %s. Try again after 60s.";
|
||||
str = String.format(Locale.ENGLISH,str,getActionStr(actionType),(isAliasAction? "alias" : " tags") ,(errorCode == 6002 ? "timeout" : "server too busy"));
|
||||
return str;
|
||||
}
|
||||
|
||||
private String getActionStr(int actionType){
|
||||
switch (actionType){
|
||||
case ACTION_ADD:
|
||||
return "add";
|
||||
case ACTION_SET:
|
||||
return "set";
|
||||
case ACTION_DELETE:
|
||||
return "delete";
|
||||
case ACTION_GET:
|
||||
return "get";
|
||||
case ACTION_CLEAN:
|
||||
return "clean";
|
||||
case ACTION_CHECK:
|
||||
return "check";
|
||||
}
|
||||
return "unkonw operation";
|
||||
}
|
||||
public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
|
||||
int sequence = jPushMessage.getSequence();
|
||||
Logger.i(TAG,"action - onTagOperatorResult, sequence:"+sequence+",tags:"+jPushMessage.getTags());
|
||||
Logger.i(TAG,"tags size:"+jPushMessage.getTags().size());
|
||||
init(context);
|
||||
//根据sequence从之前操作缓存中获取缓存记录
|
||||
TagAliasBean tagAliasBean = (TagAliasBean)setActionCache.get(sequence);
|
||||
if(tagAliasBean == null){
|
||||
ExampleUtil.showToast("获取缓存记录失败", context);
|
||||
return;
|
||||
}
|
||||
if(jPushMessage.getErrorCode() == 0){
|
||||
Logger.i(TAG,"action - modify tag Success,sequence:"+sequence);
|
||||
setActionCache.remove(sequence);
|
||||
String logs = getActionStr(tagAliasBean.action)+" tags success";
|
||||
Logger.i(TAG,logs);
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}else{
|
||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" tags";
|
||||
if(jPushMessage.getErrorCode() == 6018){
|
||||
//tag数量超过限制,需要先清除一部分再add
|
||||
logs += ", tags is exceed limit need to clean";
|
||||
}
|
||||
logs += ", errorCode:" + jPushMessage.getErrorCode();
|
||||
Logger.e(TAG, logs);
|
||||
if(!RetryActionIfNeeded(jPushMessage.getErrorCode(),tagAliasBean)) {
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage){
|
||||
int sequence = jPushMessage.getSequence();
|
||||
Logger.i(TAG,"action - onCheckTagOperatorResult, sequence:"+sequence+",checktag:"+jPushMessage.getCheckTag());
|
||||
init(context);
|
||||
//根据sequence从之前操作缓存中获取缓存记录
|
||||
TagAliasBean tagAliasBean = (TagAliasBean)setActionCache.get(sequence);
|
||||
if(tagAliasBean == null){
|
||||
ExampleUtil.showToast("获取缓存记录失败", context);
|
||||
return;
|
||||
}
|
||||
if(jPushMessage.getErrorCode() == 0){
|
||||
Logger.i(TAG,"tagBean:"+tagAliasBean);
|
||||
setActionCache.remove(sequence);
|
||||
String logs = getActionStr(tagAliasBean.action)+" tag "+jPushMessage.getCheckTag() + " bind state success,state:"+jPushMessage.getTagCheckStateResult();
|
||||
Logger.i(TAG,logs);
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}else{
|
||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" tags, errorCode:" + jPushMessage.getErrorCode();
|
||||
Logger.e(TAG, logs);
|
||||
if(!RetryActionIfNeeded(jPushMessage.getErrorCode(),tagAliasBean)) {
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
|
||||
int sequence = jPushMessage.getSequence();
|
||||
Logger.i(TAG,"action - onAliasOperatorResult, sequence:"+sequence+",alias:"+jPushMessage.getAlias());
|
||||
init(context);
|
||||
//根据sequence从之前操作缓存中获取缓存记录
|
||||
TagAliasBean tagAliasBean = (TagAliasBean)setActionCache.get(sequence);
|
||||
if(tagAliasBean == null){
|
||||
ExampleUtil.showToast("获取缓存记录失败", context);
|
||||
return;
|
||||
}
|
||||
if(jPushMessage.getErrorCode() == 0){
|
||||
Logger.i(TAG,"action - modify alias Success,sequence:"+sequence);
|
||||
setActionCache.remove(sequence);
|
||||
String logs = getActionStr(tagAliasBean.action)+" alias success";
|
||||
Logger.i(TAG,logs);
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}else{
|
||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" alias, errorCode:" + jPushMessage.getErrorCode();
|
||||
Logger.e(TAG, logs);
|
||||
if(!RetryActionIfNeeded(jPushMessage.getErrorCode(),tagAliasBean)) {
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
//设置手机号码回调
|
||||
public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
|
||||
int sequence = jPushMessage.getSequence();
|
||||
Logger.i(TAG,"action - onMobileNumberOperatorResult, sequence:"+sequence+",mobileNumber:"+jPushMessage.getMobileNumber());
|
||||
init(context);
|
||||
if(jPushMessage.getErrorCode() == 0){
|
||||
Logger.i(TAG,"action - set mobile number Success,sequence:"+sequence);
|
||||
setActionCache.remove(sequence);
|
||||
}else{
|
||||
String logs = "Failed to set mobile number, errorCode:" + jPushMessage.getErrorCode();
|
||||
Logger.e(TAG, logs);
|
||||
if(!RetrySetMObileNumberActionIfNeeded(jPushMessage.getErrorCode(),jPushMessage.getMobileNumber())){
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class TagAliasBean{
|
||||
int action;
|
||||
Set<String> tags;
|
||||
String alias;
|
||||
boolean isAliasAction;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TagAliasBean{" +
|
||||
"action=" + action +
|
||||
", tags=" + tags +
|
||||
", alias='" + alias + '\'' +
|
||||
", isAliasAction=" + isAliasAction +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.tt.ttutils.sdk.jpush.jpushdemo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
|
||||
public class TestActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
TextView tv = new TextView(this);
|
||||
tv.setText("用户自定义打开的Activity");
|
||||
Intent intent = getIntent();
|
||||
if (null != intent) {
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
String title = null;
|
||||
String content = null;
|
||||
if(bundle!=null){
|
||||
title = bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
|
||||
content = bundle.getString(JPushInterface.EXTRA_ALERT);
|
||||
}
|
||||
tv.setText("Title : " + title + " " + "Content : " + content);
|
||||
}
|
||||
addContentView(tv, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
package com.tt.ttutils.server.main;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.tt.ttutils.mvp.BasePresenter;
|
||||
import com.tt.ttutils.mvp.BaseView;
|
||||
|
||||
public class MainSContact {
|
||||
public interface MainView extends BaseView {
|
||||
//设置批次信息
|
||||
void setBatchText(String text, int visibility);
|
||||
//设置班级信息
|
||||
void setClassText(String text, int visibility);
|
||||
//设置学号信息
|
||||
void setNumberText(String text, int visibility);
|
||||
//设置姓名信息
|
||||
void setNameText(String text, int visibility);
|
||||
//获取设备锁定状态
|
||||
void setLockedState(boolean loocked);
|
||||
//是否第一次联网
|
||||
void setFirstConnect(boolean state);
|
||||
//发送mac地址
|
||||
void sendMACFinished();
|
||||
//更新设备信息
|
||||
void updateDeviceInfoFinished();
|
||||
//获取时间管控
|
||||
void getSnTimeControlFinished();
|
||||
//设置击关推送别名
|
||||
void setAliasFinished();
|
||||
//设置极光推送标签
|
||||
void setTagsFinished();
|
||||
//设置极光推送平台标签
|
||||
void setJpushPlatformTagsFinished();
|
||||
//获取应用市场更新
|
||||
void checkStoreUpdateFinished();
|
||||
//获取测试应用更新
|
||||
void checkTestUpdateFinished();
|
||||
//手动获取设备信息更新
|
||||
void buttonCheckUpdateFinished(boolean update, JsonObject jsonObject);
|
||||
//开始
|
||||
//设置设备后台设置
|
||||
void getSystemSettingbegin();
|
||||
//获取可被写入的安装包名结束
|
||||
void getAppLimitFinished(String packageList);
|
||||
//获取设备批次结束
|
||||
void getDeviceBatchFinished();
|
||||
//获取强制下载apk结束
|
||||
void getForceDownloadFinished();
|
||||
//获取浏览器上网管控设置结束
|
||||
void getBrowserListFinished(String whitelist);
|
||||
//获取浏览器书签设置管控结束
|
||||
void getBrowserBookmarksFinished();
|
||||
//获取应用图标桌面可见性管控结束
|
||||
void getDesktopIconFinished();
|
||||
//获取应用自启升级和网络权限管理结束
|
||||
void getAppAutoStartUpdateAndNetFinished();
|
||||
//获取第三方应用子页面ID连网限制结束
|
||||
void getAppIDControlFinished();
|
||||
//获取第三方应用内部网页跳转屏蔽结束
|
||||
void setAppinsideWebFinished();
|
||||
//获取系统其他管控设置结束
|
||||
void setSystemSettingFinished();
|
||||
//获取开发者选项结束
|
||||
void getDeveloperFinished();
|
||||
//设置开机动画
|
||||
void setLogoImgFinished();
|
||||
//获取应用霸屏结束
|
||||
void setTopAppFinished();
|
||||
/*
|
||||
* MainService
|
||||
* */
|
||||
//设置屏幕锁状态结束
|
||||
void setScreenLockStateFinished(boolean locked, String tips);
|
||||
//获取桌面结束
|
||||
void getDefaultDesktopFinished();
|
||||
}
|
||||
|
||||
public interface Presenter extends BasePresenter<MainView> {
|
||||
//获取学生信息
|
||||
void getStudesInfo();
|
||||
//获取设备锁定状态
|
||||
void getLockedState();
|
||||
//是否第一次联网
|
||||
void getFirstConnect();
|
||||
//关闭所有功能
|
||||
void setDisableSetting();
|
||||
//发送mac地址
|
||||
void sendMACAddress();
|
||||
//更新设备信息
|
||||
void updateDeviceInfo();
|
||||
//获取时间管控
|
||||
void getSnTimeControl();
|
||||
//设置击关推送别名
|
||||
void setJpushAlias();
|
||||
//设置极光推送标签
|
||||
void setJpushTags();
|
||||
//设置极光推送平台标签
|
||||
void setJpushPlatformTags(int platform);
|
||||
//获取应用更新
|
||||
void checkStoreUpdate();
|
||||
//手动获取设备信息更新
|
||||
void buttonCheckUpdate(View view);
|
||||
//获取测试应用更新
|
||||
void checkTestUpdate();
|
||||
//开始
|
||||
//获取设备后台设置
|
||||
void getSystemSettingbegin();
|
||||
//获取可被写入的安装包名
|
||||
void getAppLimit();
|
||||
//获取设备批次
|
||||
void getDeviceBatch(String packageList);
|
||||
//获取强制下载apk
|
||||
void getForceDownload();
|
||||
//获取浏览器上网管控设置
|
||||
void getBrowserList();
|
||||
//获取浏览器书签设置管控
|
||||
void getBrowserBookmarks(String whitelist);
|
||||
//设置白名单的url
|
||||
void getBrowserWhiteList();
|
||||
//获取应用图标桌面可见性管控
|
||||
void getDesktopIcon();
|
||||
//获取应用自启升级和网络权限管理
|
||||
void getAppAutoStartUpdateAndNet();
|
||||
//获取第三方应用子页面ID连网限制
|
||||
void getAppIDControl();
|
||||
//获取第三方应用内部网页跳转屏蔽
|
||||
void setAppinsideWeb();
|
||||
//获取系统其他管控设置
|
||||
void setSystemSetting();
|
||||
//获取开发者选项
|
||||
void getDeveloper();
|
||||
//设置开机动画
|
||||
void setLogoImg();
|
||||
//应用霸屏
|
||||
void setTopApp();
|
||||
/*
|
||||
* MainService
|
||||
* */
|
||||
//获取屏幕锁状态
|
||||
void getScreenLockState();
|
||||
//获取桌面
|
||||
void getDefaultDesktop();
|
||||
}
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
package com.tt.ttutils.server.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.tt.ttutils.activity.main.MainAContact;
|
||||
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
|
||||
/**
|
||||
* MainActivity 的 Presenter
|
||||
*
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainSPresenter implements MainSContact.Presenter {
|
||||
private static final String TAG = MainSPresenter.class.getSimpleName();
|
||||
private MainSContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
private final String DEFAULT_INFO = "暂无信息";
|
||||
private final int OK = 200;
|
||||
|
||||
public MainSPresenter(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 MainSContact.MainView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getStudesInfo() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLockedState() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFirstConnect() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisableSetting() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendMACAddress() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceInfo() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnTimeControl() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJpushAlias() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJpushTags() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJpushPlatformTags(int platform) {
|
||||
mView.setJpushPlatformTagsFinished();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkStoreUpdate() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonCheckUpdate(View view) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkTestUpdate() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getSystemSettingbegin() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppLimit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeviceBatch(String packageList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getForceDownload() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBrowserList() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBrowserBookmarks(String whitelist) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBrowserWhiteList() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDesktopIcon() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppAutoStartUpdateAndNet() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppIDControl() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppinsideWeb() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSystemSetting() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeveloper() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogoImg() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTopApp() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getScreenLockState() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDefaultDesktop() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
|
||||
public class BitmapUtils {
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
||||
public class NetworkUtils {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
|
||||
public class OtherUtils {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
|
||||
public class SystemSignUtils {
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.tt.ttutils.utils.kt
|
||||
|
||||
class ApkUtils {
|
||||
|
||||
|
||||
}
|
||||
+209
-18
@@ -1,8 +1,11 @@
|
||||
package com.tt.ttutils.activity;
|
||||
package com.ttstd.ttutils.activity;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.app.StatusBarManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.provider.Settings;
|
||||
@@ -14,11 +17,17 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.tt.ttutils.BuildConfig;
|
||||
import com.tt.ttutils.R;
|
||||
import com.tt.ttutils.base.BaseActivity;
|
||||
import com.tt.ttutils.utils.java.JGYUtils;
|
||||
import com.tt.ttutils.utils.java.ToastUtil;
|
||||
import androidx.core.content.pm.ShortcutInfoCompat;
|
||||
import androidx.core.content.pm.ShortcutManagerCompat;
|
||||
import androidx.core.graphics.drawable.IconCompat;
|
||||
|
||||
import com.ttstd.ttutils.BuildConfig;
|
||||
import com.ttstd.ttutils.R;
|
||||
import com.ttstd.ttutils.activity.main.MainActivity;
|
||||
import com.ttstd.ttutils.base.BaseActivity;
|
||||
import com.ttstd.ttutils.receiver.ShortcutReceiver;
|
||||
import com.ttstd.ttutils.utils.java.JGYUtils;
|
||||
import com.ttstd.ttutils.utils.java.ToastUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -30,6 +39,8 @@ import butterknife.ButterKnife;
|
||||
public class AoleyunTestActivity extends BaseActivity {
|
||||
private static final String TAG = AoleyunTestActivity.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.bt_settings)
|
||||
Button bt_settings;
|
||||
@BindView(R.id.bt_usb)
|
||||
Button bt_usb;
|
||||
@BindView(R.id.bt_usb_statu)
|
||||
@@ -49,6 +60,8 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
Button bt_desktop_launcher;
|
||||
@BindView(R.id.bt_desktop_dop2)
|
||||
Button bt_desktop_dop2;
|
||||
@BindView(R.id.bt_desktop_aoleyun_os)
|
||||
Button bt_desktop_aoleyun_os;
|
||||
@BindView(R.id.bt_desktop_aoleyun)
|
||||
Button bt_desktop_aoleyun;
|
||||
|
||||
@@ -79,6 +92,15 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
@BindView(R.id.bt_navigation_off)
|
||||
Button bt_navigation_off;
|
||||
|
||||
@BindView(R.id.bt_statusbar)
|
||||
Button bt_statusbar;
|
||||
@BindView(R.id.bt_statusbar_back)
|
||||
Button bt_statusbar_back;
|
||||
@BindView(R.id.bt_statusbar_home)
|
||||
Button bt_statusbar_home;
|
||||
@BindView(R.id.bt_statusbar_recent)
|
||||
Button bt_statusbar_recent;
|
||||
|
||||
@BindView(R.id.bt_status)
|
||||
Button bt_status;
|
||||
@BindView(R.id.bt_status_statu)
|
||||
@@ -160,6 +182,25 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
@BindView(R.id.bt_app_off)
|
||||
Button bt_app_off;
|
||||
|
||||
@BindView(R.id.bt_night_on)
|
||||
Button bt_night_on;
|
||||
@BindView(R.id.bt_night_off)
|
||||
Button bt_night_off;
|
||||
@BindView(R.id.bt_read_on)
|
||||
Button bt_read_on;
|
||||
@BindView(R.id.bt_read_off)
|
||||
Button bt_read_off;
|
||||
|
||||
@BindView(R.id.bt_add_shortcut)
|
||||
Button bt_add_shortcut;
|
||||
|
||||
public static final String NIGHT_DISPLAY_ENABLED = "NIGHT_DISPLAY_ENABLED";
|
||||
public static final String NIGHT_DISPLAY_DISABLED = "NIGHT_DISPLAY_DISABLED";
|
||||
public static final String READ_MODEL_ENABLED = "READ_MODEL_ENABLED";
|
||||
public static final String READ_MODEL_DISABLED = "READ_MODEL_DISABLED";
|
||||
|
||||
StatusBarManager mStatusBarManager;
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_aoleyun_test;
|
||||
@@ -168,6 +209,24 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
|
||||
PackageManager pm = getPackageManager();
|
||||
try {
|
||||
Log.e(TAG, "initView: " + pm.getApplicationEnabledSetting("com.teclast.update"));
|
||||
pm.setApplicationEnabledSetting("com.teclast.update", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
// pm.getApplicationEnabledSetting("com.teclast.update") == PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.teclast.update", "com.teclast.update. GoogleOtaClient");
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
// ApkUtils.openApp(this, "com.android.settings");
|
||||
//静音
|
||||
@@ -179,7 +238,10 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, voiceMax, 0);
|
||||
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, musicMax, 0); //音乐音量
|
||||
}
|
||||
mStatusBarManager = (StatusBarManager) getApplicationContext().getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -188,10 +250,11 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
bt_usb_statu.setOnClickListener(new View.OnClickListener() {
|
||||
bt_settings.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ToastUtil.show("app_view_click_disabled");
|
||||
startActivity(new Intent(Settings.ACTION_SETTINGS));
|
||||
// startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS));
|
||||
}
|
||||
});
|
||||
bt_usb.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -201,10 +264,19 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
"com.android.gallery3d:12345,78901;com.android.settings:9876543,12346");
|
||||
}
|
||||
});
|
||||
bt_usb_statu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ToastUtil.show("app_view_click_disabled");
|
||||
}
|
||||
});
|
||||
bt_usb_charge.setOnClickListener(view -> {
|
||||
Log.e(TAG, "bt_usb_charge: " + view.getId());
|
||||
Intent usbIntent = new Intent("aole_action_usb_usb_charge");
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK8515Platform) {
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK8515Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.TeclastP20sPlatform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
|
||||
) {
|
||||
usbIntent.setPackage("com.android.settings");
|
||||
}
|
||||
sendBroadcast(usbIntent);
|
||||
@@ -212,7 +284,10 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
bt_usb_mtp.setOnClickListener(view -> {
|
||||
Log.e(TAG, "bt_usb_charge: " + view.getId());
|
||||
Intent usbIntent = new Intent("aole_action_usb_usb_mtp");
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK8515Platform) {
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK8515Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.TeclastP20sPlatform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
|
||||
) {
|
||||
usbIntent.setPackage("com.android.settings");
|
||||
}
|
||||
sendBroadcast(usbIntent);
|
||||
@@ -220,7 +295,9 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
bt_usb_midi.setOnClickListener(view -> {
|
||||
Log.e(TAG, "bt_usb_charge: " + view.getId());
|
||||
Intent usbIntent = new Intent("aole_action_usb_usb_midi");
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK8515Platform) {
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK8515Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.TeclastP20sPlatform
|
||||
) {
|
||||
usbIntent.setPackage("com.android.settings");
|
||||
}
|
||||
sendBroadcast(usbIntent);
|
||||
@@ -241,13 +318,24 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
});
|
||||
bt_desktop_aoleyun.setOnClickListener(view -> {
|
||||
bt_desktop_aoleyun_os.setOnClickListener(view -> {
|
||||
Intent intent = new Intent("setDefaultLauncher");
|
||||
intent.putExtra("package", "com.android.uiuios");
|
||||
intent.putExtra("className", "com.android.uiuios.Launcher");
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
});
|
||||
bt_desktop_aoleyun.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent("setDefaultLauncher");
|
||||
intent.putExtra("package", "com.aoleyun.os");
|
||||
intent.putExtra("className", "com.aoleyun.os.Launcher");
|
||||
intent.setPackage("com.android.settings");
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
bt_sd_statu.setOnClickListener(view -> {
|
||||
int aole_sdcard_forbid_on = Settings.System.getInt(getContentResolver(), "aole_sdcard_forbid_on", 0);
|
||||
@@ -285,6 +373,34 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
sendBroadcast(navIntent);
|
||||
});
|
||||
|
||||
bt_statusbar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE_RECENT | StatusBarManager.DISABLE_HOME);
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE_BACK | StatusBarManager.DISABLE_RECENT | StatusBarManager.DISABLE_HOME);
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);//显示隐藏的虚拟按键
|
||||
}
|
||||
});
|
||||
bt_statusbar_back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_BACK);//隐藏返回键
|
||||
}
|
||||
});
|
||||
bt_statusbar_home.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_HOME);//隐藏home键
|
||||
}
|
||||
});
|
||||
bt_statusbar_recent.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_RECENT);//隐藏recent键
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
bt_status_on.setOnClickListener(view -> {
|
||||
Intent navIntent = new Intent("aole_show_statusBar");
|
||||
// Intent navIntent = new Intent("aole_show_statusBar").setPackage("com.android.systemui");
|
||||
@@ -299,17 +415,19 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
bt_collapse_on.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
StatusBarManager mStatusBarManager = (StatusBarManager) getApplicationContext().getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND);
|
||||
// StatusBarManager mStatusBarManager = (StatusBarManager) getApplicationContext().getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND);
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE2_NOTIFICATION_SHADE);
|
||||
Settings.Global.putInt(getContentResolver(), "PULLDOWN_MENU_ENABLED", 1);
|
||||
}
|
||||
});
|
||||
|
||||
bt_collapse_off.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
StatusBarManager mStatusBarManager = (StatusBarManager) getApplicationContext().getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);
|
||||
Settings.Global.putInt(getContentResolver(), "PULLDOWN_MENU_ENABLED", 0);
|
||||
// StatusBarManager mStatusBarManager = (StatusBarManager) getApplicationContext().getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);
|
||||
// mStatusBarManager.disable(StatusBarManager.DISABLE2_NONE);
|
||||
}
|
||||
});
|
||||
@@ -369,7 +487,6 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
}
|
||||
});
|
||||
bt_browser_on.setOnClickListener(view -> {
|
||||
|
||||
Intent intent = new Intent("setDefaultBrowser");
|
||||
intent.putExtra("package", ("com.quark.browser"));
|
||||
intent.setPackage("com.android.settings");
|
||||
@@ -406,6 +523,79 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
Settings.System.putString(getContentResolver(), "aole_network_disallow", "");
|
||||
}
|
||||
});
|
||||
bt_night_on.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sendBroadcast(new Intent(NIGHT_DISPLAY_ENABLED));
|
||||
}
|
||||
});
|
||||
bt_night_off.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sendBroadcast(new Intent(NIGHT_DISPLAY_DISABLED));
|
||||
}
|
||||
});
|
||||
bt_read_on.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sendBroadcast(new Intent(READ_MODEL_ENABLED));
|
||||
}
|
||||
});
|
||||
bt_read_off.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sendBroadcast(new Intent(READ_MODEL_DISABLED));
|
||||
}
|
||||
});
|
||||
bt_add_shortcut.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// addShortcut(AoleyunTestActivity.this, new Intent(
|
||||
// AoleyunTestActivity.this, MainActivity.class), "TTUtilsTest", false,
|
||||
// ((BitmapDrawable) getResources().getDrawable(R.drawable.ic_launcher)).getBitmap());
|
||||
addShortCutCompact(AoleyunTestActivity.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static final String ACTION_INSTALL_SHORTCUT =
|
||||
"com.android.launcher.action.INSTALL_SHORTCUT";
|
||||
|
||||
/**
|
||||
* 添加快捷方式
|
||||
*
|
||||
* @param context context
|
||||
* @param actionIntent 要启动的Intent
|
||||
* @param name name
|
||||
*/
|
||||
public void addShortcut(Context context, Intent actionIntent, String name, boolean allowRepeat, Bitmap iconBitmap) {
|
||||
Intent addShortcutIntent = new Intent(ACTION_INSTALL_SHORTCUT);
|
||||
// 是否允许重复创建
|
||||
addShortcutIntent.putExtra("duplicate", allowRepeat);
|
||||
// 快捷方式的标题
|
||||
addShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
|
||||
// 快捷方式的图标
|
||||
addShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, iconBitmap);
|
||||
// 快捷方式的动作
|
||||
addShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, actionIntent);
|
||||
context.sendBroadcast(addShortcutIntent);
|
||||
}
|
||||
|
||||
public static void addShortCutCompact(Context context) {
|
||||
if (ShortcutManagerCompat.isRequestPinShortcutSupported(context)) {
|
||||
Intent shortcutInfoIntent = new Intent(context, MainActivity.class);
|
||||
shortcutInfoIntent.setAction(Intent.ACTION_VIEW); //action必须设置,不然报错
|
||||
ShortcutInfoCompat info = new ShortcutInfoCompat.Builder(context, "id")
|
||||
.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_launcher))
|
||||
.setShortLabel("name")
|
||||
.setIntent(shortcutInfoIntent)
|
||||
.build();
|
||||
//当添加快捷方式的确认弹框弹出来时,将被回调,自定义Receiver
|
||||
PendingIntent shortcutCallbackIntent = PendingIntent.getBroadcast(context, 0, new Intent(context, ShortcutReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
ShortcutManagerCompat.requestPinShortcut(context, info,
|
||||
shortcutCallbackIntent.getIntentSender());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -448,6 +638,8 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
public void setDeveloperOptions(int state) {
|
||||
Settings.System.putInt(getContentResolver(), "aole_Developeroptions", state);
|
||||
|
||||
Log.e(TAG, "setDeveloperOptions: " + state);
|
||||
Settings.System.putInt(getContentResolver(), "aole_Developeroptions", state);
|
||||
int old_dev_enabled = Settings.Global.getInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
||||
@@ -466,6 +658,5 @@ public class AoleyunTestActivity extends BaseActivity {
|
||||
} else {
|
||||
Log.e(TAG, "setDeveloperOptions: " + "打开开发者模式");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.activity
|
||||
package com.ttstd.ttutils.activity
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
@@ -11,12 +11,11 @@ import android.util.Log
|
||||
import android.widget.Button
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.notepad.uiui.INoteAidlInterface
|
||||
import com.tt.ttutils.R
|
||||
import com.tt.ttutils.utils.java.DevicesUtils
|
||||
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
|
||||
import kotlin.math.log
|
||||
|
||||
|
||||
class KotlinMainActivity : AppCompatActivity(), CancelAdapt {
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.activity;
|
||||
package com.ttstd.ttutils.activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
@@ -6,8 +6,8 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.tt.ttutils.receiver.PackageReceiver;
|
||||
import com.tt.ttutils.R;
|
||||
import com.ttstd.ttutils.receiver.PackageReceiver;
|
||||
import com.ttstd.ttutils.R;
|
||||
|
||||
public class PackageActivity extends AppCompatActivity {
|
||||
private PackageReceiver packageReceiver;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.tt.ttutils.activity.main;
|
||||
package com.ttstd.ttutils.activity.main;
|
||||
|
||||
import com.tt.ttutils.mvp.BasePresenter;
|
||||
import com.tt.ttutils.mvp.BaseView;
|
||||
import com.ttstd.ttutils.mvp.BasePresenter;
|
||||
import com.ttstd.ttutils.mvp.BaseView;
|
||||
|
||||
public class MainAContact {
|
||||
public interface MainView extends BaseView {
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
package com.tt.ttutils.activity.main;
|
||||
package com.ttstd.ttutils.activity.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
+9
-9
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.activity.main;
|
||||
package com.ttstd.ttutils.activity.main;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
@@ -24,14 +24,14 @@ import android.widget.Toast;
|
||||
|
||||
import com.jiaoguanyi.appstore.IGetLicenseInterface;
|
||||
import com.notepad.uiui.INoteAidlInterface;
|
||||
import com.tt.ttutils.base.ImmerseBaseActivity;
|
||||
import com.tt.ttutils.server.main.MainService;
|
||||
import com.tt.ttutils.R;
|
||||
import com.tt.ttutils.utils.java.CmdUtil;
|
||||
import com.tt.ttutils.utils.java.JGYUtils;
|
||||
import com.tt.ttutils.utils.java.TTUtils;
|
||||
import com.tt.ttutils.utils.java.ToastUtil;
|
||||
import com.tt.ttutils.utils.jni.NDKTools;
|
||||
import com.ttstd.ttutils.base.ImmerseBaseActivity;
|
||||
import com.ttstd.ttutils.server.main.MainService;
|
||||
import com.ttstd.ttutils.R;
|
||||
import com.ttstd.ttutils.utils.java.CmdUtil;
|
||||
import com.ttstd.ttutils.utils.java.JGYUtils;
|
||||
import com.ttstd.ttutils.utils.java.TTUtils;
|
||||
import com.ttstd.ttutils.utils.java.ToastUtil;
|
||||
import com.ttstd.ttutils.utils.jni.NDKTools;
|
||||
import com.uiui.sn.IGetInfoInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.tt.ttutils.activity.retrofit;
|
||||
package com.ttstd.ttutils.activity.retrofit;
|
||||
|
||||
import com.tt.ttutils.R;
|
||||
import com.tt.ttutils.base.BaseActivity;
|
||||
import com.ttstd.ttutils.R;
|
||||
import com.ttstd.ttutils.base.BaseActivity;
|
||||
|
||||
public class RetrofitActivity extends BaseActivity implements RetrofitContact.MainView {
|
||||
private RetrofitPresenter mRetrofitPresenter;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.tt.ttutils.activity.retrofit;
|
||||
package com.ttstd.ttutils.activity.retrofit;
|
||||
|
||||
import com.tt.ttutils.mvp.BasePresenter;
|
||||
import com.tt.ttutils.mvp.BaseView;
|
||||
import com.ttstd.ttutils.mvp.BasePresenter;
|
||||
import com.ttstd.ttutils.mvp.BaseView;
|
||||
|
||||
public class RetrofitContact {
|
||||
public interface Presenter extends BasePresenter<MainView> {
|
||||
+4
-6
@@ -1,9 +1,8 @@
|
||||
package com.tt.ttutils.activity.retrofit;
|
||||
package com.ttstd.ttutils.activity.retrofit;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -12,10 +11,9 @@ import com.google.gson.JsonParser;
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.tt.ttutils.activity.main.MainAContact;
|
||||
import com.tt.ttutils.network.NetInterfaceManager;
|
||||
import com.tt.ttutils.network.UrlAddress;
|
||||
import com.tt.ttutils.retrofit.GetPublicIPApi;
|
||||
import com.ttstd.ttutils.network.NetInterfaceManager;
|
||||
import com.ttstd.ttutils.network.UrlAddress;
|
||||
import com.ttstd.ttutils.retrofit.GetPublicIPApi;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
+3
-5
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.activity.test;
|
||||
package com.ttstd.ttutils.activity.test;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
@@ -8,12 +8,10 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.tt.ttutils.R;
|
||||
import com.tt.ttutils.utils.java.TTUtils;
|
||||
import com.ttstd.ttutils.R;
|
||||
import com.ttstd.ttutils.utils.java.TTUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.base;
|
||||
package com.ttstd.ttutils.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -15,7 +15,7 @@ import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
import com.tt.ttutils.R;
|
||||
import com.ttstd.ttutils.R;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.base;
|
||||
package com.ttstd.ttutils.base;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Handler;
|
||||
@@ -8,7 +8,7 @@ import android.util.Log;
|
||||
import com.tencent.android.tpush.XGIOperateCallback;
|
||||
import com.tencent.android.tpush.XGPushConfig;
|
||||
import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tt.ttutils.BuildConfig;
|
||||
import com.ttstd.ttutils.BuildConfig;
|
||||
|
||||
public class BaseApplication extends Application {
|
||||
@Override
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.base;
|
||||
package com.ttstd.ttutils.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.base;
|
||||
package com.ttstd.ttutils.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -15,7 +15,7 @@ import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
import com.tt.ttutils.R;
|
||||
import com.ttstd.ttutils.R;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
+2
-3
@@ -1,11 +1,10 @@
|
||||
package com.tt.ttutils.base;
|
||||
package com.ttstd.ttutils.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.tt.ttutils.R;
|
||||
import com.ttstd.ttutils.R;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
public abstract class ImmerseBaseActivity extends BaseActivity {
|
||||
+10
-10
@@ -1,32 +1,32 @@
|
||||
package com.tt.ttutils.base
|
||||
package com.ttstd.ttutils.base
|
||||
|
||||
import android.app.Application
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import cn.jpush.android.api.JPushInterface
|
||||
import com.tencent.android.tpush.XGIOperateCallback
|
||||
import com.tencent.android.tpush.XGPushConfig
|
||||
import com.tencent.android.tpush.XGPushManager
|
||||
import com.tencent.bugly.crashreport.CrashReport
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.tt.ttutils.BuildConfig
|
||||
import com.tt.ttutils.utils.java.JGYUtils
|
||||
import com.tt.ttutils.utils.java.TTUtils
|
||||
import com.tt.ttutils.utils.java.ToastUtil
|
||||
import com.ttstd.ttutils.BuildConfig
|
||||
import com.ttstd.ttutils.utils.java.JGYUtils
|
||||
import com.ttstd.ttutils.utils.java.TTUtils
|
||||
import com.ttstd.ttutils.utils.java.ToastUtil
|
||||
|
||||
|
||||
class KotlinApplication : Application() {
|
||||
private val debug = BuildConfig.DEBUG;
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
val rootDir = MMKV.initialize(this)
|
||||
Log.e("KotlinApplication", "mmkv root: $rootDir")
|
||||
|
||||
ToastUtil.init(this)
|
||||
JPushInterface.setDebugMode(debug) // 设置开启日志,发布时请关闭日志
|
||||
JPushInterface.init(this) // 初始化 JPush
|
||||
TTUtils.init(this)
|
||||
JGYUtils.init(this)
|
||||
CrashReport.initCrashReport(getApplicationContext(), "注册时申请的APPID", false);
|
||||
|
||||
XGPushConfig.enableDebug(this, true)
|
||||
XGPushManager.registerPush(this, object : XGIOperateCallback {
|
||||
override fun onSuccess(data: Any, flag: Int) {
|
||||
@@ -52,7 +52,7 @@ class KotlinApplication : Application() {
|
||||
)
|
||||
}
|
||||
//下面是新增方法!
|
||||
Handler(Looper.getMainLooper()).post(Runnable {
|
||||
Handler(Looper.getMainLooper()).post({
|
||||
while (true) {
|
||||
try {
|
||||
Looper.loop() //会先执行这个方法,然后在执行下面的异常捕获方法!
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.base.old;
|
||||
package com.ttstd.ttutils.base.old;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.bean;
|
||||
package com.ttstd.ttutils.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.db;
|
||||
package com.ttstd.ttutils.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.db;
|
||||
package com.ttstd.ttutils.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.disklrucache;
|
||||
package com.ttstd.ttutils.disklrucache;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.disklrucache;
|
||||
package com.ttstd.ttutils.disklrucache;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.disklrucache;
|
||||
package com.ttstd.ttutils.disklrucache;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.gson;
|
||||
package com.ttstd.ttutils.gson;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.mvp;
|
||||
package com.ttstd.ttutils.mvp;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.mvp;
|
||||
package com.ttstd.ttutils.mvp;
|
||||
|
||||
public interface BaseView {
|
||||
}
|
||||
+3
-12
@@ -1,27 +1,18 @@
|
||||
package com.tt.ttutils.network;
|
||||
package com.ttstd.ttutils.network;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.tt.ttutils.BuildConfig;
|
||||
import com.tt.ttutils.network.interceptor.RequestInterceptor;
|
||||
import com.tt.ttutils.utils.java.MD5Util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.ttstd.ttutils.BuildConfig;
|
||||
import com.ttstd.ttutils.network.interceptor.RequestInterceptor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Protocol;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.network;
|
||||
package com.ttstd.ttutils.network;
|
||||
|
||||
public class UrlAddress {
|
||||
|
||||
+3
-4
@@ -1,11 +1,10 @@
|
||||
package com.tt.ttutils.network.interceptor;
|
||||
package com.ttstd.ttutils.network.interceptor;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.tt.ttutils.disklrucache.DiskLruCacheHelper;
|
||||
import com.tt.ttutils.utils.java.NetworkUtils;
|
||||
import com.tt.ttutils.utils.java.TTUtils;
|
||||
import com.ttstd.ttutils.disklrucache.DiskLruCacheHelper;
|
||||
import com.ttstd.ttutils.utils.java.TTUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.tt.ttutils.network.interceptor;
|
||||
package com.ttstd.ttutils.network.interceptor;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.tt.ttutils.BuildConfig;
|
||||
import com.tt.ttutils.utils.java.MD5Util;
|
||||
import com.ttstd.ttutils.BuildConfig;
|
||||
import com.ttstd.ttutils.utils.java.MD5Util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package com.tt.ttutils.network.interceptor;
|
||||
package com.ttstd.ttutils.network.interceptor;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
import com.tt.ttutils.utils.java.MD5Util;
|
||||
import com.ttstd.ttutils.utils.java.MD5Util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
+1
-3
@@ -1,12 +1,10 @@
|
||||
package com.tt.ttutils.receiver;
|
||||
package com.ttstd.ttutils.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
private static String TAG = BootReceiver.class.getSimpleName() + ":ttutils";
|
||||
public static final String BOOT_COMPLETED = "aoleyun.intent.action.BOOT_COMPLETED";
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.receiver;
|
||||
package com.ttstd.ttutils.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ttstd.ttutils.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
public class ShortcutReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = ShortcutReceiver.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.e(TAG, "onReceive: " + intent);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.tt.ttutils.retrofit;
|
||||
package com.ttstd.ttutils.retrofit;
|
||||
|
||||
|
||||
import com.tt.ttutils.network.UrlAddress;
|
||||
import com.ttstd.ttutils.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import okhttp3.ResponseBody;
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ttstd.ttutils.server.main;
|
||||
|
||||
import com.ttstd.ttutils.mvp.BasePresenter;
|
||||
import com.ttstd.ttutils.mvp.BaseView;
|
||||
|
||||
public class MainSContact {
|
||||
public interface MainView extends BaseView {
|
||||
|
||||
}
|
||||
|
||||
public interface Presenter extends BasePresenter<MainView> {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.ttstd.ttutils.server.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 MainSPresenter implements MainSContact.Presenter {
|
||||
private static final String TAG = MainSPresenter.class.getSimpleName();
|
||||
private MainSContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
private final String DEFAULT_INFO = "暂无信息";
|
||||
private final int OK = 200;
|
||||
|
||||
public MainSPresenter(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 MainSContact.MainView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
}
|
||||
+5
-239
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.server.main;
|
||||
package com.ttstd.ttutils.server.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Service;
|
||||
@@ -13,7 +13,6 @@ import android.graphics.PixelFormat;
|
||||
import android.hardware.usb.UsbManager;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -24,14 +23,12 @@ import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.tt.ttutils.R;
|
||||
import com.ttstd.ttutils.R;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
@@ -39,10 +36,10 @@ import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class MainService extends Service implements MainSContact.MainView {
|
||||
private static final String TAG = MainService.class.getSimpleName();
|
||||
|
||||
private MainSPresenter mPresenter;
|
||||
private UsbManager mUsbManager;
|
||||
private static final String TAG = MainService.class.getSimpleName();
|
||||
public static boolean netWorkIsRunning = false;
|
||||
|
||||
private interface Start {
|
||||
void onstar(long time);
|
||||
@@ -71,9 +68,6 @@ public class MainService extends Service implements MainSContact.MainView {
|
||||
@Override
|
||||
public void onNext(Long aLong) {
|
||||
Log.e("TimeObserver", "onNext: " + aLong);
|
||||
startCommandTime = runningTime = SystemClock.elapsedRealtime();
|
||||
mPresenter.getFirstConnect();
|
||||
mPresenter.getLockedState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,31 +192,9 @@ public class MainService extends Service implements MainSContact.MainView {
|
||||
mPresenter.detachView();
|
||||
}
|
||||
|
||||
//执行所有请求的时间
|
||||
long runningTime;
|
||||
|
||||
//MainService上次执行时间
|
||||
long startCommandTime = 0;
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
JPushInterface.init(this);
|
||||
// if (MainActivity.isForeground) {
|
||||
// Log.e(TAG, "onStartCommand: MainActivity: isForeground: " + MainActivity.isForeground);
|
||||
// } else {
|
||||
// if (((SystemClock.elapsedRealtime() - startCommandTime) < 60000) && startCommandTime != 0) {
|
||||
// Log.e(TAG, "onStartCommand: " + "启动时间过短");
|
||||
// //一分钟内防止多次调用
|
||||
// } else {
|
||||
// mPresenter.getFirstConnect();
|
||||
// mPresenter.getLockedState();
|
||||
// startCommandTime = runningTime = SystemClock.elapsedRealtime();
|
||||
// Log.e(TAG, "onStartCommand: isForeground: " + MainActivity.isForeground);
|
||||
// Log.e(TAG, "onStartCommand: " + (SystemClock.elapsedRealtime() - startCommandTime));
|
||||
// }
|
||||
start.onstar(SystemClock.elapsedRealtime());
|
||||
Log.e("timeObserver", "onStartCommand: " + (SystemClock.elapsedRealtime() - startCommandTime) + "ms");
|
||||
// }
|
||||
Log.e("timeObserver", "onStartCommand: ");
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@@ -396,33 +368,6 @@ public class MainService extends Service implements MainSContact.MainView {
|
||||
} else if (ACTION_UPDATE.equals(intent.getAction())) {
|
||||
Log.e("fht", "TimeChangedReceiver:" + "date update");
|
||||
}
|
||||
// ForegroundAppUtil.openTopApp(context);
|
||||
// long nowTime = System.currentTimeMillis();
|
||||
// TimeUtils.ContralTime contralTime = TimeUtils.getDefaltContralTime(MainService.this);
|
||||
// if (null != contralTime) {
|
||||
// if (contralTime.inControlTime(nowTime)) {
|
||||
// if (!screenlocked) {
|
||||
// showFloatingWindow("管控时间:" + contralTime.toString());
|
||||
// } else {
|
||||
// TextView textView = topView.findViewById(R.id.textView);
|
||||
// textView.setText("管控时间:" + contralTime.toString());
|
||||
// }
|
||||
// timelocked = true;
|
||||
// } else {
|
||||
// mPresenter.getScreenLockState();
|
||||
// if (!screenlocked) {
|
||||
// hideFloatingWindow();
|
||||
// }
|
||||
// timelocked = false;
|
||||
// }
|
||||
// } else {
|
||||
// if (!screenlocked) {
|
||||
// hideFloatingWindow();
|
||||
// }
|
||||
// mPresenter.getScreenLockState();
|
||||
// timelocked = false;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,183 +428,4 @@ public class MainService extends Service implements MainSContact.MainView {
|
||||
// ApkUtils.installApp(MainService.this, filePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchText(String text, int visibility) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClassText(String text, int visibility) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNumberText(String text, int visibility) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNameText(String text, int visibility) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockedState(boolean loocked) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次使用默认关闭所有功能
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
@Override
|
||||
public void setFirstConnect(boolean state) {
|
||||
Log.e(TAG, "isFirstConnect: " + "end request");
|
||||
if (state) {
|
||||
mPresenter.setDisableSetting();
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMACFinished() {
|
||||
mPresenter.updateDeviceInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceInfoFinished() {
|
||||
mPresenter.getSnTimeControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnTimeControlFinished() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAliasFinished() {
|
||||
mPresenter.setJpushTags();
|
||||
//设置极光推送tag
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTagsFinished() {
|
||||
mPresenter.checkStoreUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJpushPlatformTagsFinished() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkStoreUpdateFinished() {
|
||||
mPresenter.checkTestUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkTestUpdateFinished() {
|
||||
mPresenter.getDefaultDesktop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonCheckUpdateFinished(boolean update, JsonObject jsonObject) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSystemSettingbegin() {
|
||||
mPresenter.getAppLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppLimitFinished(String packageList) {
|
||||
mPresenter.getDeviceBatch(packageList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeviceBatchFinished() {
|
||||
mPresenter.getForceDownload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getForceDownloadFinished() {
|
||||
mPresenter.getBrowserList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBrowserListFinished(String whitelist) {
|
||||
mPresenter.getBrowserBookmarks(whitelist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBrowserBookmarksFinished() {
|
||||
mPresenter.getBrowserWhiteList();
|
||||
mPresenter.getDesktopIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDesktopIconFinished() {
|
||||
mPresenter.getAppAutoStartUpdateAndNet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppAutoStartUpdateAndNetFinished() {
|
||||
mPresenter.getAppIDControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppIDControlFinished() {
|
||||
mPresenter.setAppinsideWeb();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppinsideWebFinished() {
|
||||
mPresenter.setSystemSetting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSystemSettingFinished() {
|
||||
mPresenter.getDeveloper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeveloperFinished() {
|
||||
mPresenter.setLogoImg();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogoImgFinished() {
|
||||
mPresenter.setTopApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTopAppFinished() {
|
||||
netWorkIsRunning = false;
|
||||
Log.e(TAG, "SettingFinished: " + (SystemClock.elapsedRealtime() - runningTime) + " ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScreenLockStateFinished(boolean locked, String tips) {
|
||||
if (locked) {
|
||||
if (!timelocked) {
|
||||
showFloatingWindow(tips);
|
||||
}
|
||||
screenlocked = true;
|
||||
} else {
|
||||
if (!timelocked) {
|
||||
hideFloatingWindow();
|
||||
}
|
||||
screenlocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDefaultDesktopFinished() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.tpush;
|
||||
package com.ttstd.ttutils.tpush;
|
||||
|
||||
/**
|
||||
* Created by chacewang on 2019/7/5.
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.tpush;
|
||||
package com.ttstd.ttutils.tpush;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -11,8 +11,8 @@ import com.tencent.android.tpush.XGPushClickedResult;
|
||||
import com.tencent.android.tpush.XGPushRegisterResult;
|
||||
import com.tencent.android.tpush.XGPushShowedResult;
|
||||
import com.tencent.android.tpush.XGPushTextMessage;
|
||||
import com.tt.ttutils.tpush.common.NotificationService;
|
||||
import com.tt.ttutils.tpush.po.XGNotification;
|
||||
import com.ttstd.ttutils.tpush.common.NotificationService;
|
||||
import com.ttstd.ttutils.tpush.po.XGNotification;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.tpush.common;
|
||||
package com.ttstd.ttutils.tpush.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.tpush.common;
|
||||
package com.ttstd.ttutils.tpush.common;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
@@ -6,7 +6,7 @@ import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
|
||||
import com.tt.ttutils.tpush.po.XGNotification;
|
||||
import com.ttstd.ttutils.tpush.po.XGNotification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.tpush.po;
|
||||
package com.ttstd.ttutils.tpush.po;
|
||||
|
||||
public class XGNotification {
|
||||
private Integer id;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.IPackageDataObserver;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
public class BitmapUtils {
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.WallpaperManager;
|
||||
@@ -14,7 +14,7 @@ import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tt.ttutils.R;
|
||||
import com.ttstd.ttutils.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Executor;
|
||||
+20
-6
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ComponentName;
|
||||
@@ -7,12 +7,11 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tt.ttutils.BuildConfig;
|
||||
import com.tt.ttutils.disklrucache.CacheHelper;
|
||||
import com.tt.ttutils.receiver.BootReceiver;
|
||||
import com.ttstd.ttutils.BuildConfig;
|
||||
import com.ttstd.ttutils.disklrucache.CacheHelper;
|
||||
import com.ttstd.ttutils.receiver.BootReceiver;
|
||||
|
||||
public class JGYUtils {
|
||||
private static final String TAG = JGYUtils.class.getSimpleName();
|
||||
@@ -31,6 +30,9 @@ public class JGYUtils {
|
||||
public static final int MTK8515Platform = 6;
|
||||
public static final int G13Platform = 7;
|
||||
public static final int UnknowPlatform = 0;
|
||||
public static final int AH6016Platform = 9;
|
||||
public static final int TeclastP20sPlatform = 11;
|
||||
|
||||
|
||||
public static final String MTKTag = "MTK";
|
||||
public static final String ZhanruiTag = "展锐";
|
||||
@@ -38,6 +40,9 @@ public class JGYUtils {
|
||||
public static final String T30PROTag = "T30PRO";
|
||||
public static final String MTK8515Tag = "8515";
|
||||
public static final String G13Tag = "G13";
|
||||
public static final String AH6016Tag = "AH6016";
|
||||
public static final String TeclastP20sTag = "P20S";
|
||||
|
||||
|
||||
private JGYUtils(Context context) {
|
||||
if (context == null) {
|
||||
@@ -94,6 +99,12 @@ public class JGYUtils {
|
||||
} else if (G13Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "G13");
|
||||
return G13Platform;
|
||||
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "P20s");
|
||||
return TeclastP20sPlatform;
|
||||
} else if (AH6016Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "AH6016");
|
||||
return AH6016Platform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
@@ -127,6 +138,10 @@ public class JGYUtils {
|
||||
getAppPlatformCallback.AppPlatform(MTK8515Platform);
|
||||
} else if (G13Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(G13Platform);
|
||||
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(TeclastP20sPlatform);
|
||||
} else if (AH6016Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(AH6016Platform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
@@ -175,7 +190,6 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final String PACKAGE_DEVICEINFO = "com.aoleyun.sn";
|
||||
public static final String CLASS_DEVICEINFO = "com.aoleyun.sn.receiver.BootReceiver";
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.WallpaperManager;
|
||||
@@ -24,7 +24,7 @@ import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.tt.ttutils.R;
|
||||
import com.ttstd.ttutils.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Executor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
public class NetworkUtils {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
public class OtherUtils {
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
public class PictrueUtils {
|
||||
/**{@link }
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Application;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
public class SystemSignUtils {
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentResolver;
|
||||
@@ -9,7 +9,7 @@ import android.net.NetworkInfo;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tt.ttutils.disklrucache.CacheHelper;
|
||||
import com.ttstd.ttutils.disklrucache.CacheHelper;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.java;
|
||||
package com.ttstd.ttutils.utils.java;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -8,7 +8,7 @@ import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tt.ttutils.BuildConfig;
|
||||
import com.ttstd.ttutils.BuildConfig;
|
||||
|
||||
|
||||
/**
|
||||
+3
-3
@@ -6,7 +6,7 @@ import java.io.IOException;
|
||||
class dimens {
|
||||
|
||||
public static void main(String[] args) {
|
||||
File file = new File("."+File.separator + "dimens.xml");
|
||||
File file = new File("." + File.separator + "dimens.xml");
|
||||
System.out.println(file.getAbsolutePath());
|
||||
if (!file.exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
@@ -17,7 +17,7 @@ class dimens {
|
||||
}
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 1; i <= 500; i++) {
|
||||
for (int i = 1; i <= 700; i++) {
|
||||
stringBuilder.append("<dimen name=");
|
||||
stringBuilder.append("\"dp_");
|
||||
stringBuilder.append(i);
|
||||
@@ -27,7 +27,7 @@ class dimens {
|
||||
stringBuilder.append("\n");
|
||||
}
|
||||
stringBuilder.append("\n");
|
||||
for (int i = 1; i <= 50; i++) {
|
||||
for (int i = 1; i <= 100; i++) {
|
||||
stringBuilder.append("<dimen name=");
|
||||
stringBuilder.append("\"sp_");
|
||||
stringBuilder.append(i);
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.jni;
|
||||
package com.ttstd.ttutils.utils.jni;
|
||||
|
||||
public class NDKTools {
|
||||
static {
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.ttstd.ttutils.utils.kt
|
||||
|
||||
class ApkUtils {
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.tt.ttutils.utils.kt
|
||||
package com.ttstd.ttutils.utils.kt
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
@@ -21,11 +21,22 @@
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_settings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="打开设置" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_usb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="USB管控" />
|
||||
|
||||
<Button
|
||||
@@ -33,6 +44,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="状态:" />
|
||||
|
||||
<Button
|
||||
@@ -40,6 +53,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="charge" />
|
||||
|
||||
<Button
|
||||
@@ -67,6 +82,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="默认桌面" />
|
||||
|
||||
<Button
|
||||
@@ -93,20 +110,29 @@
|
||||
android:text="dop2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_desktop_aoleyun"
|
||||
android:id="@+id/bt_desktop_aoleyun_os"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="aoleyun.os" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_desktop_aoleyun"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="aoleyun" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_sd"
|
||||
@@ -142,8 +168,8 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_developer"
|
||||
@@ -250,6 +276,49 @@
|
||||
android:text="off" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="状态栏" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar_back"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="Back" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar_home"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="Home" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_statusbar_recent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="Recent" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -547,6 +616,78 @@
|
||||
android:text="置空" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_night_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="护眼模式" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_night_on"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="打开" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_night_off"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="关闭" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_read_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="阅读模式" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_read_on"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="打开" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_read_off"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="关闭" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_add_shortcut"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="快捷方式" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-path
|
||||
name="files_root"
|
||||
path="Android/data/com.herenit.webdoc/" />
|
||||
<external-path
|
||||
name="external_storage_root"
|
||||
path="." />
|
||||
</paths>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<base-config cleartextTrafficPermitted="true" />
|
||||
</network-security-config>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ttstd.ttutils
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
"access_id": "1500026407",
|
||||
"access_key": "AQ6C6W1O19LT"
|
||||
},
|
||||
"com.tt.ttutils": {
|
||||
"com.ttstd.ttutils": {
|
||||
"channel": {
|
||||
"enable": true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user