2.13 取消监听旋转角度,使用系统自带的旋转(根据配置初始化,旋转方向:横、竖、随意)
瑞芯适配器 接入 新的型号,使用的是 ttyS8;而不是ttyS1;并且只有一个接口。
This commit is contained in:
@ -11,7 +11,7 @@ android {
|
|||||||
minSdk 28
|
minSdk 28
|
||||||
targetSdk 28
|
targetSdk 28
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "2.12"
|
versionName "2.13"
|
||||||
|
|
||||||
// 1.0 IDATA广播模式处理
|
// 1.0 IDATA广播模式处理
|
||||||
// 1.1 霍尼韦尔的监听修改(扫描网站二维码跳出程序,监听失效,调整)、斑马PDA广播模式设置
|
// 1.1 霍尼韦尔的监听修改(扫描网站二维码跳出程序,监听失效,调整)、斑马PDA广播模式设置
|
||||||
@ -47,6 +47,8 @@ android {
|
|||||||
// 2.10 再次添加了init.json文件,进行初始化ip等参数
|
// 2.10 再次添加了init.json文件,进行初始化ip等参数
|
||||||
// 2.11 优化了保存配置的时候,重新加载页面方法,去设置初始化屏幕方向,已经init.json中添加了字段备注信息
|
// 2.11 优化了保存配置的时候,重新加载页面方法,去设置初始化屏幕方向,已经init.json中添加了字段备注信息
|
||||||
// 2.12 群创科技接入广播模式 中山市古镇人民医院 蒋凡
|
// 2.12 群创科技接入广播模式 中山市古镇人民医院 蒋凡
|
||||||
|
// 2.13 取消监听旋转角度,使用系统自带的旋转(根据配置初始化,旋转方向:横、竖、随意)
|
||||||
|
// 瑞芯适配器 接入 新的型号,使用的是 ttyS8;而不是ttyS1;并且只有一个接口。
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'armeabi-v7a'
|
abiFilters 'armeabi-v7a'
|
||||||
|
|||||||
@ -24,7 +24,6 @@
|
|||||||
android:name=".application.InitApplication"
|
android:name=".application.InitApplication"
|
||||||
android:theme="@style/Theme.PdaWeb"
|
android:theme="@style/Theme.PdaWeb"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
android:screenOrientation="user"
|
|
||||||
>
|
>
|
||||||
<uses-library android:name="com.symbol.emdk" android:required="false"/>
|
<uses-library android:name="com.symbol.emdk" android:required="false"/>
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@ -114,6 +114,9 @@
|
|||||||
.radio-group .radio-group-box .radio-item {
|
.radio-group .radio-group-box .radio-item {
|
||||||
width: calc(50% - 10px);
|
width: calc(50% - 10px);
|
||||||
}
|
}
|
||||||
|
.radio-group .radio-group-box .radio-item.full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -136,13 +139,29 @@
|
|||||||
<input id="path" name="path" placeholder="访问子路径">
|
<input id="path" name="path" placeholder="访问子路径">
|
||||||
</div>
|
</div>
|
||||||
<div class="radio-group">
|
<div class="radio-group">
|
||||||
<span>屏幕旋转</span>
|
<span>屏幕方向</span>
|
||||||
<div class="radio-group-box">
|
<div class="radio-group-box">
|
||||||
<label class="radio-item">
|
<label class="radio-item">
|
||||||
<input type="radio" name="screen_rotation" value="1" checked>
|
<input type="radio" name="screen_rotation" value="5" checked>
|
||||||
竖屏
|
正竖
|
||||||
</label>
|
</label>
|
||||||
<label class="radio-item">
|
<label class="radio-item">
|
||||||
|
<input type="radio" name="screen_rotation" value="6" checked>
|
||||||
|
倒竖
|
||||||
|
</label>
|
||||||
|
<label class="radio-item full">
|
||||||
|
<input type="radio" name="screen_rotation" value="1" checked>
|
||||||
|
竖屏(系统可能不支持)
|
||||||
|
</label>
|
||||||
|
<label class="radio-item">
|
||||||
|
<input type="radio" name="screen_rotation" value="7">
|
||||||
|
正横
|
||||||
|
</label>
|
||||||
|
<label class="radio-item">
|
||||||
|
<input type="radio" name="screen_rotation" value="8">
|
||||||
|
倒横
|
||||||
|
</label>
|
||||||
|
<label class="radio-item full">
|
||||||
<input type="radio" name="screen_rotation" value="2">
|
<input type="radio" name="screen_rotation" value="2">
|
||||||
横屏
|
横屏
|
||||||
</label>
|
</label>
|
||||||
@ -169,27 +188,6 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="radio-group">
|
|
||||||
<span>默认屏幕方向</span>
|
|
||||||
<div class="radio-group-box">
|
|
||||||
<label class="radio-item">
|
|
||||||
<input type="radio" name="start_direction" value="1" checked>
|
|
||||||
正竖屏
|
|
||||||
</label>
|
|
||||||
<label class="radio-item">
|
|
||||||
<input type="radio" name="start_direction" value="2">
|
|
||||||
倒竖屏
|
|
||||||
</label>
|
|
||||||
<label class="radio-item">
|
|
||||||
<input type="radio" name="start_direction" value="3">
|
|
||||||
正横屏
|
|
||||||
</label>
|
|
||||||
<label class="radio-item">
|
|
||||||
<input type="radio" name="start_direction" value="4">
|
|
||||||
倒横屏
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="operation">
|
<div class="operation">
|
||||||
<button style="background: #1989fa;" onclick="saveSetting()">保存</button>
|
<button style="background: #1989fa;" onclick="saveSetting()">保存</button>
|
||||||
@ -209,7 +207,6 @@
|
|||||||
document.getElementById('path').value = d.path;
|
document.getElementById('path').value = d.path;
|
||||||
document.querySelector('input[name="screen_rotation"][value="'+d.screen_rotation+'"]').checked = true;
|
document.querySelector('input[name="screen_rotation"][value="'+d.screen_rotation+'"]').checked = true;
|
||||||
document.querySelector('input[name="hide_bar"][value="'+d.hide_bar+'"]').checked = true;
|
document.querySelector('input[name="hide_bar"][value="'+d.hide_bar+'"]').checked = true;
|
||||||
document.querySelector('input[name="start_direction"][value="'+d.start_direction+'"]').checked = true;
|
|
||||||
console.log("d_data_end_=========================");
|
console.log("d_data_end_=========================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,8 +219,7 @@
|
|||||||
"port":document.getElementById('port').value,
|
"port":document.getElementById('port').value,
|
||||||
"path":document.getElementById('path').value,
|
"path":document.getElementById('path').value,
|
||||||
"screen_rotation":document.querySelector('input[name="screen_rotation"]:checked').value,
|
"screen_rotation":document.querySelector('input[name="screen_rotation"]:checked').value,
|
||||||
"hide_bar":document.querySelector('input[name="hide_bar"]:checked').value,
|
"hide_bar":document.querySelector('input[name="hide_bar"]:checked').value
|
||||||
"start_direction":document.querySelector('input[name="start_direction"]:checked').value,
|
|
||||||
});
|
});
|
||||||
window.NetworkSettingEngine.saveSetting(data);
|
window.NetworkSettingEngine.saveSetting(data);
|
||||||
window.View.reload();
|
window.View.reload();
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
"_ip":"ip地址",
|
"_ip":"ip地址",
|
||||||
"_port":"端口号",
|
"_port":"端口号",
|
||||||
"_path":"访问路径",
|
"_path":"访问路径",
|
||||||
"_screen_rotation":"屏幕旋转:1竖、2横、3横竖、4禁止",
|
"_screen_rotation":"屏幕方向:5正竖;6倒竖;7正横;8倒横;1竖;2横;3横竖;4禁止",
|
||||||
"_hide_bar":"状态拦:1隐藏、2显示",
|
"_hide_bar":"状态拦:1隐藏、2显示"
|
||||||
"_start_direction":"默认屏幕方向:1正竖、2倒竖、3正横、4倒横"
|
|
||||||
}
|
}
|
||||||
@ -70,9 +70,6 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
|||||||
|
|
||||||
public static int SCREEN_ROTATION = 3; // 屏幕旋转的设置
|
public static int SCREEN_ROTATION = 3; // 屏幕旋转的设置
|
||||||
public static int hideBar = 0; // 屏幕旋转的设置
|
public static int hideBar = 0; // 屏幕旋转的设置
|
||||||
public static int startDirection = 1; // 初始化屏幕方向
|
|
||||||
|
|
||||||
MyOrientationDetector myOrientationDetector;
|
|
||||||
|
|
||||||
private WebView webView;
|
private WebView webView;
|
||||||
private Adapter adapter;
|
private Adapter adapter;
|
||||||
@ -97,9 +94,27 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
|||||||
//SCREEN_ORIENTATION_USER,不能旋转180,0、90、270都可以旋转
|
//SCREEN_ORIENTATION_USER,不能旋转180,0、90、270都可以旋转
|
||||||
//SCREEN_ORIENTATION_FULL_SENSOR 都可以旋转,但是在不打开旋转的情况下,一样可以旋转
|
//SCREEN_ORIENTATION_FULL_SENSOR 都可以旋转,但是在不打开旋转的情况下,一样可以旋转
|
||||||
//SCREEN_ORIENTATION_FULL_USER 关闭旋转则不会旋转了
|
//SCREEN_ORIENTATION_FULL_USER 关闭旋转则不会旋转了
|
||||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER);
|
// 取消监听屏幕方向,使用用户的,等出现了问题再来调整;之前有一款pda系统旋转有bug
|
||||||
myOrientationDetector = new MyOrientationDetector(this, this);
|
// this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE);
|
||||||
myOrientationDetector.enable();
|
if (SCREEN_ROTATION == 1) {
|
||||||
|
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);//竖
|
||||||
|
}else if (SCREEN_ROTATION == 2) {
|
||||||
|
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE);//横
|
||||||
|
}else if (SCREEN_ROTATION == 3){
|
||||||
|
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER);//随便
|
||||||
|
}else if (SCREEN_ROTATION == 5) { // 正竖
|
||||||
|
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}else if (SCREEN_ROTATION == 6) {// 倒竖
|
||||||
|
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
|
||||||
|
}else if (SCREEN_ROTATION == 7) {// 正横
|
||||||
|
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
|
||||||
|
}else if (SCREEN_ROTATION == 8) {// 倒横
|
||||||
|
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}else {
|
||||||
|
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); // 禁止
|
||||||
|
}
|
||||||
|
// myOrientationDetector = new MyOrientationDetector(this, this);
|
||||||
|
// myOrientationDetector.enable();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,22 +325,20 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
|||||||
// voiceEngine.reload();
|
// voiceEngine.reload();
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
myOrientationDetector.disable();
|
|
||||||
myOrientationDetector.enable();
|
|
||||||
adapter.stop2();
|
adapter.stop2();
|
||||||
adapter.start();
|
adapter.start();
|
||||||
}
|
}
|
||||||
int rotate = 1;
|
// int rotate = 1;
|
||||||
if (startDirection == 1) {
|
// if (startDirection == 1) {
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; // 正竖屏
|
// rotate = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; // 正竖屏
|
||||||
}else if (startDirection == 2) {
|
// }else if (startDirection == 2) {
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; // 倒竖屏
|
// rotate = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; // 倒竖屏
|
||||||
}else if (startDirection == 3) {
|
// }else if (startDirection == 3) {
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; // 正横屏
|
// rotate = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; // 正横屏
|
||||||
}else if (startDirection == 4) {
|
// }else if (startDirection == 4) {
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; // 倒横屏
|
// rotate = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; // 倒横屏
|
||||||
}
|
// }
|
||||||
this.setRequestedOrientation(rotate);
|
// this.setRequestedOrientation(rotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -358,7 +371,6 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
|||||||
vibrator.cancel();
|
vibrator.cancel();
|
||||||
}
|
}
|
||||||
completionListener = null;
|
completionListener = null;
|
||||||
myOrientationDetector.disable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -400,7 +412,6 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
|||||||
initData.setPath(map.get("path").toString());
|
initData.setPath(map.get("path").toString());
|
||||||
initData.setScreen_rotation(Integer.parseInt(map.getOrDefault("screen_rotation", "3").toString()));
|
initData.setScreen_rotation(Integer.parseInt(map.getOrDefault("screen_rotation", "3").toString()));
|
||||||
initData.setHide_bar(Integer.parseInt(map.getOrDefault("hide_bar", "0").toString()));
|
initData.setHide_bar(Integer.parseInt(map.getOrDefault("hide_bar", "0").toString()));
|
||||||
initData.setStart_direction(Integer.parseInt(map.getOrDefault("start_direction", "1").toString()));
|
|
||||||
settingEngine.saveSetting(initData);
|
settingEngine.saveSetting(initData);
|
||||||
spf = this.getSharedPreferences("crtech", Context.MODE_PRIVATE);
|
spf = this.getSharedPreferences("crtech", Context.MODE_PRIVATE);
|
||||||
port = initData.getPort();
|
port = initData.getPort();
|
||||||
@ -421,24 +432,11 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
|||||||
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", 0);
|
hideBar = spf.getInt("hide_bar", 0);
|
||||||
startDirection = spf.getInt("start_direction", 1);
|
|
||||||
return link.startsWith("http://") ? link : "http://".concat(link);
|
return link.startsWith("http://") ? link : "http://".concat(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void reload() {
|
public void reload() {
|
||||||
// 第一次设置,点击保存,初始化屏幕方向问题
|
|
||||||
int rotate = 1;
|
|
||||||
if (startDirection == 1) {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; // 正竖屏
|
|
||||||
}else if (startDirection == 2) {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; // 倒竖屏
|
|
||||||
}else if (startDirection == 3) {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; // 正横屏
|
|
||||||
}else if (startDirection == 4) {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; // 倒横屏
|
|
||||||
}
|
|
||||||
this.setRequestedOrientation(rotate);
|
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
webView.loadUrl(url());
|
webView.loadUrl(url());
|
||||||
});
|
});
|
||||||
@ -504,52 +502,6 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 监听角度的变化 */
|
|
||||||
class MyOrientationDetector extends OrientationEventListener {
|
|
||||||
|
|
||||||
private int rotate;
|
|
||||||
|
|
||||||
private Activity activity;
|
|
||||||
|
|
||||||
public MyOrientationDetector(Context context, Activity activity) {
|
|
||||||
super(context);
|
|
||||||
this.activity = activity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onOrientationChanged(int orientation) {
|
|
||||||
//假设屏幕旋转被打开。则设置屏幕可旋转
|
|
||||||
//0-57度 125-236度 306-360度 这些区间范围内为竖屏
|
|
||||||
//58-124度 237-305度 这些区间范围内为横屏
|
|
||||||
if (orientation >=0 && orientation <= 57 ) {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; // 正竖屏
|
|
||||||
}else if (orientation >=125 && orientation <= 236 ) {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; // 倒竖屏
|
|
||||||
}else if (orientation >=306 && orientation <= 360 ) {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; // 正竖屏
|
|
||||||
}else if (orientation >=58 && orientation <= 124 ) {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; // 正横屏
|
|
||||||
}else if (orientation >=237 && orientation <= 305 ) {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; // 倒横屏
|
|
||||||
}else {
|
|
||||||
rotate = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; // 默认正竖屏
|
|
||||||
}
|
|
||||||
if (SCREEN_ROTATION == 1 || SCREEN_ROTATION == 3) {
|
|
||||||
if (rotate == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT || rotate == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT) {
|
|
||||||
activity.setRequestedOrientation(rotate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (SCREEN_ROTATION == 2 || SCREEN_ROTATION == 3) {
|
|
||||||
if (rotate == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || rotate == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) {
|
|
||||||
activity.setRequestedOrientation(rotate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("WrongConstant")
|
@SuppressLint("WrongConstant")
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
|||||||
@ -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, hide_bar,start_direction;
|
private EditText address, path, port, screen_rotation, hide_bar;
|
||||||
private Button save, cancel;
|
private Button save, cancel;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,7 +37,6 @@ public class NetworkSettingActivity extends AppCompatActivity {
|
|||||||
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);
|
hide_bar = findViewById(R.id.hide_bar);
|
||||||
start_direction = findViewById(R.id.start_direction);
|
|
||||||
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);
|
||||||
@ -46,7 +45,6 @@ public class NetworkSettingActivity extends AppCompatActivity {
|
|||||||
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)));
|
hide_bar.setText(String.valueOf(sharedPreferences.getInt("hide_bar", 0)));
|
||||||
start_direction.setText(String.valueOf(sharedPreferences.getInt("start_direction", 1)));
|
|
||||||
cancel.setOnClickListener((e) -> this.finish());
|
cancel.setOnClickListener((e) -> this.finish());
|
||||||
save.setOnClickListener((e) -> saveSetting());
|
save.setOnClickListener((e) -> saveSetting());
|
||||||
}
|
}
|
||||||
@ -58,7 +56,6 @@ public class NetworkSettingActivity extends AppCompatActivity {
|
|||||||
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.putInt("hide_bar", Integer.parseInt(hide_bar.getText().toString().trim()));
|
||||||
editor.putInt("start_direction", Integer.parseInt(start_direction.getText().toString().trim()));
|
|
||||||
editor.commit();
|
editor.commit();
|
||||||
this.finish();
|
this.finish();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,8 @@ package chaoran.business.adapter;
|
|||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
import chaoran.business.activity.ResultListener;
|
import chaoran.business.activity.ResultListener;
|
||||||
import chaoran.business.strategy.Strategy;
|
import chaoran.business.strategy.Strategy;
|
||||||
|
|
||||||
@ -40,7 +42,11 @@ public class RockChipAdapter implements Adapter {
|
|||||||
public RockChipAdapter(Context context, ResultListener resultListener) {
|
public RockChipAdapter(Context context, ResultListener resultListener) {
|
||||||
this.resultListener = resultListener;
|
this.resultListener = resultListener;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.strategy = new Reader(new File("/dev/ttyS1"), 115200, 0);
|
String fileName = "/dev/ttyS1";
|
||||||
|
if (Build.MODEL.equalsIgnoreCase("rk3568_r")) {
|
||||||
|
fileName = "/dev/ttyS8";
|
||||||
|
}
|
||||||
|
this.strategy = new Reader(new File(fileName), 115200, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Reader implements Strategy {
|
public class Reader implements Strategy {
|
||||||
|
|||||||
@ -15,7 +15,6 @@ public class NetworkSetting extends Setting {
|
|||||||
private Integer screen_rotation;
|
private Integer screen_rotation;
|
||||||
|
|
||||||
private Integer hide_bar;
|
private Integer hide_bar;
|
||||||
private Integer start_direction;
|
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return address;
|
return address;
|
||||||
@ -57,11 +56,4 @@ public class NetworkSetting extends Setting {
|
|||||||
this.hide_bar = hide_bar;
|
this.hide_bar = hide_bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getStart_direction() {
|
|
||||||
return start_direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStart_direction(Integer start_direction) {
|
|
||||||
this.start_direction = start_direction;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -46,7 +46,6 @@ public class NetworkSettingEngine implements SettingEngine {
|
|||||||
networkSetting.setPath(path);
|
networkSetting.setPath(path);
|
||||||
networkSetting.setScreen_rotation(screen_rotation);
|
networkSetting.setScreen_rotation(screen_rotation);
|
||||||
networkSetting.setHide_bar(spf.getInt("hide_bar", 0));
|
networkSetting.setHide_bar(spf.getInt("hide_bar", 0));
|
||||||
networkSetting.setStart_direction(spf.getInt("start_direction", 0));
|
|
||||||
return networkSetting;
|
return networkSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,11 +58,10 @@ public class NetworkSettingEngine implements SettingEngine {
|
|||||||
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.putInt("hide_bar", networkSetting.getHide_bar());
|
||||||
editor.putInt("start_direction", networkSetting.getStart_direction());
|
|
||||||
editor.commit();
|
editor.commit();
|
||||||
MainActivity.SCREEN_ROTATION = networkSetting.getScreen_rotation();
|
MainActivity.SCREEN_ROTATION = networkSetting.getScreen_rotation();
|
||||||
MainActivity.hideBar = networkSetting.getHide_bar();
|
MainActivity.hideBar = networkSetting.getHide_bar();
|
||||||
MainActivity.startDirection = networkSetting.getStart_direction();
|
// MainActivity.startDirection = networkSetting.getStart_direction();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="屏幕旋转:" />
|
android:text="屏幕方向:" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -113,36 +113,12 @@
|
|||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:digits="1234"
|
android:digits="1234"
|
||||||
android:hint="1:竖屏;2:横屏;3:横竖;4:禁止" />
|
android:hint="5正竖;6倒竖;7正横;8倒横;1竖;2横;3横竖;4禁止" />
|
||||||
|
|
||||||
<TextView />
|
<TextView />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
|
||||||
<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:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minWidth="150dp"
|
|
||||||
android:id="@+id/start_direction"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:inputType="number"
|
|
||||||
android:digits="1234"
|
|
||||||
android:hint="1:正竖;2:倒竖;3:正横;4:倒横" />
|
|
||||||
|
|
||||||
<TextView />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user