當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessibilityEvent.getEventType方法代碼示例

本文整理匯總了Java中android.view.accessibility.AccessibilityEvent.getEventType方法的典型用法代碼示例。如果您正苦於以下問題:Java AccessibilityEvent.getEventType方法的具體用法?Java AccessibilityEvent.getEventType怎麽用?Java AccessibilityEvent.getEventType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.accessibility.AccessibilityEvent的用法示例。


在下文中一共展示了AccessibilityEvent.getEventType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: watchNotifications

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
private boolean watchNotifications(AccessibilityEvent event) {
    // Not a notification
    if (event.getEventType() != AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
        return false;

    // Not a hongbao
    String tip = event.getText().toString();
    if (!tip.contains(WECHAT_NOTIFICATION_TIP)) return true;

    Parcelable parcelable = event.getParcelableData();
    if (parcelable instanceof Notification) {
        Notification notification = (Notification) parcelable;
        try {
            /* 清除signature,避免進入會話後誤判 */
            signature.cleanSignature();

            notification.contentIntent.send();
        } catch (PendingIntent.CanceledException e) {
            e.printStackTrace();
        }
    }
    return true;
}
 
開發者ID:KoreHuang,項目名稱:WeChatLuckyMoney,代碼行數:24,代碼來源:HongbaoService.java

示例2: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onAccessibilityEvent(final AccessibilityEvent event) {
    Log.v(TAG, "onAccessibilityEvent: " + event);
    if (!containsAllEventTypes && !eventTypes.contains(event.getEventType()))
        return;
    int type = event.getEventType();
    if (type == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED || type == AccessibilityEvent.TYPE_VIEW_HOVER_ENTER
            || type == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) {
        mFastRootInActiveWindow = super.getRootInActiveWindow();
    }
    for (Map.Entry<Integer, AccessibilityDelegate> entry : mDelegates.entrySet()) {
        AccessibilityDelegate delegate = entry.getValue();
        Set<Integer> types = delegate.getEventTypes();
        if (types != null && !delegate.getEventTypes().contains(event.getEventType()))
            continue;
        long start = System.currentTimeMillis();
        if (delegate.onAccessibilityEvent(AccessibilityService.this, event))
            break;
        Log.v(TAG, "millis: " + (System.currentTimeMillis() - start) + " delegate: " + entry.getValue().getClass().getName());
    }
}
 
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:22,代碼來源:AccessibilityService.java

示例3: 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;
        }
    }
}
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:20,代碼來源:RobService.java

示例4: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    if(event == null)   return;
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
    if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        if( pref.getBoolean("volume_key_lock", false) == true){
            Utils.setMusicKey(this);
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    Utils.setMusicKey(AccessibilityService.this);
                }
            }, 100);
        }
    }
}
 
開發者ID:KrongKrongPadakPadak,項目名稱:mvo,代碼行數:17,代碼來源:AccessibilityService.java

示例5: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    AccessibilityNodeInfo nodeInfo = event.getSource();
    if (nodeInfo != null) {
        int eventType = event.getEventType();
        if (eventType== AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED ||
                eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
            if (handledMap.get(event.getWindowId()) == null) {
                boolean handled = iterateNodesAndHandle(nodeInfo);
                if (handled) {
                    handledMap.put(event.getWindowId(), true);
                }
            }
        }
    }
}
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:17,代碼來源:fool.java

示例6: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(host, event);
    event.setClassName(DirectionalViewpager.class.getName());
    AccessibilityRecordCompat recordCompat = null;
    if (isHorizontal()) {
        recordCompat =
                AccessibilityEventCompat.asRecord(event);
    } else {
        recordCompat = AccessibilityRecordCompat.obtain();
    }
    recordCompat.setScrollable(canScroll());
    if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
            && mAdapter != null) {
        recordCompat.setItemCount(mAdapter.getCount());
        recordCompat.setFromIndex(mCurItem);
        recordCompat.setToIndex(mCurItem);
    }
}
 
開發者ID:ynztlxdeai,項目名稱:TextReader,代碼行數:20,代碼來源:DirectionalViewpager.java

示例7: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {

    SharedPreferences settings = getSharedPreferences(data, 0);
    settingRoom = settings.getString(settingRoomField, "");
    settingDevices = settings.getString(settingDevicesField, "");

    if (settingRoom.equals("") || settingDevices.equals("")) {
        tellUser("配置檔不完整");
        return;
    }

    int eventType = event.getEventType();
    if (eventType == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED) {
        preProcess(event);
        Log.i(TAG, "onAccessibilityEvent");
    }

}
 
開發者ID:qoli,項目名稱:MiHomePlus,代碼行數:20,代碼來源:MyAccessibility.java

