1.15 系统状态栏根据配置是否显示

This commit is contained in:
2024-08-04 18:03:08 +08:00
parent ec798944ad
commit e24a8955a2
7 changed files with 53 additions and 5 deletions

View File

@ -11,7 +11,7 @@ android {
minSdk 28 minSdk 28
targetSdk 28 targetSdk 28
versionCode 1 versionCode 1
versionName "1.14" versionName "1.15"
// 1.0 IDATA广播模式处理 // 1.0 IDATA广播模式处理
// 1.1 霍尼韦尔的监听修改扫描网站二维码跳出程序监听失效调整、斑马PDA广播模式设置 // 1.1 霍尼韦尔的监听修改扫描网站二维码跳出程序监听失效调整、斑马PDA广播模式设置
@ -28,6 +28,7 @@ android {
// 1.12 屏幕旋转采取配置化模式只能竖屏、横屏取消旋转屏幕就重置activity生命周期 // 1.12 屏幕旋转采取配置化模式只能竖屏、横屏取消旋转屏幕就重置activity生命周期
// 1.13 新大陆pda 兼容广播模式NLS-NFT10 // 1.13 新大陆pda 兼容广播模式NLS-NFT10
// 1.14 瑞芯 rk3566_r 添加引用 librockchip.so 新加一个方法返回当前PDA的厂家和型号 // 1.14 瑞芯 rk3566_r 添加引用 librockchip.so 新加一个方法返回当前PDA的厂家和型号
// 1.15 系统状态栏根据配置进行设置
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk { ndk {
abiFilters 'armeabi-v7a' abiFilters 'armeabi-v7a'

View File

@ -105,7 +105,8 @@
"address":document.getElementById('address').value, "address":document.getElementById('address').value,
"port":document.getElementById('port').value, "port":document.getElementById('port').value,
"path":document.getElementById('path').value, "path":document.getElementById('path').value,
"screen_rotation":document.getElementById('screen_rotation').value "screen_rotation":document.getElementById('screen_rotation').value,
"hide_bar":document.getElementById('hide_bar').value
}); });
window.NetworkSettingEngine.saveSetting(data); window.NetworkSettingEngine.saveSetting(data);
window.View.reload(); window.View.reload();
@ -135,6 +136,10 @@
<label>屏幕旋转</label> <label>屏幕旋转</label>
<input id="screen_rotation" value="3" name="screen_rotation" placeholder="1:强制竖屏2:强制横屏3:横竖都转"> <input id="screen_rotation" value="3" name="screen_rotation" placeholder="1:强制竖屏2:强制横屏3:横竖都转">
</div> </div>
<div class="net-list">
<label>隐藏状态栏</label>
<input id="hide_bar" value="1" name="hide_bar" placeholder="1:隐藏0:显示">
</div>
</div> </div>
<div class="operation"> <div class="operation">
<button style="background: #1989fa;" onclick="saveSetting()">保存</button> <button style="background: #1989fa;" onclick="saveSetting()">保存</button>

View File

@ -58,6 +58,7 @@ import chaoran.business.utils.StatusBarUtil;
public class MainActivity extends AppCompatActivity implements ResultListener{ public class MainActivity extends AppCompatActivity implements ResultListener{
public static int SCREEN_ROTATION = 3; // 屏幕旋转的设置 public static int SCREEN_ROTATION = 3; // 屏幕旋转的设置
public static int hideBar = 0; // 屏幕旋转的设置
MyOrientationDetector myOrientationDetector; MyOrientationDetector myOrientationDetector;
@ -154,8 +155,7 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
WebSettings settings = webView.getSettings(); WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true); settings.setJavaScriptEnabled(true);
// StatusBarUtil.transparencyBar( this); // 设置全部透明需要在页面设置一个参数进行布局的样式跳转不同的手机端状态栏高度不一样apk设置状态栏高度无效这个是安卓9的一个bug所以在此采取隐藏状态栏
StatusBarUtil.hideStatusBar( this); // 设置全部透明
//设置接口进行windows暴露 //设置接口进行windows暴露
settings.setDomStorageEnabled(true); settings.setDomStorageEnabled(true);
@ -167,6 +167,10 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
webView.addJavascriptInterface(this, "View"); webView.addJavascriptInterface(this, "View");
webView.addJavascriptInterface(new LocalAddressUtil(this, this, webView), "Localpda"); webView.addJavascriptInterface(new LocalAddressUtil(this, this, webView), "Localpda");
webView.loadUrl(url()); 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 path = spf.getString("path", "").replaceAll(" ", "");
String link = address.concat(":").concat(String.valueOf(port)).concat(path); String link = address.concat(":").concat(String.valueOf(port)).concat(path);
SCREEN_ROTATION = spf.getInt("screen_rotation", 3); SCREEN_ROTATION = spf.getInt("screen_rotation", 3);
hideBar = spf.getInt("hide_bar", 3);
return link.startsWith("http://") ? link : "http://".concat(link); return link.startsWith("http://") ? link : "http://".concat(link);
} }

