Compare commits

..
1 Commits
Author SHA1 Message Date
lijia 20ab7b5730 keepalive版MVP 2022-09-16 08:33:24 +08:00
26 changed files with 136 additions and 1097 deletions
+18 -32
View File
@@ -2,6 +2,7 @@ plugins {
id 'com.android.application' id 'com.android.application'
id 'kotlin-android' id 'kotlin-android'
id 'kotlin-kapt' id 'kotlin-kapt'
id 'kotlin-android-extensions'
id 'com.huawei.agconnect' id 'com.huawei.agconnect'
} }
@@ -34,8 +35,8 @@ android {
applicationId "com.arpa.hndahesudintocctmsdriver" applicationId "com.arpa.hndahesudintocctmsdriver"
minSdkVersion 22 minSdkVersion 22
targetSdkVersion 30 targetSdkVersion 30
versionCode 51 versionCode 49
versionName "3.2.0" versionName "3.1.9"
flavorDimensions "CHANNEL_VALUE" flavorDimensions "CHANNEL_VALUE"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions { javaCompileOptions {
@@ -49,7 +50,7 @@ android {
ndk { ndk {
//选择要添加的对应 cpu 类型的 .so 库。 //选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi-v7a', 'arm64-v8a' abiFilters 'armeabi', 'armeabi-v7a'
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64' , 'arm64-v8a' // 还可以添加 'x86', 'x86_64', 'mips', 'mips64' , 'arm64-v8a'
} }
@@ -69,12 +70,6 @@ android {
VIVO_APPID : "vivo的APPID" VIVO_APPID : "vivo的APPID"
] ]
} }
// sourceSets {
// main {
// jniLibs.srcDirs = ['libs']
// }
// }
sourceSets { sourceSets {
main { main {
jniLibs.srcDirs = ['libs'] jniLibs.srcDirs = ['libs']
@@ -149,8 +144,6 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.caverock:androidsvg-aar:1.3' implementation 'com.caverock:androidsvg-aar:1.3'
//当引入的与之前引入的库有重复冲突部分的时候,使用compileOnly
implementation files('libs\\mdp_sdk.jar')
//压缩工具 //压缩工具
implementation 'top.zibin:Luban:1.1.3' implementation 'top.zibin:Luban:1.1.3'
//角标 //角标
@@ -165,10 +158,9 @@ dependencies {
implementation 'com.github.jenly1314.AppUpdater:app-dialog:1.1.0' implementation 'com.github.jenly1314.AppUpdater:app-dialog:1.1.0'
//轮播插件 //轮播插件
implementation 'com.github.zhpanvip:BannerViewPager:3.5.4' implementation 'com.github.zhpanvip:BannerViewPager:3.5.4'
// //弹出框
// implementation 'com.lxj:xpopup:2.2.8' // implementation 'com.lxj:xpopup:2.2.8'
//工具类 // implementation 'com.github.li-xiaojun:XPopup:2.8.15'
//implementation 'cn.hutool:hutool-all:5.7.11'
//交通厅 //交通厅
implementation 'com.lzy.net:okgo:3.0.4' implementation 'com.lzy.net:okgo:3.0.4'
implementation 'com.alibaba:fastjson:1.2.61' implementation 'com.alibaba:fastjson:1.2.61'
@@ -176,12 +168,12 @@ dependencies {
implementation 'org.apache.commons:commons-lang3:3.5' implementation 'org.apache.commons:commons-lang3:3.5'
implementation (name:'locationgd-androidx_2.1.0', ext:'aar')//交通厅 implementation (name:'locationgd-androidx_2.1.0', ext:'aar')//交通厅
//安联 //安联
// implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.loopj.android:android-async-http:1.4.9' implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.j256.ormlite:ormlite-android:4.48' implementation 'com.j256.ormlite:ormlite-android:4.48'
implementation 'com.j256.ormlite:ormlite-core:4.48' implementation 'com.j256.ormlite:ormlite-core:4.48'
compileOnly 'com.github.hotchemi:permissionsdispatcher:2.3.1' implementation "org.permissionsdispatcher:permissionsdispatcher:4.6.0"
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.3.1' kapt "org.permissionsdispatcher:permissionsdispatcher-processor:4.6.0"
//极光认证 //极光认证
implementation 'cn.jiguang.sdk:jverification:2.7.1' // 此处以2.7.1 版本为例。a implementation 'cn.jiguang.sdk:jverification:2.7.1' // 此处以2.7.1 版本为例。a
implementation 'cn.jiguang.sdk:jpush:4.2.4' // 此处以JPush 4.2.4 版本为例。 implementation 'cn.jiguang.sdk:jpush:4.2.4' // 此处以JPush 4.2.4 版本为例。
@@ -193,30 +185,24 @@ dependencies {
implementation 'com.umeng.umsdk:asms:1.4.1'// 必选 implementation 'com.umeng.umsdk:asms:1.4.1'// 必选
implementation 'com.umeng.umsdk:apm:1.4.2' // 错误分析升级为独立SDK,看crash数据请一定集成,可选 implementation 'com.umeng.umsdk:apm:1.4.2' // 错误分析升级为独立SDK,看crash数据请一定集成,可选
implementation 'com.umeng.umsdk:abtest:1.0.0'//使用U-App中ABTest能力,可选 implementation 'com.umeng.umsdk:abtest:1.0.0'//使用U-App中ABTest能力,可选
//动态权限获取
implementation "org.permissionsdispatcher:permissionsdispatcher:4.6.0"
kapt "org.permissionsdispatcher:permissionsdispatcher-processor:4.6.0"
//选择器 //选择器
implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:3.1.1' implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:3.1.1'
//EventBus //EventBus
implementation 'org.greenrobot:eventbus:3.1.1' implementation 'org.greenrobot:eventbus:3.1.1'
//易签宝
implementation(name:'EsignSDK', ext:'aar')
implementation'pub.devrel:easypermissions:1.3.0'
implementation "com.squareup.retrofit2:retrofit:2.4.0"
// implementation "com.squareup.retrofit2:converter-gson:2.4.0"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.4.0"
// implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation "io.reactivex.rxjava2:rxjava:2.1.5"
implementation "io.reactivex.rxjava2:rxandroid:2.0.1"
//pdf展示 //pdf展示
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1' implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
// //工具类
//implementation 'cn.hutool:hutool-all:5.7.11'
implementation 'com.github.getActivity:XToast:8.2' implementation 'com.github.getActivity:XToast:8.2'
//易签宝
implementation(name:'EsignSDK', ext:'aar')
//当引入的与之前引入的库有重复冲突部分的时候,使用compileOnly
implementation files('libs\\mdp_sdk.jar')
implementation project(path: ':mylibrary') implementation project(path: ':mylibrary')
} }
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.
Binary file not shown.
+15 -46
View File
@@ -4,7 +4,6 @@
package="com.arpa.hndahesudintocctmsdriver"> package="com.arpa.hndahesudintocctmsdriver">
<!-- 白名单 --> <!-- 白名单 -->
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="com.huawei.permission.external_app_settings.USE_COMPONENT"/>
<!-- 基础权限 --> <!-- 基础权限 -->
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
@@ -66,42 +65,19 @@
android:name="com/alct/mdp" android:name="com/alct/mdp"
android:required="false" /> android:required="false" />
<service
android:name=".ui.text.TestNotificationListenerService"
android:enabled="true"
android:exported="true"
android:label="@string/app_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"><!--必要的绑定权限-->
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" /><!--必要的action-->
</intent-filter>
</service>
<service
android:name=".ui.text.TestService"
android:directBootAware="true"
android:enabled="true"
android:exported="true"
android:label="@string/app_name"
android:foregroundServiceType="phoneCall|mediaPlayback|dataSync|mediaProjection|connectedDevice|location" />
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.MainActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true" android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="portrait"></activity> android:screenOrientation="portrait" ></activity>
<activity
android:name=".ui.text.TextActivity"
android:exported="true">
</activity>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.wallet.WithdrawalActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.wallet.WithdrawalActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.wallet.UpBankActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.wallet.UpBankActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.OrderAllActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.OrderAllActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
@@ -117,16 +93,9 @@
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.PhotoCarActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.PhotoCarActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name="com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.VehicleAuthActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.VehicleAuthActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
@@ -142,13 +111,13 @@
</activity> </activity>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.GetShangChuanActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.GetShangChuanActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.AuthQualificationActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.AuthQualificationActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.OrderListActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.OrderListActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.HuoYunDelActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.HuoYunDelActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
@@ -161,13 +130,13 @@
</activity> </activity>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.AddCarSuccActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.AddCarSuccActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.login.LoginActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.login.LoginActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.login.WelcomeActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.login.WelcomeActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
@@ -190,10 +159,10 @@
</activity> </activity>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.drivercircle.VideoReleaseActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.drivercircle.VideoReleaseActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.WebPDFActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.WebPDFActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.StartYunDanActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.StartYunDanActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
@@ -201,13 +170,13 @@
</activity> </activity>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.drivercircle.HomePageActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.drivercircle.HomePageActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.alert.VehicleChoiceActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.alert.VehicleChoiceActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.OrderComplaintActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.OrderComplaintActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"/>
<activity <activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.web.WebActivity" android:name="com.arpa.hndahesudintocctmsdriver.ui.web.WebActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
@@ -264,7 +233,7 @@
<meta-data <meta-data
android:name="com.amap.api.v2.apikey" android:name="com.amap.api.v2.apikey"
android:value="78019612271411eca3af34db91930620" /> android:value="78019612271411eca3af34db91930620" />
<!-- android:value="702eaa84675618b8eb69298d9fd42ca3" />--> <!-- android:value="702eaa84675618b8eb69298d9fd42ca3" />-->
<service android:name="com.amap.api.location.APSService"></service> <service android:name="com.amap.api.location.APSService"></service>
@@ -3,21 +3,17 @@ package com.arpa.hndahesudintocctmsdriver;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Build;
import android.util.Log; import android.util.Log;
import com.alct.mdp.MDPLocationCollectionManager; import com.alct.mdp.MDPLocationCollectionManager;
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess; import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
import com.arpa.hndahesudintocctmsdriver.request.net.Api; import com.arpa.hndahesudintocctmsdriver.request.net.Api;
import com.arpa.hndahesudintocctmsdriver.ui.text.TestNotificationListenerService;
import com.dahe.mylibrary.CommonBaseLibrary; import com.dahe.mylibrary.CommonBaseLibrary;
import com.esign.esignsdk.EsignSdk; import com.esign.esignsdk.EsignSdk;
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil; import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
import com.gyf.cactus.Cactus;
import com.umeng.commonsdk.UMConfigure; import com.umeng.commonsdk.UMConfigure;
import cn.jiguang.verifysdk.api.JVerificationInterface; import cn.jiguang.verifysdk.api.JVerificationInterface;
@@ -32,24 +28,9 @@ public class App extends Application {
public static int APP_STATUS = APP_STATUS_KILLED; // 记录App的启动状态 public static int APP_STATUS = APP_STATUS_KILLED; // 记录App的启动状态
private Context con; private Context con;
public static App mApplication = null; public static App mApplication = null;
/**
* 启动服务
*/
private void startService() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
/****************第三点*******************/
//安卓8.0以上开启为前台服务
startForegroundService(new Intent(this, App.class));
} else {
startService(new Intent(this, App.class));
}
startService(new Intent(this, TestNotificationListenerService.class));
}
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
startService();
mApplication = this; mApplication = this;
con = getBaseContext(); con = getBaseContext();
CommonBaseLibrary.getInstance().init(this, Api.BASE_URL); CommonBaseLibrary.getInstance().init(this, Api.BASE_URL);
@@ -82,18 +63,6 @@ public class App extends Application {
Log.e("-error-", "初始化失败sss"); Log.e("-error-", "初始化失败sss");
} }
} }
Cactus.getInstance()
.isDebug(true)
// .setBackgroundMusicEnabled(true)//可选,退到后台是否可以播放音乐
.setMusicId(R.raw.main) //可选,设置音乐
// .setPendingIntent(pendingIntent)//可选,设置通知栏点击事件
// .addCallback(new CactusCallback())//可选,运行时回调
.setCrashRestartUIEnabled(true) //可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
.setCrashRestartUIEnabled(true)//可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
.setTitle("大河好运")
.setSmallIcon(R.drawable.diver_logo)
.register(this);
} }
public static App getApp() { public static App getApp() {
@@ -358,14 +358,14 @@ public class StartYunDanActivity extends BaseActivity {
}else{ }else{
Toast.makeText(con,"您还没有装货",Toast.LENGTH_SHORT).show(); Toast.makeText(con,"您还没有装货",Toast.LENGTH_SHORT).show();
} }
}else if(sdw.getStatus()==1){//装货回单 }else if(sdw.getStatus()==1){
Intent in=new Intent(con, ShangChuangImgActivity.class); Intent in=new Intent(con, ShangChuangImgActivity.class);
in.putExtra("type",2); in.putExtra("type",2);
in.putExtra("wid",wid); in.putExtra("wid",wid);
in.putExtra("h_type",type); in.putExtra("h_type",type);
in.putExtra("sob",gson.toJson(sob)); in.putExtra("sob",gson.toJson(sob));
startActivity(in); startActivity(in);
}else if(sdw.getStatus()==2){//上传收货单(卸货回单) }else if(sdw.getStatus()==2){
Intent in=new Intent(con, ShangChuangImgActivity.class); Intent in=new Intent(con, ShangChuangImgActivity.class);
in.putExtra("type",2); in.putExtra("type",2);
in.putExtra("wid",wid); in.putExtra("wid",wid);
@@ -377,7 +377,7 @@ public class StartYunDanActivity extends BaseActivity {
Intent in=new Intent(con, GetShangChuanActivity.class); Intent in=new Intent(con, GetShangChuanActivity.class);
in.putExtra("sdwStr",gson.toJson(sdw)); in.putExtra("sdwStr",gson.toJson(sdw));
startActivity(in); startActivity(in);
}else{//卸货照片 }else{
Intent in=new Intent(con, ShangChuangImgActivity.class); Intent in=new Intent(con, ShangChuangImgActivity.class);
in.putExtra("type",type); in.putExtra("type",type);
in.putExtra("wid",wid); in.putExtra("wid",wid);
@@ -348,7 +348,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
} }
break; break;
case 2: case 2:
if(imgIds!=null && imgIds.size()>0){//卸货回单 if(imgIds!=null && imgIds.size()>0){
//上传回单 //上传回单
urib.setLatitude(lgdu.getLatitude()+""); urib.setLatitude(lgdu.getLatitude()+"");
urib.setLongitude(lgdu.getLongitude()+""); urib.setLongitude(lgdu.getLongitude()+"");
@@ -367,7 +367,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
receipt_image(); receipt_image();
} }
hyr.receipt(urib); hyr.receipt(urib);
}else{ }{
Toast.makeText(con,"定位异常,请重新定位",Toast.LENGTH_SHORT).show(); Toast.makeText(con,"定位异常,请重新定位",Toast.LENGTH_SHORT).show();
} }
}else{ }else{
@@ -1,13 +1,10 @@
package com.arpa.hndahesudintocctmsdriver.ui.my; package com.arpa.hndahesudintocctmsdriver.ui.my;
import android.Manifest; import android.Manifest;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.provider.Settings;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@@ -19,7 +16,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.app.NotificationManagerCompat;
import com.arpa.hndahesudintocctmsdriver.event.PersonEvent; import com.arpa.hndahesudintocctmsdriver.event.PersonEvent;
import com.arpa.hndahesudintocctmsdriver.event.VehicleEvent; import com.arpa.hndahesudintocctmsdriver.event.VehicleEvent;
@@ -27,7 +23,6 @@ import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts; import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts;
import com.arpa.hndahesudintocctmsdriver.parts.UserParts; import com.arpa.hndahesudintocctmsdriver.parts.UserParts;
import com.arpa.hndahesudintocctmsdriver.ui.business.BusinessActivity; import com.arpa.hndahesudintocctmsdriver.ui.business.BusinessActivity;
import com.arpa.hndahesudintocctmsdriver.ui.text.TextActivity;
import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil; import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.google.gson.Gson; import com.google.gson.Gson;
@@ -55,7 +50,6 @@ import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author hlh * @author hlh
@@ -238,27 +232,24 @@ public class MyFragment extends BaseFragment {
}); });
//联系我们 //联系我们
onContact.setOnClickListener(v -> { onContact.setOnClickListener(v -> {
getActivity().startActivity(new Intent(getActivity(), TextActivity.class)); String serviceMobile="";
// isNotificationListenerEnabled(getActivity()); if(ConfigParts.getConfigParts(con)!=null){
// goHuaWeiMainager(); serviceMobile=ConfigParts.getConfigParts(con).getData().getServiceMobile();
// String serviceMobile=""; serviceMobile=StringUtil.isNull(serviceMobile,"");
// if(ConfigParts.getConfigParts(con)!=null){ }
// serviceMobile=ConfigParts.getConfigParts(con).getData().getServiceMobile(); String[] title={"平台客服:"+serviceMobile};
// serviceMobile=StringUtil.isNull(serviceMobile,""); String[] value={serviceMobile};
// } new XPopup.Builder(con)
// String[] title={"平台客服:"+serviceMobile}; .isDarkTheme(false)
// String[] value={serviceMobile}; .isDestroyOnDismiss(true) //对于只使用一次的弹窗,推荐设置这个
// new XPopup.Builder(con) .asCenterList("请选择",title,
// .isDarkTheme(false) (position1, text) -> {
// .isDestroyOnDismiss(true) //对于只使用一次的弹窗,推荐设置这个 Intent intent = new Intent(Intent.ACTION_DIAL);
// .asCenterList("请选择",title, Uri data = Uri.parse("tel:" + value[position1]);
// (position1, text) -> { intent.setData(data);
// Intent intent = new Intent(Intent.ACTION_DIAL); startActivity(intent);
// Uri data = Uri.parse("tel:" + value[position1]); })
// intent.setData(data); .show();
// startActivity(intent);
// })
// .show();
}); });
//咨询建议 //咨询建议
onOpinion.setOnClickListener(v -> { onOpinion.setOnClickListener(v -> {
@@ -273,47 +264,6 @@ public class MyFragment extends BaseFragment {
onSetUp.setOnClickListener(v -> startActivity(new Intent(con, SetupActivity.class))); onSetUp.setOnClickListener(v -> startActivity(new Intent(con, SetupActivity.class)));
} }
/**
* 是否开启通知使用权限
* @param context
* @return
*/
public void isNotificationListenerEnabled(Context context) {
Set<String> packageNames = NotificationManagerCompat.getEnabledListenerPackages(context);
if (!packageNames.contains(context.getPackageName())) {//没有开启使用权限,去开启
Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
startActivity(intent);
}
}
private void goHuaWeiMainager() {
try {
Intent intent = new Intent(getActivity().getPackageName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// ComponentName comp = new ComponentName("com.huawei.systemmanager", "com.huawei.permissionmanager.ui.MainActivity");
ComponentName comp = new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivity");
intent.setComponent(comp);
getActivity().startActivity(intent);
} catch (Exception e) {
Toast.makeText(getActivity(), "跳转失败", Toast.LENGTH_LONG).show();
e.printStackTrace();
goIntentSetting();
}
}
private void goIntentSetting() {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getActivity().getPackageName(), null);
intent.setData(uri);
try {
getActivity().startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
public void initAuth(){ public void initAuth(){
if(userBean.getData()!=null){ if(userBean.getData()!=null){
name.setText(StringUtil.isNull(userBean.getData().getUname(),"未实名")); name.setText(StringUtil.isNull(userBean.getData().getUname(),"未实名"));
@@ -0,0 +1,25 @@
package com.arpa.hndahesudintocctmsdriver.ui.test
import com.arpa.hndahesudintocctmsdriver.R
import com.kymjs.themvp.view.AppDelegate
import kotlinx.android.synthetic.main.activity_get_shangchuan.*
/**
* @ClassName SimpleDelegate
* @Author 用户
* @Date 2022/9/8 10:05
* @Description TODO
*/
class SimpleDelegate : AppDelegate(){
override fun getRootLayoutId() = R.layout.activity_get_shangchuan
override fun initWidget() {
super.initWidget()
}
override fun getOptionsMenuId(): Int {
image1
return super.getOptionsMenuId()
}
}
@@ -0,0 +1,24 @@
package com.arpa.hndahesudintocctmsdriver.ui.test
import android.os.Bundle
import com.arpa.hndahesudintocctmsdriver.R
import com.dahe.mylibrary.base.BaseActivity
import kotlinx.android.synthetic.main.activity_get_shangchuan.*
/**
* @ClassName Texasdfa
* @Author 用户
* @Date 2022/9/8 10:33
* @Description TODO
*/
class Texasdfa : BaseActivity() {
override fun getLayout() = R.layout.activity_get_shangchuan
override fun initView(savedInstanceState: Bundle?) {
img1
}
override fun initDate() {
TODO("Not yet implemented")
}
}
@@ -0,0 +1,23 @@
package com.arpa.hndahesudintocctmsdriver.ui.test
import android.os.Bundle
import android.os.PersistableBundle
import com.kymjs.themvp.presenter.ActivityPresenter
/**
* @ClassName TextMVPActivtity
* @Author 用户
* @Date 2022/9/8 10:04
* @Description TODO
*/
class TextMVPActivtity : ActivityPresenter<SimpleDelegate>() {
override fun getDelegateClass(): Class<SimpleDelegate> {
return SimpleDelegate::class.java
}
override fun bindEvenListener() {
super.bindEvenListener()
}
}
@@ -1,36 +0,0 @@
package com.arpa.hndahesudintocctmsdriver.ui.text;
import android.content.ComponentName;
import android.content.Intent;
/**
* @ClassName AutoStartAppUtil
* @Author 用户
* @Date 2022/10/9 9:56
* @Description TODO
*/
public class AutoStartAppUtil {
public static final Intent[] POWERMANAGER_INTENTS = {
new Intent().setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity")),
new Intent().setComponent(new ComponentName("com.letv.android.letvsafe", "com.letv.android.letvsafe.AutobootManageActivity")),
new Intent().setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivity")),
new Intent().setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity")),
new Intent().setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.appcontrol.activity.StartupAppControlActivity")),
//new Intent().setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.privacypermissionsentry.PermissionTopActivity")),
new Intent().setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity")),
new Intent().setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.startupapp.StartupAppListActivity")),
new Intent().setComponent(new ComponentName("com.oppo.safe", "com.oppo.safe.permission.startup.StartupAppListActivity")),
new Intent().setComponent(new ComponentName("com.iqoo.secure", "com.iqoo.secure.ui.phoneoptimize.AddWhiteListActivity")),
new Intent().setComponent(new ComponentName("com.iqoo.secure", "com.iqoo.secure.ui.phoneoptimize.BgStartUpManager")),
new Intent().setComponent(new ComponentName("com.vivo.permissionmanager", "com.vivo.permissionmanager.activity.BgStartUpManagerActivity")),
new Intent().setComponent(new ComponentName("com.samsung.android.lool", "com.samsung.android.sm.battery.ui.BatteryActivity")),
new Intent().setComponent(new ComponentName("com.samsung.android.lool", "com.samsung.android.sm.ui.battery.BatteryActivity")),
new Intent().setComponent(new ComponentName("com.htc.pitroad", "com.htc.pitroad.landingpage.activity.LandingPageActivity")),
new Intent().setComponent(new ComponentName("com.asus.mobilemanager", "com.asus.mobilemanager.MainActivity")),
new Intent().setComponent(new ComponentName("com.transsion.phonemanager", "com.itel.autobootmanager.activity.AutoBootMgrActivity")),
new Intent().setComponent(new ComponentName("com.meizu.safe", "com.meizu.safe.permission.SmartBGActivity")),
new Intent().setComponent(new ComponentName("cn.nubia.security2", "cn.nubia.security.appmanage.selfstart.ui.SelfStartActivity")),
new Intent().setComponent(new ComponentName("com.transsion.phonemaster", "com.cyin.himgr.applicationmanager.view.activities.AutoStartActivity")),
};
}
@@ -1,31 +0,0 @@
package com.arpa.hndahesudintocctmsdriver.ui.text;
import android.content.Intent;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
/**
* @ClassName TestNotificationListenerService
* @Author 用户
* @Date 2022/10/9 9:53
* @Description TODO
*/
public class TestNotificationListenerService extends NotificationListenerService {
@Override
public void onCreate() {
super.onCreate();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
super.onNotificationPosted(sbn);
//Notification notification = sbn.getNotification();
// Log.d(LiveTaskApplication.TAG, "sbn.getPackageName: " + sbn.getPackageName());
}
}
@@ -1,119 +0,0 @@
package com.arpa.hndahesudintocctmsdriver.ui.text;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.IBinder;
import androidx.core.app.NotificationCompat;
import com.arpa.hndahesudintocctmsdriver.R;
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
/**
* @ClassName TestService
* @Author 用户
* @Date 2022/10/9 9:51
* @Description TODO
*/
public class TestService extends Service {
private static final int VISIBILITY_PUBLIC = 1000;
private static final int PRIORITY_HIGH = 1000;
private final String CHANNEL_ONE_ID = "100";
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public boolean onUnbind(Intent intent) {
return super.onUnbind(intent);
}
@Override
public void onCreate() {
super.onCreate();
/****************第一点*******************/
//创建通知栏常驻通知
initNotif("title", "text");
}
@Override
public void onDestroy() {
stopForeground(true);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// return super.onStartCommand(intent, flags, startId);
/****************第二点*******************/
//返回START_STICKY,被系统或手动清理后可重启
return START_STICKY;
}
public void initNotif(String title, String context) {
//RemoteViews remoteView = new RemoteViews(getPackageName(), R.layout.RemoteView);
Drawable drawable = getResources().getDrawable(R.mipmap.ic_launcher, null);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
Bitmap bitmapIcon = getBitmapFromDrawable(drawable);
Intent nfIntent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, nfIntent, 0);
@SuppressLint("WrongConstant") NotificationCompat.Builder builder = new NotificationCompat.Builder(this.getApplicationContext(), CHANNEL_ONE_ID)
.setContentIntent(pendingIntent) // 设置PendingIntent
.setSmallIcon(R.mipmap.ic_launcher) // 设置状态栏内的小图标
//.setLargeIcon(bitmapIcon)// 设置大图标
.setContentTitle(title)
.setContentText(context) // 设置内容
.setWhen(System.currentTimeMillis())// 设置该通知发生的时间
.setVisibility(VISIBILITY_PUBLIC)// 锁屏显示全部通知
//.setDefaults(Notification.DEFAULT_ALL)// //使用默认的声音、振动、闪光
.setPriority(PRIORITY_HIGH);// 通知的优先级
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//修改安卓8.0以上系统报错
NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ONE_ID, "服务常驻通知", NotificationManager.IMPORTANCE_MIN);
notificationChannel.enableLights(false);//如果使用中的设备支持通知灯,则说明此通知通道是否应显示灯
notificationChannel.setShowBadge(false);//是否显示角标
notificationChannel.enableVibration(false);//是否震动
notificationChannel.setLockscreenVisibility(VISIBILITY_PUBLIC);//锁屏显示全部通知
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.createNotificationChannel(notificationChannel);
builder.setChannelId(CHANNEL_ONE_ID);
}
Notification notification = builder.build(); // 获取构建好的Notification
notification.defaults = Notification.DEFAULT_SOUND; //设置为默认的声音
startForeground(1, notification);
}
/**
* 把资源图片转换成Bitmap
*
* @param drawable 资源图片
* @return 位图
*/
public static Bitmap getBitmapFromDrawable(Drawable drawable) {
int width = drawable.getBounds().width();
int height = drawable.getBounds().height();
Bitmap bitmap = Bitmap.createBitmap(width, height, drawable
.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, width, height);
drawable.draw(canvas);
return bitmap;
}
}
@@ -1,338 +0,0 @@
package com.arpa.hndahesudintocctmsdriver.ui.text;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.PowerManager;
import android.provider.Settings;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
import com.arpa.hndahesudintocctmsdriver.R;
import java.util.Locale;
import java.util.Set;
/**
* @ClassName TextActivity
* @Author 用户
* @Date 2022/10/9 10:05
* @Description TODO
*/
public class TextActivity extends AppCompatActivity implements View.OnClickListener{
private TextView mLeft;
private TextView mBandName;
private TextView mAutoStart;
private TextView mTutorials;
private TextView mLockApp;
private TextView mBatteryOptimization;
private WebView mWebView1, mWebView2;
private boolean isWeb = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main1);
//提示: 需要与服务共享数据自行绑定服务
initView();
/****************第四点*******************/
//开启通知使用权限(有的手机需要开启才能重启进程)
isNotificationListenerEnabled(this);
}
@Override
public void onClick(View v) {
if (v == mLeft) {
if (isWeb) {
isWeb = false;
mWebView1.setVisibility(View.GONE);
mWebView2.setVisibility(View.GONE);
return;
}
finish();
} else if (v == mTutorials) {
isWeb = true;
mWebView1.setVisibility(View.VISIBLE);
String brand = getDeviceBrand();
String htmlName = "";
if (brand.equalsIgnoreCase("huawei")) {
htmlName = "huawei";
} else if (brand.equalsIgnoreCase("honor")) {
htmlName = "honor";
} else if (brand.equalsIgnoreCase("infinix")) {
htmlName = "infinix";
} else if (brand.equalsIgnoreCase("meizu")) {
htmlName = "meizu";
} else if (brand.equalsIgnoreCase("xiaomi")) {
htmlName = "xiaomi";
} else if (brand.equalsIgnoreCase("redmi")) {
htmlName = "redmi";
} else if (brand.equalsIgnoreCase("oppo")) {
htmlName = "oppo";
} else if (brand.equalsIgnoreCase("realme")) {
htmlName = "realme";
} else if (brand.equalsIgnoreCase("onePlus")) {
htmlName = "onePlus";
} else if (brand.equalsIgnoreCase("vivo")) {
htmlName = "vivo";
} else if (brand.equalsIgnoreCase("iqoo")) {
htmlName = "iqoo";
} else if (brand.equalsIgnoreCase("smartisan")) {
htmlName = "smartisan";
} else if (brand.equalsIgnoreCase("sumsang")) {
htmlName = "sumsang";
} else if (brand.equalsIgnoreCase("asus")) {
htmlName = "asus";
} else if (brand.equalsIgnoreCase("lenovo")) {
htmlName = "lenovo";
} else if (brand.equalsIgnoreCase("nubia")) {
htmlName = "nubia";
}
if (!getSystemLanguage().contains("zh")) {// 非中文
htmlName = htmlName + "_e";
}
mWebView1.loadUrl("http://服务器接口地址/autostart/autostart_" + htmlName + ".html");
} else if (v == mAutoStart) {
Intent intents = null;
for (Intent intent : AutoStartAppUtil.POWERMANAGER_INTENTS)
if (getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
intents = intent;
break;
}
Log.e("gy", "手机品牌 device brand" + getDeviceBrand());
if (intents != null) {
if (getDeviceBrand().equalsIgnoreCase("Infinix")) {
Toast.makeText(this, "无权打开系统界面, 请点击查看教程手动设置", Toast.LENGTH_SHORT).show();
return;
}
if (getDeviceBrand().equalsIgnoreCase("OPPO") || getDeviceBrand().equalsIgnoreCase("realme")) {
if (ContextCompat.checkSelfPermission(TextActivity.this, "oppo.permission.OPPO_COMPONENT_SAFE") != PackageManager.PERMISSION_GRANTED) {
// oppo 为系统权限不对外开放
Toast.makeText(this, "无权打开系统界面, 请点击查看教程手动设置", Toast.LENGTH_SHORT).show();
// ActivityCompat.requestPermissions(PermissionsDescriptionActivity.this, new
// String[]{"oppo.permission.OPPO_COMPONENT_SAFE"}, 1);
} else {
startActivity(intents);
}
return;
}
try {
startActivity(intents);
}catch (Exception e){
System.out.println(e);
}
} else {
if (getDeviceBrand().equalsIgnoreCase("OnePlus")) {
intents = new Intent("com.android.settings.action.BACKGROUND_OPTIMIZE");
startActivity(intents);
return;
}
// if (SystemUtil.getDeviceBrand().equalsIgnoreCase("SMARTISAN")) {
// intents = new Intent("com.smartisanos.security.action.SWITCHED_PERMISSIONS_NEW");//无效
// startActivity(intents);
// return;
// }
Toast.makeText(this, "无权打开系统界面, 请点击查看教程手动设置", Toast.LENGTH_SHORT).show();
}
} else if (v == mLockApp) {
isWeb = true;
mWebView2.setVisibility(View.VISIBLE);
if (getSystemLanguage().contains("zh")) {// 中文
mWebView2.loadUrl("http://服务器接口地址/locktask/lockApp.html");
} else {
mWebView2.loadUrl("http://服务器接口地址/locktask/lockApp_e.html");
}
} else if (v == mBatteryOptimization) {
// 显示屏幕以控制哪些应用可以忽略电池优化
// 您可以PowerManager.isIgnoringBatteryOptimizations()用来确定应用程序是否已经忽略优化。
// 您可以 ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS用来要求用户将您放在此列表中。
//android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setIcon(R.mipmap.ic_launcher)
.setTitle("忽略电池优化")
.setMessage("参考说明:\n在手机&#160;设置&#160;-->&#160;电池&#160;-->&#160;耗电管理&#160;中找到" + getString(R.string.app_name) + ",&#160;设置&#160;允许后台运行&#160;或&#160;允许后台启动 等")
.setPositiveButton("设置忽略", new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
if (!isIgnoringBatteryOptimizations()) {
try {
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + getPackageName()));
//跳转之前判断intent是否存在,否则有的机型会报找不到activity
if (intent.resolveActivity(getPackageManager()) == null) {
intent = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
intent.setData(Uri.parse("package:" + getPackageName()));
if (intent.resolveActivity(getPackageManager()) == null) {
// showToast("无法启动系统界面,请以参考说明操作");
} else {
startActivity(intent);
}
} else {
startActivity(intent);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
})
.show();
}
}
/**
* 是否开启通知使用权限
* @param context
* @return
*/
public void isNotificationListenerEnabled(Context context) {
Set<String> packageNames = NotificationManagerCompat.getEnabledListenerPackages(this);
if (!packageNames.contains(context.getPackageName())) {//没有开启使用权限,去开启
Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
startActivity(intent);
}
}
private void initView() {
mBandName = (TextView) findViewById(R.id.bandName);
mLeft = (TextView) findViewById(R.id.left);
mLeft.setOnClickListener(this);
mAutoStart = (TextView) findViewById(R.id.autoStart);
mAutoStart.setOnClickListener(this);
mTutorials = (TextView) findViewById(R.id.tutorials);
mTutorials.setOnClickListener(this);
mLockApp = (TextView) findViewById(R.id.lockApp);
mLockApp.setOnClickListener(this);
mBatteryOptimization = (TextView) findViewById(R.id.battery_optimization);
mBatteryOptimization.setOnClickListener(this);
mWebView1 = (WebView) findViewById(R.id.webView1);
mWebView1.setOnClickListener(this);
mWebView2 = (WebView) findViewById(R.id.webView2);
mWebView2.setOnClickListener(this);
mBandName.setText(getDeviceBrand());
}
/**
* 确定应用程序是否已经忽略电池优化
*
* @return
*/
private boolean isIgnoringBatteryOptimizations() {
boolean isIgnoring = false;
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (powerManager != null) {
isIgnoring = powerManager.isIgnoringBatteryOptimizations(getPackageName());
}
return isIgnoring;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
//super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case 1:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Intent intents = null;
for (Intent intent : AutoStartAppUtil.POWERMANAGER_INTENTS)
if (getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
intents = intent;
break;
}
if (intents != null) {
startActivity(intents);
}
} else {
Toast.makeText(this, "无权打开系统界面, 请点击查看教程手动设置", Toast.LENGTH_SHORT).show();
}
break;
default:
}
}
/**
* 原生Android系统 开启后台运行调用这里
*/
public void requestIgnoreBatteryOptimizations() {
try {
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + getPackageName()));
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
moveTaskToBack(true);//按返回键,不 finish activity
return true;
}
return super.onKeyDown(keyCode, event);
}
/**
* 获取当前手机系统语言。
*
* @return 返回当前系统语言。例如:当前设置的是“中文-中国”,则返回“zh-CN”
*/
public static String getSystemLanguage() {
return Locale.getDefault().getLanguage();
}
/**
* 获取当前系统上的语言列表(Locale列表)
*
* @return 语言列表
*/
public static Locale[] getSystemLanguageList() {
return Locale.getAvailableLocales();
}
/**
* 获取当前手机系统版本号
*
* @return 系统版本号
*/
public static String getSystemVersion() {
return android.os.Build.VERSION.RELEASE;
}
/**
* 获取手机型号
*
* @return 手机型号
*/
public static String getSystemModel() {
return android.os.Build.MODEL;
}
/**
* 获取手机厂商
*
* @return 手机厂商
*/
public static String getDeviceBrand() {
return android.os.Build.BRAND;
}
}
@@ -55,10 +55,11 @@
android:layout_width="@dimen/dp_90" android:layout_width="@dimen/dp_90"
android:layout_height="@dimen/dp_90" android:layout_height="@dimen/dp_90"
android:background="#EEEEEE"> android:background="#EEEEEE">
<ImageView <ImageView
android:id="@+id/img1" android:id="@+id/img1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent" />
</RelativeLayout> </RelativeLayout>
<LinearLayout <LinearLayout
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
@@ -71,14 +72,14 @@
android:layout_marginTop="@dimen/dp_7" android:layout_marginTop="@dimen/dp_7"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/name_one" android:id="@+id/name_one"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="卸货照片" android:text="卸货照片"
android:textColor="#ff000000" android:textColor="#ff000000"
android:textSize="@dimen/sp_13" android:textSize="@dimen/sp_13" />
/>
<TextView <TextView
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:id="@+id/time_one" android:id="@+id/time_one"
-221
View File
@@ -1,221 +0,0 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/titleBar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:clipToPadding="true"
tools:context=".activity.BaseActivity">
<!--android:fitsSystemWindows="true"-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal"
android:padding="10dp">
<TextView
android:id="@+id/left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:text="返回"
android:textColor="@android:color/black"
android:visibility="visible" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="后台运行设置"
android:textColor="@android:color/black"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:gravity="center"
android:text=""
android:textColor="@android:color/black"
android:visibility="gone" />
</RelativeLayout>
<View
android:id="@+id/line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="?android:attr/listDivider"
android:visibility="visible" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="你的手机"
android:textColor="@android:color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/bandName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:gravity="center_vertical"
android:text="HUAWEI"
android:textColor="@android:color/holo_orange_dark"
android:textSize="18sp" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="20dp"
android:text="为什么要让应用程序在后台运行?"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingStart="40dp"
android:paddingTop="20dp"
android:paddingEnd="40dp"
android:paddingBottom="20dp"
android:text="接收通知需要应用在后台持续运行,以避免进程被系统终止。 这可能会错过来电和信息。"
android:textColor="@android:color/black"
android:textSize="14sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingStart="40dp"
android:paddingEnd="40dp"
android:text="注意:如果您的手机上安装了第三方安全管理应用,请将IMFitPro添加到它们的例外中, 不受其约束。"
android:textColor="@android:color/black"
android:textSize="14sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp">
<TextView
android:id="@+id/tutorials"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawablePadding="20dp"
android:gravity="center"
android:text="查看自启动教程"
android:textColor="@android:color/holo_orange_dark"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:id="@+id/autoStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawablePadding="20dp"
android:gravity="center"
android:text="设置自启动"
android:textColor="@android:color/holo_orange_dark"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:id="@+id/lockApp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawablePadding="20dp"
android:gravity="center"
android:text="在后台锁定应用程序"
android:textColor="@android:color/holo_orange_dark"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:id="@+id/battery_optimization"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawablePadding="20dp"
android:gravity="center"
android:text="忽略电池优化"
android:textColor="@android:color/holo_orange_dark"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:visibility="gone" />
<WebView
android:id="@+id/webView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
Binary file not shown.
+1 -1
View File
@@ -77,8 +77,8 @@ dependencies {
api rootProject.ext.dependencies["3Dmap"] api rootProject.ext.dependencies["3Dmap"]
api rootProject.ext.dependencies["Location"] api rootProject.ext.dependencies["Location"]
api rootProject.ext.dependencies["Search"] api rootProject.ext.dependencies["Search"]
api 'com.gyf.cactus:cactus:1.1.3-beta13'
api 'com.github.kymjs:themvp:2.0.0'
//友盟基础库(必须) //友盟基础库(必须)
// api 'com.umeng.umsdk:common:9.4.4' // api 'com.umeng.umsdk:common:9.4.4'
@@ -1,163 +0,0 @@
package com.dahe.mylibrary.utils;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.util.Log;
import android.view.WindowManager;
import com.dahe.mylibrary.R;
/**
* @ClassName MobileInfoUtils
* @Author 用户
* @Date 2022/10/8 10:18
* @Description TODO
*/
public class MobileInfoUtils {
// private SettingDialogPermision dialog_per;
//获取手机类型
private static String getMobileType() {
return Build.MANUFACTURER;
}
//跳转至授权页面
public void jumpStartInterface(Context context) {
Intent intent = new Intent();
try {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.e("HLQ_Struggle", "******************当前手机型号为:" + getMobileType());
ComponentName componentName = null;
if (getMobileType().equals("Xiaomi")) { // 红米Note4测试通过
componentName = new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity");
} else if (getMobileType().equals("Letv")) { // 乐视2测试通过
intent.setAction("com.letv.android.permissionautoboot");
} else if (getMobileType().equals("samsung")) { // 三星Note5测试通过
//componentName = new ComponentName("com.samsung.android.sm_cn", "com.samsung.android.sm.ui.ram.AutoRunActivity");
//componentName = ComponentName.unflattenFromString("com.samsung.android.sm/.ui.ram.RamActivity");// Permission Denial not exported from uid 1000,不允许被其他程序调用
componentName = ComponentName.unflattenFromString("com.samsung.android.sm/.app.dashboard.SmartManagerDashBoardActivity");
} else if (getMobileType().equals("HUAWEI")) { // 华为测试通过
//componentName = new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity");//锁屏清理
componentName = ComponentName.unflattenFromString("com.huawei.systemmanager/.startupmgr.ui.StartupNormalAppListActivity");//跳自启动管理
//SettingOverlayView.show(context);
} else if (getMobileType().equals("vivo")) { // VIVO测试通过
componentName = ComponentName.unflattenFromString("com.iqoo.secure/.safeguard.PurviewTabActivity");
} else if (getMobileType().equals("Meizu")) { //万恶的魅族
//componentName = ComponentName.unflattenFromString("com.meizu.safe/.permission.PermissionMainActivity");//跳转到手机管家
componentName = ComponentName.unflattenFromString("com.meizu.safe/.permission.SmartBGActivity");//跳转到后台管理页面
} else if (getMobileType().equals("OPPO")) { // OPPO R8205测试通过
componentName = ComponentName.unflattenFromString("com.oppo.safe/.permission.startup.StartupAppListActivity");
} else if (getMobileType().equals("ulong")) { // 360手机 未测试
componentName = new ComponentName("com.yulong.android.coolsafe", ".ui.activity.autorun.AutoRunListActivity");
} else {
// 将用户引导到系统设置页面
if (Build.VERSION.SDK_INT >= 9) {
Log.e("HLQ_Struggle", "APPLICATION_DETAILS_SETTINGS");
intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.fromParts("package", context.getPackageName(), null));
} else if (Build.VERSION.SDK_INT <= 8) {
intent.setAction(Intent.ACTION_VIEW);
intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
intent.putExtra("com.android.settings.ApplicationPkgName", context.getPackageName());
}
}
intent.setComponent(componentName);
context.startActivity(intent);
// if (getMobileType().equals("Xiaomi")) {
//
// showtip();//显示弹窗(**特别注意**
//
// }
//
// if (getMobileType().equals("samsung")){
//
// new SettingOverlayView().show(context);//
//
// }
} catch (Exception e) {//抛出异常就直接打开设置页面
Log.e("HLQ_Struggle", e.getLocalizedMessage());
intent = new Intent(Settings.ACTION_SETTINGS);
context.startActivity(intent);
}
}
//小米手机显示弹窗
// private void showtip() {
//
// try {
//
// dialog_per=new SettingDialogPermision(context, R.style.CustomDialog4);
//
// dialog_per.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);//注意这里改成吐司类型
//
// dialog_per.show();
//
// Log.e("HLQ_Struggle","显示弹窗");
//
// } catch (Exception e) {
//
// e.printStackTrace();
//
// Log.e("HLQ_Struggle", "没有显示弹窗"+e.getMessage());
//
// }
//
// }
}