Merge pull request #691 from Heap-Hop/master

Update Mobile
This commit is contained in:
RustDesk 2022-06-02 18:09:03 +08:00 committed by GitHub
commit e07b56b646
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 5 deletions

View File

@ -1,5 +1,11 @@
package com.carriez.flutter_hbb
/**
* Handle remote input and dispatch android gesture
*
* Inspired by [droidVNC-NG] https://github.com/bk138/droidVNC-NG
*/
import android.accessibilityservice.AccessibilityService
import android.accessibilityservice.GestureDescription
import android.content.Context

View File

@ -1,5 +1,12 @@
package com.carriez.flutter_hbb
/**
* Handle events from flutter
* Request MediaProjection permission
*
* Inspired by [droidVNC-NG] https://github.com/bk138/droidVNC-NG
*/
import android.app.Activity
import android.content.ComponentName
import android.content.Context

View File

@ -1,8 +1,11 @@
package com.carriez.flutter_hbb
/**
* Capture screen,get video and audio,send to rust.
* Handle notification
* Dispatch notifications
*
* Inspired by [droidVNC-NG] https://github.com/bk138/droidVNC-NG
*/
package com.carriez.flutter_hbb
import android.Manifest
import android.annotation.SuppressLint

View File

@ -168,6 +168,7 @@ class FfiModel with ChangeNotifier {
}
void handleSwitchDisplay(Map<String, dynamic> evt) {
final oldOrientation = _display.width > _display.height;
var old = _pi.currentDisplay;
_pi.currentDisplay = int.parse(evt['display']);
_display.x = double.parse(evt['x']);
@ -176,6 +177,11 @@ class FfiModel with ChangeNotifier {
_display.height = int.parse(evt['height']);
if (old != _pi.currentDisplay)
FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y);
// remote is mobile, and orientation changed
if ((_display.width > _display.height) != oldOrientation) {
FFI.canvasModel.updateViewStyle();
}
notifyListeners();
}

View File

@ -33,6 +33,7 @@ class _RemotePageState extends State<RemotePage> {
String _value = '';
double _scale = 1;
double _mouseScrollIntegral = 0; // mouse scroll speed controller
Orientation? _currentOrientation;
var _more = true;
var _fn = false;
@ -258,12 +259,22 @@ class _RemotePageState extends State<RemotePage> {
color: Colors.black,
child: isDesktop
? getBodyForDesktopWithListener(keyboard)
: SafeArea(
child: Container(
: SafeArea(child:
OrientationBuilder(builder: (ctx, orientation) {
if (_currentOrientation != orientation) {
debugPrint("on orientation changed");
Timer(Duration(milliseconds: 200), () {
resetMobileActionsOverlay();
_currentOrientation = orientation;
FFI.canvasModel.updateViewStyle();
});
}
return Container(
color: MyTheme.canvasColor,
child: _isPhysicalMouse
? getBodyForMobile()
: getBodyForMobileWithGesture())));
: getBodyForMobileWithGesture());
})));
})
],
))),

View File

@ -228,6 +228,12 @@ class DraggableMobileActions extends StatelessWidget {
}
}
resetMobileActionsOverlay() {
if (mobileActionsOverlayEntry == null) return;
hideMobileActionsOverlay();
showMobileActionsOverlay();
}
showMobileActionsOverlay() {
if (mobileActionsOverlayEntry != null) return;
if (globalKey.currentContext == null ||