View File

@ -19,7 +19,7 @@ import chaoran.business.R;
public class NetworkSettingActivity extends AppCompatActivity { 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; private Button save, cancel;
@Override @Override
@ -36,6 +36,7 @@ public class NetworkSettingActivity extends AppCompatActivity {
path = findViewById(R.id.path); path = findViewById(R.id.path);
port = findViewById(R.id.port); port = findViewById(R.id.port);
screen_rotation = findViewById(R.id.screen_rotation); screen_rotation = findViewById(R.id.screen_rotation);
hide_bar = findViewById(R.id.hide_bar);
save = findViewById(R.id.save); save = findViewById(R.id.save);
cancel = findViewById(R.id.cancel); cancel = findViewById(R.id.cancel);
SharedPreferences sharedPreferences = this.getSharedPreferences("crtech", Context.MODE_PRIVATE); SharedPreferences sharedPreferences = this.getSharedPreferences("crtech", Context.MODE_PRIVATE);
@ -43,6 +44,7 @@ public class NetworkSettingActivity extends AppCompatActivity {
path.setText(sharedPreferences.getString("path", "")); path.setText(sharedPreferences.getString("path", ""));
port.setText(String.valueOf(sharedPreferences.getInt("port", -1))); port.setText(String.valueOf(sharedPreferences.getInt("port", -1)));
screen_rotation.setText(String.valueOf(sharedPreferences.getInt("screen_rotation", 3))); 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()); cancel.setOnClickListener((e) -> this.finish());
save.setOnClickListener((e) -> saveSetting()); save.setOnClickListener((e) -> saveSetting());
} }
@ -53,6 +55,7 @@ public class NetworkSettingActivity extends AppCompatActivity {
editor.putString("path", path.getText().toString().trim()); editor.putString("path", path.getText().toString().trim());
editor.putInt("port", Integer.parseInt(port.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("screen_rotation", Integer.parseInt(screen_rotation.getText().toString().trim()));
editor.putInt("hide_bar", Integer.parseInt(hide_bar.getText().toString().trim()));
editor.commit(); editor.commit();
this.finish(); this.finish();
} }

View File

@ -14,6 +14,8 @@ public class NetworkSetting extends Setting {
private Integer screen_rotation; private Integer screen_rotation;
private Integer hide_bar;
public String getAddress() { public String getAddress() {
return address; return address;
} }
@ -45,4 +47,12 @@ public class NetworkSetting extends Setting {
public void setScreen_rotation(Integer screen_rotation) { public void setScreen_rotation(Integer screen_rotation) {
this.screen_rotation = 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;
}
} }

View File

@ -56,8 +56,10 @@ public class NetworkSettingEngine implements SettingEngine {
editor.putString("path", networkSetting.getPath()); editor.putString("path", networkSetting.getPath());
editor.putInt("port", networkSetting.getPort()); editor.putInt("port", networkSetting.getPort());
editor.putInt("screen_rotation", networkSetting.getScreen_rotation()); editor.putInt("screen_rotation", networkSetting.getScreen_rotation());
editor.putInt("hide_bar", networkSetting.getHide_bar());
editor.commit(); editor.commit();
MainActivity.SCREEN_ROTATION = networkSetting.getScreen_rotation(); MainActivity.SCREEN_ROTATION = networkSetting.getScreen_rotation();
MainActivity.hideBar = networkSetting.getHide_bar();
return true; return true;
} }

View File

@ -7,6 +7,28 @@
android:id="@+id/table"> android:id="@+id/table">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="隐藏状态栏:" />
<EditText
android:id="@+id/hide_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="1:隐藏0显示"
android:minWidth="150dp"
android:singleLine="true" />
<TextView />
</TableRow>
<TableRow <TableRow
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">