本文整理汇总了Java中android.view.accessibility.AccessibilityEvent.getClassName方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityEvent.getClassName方法的具体用法?Java AccessibilityEvent.getClassName怎么用?Java AccessibilityEvent.getClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.AccessibilityEvent
的用法示例。
在下文中一共展示了AccessibilityEvent.getClassName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public void onAccessibilityEvent(final AccessibilityEvent event) {
Log.d(TAG,"onAccessibilityEvent "+event.getSource()+event.toString());
if(null == event || null == event.getSource()) { return; }
if(event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED &&
event.getPackageName().equals(PACKAGE)){
final CharSequence className = event.getClassName();
Log.d(TAG,"onAccessibilityEvent "+className);
if(className.equals(NAME_APP_DETAILS)){
simulationClick(event, TEXT_FORCE_STOP);
performGlobalAction(GLOBAL_ACTION_BACK);
isAppDetail = true;
}
if(isAppDetail && className.equals(NAME_ALERT_DIALOG)){
simulationClick(event, TEXT_DETERMINE);
performGlobalAction(GLOBAL_ACTION_BACK);
isAppDetail = false;
}
}
}
示例2: onAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public void onAccessibilityEvent(final AccessibilityEvent event) {
Log.d(TAG,"onAccessibilityEvent "+event.getSource()+event.toString());
if(bRun==false){
handler.sendEmptyMessage(1);
bRun=true;
}
if(null == event || null == event.getSource()) { return; }
if(event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED &&
event.getPackageName().equals(PACKAGE)){
final CharSequence className = event.getClassName();
Log.d(TAG,"onAccessibilityEvent "+className);
if(className.equals(NAME_APP_DETAILS)){
simulationClick(event, TEXT_FORCE_STOP);
performGlobalAction(GLOBAL_ACTION_BACK);
isAppDetail = true;
}
if(isAppDetail && className.equals(NAME_ALERT_DIALOG)){
simulationClick(event, TEXT_DETERMINE);
performGlobalAction(GLOBAL_ACTION_BACK);
isAppDetail = false;
}
}
}
示例3: openHongBao
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void openHongBao(AccessibilityEvent event)
{
CharSequence className = event.getClassName();
checkScreen(getApplicationContext());
if ("com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyReceiveUI".equals(className))
{
// 点中了红包,下一步就是去拆红包
checkKey1();
} else if ("com.tencent.mm.ui.LauncherUI".equals(className) || "com.tencent.mobileqq.activity.ChatActivity".equals(className))
{
// 在聊天界面,去点中红包
checkKey2();
} else
{
// 在聊天界面,去点中红包
checkKey2();
}
}
示例4: openEnvelopeQQ
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/**
* 打开QQ红包
*
* @param event
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void openEnvelopeQQ(AccessibilityEvent event) {
CharSequence className = event.getClassName();
Log.w(TAG, "curClassName:" + className);
if (QQ_ACTIVITY_CHAT.equals(className)) {
//在聊天界面,去点中红包
///主界面中,打开对话框
Log.d(TAG, "聊天界面---->点击红包" + event);
chaikaihongbao();
} else if (QQ_ACTIVITY_OPENED.equals(className)) {
Log.d(TAG, "领取成功/已被领完" + event);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
Log.d(TAG, "延迟两秒返回home 上锁");
returnHome();
}
}, 2000);
}
}
示例5: 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;
}
}
示例6: 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();
}
}
示例7: 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;
}
}
示例8: windowStateEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/** 窗口状态变化 */
private void windowStateEvent(AccessibilityEvent event) {
CharSequence className = event.getClassName();
if(className == null){
return;
}
switch (className.toString()){
case CLASSNAME_1:
mCurrentWindow = WINDOW_LAUNCHER_UI;
break;
case CLASSNAME_2:
mCurrentWindow = WINDOW_LUCKY_MONEY_OPEN;
break;
case CLASSNAME_3:
mCurrentWindow = WINDOW_LUCKY_MONEY_DETAILUI;
break;
default:
mCurrentWindow = WINDOW_OTHER;
break;
}
if(!isReceived) { // 未收到红包, 下面操作不执行
return;
}
switch (mCurrentWindow){
case WINDOW_LAUNCHER_UI:
clickRedPacket(); // 在聊天界面, 去点中红包
break;
case WINDOW_LUCKY_MONEY_OPEN:
openRedPacket(); // 点中了红包, 下一步就是去拆红包
break;
case WINDOW_LUCKY_MONEY_DETAILUI:
detailsRedPacket(); // 拆完红包后看详细的纪录界面
break;
}
}
示例9: windowStateEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/** 窗口状态变化 */
private void windowStateEvent(AccessibilityEvent event) {
CharSequence className = event.getClassName();
if(className == null){
return;
}
switch (className.toString()){
case CLASSNAME_1:
mCurrentWindow = WINDOW_SPLASH;
break;
case CLASSNAME_2:
mCurrentWindow = WINDOW_QWALLET_PLUGIN_PROXY;
break;
default:
mCurrentWindow = WINDOW_OTHER;
break;
}
if(!isReceived) { // 未收到红包, 下面操作不执行
return;
}
switch (mCurrentWindow){
case WINDOW_SPLASH:
clickRedPacket(); // 在聊天界面, 去点中红包
break;
case WINDOW_QWALLET_PLUGIN_PROXY:
clickRedPacketAfter(); // 已拆红包, 干哈呢
break;
}
}
示例10: onAccessibilityEvent
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
if (!closeAdvancedFunction && mSp.getBoolean(Config.KEYBLOCK_ACTIVITY, false) && !RootScanActivity && !AdvancedScanActivity) {
int eventType = event.getEventType();
if (eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
if (event.getClassName() != null) {
CurrentActivityFix(event.getPackageName().toString(), event.getClassName().toString());
}
}
}
}
示例11: getText
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
private synchronized void getText(AccessibilityEvent event){
if(XposedEnableUtil.isEnable())
return;
LogUtil.d(TAG,"getText:"+event);
if (!monitorClick || event==null ) {
return;
}
if (showFloatView && !isRun) {
return;
}
int type=getClickType(event);
CharSequence className = event.getClassName();
if (mWindowClassName==null){
return;
}
if (mWindowClassName.toString().startsWith("com.forfan.bigbang")){
//自己的应用不监控
return;
}
if (mCurrentPackage.equals(event.getPackageName())){
if (type!=mCurrentType){
//点击方式不匹配,直接返回
return;
}
}else {
//包名不匹配,直接返回
return;
}
if (className==null || className.equals("android.widget.EditText")){
//输入框不监控
return;
}
if (onlyText){
//onlyText方式下,只获取TextView的内容
if (className==null || !className.equals("android.widget.TextView")){
if (!hasShowTipToast){
ToastUtil.show(R.string.toast_tip_content);
hasShowTipToast=true;
}
return;
}
}
AccessibilityNodeInfo info=event.getSource();
if(info==null){
return;
}
CharSequence txt=info.getText();
if (TextUtils.isEmpty(txt) && !onlyText){
//非onlyText方式下获取文字更多,但是可能并不是想要的文字
//比如系统短信页面需要这样才能获取到内容。
List<CharSequence> txts=event.getText();
if (txts!=null) {
StringBuilder sb=new StringBuilder();
for (CharSequence t : txts) {
sb.append(t);
}
txt=sb.toString();
}
}
if (!TextUtils.isEmpty(txt)) {
if (txt.length()<=2 ){
//对于太短的词进行屏蔽,因为这些词往往是“发送”等功能按钮,其实应该根据不同的activity进行区分
if (!hasShowTooShortToast) {
ToastUtil.show(R.string.too_short_to_split);
hasShowTooShortToast = true;
}
return;
}
Intent intent=new Intent(this, BigBangActivity.class);
intent.addFlags(intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(BigBangActivity.TO_SPLIT_STR,txt.toString());
// startActivity(intent);
//放到ArcTipViewController中触发试试
ArcTipViewController.getInstance().showTipViewForStartActivity(intent);
}
}