Skip to content

Commit

Permalink
更新V1.4.2
Browse files Browse the repository at this point in the history
三八妇女节,祝女同胞万事顺利,幸福美满!(虽然可能没有女孩子在用易控)

- 修复经常白屏的问题
- 细调UI,较少误触,提高拖动概率,修改部分元素间距与大小
- 修复解码器优选模块问题,适配未知解码器
- 修复无法自动切换隧道连接的问题
- 修复部分设备无法恢复背光的问题
- 支持发送文件
- 支持设置默认使用易控打开有线设备,避免每次插入后手动授权
- 修复因无法直连导致延迟增加的问题
- 支持ADB复用,降低启动时间,减少资源占用
- 支持单应用投屏
- 优化代码结构

- 旋转被控端屏幕存在问题
  • Loading branch information
mingzhixian committed Mar 7, 2024
1 parent 7666fb6 commit 991295d
Show file tree
Hide file tree
Showing 69 changed files with 1,454 additions and 868 deletions.
14 changes: 10 additions & 4 deletions HOW_TO_USE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
- 域名:ex.com:5555
5. 点击刚添加的新设备,被控端授权允许主控端连接(请勾选一律允许)

3. 单应用投屏
1. 连接普通的镜像投屏后,打开某一个软件,点击工具栏中的向外分离的图标,将当前应用分离出来进行投屏
2. 也可以在设备设置页面,在设备的地址后面加上“#包名”,如“192.168.43.1:5555#com.baidu.BaiduMap”
3. 单应用投屏后,若在主屏幕打开对应应用,因系统不同而出现不同的情况,有可能软件会切回到主屏幕,单应用投屏的画面会卡主,也有可能会无反应
4. 单应用投屏时,如果该应用崩溃,或多次返回导致软件退出等,画面会卡在最后一帧,属于正常现象

