Skip to content

Commit

Permalink
更新V1.3.12
Browse files Browse the repository at this point in the history
新年快乐!!!

- 整理客户端架构
- 支持连接时自动唤醒
- 优化性能
- 优化音频卡顿问题
- 优化小窗横竖屏切换
- 完善小窗模式,避免大小和位置超出
- 调整界面UI
- 修复一系列BUG
- 新年期间优惠价格:10元,2024.2.1-2024.2.15
  • Loading branch information
mingzhixian committed Feb 1, 2024
1 parent 1719ad4 commit c917d20
Show file tree
Hide file tree
Showing 61 changed files with 1,707 additions and 1,350 deletions.
12 changes: 6 additions & 6 deletions HOW_TO_USE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# 易控(Easycontrol)使用说明

## 视频教程(视频版本更新较慢,请以文本说明为准)
1. [视频1](https://www.bilibili.com/video/BV1Wu4y1u7vD/)
2. [视频2](https://www.bilibili.com/video/BV11a4y1d7EU/)
3. [视频3](https://www.bilibili.com/video/BV1Wa4y197tF/)

## 初次使用
## 准备操作
1. 被控端手机连续点击关于手机-版本号,直至提示打开开发者选项
2. 被控端手机设置中找到开发者选项
- 打开“USB调试”
Expand Down Expand Up @@ -98,3 +93,8 @@
- 目标设备关闭投屏:
action:close
uuid:设备ID
## 视频教程(视频版本更新较慢,请以文本说明为准)
1. [视频1](https://www.bilibili.com/video/BV1Wu4y1u7vD/)
2. [视频2](https://www.bilibili.com/video/BV11a4y1d7EU/)
3. [视频3](https://www.bilibili.com/video/BV1Wa4y197tF/)
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 10310
versionName "1.3.10"
versionCode 10312
versionName "1.3.12"
ndk {
abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@
import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.util.Pair;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;

import top.saymzx.easycontrol.app.databinding.ActivityActiveBinding;
import top.saymzx.easycontrol.app.databinding.ItemLoadingBinding;
import top.saymzx.easycontrol.app.entity.AppData;
import top.saymzx.easycontrol.app.helper.ActiveHelper;
import top.saymzx.easycontrol.app.helper.PublicTools;
import top.saymzx.easycontrol.app.helper.ViewTools;

public class ActiveActivity extends Activity {

private ActivityActiveBinding activeActivity;

@Override
protected void onCreate(Bundle savedInstanceState) {
PublicTools.setStatusAndNavBar(this);
PublicTools.setLocale(this);
ViewTools.setStatusAndNavBar(this);
ViewTools.setLocale(this);
activeActivity = ActivityActiveBinding.inflate(this.getLayoutInflater());
setContentView(activeActivity.getRoot());
AppData.setting.setIsActive(false);
Expand All @@ -29,18 +34,18 @@ protected void onCreate(Bundle savedInstanceState) {

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

private void setButtonListener() {
activeActivity.active.setOnClickListener(v -> {
String activeKey = String.valueOf(activeActivity.key.getText());
AppData.setting.setActiveKey(activeKey);
Dialog dialog = PublicTools.createClientLoading(AppData.main);
dialog.show();
Pair<View, WindowManager.LayoutParams> loading = ViewTools.createLoading(this);
AppData.windowManager.addView(loading.first, loading.second);
new Thread(() -> {
boolean isOk = ActiveHelper.checkOk(activeKey);
dialog.cancel();
AppData.windowManager.removeView(loading.first);
AppData.uiHandler.post(() -> {
if (isOk) {
finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.os.Bundle;
import android.util.Pair;
import android.widget.Toast;

import java.io.File;
Expand All @@ -13,18 +14,19 @@
import top.saymzx.easycontrol.app.databinding.ActivityAdbKeyBinding;
import top.saymzx.easycontrol.app.entity.AppData;
import top.saymzx.easycontrol.app.helper.PublicTools;
import top.saymzx.easycontrol.app.helper.ViewTools;

public class AdbKeyActivity extends Activity {
private ActivityAdbKeyBinding activityAdbKeyBinding;
private final File privateKey = new File(AppData.main.getApplicationContext().getFilesDir(), "private.key");
private final File publicKey = new File(AppData.main.getApplicationContext().getFilesDir(), "public.key");
private Pair<File,File> adbKeyFile;

@Override
protected void onCreate(Bundle savedInstanceState) {
PublicTools.setStatusAndNavBar(this);
PublicTools.setLocale(this);
ViewTools.setStatusAndNavBar(this);
ViewTools.setLocale(this);
activityAdbKeyBinding = ActivityAdbKeyBinding.inflate(this.getLayoutInflater());
setContentView(activityAdbKeyBinding.getRoot());
adbKeyFile=PublicTools.getAdbKeyFile(this);
readKey();
activityAdbKeyBinding.backButton.setOnClickListener(v -> finish());
activityAdbKeyBinding.ok.setOnClickListener(v -> writeKey());
Expand All @@ -34,14 +36,14 @@ protected void onCreate(Bundle savedInstanceState) {
// 读取旧的密钥公钥文件
private void readKey() {
try {
byte[] publicKeyBytes = new byte[(int) publicKey.length()];
byte[] privateKeyBytes = new byte[(int) privateKey.length()];
byte[] publicKeyBytes = new byte[(int) adbKeyFile.first.length()];
byte[] privateKeyBytes = new byte[(int) adbKeyFile.second.length()];

try (FileInputStream stream = new FileInputStream(publicKey)) {
try (FileInputStream stream = new FileInputStream(adbKeyFile.first)) {
stream.read(publicKeyBytes);
activityAdbKeyBinding.adbKeyPub.setText(new String(publicKeyBytes));
}
try (FileInputStream stream = new FileInputStream(privateKey)) {
try (FileInputStream stream = new FileInputStream(adbKeyFile.second)) {
stream.read(privateKeyBytes);
activityAdbKeyBinding.adbKeyPri.setText(new String(privateKeyBytes));
}
Expand All @@ -52,15 +54,15 @@ private void readKey() {
// 写入新的密钥公钥文件
private void writeKey() {
try {
try (FileWriter publicKeyWriter = new FileWriter(publicKey)) {
try (FileWriter publicKeyWriter = new FileWriter(adbKeyFile.first)) {
publicKeyWriter.write(String.valueOf(activityAdbKeyBinding.adbKeyPub.getText()));
publicKeyWriter.flush();
}
try (FileWriter privateKeyWriter = new FileWriter(privateKey)) {
try (FileWriter privateKeyWriter = new FileWriter(adbKeyFile.second)) {
privateKeyWriter.write(String.valueOf(activityAdbKeyBinding.adbKeyPri.getText()));
privateKeyWriter.flush();
}
AppData.keyPair = AdbKeyPair.read(privateKey, publicKey);
AppData.keyPair = AdbKeyPair.read(adbKeyFile.first, adbKeyFile.second);
Toast.makeText(this, getString(R.string.adb_key_button_code), Toast.LENGTH_SHORT).show();
} catch (Exception ignored) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
import top.saymzx.easycontrol.app.databinding.ItemTextBinding;
import top.saymzx.easycontrol.app.entity.AppData;
import top.saymzx.easycontrol.app.helper.PublicTools;
import top.saymzx.easycontrol.app.helper.ViewTools;

public class IpActivity extends Activity {
private ActivityIpBinding ipActivity;

@Override
public void onCreate(Bundle savedInstanceState) {
PublicTools.setStatusAndNavBar(this);
PublicTools.setLocale(this);
ViewTools.setStatusAndNavBar(this);
ViewTools.setLocale(this);
ipActivity = ActivityIpBinding.inflate(this.getLayoutInflater());
setContentView(ipActivity.getRoot());
setButtonListener();
Expand All @@ -35,14 +36,14 @@ private void drawUi() {
Pair<ArrayList<String>, ArrayList<String>> listPair = PublicTools.getIp();
Context context = this;
for (String i : listPair.first) {
ItemTextBinding text = PublicTools.createTextCard(context, i, () -> {
ItemTextBinding text = ViewTools.createTextCard(context, i, () -> {
AppData.clipBoard.setPrimaryClip(ClipData.newPlainText(ClipDescription.MIMETYPE_TEXT_PLAIN, i));
Toast.makeText(context, getString(R.string.ip_copy), Toast.LENGTH_SHORT).show();
});
ipActivity.ipv4.addView(text.getRoot());
}
for (String i : listPair.second) {
ItemTextBinding text = PublicTools.createTextCard(context, i, () -> {
ItemTextBinding text = ViewTools.createTextCard(context, i, () -> {
AppData.clipBoard.setPrimaryClip(ClipData.newPlainText(ClipDescription.MIMETYPE_TEXT_PLAIN, i));
Toast.makeText(context, getString(R.string.ip_copy), Toast.LENGTH_SHORT).show();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import top.saymzx.easycontrol.app.helper.DeviceListAdapter;
import top.saymzx.easycontrol.app.helper.MyBroadcastReceiver;
import top.saymzx.easycontrol.app.helper.PublicTools;
import top.saymzx.easycontrol.app.helper.ViewTools;

public class MainActivity extends Activity {
// 设备列表
Expand All @@ -32,8 +33,8 @@ public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
AppData.init(this);
PublicTools.setStatusAndNavBar(this);
PublicTools.setLocale(this);
ViewTools.setStatusAndNavBar(this);
ViewTools.setLocale(this);
mainActivity = ActivityMainBinding.inflate(this.getLayoutInflater());
setContentView(mainActivity.getRoot());
// 检测激活
Expand All @@ -49,7 +50,7 @@ public void onCreate(Bundle savedInstanceState) {
// 检查已连接设备
myBroadcastReceiver.checkConnectedUsb(this);
// 启动默认设备
AppData.uiHandler.postDelayed(myBroadcastReceiver::startDefault, 1000);
AppData.uiHandler.postDelayed(() -> myBroadcastReceiver.startDefault(this), 1000);
super.onCreate(savedInstanceState);
}

Expand Down Expand Up @@ -87,7 +88,7 @@ private void checkPermission() {

// 设置按钮监听
private void setButtonListener() {
mainActivity.buttonAdd.setOnClickListener(v -> PublicTools.createAddDeviceView(this, Device.getDefaultDevice(UUID.randomUUID().toString(), Device.TYPE_NORMAL), deviceListAdapter).show());
mainActivity.buttonAdd.setOnClickListener(v -> ViewTools.createAddDeviceView(this, Device.getDefaultDevice(UUID.randomUUID().toString(), Device.TYPE_NORMAL), deviceListAdapter).show());
mainActivity.buttonSet.setOnClickListener(v -> startActivity(new Intent(this, SetActivity.class)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import top.saymzx.easycontrol.app.databinding.ActivitySetBinding;
import top.saymzx.easycontrol.app.entity.AppData;
import top.saymzx.easycontrol.app.helper.PublicTools;
import top.saymzx.easycontrol.app.helper.ViewTools;

public class SetActivity extends Activity {
private ActivitySetBinding setActivity;

@Override
public void onCreate(Bundle savedInstanceState) {
PublicTools.setStatusAndNavBar(this);
PublicTools.setLocale(this);
ViewTools.setStatusAndNavBar(this);
ViewTools.setLocale(this);
setActivity = ActivitySetBinding.inflate(this.getLayoutInflater());
setContentView(setActivity.getRoot());
// 设置页面
Expand All @@ -27,33 +28,34 @@ public void onCreate(Bundle savedInstanceState) {
// 设置默认值
private void drawUi() {
// 默认参数
PublicTools.createDeviceOptionSet(this, setActivity.setDefault, null);
ViewTools.createDeviceOptionSet(this, setActivity.setDefault, null);
// 显示
setActivity.setDisplay.addView(PublicTools.createSwitchCard(this, getString(R.string.set_display_keep_screen_awake), getString(R.string.set_display_keep_screen_awake_detail), AppData.setting.getKeepAwake(), isChecked -> AppData.setting.setKeepAwake(isChecked)).getRoot());
setActivity.setDisplay.addView(PublicTools.createSwitchCard(this, getString(R.string.set_display_auto_back_on_start_default), getString(R.string.set_display_auto_back_on_start_default_detail), AppData.setting.getAutoBackOnStartDefault(), isChecked -> AppData.setting.setAutoBackOnStartDefault(isChecked)).getRoot());
setActivity.setDisplay.addView(PublicTools.createSwitchCard(this, getString(R.string.set_display_default_mini_on_outside), getString(R.string.set_display_default_mini_on_outside_detail), AppData.setting.getAutoMiniOnOutside(), isChecked -> AppData.setting.setAutoMiniOnOutside(isChecked)).getRoot());
setActivity.setDisplay.addView(PublicTools.createSwitchCard(this, getString(R.string.set_display_default_show_nav_bar), getString(R.string.set_display_default_show_nav_bar_detail), AppData.setting.getDefaultShowNavBar(), isChecked -> AppData.setting.setDefaultShowNavBar(isChecked)).getRoot());
setActivity.setDisplay.addView(ViewTools.createSwitchCard(this, getString(R.string.set_display_auto_wake), getString(R.string.set_display_auto_wake_detail), AppData.setting.getAutoWake(), isChecked -> AppData.setting.setAutoWake(isChecked)).getRoot());
setActivity.setDisplay.addView(ViewTools.createSwitchCard(this, getString(R.string.set_display_keep_screen_awake), getString(R.string.set_display_keep_screen_awake_detail), AppData.setting.getKeepAwake(), isChecked -> AppData.setting.setKeepAwake(isChecked)).getRoot());
setActivity.setDisplay.addView(ViewTools.createSwitchCard(this, getString(R.string.set_display_auto_back_on_start_default), getString(R.string.set_display_auto_back_on_start_default_detail), AppData.setting.getAutoBackOnStartDefault(), isChecked -> AppData.setting.setAutoBackOnStartDefault(isChecked)).getRoot());
setActivity.setDisplay.addView(ViewTools.createSwitchCard(this, getString(R.string.set_display_default_mini_on_outside), getString(R.string.set_display_default_mini_on_outside_detail), AppData.setting.getAutoMiniOnOutside(), isChecked -> AppData.setting.setAutoMiniOnOutside(isChecked)).getRoot());
setActivity.setDisplay.addView(ViewTools.createSwitchCard(this, getString(R.string.set_display_default_show_nav_bar), getString(R.string.set_display_default_show_nav_bar_detail), AppData.setting.getDefaultShowNavBar(), isChecked -> AppData.setting.setDefaultShowNavBar(isChecked)).getRoot());
// 其他
setActivity.setOther.addView(PublicTools.createTextCard(this, getString(R.string.set_about_ip), () -> startActivity(new Intent(this, IpActivity.class))).getRoot());
setActivity.setOther.addView(PublicTools.createTextCard(this, getString(R.string.set_other_clear_default), () -> {
setActivity.setOther.addView(ViewTools.createTextCard(this, getString(R.string.set_about_ip), () -> startActivity(new Intent(this, IpActivity.class))).getRoot());
setActivity.setOther.addView(ViewTools.createTextCard(this, getString(R.string.set_other_clear_default), () -> {
AppData.setting.setDefaultDevice("");
Toast.makeText(this, getString(R.string.set_other_clear_default_code), Toast.LENGTH_SHORT).show();
}).getRoot());
setActivity.setOther.addView(PublicTools.createTextCard(this, getString(R.string.set_other_custom_key), () -> startActivity(new Intent(this, AdbKeyActivity.class))).getRoot());
setActivity.setOther.addView(PublicTools.createTextCard(this, getString(R.string.set_other_clear_key), () -> {
AppData.reGenerateAdbKeyPair(this);
setActivity.setOther.addView(ViewTools.createTextCard(this, getString(R.string.set_other_custom_key), () -> startActivity(new Intent(this, AdbKeyActivity.class))).getRoot());
setActivity.setOther.addView(ViewTools.createTextCard(this, getString(R.string.set_other_clear_key), () -> {
AppData.keyPair=PublicTools.reGenerateAdbKeyPair();
Toast.makeText(this, getString(R.string.set_other_clear_key_code), Toast.LENGTH_SHORT).show();
}).getRoot());
setActivity.setOther.addView(PublicTools.createTextCard(this, getString(R.string.set_other_locale), () -> {
setActivity.setOther.addView(ViewTools.createTextCard(this, getString(R.string.set_other_locale), () -> {
AppData.setting.setDefaultLocale(!AppData.setting.getDefaultLocale().equals("zh") ? "zh" : "en");
Toast.makeText(this, getString(R.string.set_other_locale_code), Toast.LENGTH_SHORT).show();
}).getRoot());
// 关于
setActivity.setAbout.addView(PublicTools.createTextCard(this, getString(R.string.set_about_active), () -> startActivity(new Intent(this, ActiveActivity.class))).getRoot());
setActivity.setAbout.addView(PublicTools.createTextCard(this, getString(R.string.set_about_website), () -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol")).getRoot());
setActivity.setAbout.addView(PublicTools.createTextCard(this, getString(R.string.set_about_how_to_use), () -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/blob/master/HOW_TO_USE.md")).getRoot());
setActivity.setAbout.addView(PublicTools.createTextCard(this, getString(R.string.set_about_privacy), () -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/blob/master/PRIVACY.md")).getRoot());
setActivity.setAbout.addView(PublicTools.createTextCard(this, getString(R.string.set_about_version) + BuildConfig.VERSION_NAME, () -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/releases")).getRoot());
setActivity.setAbout.addView(ViewTools.createTextCard(this, getString(R.string.set_about_active), () -> startActivity(new Intent(this, ActiveActivity.class))).getRoot());
setActivity.setAbout.addView(ViewTools.createTextCard(this, getString(R.string.set_about_website), () -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol")).getRoot());
setActivity.setAbout.addView(ViewTools.createTextCard(this, getString(R.string.set_about_how_to_use), () -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/blob/master/HOW_TO_USE.md")).getRoot());
setActivity.setAbout.addView(ViewTools.createTextCard(this, getString(R.string.set_about_privacy), () -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/blob/master/PRIVACY.md")).getRoot());
setActivity.setAbout.addView(ViewTools.createTextCard(this, getString(R.string.set_about_version) + BuildConfig.VERSION_NAME, () -> PublicTools.startUrl(this, "https://gitee.com/mingzhixianweb/easycontrol/releases")).getRoot());
}

// 设置按钮监听
Expand Down
Loading

0 comments on commit c917d20

Please sign in to comment.