Skip to content

Commit

Permalink
更新V1.3.76
Browse files Browse the repository at this point in the history
- 优化修改分辨率算法,避免元素缩放过大过小问题
- 完善分辨率自适应功能
- UI界面优化
- 修复部分设备UI显示问题
- 局域网设备扫描功能增强
- 完善自定义动作设置
- 增加连接时自定义分辨率功能
- 分辨率自动恢复从重置改为恢复成连接前分辨率(主控端设备长按恢复分辨率仍为重置)
- 支持多设备自启动
- 修复直连与隧道无法自动切换的问题
- 增加间距减少误触
  • Loading branch information
mingzhixian committed Feb 25, 2024
1 parent f2e60e3 commit 7666fb6
Show file tree
Hide file tree
Showing 69 changed files with 1,398 additions and 1,307 deletions.
2 changes: 0 additions & 2 deletions HOW_TO_USE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@

4. 扩展使用
易控支持在外部使用广播控制,广播地址为:"top.saymzx.easycontrol.app.CONTROL",需要向意向也就是Intent填入想要做的动作:
- 启动默认设备:
- action:startDefault
- 启动目标设备:
- action:start
- uuid:设备ID
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,24 @@
代码是开源的,但官方打包的安装包需要激活才可使用,激活的步骤请参考[此页面](https://gitee.com/mingzhixianweb/easycontrol/blob/master/DONATE.md)

## 截图
<img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/main.webp" width="200px">
<img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/small.webp" width="200px">
<img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/mini.webp" width="200px">
<img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/full.webp" width="200px">
<center class="half">
<img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/1.jpg" width="150"/><img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/2.jpg" width="150"/><img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/3.jpg" width="150"/>
<img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/4.jpg" width="150"/><img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/5.jpg" width="150"/><img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/6.jpg" width="150"/>
<img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/7.jpg" width="150"/><img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/screenshot/8.jpg" width="150"/>
</center>

## 构建
如果您想要自己构建,请注意以下几项
- 请遵循本项目的开源协议
- 我去除了官方打包加入的激活模块相关的代码文件,所以会有报错,请自行注释掉报错代码即可

## 反馈

请在Github或Gitee提出Issue,或进入易控反馈群反馈BUG或建议。

<img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/other/qq_issue.webp" width="200px">
<img src="https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/other/wechat_issue.png" width="200px">

## 附加
- ADB协议说明(官方的文档写的真烂,感谢cstyan大佬) [点击前往](https://github.com/cstyan/adbDocumentation)
- Scrcpy官方地址 [点击前往](https://github.com/Genymobile/scrcpy)
- 第三方修改本(专为车机进行了优化) [点击前往](https://github.com/eiyooooo/Easycontrol_For_Car)
4 changes: 2 additions & 2 deletions easycontrol/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "top.saymzx.easycontrol.app"
minSdk 21
targetSdk 34
versionCode 10373
versionName "1.3.73"
versionCode 10376
versionName "1.3.76"
ndk {
abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64"
}
Expand Down
7 changes: 3 additions & 4 deletions easycontrol/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" /> <!-- 网络 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down Expand Up @@ -28,13 +27,13 @@
</intent-filter>
</activity>
<activity
android:name=".IpActivity"
android:name=".DeviceDetailActivity"
android:exported="false" />
<activity
android:name=".SetActivity"
android:exported="false" />
<activity
android:name=".SetDetailActivity"
android:name=".IpActivity"
android:exported="false" />
<activity
android:name=".client.view.FullActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

public class ActiveActivity extends Activity {

private ActivityActiveBinding activeActivity;
private ActivityActiveBinding activityActiveBinding;

@Override
protected void onCreate(Bundle savedInstanceState) {
ViewTools.setStatusAndNavBar(this);
ViewTools.setLocale(this);
activeActivity = ActivityActiveBinding.inflate(this.getLayoutInflater());
setContentView(activeActivity.getRoot());
activityActiveBinding = ActivityActiveBinding.inflate(this.getLayoutInflater());
setContentView(activityActiveBinding.getRoot());
// 取消激活
if (AppData.setting.getIsActive()) deactivate();
setButtonListener();
Expand All @@ -31,13 +31,13 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void drawUi() {
activeActivity.key.setText(AppData.setting.getActiveKey());
activeActivity.layout.addView(ViewTools.createTextCard(this, getString(R.string.active_url), () -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/blob/master/DONATE.md")).getRoot());
activityActiveBinding.key.setText(AppData.setting.getActiveKey());
activityActiveBinding.url.setOnClickListener(v -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/blob/master/DONATE.md"));
}

private void setButtonListener() {
activeActivity.active.setOnClickListener(v -> {
String activeKey = String.valueOf(activeActivity.key.getText());
activityActiveBinding.active.setOnClickListener(v -> {
String activeKey = String.valueOf(activityActiveBinding.key.getText());
AppData.setting.setActiveKey(activeKey);
Pair<View, WindowManager.LayoutParams> loading = ViewTools.createLoading(this);
AppData.windowManager.addView(loading.first, loading.second);
Expand All @@ -49,8 +49,8 @@ private void setButtonListener() {
finish();
AppData.setting.setIsActive(true);
PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/blob/master/HOW_TO_USE.md");
PublicTools.logToast("active", getString(R.string.active_button_success), true);
} else PublicTools.logToast("active", getString(R.string.active_button_error), true);
PublicTools.logToast("active", getString(R.string.toast_success), true);
} else PublicTools.logToast("active", getString(R.string.toast_fail), true);
});
}).start();
});
Expand All @@ -66,8 +66,8 @@ private void deactivate() {
AppData.uiHandler.post(() -> {
if (isOk) {
AppData.setting.setIsActive(false);
PublicTools.logToast("deactivate", getString(R.string.active_deactivate_success), true);
} else PublicTools.logToast("deactivate", getString(R.string.active_deactivate_error), true);
PublicTools.logToast("deactivate", getString(R.string.toast_success), true);
} else PublicTools.logToast("deactivate", getString(R.string.toast_fail), true);
});
}).start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void writeKey() {
privateKeyWriter.flush();
}
AppData.keyPair = AdbKeyPair.read(adbKeyFile.first, adbKeyFile.second);
Toast.makeText(this, getString(R.string.adb_key_button_code), Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(R.string.toast_success), Toast.LENGTH_SHORT).show();
} catch (Exception ignored) {
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package top.saymzx.easycontrol.app;

import android.app.Activity;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Toast;

import java.util.UUID;

import top.saymzx.easycontrol.app.databinding.ActivityDeviceDetailBinding;
import top.saymzx.easycontrol.app.entity.AppData;
import top.saymzx.easycontrol.app.entity.Device;
import top.saymzx.easycontrol.app.helper.MyBroadcastReceiver;
import top.saymzx.easycontrol.app.helper.ViewTools;

public class DeviceDetailActivity extends Activity {
private ActivityDeviceDetailBinding activityDeviceDetailBinding;
private boolean isNew;
private Device device;

@Override
protected void onCreate(Bundle savedInstanceState) {
ViewTools.setStatusAndNavBar(this);
ViewTools.setLocale(this);
activityDeviceDetailBinding = ActivityDeviceDetailBinding.inflate(this.getLayoutInflater());
setContentView(activityDeviceDetailBinding.getRoot());
// 获取Device
String uuid = getIntent().getStringExtra("uuid");
isNew = uuid == null;
if (isNew) device = new Device(UUID.randomUUID().toString(), Device.TYPE_NETWORK);
else device = AppData.dbHelper.getByUUID(uuid);
// 绘制UI
drawUI();
// 设置监听
setListener();
super.onCreate(savedInstanceState);
}

// 绘制UI
private static final String[] maxSizeList = new String[]{"2560", "1920", "1600", "1280", "1024", "800"};
private static final String[] maxFpsList = new String[]{"90", "60", "40", "30", "20", "10"};
private static final String[] maxVideoBitList = new String[]{"12", "8", "4", "2", "1"};

private void drawUI() {
// UUID
activityDeviceDetailBinding.uuid.setOnClickListener(v -> {
AppData.clipBoard.setPrimaryClip(ClipData.newPlainText(ClipDescription.MIMETYPE_TEXT_PLAIN, device.uuid));
Toast.makeText(this, getString(R.string.toast_copy), Toast.LENGTH_SHORT).show();
});
// 预填写参数
activityDeviceDetailBinding.name.setText(device.name);
activityDeviceDetailBinding.address.setText(device.address);
if (!device.isNetworkDevice()) activityDeviceDetailBinding.address.setEnabled(false);
activityDeviceDetailBinding.customResolution.setVisibility(device.customResolutionOnConnect ? View.VISIBLE : View.GONE);
activityDeviceDetailBinding.customResolutionWidth.setText(String.valueOf(device.customResolutionWidth));
activityDeviceDetailBinding.customResolutionHeight.setText(String.valueOf(device.customResolutionHeight));
// 连接时操作
activityDeviceDetailBinding.layoutOnConnect.setOnClickListener(v -> activityDeviceDetailBinding.layoutOnConnectSub.setVisibility(activityDeviceDetailBinding.layoutOnConnectSub.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE));
activityDeviceDetailBinding.layoutOnConnectSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_custom_resolution_on_connect), getString(R.string.device_custom_resolution_on_connect_detail), device.customResolutionOnConnect, isChecked -> activityDeviceDetailBinding.customResolution.setVisibility(isChecked ? View.VISIBLE : View.GONE)).getRoot(), 0);
activityDeviceDetailBinding.layoutOnConnectSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_wake_on_connect), getString(R.string.device_wake_on_connect_detail), device.wakeOnConnect, isChecked -> device.wakeOnConnect = isChecked).getRoot());
activityDeviceDetailBinding.layoutOnConnectSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_light_off_on_connect), getString(R.string.device_light_off_on_connect_detail), device.lightOffOnConnect, isChecked -> device.lightOffOnConnect = isChecked).getRoot());
activityDeviceDetailBinding.layoutOnConnectSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_show_nav_bar_on_connect), getString(R.string.device_show_nav_bar_on_connect_detail), device.showNavBarOnConnect, isChecked -> device.showNavBarOnConnect = isChecked).getRoot());
activityDeviceDetailBinding.layoutOnConnectSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_change_to_full_on_connect), getString(R.string.device_change_to_full_on_connect_detail), device.changeToFullOnConnect, isChecked -> device.changeToFullOnConnect = isChecked).getRoot());
// 运行时操作
activityDeviceDetailBinding.layoutOnRunning.setOnClickListener(v -> activityDeviceDetailBinding.layoutOnRunningSub.setVisibility(activityDeviceDetailBinding.layoutOnRunningSub.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE));
activityDeviceDetailBinding.layoutOnRunningSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_keep_wake_on_running), getString(R.string.device_keep_wake_on_running_detail), device.keepWakeOnRunning, isChecked -> device.keepWakeOnRunning = isChecked).getRoot());
activityDeviceDetailBinding.layoutOnRunningSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_change_resolution_on_running), getString(R.string.device_change_resolution_on_running_detail), device.changeResolutionOnRunning, isChecked -> device.changeResolutionOnRunning = isChecked).getRoot());
activityDeviceDetailBinding.layoutOnRunningSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_small_to_mini_on_running), getString(R.string.device_small_to_mini_on_running_detail), device.smallToMiniOnRunning, isChecked -> device.smallToMiniOnRunning = isChecked).getRoot());
activityDeviceDetailBinding.layoutOnRunningSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_full_to_mini_on_running), getString(R.string.device_full_to_mini_on_running_detail), device.fullToMiniOnRunning, isChecked -> device.fullToMiniOnRunning = isChecked).getRoot());
activityDeviceDetailBinding.layoutOnRunningSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_mini_timeout_on_running), getString(R.string.device_mini_timeout_on_running_detail), device.miniTimeoutOnRunning, isChecked -> device.miniTimeoutOnRunning = isChecked).getRoot());
// 断开时操作
activityDeviceDetailBinding.layoutOnClose.setOnClickListener(v -> activityDeviceDetailBinding.layoutOnCloseSub.setVisibility(activityDeviceDetailBinding.layoutOnCloseSub.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE));
activityDeviceDetailBinding.layoutOnCloseSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_lock_on_close), getString(R.string.device_lock_on_close_detail), device.lockOnClose, isChecked -> device.lockOnClose = isChecked).getRoot());
activityDeviceDetailBinding.layoutOnCloseSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_light_on_close), getString(R.string.device_light_on_close_detail), device.lightOnClose, isChecked -> device.lightOnClose = isChecked).getRoot());
activityDeviceDetailBinding.layoutOnCloseSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_reconnect_on_close), getString(R.string.device_reconnect_on_close_detail), device.reconnectOnClose, isChecked -> device.reconnectOnClose = isChecked).getRoot());
// 参数
activityDeviceDetailBinding.layoutOption.setOnClickListener(v -> activityDeviceDetailBinding.layoutOptionSub.setVisibility(activityDeviceDetailBinding.layoutOptionSub.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE));
ArrayAdapter<String> maxSizeAdapter = new ArrayAdapter<>(AppData.applicationContext, R.layout.item_spinner_item, maxSizeList);
ArrayAdapter<String> maxFpsAdapter = new ArrayAdapter<>(AppData.applicationContext, R.layout.item_spinner_item, maxFpsList);
ArrayAdapter<String> maxVideoBitAdapter = new ArrayAdapter<>(AppData.applicationContext, R.layout.item_spinner_item, maxVideoBitList);
activityDeviceDetailBinding.layoutOptionSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_is_audio), getString(R.string.device_is_audio_detail), device.isAudio, isChecked -> device.isAudio = isChecked).getRoot());
activityDeviceDetailBinding.layoutOptionSub.addView(ViewTools.createSpinnerCard(this, getString(R.string.device_max_size), getString(R.string.device_max_size_detail), String.valueOf(device.maxSize), maxSizeAdapter, str -> device.maxSize = Integer.parseInt(str)).getRoot());
activityDeviceDetailBinding.layoutOptionSub.addView(ViewTools.createSpinnerCard(this, getString(R.string.device_max_fps), getString(R.string.device_max_fps_detail), String.valueOf(device.maxFps), maxFpsAdapter, str -> device.maxFps = Integer.parseInt(str)).getRoot());
activityDeviceDetailBinding.layoutOptionSub.addView(ViewTools.createSpinnerCard(this, getString(R.string.device_max_video_bit), getString(R.string.device_max_video_bit_detail), String.valueOf(device.maxVideoBit), maxVideoBitAdapter, str -> device.maxVideoBit = Integer.parseInt(str)).getRoot());
activityDeviceDetailBinding.layoutOptionSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_use_h265), getString(R.string.device_use_h265_detail), device.useH265, isChecked -> device.useH265 = isChecked).getRoot());
activityDeviceDetailBinding.layoutOptionSub.addView(ViewTools.createSwitchCard(this, getString(R.string.device_connect_on_start), getString(R.string.device_connect_on_start_detail), device.connectOnStart, isChecked -> device.connectOnStart = isChecked).getRoot());
}

