feat(autojs): requestScreenCapture() supports changing orientation automatically and dynamically
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.stardust.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Point;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
@@ -44,6 +45,22 @@ public class ScreenMetrics {
|
||||
return deviceScreenDensity;
|
||||
}
|
||||
|
||||
public static int getOrientationAwareScreenWidth(int orientation) {
|
||||
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
return getDeviceScreenHeight();
|
||||
} else {
|
||||
return getDeviceScreenWidth();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getOrientationAwareScreenHeight(int orientation) {
|
||||
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
return getDeviceScreenWidth();
|
||||
} else {
|
||||
return getDeviceScreenHeight();
|
||||
}
|
||||
}
|
||||
|
||||
public static int scaleX(int x, int width) {
|
||||
if (width == 0 || !initialized)
|
||||
return x;
|
||||
|
||||
Reference in New Issue
Block a user