示例8: getClickType

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
private int getClickType(AccessibilityEvent event){
    int type = event.getEventType();
    long time = event.getEventTime();
    long id=getSourceNodeId(event);
    if (type!=TYPE_VIEW_CLICKED){
        mLastClickTime=time;
        mLastSourceNodeId=-1;
        return type;
    }
    if (id==-1){
        mLastClickTime=time;
        mLastSourceNodeId=-1;
        return type;
    }
    if (type==TYPE_VIEW_CLICKED && time - mLastClickTime<= double_click_interval && id==mLastSourceNodeId){
        mLastClickTime=-1;
        mLastSourceNodeId=-1;
        return TYPE_VIEW_DOUBLD_CLICKED;
    }else {
        mLastClickTime=time;
        mLastSourceNodeId=id;
        return type;
    }
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:25,代碼來源:BigBangMonitorService.java

示例9: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
    if (null == accessibilityEvent) {
        return;
    }
    switch (accessibilityEvent.getEventType()) {
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: {
            Log.i("AnalystService.onAccessibilityEvent # AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED");
            mLastEventClassName = StringUtil.toNb(accessibilityEvent.getClassName());
            postEvent();
        }
        break;
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: {
            Log.i("AnalystService.onAccessibilityEvent # AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED");
            if (null != mLastEventClassName) {
                postEvent();
            }
        }
        break;
    }
}
 
開發者ID:littleRich,項目名稱:AutoInteraction-Library,代碼行數:22,代碼來源:AnalystService.java

示例10: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    if (event.getEventType() == 4096) {
        return super.dispatchPopulateAccessibilityEvent(event);
    }
    int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);
        if (child.getVisibility() == 0) {
            ItemInfo ii = infoForChild(child);
            if (ii != null && ii.position == this.mCurItem && child.dispatchPopulateAccessibilityEvent(event)) {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:17,代碼來源:ViewPager.java

示例11: watchList

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
private boolean watchList(AccessibilityEvent event) {
    if (mListMutex) return false;
    mListMutex = true;
    AccessibilityNodeInfo eventSource = event.getSource();
    // Not a message
    if (event.getEventType() != AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED || eventSource == null)
        return false;

    List<AccessibilityNodeInfo> nodes = eventSource.findAccessibilityNodeInfosByText(WECHAT_NOTIFICATION_TIP);
    //增加條件判斷currentActivityName.contains(WECHAT_LUCKMONEY_GENERAL_ACTIVITY)
    //避免當訂閱號中出現標題為“[微信紅包]拜年紅包”(其實並非紅包)的信息時誤判
    if (!nodes.isEmpty() && currentActivityName.contains(WECHAT_LUCKMONEY_GENERAL_ACTIVITY)) {
        AccessibilityNodeInfo nodeToClick = nodes.get(0);
        if (nodeToClick == null) return false;
        CharSequence contentDescription = nodeToClick.getContentDescription();
        if (contentDescription != null && !signature.getContentDescription().equals(contentDescription)) {
            nodeToClick.performAction(AccessibilityNodeInfo.ACTION_CLICK);
            signature.setContentDescription(contentDescription.toString());
            return true;
        }
    }
    return false;
}
 
開發者ID:KoreHuang,項目名稱:WeChatLuckyMoney,代碼行數:24,代碼來源:HongbaoService.java

示例12: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
/**
 * Announce the currently-selected time when launched.
 */
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        // Clear the event's current text so that only the current time will be spoken.
        event.getText().clear();
        Calendar time = Calendar.getInstance();
        time.set(Calendar.HOUR, getHours());
        time.set(Calendar.MINUTE, getMinutes());
        time.set(Calendar.SECOND, getSeconds());
        long millis = time.getTimeInMillis();
        int flags = DateUtils.FORMAT_SHOW_TIME;
        if (mIs24HourMode) {
            flags |= DateUtils.FORMAT_24HOUR;
        }
        String timeString = DateUtils.formatDateTime(getContext(), millis, flags);
        event.getText().add(timeString);
        return true;
    }
    return super.dispatchPopulateAccessibilityEvent(event);
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:24,代碼來源:RadialPickerLayout.java

示例13: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public boolean onAccessibilityEvent(AccessibilityService service, AccessibilityEvent event) {
    if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        setLatestComponent(event.getPackageName(), event.getClassName());
    }
    return false;
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:8,代碼來源:AccessibilityInfoProvider.java

示例14: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
  super.onInitializeAccessibilityEvent(event);
  if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SELECTED) {
    event.getText().add(getProgressText());
  }
  event.setClassName(DefaultTimeBar.class.getName());
}
 
開發者ID:yangchaojiang,項目名稱:yjPlay,代碼行數:9,代碼來源:DefaultTimeBar.java

示例15: 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;
    }
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:41,代碼來源:BigBangMonitorService.java


注:本文中的android.view.accessibility.AccessibilityEvent.getEventType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。