// 设置监听
private void setListener() {
activityDeviceDetailBinding.backButton.setOnClickListener(v -> finish());
// 设置确认按钮监听
activityDeviceDetailBinding.ok.setOnClickListener(v -> {
if (device.isNetworkDevice() && String.valueOf(activityDeviceDetailBinding.address.getText()).equals("")) return;
device.name = String.valueOf(activityDeviceDetailBinding.name.getText());
device.address = String.valueOf(activityDeviceDetailBinding.address.getText());
// 自定义分辨率
String width = String.valueOf(activityDeviceDetailBinding.customResolutionWidth.getText());
String height = String.valueOf(activityDeviceDetailBinding.customResolutionHeight.getText());
device.customResolutionOnConnect = false;
if (activityDeviceDetailBinding.customResolution.getVisibility() != View.GONE && !width.equals("") && !height.equals("") && Integer.parseInt(width) >= 500 && Integer.parseInt(height) >= 500) {
device.customResolutionOnConnect = true;
device.customResolutionWidth = Integer.parseInt(width);
device.customResolutionHeight = Integer.parseInt(height);
}
// 更新数据库
if (isNew) AppData.dbHelper.insert(device);
else AppData.dbHelper.update(device);
Intent intent = new Intent();
intent.setAction(MyBroadcastReceiver.ACTION_UPDATE_DEVICE_LIST);
sendBroadcast(intent);
finish();
});
}
}
Loading

0 comments on commit 7666fb6

Please sign in to comment.