version:1.0
update:2021-10-21 10:14:40 fix: add:增加开机检测弹窗,增加常驻通知
This commit is contained in:
@@ -46,7 +46,7 @@ android {
|
||||
channel_value: "newly",
|
||||
]
|
||||
/*********************************极光推送end************************************/
|
||||
buildConfigField "String", "ROOT_URL", '"http://led.aoleyun.cn/api/"'
|
||||
buildConfigField "String", "ROOT_URL", '"https://led.aoleyun.cn/api/"'
|
||||
buildConfigField "String", "SCREEN_BASE_URL", '"https://led.aoleyun.cn:2018/"'
|
||||
buildConfigField "String", "SCREEN_URL", '"https://led.aoleyun.cn:2018/wm/is_online"'
|
||||
buildConfigField "String", "WebsocketURL", '"wss://led.aoleyun.cn:2018"'
|
||||
@@ -64,7 +64,7 @@ android {
|
||||
channel_value: "newly",
|
||||
]
|
||||
/*********************************极光推送end************************************/
|
||||
buildConfigField "String", "ROOT_URL", '"http://led.aoleyun.cn/api/"'
|
||||
buildConfigField "String", "ROOT_URL", '"https://led.aoleyun.cn/api/"'
|
||||
buildConfigField "String", "SCREEN_BASE_URL", '"https://led.aoleyun.cn:2018/"'
|
||||
buildConfigField "String", "SCREEN_URL", '"https://led.aoleyun.cn:2018/wm/is_online"'
|
||||
buildConfigField "String", "WebsocketURL", '"wss://led.aoleyun.cn:2018"'
|
||||
@@ -84,7 +84,7 @@ android {
|
||||
channel_value: "beta",
|
||||
]
|
||||
/*********************************极光推送end************************************/
|
||||
buildConfigField "String", "ROOT_URL", '"http://led.aoleyun.cn/api/"'
|
||||
buildConfigField "String", "ROOT_URL", '"https://led.aoleyun.cn/api/"'
|
||||
buildConfigField "String", "SCREEN_BASE_URL", '"https://led.aoleyun.cn:2018/"'
|
||||
buildConfigField "String", "SCREEN_URL", '"https://led.aoleyun.cn:2018/wm/is_online"'
|
||||
buildConfigField "String", "WebsocketURL", '"wss://led.aoleyun.cn:2018"'
|
||||
@@ -163,7 +163,7 @@ android {
|
||||
zhanRuiRelease.initWith(release)
|
||||
zhanRuiRelease {
|
||||
manifestPlaceholders = [
|
||||
AMAP_KEY: "546eb5646a65ac6a5b7d1c7456466e05"
|
||||
AMAP_KEY: "6e339305206eeb43f2b4cc1f31751f89"
|
||||
]
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
signingConfig signingConfigs.zhanRui
|
||||
@@ -172,7 +172,7 @@ android {
|
||||
zhanRuiDebug.initWith(debug)
|
||||
zhanRuiDebug {
|
||||
manifestPlaceholders = [
|
||||
AMAP_KEY: "546eb5646a65ac6a5b7d1c7456466e05"
|
||||
AMAP_KEY: "6e339305206eeb43f2b4cc1f31751f89"
|
||||
]
|
||||
versionNameSuffix "-debug"
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
@@ -184,7 +184,7 @@ android {
|
||||
zhanRuiUserdebug.initWith(zhanRuiDebug)
|
||||
zhanRuiUserdebug {
|
||||
manifestPlaceholders = [
|
||||
AMAP_KEY: "546eb5646a65ac6a5b7d1c7456466e05"
|
||||
AMAP_KEY: "6e339305206eeb43f2b4cc1f31751f89"
|
||||
]
|
||||
versionNameSuffix "-debug"
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
@@ -195,7 +195,7 @@ android {
|
||||
zhanRuiUserdebugReleas.initWith(release)
|
||||
zhanRuiUserdebugReleas {
|
||||
manifestPlaceholders = [
|
||||
AMAP_KEY: "546eb5646a65ac6a5b7d1c7456466e05"
|
||||
AMAP_KEY: "6e339305206eeb43f2b4cc1f31751f89"
|
||||
]
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
debuggable true
|
||||
|
||||
@@ -12,6 +12,8 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -46,37 +48,63 @@ import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.Scheduler;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
|
||||
public class CheckNetActivity extends BaseActivity implements MainContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
@BindView(R.id.giv_1)
|
||||
GifImageView giv_1;
|
||||
@BindView(R.id.giv_2)
|
||||
GifImageView giv_2;
|
||||
@BindView(R.id.giv_3)
|
||||
GifImageView giv_3;
|
||||
@BindView(R.id.tv_1)
|
||||
TextView tv_1;
|
||||
@BindView(R.id.tv_2)
|
||||
TextView tv_2;
|
||||
@BindView(R.id.tv_3)
|
||||
TextView tv_3;
|
||||
|
||||
private static final String TAG = CheckNetActivity.class.getSimpleName();
|
||||
private MainPresenter mPresenter;
|
||||
|
||||
private boolean netWorkIsRunning = false;
|
||||
private boolean updateApp = false;
|
||||
|
||||
//jiguang
|
||||
public static boolean isForeground = false;
|
||||
//for receive customer msg from jpush server
|
||||
private CheckNetActivity.MessageReceiver mMessageReceiver;
|
||||
private MessageReceiver mMessageReceiver;
|
||||
public static final String MESSAGE_RECEIVED_ACTION = "com.aoleyun.sn.MESSAGE_RECEIVED_ACTION";
|
||||
public static final String KEY_TITLE = "title";
|
||||
public static final String KEY_MESSAGE = "message";
|
||||
public static final String KEY_EXTRAS = "extras";
|
||||
|
||||
// @Override
|
||||
// protected void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// setContentView(R.layout.activity_checknet);
|
||||
// }
|
||||
private static Handler mHandler;
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
Log.e("OnNetworkStatusChangedListener", "onDisconnected: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e("OnNetworkStatusChangedListener", "onConnected: ");
|
||||
timeMillis = SystemClock.elapsedRealtime();
|
||||
//直接获取数据
|
||||
mPresenter.getLockedState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_checknet;
|
||||
}
|
||||
|
||||
boolean isAvailable = false;
|
||||
int runTimes = 0;
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
@@ -88,8 +116,64 @@ public class CheckNetActivity extends BaseActivity implements MainContact.MainVi
|
||||
mPresenter.getFirstConnect();
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
getDevicesInfo();
|
||||
mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
Resut resut = (Resut) msg.obj;
|
||||
if (resut.Times == 10) {
|
||||
if (resut.isAvailable) {
|
||||
giv_1.setImageResource(R.drawable.successful);
|
||||
} else {
|
||||
giv_1.setImageResource(R.drawable.failed);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
checkNetworkIsAvailable();
|
||||
}
|
||||
|
||||
private static class Resut {
|
||||
int Times;
|
||||
boolean isAvailable;
|
||||
}
|
||||
|
||||
private void checkNetworkIsAvailable() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
while (!isAvailable && runTimes < 10) {
|
||||
runTimes++;
|
||||
Log.e("initView", "run: " + "第" + runTimes + "次检测网络");
|
||||
if (NetworkUtils.isAvailable()) {
|
||||
Resut resut = new Resut();
|
||||
resut.Times = runTimes;
|
||||
resut.isAvailable = true;
|
||||
Message message = new Message();
|
||||
message.obj = resut;
|
||||
mHandler.sendMessage(message);
|
||||
} else {
|
||||
Resut resut = new Resut();
|
||||
resut.Times = runTimes;
|
||||
resut.isAvailable = false;
|
||||
Message message = new Message();
|
||||
message.obj = resut;
|
||||
mHandler.sendMessage(message);
|
||||
}
|
||||
try {
|
||||
synchronized (this) {
|
||||
wait(1200);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
private void getDevicesInfo() {
|
||||
String sn = Utils.getSerial();
|
||||
checkSNError(sn);
|
||||
@@ -254,14 +338,7 @@ public class CheckNetActivity extends BaseActivity implements MainContact.MainVi
|
||||
|
||||
@Override
|
||||
public void buttonCheckUpdateFinished(boolean update, JsonObject jsonObject) {
|
||||
this.updateApp = !update;
|
||||
if (update) {
|
||||
showDialog(jsonObject);
|
||||
} else {
|
||||
Observable.timer(5000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> ToastUtil.show("已经是最新版本"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -402,14 +479,12 @@ public class CheckNetActivity extends BaseActivity implements MainContact.MainVi
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
isForeground = false;
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
isForeground = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -495,19 +570,6 @@ public class CheckNetActivity extends BaseActivity implements MainContact.MainVi
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
Log.e("OnNetworkStatusChangedListener", "onDisconnected: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e("OnNetworkStatusChangedListener", "onConnected: ");
|
||||
timeMillis = SystemClock.elapsedRealtime();
|
||||
//直接获取数据
|
||||
mPresenter.getLockedState();
|
||||
}
|
||||
|
||||
public static class MessageReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
@@ -24,6 +25,7 @@ import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.network.HTTPInterface;
|
||||
import com.aoleyun.sn.service.LogcatService;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.Logutils;
|
||||
@@ -55,8 +57,8 @@ public class HomeActivity extends AppCompatActivity {
|
||||
initView();
|
||||
debugTest();
|
||||
new Handler().postDelayed(() -> {
|
||||
// startActivity(new Intent(HomeActivity.this, MainActivity.class));
|
||||
startActivity(new Intent(HomeActivity.this, CheckNetActivity.class));
|
||||
startActivity(new Intent(HomeActivity.this, MainActivity.class));
|
||||
// startActivity(new Intent(HomeActivity.this, CheckNetActivity.class));
|
||||
finish();
|
||||
}, 2000);
|
||||
}
|
||||
@@ -134,8 +136,15 @@ public class HomeActivity extends AppCompatActivity {
|
||||
Logutils.e(TAG, "debugTest: SPUtils all " + SPUtils.getAll(this));
|
||||
|
||||
PackageManager packageManager = getPackageManager();
|
||||
packageManager.setApplicationEnabledSetting(PackageNames.OLD_DEVICE_INFO, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
packageManager.setApplicationEnabledSetting(PackageNames.OLD_APPSTORE, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
// packageManager.setApplicationEnabledSetting(PackageNames.OLD_DEVICE_INFO, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
// packageManager.setApplicationEnabledSetting(PackageNames.OLD_APPSTORE, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
HTTPInterface.getPublicIP(this, new HTTPInterface.PublicIP() {
|
||||
@Override
|
||||
public void set(String ip) {
|
||||
Log.e("getPublicIP", "set: " + ip);
|
||||
}
|
||||
});
|
||||
Log.e("getLocalIP", "set: " + Utils.getIPAddress(this));
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
|
||||
@@ -8,11 +8,15 @@ import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.action.JGYActions;
|
||||
import com.aoleyun.sn.network.api.newapi.GetPublicIPApi;
|
||||
import com.aoleyun.sn.network.api.newapi.SendScreenStatusApi;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -55,6 +59,10 @@ import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import retrofit2.http.GET;
|
||||
|
||||
import static com.aoleyun.sn.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
import static com.aoleyun.sn.jpush.TagAliasOperatorHelper.sequence;
|
||||
@@ -846,4 +854,72 @@ public class HTTPInterface {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface PublicIP {
|
||||
void set(String ip);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备公网IP
|
||||
*
|
||||
* @param context
|
||||
* @param publicIP
|
||||
*/
|
||||
public static void getPublicIP(Context context, PublicIP publicIP) {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.client(NetInterfaceManager.getInstance().getOkHttpClient())
|
||||
.baseUrl(UrlAddress.SHOUHU_CITYJSON)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
GetPublicIPApi getPublicIPApi = retrofit.create(GetPublicIPApi.class);
|
||||
getPublicIPApi.getJpushTags()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getPublicIP", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
try {
|
||||
String s = responseBody.string();
|
||||
Log.e("getPublicIP", "onNext: " + s);
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
//var returnCitySN = {"cip": "183.11.74.141", "cid": "440300", "cname": "广东省深圳市"};
|
||||
if (s.contains("{")) {
|
||||
String jsonString = s.substring(s.indexOf("{"), s.lastIndexOf("}") + 1);
|
||||
JsonObject jsonObject = JsonParser.parseString(jsonString).getAsJsonObject();
|
||||
String ip = jsonObject.get("cip").getAsString();
|
||||
if (!TextUtils.isEmpty(ip)) {
|
||||
publicIP.set(ip);
|
||||
} else {
|
||||
publicIP.set("");
|
||||
}
|
||||
} else {
|
||||
publicIP.set("");
|
||||
}
|
||||
} else {
|
||||
publicIP.set("");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("getPublicIP", "IOException: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getPublicIP", "onError: " + e.getMessage());
|
||||
publicIP.set("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getPublicIP", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.aoleyun.sn.network;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.bean.Appground;
|
||||
@@ -48,10 +49,15 @@ import com.aoleyun.sn.network.api.newapi.SnTimeControlApi;
|
||||
import com.aoleyun.sn.network.api.newapi.StudentsInfosApi;
|
||||
import com.aoleyun.sn.network.api.newapi.TopAppControlApi;
|
||||
import com.aoleyun.sn.network.api.newapi.UpdateDeviceInfoApi;
|
||||
import com.aoleyun.sn.utils.MD5Util;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
@@ -59,7 +65,11 @@ import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Protocol;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.CallAdapter;
|
||||
import retrofit2.Converter;
|
||||
@@ -73,6 +83,7 @@ public class NetInterfaceManager {
|
||||
private Context mContext;
|
||||
private Retrofit mRetrofit;
|
||||
private OkHttpClient okHttpClient;
|
||||
private final ConcurrentHashMap<String, Long> requestIdsMap = new ConcurrentHashMap<>();
|
||||
|
||||
//超时时间
|
||||
private static int timeOut = 5;
|
||||
@@ -80,16 +91,73 @@ public class NetInterfaceManager {
|
||||
private static long cacheSize = 1024 * 1024 * 64;
|
||||
|
||||
public static final String HTTP_KEY = "YTM3YTAxNTJmMmZmNzkyM2E2YzIwZjlhZTc0NzNmMGI=";
|
||||
public static final String CUSTOM_REPEAT_REQ_PROTOCOL = "MY_CUSTOM_REPEAT_REQ_PROTOCOL";
|
||||
|
||||
private NetInterfaceManager(Context context) {
|
||||
this.mContext = context;
|
||||
if (okHttpClient == null) {
|
||||
Interceptor myHttpInterceptor = new Interceptor() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Response intercept(@NotNull Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
String requestKey = MD5Util.getUpperMD5Str(request.method() + request.url().toString());
|
||||
Response response = chain.proceed(request); //准备返回Response
|
||||
// try {
|
||||
// response.close();
|
||||
// response = chain.proceed(request);
|
||||
// } catch (Exception e) {
|
||||
// Log.e(TAG, "intercept: " + e.getMessage());
|
||||
// //异常的返回也是完成Http请求。在这里移除请求登记
|
||||
// if (!TextUtils.isEmpty(e.toString()) && e.toString().contains(NetInterfaceManager.CUSTOM_REPEAT_REQ_PROTOCOL)) {
|
||||
// Log.e("REPEAT-REQUEST", "移除请求1:" + requestKey + " --- " + Thread.currentThread().getName() + " URL = " + request.url());
|
||||
// } else {
|
||||
// requestIdsMap.remove(requestKey);
|
||||
// }
|
||||
// throw e;
|
||||
// }
|
||||
synchronized (requestIdsMap) {
|
||||
requestIdsMap.remove(requestKey); //在这里移除正常的请求登记
|
||||
Log.e("REPEAT-REQUEST", "移除请求2:" + requestKey + " --- " + Thread.currentThread().getName() + " URL = " + request.url());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
};
|
||||
Interceptor mRequestInterceptor = new Interceptor() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Response intercept(@NotNull Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
//拦截处理重复的HTTP 请求,类似 防止快速点击按钮去重 可以不去处理了,全局统一处理
|
||||
String requestKey = MD5Util.getUpperMD5Str(request.method() + request.url().toString());
|
||||
synchronized (requestIdsMap) {
|
||||
if (requestIdsMap.get(requestKey) == null) {
|
||||
// Log.e("REPEAT-REQUEST", "intercept: " + requestIdsMap);
|
||||
requestIdsMap.put(requestKey, System.currentTimeMillis());
|
||||
Log.e("REPEAT-REQUEST", "注册请求:" + requestKey + " --- " + Thread.currentThread().getName() + " URL = " + request.url());
|
||||
} else {
|
||||
//如果是重复的请求,抛出一个自定义的错误,这个错误大家根据自己的业务定义吧
|
||||
Log.e("REPEAT-REQUEST", "重复请求:" + requestKey + " --- " + Thread.currentThread().getName() + " URL = " + request.url());
|
||||
return new Response.Builder()
|
||||
.protocol(Protocol.get(CUSTOM_REPEAT_REQ_PROTOCOL))
|
||||
.request(request) //multi thread
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Response originalResponse = chain.proceed(request);
|
||||
return originalResponse.newBuilder().build();
|
||||
}
|
||||
};
|
||||
|
||||
//如果无法生存缓存文件目录,检测权限使用已经加上,检测手机是否把文件读写权限禁止了
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(timeOut, TimeUnit.SECONDS); // 设置连接超时时间
|
||||
builder.writeTimeout(timeOut, TimeUnit.SECONDS);// 设置写入超时时间
|
||||
builder.readTimeout(timeOut, TimeUnit.SECONDS);// 设置读取数据超时时间
|
||||
builder.retryOnConnectionFailure(true);// 设置进行连接失败重试
|
||||
builder.addInterceptor(myHttpInterceptor);
|
||||
builder.addNetworkInterceptor(mRequestInterceptor);
|
||||
|
||||
// 设置缓存文件路径
|
||||
String cacheDirectory = mContext.getExternalCacheDir().getAbsolutePath() + "/OkHttpCache";
|
||||
Cache cache = new Cache(new File(cacheDirectory), cacheSize);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class UrlAddress {
|
||||
//获取隐藏桌面图标
|
||||
public static final String GET_HIDE_DESKTOPICON = "Icon";
|
||||
//获取应用升级自启
|
||||
public final static String NET_AND_LAUNCH_API = "automatic/get";
|
||||
public static final String NET_AND_LAUNCH_API = "automatic/get";
|
||||
//通过sn获取信息
|
||||
public static final String GET_STUDENTS_INFO = "Sn/getStudent";
|
||||
//上传截图
|
||||
@@ -50,28 +50,30 @@ public class UrlAddress {
|
||||
//上传我的设备
|
||||
//public static final String UPDATE_DEVICEINFO = "Mac/getInfo";
|
||||
//获取霸屏状态
|
||||
public final static String GET_LOCK_SCREEN_STATE = "Sn/getSnScreen";
|
||||
public static final String GET_LOCK_SCREEN_STATE = "Sn/getSnScreen";
|
||||
//获取默认桌面升级
|
||||
public final static String GET_DESKTOP = "Sn/getSnDesktop";
|
||||
public static final String GET_DESKTOP = "Sn/getSnDesktop";
|
||||
//获取时间管控
|
||||
public final static String GET_SN_TIME_CONTROL = "Sn/getSnTimeControl";
|
||||
public static final String GET_SN_TIME_CONTROL = "Sn/getSnTimeControl";
|
||||
//获取顶部app管控
|
||||
public final static String GET_TOP_APP_CONTROL = "Sn/getSnAppControl";
|
||||
public static final String GET_TOP_APP_CONTROL = "Sn/getSnAppControl";
|
||||
//获取测试app
|
||||
public final static String GET_SN_APP_TEST = "Sn/getSnAppTest";
|
||||
public static final String GET_SN_APP_TEST = "Sn/getSnAppTest";
|
||||
//开机动画
|
||||
public final static String GET_LOGO_IMG = "Sn/getLogoImg";
|
||||
public static final String GET_LOGO_IMG = "Sn/getLogoImg";
|
||||
//开发人员选项开关
|
||||
public final static String GET_DEVELOPER = "Sn/getDeveloper";
|
||||
public static final String GET_DEVELOPER = "Sn/getDeveloper";
|
||||
//通过固件名获取内置应用
|
||||
public final static String GET_ROM_APP = "And/getFirmwareApp";
|
||||
public static final String GET_ROM_APP = "And/getFirmwareApp";
|
||||
//获取全部应用
|
||||
public final static String GET_ALL_APP = "recommend/index";
|
||||
public static final String GET_ALL_APP = "recommend/index";
|
||||
//获取电子书包激活码
|
||||
public final static String GET_EBAG_CODE = "And/getEbagCode";
|
||||
public static final String GET_EBAG_CODE = "And/getEbagCode";
|
||||
//获取系统默认程序
|
||||
public final static String GET_DEFAULT_APP = "app/getDefaultApp";
|
||||
public static final String GET_DEFAULT_APP = "app/getDefaultApp";
|
||||
|
||||
//获取公网IP
|
||||
public static final String SHOUHU_CITYJSON = "http://pv.sohu.com/cityjson/";
|
||||
//删除alias
|
||||
public static final String DELETE_JPUSH_ALIAS = "https://device.jpush.cn/v3/aliases/";
|
||||
//删除tags
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.aoleyun.sn.network.api.newapi;
|
||||
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* @author : fanhuitong
|
||||
* e-mail :
|
||||
* @date : 2021/10/1814:39
|
||||
* desc :
|
||||
* version: 1.0
|
||||
*/
|
||||
public interface GetPublicIPApi {
|
||||
@GET(UrlAddress.SHOUHU_CITYJSON)
|
||||
Observable<ResponseBody> getJpushTags();
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.sn.activity.CheckNetActivity;
|
||||
import com.aoleyun.sn.service.MainService;
|
||||
import com.aoleyun.sn.utils.BootManager;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
@@ -48,7 +49,7 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getLockedState", "onError: "+e.getMessage());
|
||||
Log.e("getLockedState", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,6 +73,7 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
default:
|
||||
break;
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
context.startActivity(new Intent(context, CheckNetActivity.class));
|
||||
JGYUtils.startServices(context);
|
||||
new BootManager(context).start();
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.aoleyun.sn.service;
|
||||
|
||||
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.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
@@ -8,8 +12,10 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
@@ -23,6 +29,10 @@ import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
@@ -173,6 +183,8 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
//发送设备mac地址和信息
|
||||
mPresenter.sendMACAddress();
|
||||
setFloatingWindow(this);
|
||||
createNotificationChannel();
|
||||
sendSimpleNotification();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -215,6 +227,41 @@ public class MainService extends Service implements MainContact.MainView, Networ
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void createNotificationChannel() {
|
||||
// Create the NotificationChannel, but only on API 26+ because
|
||||
// the NotificationChannel class is new and not in the support library
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
CharSequence name = channel_name;
|
||||
String description = channel_description;
|
||||
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
|
||||
channel.setDescription(description);
|
||||
// Register the channel with the system; you can't change the importance
|
||||
// or other notification behaviors after this
|
||||
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String CHANNEL_ID = "CHANNEL_ID";
|
||||
private static final String channel_name = "系统通知";
|
||||
private static final String channel_description = "我的设备系统通知";
|
||||
|
||||
private void sendSimpleNotification() {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "CHANNEL_ID")
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setContentTitle("设备管控中")
|
||||
// .setContentText("测试内容")
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(false)
|
||||
.setOngoing(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_MAX);
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
||||
// notificationId is a unique int for each notification that you must define
|
||||
notificationManager.notify(1, builder.build());
|
||||
|
||||
}
|
||||
|
||||
private void addShortcut() {
|
||||
ApkUtils.addShortcut(MainService.this);
|
||||
}
|
||||
|
||||
112
app/src/main/java/com/aoleyun/sn/utils/MD5Util.java
Normal file
112
app/src/main/java/com/aoleyun/sn/utils/MD5Util.java
Normal file
@@ -0,0 +1,112 @@
|
||||
package com.aoleyun.sn.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class MD5Util {
|
||||
|
||||
public static String packetMD5(String str) {
|
||||
MessageDigest messageDigest = null;
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
|
||||
messageDigest.reset();
|
||||
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
System.out.println("NoSuchAlgorithmException caught!");
|
||||
System.exit(-1);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
|
||||
StringBuffer md5StrBuff = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
|
||||
md5StrBuff.append("0").append(
|
||||
Integer.toHexString(0xFF & byteArray[i]));
|
||||
else
|
||||
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
}
|
||||
|
||||
return md5StrBuff.toString();
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public static String getUpperMD5Str(String str) {
|
||||
MessageDigest messageDigest = null;
|
||||
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
|
||||
messageDigest.reset();
|
||||
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
System.out.println("NoSuchAlgorithmException caught!");
|
||||
System.exit(-1);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
|
||||
StringBuffer md5StrBuff = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
|
||||
md5StrBuff.append("0").append(
|
||||
Integer.toHexString(0xFF & byteArray[i]));
|
||||
else
|
||||
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
}
|
||||
|
||||
return md5StrBuff.toString().toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取16位的MD5 值得
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
@SuppressLint("DefaultLocale")
|
||||
public static String getUpperMD5Str16(String str) {
|
||||
MessageDigest messageDigest = null;
|
||||
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
|
||||
messageDigest.reset();
|
||||
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
System.out.println("NoSuchAlgorithmException caught!");
|
||||
System.exit(-1);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
|
||||
StringBuffer md5StrBuff = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
|
||||
md5StrBuff.append("0").append(
|
||||
Integer.toHexString(0xFF & byteArray[i]));
|
||||
else
|
||||
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
}
|
||||
|
||||
return md5StrBuff.toString().toUpperCase().substring(8, 24);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,6 +72,8 @@ import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.security.MessageDigest;
|
||||
@@ -83,6 +85,7 @@ import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -1507,5 +1510,36 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本机IP
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static String getIPAddress(Context context) {
|
||||
ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);//获取系统的连接服务
|
||||
NetworkInfo mActiveNetInfo = mConnectivityManager.getActiveNetworkInfo();//获取网络连接的信息
|
||||
NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
|
||||
if (info != null && info.isConnected()) {
|
||||
if ((info.getType() == ConnectivityManager.TYPE_MOBILE) || (info.getType() == ConnectivityManager.TYPE_WIFI)) {//当前使用2G/3G/4G网络
|
||||
try {
|
||||
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
|
||||
NetworkInterface intf = en.nextElement();
|
||||
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
|
||||
InetAddress inetAddress = enumIpAddr.nextElement();
|
||||
if (!inetAddress.isLoopbackAddress() && inetAddress instanceof Inet4Address) {
|
||||
return inetAddress.getHostAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else { //当前无网络连接,请在设置中打开网络
|
||||
return "网络未连接";
|
||||
}
|
||||
return "获取失败";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/failed.png
Normal file
BIN
app/src/main/res/drawable-hdpi/failed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-hdpi/successful.png
Normal file
BIN
app/src/main/res/drawable-hdpi/successful.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@@ -17,7 +17,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
@@ -36,9 +36,10 @@
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView5">
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设备联网状态"
|
||||
@@ -49,6 +50,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/giv_1"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:background="@drawable/loading"
|
||||
@@ -68,6 +70,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设备连接服务器"
|
||||
@@ -78,6 +81,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/giv_2"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:background="@drawable/loading"
|
||||
@@ -97,6 +101,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="获取最新管控策略"
|
||||
@@ -107,6 +112,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/giv_3"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:background="@drawable/loading"
|
||||
@@ -117,6 +123,7 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginBottom="16dp"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
@@ -36,9 +36,10 @@
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView5">
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设备联网状态"
|
||||
@@ -49,6 +50,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/giv_1"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:background="@drawable/loading"
|
||||
@@ -68,6 +70,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设备连接服务器"
|
||||
@@ -78,6 +81,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/giv_2"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:background="@drawable/loading"
|
||||
@@ -97,6 +101,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="获取最新管控策略"
|
||||
@@ -107,6 +112,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/giv_3"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:background="@drawable/loading"
|
||||
@@ -117,6 +123,7 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginBottom="16dp"
|
||||
|
||||
@@ -46,4 +46,17 @@
|
||||
<!--背景是否模糊显示-->
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
</style>
|
||||
|
||||
<style name="dialog" parent="@android:style/Theme.Dialog">
|
||||
<item name="android:windowFrame">@null</item> //Dialog的windowFrame框为无
|
||||
<item name="android:windowIsFloating">true</item> //是否浮现在activity之上
|
||||
<item name="android:windowIsTranslucent">true</item> //是否半透明
|
||||
<item name="android:windowNoTitle">true</item> //是否显示title
|
||||
<item name="android:background">@android:color/transparent</item> //设置dialog的背景
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:backgroundDimAmount">0.7</item> //就是用来控制灰度的值,当为1时,界面除了我们的dialog内容是高亮显示的,dialog以外的区域是黑色的,完全看不到其他内容
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
include ':app'
|
||||
rootProject.name='我的设备'
|
||||
rootProject.name='奥乐云我的设备'
|
||||
|
||||
Reference in New Issue
Block a user