feat#415_loading
This commit is contained in:
parent
078a5eef4b
commit
8781a2bb14
|
|
@ -26,6 +26,6 @@ android.enableJetifier=true
|
|||
android.useAndroidX=true
|
||||
android.useDeprecatedNdk=true
|
||||
|
||||
versionCode=101
|
||||
versionName=4.12.01
|
||||
versionCode=103
|
||||
versionName=4.12.03
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ public class LoadingActivity extends BaseActivityNotAnim {
|
|||
if(!aBoolean && !showPrivacy){
|
||||
startPrivacyTextDialog();
|
||||
}else{
|
||||
getPermission();
|
||||
// ();
|
||||
initapp();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -974,10 +975,9 @@ public class LoadingActivity extends BaseActivityNotAnim {
|
|||
public void onClick(View v) {
|
||||
alertDialog.cancel();
|
||||
SPUtil.getInstance(getApplicationContext()).putBoolean(firstShowPrivacy,true);
|
||||
// getPermission();
|
||||
// pushInit();
|
||||
// initapp();
|
||||
getPermission();
|
||||
initapp();
|
||||
// getPermission();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
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 +44,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 +103,8 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
|
||||
private Device deviceBean;
|
||||
|
||||
private boolean isBind = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -117,9 +122,28 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
isBind = getIntent().getBooleanExtra(BaseGradeActivity.BINDDEVICE,false);
|
||||
|
||||
|
||||
if (isBind){
|
||||
DialogUtil.Companion.showLoadingDialog(this,true,"设备正在联网中,请耐心等待.....");
|
||||
startDownTimer();
|
||||
}
|
||||
}
|
||||
|
||||
private void showHint(){
|
||||
|
||||
IosAlertDialog openDialog = new IosAlertDialog(this).builder();
|
||||
openDialog.setCancelable(true);
|
||||
openDialog.setTitle("温馨提示");
|
||||
openDialog.setMessage("请检查输入密码是否正确");
|
||||
openDialog.setPositiveButton("确定", new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
}
|
||||
});
|
||||
openDialog.show();
|
||||
}
|
||||
public void onEventMainThread(EventBean eventBean){
|
||||
if (eventBean!=null && EventBean.CHANGE_DEVICE_NAME.equals(eventBean.name)){
|
||||
setTitle(eventBean.value);
|
||||
|
|
@ -147,6 +171,7 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
isToast = false;
|
||||
EventBus.getDefault().unregister(this);
|
||||
closeSoket();
|
||||
closeDownTimer();
|
||||
stopAllTimer();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
|
@ -579,9 +604,11 @@ 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();
|
||||
DialogUtil.Companion.setLoadingDialogDismiss(this);
|
||||
dismissProgressDialogCancelble();
|
||||
tv_offline.setVisibility(View.GONE);
|
||||
backInfoModelSix_4F = event;
|
||||
|
|
@ -748,7 +775,7 @@ public class MainSix_4F_ControlActivity extends BaseGradeActivity implements Swi
|
|||
OffLineDevice();
|
||||
}
|
||||
isWaterDialog = false;
|
||||
dismissProgressDialog();
|
||||
dismissProgressDialog();
|
||||
}
|
||||
|
||||
private void OffLineDevice() {//设备离线的处理
|
||||
|
|
@ -1318,4 +1345,32 @@ 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) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
DialogUtil.Companion.setLoadingDialogDismiss(MainSix_4F_ControlActivity.this);
|
||||
showHint();
|
||||
}
|
||||
};
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
private void closeDownTimer(){
|
||||
if (countDownTimer!=null){
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ 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;
|
||||
|
|
@ -256,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();
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
public static Activity cam_ctx;
|
||||
private PermissionHelper permissionHelper;
|
||||
|
||||
String[] permission;
|
||||
// String[] permission;
|
||||
String[] permission_blue;
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
|
@ -220,9 +220,9 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
adInfos();
|
||||
initInformation();
|
||||
|
||||
permission = new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION};
|
||||
// permission = new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION};
|
||||
permission_blue = AppUtil.getBluePermissionList();
|
||||
permissionHelper = new PermissionHelper(DeviceFragment.this, permission, 250);
|
||||
permissionHelper = new PermissionHelper(DeviceFragment.this, permission_blue, 250);
|
||||
|
||||
initBooth();
|
||||
boolean notificationsEnabled = PushManager.getInstance().areNotificationsEnabled(requireActivity());
|
||||
|
|
@ -332,7 +332,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());
|
||||
});
|
||||
|
|
@ -670,20 +670,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);
|
||||
|
|
@ -1961,7 +1956,7 @@ public class DeviceFragment extends BaseV4Fragment implements ObservableScrollVi
|
|||
IosAlertDialog openDialog = new IosAlertDialog(getContext()).builder();
|
||||
openDialog.setCancelable(true);
|
||||
openDialog.setTitle("申请权限目的说明");
|
||||
openDialog.setMessage("添加设备,需要先获取位置信息,才能获取附近wifi信息,进行配网连接您的设备,是否允许申请位置权限?");
|
||||
openDialog.setMessage("添加设备,需要先获取位置信息,才能获取附近wifi信息或智能设备,进行配网连接您的设备,是否允许申请位置权限和蓝牙权限?");
|
||||
openDialog.setPositiveButton("继续", new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
|||
|
|
@ -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())) {
|
||||
|
|
|
|||
|
|
@ -301,9 +301,7 @@ public class AppUtil {
|
|||
perList.add(android.Manifest.permission.BLUETOOTH_SCAN);
|
||||
perList.add(android.Manifest.permission.BLUETOOTH_ADVERTISE);
|
||||
perList.add(android.Manifest.permission.BLUETOOTH_CONNECT);
|
||||
}else {
|
||||
|
||||
}
|
||||
}
|
||||
int size = perList.size();
|
||||
String [] permissions = new String[size];
|
||||
|
||||
|
|
@ -325,4 +323,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ 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
|
||||
|
|
|
|||
|
|
@ -4,33 +4,29 @@ import android.app.Activity
|
|||
import android.app.Dialog
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.ifish.activity.R
|
||||
import com.ifish.utils.Commons.Text
|
||||
|
||||
/**
|
||||
* @创建者 肖天长
|
||||
* @创建时间 2018/7/6 0006 11:59
|
||||
* @描述 ${TODO}
|
||||
* @更新者 $Author$
|
||||
* @更新时间 2018/7/6 0006$
|
||||
* @更新描述 ${TODO}
|
||||
*/
|
||||
|
||||
class LoadingDialog(context: Activity,hint:String?) : Dialog(context, R.style.BaseDialogStyle) {
|
||||
|
||||
class LoadingDialog(context: Activity,hint:String?) : Dialog(context, R.style.fullDialog) {
|
||||
|
||||
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)
|
||||
// val mParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)
|
||||
|
||||
setCancelable(false)
|
||||
setContentView(inflate)
|
||||
var view =findViewById<TextView>(R.id.tv_hint)
|
||||
view.text = hint
|
||||
if (TextUtils.isEmpty(hint)){
|
||||
|
||||
}
|
||||
|
||||
window!!.setDimAmount(0f) //去除阴影遮罩效果
|
||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
// window!!.setDimAmount(0f) //去除阴影遮罩效果
|
||||
setCanceledOnTouchOutside(false)
|
||||
// setCancelable(false)
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -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>
|
||||
|
|
@ -1,17 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="150dp"
|
||||
android:layout_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:layout_width="match_parent"
|
||||
app:cardCornerRadius="@dimen/dp_15"
|
||||
android:layout_gravity="center"
|
||||
app:cardElevation="0dp"
|
||||
android:elevation="0dp"
|
||||
android:layout_marginHorizontal="60dp"
|
||||
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:background="@color/white"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:orientation="vertical"
|
||||
android:layout_height="150dp">
|
||||
|
||||
|
|
@ -31,8 +41,9 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="正在加载中..."
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</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>
|
||||
|
|
@ -301,4 +301,24 @@
|
|||
<!--<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