蓝牙连接后,每次都走绑定
This commit is contained in:
parent
07ae06fa30
commit
695487920f
|
|
@ -26,5 +26,5 @@ android.enableJetifier=true
|
|||
android.useAndroidX=true
|
||||
android.useDeprecatedNdk=true
|
||||
|
||||
versionCode=50
|
||||
versionName=4.11.10
|
||||
versionCode=51
|
||||
versionName=4.11.11
|
||||
|
|
@ -120,7 +120,7 @@ public class MainTabActivity extends BaseFragmentActivity {
|
|||
onParseIntent();
|
||||
initView();
|
||||
init();
|
||||
StartWifiChangeTimer();
|
||||
// StartWifiChangeTimer();
|
||||
|
||||
//**
|
||||
//* 注意: 即使您已经在AndroidManifest.xml中配置过appkey和channel值,也需要在App代码中调
|
||||
|
|
@ -262,14 +262,20 @@ public class MainTabActivity extends BaseFragmentActivity {
|
|||
finish();
|
||||
}
|
||||
|
||||
User user;
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
StartWifiChangeTimer();
|
||||
user = Commons.USER;
|
||||
if (user!=null){
|
||||
StartWifiChangeTimer(user.getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
private void StartWifiChangeTimer() {
|
||||
if (timer == null) {
|
||||
private void StartWifiChangeTimer(String userId) {
|
||||
|
||||
L.i("jjia--------wifi--切换了---");
|
||||
if (timer == null && !TextUtils.isEmpty(userId)) {
|
||||
timer = new CountDownTimer(1000, 1000) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
|
|
@ -300,7 +306,8 @@ public class MainTabActivity extends BaseFragmentActivity {
|
|||
public void finish() {
|
||||
|
||||
}
|
||||
}, Commons.USER.getUserId());
|
||||
}, userId);
|
||||
// }, Commons.USER.getUserId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,11 +68,13 @@ import com.ifish.tcp.OrderDeviceConnectModel;
|
|||
import com.ifish.tcp.OrderModel;
|
||||
import com.ifish.tcp.QueryTempeSettingModel;
|
||||
import com.ifish.tcp.ResetDeviceModel;
|
||||
import com.ifish.utils.ActivityManager;
|
||||
import com.ifish.utils.AnimationUtil;
|
||||
import com.ifish.utils.BlueToothUtil;
|
||||
import com.ifish.utils.ByteUtil;
|
||||
import com.ifish.utils.ClickUtil;
|
||||
import com.ifish.utils.Commons;
|
||||
import com.ifish.utils.DialogUtil;
|
||||
import com.ifish.utils.HttpListener;
|
||||
import com.ifish.utils.HttpManager;
|
||||
import com.ifish.utils.L;
|
||||
|
|
@ -130,6 +132,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
setContentView(R.layout.activity_new_bind_device_choice);
|
||||
|
||||
|
||||
ActivityManager.getInstance().addActivity(this);
|
||||
|
||||
sp=SPUtil.getInstance(this);
|
||||
act = this;
|
||||
|
|
@ -293,7 +296,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
* 根据连接类型切换UI
|
||||
* todo 这里的提示应该根据连接类型有不同的提示
|
||||
*
|
||||
* @param connectType
|
||||
* @param
|
||||
*/
|
||||
|
||||
private void changeView(boolean blue){
|
||||
|
|
@ -430,7 +433,8 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
if (TextUtils.isEmpty(type)){
|
||||
blueScan();
|
||||
}else {
|
||||
showProgressDialogCancelble("开始连接蓝牙设备");
|
||||
DialogUtil.Companion.showLoadingDialog(true,"开始连接蓝牙设备");
|
||||
// showProgressDialogCancelble("开始连接蓝牙设备");
|
||||
connectBle();
|
||||
}
|
||||
}else {
|
||||
|
|
@ -478,14 +482,16 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
connectBle();
|
||||
}else {
|
||||
ToastUtil.show(NewBindDeviceActivity.this,"扫描结束,没有搜索到可用设备");
|
||||
dismissProgressDialogCancelble();
|
||||
// dismissProgressDialogCancelble();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanStarted(boolean success) {
|
||||
// ToastUtil.show(NewBindDeviceActivity.this,"开始扫描");
|
||||
showProgressDialogCancelble("正在搜索附近设备,请确保设备处于配网状态");
|
||||
DialogUtil.Companion.showLoadingDialog(true,"正在搜索附近设备,请确保设备处于配网状态");
|
||||
// showProgressDialogCancelble("正在搜索附近设备,请确保设备处于配网状态");
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
|
|
@ -593,7 +599,8 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public void onNotifyFailure(BleException exception) {
|
||||
dismissProgressDialogCancelble();
|
||||
// dismissProgressDialogCancelble();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -613,25 +620,20 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
String status = ByteUtil.toHex(model.getStatus());
|
||||
device_mac = ByteUtil.bytesToHexString(model.getSrc());
|
||||
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
|
||||
checkoutMac(device_mac);
|
||||
switch (nofity_type){
|
||||
case 1:
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
L.i(status+"jjia-------"+device_mac);
|
||||
|
||||
break;
|
||||
if (!TextUtils.isEmpty(device_mac)){
|
||||
// dismissProgressDialogCancelble();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
// showProgressDialogCancelble("正在绑定设备,请稍等...");
|
||||
DialogUtil.Companion.showLoadingDialog(true,"正在绑定设备...");
|
||||
connectDevice.cancel();
|
||||
connectDevice.start();
|
||||
}
|
||||
|
||||
|
||||
// checkoutMac(device_mac);
|
||||
} else {
|
||||
dismissProgressDialogCancelble();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
// dismissProgressDialogCancelble();
|
||||
// BackFunctionCode7_11 model = (BackFunctionCode7_11) object;
|
||||
// String status = ByteUtil.toHex(model.getStatus());
|
||||
// if ("01".equals(status)) {
|
||||
|
|
@ -646,54 +648,54 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
|
||||
private void checkoutMac(String mac){
|
||||
|
||||
if (!TextUtils.isEmpty(mac)){
|
||||
boolean isSameName = false;
|
||||
devicePosition = 0;
|
||||
try {
|
||||
if (Commons.DEVICE != null) {
|
||||
if (Commons.DEVICE.size() != 0) {
|
||||
for (int i = 0; i < Commons.DEVICE.size(); i++) {
|
||||
if (mac.equals(Commons.DEVICE.get(i).getMacAddress())) {
|
||||
devicePosition = i;
|
||||
isSameName = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
if (isSameName){
|
||||
L.i("jjia-------------不包含");
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
resetDevice(1);
|
||||
}
|
||||
});
|
||||
}else {
|
||||
L.i("jjia-------------不包含");
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
isContinue = true;
|
||||
resetDevice(2);
|
||||
}
|
||||
});
|
||||
}
|
||||
}else {
|
||||
dismissProgressDialogCancelble();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
// private void checkoutMac(String mac){
|
||||
//
|
||||
// if (!TextUtils.isEmpty(mac)){
|
||||
// boolean isSameName = false;
|
||||
// devicePosition = 0;
|
||||
// try {
|
||||
// if (Commons.DEVICE != null) {
|
||||
// if (Commons.DEVICE.size() != 0) {
|
||||
// for (int i = 0; i < Commons.DEVICE.size(); i++) {
|
||||
// if (mac.equals(Commons.DEVICE.get(i).getMacAddress())) {
|
||||
// devicePosition = i;
|
||||
// isSameName = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (isSameName){
|
||||
// L.i("jjia-------------不包含");
|
||||
// runOnUiThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// resetDevice(1);
|
||||
// }
|
||||
// });
|
||||
// }else {
|
||||
// L.i("jjia-------------不包含");
|
||||
// runOnUiThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// isContinue = true;
|
||||
// resetDevice(2);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }else {
|
||||
// dismissProgressDialogCancelble();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
int devicePosition = 0;
|
||||
private void sendBleData(){
|
||||
|
||||
|
|
@ -735,8 +737,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
private void resetDevice(int type){
|
||||
|
||||
dismissProgressDialogCancelble();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
if (1==type){
|
||||
toDevice();
|
||||
}else if (2==type){
|
||||
|
|
@ -776,24 +777,24 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
BleManager.getInstance().connect(currentDevice, new BleGattCallback() {
|
||||
@Override
|
||||
public void onStartConnect() {
|
||||
setMessage("开始连接蓝牙设备");
|
||||
DialogUtil.Companion.showLoadingDialog(true,"开始连接蓝牙设备");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectFail(BleDevice bleDevice, BleException exception) {
|
||||
ToastUtil.show(NewBindDeviceActivity.this,"连接蓝牙设备失败,请重试");
|
||||
dismissProgressDialogCancelble();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess(BleDevice bleDevice, BluetoothGatt gatt, int status) {
|
||||
// ToastUtil.show(NewBindDeviceActivity.this,"蓝牙连接成功");
|
||||
setMessage("蓝牙连接成功");
|
||||
// setMessage("蓝牙连接成功");
|
||||
BleManager.getInstance().setMtu(bleDevice, 512, new BleMtuChangedCallback() {
|
||||
@Override
|
||||
public void onSetMTUFailure(BleException exception) {
|
||||
L.i("jjia-------MTU--"+exception.toString());
|
||||
dismissProgressDialogCancelble();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -901,7 +902,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
long sum = millisUntilFinished / 1000 % 2;
|
||||
long sum = millisUntilFinished / 1000;
|
||||
if (sum == 0) {
|
||||
if (!act.isFinishing() && isContinue) {
|
||||
isNetWorkAvailable("www.baidu.com", new Comparable<Boolean>() {
|
||||
|
|
@ -927,6 +928,8 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
public void onFinish() {
|
||||
if (isContinue) {
|
||||
// dismissProgressDialog();
|
||||
// dismissProgressDialogCancelble();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1038,16 +1041,19 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public void finish() {
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
deviceIsNullHandler.sendEmptyMessage(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Exception e, String msg) {
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
result = Commons.NetWork.ERROR;
|
||||
}
|
||||
}, deviceObj.getDeviceId(), Commons.USER.getUserId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1070,12 +1076,28 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
if (deviceIsNull) {//当服务器返回的设备控制器数和定时器数为null的时候 不跳转进入主界面
|
||||
return;
|
||||
}
|
||||
Commons.DEVICE.add(deviceObj);
|
||||
try {
|
||||
sp.putInt(Commons.LoginSPKey.Position, Commons.DEVICE.size() - 1);
|
||||
Commons.DevicePosition = Commons.DEVICE.size() - 1;
|
||||
} catch (Exception e) {
|
||||
|
||||
List<Device> allDevices = Commons.DEVICE;
|
||||
Boolean isHasDev = false;
|
||||
if (deviceObj!=null && deviceObj.getMacAddress()!=null && allDevices!=null && allDevices.size()>0){
|
||||
for (int i = 0;i<allDevices.size();i++){
|
||||
Device item = allDevices.get(i);
|
||||
if (item!=null && deviceObj.getMacAddress().equals(item.getMacAddress())){
|
||||
Commons.DevicePosition = i;
|
||||
isHasDev = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isHasDev){
|
||||
Commons.DEVICE.add(deviceObj);
|
||||
try {
|
||||
sp.putInt(Commons.LoginSPKey.Position, Commons.DEVICE.size() - 1);
|
||||
Commons.DevicePosition = Commons.DEVICE.size() - 1;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
ToastUtil.show(NewBindDeviceActivity.this, "设备序号" + Commons.DevicePosition + "---" + Commons.DEVICE.size());
|
||||
Commons.IS_EventBus = true;
|
||||
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||
|
|
@ -1156,6 +1178,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
} catch (Exception e) {
|
||||
i.setClass(NewBindDeviceActivity.this, MainThreeControlActivity.class);
|
||||
}
|
||||
DialogUtil.Companion.setLoadingDialogDismiss();
|
||||
i.putExtra(BaseGradeActivity.BINDDEVICE, true);//绑定成功增加经验
|
||||
ToastUtil.show(NewBindDeviceActivity.this, "绑定设备成功");
|
||||
startActivity(i);
|
||||
|
|
@ -1343,25 +1366,25 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
* @date 2015-9-4 上午9:24:21
|
||||
*/
|
||||
|
||||
private ProgressDialog myProgressDialogCancelble;
|
||||
protected void showProgressDialogCancelble(String msg) {
|
||||
if (myProgressDialogCancelble == null) {
|
||||
myProgressDialogCancelble = new ProgressDialog(this, ProgressDialog.THEME_HOLO_LIGHT);
|
||||
myProgressDialogCancelble.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
myProgressDialogCancelble.setMessage(msg);
|
||||
myProgressDialogCancelble.setIndeterminate(true);
|
||||
myProgressDialogCancelble.setCancelable(false);//返回键可以取消
|
||||
}
|
||||
myProgressDialogCancelble.show();
|
||||
}
|
||||
// private ProgressDialog myProgressDialogCancelble;
|
||||
// protected void showProgressDialogCancelble(String msg) {
|
||||
// if (myProgressDialogCancelble == null) {
|
||||
// myProgressDialogCancelble = new ProgressDialog(this, ProgressDialog.THEME_HOLO_LIGHT);
|
||||
// myProgressDialogCancelble.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
// myProgressDialogCancelble.setMessage(msg);
|
||||
// myProgressDialogCancelble.setIndeterminate(true);
|
||||
// myProgressDialogCancelble.setCancelable(false);//返回键可以取消
|
||||
// }
|
||||
// myProgressDialogCancelble.show();
|
||||
// }
|
||||
|
||||
protected void setMessage(String msg) {
|
||||
if (myProgressDialogCancelble != null) {
|
||||
myProgressDialogCancelble.setMessage(msg);
|
||||
}else {
|
||||
showProgressDialogCancelble(msg);
|
||||
}
|
||||
}
|
||||
// protected void setMessage(String msg) {
|
||||
// if (myProgressDialogCancelble != null) {
|
||||
// myProgressDialogCancelble.setMessage(msg);
|
||||
// }else {
|
||||
// showProgressDialogCancelble(msg);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param
|
||||
|
|
@ -1369,12 +1392,12 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
* @author Jacky dada
|
||||
* @date 2015-9-4 上午9:24:04
|
||||
*/
|
||||
protected void dismissProgressDialogCancelble() {
|
||||
if (myProgressDialogCancelble != null) {
|
||||
myProgressDialogCancelble.dismiss();
|
||||
myProgressDialogCancelble = null;
|
||||
}
|
||||
}
|
||||
// protected void dismissProgressDialogCancelble() {
|
||||
// if (myProgressDialogCancelble != null) {
|
||||
// myProgressDialogCancelble.dismiss();
|
||||
// myProgressDialogCancelble = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
List<BleDevice> deviceList;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package com.ifish.utils
|
||||
|
||||
/**
|
||||
* Created by achang on 2018/10/6.
|
||||
*/
|
||||
|
||||
class DialogUtil {
|
||||
companion object {
|
||||
var mLoadingDialog: LoadingDialog? = null
|
||||
var showDialog:Boolean=false
|
||||
var hint:String?="正在加载中,请稍等片刻..."
|
||||
fun showLoadingDialog(showDialog:Boolean,hint:String?="正在加载中,请稍等片刻..."): LoadingDialog {
|
||||
this.showDialog= showDialog
|
||||
if (mLoadingDialog == null&& ActivityManager.getInstance().lastActivity()!=null) {
|
||||
mLoadingDialog = LoadingDialog(ActivityManager.getInstance().lastActivity()!!,hint)
|
||||
if (!mLoadingDialog!!.isShowing && ActivityManager.getInstance().lastActivity() != null && !ActivityManager.getInstance().lastActivity()!!.isFinishing) {
|
||||
mLoadingDialog!!.show()
|
||||
}
|
||||
} else {
|
||||
if (!mLoadingDialog!!.isShowing && ActivityManager.getInstance().lastActivity() != null && !ActivityManager.getInstance().lastActivity()!!.isFinishing) {
|
||||
mLoadingDialog!!.show()
|
||||
}
|
||||
}
|
||||
/* mLoadingDialog?.apply {
|
||||
LogUtil.logD(isShowing.toString()+"======="+ AppManagerUtil.lastActivity.toString()+"==="+(mLoadingDialog==null))
|
||||
}*/
|
||||
return mLoadingDialog!!
|
||||
}
|
||||
|
||||
fun setLoadingDialogDismiss() {
|
||||
mLoadingDialog?.apply {
|
||||
if (this.isShowing ) {
|
||||
ActivityManager.getInstance().lastActivity()?.apply {
|
||||
if (!this.isFinishing)
|
||||
mLoadingDialog!!.dismiss()
|
||||
mLoadingDialog = null
|
||||
}
|
||||
}
|
||||
}
|
||||
// LogUtil.logD("setLoadingDialogDismiss===========")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.ifish.utils
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.ifish.activity.R
|
||||
import com.ifish.utils.Commons.Text
|
||||
|
||||
/**
|
||||
* @创建者 肖天长
|
||||
* @创建时间 2018/7/6 0006 11:59
|
||||
* @描述 ${TODO}
|
||||
* @更新者 $Author$
|
||||
* @更新时间 2018/7/6 0006$
|
||||
* @更新描述 ${TODO}
|
||||
*/
|
||||
|
||||
class LoadingDialog(context: Activity,hint:String?) : Dialog(context, R.style.BaseDialogStyle) {
|
||||
|
||||
init {
|
||||
val inflate = View.inflate(context, R.layout.dialog_loading, null)
|
||||
val mParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
setContentView(inflate, mParams)
|
||||
var view =findViewById<TextView>(R.id.tv_hint)
|
||||
view.text = hint
|
||||
if (TextUtils.isEmpty(hint)){
|
||||
|
||||
}
|
||||
|
||||
window!!.setDimAmount(0f) //去除阴影遮罩效果
|
||||
setCanceledOnTouchOutside(false)
|
||||
// setCancelable(false)
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/dialog_loading"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%" />
|
||||
|
||||
|
||||
<!-- 下面是转圈的
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/dialog_loading_img2"
|
||||
android:fromDegrees="0"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:toDegrees="360" />
|
||||
|
||||
-->
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="12dp"/>
|
||||
<solid android:color="#AA000000" />
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="150dp"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<LinearLayout
|
||||
android:background="@drawable/shape_white_radius15"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="150dp"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="150dp">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/dg_pb_loading"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:indeterminateDrawable="@drawable/shape_loading_anim"
|
||||
android:indeterminateOnly="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hint"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="正在加载中..."
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -268,5 +268,37 @@
|
|||
<item name="android:windowEnterAnimation">@anim/bottom_dialog_in</item>
|
||||
<item name="android:windowExitAnimation">@anim/bottom_dialog_out</item>
|
||||
</style>
|
||||
|
||||
<style name="BaseDialogStyle" parent="Theme.AppCompat.DayNight.Dialog.Alert"><!-- @android:style/Theme.Dialog -->
|
||||
<!-- 无边框 -->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<!-- 浮在 Activity 之上 -->
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<!-- 半透明 -->
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<!-- 背景透明 -->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!-- 遮盖层 -->
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
<!-- 无标题 -->
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!-- Base.Theme.AppCompat.Light.Dialog.Alert 特有的属性,用于指定默认宽度,这里需要禁用 -->
|
||||
<item name="android:windowMinWidthMajor">0dp</item>
|
||||
<item name="android:windowMinWidthMinor">0dp</item>
|
||||
<!-- 解决 ActionBar 占位导致 Dialog 无法全屏显示的问题 -->
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!-- ActionMode 覆盖 Actionbar,不顶下来 -->
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:background">@null</item>
|
||||
<!-- 动画效果 -->
|
||||
<!--<item name="android:windowEnterAnimation">@anim/ios_in_window</item>
|
||||
<item name="android:windowExitAnimation">@anim/ios_out_window</item>-->
|
||||
<!-- 不感知敏感的切换 -->
|
||||
<!--<item name="android:configChanges">orientation|screenSize|keyboardHidden</item>-->
|
||||
<!-- 默认隐藏输入法 -->
|
||||
<!--<item name="android:windowSoftInputMode">stateHidden</item>-->
|
||||
<!-- Dialog 全屏显示 -->
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Reference in New Issue