optimize memory and image size. remove unnecessary language file

This commit is contained in:
hyb1996
2017-05-10 15:42:58 +08:00
parent e5ade55519
commit 1222e00adc
77 changed files with 590 additions and 436 deletions

View File

@@ -4,6 +4,7 @@ import android.app.UiAutomation;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.Pools;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
@@ -129,8 +130,10 @@ public class UiObject extends AccessibilityNodeInfoCompat {
return getViewIdResourceName();
}
@NonNull
public CharSequence text() {
return getText();
CharSequence t = getText();
return t == null ? "" : t;
}
public CharSequence desc() {
@@ -305,6 +308,10 @@ public class UiObject extends AccessibilityNodeInfoCompat {
return mAllocator.getParent(this);
}
public boolean visibleToUser() {
return isVisibleToUser();
}
@Override
public List<AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByText(String text) {
if (mAllocator == null)

View File

@@ -48,7 +48,7 @@ public class ActionFactory {
@Override
protected void performAction(UiObject node) {
Bundle args = new Bundle();
args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, text);
args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, node.text() + text);
node.performAction(getAction(), args);
}
};

View File

@@ -0,0 +1,35 @@
package com.stardust.uiautomator;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.InstrumentationInfo;
import android.widget.Toast;
import java.util.List;
/**
* Created by Stardust on 2017/5/9.
*/
public class Test {
private void runTests(Context context) {
final String packageName = context.getPackageName();
final List<InstrumentationInfo> list =
context.getPackageManager().queryInstrumentation(packageName, 0);
if (list.isEmpty()) {
Toast.makeText(context, "Cannot find instrumentation for " + packageName,
Toast.LENGTH_SHORT).show();
return;
}
final InstrumentationInfo instrumentationInfo = list.get(0);
final ComponentName componentName =
new ComponentName(instrumentationInfo.packageName,
instrumentationInfo.name);
if (!context.startInstrumentation(componentName, null, null)) {
Toast.makeText(context, "Cannot run instrumentation for " + packageName,
Toast.LENGTH_SHORT).show();
}
}
}