1.15 系统状态栏根据配置是否显示
This commit is contained in:
@ -58,6 +58,7 @@ import chaoran.business.utils.StatusBarUtil;
|
||||
public class MainActivity extends AppCompatActivity implements ResultListener{
|
||||
|
||||
public static int SCREEN_ROTATION = 3; // 屏幕旋转的设置
|
||||
public static int hideBar = 0; // 屏幕旋转的设置
|
||||
|
||||
MyOrientationDetector myOrientationDetector;
|
||||
|
||||
@ -154,8 +155,7 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
||||
WebSettings settings = webView.getSettings();
|
||||
settings.setJavaScriptEnabled(true);
|
||||
|
||||
// StatusBarUtil.transparencyBar( this); // 设置全部透明,需要在页面设置一个参数进行布局的样式跳转,不同的手机端,状态栏高度不一样(apk设置状态栏高度无效,这个是安卓9的一个bug),所以在此采取隐藏状态栏
|
||||
StatusBarUtil.hideStatusBar( this); // 设置全部透明
|
||||
|
||||
|
||||
//设置接口进行windows暴露
|
||||
settings.setDomStorageEnabled(true);
|
||||
@ -167,6 +167,10 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
||||
webView.addJavascriptInterface(this, "View");
|
||||
webView.addJavascriptInterface(new LocalAddressUtil(this, this, webView), "Localpda");
|
||||
webView.loadUrl(url());
|
||||
// StatusBarUtil.transparencyBar( this); // 设置全部透明,需要在页面设置一个参数进行布局的样式跳转,不同的手机端,状态栏高度不一样(apk设置状态栏高度无效,这个是安卓9的一个bug),所以在此采取隐藏状态栏
|
||||
if (hideBar == 1) {
|
||||
StatusBarUtil.hideStatusBar( this); // 设置全部透明
|
||||
}
|
||||
}
|
||||
|
||||
//配置客户端
|
||||
@ -308,6 +312,7 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
||||
String path = spf.getString("path", "").replaceAll(" ", "");
|
||||
String link = address.concat(":").concat(String.valueOf(port)).concat(path);
|
||||
SCREEN_ROTATION = spf.getInt("screen_rotation", 3);
|
||||
hideBar = spf.getInt("hide_bar", 3);
|
||||
return link.startsWith("http://") ? link : "http://".concat(link);
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ import chaoran.business.R;
|
||||
|
||||
public class NetworkSettingActivity extends AppCompatActivity {
|
||||
|
||||
private EditText address, path, port, screen_rotation;
|
||||
private EditText address, path, port, screen_rotation, hide_bar;
|
||||
private Button save, cancel;
|
||||
|
||||
@Override
|
||||
@ -36,6 +36,7 @@ public class NetworkSettingActivity extends AppCompatActivity {
|
||||
path = findViewById(R.id.path);
|
||||
port = findViewById(R.id.port);
|
||||
screen_rotation = findViewById(R.id.screen_rotation);
|
||||
hide_bar = findViewById(R.id.hide_bar);
|
||||
save = findViewById(R.id.save);
|
||||
cancel = findViewById(R.id.cancel);
|
||||
SharedPreferences sharedPreferences = this.getSharedPreferences("crtech", Context.MODE_PRIVATE);
|
||||
@ -43,6 +44,7 @@ public class NetworkSettingActivity extends AppCompatActivity {
|
||||
path.setText(sharedPreferences.getString("path", ""));
|
||||
port.setText(String.valueOf(sharedPreferences.getInt("port", -1)));
|
||||
screen_rotation.setText(String.valueOf(sharedPreferences.getInt("screen_rotation", 3)));
|
||||
hide_bar.setText(String.valueOf(sharedPreferences.getInt("hide_bar", 0)));
|
||||
cancel.setOnClickListener((e) -> this.finish());
|
||||
save.setOnClickListener((e) -> saveSetting());
|
||||
}
|
||||
@ -53,6 +55,7 @@ public class NetworkSettingActivity extends AppCompatActivity {
|
||||
editor.putString("path", path.getText().toString().trim());
|
||||
editor.putInt("port", Integer.parseInt(port.getText().toString().trim()));
|
||||
editor.putInt("screen_rotation", Integer.parseInt(screen_rotation.getText().toString().trim()));
|
||||
editor.putInt("hide_bar", Integer.parseInt(hide_bar.getText().toString().trim()));
|
||||
editor.commit();
|
||||
this.finish();
|
||||
}
|
||||
|
||||
@ -14,6 +14,8 @@ public class NetworkSetting extends Setting {
|
||||
|
||||
private Integer screen_rotation;
|
||||
|
||||
private Integer hide_bar;
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
@ -45,4 +47,12 @@ public class NetworkSetting extends Setting {
|
||||
public void setScreen_rotation(Integer screen_rotation) {
|
||||
this.screen_rotation = screen_rotation;
|
||||
}
|
||||
|
||||
public Integer getHide_bar() {
|
||||
return hide_bar;
|
||||
}
|
||||
|
||||
public void setHide_bar(Integer hide_bar) {
|
||||
this.hide_bar = hide_bar;
|
||||
}
|
||||
}
|
||||
@ -56,8 +56,10 @@ public class NetworkSettingEngine implements SettingEngine {
|
||||
editor.putString("path", networkSetting.getPath());
|
||||
editor.putInt("port", networkSetting.getPort());
|
||||
editor.putInt("screen_rotation", networkSetting.getScreen_rotation());
|
||||
editor.putInt("hide_bar", networkSetting.getHide_bar());
|
||||
editor.commit();
|
||||
MainActivity.SCREEN_ROTATION = networkSetting.getScreen_rotation();
|
||||
MainActivity.hideBar = networkSetting.getHide_bar();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user