Giter VIP home page Giter VIP logo

Comments (4)

Zebartin avatar Zebartin commented on June 19, 2024

应该是因为安卓版本比较新的原因,我手上的设备版本比较老所以没遇到过,我研究一下怎么改正。

应急的话可以这么处理:编辑utils.js,把第110行里的isLandscape改成false,把100-109行删掉

function requestScreenCaptureAuto() {
  //安卓版本高于Android 9
  if (device.sdkInt > 28) {
    //等待截屏权限申请并同意
    threads.start(function () {
      packageName('com.android.systemui').text('允许').waitFor();
      text('允许').click();
    });
  }
-  // 检查屏幕方向
-  let rotation = context.getDisplay().getRotation();
-  // 旋转0度/180度,为竖屏
-  // 对平板/宽屏来说,竖屏时横边长,竖边短
-  if (rotation == android.view.Surface.ROTATION_0 ||
-    rotation == android.view.Surface.ROTATION_180)
-    isLandscape = false;
-  else
-    isLandscape = true
-  toastLog(`申请截屏权限:${isLandscape ? '横' : '竖'}屏`);
-  if (!requestScreenCapture(isLandscape)) {
+  if (!requestScreenCapture(false)) {
    log("请求截图失败");
    exit();
  }
}

from autoxjs-scripts.

Zebartin avatar Zebartin commented on June 19, 2024

因为我手头上没有合适的设备,所以如果方便的话,需要麻烦你帮忙调试一下

新建一个空白脚本,内容填上:

toastLog(context.getResources().getConfiguration().orientation);

运行一下,看看有没有报错。没有的话,正常情况下,手机竖屏的时候会显示1,横屏的时候会显示2

from autoxjs-scripts.

Platanus04 avatar Platanus04 commented on June 19, 2024

utils.js编辑后已解决,横屏检测运行正常
1676002153371

from autoxjs-scripts.

Zebartin avatar Zebartin commented on June 19, 2024

好的,谢谢,之后我就照着新方式改了

from autoxjs-scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.