3. 界面使用
1. 工具栏
- 在小窗模式下点击上横条,可查看工具栏
Expand Down Expand Up @@ -62,6 +68,9 @@
- 启动目标设备:
- action:start
- uuid:设备ID
- 目标设备关闭投屏:
- action:close
- uuid:设备ID
- 目标设备变成小窗:
- action:changeToSmall
- uuid:设备ID
Expand Down Expand Up @@ -98,11 +107,8 @@
- 目标设备旋转屏幕:
- action:buttonRotate
- uuid:设备ID
- 目标设备关闭投屏:
- action:close
- uuid:设备ID
- 目标设备执行命令:
- action:runShell
- uuid:设备ID
- cmd: 命令
- uuid:设备ID
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
## 附加
- ADB协议说明(官方的文档写的真烂,感谢cstyan大佬) [点击前往](https://github.com/cstyan/adbDocumentation)
- Scrcpy官方地址 [点击前往](https://github.com/Genymobile/scrcpy)
- 第三方修改本(专为车机进行了优化) [点击前往](https://github.com/eiyooooo/Easycontrol_For_Car)
- 易控车机版(第三方用户专为车机进行了调整优化) [点击前往](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 10376
versionName "1.3.76"
versionCode 10402
versionName "1.4.2"
ndk {
abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64"
}
Expand Down
28 changes: 24 additions & 4 deletions easycontrol/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 悬浮窗 -->
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- WIFI状态 -->
<uses-permission android:name="android.permission.USB_PERMISSION" /> <!-- USB -->
<uses-feature android:name="android.hardware.usb.host" />

<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />

<application
android:icon="${app_icon}"
android:installLocation="internalOnly"
Expand All @@ -17,14 +21,20 @@
android:supportsRtl="true"
android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar"
android:usesCleartextTraffic="true">

<activity
android:name=".MainActivity"
android:exported="true">
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>
<activity
android:name=".DeviceDetailActivity"
Expand All @@ -37,14 +47,24 @@
android:exported="false" />
<activity
android:name=".client.view.FullActivity"
android:exported="false"
android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen" />
android:exported="false" />
<activity
android:name=".AdbKeyActivity"
android:exported="false" />
<activity
android:name=".ActiveActivity"
android:exported="false" />
<activity
android:name=".UsbActivity"
android:exported="false">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>

<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package top.saymzx.easycontrol.app;

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 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;
Expand Down Expand Up @@ -39,11 +41,11 @@ private void setButtonListener() {
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);
Pair<ItemLoadingBinding, Dialog> loading = ViewTools.createLoading(this);
loading.second.show();
new Thread(() -> {
boolean isOk = ActiveHelper.active(activeKey);
AppData.windowManager.removeView(loading.first);
loading.second.cancel();
AppData.uiHandler.post(() -> {
if (isOk) {
finish();
Expand All @@ -58,11 +60,11 @@ private void setButtonListener() {

// 取消激活
private void deactivate() {
Pair<View, WindowManager.LayoutParams> loading = ViewTools.createLoading(this);
AppData.windowManager.addView(loading.first, loading.second);
Pair<ItemLoadingBinding, Dialog> loading = ViewTools.createLoading(this);
loading.second.show();
new Thread(() -> {
boolean isOk = ActiveHelper.deactivate(AppData.setting.getActiveKey());
AppData.windowManager.removeView(loading.first);
loading.second.cancel();
AppData.uiHandler.post(() -> {
if (isOk) {
AppData.setting.setIsActive(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
package top.saymzx.easycontrol.app;

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

import java.util.ArrayList;
import java.util.UUID;

import top.saymzx.easycontrol.app.databinding.ActivityDeviceDetailBinding;
import top.saymzx.easycontrol.app.databinding.ItemLoadingBinding;
import top.saymzx.easycontrol.app.databinding.ItemScanAddressListBinding;
import top.saymzx.easycontrol.app.databinding.ItemTextBinding;
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.PublicTools;
import top.saymzx.easycontrol.app.helper.ViewTools;

public class DeviceDetailActivity extends Activity {
Expand Down Expand Up @@ -54,7 +62,6 @@ private void drawUI() {
// 预填写参数
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));
Expand Down Expand Up @@ -93,9 +100,11 @@ private void drawUI() {
// 设置监听
private void setListener() {
activityDeviceDetailBinding.backButton.setOnClickListener(v -> finish());
activityDeviceDetailBinding.buttonScan.setOnClickListener(v -> scanAddress());
// 设置确认按钮监听
activityDeviceDetailBinding.ok.setOnClickListener(v -> {
if (device.isNetworkDevice() && String.valueOf(activityDeviceDetailBinding.address.getText()).equals("")) return;
String name = String.valueOf(activityDeviceDetailBinding.address.getText());
if (name.equals("----") || name.equals("")) return;
device.name = String.valueOf(activityDeviceDetailBinding.name.getText());
device.address = String.valueOf(activityDeviceDetailBinding.address.getText());
// 自定义分辨率
Expand All @@ -116,4 +125,26 @@ private void setListener() {
finish();
});
}

// 扫描局域网地址
private void scanAddress() {
Pair<ItemLoadingBinding, Dialog> loading = ViewTools.createLoading(this);
loading.second.show();
new Thread(() -> {
ArrayList<String> scannedAddresses = PublicTools.scanAddress();
loading.second.cancel();
AppData.uiHandler.post(() -> {
ItemScanAddressListBinding scanAddressListView = ItemScanAddressListBinding.inflate(LayoutInflater.from(this));
Dialog dialog = ViewTools.createDialog(this, true, scanAddressListView.getRoot());
for (String i : scannedAddresses) {
ItemTextBinding text = ViewTools.createTextCard(this, i, () -> {
activityDeviceDetailBinding.address.setText(i);
dialog.cancel();
});
scanAddressListView.list.addView(text.getRoot());
}
dialog.show();
});
}).start();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,33 @@
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ContentResolver;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.OpenableColumns;
import android.provider.Settings;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;

import java.util.ArrayList;
import java.io.IOException;
import java.io.InputStream;

import top.saymzx.easycontrol.app.client.Client;
import top.saymzx.easycontrol.app.client.tools.AdbTools;
import top.saymzx.easycontrol.app.databinding.ActivityMainBinding;
import top.saymzx.easycontrol.app.databinding.ItemRequestPermissionBinding;
import top.saymzx.easycontrol.app.databinding.ItemScanAddressListBinding;
import top.saymzx.easycontrol.app.databinding.ItemTextBinding;
import top.saymzx.easycontrol.app.entity.AppData;
import top.saymzx.easycontrol.app.entity.Device;
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 {

private ActivityMainBinding activityMainBinding;
public DeviceListAdapter deviceListAdapter;

// 广播
private final MyBroadcastReceiver myBroadcastReceiver = new MyBroadcastReceiver();
Expand Down Expand Up @@ -60,17 +59,19 @@ private void startApp() {
// 检测激活
checkActive();
// 设置设备列表适配器
DeviceListAdapter deviceListAdapter = new DeviceListAdapter(this);
deviceListAdapter = new DeviceListAdapter(this);
activityMainBinding.devicesList.setAdapter(deviceListAdapter);
myBroadcastReceiver.setDeviceListAdapter(deviceListAdapter);
// 设置按钮监听
setButtonListener();
// 注册广播监听
myBroadcastReceiver.register(this);
// 检查已连接设备
myBroadcastReceiver.checkConnectedUsb(this);
// 重置已连接设备
myBroadcastReceiver.resetUSB();
// 自启动设备
AppData.uiHandler.postDelayed(deviceListAdapter::startDefaultDevice, 1000);
AppData.uiHandler.postDelayed(() -> {
for (Device device : AdbTools.devicesList) if (device.connectOnStart) Client.startDevice(device);
}, 2000);
}

// 检测激活
Expand Down Expand Up @@ -116,31 +117,35 @@ private void checkPermissionDelay(Dialog dialog) {

// 设置按钮监听
private void setButtonListener() {
activityMainBinding.buttonScan.setOnClickListener(v -> scanAddress());
activityMainBinding.buttonAdd.setOnClickListener(v -> startActivity(new Intent(this, DeviceDetailActivity.class)));
activityMainBinding.buttonSet.setOnClickListener(v -> startActivity(new Intent(this, SetActivity.class)));
}

// 扫描局域网地址
private void scanAddress() {
Pair<View, WindowManager.LayoutParams> loading = ViewTools.createLoading(this);
AppData.windowManager.addView(loading.first, loading.second);
new Thread(() -> {
ArrayList<String> scannedAddresses = PublicTools.scanAddress();
AppData.windowManager.removeView(loading.first);
AppData.uiHandler.post(() -> {
ItemScanAddressListBinding scanAddressListView = ItemScanAddressListBinding.inflate(LayoutInflater.from(this));
Dialog dialog = ViewTools.createDialog(this, true, scanAddressListView.getRoot());
for (String i : scannedAddresses) {
ItemTextBinding text = ViewTools.createTextCard(this, i, () -> {
AppData.clipBoard.setPrimaryClip(ClipData.newPlainText(ClipDescription.MIMETYPE_TEXT_PLAIN, i));
Toast.makeText(this, getString(R.string.toast_copy), Toast.LENGTH_SHORT).show();
});
scanAddressListView.list.addView(text.getRoot());
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == 1) {
Uri uri = data.getData();
if (uri == null) deviceListAdapter.pushFile(null, null);
;
try {
String fileName = "easycontrol_push_file";
ContentResolver contentProvider = getContentResolver();
InputStream inputStream = contentProvider.openInputStream(uri);
//根据Uri查询文件名
try (Cursor cursor = contentProvider.query(uri, null, null, null, null)) {
if (cursor != null) {
cursor.moveToFirst();
int nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
fileName = cursor.getString(nameIndex);
}
}
dialog.show();
});
}).start();
deviceListAdapter.pushFile(inputStream, fileName);
} catch (IOException ignored) {
deviceListAdapter.pushFile(null, null);
;
}
}
super.onActivityResult(requestCode, resultCode, data);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package top.saymzx.easycontrol.app;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import top.saymzx.easycontrol.app.helper.MyBroadcastReceiver;

public class UsbActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent();
intent.setAction(MyBroadcastReceiver.ACTION_UPDATE_USB);
sendBroadcast(intent);
startActivity(new Intent(this, MainActivity.class));
finish();
}
}
Loading

0 comments on commit 991295d

Please sign in to comment.