Compare commits

..

2 Commits

8 changed files with 69 additions and 5 deletions

View File

@ -11,7 +11,7 @@ android {
minSdk 28
targetSdk 28
versionCode 1
versionName "1.13"
versionName "1.15"
// 1.0 IDATA广播模式处理
// 1.1 霍尼韦尔的监听修改扫描网站二维码跳出程序监听失效调整、斑马PDA广播模式设置
@ -27,7 +27,12 @@ android {
// 1.11 霍尼韦尔EDA52
// 1.12 屏幕旋转采取配置化模式只能竖屏、横屏取消旋转屏幕就重置activity生命周期
// 1.13 新大陆pda 兼容广播模式NLS-NFT10
// 1.14 瑞芯 rk3566_r 添加引用 librockchip.so 新加一个方法返回当前PDA的厂家和型号
// 1.15 系统状态栏根据配置进行设置
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters 'armeabi-v7a'
}
}
//签名配置
@ -85,4 +90,5 @@ dependencies {
//implementation fileTree(include: ['*.aar'], dir: 'libs')
// 全屏,没有状态栏
api 'com.readystatesoftware.systembartint:systembartint:1.0.3'
implementation files('libs/armeabi-v7a/librockchip.so')
}

View File

@ -105,7 +105,8 @@
"address":document.getElementById('address').value,
"port":document.getElementById('port').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.View.reload();
@ -135,6 +136,10 @@
<label>屏幕旋转</label>
<input id="screen_rotation" value="3" name="screen_rotation" placeholder="1:强制竖屏2:强制横屏3:横竖都转">
</div>
<div class="net-list">
<label>隐藏状态栏</label>
<input id="hide_bar" value="1" name="hide_bar" placeholder="1:隐藏0:显示">
</div>
</div>
<div class="operation">
<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 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);
}

View File

@ -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();
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -18,6 +18,7 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import chaoran.business.BrandEnum;
import chaoran.business.BuildConfig;
import chaoran.business.R;
import chaoran.business.activity.MainActivity;
@ -164,4 +165,14 @@ public class LocalAddressUtil {
public String getApkVersion() {
return BuildConfig.VERSION_NAME;
}
/**
* 暴露PDA的厂家和型号
* @return String 格式:厂家:型号
*/
@SuppressLint("JavascriptInterface")
@JavascriptInterface
public String getPdaInfo() {
return Build.MANUFACTURER + "" + Build.MODEL.toLowerCase();
}
}

View File

@ -7,6 +7,28 @@
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
android:layout_width="match_parent"
android:layout_height="match_parent">