feat#415_绑定等待提醒
This commit is contained in:
parent
8781a2bb14
commit
71e15f204e
|
|
@ -26,6 +26,6 @@ android.enableJetifier=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.useDeprecatedNdk=true
|
android.useDeprecatedNdk=true
|
||||||
|
|
||||||
versionCode=103
|
versionCode=105
|
||||||
versionName=4.12.03
|
versionName=4.12.05
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ public class HotSpotConnentDeviceActivity extends BaseActivity {
|
||||||
|
|
||||||
public void toDevice() {
|
public void toDevice() {
|
||||||
AppRoute.newToStart(HotSpotConnentDeviceActivity.this,deviceObj,true);
|
AppRoute.newToStart(HotSpotConnentDeviceActivity.this,deviceObj,true);
|
||||||
ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
// ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
||||||
EventBean eventBean =new EventBean(EventBean.LINK_FINISH,0);
|
EventBean eventBean =new EventBean(EventBean.LINK_FINISH,0);
|
||||||
EventBus.getDefault().post(eventBean);
|
EventBus.getDefault().post(eventBean);
|
||||||
finish();
|
finish();
|
||||||
|
|
@ -417,7 +417,7 @@ public class HotSpotConnentDeviceActivity extends BaseActivity {
|
||||||
Commons.IS_CAMERA = false;
|
Commons.IS_CAMERA = false;
|
||||||
sp.putBoolean(LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
sp.putBoolean(LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||||
AppRoute.newToStart(HotSpotConnentDeviceActivity.this,deviceObj,true);
|
AppRoute.newToStart(HotSpotConnentDeviceActivity.this,deviceObj,true);
|
||||||
ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
// ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
||||||
EventBean eventBean =new EventBean(EventBean.LINK_FINISH,0);
|
EventBean eventBean =new EventBean(EventBean.LINK_FINISH,0);
|
||||||
EventBus.getDefault().post(eventBean);
|
EventBus.getDefault().post(eventBean);
|
||||||
AnimationUtil.startAnimation(HotSpotConnentDeviceActivity.this);
|
AnimationUtil.startAnimation(HotSpotConnentDeviceActivity.this);
|
||||||
|
|
@ -456,13 +456,13 @@ public class HotSpotConnentDeviceActivity extends BaseActivity {
|
||||||
Commons.DevicePosition = Commons.DEVICE.size() - 1;
|
Commons.DevicePosition = Commons.DEVICE.size() - 1;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
ToastUtil.show(HotSpotConnentDeviceActivity.this, "设备序号" + Commons.DevicePosition + "---" + Commons.DEVICE.size());
|
// ToastUtil.show(HotSpotConnentDeviceActivity.this, "设备序号" + Commons.DevicePosition + "---" + Commons.DEVICE.size());
|
||||||
Commons.IS_EventBus = true;
|
Commons.IS_EventBus = true;
|
||||||
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||||
Commons.IS_CAMERA = false;
|
Commons.IS_CAMERA = false;
|
||||||
sp.putBoolean(LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
sp.putBoolean(LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||||
AppRoute.newToStart(HotSpotConnentDeviceActivity.this,deviceObj,true);
|
AppRoute.newToStart(HotSpotConnentDeviceActivity.this,deviceObj,true);
|
||||||
ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
// ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
||||||
EventBean eventBean =new EventBean(EventBean.LINK_FINISH,0);
|
EventBean eventBean =new EventBean(EventBean.LINK_FINISH,0);
|
||||||
EventBus.getDefault().post(eventBean);
|
EventBus.getDefault().post(eventBean);
|
||||||
AnimationUtil.startAnimation(HotSpotConnentDeviceActivity.this);
|
AnimationUtil.startAnimation(HotSpotConnentDeviceActivity.this);
|
||||||
|
|
|
||||||
|
|
@ -583,7 +583,7 @@ public class HotSpotConnentPetDeviceActivity extends BaseActivity {
|
||||||
Commons.DevicePosition = Commons.DEVICE.size() - 1;
|
Commons.DevicePosition = Commons.DEVICE.size() - 1;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
ToastUtil.show(HotSpotConnentPetDeviceActivity.this, "设备序号" + Commons.DevicePosition + "---" + Commons.DEVICE.size());
|
// ToastUtil.show(HotSpotConnentPetDeviceActivity.this, "设备序号" + Commons.DevicePosition + "---" + Commons.DEVICE.size());
|
||||||
Commons.IS_EventBus = true;
|
Commons.IS_EventBus = true;
|
||||||
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||||
Commons.IS_CAMERA = false;
|
Commons.IS_CAMERA = false;
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,23 @@ import static com.ifish.activity.MainTabActivity.map;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.clj.fastble.data.BleScanState;
|
import com.clj.fastble.data.BleScanState;
|
||||||
|
|
@ -104,6 +109,7 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
||||||
private Device deviceBean;
|
private Device deviceBean;
|
||||||
|
|
||||||
private boolean isBind = false;
|
private boolean isBind = false;
|
||||||
|
private boolean isShowHint = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
@ -123,26 +129,26 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
isBind = getIntent().getBooleanExtra(BaseGradeActivity.BINDDEVICE,false);
|
isBind = getIntent().getBooleanExtra(BaseGradeActivity.BINDDEVICE,false);
|
||||||
|
L.i("jjia------------"+isBind);
|
||||||
|
|
||||||
if (isBind){
|
if (isBind){
|
||||||
DialogUtil.Companion.showLoadingDialog(this,true,"设备正在联网中,请耐心等待.....");
|
DialogUtil.Companion.showLoadingDialog(this,true,"设备正在联网中,请耐心等待");
|
||||||
startDownTimer();
|
startDownTimer();
|
||||||
}
|
}
|
||||||
|
// showHint();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showHint(){
|
private void showHint(){
|
||||||
|
|
||||||
IosAlertDialog openDialog = new IosAlertDialog(this).builder();
|
isShowHint = false;
|
||||||
openDialog.setCancelable(true);
|
Toast toast = new Toast(this);
|
||||||
openDialog.setTitle("温馨提示");
|
toast.setDuration(Toast.LENGTH_LONG);
|
||||||
openDialog.setMessage("请检查输入密码是否正确");
|
|
||||||
openDialog.setPositiveButton("确定", new View.OnClickListener() {
|
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
@Override
|
View view = inflater.inflate(R.layout.hint_toast, null);
|
||||||
public void onClick(View view) {
|
toast.setView(view);
|
||||||
}
|
toast.setGravity(Gravity.CENTER,0,120);
|
||||||
});
|
toast.show();
|
||||||
openDialog.show();
|
|
||||||
}
|
}
|
||||||
public void onEventMainThread(EventBean eventBean){
|
public void onEventMainThread(EventBean eventBean){
|
||||||
if (eventBean!=null && EventBean.CHANGE_DEVICE_NAME.equals(eventBean.name)){
|
if (eventBean!=null && EventBean.CHANGE_DEVICE_NAME.equals(eventBean.name)){
|
||||||
|
|
@ -170,6 +176,7 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
isToast = false;
|
isToast = false;
|
||||||
EventBus.getDefault().unregister(this);
|
EventBus.getDefault().unregister(this);
|
||||||
|
DialogUtil.Companion.setLoadingDialogDismiss(this);
|
||||||
closeSoket();
|
closeSoket();
|
||||||
closeDownTimer();
|
closeDownTimer();
|
||||||
stopAllTimer();
|
stopAllTimer();
|
||||||
|
|
@ -414,7 +421,7 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
||||||
tv_wendu.setText("");
|
tv_wendu.setText("");
|
||||||
sw.setRefreshing(false);
|
sw.setRefreshing(false);
|
||||||
if (isToast) {
|
if (isToast) {
|
||||||
ToastUtil.showSpecial(MainSix_4F_ControlActivity.this, Commons.Text.Repost);
|
// ToastUtil.showSpecial(MainSix_4F_ControlActivity.this, Commons.Text.Repost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -463,7 +470,7 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
||||||
resetIVFlag();
|
resetIVFlag();
|
||||||
isWaterDialog = false;
|
isWaterDialog = false;
|
||||||
dismissProgressDialog();
|
dismissProgressDialog();
|
||||||
ToastUtil.showSpecial(MainSix_4F_ControlActivity.this, Commons.Text.Repost);
|
// ToastUtil.showSpecial(MainSix_4F_ControlActivity.this, Commons.Text.Repost);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -608,7 +615,12 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
||||||
L.i("jjia---------c------1"+event.toString());
|
L.i("jjia---------c------1"+event.toString());
|
||||||
hidegif();
|
hidegif();
|
||||||
dismissProgressDialog();
|
dismissProgressDialog();
|
||||||
DialogUtil.Companion.setLoadingDialogDismiss(this);
|
if (isBind){
|
||||||
|
DialogUtil.Companion.setLoadingDialogDismiss(this);
|
||||||
|
if (isShowHint){
|
||||||
|
showHint();
|
||||||
|
}
|
||||||
|
}
|
||||||
dismissProgressDialogCancelble();
|
dismissProgressDialogCancelble();
|
||||||
tv_offline.setVisibility(View.GONE);
|
tv_offline.setVisibility(View.GONE);
|
||||||
backInfoModelSix_4F = event;
|
backInfoModelSix_4F = event;
|
||||||
|
|
@ -1354,12 +1366,13 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
||||||
countDownTimer = new CountDownTimer(40000,1000) {
|
countDownTimer = new CountDownTimer(40000,1000) {
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long l) {
|
public void onTick(long l) {
|
||||||
|
DialogUtil.Companion.setProgress(dowmCount);
|
||||||
|
dowmCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
DialogUtil.Companion.setLoadingDialogDismiss(MainSix_4F_ControlActivity.this);
|
DialogUtil.Companion.setError();
|
||||||
showHint();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
countDownTimer.start();
|
countDownTimer.start();
|
||||||
|
|
|
||||||
|
|
@ -532,7 +532,7 @@ public class AirKissUtil {
|
||||||
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||||
Commons.IS_CAMERA = false;
|
Commons.IS_CAMERA = false;
|
||||||
sp.putBoolean(Commons.LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
sp.putBoolean(Commons.LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||||
ToastUtil.show(curActivity, "绑定设备成功");
|
// ToastUtil.show(curActivity, "绑定设备成功");
|
||||||
AppRoute.newToStart(curActivity,deviceObj,true);
|
AppRoute.newToStart(curActivity,deviceObj,true);
|
||||||
curActivity.finish();
|
curActivity.finish();
|
||||||
L.i("===================绑定设备成功=" + device_mac);
|
L.i("===================绑定设备成功=" + device_mac);
|
||||||
|
|
@ -599,7 +599,7 @@ public class AirKissUtil {
|
||||||
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||||
Commons.IS_CAMERA = false;
|
Commons.IS_CAMERA = false;
|
||||||
sp.putBoolean(Commons.LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
sp.putBoolean(Commons.LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||||
ToastUtil.show(curActivity, "绑定设备成功");
|
// ToastUtil.show(curActivity, "绑定设备成功");
|
||||||
AppRoute.newToStart(curActivity,deviceObj,true);
|
AppRoute.newToStart(curActivity,deviceObj,true);
|
||||||
|
|
||||||
curActivity.finish();
|
curActivity.finish();
|
||||||
|
|
|
||||||
|
|
@ -494,7 +494,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
case AirKiss:
|
case AirKiss:
|
||||||
// 处理AirKiss逻辑
|
// 处理AirKiss逻辑
|
||||||
L.i("jjia----------------bssid="+bssid);
|
L.i("jjia----------------bssid="+bssid);
|
||||||
ToastUtil.show(NewBindDeviceActivity.this, "开始AirKiss联网...");
|
// ToastUtil.show(NewBindDeviceActivity.this, "开始AirKiss联网...");
|
||||||
airKissUtil.connectDeviceByAirKiss(this, ssid, bssid, pwd);
|
airKissUtil.connectDeviceByAirKiss(this, ssid, bssid, pwd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1104,7 +1104,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ToastUtil.show(NewBindDeviceActivity.this, "设备序号" + Commons.DevicePosition + "---" + Commons.DEVICE.size());
|
// ToastUtil.show(NewBindDeviceActivity.this, "设备序号" + Commons.DevicePosition + "---" + Commons.DEVICE.size());
|
||||||
|
|
||||||
|
|
||||||
if (deviceObj!=null){
|
if (deviceObj!=null){
|
||||||
|
|
@ -1144,7 +1144,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private void toIntent(Device device){
|
private void toIntent(Device device){
|
||||||
dismissDialog();
|
dismissDialog();
|
||||||
ToastUtil.show(NewBindDeviceActivity.this, "绑定设备成功");
|
// ToastUtil.show(NewBindDeviceActivity.this, "绑定设备成功");
|
||||||
AppRoute.newToStart(NewBindDeviceActivity.this,device,true);
|
AppRoute.newToStart(NewBindDeviceActivity.this,device,true);
|
||||||
EventBus.getDefault().post(new ConnectMessageEvent(1, "test"));
|
EventBus.getDefault().post(new ConnectMessageEvent(1, "test"));
|
||||||
finish();
|
finish();
|
||||||
|
|
@ -1196,7 +1196,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
||||||
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||||
Commons.IS_CAMERA = false;
|
Commons.IS_CAMERA = false;
|
||||||
sp.putBoolean(Commons.LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
sp.putBoolean(Commons.LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||||
ToastUtil.show(NewBindDeviceActivity.this, "绑定设备成功");
|
// ToastUtil.show(NewBindDeviceActivity.this, "绑定设备成功");
|
||||||
AppRoute.newToStart(NewBindDeviceActivity.this,deviceObj,true);
|
AppRoute.newToStart(NewBindDeviceActivity.this,deviceObj,true);
|
||||||
finish();
|
finish();
|
||||||
L.i("===================绑定设备成功=" + device_mac);
|
L.i("===================绑定设备成功=" + device_mac);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
|
@ -1971,41 +1972,48 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
});
|
});
|
||||||
openDialog.show();
|
openDialog.show();
|
||||||
}
|
}
|
||||||
AlertDialog alertDialog;
|
IosAlertDialog alertDialog;
|
||||||
public void showDevice(){
|
public void showDevice(){
|
||||||
// 检测页面
|
// 检测页面
|
||||||
if (!isShowIng){
|
if (!isShowIng){
|
||||||
isShowIng = true;
|
isShowIng = true;
|
||||||
isShowEd = true;
|
isShowEd = true;
|
||||||
|
|
||||||
alertDialog = new AlertDialog.Builder(requireActivity())
|
alertDialog = new IosAlertDialog(requireContext(), Gravity.BOTTOM).builder();
|
||||||
.setTitle("提示")
|
alertDialog.setTextColor(R.color.danghao_color);
|
||||||
.setMessage("发现一个新设备是否去添加")
|
alertDialog.setCancelable(false);
|
||||||
.setOnDismissListener(dialogInterface -> isShowIng = false)
|
alertDialog.setTitle("发现设备");
|
||||||
.setPositiveButton("确定", (dialog, which) -> {
|
alertDialog.setMessage("鱼缸智能插座1个");
|
||||||
dialog.dismiss();
|
alertDialog.setNegativeButton("忽略", new OnClickListener() {
|
||||||
isShowIng = false;
|
@Override
|
||||||
closeDownTimer();
|
public void onClick(View view) {
|
||||||
Intent intent = new Intent();
|
isShowIng = false;
|
||||||
intent.setClass(requireActivity(), NewBindDeviceActivity.class);
|
alertDialog.dismiss();
|
||||||
intent.putExtra("title", "连接水族箱");
|
isShowIng = false;
|
||||||
intent.putExtra("type", "bluetooth");
|
startDownTimer();
|
||||||
//jjia-xpush
|
}
|
||||||
intent.putExtra("device", currentDevice);
|
});
|
||||||
startActivity(intent);
|
alertDialog.setPositiveButton("添加", new OnClickListener() {
|
||||||
AnimationUtil.finishAnimation(requireActivity());
|
@Override
|
||||||
})
|
public void onClick(View view) {
|
||||||
.setNegativeButton("取消", (dialog, which) -> {
|
alertDialog.dismiss();
|
||||||
dialog.dismiss();
|
isShowIng = false;
|
||||||
isShowIng = false;
|
closeDownTimer();
|
||||||
startDownTimer();
|
Intent intent = new Intent();
|
||||||
})
|
intent.setClass(requireActivity(), NewBindDeviceActivity.class);
|
||||||
.create();
|
intent.putExtra("title", "连接水族箱");
|
||||||
|
intent.putExtra("type", "bluetooth");
|
||||||
|
//jjia-xpush
|
||||||
|
intent.putExtra("device", currentDevice);
|
||||||
|
startActivity(intent);
|
||||||
|
AnimationUtil.finishAnimation(requireActivity());
|
||||||
|
}
|
||||||
|
});
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int dowmCount = 1;
|
int dowmCount = 1;
|
||||||
CountDownTimer countDownTimer;
|
CountDownTimer countDownTimer;
|
||||||
private void startDownTimer(){
|
private void startDownTimer(){
|
||||||
|
|
@ -2066,7 +2074,6 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
||||||
if (alertDialog!=null){
|
if (alertDialog!=null){
|
||||||
L.i("jjia---扫描暂停----------");
|
L.i("jjia---扫描暂停----------");
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
alertDialog.cancel();
|
|
||||||
alertDialog = null;
|
alertDialog = null;
|
||||||
}
|
}
|
||||||
closeDownTimer();
|
closeDownTimer();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.ifish.utils
|
package com.ifish.utils
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import com.ifish.baseclass.BaseActivity
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by achang on 2018/10/6.
|
* Created by achang on 2018/10/6.
|
||||||
|
|
@ -30,16 +29,23 @@ class DialogUtil{
|
||||||
return mLoadingDialog!!
|
return mLoadingDialog!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setProgress(value: Int){
|
||||||
|
mLoadingDialog?.setProgress(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setError(){
|
||||||
|
mLoadingDialog?.setError()
|
||||||
|
}
|
||||||
fun setLoadingDialogDismiss(activity: Activity?) {
|
fun setLoadingDialogDismiss(activity: Activity?) {
|
||||||
mLoadingDialog?.apply {
|
mLoadingDialog?.apply {
|
||||||
if (this.isShowing ) {
|
if (this.isShowing ) {
|
||||||
activity?.apply {
|
activity?.apply {
|
||||||
if (!this.isFinishing)
|
if (!this.isFinishing)
|
||||||
mLoadingDialog!!.dismiss()
|
mLoadingDialog!!.dismiss()
|
||||||
mLoadingDialog = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mLoadingDialog = null
|
||||||
// LogUtil.logD("setLoadingDialogDismiss===========")
|
// LogUtil.logD("setLoadingDialogDismiss===========")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,32 +2,62 @@ package com.ifish.utils
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.text.TextUtils
|
import android.graphics.drawable.AnimationDrawable
|
||||||
|
import android.os.Build
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.LinearLayout
|
import android.widget.ImageView
|
||||||
|
import android.widget.ProgressBar
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.cardview.widget.CardView
|
||||||
import com.ifish.activity.R
|
import com.ifish.activity.R
|
||||||
import com.ifish.utils.Commons.Text
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LoadingDialog(context: Activity,hint:String?) : Dialog(context, R.style.fullDialog) {
|
class LoadingDialog(context: Activity,hint:String?) : Dialog(context, R.style.fullDialog) {
|
||||||
|
|
||||||
|
var progress: ProgressBar
|
||||||
|
var ivCancel: ImageView? = null
|
||||||
|
var image: AnimationDrawable? = null
|
||||||
|
var cardview: CardView? = null
|
||||||
|
var tvCancel: TextView? = null
|
||||||
init {
|
init {
|
||||||
val inflate = View.inflate(context, R.layout.dialog_loading, null)
|
val inflate = View.inflate(context, R.layout.dialog_loading, null)
|
||||||
// val mParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)
|
|
||||||
|
|
||||||
setCancelable(false)
|
setCancelable(false)
|
||||||
setContentView(inflate)
|
setContentView(inflate)
|
||||||
var view =findViewById<TextView>(R.id.tv_hint)
|
var icon =findViewById<ImageView>(R.id.iconx)
|
||||||
view.text = hint
|
image = icon.drawable as AnimationDrawable
|
||||||
if (TextUtils.isEmpty(hint)){
|
image?.start()
|
||||||
|
|
||||||
|
|
||||||
|
progress =findViewById<ProgressBar>(R.id.dg_pb_loading)
|
||||||
|
cardview =findViewById<CardView>(R.id.cardview)
|
||||||
|
ivCancel =findViewById<ImageView>(R.id.iv_cancel)
|
||||||
|
tvCancel =findViewById<TextView>(R.id.tv_cancel)
|
||||||
|
|
||||||
|
var view =findViewById<TextView>(R.id.tv_hint)
|
||||||
|
tvCancel?.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
}
|
}
|
||||||
|
view.text = hint
|
||||||
|
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
// window!!.setDimAmount(0f) //去除阴影遮罩效果
|
|
||||||
setCanceledOnTouchOutside(false)
|
setCanceledOnTouchOutside(false)
|
||||||
// setCancelable(false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setProgress(value: Int){
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
progress?.setProgress(value,true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setError(){
|
||||||
|
cardview?.visibility = View.GONE
|
||||||
|
ivCancel?.visibility = View.VISIBLE
|
||||||
|
tvCancel?.visibility = View.VISIBLE
|
||||||
|
image?.stop()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.ifish.activity.R;
|
import com.ifish.activity.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,7 +40,7 @@ public class IosAlertDialog {
|
||||||
private boolean showNegBtn = false;
|
private boolean showNegBtn = false;
|
||||||
private boolean isMiddleShowEclipse = false; //setMsg时 文本内容超过最多5行后,省略号是否居中显示,默认不居中
|
private boolean isMiddleShowEclipse = false; //setMsg时 文本内容超过最多5行后,省略号是否居中显示,默认不居中
|
||||||
private int maxLines = 5;
|
private int maxLines = 5;
|
||||||
|
int gravity = Gravity.CENTER;
|
||||||
public IosAlertDialog(Context context) {
|
public IosAlertDialog(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
WindowManager windowManager = (WindowManager) context
|
WindowManager windowManager = (WindowManager) context
|
||||||
|
|
@ -45,6 +48,16 @@ public class IosAlertDialog {
|
||||||
display = windowManager.getDefaultDisplay();
|
display = windowManager.getDefaultDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IosAlertDialog(Context context,int gravity) {
|
||||||
|
this.context = context;
|
||||||
|
WindowManager windowManager = (WindowManager) context
|
||||||
|
.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
display = windowManager.getDefaultDisplay();
|
||||||
|
this.gravity = gravity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public IosAlertDialog builder() {
|
public IosAlertDialog builder() {
|
||||||
// 获取Dialog布局
|
// 获取Dialog布局
|
||||||
View view = LayoutInflater.from(context).inflate(
|
View view = LayoutInflater.from(context).inflate(
|
||||||
|
|
@ -64,14 +77,18 @@ public class IosAlertDialog {
|
||||||
|
|
||||||
// 定义Dialog布局和参数
|
// 定义Dialog布局和参数
|
||||||
dialog = new Dialog(context, R.style.AlertDialogStyle);
|
dialog = new Dialog(context, R.style.AlertDialogStyle);
|
||||||
dialog.getWindow().setGravity(Gravity.CENTER);
|
dialog.getWindow().setGravity(gravity);
|
||||||
dialog.setContentView(view);
|
dialog.setContentView(view);
|
||||||
// 调整dialog背景大小
|
// 调整dialog背景大小
|
||||||
lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
|
lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
|
||||||
.getWidth() * 0.7), LinearLayout.LayoutParams.MATCH_PARENT));
|
.getWidth() * 0.9), LinearLayout.LayoutParams.MATCH_PARENT));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTextColor(int color){
|
||||||
|
txt_msg.setTextColor(ContextCompat.getColor(context,color));
|
||||||
|
}
|
||||||
|
|
||||||
public IosAlertDialog setTitle(String title) {
|
public IosAlertDialog setTitle(String title) {
|
||||||
showTitle = true;
|
showTitle = true;
|
||||||
if ("".equals(title)) {
|
if ("".equals(title)) {
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:oneshot="false">
|
||||||
|
<item android:drawable="@drawable/bluetooth_one" android:duration="500"/>
|
||||||
|
<item android:drawable="@drawable/bluetooth_two" android:duration="500"/>
|
||||||
|
<item android:drawable="@drawable/bluetooth_three" android:duration="500"/>
|
||||||
|
<item android:drawable="@drawable/bluetooth_four" android:duration="500"/>
|
||||||
|
</animation-list>
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- 设置背景色 -->
|
||||||
|
<item android:id="@android:id/background">
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="2dp"></corners>
|
||||||
|
<solid android:color="#1A999999"></solid>
|
||||||
|
</shape>
|
||||||
|
|
||||||
|
</item>
|
||||||
|
<!-- 设置进度条颜色 -->
|
||||||
|
<item android:id="@android:id/progress">
|
||||||
|
<clip>
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="2dp"></corners>
|
||||||
|
<solid android:color="@color/cyan"></solid>
|
||||||
|
</shape>
|
||||||
|
</clip>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
|
@ -1,49 +1,84 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:background="#1A000000"
|
android:background="#1A000000"
|
||||||
android:layout_gravity="center">
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/cardview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
app:cardCornerRadius="@dimen/dp_15"
|
android:layout_marginHorizontal="40dp"
|
||||||
android:layout_gravity="center"
|
android:layout_centerInParent="true"
|
||||||
app:cardElevation="0dp"
|
app:cardCornerRadius="20dp"
|
||||||
android:elevation="0dp"
|
android:elevation="0dp"
|
||||||
android:layout_marginHorizontal="60dp"
|
app:cardElevation="0dp"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:gravity="center"
|
|
||||||
android:background="@color/white"
|
|
||||||
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
|
|
||||||
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:gravity="center"
|
||||||
android:text="正在加载中..."
|
android:layout_centerInParent="true"
|
||||||
android:textSize="18sp"
|
android:background="@color/white"
|
||||||
android:textColor="@color/black"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:orientation="vertical"
|
||||||
</LinearLayout>
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iconx"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
android:src="@drawable/bluetooth_connect"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/dg_pb_loading"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="4dp"
|
||||||
|
android:max="40"
|
||||||
|
android:progress="20"
|
||||||
|
android:progressDrawable="@drawable/progress_drawable"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||||
|
android:indeterminateBehavior="repeat"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_hint"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginBottom="60dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="设备正在联网中,请耐心等待"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_cancel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@drawable/bluetooth_five"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_marginHorizontal="40dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_cancel"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_alignBottom="@id/iv_cancel"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:layout_height="50dp"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/wv_wv"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:text="恭喜您,联网成功了"
|
||||||
|
android:textSize="26sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/danghao_color"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
@ -24,15 +24,15 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:layout_marginRight="15dp"
|
android:layout_marginRight="15dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="28dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="14sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0.5dp"
|
android:layout_height="0.5dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="40dp"
|
||||||
android:background="#c6c6c6" />
|
android:background="#c6c6c6" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
@ -43,24 +43,24 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_neg"
|
android:id="@+id/btn_neg"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="43dp"
|
android:layout_height="50dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:background="@drawable/ios_dialog_left_bg"
|
android:background="@drawable/ios_dialog_left_bg"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="#037BFF"
|
android:textColor="#999999"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_line"
|
android:id="@+id/img_line"
|
||||||
android:layout_width="0.5dp"
|
android:layout_width="0.5dp"
|
||||||
android:layout_height="43dp"
|
android:layout_height="50dp"
|
||||||
android:background="#c6c6c6" />
|
android:background="#c6c6c6" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_pos"
|
android:id="@+id/btn_pos"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="43dp"
|
android:layout_height="50dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:background="@drawable/ios_dialog_right_bg"
|
android:background="@drawable/ios_dialog_right_bg"
|
||||||
|
|
|
||||||
|
|
@ -321,4 +321,6 @@
|
||||||
<!--弹窗背景是否变暗-->
|
<!--弹窗背景是否变暗-->
|
||||||
<item name="android:backgroundDimEnabled">false</item>
|
<item name="android:backgroundDimEnabled">false</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue