本文整理汇总了Java中android.view.accessibility.AccessibilityEvent.getPackageName方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityEvent.getPackageName方法的具体用法?Java AccessibilityEvent.getPackageName怎么用?Java AccessibilityEvent.getPackageName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.AccessibilityEvent
的用法示例。
在下文中一共展示了AccessibilityEvent.getPackageName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
int type=event.getEventType();
switch (type){
case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
mWindowClassName = event.getClassName();
mCurrentPackage = event.getPackageName()==null?"":event.getPackageName().toString();
if (mCurrentPackage.equals(HIDE_FLOAT_VIEW_PACKAGE_NAME)){
tipViewController.hide();
}else {
tipViewController.show(1,"");
}
break;
case TYPE_VIEW_CLICKED:
case TYPE_VIEW_LONG_CLICKED:
break;
}
}
示例2: AccEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
AccEvent(AccessibilityEvent accessibilityEvent, AccessibilityNodeInfo rootNode) {
this.setFieldValue(EVENT, accessibilityEvent);
this.setFieldValue(EVENT_TIME, accessibilityEvent.getEventTime());
this.setFieldValue(ROOT_NODE, rootNode);
this.setFieldValue(EVENT_TYPE, accessibilityEvent.getEventType());
CharSequence charSequence = accessibilityEvent.getPackageName();
String packageName = charSequence == null ? "" : charSequence.toString();
this.setFieldValue(PACKAGE_NAME, packageName);
}
示例3: onAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
if (accessibilityEvent.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
foregroundPackageName = accessibilityEvent.getPackageName();
foregroundClassName = accessibilityEvent.getClassName();
}
}
示例4: onAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
//虚拟手机按键处理,优先级高于是否点击分词的判断
if ((event.getEventType() == TYPE_VIEW_LONG_CLICKED) && ("com.android.systemui".equals(event.getPackageName())))
{
if (TextUtils.isEmpty(event.getContentDescription())){
return;
}
//长按虚拟机触发的,需要转到按键处理去
if (!TextUtils.isEmpty(back) && event.getContentDescription().equals(back)){
KeyPressedTipViewController.getInstance().onKeyLongPress(KeyEvent.KEYCODE_BACK);
}else if (!TextUtils.isEmpty(home) && event.getContentDescription().equals(home)){
KeyPressedTipViewController.getInstance().onKeyLongPress(KeyEvent.KEYCODE_HOME);
}else if (!TextUtils.isEmpty(recent) && event.getContentDescription().equals(recent)){
KeyPressedTipViewController.getInstance().onKeyLongPress(KeyEvent.KEYCODE_APP_SWITCH);
}
}
if (!isRun){
return;
}
LogUtil.d(TAG,"onAccessibilityEvent:"+event);
int type=event.getEventType();
switch (type){
case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
mWindowClassName = event.getClassName();
mCurrentPackage = event.getPackageName()==null?"":event.getPackageName().toString();
Integer selectType=selections.get(mCurrentPackage);
mCurrentType = selectType==null?TYPE_VIEW_NONE:(selectType+1);
if ("com.tencent.mm.plugin.sns.ui.SnsTimeLineUI".equals(mWindowClassName)){
setCapabilities(true);
}else {
setCapabilities(false);
}
break;
case TYPE_VIEW_CLICKED:
case TYPE_VIEW_LONG_CLICKED:
getText(event);
break;
}
}
示例5: onAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
int eventType = event.getEventType();
CharSequence packageName = event.getPackageName();
switch (eventType) {
case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
AccessibilityNodeInfo rootNode = getRootInActiveWindow();
if (rootNode != null) {
if (packageName.equals("com.android.settings")) {
AccessibilityNodeInfo settingNode = AceHelper.findNodeByText(rootNode,"WLAN");
AceHelper.performClick(settingNode);
rootNode.recycle();
} else if (packageName.equals("com.android.wifisettings")) {
AccessibilityNodeInfo wifiNode = AceHelper.findNodeByText(rootNode, "TP-LINK_F770");
AccessibilityNodeInfo wifiNodeParent = wifiNode.getParent();
AccessibilityNodeInfo iconNode = AceHelper.findNodeById(wifiNodeParent, "com.android.wifisettings:id/advance_layout");
AceHelper.performClick(iconNode);
}
}
break;
case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
Toast.makeText(this, "Notify", Toast.LENGTH_SHORT).show();
event.getSource().recycle();
break;
case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:
break;
default:
break;
}
}
示例6: fromEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
public static NotificationInfo fromEvent(AccessibilityEvent event) {
return new NotificationInfo(event.getPackageName(), event.getText());
}
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:4,代码来源:NotificationListener.java