|
|
@@ -74,6 +74,7 @@ import com.hjq.permissions.Permission;
|
|
|
import com.hjq.permissions.XXPermissions;
|
|
|
import java.util.List;
|
|
|
import com.hjq.toast.Toaster;
|
|
|
+import com.blankj.utilcode.util.BarUtils;
|
|
|
|
|
|
|
|
|
public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCallbacks, SensorEventListener {
|
|
|
@@ -117,11 +118,13 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
static final int GOT_REMOTE_LOG_PROCEDURE_END = 9;
|
|
|
static final int GOT_REMOTE_LOG_PROCEDURE_START = 10;
|
|
|
|
|
|
+ private static final String LOG_TAG = "TelephonyManagerSub";
|
|
|
+
|
|
|
Handler mainHandler = new Handler(new Handler.Callback() {
|
|
|
@Override
|
|
|
public boolean handleMessage(Message message) {
|
|
|
int what = message.what;
|
|
|
- Log.e("scrcpy"," handle message "+what);
|
|
|
+ Log.e(LOG_TAG," handle message "+what);
|
|
|
if(what == ADB_CONNECT_START){
|
|
|
showProgress();
|
|
|
mainHandler.sendEmptyMessageDelayed(ADB_CONNECT_REAL_START,500);
|
|
|
@@ -264,6 +267,10 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ View decorView = getWindow().getDecorView();
|
|
|
+ decorView.setOnSystemUiVisibilityChangeListener(visibility -> BarUtils.setNavBarVisibility(MainActivity.this, false));
|
|
|
+ BarUtils.setStatusBarVisibility(MainActivity.this, false);
|
|
|
+
|
|
|
if (first_time) {
|
|
|
scrcpy_main();
|
|
|
} else {
|
|
|
@@ -309,7 +316,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
public void onMessageEvent(MessageEvent event) {
|
|
|
//Log.e("Scrcpy: ","activity DownloadTaskDialog onMessageEvent "+event.what);
|
|
|
if(event.what == MessageEvent.EVENT_GOT_REMOTE_VERSION){
|
|
|
- Log.e("Scrcpy1","onMessageEvent "+landscape);
|
|
|
+ Log.e(LOG_TAG,"onMessageEvent "+landscape);
|
|
|
if(!landscape){//机器是竖屏的,在此显示悬浮窗
|
|
|
showFloatViewWhenRender();
|
|
|
}
|
|
|
@@ -321,7 +328,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
}
|
|
|
|
|
|
private void showProgress(){
|
|
|
- Log.e("scrcpy","Asset showProgress");
|
|
|
+ Log.e(LOG_TAG,"Asset showProgress");
|
|
|
mainProgressDialog = new ProgressDialog(context);
|
|
|
mainProgressDialog.setTitle("提示");
|
|
|
mainProgressDialog.setMessage("正在连接公司设备...");
|
|
|
@@ -345,7 +352,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
@SuppressLint("SourceLockedOrientationActivity")
|
|
|
public void scrcpy_main(){
|
|
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
|
- Log.e("Scrcpy1","scrcpy_main");
|
|
|
+ Log.e(LOG_TAG,"scrcpy_main");
|
|
|
setContentView(R.layout.activity_main);
|
|
|
final Button startButton = findViewById(R.id.button_start);
|
|
|
AssetManager assetManager = getAssets();
|
|
|
@@ -355,7 +362,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
input_Stream.read(buffer);
|
|
|
fileBase64 = Base64.encode(buffer, 2);
|
|
|
} catch (IOException e) {
|
|
|
- Log.e("Asset Manager", e.getMessage());
|
|
|
+ Log.e(LOG_TAG,"Asset Manager "+e.getMessage());
|
|
|
}
|
|
|
sendCommands = new SendCommands(mainHandler);
|
|
|
|
|
|
@@ -431,7 +438,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
}
|
|
|
float remote_device_aspect_ratio = remote_device_height/remote_device_width;
|
|
|
|
|
|
- Log.e("Scrcpy1","set_display_nd_touch "+landscape);
|
|
|
+ Log.e(LOG_TAG,"set_display_nd_touch "+landscape);
|
|
|
//改变渲染的边距
|
|
|
if (!landscape) { //Portrait
|
|
|
float this_device_aspect_ratio = this_dev_height/this_dev_width;
|
|
|
@@ -539,7 +546,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
|
private void start_screen_copy_magic() {
|
|
|
- Log.e("Scrcpy1","start_screen_copy_magic");
|
|
|
+ Log.e(LOG_TAG,"start_screen_copy_magic");
|
|
|
setContentView(R.layout.surface);//开始渲染
|
|
|
final View decorView = getWindow().getDecorView();
|
|
|
decorView.setSystemUiVisibility(
|
|
|
@@ -609,7 +616,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
@Override
|
|
|
public void loadNewRotation() {
|
|
|
hideProgress();//横屏机器需要在此隐藏进度对话框
|
|
|
- Log.e("Scrcpy1","loadNewRotation "+first_time);
|
|
|
+ Log.e(LOG_TAG,"loadNewRotation "+first_time);
|
|
|
if (first_time){
|
|
|
int[] rem_res = scrcpy.get_remote_device_resolution();
|
|
|
remote_device_height = rem_res[1];
|
|
|
@@ -631,7 +638,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
@Override
|
|
|
protected void onPause() {
|
|
|
super.onPause();
|
|
|
- Log.e("Scrcpy1","onPause "+first_time);
|
|
|
+ Log.e(LOG_TAG,"onPause "+first_time);
|
|
|
EventBus.getDefault().unregister(this);
|
|
|
|
|
|
if (serviceBound) {
|
|
|
@@ -642,7 +649,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
|
|
|
@Override
|
|
|
protected void onResume() {
|
|
|
super.onResume();
|
|
|
- Log.e("Scrcpy1","onResume "+first_time);
|
|
|
+ Log.e(LOG_TAG,"onResume "+first_time);
|
|
|
EventBus.getDefault().register(this);
|
|
|
|
|
|
if (!first_time && !result_of_Rotation) {
|