本文整理匯總了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);
}
}