mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-21 21:01:43 +08:00
release 2.0.13 Beta3 for YingYongBao
This commit is contained in:
parent
a660a98539
commit
c6e31dcb41
@ -147,7 +147,12 @@ public class Pref {
|
||||
def().edit().putLong(KEY_LAST_SHOW_AD_MILLIS, System.currentTimeMillis()).apply();
|
||||
return true;
|
||||
case "Off":
|
||||
return false;
|
||||
lastShowMillis = def().getLong(KEY_LAST_SHOW_AD_MILLIS, 0);
|
||||
if (System.currentTimeMillis() - lastShowMillis < TimeUnit.DAYS.toMillis(2)) {
|
||||
return false;
|
||||
}
|
||||
def().edit().putLong(KEY_LAST_SHOW_AD_MILLIS, System.currentTimeMillis()).apply();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.stardust.scriptdroid.script;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.stardust.autojs.execution.ExecutionConfig;
|
||||
@ -69,7 +70,7 @@ public class Scripts {
|
||||
public static void createShortcut(ScriptFile scriptFile) {
|
||||
new Shortcut(App.getApp()).name(scriptFile.getSimplifiedName())
|
||||
.targetClass(ShortcutActivity.class)
|
||||
.icon(R.drawable.ic_node_js_black)
|
||||
.iconRes(R.drawable.ic_node_js_black)
|
||||
.extras(new Intent().putExtra(CommonUtils.EXTRA_KEY_PATH, scriptFile.getPath()))
|
||||
.send();
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.qq.e.comm.DownloadService;
|
||||
import com.stardust.app.FragmentPagerAdapterBuilder;
|
||||
import com.stardust.app.NotAskAgainDialog;
|
||||
import com.stardust.app.OnActivityResultDelegate;
|
||||
@ -103,6 +104,8 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
EventBus.getDefault().register(this);
|
||||
mVersionGuard = new VersionGuard(this);
|
||||
showAnnunciationIfNeeded();
|
||||
//Stop download service of ad sdk
|
||||
stopService(new Intent(this, DownloadService.class));
|
||||
}
|
||||
|
||||
@AfterViews
|
||||
|
||||
@ -224,7 +224,7 @@
|
||||
<string-array name="ad_showing_mode_keys">
|
||||
<item>默认</item>
|
||||
<item>每天显示一次</item>
|
||||
<item>不显示</item>
|
||||
<item>两天显示一次</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="ad_showing_mode_values">
|
||||
|
||||
@ -10,6 +10,10 @@ module.exports = function(__runtime__, scope){
|
||||
|
||||
images.saveImage = __runtime__.images.saveImage.bind(__runtime__.images);
|
||||
|
||||
images.pixel = __runtime__.images.pixel;
|
||||
|
||||
images.detectsColor = __runtime__.images.detectsColor.bind(__runtime__.images);
|
||||
|
||||
images.findColor = function(img, color, options){
|
||||
if(typeof(color) == 'string'){
|
||||
if(color.startsWith('#')){
|
||||
|
||||
@ -5,15 +5,11 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.media.Image;
|
||||
import android.media.ImageReader;
|
||||
import android.media.ImageWriter;
|
||||
import android.media.MediaCodec;
|
||||
import android.os.Build;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.view.Surface;
|
||||
|
||||
import com.stardust.autojs.runtime.AbstractScriptRuntime;
|
||||
import com.stardust.autojs.runtime.ScriptInterruptedException;
|
||||
@ -29,7 +25,7 @@ import java.nio.ByteBuffer;
|
||||
/**
|
||||
* Created by Stardust on 2017/5/20.
|
||||
*/
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
public class Images {
|
||||
|
||||
private AbstractScriptRuntime mScriptRuntime;
|
||||
@ -109,13 +105,28 @@ public class Images {
|
||||
public static int pixel(Image image, int x, int y) {
|
||||
Image.Plane plane = image.getPlanes()[0];
|
||||
int offset = y * plane.getRowStride() + x * plane.getPixelStride();
|
||||
return plane.getBuffer().getInt(offset);
|
||||
int c = plane.getBuffer().getInt(offset);
|
||||
return (c & 0xff000000) + ((c & 0xff) << 16) + (c & 0x00ff00) + ((c & 0xff0000) >> 16);
|
||||
}
|
||||
|
||||
public static int pixel(Bitmap bitmap, int x, int y) {
|
||||
return bitmap.getPixel(x, y);
|
||||
}
|
||||
|
||||
public boolean detectsColor(Image image, int x, int y, int color) {
|
||||
if (image == null)
|
||||
return false;
|
||||
int pixel = pixel(image, x, y);
|
||||
return colorFinder.defaultColorDetector(color).detectsColor(Color.red(pixel), Color.green(pixel), Color.blue(pixel));
|
||||
}
|
||||
|
||||
public boolean detectsColor(Image image, int x, int y, int color, int threshold) {
|
||||
if (image == null)
|
||||
return false;
|
||||
int pixel = pixel(image, x, y);
|
||||
return colorFinder.defaultColorDetector(color, threshold).detectsColor(Color.red(pixel), Color.green(pixel), Color.blue(pixel));
|
||||
}
|
||||
|
||||
public static Bitmap read(String path) {
|
||||
return BitmapFactory.decodeFile(path);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:accessibilityEventTypes="typeAllMask"
|
||||
android:accessibilityFeedbackType="feedbackGeneric"
|
||||
android:accessibilityFlags="flagRetrieveInteractiveWindows|flagIncludeNotImportantViews|flagReportViewIds|flagRequestEnhancedWebAccessibility|flagRequestFilterKeyEvents"
|
||||
android:accessibilityFlags="flagRetrieveInteractiveWindows|flagIncludeNotImportantViews|flagReportViewIds|flagRequestEnhancedWebAccessibility"
|
||||
android:canPerformGestures="true"
|
||||
android:canRequestEnhancedWebAccessibility="true"
|
||||
android:canRetrieveWindowContent="true"
|
||||
|
||||
@ -81,28 +81,17 @@ public class AccessibilityService extends android.accessibilityservice.Accessibi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterrupt() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessibilityNodeInfo getRootInActiveWindow() {
|
||||
return mRootInActiveWindow;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean onKeyEvent(KeyEvent event) {
|
||||
Log.v(TAG, "onKeyEvent: " + event);
|
||||
return super.onKeyEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onGesture(int gestureId) {
|
||||
Log.v(TAG, "onGesture: " + gestureId);
|
||||
return super.onGesture(gestureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterrupt() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
instance = null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user