当前位置: 首页>>代码示例>>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;未经允许,请勿转载。