Commit da66d469 authored by chenyuling's avatar chenyuling

"设置设备型号为RC500"

parent 5a9a0890
Pipeline #1567 canceled with stages
package com.srthinker.statinfo.constant; package com.srthinker.statinfo.constant;
public class Const { public class Const {
public static final String DEVICE_TYPE = "RC13"; public static final String DEVICE_TYPE = "RC500";
public static final String SN_PATH = "/sdcard/devicesn/deviceSn.txt";
} }
...@@ -29,7 +29,8 @@ public abstract class BaseActivity extends AppCompatActivity { ...@@ -29,7 +29,8 @@ public abstract class BaseActivity extends AppCompatActivity {
Utils.autoSizeSwitch(this); Utils.autoSizeSwitch(this);
} }
protected void setStatusBar() { protected void setStatusBar() {
StatusBarUtil.hideSystemUI(this); //StatusBarUtil.hideSystemUI(this);
StatusBarUtil.hideSystemNeverUI(this,1000);
} }
protected abstract void initData(); protected abstract void initData();
protected abstract void initView(); protected abstract void initView();
......
package com.srthinker.statinfo.uis; package com.srthinker.statinfo.uis;
import static com.srthinker.statinfo.constant.Const.DEVICE_TYPE; import static com.srthinker.statinfo.constant.Const.DEVICE_TYPE;
import static com.srthinker.statinfo.constant.Const.SN_PATH;
import static com.srthinker.statinfo.constant.GroupConst.BUILD; import static com.srthinker.statinfo.constant.GroupConst.BUILD;
import static com.srthinker.statinfo.constant.GroupConst.BUILD_ID; import static com.srthinker.statinfo.constant.GroupConst.BUILD_ID;
import static com.srthinker.statinfo.constant.GroupConst.OUTRIGGER; import static com.srthinker.statinfo.constant.GroupConst.OUTRIGGER;
...@@ -121,7 +122,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener, ...@@ -121,7 +122,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
@Override @Override
protected void initData() { protected void initData() {
//获取Sn //获取Sn
deviceSn = FileUtil.readTextFromFile("/sdcard/devicesn/deviceSn.txt"); deviceSn = FileUtil.readTextFromFile(SN_PATH);
networkIPMonitor = new NetworkIPMonitor(this); networkIPMonitor = new NetworkIPMonitor(this);
enterBeans = new ArrayList<>(); enterBeans = new ArrayList<>();
leaveBeans = new ArrayList<>(); leaveBeans = new ArrayList<>();
......
...@@ -129,6 +129,7 @@ public class ConfigDlgFragment extends DialogFragment { ...@@ -129,6 +129,7 @@ public class ConfigDlgFragment extends DialogFragment {
String account = mBinding.evAccount.getContent(); String account = mBinding.evAccount.getContent();
String password = mBinding.evPassword.getContent(); String password = mBinding.evPassword.getContent();
String serverIp = mBinding.evServerip.getContent(); String serverIp = mBinding.evServerip.getContent();
if (!TextUtils.isEmpty(account)|| !TextUtils.isEmpty(password) || checkAtLeastOneIp()){
if (TextUtils.isEmpty(account)){ if (TextUtils.isEmpty(account)){
Utils.showTips(context,"请输入账号名!"); Utils.showTips(context,"请输入账号名!");
return; return;
...@@ -145,6 +146,7 @@ public class ConfigDlgFragment extends DialogFragment { ...@@ -145,6 +146,7 @@ public class ConfigDlgFragment extends DialogFragment {
Utils.showTips(context,"请输入IP!"); Utils.showTips(context,"请输入IP!");
return; return;
} }
}
//List<ConfigBean> configBeanList = new ArrayList<>(); //List<ConfigBean> configBeanList = new ArrayList<>();
List<ConfigEntity> configEntities = new ArrayList<>(); List<ConfigEntity> configEntities = new ArrayList<>();
List<String> allDeviceIps = getAllDeviceIps(); List<String> allDeviceIps = getAllDeviceIps();
......
...@@ -3,6 +3,7 @@ package com.srthinker.statinfo.util.common; ...@@ -3,6 +3,7 @@ package com.srthinker.statinfo.util.common;
import android.app.Activity; import android.app.Activity;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.os.Handler;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
...@@ -86,6 +87,8 @@ public class StatusBarUtil { ...@@ -86,6 +87,8 @@ public class StatusBarUtil {
} }
} }
/** /**
* 隐藏导航栏和状态栏 * 隐藏导航栏和状态栏
* *
...@@ -94,20 +97,87 @@ public class StatusBarUtil { ...@@ -94,20 +97,87 @@ public class StatusBarUtil {
public static void hideSystemUI(Activity activity) { public static void hideSystemUI(Activity activity) {
// 检查设备版本,只有在Android 4.0及以上版本才能隐藏导航栏和状态栏 // 检查设备版本,只有在Android 4.0及以上版本才能隐藏导航栏和状态栏
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
View decorView = activity.getWindow().getDecorView();
int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE;
// 如果导航栏和状态栏已经可见,则隐藏它们
if ((decorView.getSystemUiVisibility() & flags) == 0) {
decorView.setSystemUiVisibility(flags);
}
} else {
// 对于Android 4.0以下的设备,只隐藏标题栏
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
}
/**
* 隐藏导航栏和状态栏,如果想随时都不显示的
*
* @param activity 当前活动
*/
public static void hideSystemNeverUI(final Activity activity,long delayMillis) {
// 检查设备版本,只有在Android 4.0及以上版本才能隐藏导航栏和状态栏
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final View decorView = activity.getWindow().getDecorView();
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE;
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
// 如果可见,则延迟隐藏状态栏和导航栏
//decorView.setSystemUiVisibility(flags);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
decorView.setSystemUiVisibility(flags);
}
}, delayMillis);
}
}
});
// 设置全屏标志 // 设置全屏标志
activity.getWindow().getDecorView().setSystemUiVisibility( decorView.setSystemUiVisibility(flags);
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_IMMERSIVE);
} else { } else {
// 对于Android 4.0以下的设备,只隐藏标题栏 // 对于Android 4.0以下的设备,只隐藏标题栏
activity.requestWindowFeature(Window.FEATURE_NO_TITLE); activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
} }
} }
/**
* 只隐藏导航栏
*
* @param activity 当前活动
*/
public static void hideNavigationBar(Activity activity) {
// 检查设备版本,只有在Android 4.0及以上版本才能隐藏导航栏
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
View decorView = activity.getWindow().getDecorView();
int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE;
// 如果导航栏已经可见,则隐藏它
if ((decorView.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
decorView.setSystemUiVisibility(flags);
}
}
}
/** /**
* 显示导航栏和状态栏 * 显示导航栏和状态栏
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment