Compare commits
23 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
91097fe0c0 | |
|
|
7acd65cb7c | |
|
|
fa69f374b6 | |
|
|
605fad0a0a | |
|
|
6979384f08 | |
|
|
cc17055443 | |
|
|
9a812e4e35 | |
|
|
e2bc03182f | |
|
|
16b36e3dfc | |
|
|
b458f80d13 | |
|
|
71e15f204e | |
|
|
8781a2bb14 | |
|
|
078a5eef4b | |
|
|
b982bc787a | |
|
|
3842e95435 | |
|
|
4b47f7d16f | |
|
|
daa7b860b2 | |
|
|
4cccd1ddad | |
|
|
a9ed698358 | |
|
|
694373a0a4 | |
|
|
6ea400ebff | |
|
|
2664e9cf76 | |
|
|
458a80bc00 |
|
|
@ -25,6 +25,6 @@ android.nonTransitiveRClass=true
|
|||
android.enableJetifier=true
|
||||
android.useAndroidX=true
|
||||
android.useDeprecatedNdk=true
|
||||
versionCode=111
|
||||
versionName=4.12.11
|
||||
|
||||
versionCode=104
|
||||
versionName=4.12.04
|
||||
|
|
@ -25,7 +25,7 @@ android {
|
|||
config {
|
||||
keyAlias 'android.keystore'
|
||||
keyPassword 'ifish7'
|
||||
storeFile file('../ifish7.keystore')
|
||||
storeFile file('ifish7.keystore')
|
||||
storePassword 'ifish7'
|
||||
}
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ android {
|
|||
versionName project.versionName
|
||||
multiDexEnabled true
|
||||
ndk {
|
||||
abiFilters "arm64-v8a"
|
||||
abiFilters "armeabi", "arm64-v8a"
|
||||
}
|
||||
|
||||
manifestPlaceholders = [
|
||||
|
|
@ -153,7 +153,7 @@ dependencies {
|
|||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'//2.0.4
|
||||
implementation 'com.tencent:mmkv:2.0.0'
|
||||
implementation("com.github.bumptech.glide:okhttp3-integration:4.11.0" )
|
||||
// implementation 'com.github.Jasonchenlijian:FastBle:2.4.0'
|
||||
implementation 'com.github.Jasonchenlijian:FastBle:2.4.0'
|
||||
|
||||
implementation 'io.github.lucksiege:pictureselector:v3.11.2'
|
||||
// 图片压缩 (按需引入)
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@
|
|||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<!-- // jiablue-->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />-->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />-->
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
|
@ -22,6 +19,7 @@
|
|||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
|
|
@ -37,14 +35,14 @@
|
|||
|
||||
|
||||
<!-- 蓝牙权限需求 -->
|
||||
<!-- // jiablue-->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH" />-->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!– 安卓12新增的蓝牙权限 –>-->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />-->
|
||||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <!– 定位权限, 蓝牙搜索需要 –>-->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />-->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
|
||||
<!-- // jiaxblue-->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 安卓12新增的蓝牙权限 -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <!-- 定位权限, 蓝牙搜索需要 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<!-- 使用相机 -->
|
||||
<!--
|
||||
<uses-feature
|
||||
|
|
@ -107,7 +105,7 @@
|
|||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:icon,android:theme,android:allowBackup">
|
||||
|
||||
<!-- 推送服务 jjia-push-->
|
||||
<!-- 推送服务 jjia-xpush-->
|
||||
<service
|
||||
android:name="com.ifish.push.IPushService"
|
||||
android:exported="false"
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ public class BindTwoDeviceActivity extends BaseActivity {
|
|||
initTitle("选择设备");
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
|
||||
// jiablue
|
||||
// perlist = new String[]{
|
||||
// android.Manifest.permission.BLUETOOTH_SCAN,
|
||||
// android.Manifest.permission.BLUETOOTH_ADVERTISE,
|
||||
// android.Manifest.permission.BLUETOOTH_CONNECT,
|
||||
// android.Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
// android.Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
// android.Manifest.permission.BLUETOOTH
|
||||
// };
|
||||
perlist = new String[]{
|
||||
android.Manifest.permission.BLUETOOTH_SCAN,
|
||||
android.Manifest.permission.BLUETOOTH_ADVERTISE,
|
||||
android.Manifest.permission.BLUETOOTH_CONNECT,
|
||||
android.Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
android.Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
android.Manifest.permission.BLUETOOTH
|
||||
};
|
||||
}
|
||||
initView();//初始化控件
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import android.widget.AdapterView;
|
|||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
//jjia-push
|
||||
//import com.clj.fastble.BleManager;
|
||||
//jjia-xpush
|
||||
import com.clj.fastble.BleManager;
|
||||
import com.ifish.adapter.GridViewCameraBaseAdapter;
|
||||
import com.ifish.adapter.GridViewDeviceBaseAdapter;
|
||||
import com.ifish.basebean.BaseBean;
|
||||
|
|
@ -370,8 +370,8 @@ public class DeviceCameraListActivity extends BaseActivity {
|
|||
@Override
|
||||
public void success(BaseBean<Device> baseBean) {
|
||||
result = baseBean.result;
|
||||
//jjia-push
|
||||
// BleManager.getInstance().disconnectAllDevice();
|
||||
//jjia-xpush
|
||||
BleManager.getInstance().disconnectAllDevice();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ public class HotSpotConnentDeviceActivity extends BaseActivity {
|
|||
|
||||
public void toDevice() {
|
||||
AppRoute.newToStart(HotSpotConnentDeviceActivity.this,deviceObj,true);
|
||||
ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
||||
// ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
||||
EventBean eventBean =new EventBean(EventBean.LINK_FINISH,0);
|
||||
EventBus.getDefault().post(eventBean);
|
||||
finish();
|
||||
|
|
@ -417,7 +417,7 @@ public class HotSpotConnentDeviceActivity extends BaseActivity {
|
|||
Commons.IS_CAMERA = false;
|
||||
sp.putBoolean(LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||
AppRoute.newToStart(HotSpotConnentDeviceActivity.this,deviceObj,true);
|
||||
ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
||||
// ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
||||
EventBean eventBean =new EventBean(EventBean.LINK_FINISH,0);
|
||||
EventBus.getDefault().post(eventBean);
|
||||
AnimationUtil.startAnimation(HotSpotConnentDeviceActivity.this);
|
||||
|
|
@ -456,13 +456,13 @@ public class HotSpotConnentDeviceActivity extends BaseActivity {
|
|||
Commons.DevicePosition = Commons.DEVICE.size() - 1;
|
||||
} 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.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||
Commons.IS_CAMERA = false;
|
||||
sp.putBoolean(LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||
AppRoute.newToStart(HotSpotConnentDeviceActivity.this,deviceObj,true);
|
||||
ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
||||
// ToastUtil.show(HotSpotConnentDeviceActivity.this, "绑定设备成功");
|
||||
EventBean eventBean =new EventBean(EventBean.LINK_FINISH,0);
|
||||
EventBus.getDefault().post(eventBean);
|
||||
AnimationUtil.startAnimation(HotSpotConnentDeviceActivity.this);
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ public class HotSpotConnentPetDeviceActivity extends BaseActivity {
|
|||
Commons.DevicePosition = Commons.DEVICE.size() - 1;
|
||||
} 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.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||
Commons.IS_CAMERA = false;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ifish.activity;
|
|||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
|
|
@ -31,6 +32,7 @@ import androidx.annotation.NonNull;
|
|||
import com.alibaba.sdk.android.httpdns.HttpDns;
|
||||
import com.alibaba.sdk.android.httpdns.HttpDnsService;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ifish.activity.newbind.NewBindDeviceActivity;
|
||||
import com.ifish.basebean.AdInfos;
|
||||
import com.ifish.basebean.BaseBean;
|
||||
import com.ifish.basebean.Device;
|
||||
|
|
@ -43,6 +45,7 @@ import com.ifish.geewe.DeviceCamera;
|
|||
import com.ifish.permission.PermissionHelper;
|
||||
import com.ifish.utils.ActivityManager;
|
||||
import com.ifish.utils.AnimationUtil;
|
||||
import com.ifish.utils.AppUtil;
|
||||
import com.ifish.utils.Commons;
|
||||
import com.ifish.utils.Commons.LoginSPKey;
|
||||
import com.ifish.utils.Commons.NetWork;
|
||||
|
|
@ -53,11 +56,13 @@ import com.ifish.utils.HttpManager;
|
|||
import com.ifish.utils.L;
|
||||
import com.ifish.utils.SPUtil;
|
||||
import com.ifish.utils.ToastUtil;
|
||||
import com.ifish.view.IosAlertDialog;
|
||||
import com.ifish.view.SuperTextView;
|
||||
import com.igexin.sdk.PushManager;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.xiaomi.mipush.sdk.MiPushClient;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -111,7 +116,7 @@ public class LoadingActivity extends BaseActivityNotAnim {
|
|||
private PermissionHelper permissionHelper;
|
||||
private static String firstShowPrivacy = "firstShowPrivacy";
|
||||
|
||||
|
||||
String[] permission;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -122,16 +127,82 @@ public class LoadingActivity extends BaseActivityNotAnim {
|
|||
if (savedInstanceState != null) {
|
||||
setIntent(new Intent()); // 从堆栈恢复,不再重复解析之前的intent
|
||||
}
|
||||
permission = AppUtil.getBluePermissionList();
|
||||
permissionHelper = new PermissionHelper(this, permission, 250);
|
||||
|
||||
//
|
||||
Boolean showPrivacy = SPUtil.getInstance(getApplicationContext()).getBoolean(firstShowPrivacy, false);
|
||||
Boolean aBoolean = ConfigUtil.getInstance(getApplicationContext()).getBoolean(LoginSPKey.IS_FirstOpen, false);
|
||||
if(!aBoolean && !showPrivacy){
|
||||
startPrivacyTextDialog();
|
||||
}else{
|
||||
// ();
|
||||
initapp();
|
||||
}
|
||||
|
||||
}
|
||||
private void getPermission() {
|
||||
permissionHelper.request(new PermissionHelper.PermissionCallback() {
|
||||
@Override
|
||||
public void onPermissionGranted() {
|
||||
initapp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIndividualPermissionGranted(String[] grantedPermission) {
|
||||
initapp();
|
||||
// AlertDialog.Builder dialog = new AlertDialog.Builder(LoadingActivity.this);
|
||||
// dialog.setCancelable(false);
|
||||
// dialog.setMessage("蓝牙联网,请先同意app获取蓝牙相关权限x");
|
||||
// dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(
|
||||
// DialogInterface dialog,
|
||||
// int which) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// }
|
||||
// });
|
||||
// dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPermissionDenied() {
|
||||
initapp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPermissionDeniedBySystem() {
|
||||
// IosAlertDialog dialog = new IosAlertDialog(LoadingActivity.this).builder();
|
||||
// dialog.setCancelable(false);
|
||||
// dialog.setTitle("权限申请理由");
|
||||
// dialog.setMessage("蓝牙联网,请到应用信息页面-权限管理-打开蓝牙权限");
|
||||
// dialog.setNegativeButton("取消", view -> {
|
||||
// initapp();
|
||||
// });
|
||||
// dialog.setPositiveButton("去开启", view ->
|
||||
// {
|
||||
// AppUtil.toAuthority(LoadingActivity.this);
|
||||
// });
|
||||
// dialog.show();
|
||||
initapp();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (permissionHelper != null) {
|
||||
permissionHelper.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void analysisBaseUrlError(){
|
||||
showProgressDialog();
|
||||
|
|
@ -308,11 +379,16 @@ public class LoadingActivity extends BaseActivityNotAnim {
|
|||
|
||||
|
||||
private void initapp() {
|
||||
// jjia-push
|
||||
// jjia-xpush
|
||||
// IPushService
|
||||
// IIntentService
|
||||
PushManager.getInstance().preInit(this);
|
||||
PushManager.getInstance().initialize(this);
|
||||
MiPushClient.setAlias(this,"aaa","aaa" );
|
||||
|
||||
L.i("jjia------push init-as-"+MiPushClient.getAllAlias(this));
|
||||
L.i("jjia------push init-getRegId-"+MiPushClient.getRegId(this));
|
||||
L.i("jjia------push init-getRegId-"+PushManager.getInstance().getClientid(this));
|
||||
if (BuildConfig.DEBUG){
|
||||
PushManager.getInstance().setDebugLogger(this, s -> L.i("jjia--------"+s));
|
||||
}
|
||||
|
|
@ -899,9 +975,9 @@ public class LoadingActivity extends BaseActivityNotAnim {
|
|||
public void onClick(View v) {
|
||||
alertDialog.cancel();
|
||||
SPUtil.getInstance(getApplicationContext()).putBoolean(firstShowPrivacy,true);
|
||||
// getPermission();
|
||||
// pushInit();
|
||||
initapp();
|
||||
// getPermission();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ public class LoginActivity extends BaseActivity {
|
|||
initTitleView();
|
||||
initView();
|
||||
initListener();
|
||||
SPUtil.getInstance(this).putBoolean("xfirst",false);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
|
|
@ -294,7 +295,7 @@ public class LoginActivity extends BaseActivity {
|
|||
switch (msg.what) {
|
||||
case NetWork.Success:
|
||||
saveInfo();
|
||||
ToastUtil.show(getApplicationContext(), "登录成功");
|
||||
// ToastUtil.show(getApplicationContext(), "登录成功");
|
||||
dismissProgressDialog();
|
||||
startActivity(MainTabActivity.class);
|
||||
finish();
|
||||
|
|
|
|||
|
|
@ -4,20 +4,26 @@ import static com.ifish.activity.MainTabActivity.map;
|
|||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.clj.fastble.data.BleScanState;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.ifish.basebean.BaseBean;
|
||||
|
|
@ -43,7 +49,9 @@ import com.ifish.tcp.FishFeedType;
|
|||
import com.ifish.tcp.TcpReceiveThread;
|
||||
import com.ifish.tcp.TcpSendThread;
|
||||
import com.ifish.utils.AnimationUtil;
|
||||
import com.ifish.utils.AppUtil;
|
||||
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;
|
||||
|
|
@ -100,6 +108,9 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
|
||||
private Device deviceBean;
|
||||
|
||||
private boolean isBind = false;
|
||||
private boolean isShowHint = true;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -117,9 +128,28 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
isBind = getIntent().getBooleanExtra(BaseGradeActivity.BINDDEVICE,false);
|
||||
L.i("jjia------------"+isBind);
|
||||
if (isBind){
|
||||
DialogUtil.Companion.showLoadingDialog(this,true,"设备正在联网中,请耐心等待");
|
||||
startDownTimer();
|
||||
}
|
||||
// showHint();
|
||||
}
|
||||
|
||||
private void showHint(){
|
||||
|
||||
isShowHint = false;
|
||||
Toast toast = new Toast(this);
|
||||
toast.setDuration(Toast.LENGTH_LONG);
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
View view = inflater.inflate(R.layout.hint_toast, null);
|
||||
toast.setView(view);
|
||||
toast.setGravity(Gravity.CENTER,0,120);
|
||||
toast.show();
|
||||
|
||||
}
|
||||
public void onEventMainThread(EventBean eventBean){
|
||||
if (eventBean!=null && EventBean.CHANGE_DEVICE_NAME.equals(eventBean.name)){
|
||||
setTitle(eventBean.value);
|
||||
|
|
@ -146,7 +176,9 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
protected void onDestroy() {
|
||||
isToast = false;
|
||||
EventBus.getDefault().unregister(this);
|
||||
DialogUtil.Companion.setLoadingDialogDismiss(this);
|
||||
closeSoket();
|
||||
closeDownTimer();
|
||||
stopAllTimer();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
|
@ -389,7 +421,7 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
tv_wendu.setText("");
|
||||
sw.setRefreshing(false);
|
||||
if (isToast) {
|
||||
ToastUtil.showSpecial(MainSix_4F_ControlActivity.this, Commons.Text.Repost);
|
||||
// ToastUtil.showSpecial(MainSix_4F_ControlActivity.this, Commons.Text.Repost);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -438,7 +470,7 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
resetIVFlag();
|
||||
isWaterDialog = false;
|
||||
dismissProgressDialog();
|
||||
ToastUtil.showSpecial(MainSix_4F_ControlActivity.this, Commons.Text.Repost);
|
||||
// ToastUtil.showSpecial(MainSix_4F_ControlActivity.this, Commons.Text.Repost);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -579,9 +611,16 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
|
||||
//接受6控查询返回的指令
|
||||
public void onEventMainThread(BackInfoModelSix_4F event) {
|
||||
closeDownTimer();
|
||||
L.i("jjia---------c------1"+event.toString());
|
||||
hidegif();
|
||||
dismissProgressDialog();
|
||||
if (isBind){
|
||||
DialogUtil.Companion.setLoadingDialogDismiss(this);
|
||||
if (isShowHint){
|
||||
showHint();
|
||||
}
|
||||
}
|
||||
dismissProgressDialogCancelble();
|
||||
tv_offline.setVisibility(View.GONE);
|
||||
backInfoModelSix_4F = event;
|
||||
|
|
@ -1318,4 +1357,33 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
CountDownTimer countDownTimer;
|
||||
int dowmCount = 0;
|
||||
private void startDownTimer(){
|
||||
closeDownTimer();
|
||||
countDownTimer = new CountDownTimer(40000,1000) {
|
||||
@Override
|
||||
public void onTick(long l) {
|
||||
DialogUtil.Companion.setProgress(dowmCount);
|
||||
dowmCount++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
DialogUtil.Companion.setError();
|
||||
}
|
||||
};
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
private void closeDownTimer(){
|
||||
if (countDownTimer!=null){
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -721,19 +721,19 @@ public class MainTabActivity extends BaseFragmentActivity {
|
|||
}
|
||||
|
||||
public void onEventMainThread(EventBean event) {
|
||||
if (event!=null){
|
||||
switch (event.index) {
|
||||
case -1:
|
||||
startDownTimer();
|
||||
break;
|
||||
case 1:
|
||||
closeDownTimer();
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if (event!=null){
|
||||
// switch (event.index) {
|
||||
// case -1:
|
||||
// startDownTimer();
|
||||
// break;
|
||||
// case 1:
|
||||
// closeDownTimer();
|
||||
// break;
|
||||
// default:
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
CountDownTimer countDownTimer;
|
||||
|
|
|
|||
|
|
@ -7,11 +7,7 @@
|
|||
*/
|
||||
package com.ifish.activity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
|
|
@ -25,7 +21,6 @@ import android.provider.MediaStore;
|
|||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.Window;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
|
|
@ -42,7 +37,6 @@ import com.ifish.basebean.LoadHeadImage;
|
|||
import com.ifish.basebean.User;
|
||||
import com.ifish.baseclass.BaseActivity;
|
||||
import com.ifish.baseclass.UriForFile;
|
||||
import com.ifish.fragment.DeviceFragment;
|
||||
import com.ifish.permission.PermissionHelper;
|
||||
import com.ifish.utils.AnimationUtil;
|
||||
import com.ifish.utils.AppUtil;
|
||||
|
|
@ -631,6 +625,17 @@ public class MineActivity extends BaseActivity {
|
|||
|
||||
@Override
|
||||
public void onIndividualPermissionGranted(String[] grantedPermission) {
|
||||
//<<<<<<< HEAD
|
||||
// AlertDialog.Builder dialog = new AlertDialog.Builder(MineActivity.this);
|
||||
// dialog.setCancelable(false);
|
||||
// dialog.setMessage("设置头像,请先同意app获取存储和相机权限");
|
||||
// dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(
|
||||
// DialogInterface dialog,
|
||||
// int which) {
|
||||
//=======
|
||||
//>>>>>>> feature-online
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -693,7 +698,6 @@ public class MineActivity extends BaseActivity {
|
|||
|
||||
IosAlertDialog openDialog;
|
||||
private void showPermissionHint(){
|
||||
|
||||
openDialog = new IosAlertDialog(MineActivity.this).builder();
|
||||
openDialog.setCancelable(true);
|
||||
openDialog.setTitle("申请权限目的说明");
|
||||
|
|
@ -701,10 +705,15 @@ public class MineActivity extends BaseActivity {
|
|||
openDialog.setPositiveButtonx("继续", new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (permissionHelper.checkSelfPermission(permission)) {
|
||||
gallery();
|
||||
}else{
|
||||
getPermission();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
openDialog.setNegativeButton("取消", new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
|||
|
|
@ -34,12 +34,14 @@ import com.ifish.baseclass.UriForFile;
|
|||
import com.ifish.permission.PermissionHelper;
|
||||
import com.ifish.utils.ActivityManager;
|
||||
import com.ifish.utils.AnimationUtil;
|
||||
import com.ifish.utils.AppUtil;
|
||||
import com.ifish.utils.Commons;
|
||||
import com.ifish.utils.HttpListener;
|
||||
import com.ifish.utils.HttpManager;
|
||||
import com.ifish.utils.L;
|
||||
import com.ifish.utils.SPUtil;
|
||||
import com.ifish.utils.ToastUtil;
|
||||
import com.igexin.sdk.PushManager;
|
||||
import com.lidroid.xutils.HttpUtils;
|
||||
import com.lidroid.xutils.exception.HttpException;
|
||||
import com.lidroid.xutils.http.ResponseInfo;
|
||||
|
|
@ -127,6 +129,8 @@ public class MySettingActivity extends BaseActivity {
|
|||
findViewById(R.id.rl_devicereset).setOnClickListener(this);
|
||||
findViewById(R.id.rl_bindphone).setOnClickListener(this);
|
||||
findViewById(R.id.tv_exit).setOnClickListener(view -> exitAccount());
|
||||
TextView textView = findViewById(R.id.cid);
|
||||
textView.setText(PushManager.getInstance().getClientid(this));
|
||||
}
|
||||
|
||||
private void exitAccount(){
|
||||
|
|
@ -253,7 +257,12 @@ public class MySettingActivity extends BaseActivity {
|
|||
|
||||
private void checkVersion() {
|
||||
versionCode = versionCode.toUpperCase();
|
||||
if (versionCode.equals(HttpManager.getVersionName(MySettingActivity.this))) {
|
||||
|
||||
int code = AppUtil.getVersionValue(versionCode);
|
||||
int appCode = AppUtil.getVersionValue(HttpManager.getVersionName(MySettingActivity.this));
|
||||
L.i("jia---------servercode--"+code);
|
||||
L.i("jia---------appCode--"+appCode);
|
||||
if (appCode>= code) {
|
||||
ToastUtil.show(MySettingActivity.this, "您使用的是最新版本");
|
||||
} else {
|
||||
updateDialog();
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ public class NoNetwork extends BaseSingleActivity {
|
|||
Intent intent = new Intent();
|
||||
switch (msg.what) {
|
||||
case NetWork.Success:
|
||||
ToastUtil.show(getApplicationContext(), "登录成功");
|
||||
// ToastUtil.show(getApplicationContext(), "登录成功");
|
||||
String stringExtra = getIntent().getStringExtra("jpush");
|
||||
if (!TextUtils.isEmpty(stringExtra)) {
|
||||
intent.putExtra("jpush", stringExtra);
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ public class RegisteredActivity extends BaseActivityNotAnim {
|
|||
initView();
|
||||
init();
|
||||
initListener();
|
||||
SPUtil.getInstance(this).putBoolean("xfirst",false);
|
||||
}
|
||||
|
||||
private void test() {
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ public class AirKissUtil {
|
|||
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||
Commons.IS_CAMERA = false;
|
||||
sp.putBoolean(Commons.LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||
ToastUtil.show(curActivity, "绑定设备成功");
|
||||
// ToastUtil.show(curActivity, "绑定设备成功");
|
||||
AppRoute.newToStart(curActivity,deviceObj,true);
|
||||
curActivity.finish();
|
||||
L.i("===================绑定设备成功=" + device_mac);
|
||||
|
|
@ -599,7 +599,7 @@ public class AirKissUtil {
|
|||
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||
Commons.IS_CAMERA = false;
|
||||
sp.putBoolean(Commons.LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||
ToastUtil.show(curActivity, "绑定设备成功");
|
||||
// ToastUtil.show(curActivity, "绑定设备成功");
|
||||
AppRoute.newToStart(curActivity,deviceObj,true);
|
||||
|
||||
curActivity.finish();
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ public class BottomChoiceDialog extends DialogFragment implements View.OnClickLi
|
|||
lineAirKiss.setVisibility(View.VISIBLE);
|
||||
lineAP.setVisibility(View.VISIBLE);
|
||||
lineSmartConfig.setVisibility(View.GONE);
|
||||
// jiablue 暂时隐藏
|
||||
lineBle.setVisibility(View.GONE);
|
||||
// jiaxblue 暂时隐藏
|
||||
// lineBle.setVisibility(View.GONE);
|
||||
switch (curConnectType) {
|
||||
case SmartConfig:
|
||||
// 处理SmartConfig逻辑
|
||||
|
|
|
|||
|
|
@ -28,16 +28,17 @@ import android.widget.RelativeLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresPermission;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
//jjia-push
|
||||
//import com.clj.fastble.BleManager;
|
||||
//import com.clj.fastble.callback.BleGattCallback;
|
||||
//import com.clj.fastble.callback.BleMtuChangedCallback;
|
||||
//import com.clj.fastble.callback.BleNotifyCallback;
|
||||
//import com.clj.fastble.callback.BleScanCallback;
|
||||
//import com.clj.fastble.callback.BleWriteCallback;
|
||||
//import com.clj.fastble.data.BleDevice;
|
||||
//import com.clj.fastble.exception.BleException;
|
||||
//jjia-xpush
|
||||
import com.clj.fastble.BleManager;
|
||||
import com.clj.fastble.callback.BleGattCallback;
|
||||
import com.clj.fastble.callback.BleMtuChangedCallback;
|
||||
import com.clj.fastble.callback.BleNotifyCallback;
|
||||
import com.clj.fastble.callback.BleScanCallback;
|
||||
import com.clj.fastble.callback.BleWriteCallback;
|
||||
import com.clj.fastble.data.BleDevice;
|
||||
import com.clj.fastble.exception.BleException;
|
||||
import com.ifish.activity.BindCameraActivity;
|
||||
import com.ifish.activity.BindTankActivity;
|
||||
import com.ifish.activity.BindTankPetActivity;
|
||||
|
|
@ -58,6 +59,7 @@ import com.ifish.activity.MainThree1CControlActivity;
|
|||
import com.ifish.activity.MainThreeControlActivity;
|
||||
import com.ifish.activity.MainTwoControlActivity;
|
||||
import com.ifish.activity.MainZeroControlActivity;
|
||||
import com.ifish.activity.MineActivity;
|
||||
import com.ifish.activity.R;
|
||||
import com.ifish.activity.WebViewActivity;
|
||||
import com.ifish.basebean.BaseBean;
|
||||
|
|
@ -65,6 +67,7 @@ import com.ifish.basebean.ConnectMessageEvent;
|
|||
import com.ifish.basebean.Device;
|
||||
import com.ifish.basebean.EventBean;
|
||||
import com.ifish.baseclass.BaseGradeActivity;
|
||||
import com.ifish.permission.PermissionHelper;
|
||||
import com.ifish.tcp.BackFunctionCode7_11;
|
||||
import com.ifish.tcp.ModelCodec;
|
||||
import com.ifish.tcp.OrderDeviceConnectModel;
|
||||
|
|
@ -73,6 +76,7 @@ import com.ifish.tcp.ResetDeviceModel;
|
|||
import com.ifish.utils.ActivityManager;
|
||||
import com.ifish.utils.AnimationUtil;
|
||||
import com.ifish.utils.AppRoute;
|
||||
import com.ifish.utils.AppUtil;
|
||||
import com.ifish.utils.BlueToothUtil;
|
||||
import com.ifish.utils.ByteUtil;
|
||||
import com.ifish.utils.ClickUtil;
|
||||
|
|
@ -83,6 +87,7 @@ import com.ifish.utils.L;
|
|||
import com.ifish.utils.SPUtil;
|
||||
import com.ifish.utils.ToastUtil;
|
||||
import com.ifish.utils.WifiAdmin;
|
||||
import com.ifish.view.IosAlertDialog;
|
||||
import com.lidroid.xutils.util.LogUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
|
@ -130,12 +135,15 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
private Dialog waterTempDialog;
|
||||
String type = null;
|
||||
private Activity activity;
|
||||
private PermissionHelper permissionHelper;
|
||||
String[] permission;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_new_bind_device_choice);
|
||||
activity = this;
|
||||
|
||||
permission = AppUtil.getBluePermissionList();
|
||||
permissionHelper = new PermissionHelper(this, permission, 250);
|
||||
ActivityManager.getInstance().addActivity(this);
|
||||
|
||||
sp=SPUtil.getInstance(this);
|
||||
|
|
@ -151,8 +159,8 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
devicetype = getIntent().getStringExtra("devicetype");
|
||||
L.i("jjia----------------devicetype="+devicetype);
|
||||
airKissUtil.init(this,devicetype);
|
||||
//jjia-push
|
||||
// BleManager.getInstance().disconnectAllDevice();
|
||||
//jjia-xpush
|
||||
BleManager.getInstance().disconnectAllDevice();
|
||||
if ("bluetooth".equals(type)){
|
||||
curConnectType = BlueTooth;
|
||||
}else {
|
||||
|
|
@ -163,8 +171,8 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
switchUIConnectType(curConnectType);
|
||||
|
||||
if ("bluetooth".equals(type)){ // 主动去联网
|
||||
//jjia-push
|
||||
// currentDevice = getIntent().getParcelableExtra("device");
|
||||
//jjia-xpush
|
||||
currentDevice = getIntent().getParcelableExtra("device");
|
||||
}
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
|
|
@ -319,6 +327,10 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
public void onClick(View v) {
|
||||
Intent i = new Intent();
|
||||
i.setClass(NewBindDeviceActivity.this, WebViewActivity.class);
|
||||
if (curConnectType ==ConnectType.BlueTooth){
|
||||
i.putExtra(WebViewActivity.URL, HttpManager.BlueConnectVideoUrl);
|
||||
i.putExtra(WebViewActivity.WEBVIEWTITLE, HttpManager.BlueConnectVideoTitle);
|
||||
}else
|
||||
if (curConnectType == ConnectType.AirKiss){
|
||||
i.putExtra(WebViewActivity.URL, HttpManager.AirKissConnectVideoUrl);
|
||||
i.putExtra(WebViewActivity.WEBVIEWTITLE, HttpManager.AirKissConnectVideoTitle);
|
||||
|
|
@ -348,15 +360,15 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
*/
|
||||
|
||||
private void changeView(boolean blue){
|
||||
if (blue){
|
||||
tvTips2.setVisibility(View.GONE);
|
||||
tvTips3.setVisibility(View.GONE);
|
||||
|
||||
|
||||
}else {
|
||||
tvTips2.setVisibility(View.VISIBLE);
|
||||
tvTips3.setVisibility(View.VISIBLE);
|
||||
}
|
||||
// if (blue){
|
||||
// tvTips2.setVisibility(View.GONE);
|
||||
// tvTips3.setVisibility(View.GONE);
|
||||
//
|
||||
//
|
||||
// }else {
|
||||
// tvTips2.setVisibility(View.VISIBLE);
|
||||
// tvTips3.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
}
|
||||
public void switchUIConnectType(ConnectType connectType) {
|
||||
resetLayout();
|
||||
|
|
@ -369,7 +381,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
tvConnectVideo.setVisibility(View.INVISIBLE);
|
||||
tvTips.setText("1、插座仅支持2.4G的WiFi网络,不支持5G及双频合一的网络(需在路由器设置中分开)");
|
||||
tvTips2.setText("2、先长按插座复位键3秒,松手后红灯绿灯同时闪烁以后,再点确定按钮。");
|
||||
tvTips3.setText("3、如多次尝试一键联网都不成功,可切换其他联网方式,每次重新连接时插座需断一次电然后重新复位连接。");
|
||||
tvTips3.setText("3、如多次尝试快捷联网都不成功,可切换其他联网方式,每次重新连接时插座需断一次电,然后重新复位连接。");
|
||||
changeView(false);
|
||||
break;
|
||||
case BlueTooth:
|
||||
|
|
@ -377,10 +389,10 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
// 处理SmartConfig逻辑
|
||||
tvConnectType.setText("蓝牙联网");
|
||||
tvClickButton.setText("确定");
|
||||
tvConnectVideo.setVisibility(View.INVISIBLE);
|
||||
tvTips.setText("1、插座仅支持2.4G的WiFi网络,不支持5G及双频合一的网络(需在路由器设置中分开)");
|
||||
tvTips2.setText("2、先长按插座复位键3秒,松手后红灯绿灯同时闪烁以后,再点确定按钮。");
|
||||
tvTips3.setText("3、如多次尝试一键联网都不成功,可切换其他联网方式,每次重新连接时插座需断一次电然后重新复位连接。");
|
||||
// tvConnectVideo.setVisibility(View.INVISIBLE);
|
||||
tvTips.setText("1、插座不支持5G的WiFi网络。");
|
||||
tvTips2.setText("2、先长按插座复位键3秒,松手后红灯绿灯同时闪烁,再点确定按钮。");
|
||||
tvTips3.setText("3、如多次尝试蓝牙联网都不成功,可切换成AP联网方式,每次重新连接时插座需断一次电,然后重新复位连接。");
|
||||
changeView(true);
|
||||
break;
|
||||
case APConnect:
|
||||
|
|
@ -397,7 +409,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
tvClickButton.setText("确定");
|
||||
tvTips.setText("1、插座仅支持2.4G的WiFi网络,不支持5G及双频合一的网络(需在路由器设置中分开)");
|
||||
tvTips2.setText("2、先长按插座复位键3秒,松手后红灯绿灯同时闪烁以后,再点确定按钮。");
|
||||
tvTips3.setText("3、如多次尝试一键联网都不成功,可切换其他联网方式,每次重新连接时插座需断一次电然后重新复位连接。");
|
||||
tvTips3.setText("3、如多次尝试一键联网都不成功,可切换其他联网方式,每次重新连接时插座需断一次电,然后重新复位连接。");
|
||||
// 处理AirKiss逻辑
|
||||
changeView(false);
|
||||
break;
|
||||
|
|
@ -470,42 +482,13 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
break;
|
||||
case BlueTooth:
|
||||
|
||||
if (permissionHelper.checkSelfPermission(permission)) {
|
||||
blueClick();
|
||||
} else {
|
||||
showPermissionHint();
|
||||
}
|
||||
|
||||
|
||||
//jjia-push
|
||||
// boolean support = BleManager.getInstance().isSupportBle();
|
||||
// if (!support){
|
||||
// ToastUtil.show(NewBindDeviceActivity.this,"当前设备不支持低功耗蓝牙");
|
||||
// } else {
|
||||
// boolean enable = BleManager.getInstance().isBlueEnable();
|
||||
// if (enable){
|
||||
// if (TextUtils.isEmpty(type)){
|
||||
// blueScan();
|
||||
// }else {
|
||||
// showDialog("开始连接蓝牙设备");
|
||||
// connectBle();
|
||||
// }
|
||||
// }else {
|
||||
// AlertDialog.Builder dialog = new AlertDialog.Builder(NewBindDeviceActivity.this, AlertDialog.THEME_HOLO_LIGHT);
|
||||
// dialog.setCancelable(false);
|
||||
// dialog.setMessage("蓝牙没有打开,现在去申请打开蓝牙,请允许后,再点击'确定'连接");
|
||||
// dialog.setPositiveButton("去申请", new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(
|
||||
// DialogInterface dialog,
|
||||
// int which) {
|
||||
// BlueToothUtil.openBlueTooth(NewBindDeviceActivity.this);
|
||||
// }
|
||||
// });
|
||||
// dialog.setNegativeButton("拒绝", new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// finish();
|
||||
// }
|
||||
// });
|
||||
// dialog.show();
|
||||
// }
|
||||
// }
|
||||
|
||||
break;
|
||||
case APConnect:
|
||||
|
|
@ -515,49 +498,167 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
case AirKiss:
|
||||
// 处理AirKiss逻辑
|
||||
L.i("jjia----------------bssid="+bssid);
|
||||
ToastUtil.show(NewBindDeviceActivity.this, "开始AirKiss联网...");
|
||||
// ToastUtil.show(NewBindDeviceActivity.this, "开始AirKiss联网...");
|
||||
airKissUtil.connectDeviceByAirKiss(this, ssid, bssid, pwd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//jjia-push
|
||||
// private void blueScan(){
|
||||
// BleManager.getInstance().scan(new BleScanCallback() {
|
||||
// @Override
|
||||
// public void onScanFinished(List<BleDevice> scanResultList) {
|
||||
//
|
||||
// if (currentDevice!=null){
|
||||
// connectBle();
|
||||
// }else {
|
||||
// ToastUtil.show(NewBindDeviceActivity.this,"扫描结束,没有搜索到可用设备");
|
||||
// dismissDialog();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onScanStarted(boolean success) {
|
||||
//// ToastUtil.show(NewBindDeviceActivity.this,"开始扫描");
|
||||
// showDialog("正在搜索附近设备,请确保设备处于配网状态");
|
||||
// }
|
||||
//
|
||||
// @SuppressLint("MissingPermission")
|
||||
// @Override
|
||||
// public void onScanning(BleDevice bleDevice) {
|
||||
// if (bleDevice!=null && bleDevice.getDevice()!=null){
|
||||
// BluetoothDevice bean = bleDevice.getDevice();
|
||||
// if (!TextUtils.isEmpty(bean.getName()) && bean.getName().startsWith("ifish")){
|
||||
// currentDevice = bleDevice;
|
||||
//// tvname.setText(bean.getName()+bean.getAddress());
|
||||
// BleManager.getInstance().cancelScan();
|
||||
// }
|
||||
// L.i(bean.getName()+"jjia---------"+bean.getAddress());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
private void showPermissionHint(){
|
||||
IosAlertDialog dialog = new IosAlertDialog(this).builder();
|
||||
dialog.setCancelable(false);
|
||||
dialog.setTitle("权限申请理由");
|
||||
dialog.setMessage("蓝牙联网,需要app获取手机的蓝牙扫描权限才能进行蓝牙扫描,是否允许申请蓝牙扫描相关权限?");
|
||||
dialog.setNegativeButton("拒绝", view -> {
|
||||
|
||||
});
|
||||
dialog.setPositiveButton("申请", view ->
|
||||
{
|
||||
getPermission();
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void getPermission() {
|
||||
permissionHelper.request(new PermissionHelper.PermissionCallback() {
|
||||
@Override
|
||||
public void onPermissionGranted() {
|
||||
blueClick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIndividualPermissionGranted(String[] grantedPermission) {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(NewBindDeviceActivity.this);
|
||||
dialog.setCancelable(false);
|
||||
dialog.setMessage("蓝牙联网,请先同意app获取蓝牙相关权限");
|
||||
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(
|
||||
DialogInterface dialog,
|
||||
int which) {
|
||||
|
||||
}
|
||||
});
|
||||
dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPermissionDenied() {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(NewBindDeviceActivity.this);
|
||||
dialog.setCancelable(false);
|
||||
dialog.setMessage("蓝牙联网,请先同意app获取蓝牙相关权限");
|
||||
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(
|
||||
DialogInterface dialog,
|
||||
int which) {
|
||||
getPermission();
|
||||
}
|
||||
});
|
||||
dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPermissionDeniedBySystem() {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(NewBindDeviceActivity.this);
|
||||
dialog.setCancelable(false);
|
||||
dialog.setTitle("温馨提示");
|
||||
dialog.setMessage("蓝牙联网,请到应用信息页面-权限管理-打开蓝牙权限");
|
||||
dialog.setPositiveButton("去开启", (dialog1, which) -> {
|
||||
AppUtil.toAuthority(NewBindDeviceActivity.this);
|
||||
});
|
||||
dialog.setNegativeButton("取消", (dialog12, which) -> {
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void blueClick(){
|
||||
//jjia-xpush
|
||||
boolean support = BleManager.getInstance().isSupportBle();
|
||||
if (!support){
|
||||
ToastUtil.show(NewBindDeviceActivity.this,"当前设备不支持低功耗蓝牙");
|
||||
} else {
|
||||
boolean enable = BleManager.getInstance().isBlueEnable();
|
||||
if (enable){
|
||||
if (TextUtils.isEmpty(type)){
|
||||
blueScan();
|
||||
}else {
|
||||
showDialog("开始连接蓝牙设备");
|
||||
connectBle();
|
||||
}
|
||||
}else {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(NewBindDeviceActivity.this, AlertDialog.THEME_HOLO_LIGHT);
|
||||
dialog.setCancelable(false);
|
||||
dialog.setMessage("蓝牙没有打开,现在去申请打开蓝牙,请允许后,再点击'确定'连接");
|
||||
dialog.setPositiveButton("去申请", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(
|
||||
DialogInterface dialog,
|
||||
int which) {
|
||||
BlueToothUtil.openBlueTooth(NewBindDeviceActivity.this);
|
||||
}
|
||||
});
|
||||
dialog.setNegativeButton("拒绝", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
//jjia-xpush
|
||||
private void blueScan(){
|
||||
BleManager.getInstance().scan(new BleScanCallback() {
|
||||
@Override
|
||||
public void onScanFinished(List<BleDevice> scanResultList) {
|
||||
|
||||
if (currentDevice!=null){
|
||||
connectBle();
|
||||
}else {
|
||||
ToastUtil.show(NewBindDeviceActivity.this,"扫描结束,没有搜索到可用设备");
|
||||
dismissDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanStarted(boolean success) {
|
||||
// ToastUtil.show(NewBindDeviceActivity.this,"开始扫描");
|
||||
showDialog("正在搜索附近设备,请确保设备处于配网状态");
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@Override
|
||||
public void onScanning(BleDevice bleDevice) {
|
||||
if (bleDevice!=null && bleDevice.getDevice()!=null){
|
||||
BluetoothDevice bean = bleDevice.getDevice();
|
||||
if (!TextUtils.isEmpty(bean.getName()) && bean.getName().startsWith("ifish")){
|
||||
currentDevice = bleDevice;
|
||||
// tvname.setText(bean.getName()+bean.getAddress());
|
||||
BleManager.getInstance().cancelScan();
|
||||
}
|
||||
L.i(bean.getName()+"jjia---------"+bean.getAddress());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private boolean isJump = false;
|
||||
//jjia-push
|
||||
// BleDevice currentDevice;
|
||||
//jjia-xpush
|
||||
BleDevice currentDevice;
|
||||
/**
|
||||
* 1.跳转设置页面连接ifish-xxx的wifi,连接成功后返回
|
||||
*/
|
||||
|
|
@ -636,142 +737,153 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
}
|
||||
//jjia-push
|
||||
//jjia-xpush
|
||||
private String device_mac;
|
||||
// private void openNotify(){
|
||||
// BleManager.getInstance().notify(currentDevice, SERVICE_UUID, WRITE_UUID, new BleNotifyCallback() {
|
||||
// @Override
|
||||
// public void onNotifySuccess() {
|
||||
// sendBleData();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNotifyFailure(BleException exception) {
|
||||
//// dismissProgressDialogCancelble();
|
||||
// dismissDialog();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCharacteristicChanged(byte[] data) {
|
||||
//
|
||||
// if (data!=null && data.length>0){
|
||||
// int check_code = data[1];
|
||||
// int length = data[14];
|
||||
// byte[] dataByte = new byte[length];
|
||||
// for (int i = 0; i < dataByte.length; i++) {
|
||||
// dataByte[i] = data[i];
|
||||
// }
|
||||
//
|
||||
// Object object = ModelCodec.deCode(dataByte,Commons.IoBuffer);
|
||||
// if (object!=null && object instanceof BackFunctionCode7_11){
|
||||
// BackFunctionCode7_11 model = (BackFunctionCode7_11) object;
|
||||
// String status = ByteUtil.toHex(model.getStatus());
|
||||
// device_mac = ByteUtil.bytesToHexString(model.getSrc());
|
||||
//
|
||||
//
|
||||
// dismissDialog();
|
||||
// if (!TextUtils.isEmpty(device_mac)){
|
||||
// showDialog("正在绑定设备...");
|
||||
// connectDevice.cancel();
|
||||
// connectDevice.start();
|
||||
// }
|
||||
//// checkoutMac(device_mac);
|
||||
// }
|
||||
// L.i("jjia-------check_code-"+check_code);
|
||||
// L.i("jjia-------length-"+length);
|
||||
// L.i("jjia-------device_mac-"+device_mac);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
private void openNotify(){
|
||||
BleManager.getInstance().notify(currentDevice, SERVICE_UUID, WRITE_UUID, new BleNotifyCallback() {
|
||||
@Override
|
||||
public void onNotifySuccess() {
|
||||
sendBleData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotifyFailure(BleException exception) {
|
||||
// dismissProgressDialogCancelble();
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCharacteristicChanged(byte[] data) {
|
||||
|
||||
if (data!=null && data.length>0){
|
||||
int check_code = data[1];
|
||||
int length = data[14];
|
||||
byte[] dataByte = new byte[length];
|
||||
for (int i = 0; i < dataByte.length; i++) {
|
||||
dataByte[i] = data[i];
|
||||
}
|
||||
|
||||
Object object = ModelCodec.deCode(dataByte,Commons.IoBuffer);
|
||||
if (object!=null && object instanceof BackFunctionCode7_11){
|
||||
BackFunctionCode7_11 model = (BackFunctionCode7_11) object;
|
||||
String status = ByteUtil.toHex(model.getStatus());
|
||||
device_mac = ByteUtil.bytesToHexString(model.getSrc());
|
||||
|
||||
|
||||
dismissDialog();
|
||||
if (!TextUtils.isEmpty(device_mac)){
|
||||
showDialog("正在绑定设备...");
|
||||
connectDevice.cancel();
|
||||
connectDevice.start();
|
||||
}
|
||||
// checkoutMac(device_mac);
|
||||
}
|
||||
L.i("jjia-------check_code-"+check_code);
|
||||
L.i("jjia-------length-"+length);
|
||||
L.i("jjia-------device_mac-"+device_mac);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
int devicePosition = 0;
|
||||
//jjia-push
|
||||
// private void sendBleData(){
|
||||
//
|
||||
// String ssid = tvWifiName.getText().toString();
|
||||
// String pwd = tvWifiPwd.getText().toString();
|
||||
//
|
||||
// OrderDeviceConnectModel model = OrderModel.OrderDeviceConnectModel(ssid, pwd,true);//设置正式环境域名
|
||||
// byte[] data = ModelCodec.enCode(model, Commons.IoBuffer);
|
||||
// BleManager.getInstance().write(currentDevice, SERVICE_UUID, WRITE_UUID, data,false, new BleWriteCallback() {
|
||||
// @Override
|
||||
// public void onWriteSuccess(int current, int total, byte[] justWrite) {
|
||||
//
|
||||
// L.i("jjia-------------ssid 发送");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onWriteFailure(BleException exception) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//jjia-push
|
||||
// private void toReset(){
|
||||
// ResetDeviceModel model = OrderModel.resetDevice();//设置正式环境域名
|
||||
// byte[] data = ModelCodec.enCode(model);
|
||||
//// data = new byte[1];
|
||||
//
|
||||
//// QueryTempeSettingModel xx = OrderModel.OrderQueryTempeSettingModel(device_mac);
|
||||
//// byte[] data = ModelCodec.enCode(xx);
|
||||
// BleManager.getInstance().write(currentDevice, SERVICE_UUID, WRITE_UUID, data,false, new BleWriteCallback() {
|
||||
// @Override
|
||||
// public void onWriteSuccess(int current, int total, byte[] justWrite) {
|
||||
// L.i("jjia-------------重启 发送 成功-");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onWriteFailure(BleException exception) {
|
||||
// L.i("jjia-------------重启 发送 失败"+exception.toString());
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//jjia-xpush
|
||||
private void sendBleData(){
|
||||
|
||||
String ssid = tvWifiName.getText().toString();
|
||||
String pwd = tvWifiPwd.getText().toString();
|
||||
|
||||
OrderDeviceConnectModel model = OrderModel.OrderDeviceConnectModel(ssid, pwd,true);//设置正式环境域名
|
||||
byte[] data = ModelCodec.enCode(model, Commons.IoBuffer);
|
||||
BleManager.getInstance().write(currentDevice, SERVICE_UUID, WRITE_UUID, data,false, new BleWriteCallback() {
|
||||
@Override
|
||||
public void onWriteSuccess(int current, int total, byte[] justWrite) {
|
||||
|
||||
L.i("jjia-------------ssid 发送ok");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWriteFailure(BleException exception) {
|
||||
L.i("jjia-------------发送-失败"+exception.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
//jjia-xpush
|
||||
private void toReset(){
|
||||
ResetDeviceModel model = OrderModel.resetDevice();//设置正式环境域名
|
||||
byte[] data = ModelCodec.enCode(model,Commons.IoBuffer);
|
||||
// data = new byte[1];
|
||||
|
||||
// QueryTempeSettingModel xx = OrderModel.OrderQueryTempeSettingModel(device_mac);
|
||||
// byte[] data = ModelCodec.enCode(xx);
|
||||
BleManager.getInstance().write(currentDevice, SERVICE_UUID, WRITE_UUID, data,false, new BleWriteCallback() {
|
||||
@Override
|
||||
public void onWriteSuccess(int current, int total, byte[] justWrite) {
|
||||
L.i("jjia-------------重启 发送 成功-");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWriteFailure(BleException exception) {
|
||||
L.i("jjia-------------重启 发送 失败"+exception.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static final String SERVICE_UUID = "000000ff-0000-1000-8000-00805f9b34fb"; //蓝牙通讯服务
|
||||
public static final String READ_UUID = "0000ff01-0000-1000-8000-00805f9b34fb"; //读特征
|
||||
public static final String WRITE_UUID = "0000ff01-0000-1000-8000-00805f9b34fb"; //写特征
|
||||
|
||||
//jjia-push
|
||||
// private void connectBle(){
|
||||
// BleManager.getInstance().connect(currentDevice, new BleGattCallback() {
|
||||
// @Override
|
||||
// public void onStartConnect() {
|
||||
// showDialog("开始连接蓝牙设备");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onConnectFail(BleDevice bleDevice, BleException exception) {
|
||||
// ToastUtil.show(NewBindDeviceActivity.this,"连接蓝牙设备失败,请重试");
|
||||
// dismissDialog();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onConnectSuccess(BleDevice bleDevice, BluetoothGatt gatt, int status) {
|
||||
//// ToastUtil.show(NewBindDeviceActivity.this,"蓝牙连接成功");
|
||||
//// setMessage("蓝牙连接成功");
|
||||
// BleManager.getInstance().setMtu(bleDevice, 512, new BleMtuChangedCallback() {
|
||||
// @Override
|
||||
// public void onSetMTUFailure(BleException exception) {
|
||||
// L.i("jjia-------MTU--"+exception.toString());
|
||||
// dismissDialog();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMtuChanged(int mtu) {
|
||||
// L.i("jjia-------MTU--"+mtu);
|
||||
// openNotify();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onDisConnected(boolean isActiveDisConnected, BleDevice device, BluetoothGatt gatt, int status) {
|
||||
//// ToastUtil.show(NewBindDeviceActivity.this,"连接断开了");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// 全局gatt
|
||||
private BluetoothGatt mGatt;
|
||||
//jjia-xpush
|
||||
private void connectBle(){
|
||||
BleManager.getInstance().connect(currentDevice, new BleGattCallback() {
|
||||
@RequiresPermission(Manifest.permission.BLUETOOTH_CONNECT)
|
||||
@Override
|
||||
public void onStartConnect() {
|
||||
|
||||
if (mGatt!=null){
|
||||
mGatt.disconnect();
|
||||
mGatt.close();
|
||||
mGatt = null;
|
||||
}
|
||||
showDialog("开始连接蓝牙设备");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectFail(BleDevice bleDevice, BleException exception) {
|
||||
ToastUtil.show(NewBindDeviceActivity.this,"连接蓝牙设备失败,请重试");
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess(BleDevice bleDevice, BluetoothGatt gatt, int status) {
|
||||
// ToastUtil.show(NewBindDeviceActivity.this,"蓝牙连接成功");
|
||||
// setMessage("蓝牙连接成功");
|
||||
|
||||
mGatt = gatt;
|
||||
BleManager.getInstance().setMtu(bleDevice, 512, new BleMtuChangedCallback() {
|
||||
@Override
|
||||
public void onSetMTUFailure(BleException exception) {
|
||||
L.i("jjia-------MTU--"+exception.toString());
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMtuChanged(int mtu) {
|
||||
L.i("jjia-------MTU--"+mtu);
|
||||
openNotify();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisConnected(boolean isActiveDisConnected, BleDevice device, BluetoothGatt gatt, int status) {
|
||||
// ToastUtil.show(NewBindDeviceActivity.this,"连接断开了");
|
||||
}
|
||||
});
|
||||
}
|
||||
private Activity act;
|
||||
private ConnectDevice connectDevice;
|
||||
private boolean isContinue = true;
|
||||
|
|
@ -791,8 +903,8 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public int compareTo(Boolean available) {
|
||||
if (available) {
|
||||
//jjia-push
|
||||
// toReset();
|
||||
//jjia-xpush
|
||||
toReset();
|
||||
isContinue = false;
|
||||
connectDevice.cancel();
|
||||
L.i("jjia-----------调用绑定接口---");
|
||||
|
|
@ -996,7 +1108,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){
|
||||
|
|
@ -1036,7 +1148,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
|
||||
private void toIntent(Device device){
|
||||
dismissDialog();
|
||||
ToastUtil.show(NewBindDeviceActivity.this, "绑定设备成功");
|
||||
// ToastUtil.show(NewBindDeviceActivity.this, "绑定设备成功");
|
||||
AppRoute.newToStart(NewBindDeviceActivity.this,device,true);
|
||||
EventBus.getDefault().post(new ConnectMessageEvent(1, "test"));
|
||||
finish();
|
||||
|
|
@ -1088,7 +1200,7 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
Commons.HAVE_DEVICE = true;//改变判断是否绑定的变量
|
||||
Commons.IS_CAMERA = false;
|
||||
sp.putBoolean(Commons.LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||
ToastUtil.show(NewBindDeviceActivity.this, "绑定设备成功");
|
||||
// ToastUtil.show(NewBindDeviceActivity.this, "绑定设备成功");
|
||||
AppRoute.newToStart(NewBindDeviceActivity.this,deviceObj,true);
|
||||
finish();
|
||||
L.i("===================绑定设备成功=" + device_mac);
|
||||
|
|
@ -1145,23 +1257,23 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
// myProgressDialogCancelble = null;
|
||||
// }
|
||||
// }
|
||||
//jjia-push
|
||||
// List<BleDevice> deviceList;
|
||||
//jjia-xpush
|
||||
List<BleDevice> deviceList;
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
private void findConencted(){
|
||||
//jjia-push
|
||||
// deviceList = BleManager.getInstance().getAllConnectedDevice();
|
||||
// if (deviceList!=null && deviceList.size()>0){
|
||||
// for (BleDevice item:deviceList){
|
||||
// if (item!=null){
|
||||
// L.i("jjia-----------"+item.getDevice().getName());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }else {
|
||||
// L.i("jjia--------没有连接的蓝牙---");
|
||||
// }
|
||||
//jjia-xpush
|
||||
deviceList = BleManager.getInstance().getAllConnectedDevice();
|
||||
if (deviceList!=null && deviceList.size()>0){
|
||||
for (BleDevice item:deviceList){
|
||||
if (item!=null){
|
||||
L.i("jjia-----------"+item.getDevice().getName());
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
L.i("jjia--------没有连接的蓝牙---");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1171,6 +1283,10 @@ public class NewBindDeviceActivity extends AppCompatActivity {
|
|||
L.i(requestCode+"jjia--------result-1--"+requestCode);
|
||||
if (101== requestCode && 0==resultCode){
|
||||
checkNet();
|
||||
}else if(250==requestCode){
|
||||
if (permissionHelper.checkSelfPermission(permission)) {
|
||||
blueClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void showDialog(String msg){
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public class EventBean {
|
|||
public String name;
|
||||
public String value;
|
||||
public int index = 0;
|
||||
// jiablue
|
||||
// jiaxblue
|
||||
// public static String BLUETOOTH_START_SCAN = "start_scan";
|
||||
public static String BACK_STAGE = "back_stage";
|
||||
public static String TAB_INDEX = "tab_index";
|
||||
|
|
|
|||
|
|
@ -19,17 +19,16 @@ import android.widget.TextView;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
//import com.clj.fastble.BleManager;
|
||||
//import com.clj.fastble.scan.BleScanRuleConfig;
|
||||
import com.clj.fastble.BleManager;
|
||||
import com.clj.fastble.scan.BleScanRuleConfig;
|
||||
import com.ifish.activity.BuildConfig;
|
||||
import com.ifish.basebean.EventBean;
|
||||
import com.ifish.utils.ActivityManager;
|
||||
import com.ifish.utils.ImageDownLoader;
|
||||
import com.ifish.utils.L;
|
||||
import com.ifish.utils.SystemUtil;
|
||||
import com.ifish.utils.ToastUtil;
|
||||
import com.ifish.utils.TrustAllCerts;
|
||||
//import com.igexin.sdk.PushManager;
|
||||
import com.igexin.sdk.PushManager;
|
||||
import com.p2p.core.P2PSpecial.P2PSpecial;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
|
|
@ -80,21 +79,19 @@ public class BaseApplication extends MultiDexApplication {
|
|||
P2PSpecial.getInstance().init(app, APPID, APPToken, APPVersion);
|
||||
initLog();
|
||||
initPicasso();
|
||||
//jjia-push
|
||||
// BleManager.getInstance().init(this);
|
||||
//jjia-xpush
|
||||
BleManager.getInstance().init(this);
|
||||
|
||||
UUID[] uuids = {UUID.fromString(SERVICE_UUID)};
|
||||
//jjia-push
|
||||
// BleScanRuleConfig scanRuleConfig = new BleScanRuleConfig.Builder()
|
||||
// .setServiceUuids(uuids) // 只扫描指定的服务的设备,可选
|
||||
//// .setDeviceName(true, names) // 只扫描指定广播名的设备,可选
|
||||
//// .setDeviceMac(mac) // 只扫描指定mac的设备,可选
|
||||
//// .setAutoConnect(isAutoConnect) // 连接时的autoConnect参数,可选,默认false
|
||||
// .setScanTimeOut(30000) // 扫描超时时间30S,可选,默认10秒;小于等于0表示不限制扫描时间
|
||||
// .build();
|
||||
// BleManager.getInstance().initScanRule(scanRuleConfig);
|
||||
|
||||
|
||||
//jjia-xpush
|
||||
BleScanRuleConfig scanRuleConfig = new BleScanRuleConfig.Builder()
|
||||
.setServiceUuids(uuids) // 只扫描指定的服务的设备,可选
|
||||
// .setDeviceName(true, names) // 只扫描指定广播名的设备,可选
|
||||
// .setDeviceMac(mac) // 只扫描指定mac的设备,可选
|
||||
// .setAutoConnect(isAutoConnect) // 连接时的autoConnect参数,可选,默认false
|
||||
.setScanTimeOut(30000) // 扫描超时时间30S,可选,默认10秒;小于等于0表示不限制扫描时间
|
||||
.build();
|
||||
BleManager.getInstance().initScanRule(scanRuleConfig);
|
||||
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||
@Override
|
||||
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle bundle) {
|
||||
|
|
@ -151,8 +148,6 @@ public class BaseApplication extends MultiDexApplication {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -163,7 +158,6 @@ public class BaseApplication extends MultiDexApplication {
|
|||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle bundle) {
|
||||
Log.i("ifish7", "LHD" + "---" + activity.getLocalClassName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ package com.ifish.fragment;
|
|||
|
||||
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
|
@ -35,6 +36,7 @@ import android.provider.Settings;
|
|||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
|
@ -54,11 +56,11 @@ import androidx.core.app.ActivityCompat;
|
|||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
//jjia-push
|
||||
//import com.clj.fastble.BleManager;
|
||||
//import com.clj.fastble.callback.BleScanCallback;
|
||||
//import com.clj.fastble.data.BleDevice;
|
||||
//import com.clj.fastble.data.BleScanState;
|
||||
//jjia-xpush
|
||||
import com.clj.fastble.BleManager;
|
||||
import com.clj.fastble.callback.BleScanCallback;
|
||||
import com.clj.fastble.data.BleDevice;
|
||||
import com.clj.fastble.data.BleScanState;
|
||||
import com.ifish.activity.BindTwoDeviceActivity;
|
||||
import com.ifish.activity.BuildConfig;
|
||||
import com.ifish.activity.DeviceInstructionActivity;
|
||||
|
|
@ -196,7 +198,10 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
public static Activity cam_ctx;
|
||||
private PermissionHelper permissionHelper;
|
||||
|
||||
String[] permission;
|
||||
private String permissionHintFirst = "";
|
||||
private String permissionHint = "";
|
||||
// String[] permission;
|
||||
String[] permission_blue;
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
|
@ -218,13 +223,23 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
adInfos();
|
||||
initInformation();
|
||||
|
||||
permission = new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION};
|
||||
permissionHelper = new PermissionHelper(DeviceFragment.this, permission, 250);
|
||||
// initBooth();
|
||||
// permission = new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION};
|
||||
permission_blue = AppUtil.getBluePermissionList();
|
||||
permissionHelper = new PermissionHelper(DeviceFragment.this, permission_blue, 250);
|
||||
|
||||
initBooth();
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU){
|
||||
boolean notificationsEnabled = PushManager.getInstance().areNotificationsEnabled(requireActivity());
|
||||
if (!notificationsEnabled){
|
||||
toOpenNotifications();
|
||||
}
|
||||
permissionHintFirst = "";
|
||||
permissionHint = "";
|
||||
}else {
|
||||
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
@ -269,19 +284,17 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
dialog.show();
|
||||
}
|
||||
|
||||
private void getPermission() {
|
||||
private void getPermission(boolean jump) {
|
||||
permissionHelper.request(new PermissionHelper.PermissionCallback() {
|
||||
@Override
|
||||
public void onPermissionGranted() {
|
||||
|
||||
|
||||
|
||||
|
||||
if (jump){
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(getActivity(), BindTwoDeviceActivity.class);
|
||||
startActivity(intent);
|
||||
AnimationUtil.startAnimation(getActivity());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -315,7 +328,7 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
public void onClick(
|
||||
DialogInterface dialog,
|
||||
int which) {
|
||||
getPermission();
|
||||
getPermission(jump);
|
||||
}
|
||||
});
|
||||
dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
|
|
@ -331,7 +344,7 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());
|
||||
dialog.setCancelable(false);
|
||||
dialog.setTitle("温馨提示");
|
||||
dialog.setMessage("请到应用信息页面-权限管理-打开位置权限,不然是发现不了附近的wifi的,将无法进行配网连接您的智能设备");
|
||||
dialog.setMessage("请到应用信息页面-权限管理-打开位置权限,不然是发现不了附近的wifi或智能插座,将无法进行配网连接您的智能设备");
|
||||
dialog.setPositiveButton("去开启", (dialog1, which) -> {
|
||||
AppUtil.toAuthority(requireActivity());
|
||||
});
|
||||
|
|
@ -669,20 +682,15 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
}
|
||||
};
|
||||
|
||||
private int getVersionValue(String value){
|
||||
String valueStr = value.replace("V","").replace("v","").replace(".","");
|
||||
return Integer.parseInt(TextUtils.isEmpty(valueStr)?"0":valueStr);
|
||||
}
|
||||
|
||||
private void checkVersion() {
|
||||
versionCode = versionCode.toUpperCase();
|
||||
spversionCode = sp.getString("versionCode","");
|
||||
|
||||
int versionCodeValue = getVersionValue(versionCode);
|
||||
// int spversionCodeValue = getVersionValue(spversionCode);
|
||||
int appCodeValue = getVersionValue(HttpManager.getVersionName(requireActivity()));
|
||||
int versionCodeValue = AppUtil.getVersionValue(versionCode);
|
||||
int appCodeValue = AppUtil.getVersionValue(HttpManager.getVersionName(requireActivity()));
|
||||
L.i("jjia-------1-"+versionCodeValue);
|
||||
L.i("jjia-------3-"+appCodeValue);
|
||||
// if (!HttpManager.getVersionName(requireActivity()).equals(versionCode) && !spversionCode.equals(versionCode)) {
|
||||
if (versionCodeValue > appCodeValue && !spversionCode.equals(versionCode)) {
|
||||
if (!MustUpdate.equals(isMustUpdate)) {
|
||||
sp.putString("versionCode",versionCode);
|
||||
|
|
@ -1135,8 +1143,6 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
//// deviceAdapter.notifyDataSetChanged();
|
||||
//// cameraAdapter.notifyDataSetChanged();
|
||||
showDevice = PetDeviceGetDistinguish.getShowDevice(getContext());
|
||||
showCamera = PetDeviceGetDistinguish.getFishCameras(Commons.CAMERA);
|
||||
deviceAdapter = new DeviceFragmentAdapter(getActivity(), showDevice);
|
||||
|
|
@ -1145,10 +1151,70 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
lv_camera.setAdapter(cameraAdapter);
|
||||
setUserInfo();
|
||||
|
||||
// jiablue
|
||||
// startDownTimer();
|
||||
// jiaxblue
|
||||
startDownTimer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Activity activityName = ActivityManager.getInstance().lastActivity();
|
||||
if (activityName!=null && activityName.toString().contains("MainTabActivity")){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
oonPause();
|
||||
L.i("jjia-x-----xxx-----2");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
Activity activityName = ActivityManager.getInstance().lastActivity();
|
||||
if (activityName!=null && activityName.toString().contains("MainTabActivity")){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// jiaxblue
|
||||
public void onEventMainThread(EventBean eventBean){
|
||||
if (eventBean!= null){
|
||||
// if (EventBean.BLUETOOTH_START_SCAN.equals(eventBean.name)){
|
||||
// L.i("jjia-x-----start-----");
|
||||
// if (!isShowEd){
|
||||
// initBooth();
|
||||
// }
|
||||
// }else if (EventBean.BLUETOOTH_STOP_SCAN.equals(eventBean.name)){
|
||||
// L.i("jjia-x-----stop-----");
|
||||
// if (!isShowIng){
|
||||
// currentDevice = null;
|
||||
// }
|
||||
// if (AppUtil.checkSelfPermission(getContext(),permission_blue)) {
|
||||
// BleManager.getInstance().cancelScan();
|
||||
// }
|
||||
//
|
||||
// }else
|
||||
if (EventBean.TAB_INDEX.equals(eventBean.name)){
|
||||
currentIndex = eventBean.index;
|
||||
L.i("jjia-x----tab_index--"+eventBean.index);
|
||||
if (currentIndex == 0){
|
||||
startDownTimer();
|
||||
}else {
|
||||
oonPause();
|
||||
}
|
||||
}else if (EventBean.HEADER.equals(eventBean.name)){
|
||||
Glide.with(getActivity()).load(eventBean.value).into(iv_head);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setUserInfo() {
|
||||
try {
|
||||
|
|
@ -1192,7 +1258,6 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
lv_camera.setAdapter(cameraAdapter);
|
||||
return;
|
||||
}
|
||||
// Intent intent = new Intent();
|
||||
int index = 0;
|
||||
for (int i1 = 0; i1 < Commons.DEVICE.size(); i1++) {
|
||||
if (showDevice.get(position).getDeviceId().equals(Commons.DEVICE.get(i1).getDeviceId())) {
|
||||
|
|
@ -1205,88 +1270,6 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
sp.putBoolean(LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||
Device clickItem = (Device) lv_device.getItemAtPosition(position);
|
||||
AppRoute.newToStart(requireActivity(),clickItem,false);
|
||||
// try {
|
||||
// Integer controlAmount = Commons.DEVICE.get(Commons.DevicePosition).getControlAmount();
|
||||
// Integer timerAmount = Commons.DEVICE.get(Commons.DevicePosition).getTimerAmount();
|
||||
// String type = Commons.DEVICE.get(Commons.DevicePosition).type;
|
||||
//
|
||||
//
|
||||
// L.i("jjia-------mainclick--type-"+type);
|
||||
// L.i("jjia-------mainclick--"+Commons.DEVICE.get(Commons.DevicePosition).toString());
|
||||
// if (Commons.FishKey.On.equals(Commons.DEVICE.get(Commons.DevicePosition).isBlacklist)) {//黑名单
|
||||
// i.setClass(getActivity(), BlackListActivity.class);
|
||||
// } else {
|
||||
// if (Device.TYPE_1C.equals(type)) {
|
||||
// i.setClass(getActivity(), MainThree1CControlActivity.class);
|
||||
// } else if (Device.TYPE_AA.equals(type)) {
|
||||
// i.setClass(getActivity(), MainFiveControlActivity.class);
|
||||
// } else if (Device.TYPE_BD.equals(type)) {
|
||||
// i.setClass(getActivity(), MainFiveBDControlActivity.class);
|
||||
// } else if (Device.TYPE_2A.equals(type)) {
|
||||
// i.setClass(getActivity(), MainSix_2A_ControlActivity.class);
|
||||
// } else if (Device.TYPE_2B.equals(type)) {
|
||||
// i.setClass(getActivity(), MainFour_2B_ControlActivity.class);
|
||||
// } else if (Device.TYPE_3A.equals(type)) {
|
||||
// i.setClass(getActivity(), MainHot_3A_ControlActivity.class);
|
||||
// } else if (Device.TYPE_2F.equals(type)) {
|
||||
// i.setClass(getActivity(), MainSeven_2F_ControlActivity.class);
|
||||
// } else if (Device.TYPE_3F.equals(type)) {
|
||||
// i.setClass(getActivity(), MainFour_3F_ControlActivity.class);
|
||||
// } else if (Device.TYPE_4F.equals(type) || Device.TYPE_5F.equals(type)) {
|
||||
// i.setClass(getActivity(), MainSix_4F_ControlActivity.class);
|
||||
// } else {
|
||||
// if (controlAmount == null) {//如果控制器返回空 则默认给三控的页面
|
||||
// i.setClass(getActivity(), MainThreeControlActivity.class);
|
||||
// } else {
|
||||
// i.setClass(getActivity(), MainThreeControlActivity.class);
|
||||
// switch (controlAmount) {
|
||||
// case 0: {
|
||||
// i.setClass(getActivity(), MainZeroControlActivity.class);
|
||||
// break;
|
||||
// }
|
||||
// case 2: {
|
||||
// i.setClass(getActivity(), MainTwoControlActivity.class);
|
||||
// break;
|
||||
// }
|
||||
// case 3: {
|
||||
// i.setClass(getActivity(), MainThreeControlActivity.class);
|
||||
// break;
|
||||
// }
|
||||
// case 4: {
|
||||
// if (timerAmount == 6) { // 可丽爱
|
||||
// i.setClass(getActivity(), MainFiveControlActivity.class);
|
||||
// } else {//4控
|
||||
// i.setClass(getActivity(), MainFourControlActivity.class);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case 5: {
|
||||
// if (6 == timerAmount) {//5控六定时器 询多页面
|
||||
// i.setClass(getActivity(), MainSixControlActivity.class);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case 8: {
|
||||
// i.setClass(getActivity(), MainEightControlActivity.class);
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// i.setClass(getActivity(), MainThreeControlActivity.class);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// ClipboardManager clipboardManager = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
// ClipData mClipData = ClipData.newPlainText("Label", e.getMessage() + getStackTrace(e));
|
||||
// clipboardManager.setPrimaryClip(mClipData);
|
||||
// Toast.makeText(getActivity(), "错误日志复制到剪贴板!", Toast.LENGTH_SHORT).show();
|
||||
// i.setClass(getActivity(), MainThreeControlActivity.class);
|
||||
// }
|
||||
// startActivity(i);
|
||||
// AnimationUtil.startAnimation(getActivity());
|
||||
}
|
||||
});
|
||||
lv_camera.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
|
@ -1600,11 +1583,9 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
AnimationUtil.startAnimation(getActivity());
|
||||
break;
|
||||
case R.id.rl_adddevice:
|
||||
// jiablue
|
||||
// jiaxblue
|
||||
// EventBean eventBean = new EventBean(EventBean.BLUETOOTH_STOP_SCAN);
|
||||
// EventBus.getDefault().post(eventBean);
|
||||
|
||||
|
||||
addDevice();
|
||||
|
||||
|
||||
|
|
@ -1634,7 +1615,7 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
private void addDevice(){
|
||||
if (ContextCompat.checkSelfPermission(requireActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
!= PackageManager.PERMISSION_GRANTED || BuildConfig.show) {
|
||||
showPermissionHint();
|
||||
showPermissionHint(true);
|
||||
}else {
|
||||
Intent intentx = new Intent();
|
||||
intentx.setClass(requireActivity(), BindTwoDeviceActivity.class);
|
||||
|
|
@ -1929,42 +1910,54 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
}
|
||||
firstResult = firstResult + HttpManager.PAGESIZE;
|
||||
}
|
||||
//jjia-push
|
||||
// private void initBooth(){
|
||||
// boolean enable = BleManager.getInstance().isBlueEnable();
|
||||
// if (enable) {
|
||||
// BleManager.getInstance().scan(new BleScanCallback() {
|
||||
// @Override
|
||||
// public void onScanFinished(List<BleDevice> scanResultList) {
|
||||
// if (currentDevice!=null){ // 扫描结束,有设备
|
||||
// L.i("jjjia-----------scan---");
|
||||
// showDevice();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onScanStarted(boolean success) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @SuppressLint("MissingPermission")
|
||||
// @Override
|
||||
// public void onScanning(BleDevice bleDevice) {
|
||||
// if (bleDevice!=null && bleDevice.getDevice()!=null){
|
||||
// BluetoothDevice bean = bleDevice.getDevice();
|
||||
// if (!TextUtils.isEmpty(bean.getName()) && bean.getName().startsWith("ifish")){
|
||||
// currentDevice = bleDevice;
|
||||
// BleManager.getInstance().cancelScan();
|
||||
// }
|
||||
// L.i(bean.getName()+"jjia------mac---"+bean.getAddress());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//jjia-push
|
||||
// BleDevice currentDevice;
|
||||
//jjia-xpush
|
||||
private void initBooth(){
|
||||
if (AppUtil.checkSelfPermission(getContext(),permission_blue)) {
|
||||
boolean enable = BleManager.getInstance().isBlueEnable();
|
||||
if (enable) {
|
||||
L.i("jjjia-----------蓝牙可用-开始扫描--");
|
||||
BleManager.getInstance().scan(new BleScanCallback() {
|
||||
@Override
|
||||
public void onScanFinished(List<BleDevice> scanResultList) {
|
||||
if (currentDevice!=null){ // 扫描结束,有设备
|
||||
L.i("jjjia-----------scan- end--");
|
||||
showDevice();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanStarted(boolean success) {
|
||||
L.i("jjjia-----------scan- start--");
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@Override
|
||||
public void onScanning(BleDevice bleDevice) {
|
||||
L.i("jjjia-----------scan- ing--");
|
||||
if (bleDevice!=null && bleDevice.getDevice()!=null){
|
||||
BluetoothDevice bean = bleDevice.getDevice();
|
||||
if (!TextUtils.isEmpty(bean.getName()) && bean.getName().startsWith("ifish")){
|
||||
currentDevice = bleDevice;
|
||||
BleManager.getInstance().cancelScan();
|
||||
}
|
||||
L.i(bean.getName()+"jjia------mac---"+bean.getAddress());
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
L.i("jjjia-----------蓝牙不可用---");
|
||||
}
|
||||
}else {
|
||||
boolean first = SPUtil.getInstance(requireContext()).getBoolean("xfirst",false);
|
||||
if (!first){
|
||||
showPermissionHint(false);
|
||||
SPUtil.getInstance(requireContext()).putBoolean("xfirst",true);
|
||||
}
|
||||
L.i("jjjia-----------没有扫描权限---");
|
||||
}
|
||||
}
|
||||
//jjia-xpush
|
||||
BleDevice currentDevice;
|
||||
public void onEventMainThread(BluetoothDevice event) {
|
||||
|
||||
}
|
||||
|
|
@ -1973,44 +1966,18 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
private boolean isShowEd = false;
|
||||
|
||||
private int currentIndex = 0;
|
||||
// jiablue
|
||||
// public void onEventMainThread(EventBean eventBean){
|
||||
// if (eventBean!= null){
|
||||
// if (EventBean.BLUETOOTH_START_SCAN.equals(eventBean.name)){
|
||||
// if (!isShowEd){
|
||||
// initBooth();
|
||||
// }
|
||||
// }else if (EventBean.BLUETOOTH_STOP_SCAN.equals(eventBean.name)){
|
||||
// if (!isShowIng){
|
||||
// currentDevice = null;
|
||||
// }
|
||||
// BleManager.getInstance().cancelScan();
|
||||
// }else
|
||||
//
|
||||
// if (EventBean.TAB_INDEX.equals(eventBean.name)){
|
||||
// currentIndex = eventBean.index;
|
||||
// L.i("jjia-----tab_index--"+eventBean.index);
|
||||
// if (currentIndex == 0){
|
||||
// startDownTimer();
|
||||
// }else {
|
||||
// oonPause();
|
||||
// }
|
||||
// }else if (EventBean.HEADER.equals(eventBean.name)){
|
||||
// Glide.with(getActivity()).load(eventBean.value).into(iv_head);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private void showPermissionHint(){
|
||||
|
||||
IosAlertDialog openDialog = new IosAlertDialog(getContext()).builder();
|
||||
private void showPermissionHint(boolean jump){
|
||||
|
||||
IosAlertDialog openDialog = new IosAlertDialog(requireContext()).builder();
|
||||
openDialog.setCancelable(true);
|
||||
openDialog.setTitle("申请权限目的说明");
|
||||
openDialog.setMessage("添加设备,需要先获取位置信息,才能获取附近wifi信息,进行配网连接您的设备,是否允许申请位置权限?");
|
||||
openDialog.setPositiveButton("继续", new View.OnClickListener() {
|
||||
openDialog.setTitle("重要提示");
|
||||
openDialog.setMessage(!jump?"APP首次绑定设备需要访问位置权限和蓝牙使用权限,在稍后弹出的权限使用对话框中请点击确定,并打开手机蓝牙。":"添加设备,需要先获取位置信息,才能获取附近wifi信息或智能设备,进行配网连接您的设备,是否允许申请位置权限和蓝牙权限?");
|
||||
openDialog.setPositiveButton("确定", new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getPermission();
|
||||
getPermission(jump);
|
||||
}
|
||||
});
|
||||
openDialog.setNegativeButton("取消", new View.OnClickListener() {
|
||||
|
|
@ -2019,69 +1986,78 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
openDialog.show();
|
||||
}
|
||||
IosAlertDialog alertDialog;
|
||||
public void showDevice(){
|
||||
// 检测页面
|
||||
if (!isShowIng){
|
||||
isShowIng = true;
|
||||
isShowEd = true;
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(requireContext(), AlertDialog.THEME_HOLO_LIGHT);
|
||||
dialog.setCancelable(true);
|
||||
dialog.setTitle("提示");
|
||||
dialog.setMessage("发现一个新设备是否去添加");
|
||||
dialog.setOnDismissListener(dialogInterface -> isShowIng = false);
|
||||
dialog.setNegativeButton("取消", (arg0, arg1) -> {
|
||||
arg0.dismiss();
|
||||
|
||||
alertDialog = new IosAlertDialog(requireContext(), Gravity.BOTTOM).builder();
|
||||
alertDialog.showBottom(true);
|
||||
alertDialog.setTextColor(R.color.danghao_color);
|
||||
alertDialog.setCancelable(false);
|
||||
alertDialog.setTitle("发现设备");
|
||||
alertDialog.setMessage("鱼缸智能插座1个");
|
||||
alertDialog.setNegativeButton("忽略", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
isShowIng = false;
|
||||
alertDialog.dismiss();
|
||||
isShowIng = false;
|
||||
startDownTimer();
|
||||
|
||||
}
|
||||
});
|
||||
dialog.setPositiveButton("确定", (dialog1, which) -> {
|
||||
dialog1.dismiss();
|
||||
alertDialog.setPositiveButton("添加", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
alertDialog.dismiss();
|
||||
isShowIng = false;
|
||||
closeDownTimer();
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(requireActivity(), NewBindDeviceActivity.class);
|
||||
intent.putExtra("title", "连接水族箱");
|
||||
intent.putExtra("type", "bluetooth");
|
||||
//jjia-push
|
||||
// intent.putExtra("device", currentDevice);
|
||||
//jjia-xpush
|
||||
intent.putExtra("device", currentDevice);
|
||||
startActivity(intent);
|
||||
AnimationUtil.finishAnimation(requireActivity());
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
alertDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int dowmCount = 1;
|
||||
CountDownTimer countDownTimer;
|
||||
private void startDownTimer(){
|
||||
closeDownTimer();
|
||||
if (AppUtil.checkSelfPermission(getContext(),permission_blue)) {
|
||||
if (!isShowIng && currentIndex == 0){
|
||||
dowmCount = 1;
|
||||
countDownTimer = new CountDownTimer(2000000000,1000) {
|
||||
@Override
|
||||
public void onTick(long l) {
|
||||
L.i("jjia-----dowmCount--"+dowmCount);
|
||||
//jjia-push
|
||||
// if (dowmCount%6==0){
|
||||
// BleScanState scanState = getScanState();
|
||||
// L.i("jjia-----------timer--"+scanState);
|
||||
// if (BleScanState.STATE_IDLE.equals(scanState)){
|
||||
// if (isShowIng){
|
||||
// L.i("jjia-----已经扫描到设备了,等待反馈-");
|
||||
// closeDownTimer();
|
||||
// }else {
|
||||
// initBooth();
|
||||
// L.i("jjia-----开始扫描-");
|
||||
// }
|
||||
// }else {
|
||||
// L.i("jjia----timer--上一次的扫描还在继续中-");
|
||||
// }
|
||||
// }
|
||||
//jjia-xpush
|
||||
if (dowmCount%6==0){
|
||||
BleScanState scanState = getScanState();
|
||||
L.i("jjia-----------timer--"+scanState);
|
||||
if (BleScanState.STATE_IDLE.equals(scanState)){
|
||||
if (isShowIng){
|
||||
L.i("jjia-----已经扫描到设备了,等待反馈-");
|
||||
closeDownTimer();
|
||||
}else {
|
||||
initBooth();
|
||||
L.i("jjia-----开始扫描-");
|
||||
}
|
||||
}else {
|
||||
L.i("jjia----timer--上一次的扫描还在继续中-");
|
||||
}
|
||||
}
|
||||
|
||||
dowmCount++;
|
||||
}
|
||||
|
|
@ -2095,36 +2071,41 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
}else {
|
||||
L.i("jjia----timer--已扫描到设备,暂不执行倒计时-");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void closeDownTimer(){
|
||||
if (countDownTimer!=null){
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
L.i("jjia-----dowmCount--xxx");
|
||||
}
|
||||
}
|
||||
//jjia-push
|
||||
// private BleScanState getScanState(){
|
||||
// return BleManager.getInstance().getScanSate();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
oonPause();
|
||||
//jjia-xpush
|
||||
private BleScanState getScanState(){
|
||||
return BleManager.getInstance().getScanSate();
|
||||
}
|
||||
|
||||
private void oonPause(){
|
||||
|
||||
if (alertDialog!=null){
|
||||
L.i("jjia---扫描暂停----------");
|
||||
alertDialog.dismiss();
|
||||
alertDialog = null;
|
||||
}
|
||||
closeDownTimer();
|
||||
//jjia-push
|
||||
// BleScanState scanState = getScanState();
|
||||
// if (BleScanState.STATE_SCANNING.equals(scanState)) {
|
||||
// BleManager.getInstance().cancelScan();
|
||||
// L.i("jjia---扫描暂停----------");
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
// L.i("jjia---扫描暂停-"+scanState);
|
||||
if (AppUtil.checkSelfPermission(getContext(),permission_blue)) {
|
||||
//jjia-xpush
|
||||
BleScanState scanState = getScanState();
|
||||
if (BleScanState.STATE_SCANNING.equals(scanState)) {
|
||||
currentDevice = null;
|
||||
BleManager.getInstance().cancelScan();
|
||||
L.i("jjia---扫描暂停----------");
|
||||
}
|
||||
L.i("jjia---扫描暂停-"+scanState);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
//jjia-push
|
||||
//import com.clj.fastble.BleManager;
|
||||
//jjia-xpush
|
||||
import com.clj.fastble.BleManager;
|
||||
import com.ifish.activity.AboutActivity;
|
||||
import com.ifish.activity.BindTwoDeviceActivity;
|
||||
import com.ifish.activity.CaptureActivity;
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ public class TcpReceiveThread implements Runnable {
|
|||
}
|
||||
} else if(obj instanceof BackInfoModelSix_4F_FeedFish){ //一键喂鱼查询
|
||||
BackInfoModelSix_4F_FeedFish model = (BackInfoModelSix_4F_FeedFish) obj;
|
||||
L.i("jjia---------------------BackInfoModelSix_4F_FeedFish-----");
|
||||
if (Commons.IS_EventBus) {//判断tcp连接返回的mac地址是否与自己本地相同 不同则不做处理
|
||||
try {
|
||||
if (ByteUtil.bytesToHexString(model.getSrc()).equals(Commons.DEVICE.get(MainTabActivity.sp.getInt(LoginSPKey.Position, 0)).getMacAddress())) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.bluetooth.BluetoothManager;
|
|||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
|
|
@ -13,7 +14,9 @@ import android.util.Log;
|
|||
import android.widget.ImageView;
|
||||
|
||||
import androidx.activity.ComponentActivity;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.ifish.activity.R;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
|
@ -258,7 +261,14 @@ public class AppUtil {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean checkSelfPermission(Context context ,String[] permissions) {
|
||||
for (String permission : permissions) {
|
||||
if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String [] getImagePermissionList(){
|
||||
List<String> perList = new ArrayList<>();
|
||||
|
|
@ -282,6 +292,31 @@ public class AppUtil {
|
|||
return permissions;
|
||||
}
|
||||
|
||||
|
||||
public static String [] getBluePermissionList(){
|
||||
List<String> perList = new ArrayList<>();
|
||||
perList.add(android.Manifest.permission.BLUETOOTH);
|
||||
perList.add(android.Manifest.permission.ACCESS_FINE_LOCATION);
|
||||
perList.add(android.Manifest.permission.ACCESS_COARSE_LOCATION);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
|
||||
perList.add(android.Manifest.permission.BLUETOOTH_SCAN);
|
||||
perList.add(android.Manifest.permission.BLUETOOTH_ADVERTISE);
|
||||
perList.add(android.Manifest.permission.BLUETOOTH_CONNECT);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
||||
perList.add(android.Manifest.permission.POST_NOTIFICATIONS);
|
||||
}
|
||||
int size = perList.size();
|
||||
String [] permissions = new String[size];
|
||||
|
||||
for (int i = 0;i<size;i++){
|
||||
permissions[i] = perList.get(i);
|
||||
}
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public static void setHeader(Activity activity,ImageView header,String weixin){
|
||||
String userImg = Commons.USER.getUserImg();
|
||||
if (!TextUtils.isEmpty(userImg)){
|
||||
|
|
@ -294,4 +329,9 @@ public class AppUtil {
|
|||
|
||||
}
|
||||
|
||||
public static int getVersionValue(String value){
|
||||
String valueStr = value.replace("V","").replace("v","").replace(".","");
|
||||
return Integer.parseInt(TextUtils.isEmpty(valueStr)?"0":valueStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
package com.ifish.utils
|
||||
|
||||
import android.app.Activity
|
||||
import com.ifish.baseclass.BaseActivity
|
||||
|
||||
/**
|
||||
* Created by achang on 2018/10/6.
|
||||
*/
|
||||
|
||||
class DialogUtil1 {
|
||||
class DialogUtil{
|
||||
companion object {
|
||||
var mLoadingDialog: LoadingDialog? = null
|
||||
var showDialog:Boolean=false
|
||||
|
|
@ -30,16 +29,23 @@ class DialogUtil1 {
|
|||
return mLoadingDialog!!
|
||||
}
|
||||
|
||||
fun setProgress(value: Int){
|
||||
mLoadingDialog?.setProgress(value)
|
||||
}
|
||||
|
||||
fun setError(){
|
||||
mLoadingDialog?.setError()
|
||||
}
|
||||
fun setLoadingDialogDismiss(activity: Activity?) {
|
||||
mLoadingDialog?.apply {
|
||||
if (this.isShowing ) {
|
||||
activity?.apply {
|
||||
if (!this.isFinishing)
|
||||
mLoadingDialog!!.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
mLoadingDialog = null
|
||||
}
|
||||
}
|
||||
}
|
||||
// LogUtil.logD("setLoadingDialogDismiss===========")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ public class HttpManager {
|
|||
public static final String APConnectVideoTitle = "AP联网";
|
||||
public static String APConnectVideoUrl = "https://www.ifish7.com/download/s2.mp4"; //安卓版本的 AP联网视频
|
||||
|
||||
public static final String BlueConnectVideoTitle = "蓝牙联网";
|
||||
public static String BlueConnectVideoUrl = "https://www.ifish7.com/download/bluetooth_device.mp4"; //安卓版本的蓝牙联网视频
|
||||
|
||||
private String user_URL = "user/";
|
||||
private String users_URL = "users/";
|
||||
public static String Room_URL = "room/";
|
||||
|
|
|
|||
|
|
@ -2,36 +2,62 @@ package com.ifish.utils
|
|||
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import android.text.TextUtils
|
||||
import android.graphics.drawable.AnimationDrawable
|
||||
import android.os.Build
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.cardview.widget.CardView
|
||||
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) {
|
||||
|
||||
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 {
|
||||
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)
|
||||
|
||||
setCancelable(false)
|
||||
setContentView(inflate)
|
||||
var icon =findViewById<ImageView>(R.id.iconx)
|
||||
image = icon.drawable as AnimationDrawable
|
||||
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
|
||||
if (TextUtils.isEmpty(hint)){
|
||||
|
||||
}
|
||||
|
||||
window!!.setDimAmount(0f) //去除阴影遮罩效果
|
||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
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.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.ifish.activity.R;
|
||||
|
||||
/**
|
||||
|
|
@ -30,6 +33,7 @@ public class IosAlertDialog {
|
|||
private Button btn_neg;
|
||||
private Button btn_pos;
|
||||
private ImageView img_line;
|
||||
private View bottom;
|
||||
private Display display;
|
||||
private boolean showTitle = false;
|
||||
private boolean showMsg = false;
|
||||
|
|
@ -37,7 +41,7 @@ public class IosAlertDialog {
|
|||
private boolean showNegBtn = false;
|
||||
private boolean isMiddleShowEclipse = false; //setMsg时 文本内容超过最多5行后,省略号是否居中显示,默认不居中
|
||||
private int maxLines = 5;
|
||||
|
||||
int gravity = Gravity.CENTER;
|
||||
public IosAlertDialog(Context context) {
|
||||
this.context = context;
|
||||
WindowManager windowManager = (WindowManager) context
|
||||
|
|
@ -45,6 +49,27 @@ public class IosAlertDialog {
|
|||
display = windowManager.getDefaultDisplay();
|
||||
}
|
||||
|
||||
public void showBottom(boolean show) {
|
||||
if (bottom!=null){
|
||||
if (show){
|
||||
bottom.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
bottom.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
// 获取Dialog布局
|
||||
View view = LayoutInflater.from(context).inflate(
|
||||
|
|
@ -52,6 +77,7 @@ public class IosAlertDialog {
|
|||
// 获取自定义Dialog布局中的控件
|
||||
lLayout_bg = view.findViewById(R.id.lLayout_bg);
|
||||
txt_title = view.findViewById(R.id.txt_title);
|
||||
bottom = view.findViewById(R.id.bottom);
|
||||
txt_title.setVisibility(View.GONE);
|
||||
txt_msg = view.findViewById(R.id.txt_msg);
|
||||
txt_msg.setVisibility(View.GONE);
|
||||
|
|
@ -64,14 +90,18 @@ public class IosAlertDialog {
|
|||
|
||||
// 定义Dialog布局和参数
|
||||
dialog = new Dialog(context, R.style.AlertDialogStyle);
|
||||
dialog.getWindow().setGravity(Gravity.CENTER);
|
||||
dialog.getWindow().setGravity(gravity);
|
||||
dialog.setContentView(view);
|
||||
// 调整dialog背景大小
|
||||
lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
|
||||
.getWidth() * 0.7), LinearLayout.LayoutParams.MATCH_PARENT));
|
||||
.getWidth() * 0.9), LinearLayout.LayoutParams.MATCH_PARENT));
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setTextColor(int color){
|
||||
txt_msg.setTextColor(ContextCompat.getColor(context,color));
|
||||
}
|
||||
|
||||
public IosAlertDialog setTitle(String title) {
|
||||
showTitle = true;
|
||||
if ("".equals(title)) {
|
||||
|
|
@ -83,6 +113,10 @@ public class IosAlertDialog {
|
|||
}
|
||||
|
||||
|
||||
public void setTextStart(){
|
||||
txt_msg.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
|
||||
}
|
||||
|
||||
public IosAlertDialog setMessage(String msg) {
|
||||
showMsg = true;
|
||||
if(!isMiddleShowEclipse){
|
||||
|
|
|
|||
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 |
Binary file not shown.
|
After Width: | Height: | Size: 1.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,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/dialog_loading"
|
||||
android:drawable="@drawable/loading_icon"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%" />
|
||||
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="12dp"/>
|
||||
<solid android:color="#AA000000" />
|
||||
<solid android:color="#88000000" />
|
||||
</shape>
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="联网视频"
|
||||
android:text="联网视频教程"
|
||||
android:textColor="#E60012"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
|
@ -184,6 +184,16 @@
|
|||
android:text="3、如多次尝试一键联网都不成功,可切换其他联网方式,每次重新联接时插座需断一次电然后重新复位联接。"
|
||||
android:textColor="#999999" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:lineSpacingExtra="5dp"
|
||||
android:textColor="@color/black"
|
||||
android:text="提示:由于新版APP升级,产品包装盒内的说明书可能与新版APP联网方式不同,请以APP界面提示内容为准,也可查看右上角视频教程。" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_other_connect"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -1,38 +1,84 @@
|
|||
<?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"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="#1A000000"
|
||||
android:layout_gravity="center">
|
||||
|
||||
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginHorizontal="40dp"
|
||||
android:layout_centerInParent="true"
|
||||
app:cardCornerRadius="20dp"
|
||||
android:elevation="0dp"
|
||||
app:cardElevation="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<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:layout_centerInParent="true"
|
||||
android:background="@color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="150dp">
|
||||
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="38dp"
|
||||
android:layout_height="38dp"
|
||||
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"
|
||||
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_marginBottom="60dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="正在加载中..."
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="设备正在联网中,请耐心等待"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<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>
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
android:id="@+id/lLayout_bg"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/ios_dialog_bg"
|
||||
|
|
@ -24,15 +29,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:background="#c6c6c6" />
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -43,24 +48,24 @@
|
|||
<Button
|
||||
android:id="@+id/btn_neg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="43dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:textAllCaps="false"
|
||||
android:background="@drawable/ios_dialog_left_bg"
|
||||
android:gravity="center"
|
||||
android:textColor="#037BFF"
|
||||
android:textColor="#999999"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_line"
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="43dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="#c6c6c6" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_pos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="43dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:textAllCaps="false"
|
||||
android:background="@drawable/ios_dialog_right_bg"
|
||||
|
|
@ -70,4 +75,10 @@
|
|||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/bottom"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"/>
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="250dp"
|
||||
android:background="@color/white"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/one"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="设备正在联网中,请耐心等待....."
|
||||
android:layout_height="wrap_content"/>
|
||||
<ProgressBar
|
||||
android:layout_above="@id/one"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_height="wrap_content"/>
|
||||
</RelativeLayout>
|
||||
|
|
@ -302,5 +302,13 @@
|
|||
android:gravity="center"
|
||||
android:background="@drawable/minefragment_bg_select"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cid"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_margin="20dp"
|
||||
android:textIsSelectable="true"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -167,7 +167,6 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/bt_submit"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:layout_marginLeft="@dimen/new_login_bg_width"
|
||||
android:layout_marginRight="@dimen/new_login_bg_width"
|
||||
android:layout_marginTop="12dp">
|
||||
|
|
@ -203,6 +202,16 @@
|
|||
android:textSize="13dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginHorizontal="28dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:lineSpacingMultiplier="1.1"
|
||||
android:textColor="@color/red"
|
||||
android:text="注:如不能接收到短信验证码,可以使用默认密码登录,登录名为未注册过的手机号码,密码为ifish+手机号后4位"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
|||
|
|
@ -301,4 +301,26 @@
|
|||
<!--<item name="android:windowSoftInputMode">stateHidden</item>-->
|
||||
<!-- Dialog 全屏显示 -->
|
||||
</style>
|
||||
|
||||
|
||||
<!--全屏dialog-->
|
||||
<style name="fullDialog" parent="@android:style/Theme.Holo.Dialog">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<!-- 是否有边框 -->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<!--是否在悬浮Activity之上 -->
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<!--标题 -->
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!--阴影 -->
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<!--透明背景-->
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
<!--窗口背景透明-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--弹窗背景是否变暗-->
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Reference in New Issue