optimize memory and image size. remove unnecessary language file
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
35
automator/src/main/java/com/stardust/uiautomator/Test.java
Normal file
35
automator/src/main/java/com/stardust/uiautomator/Test.java
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user