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


Java AccessibilityEvent.getText方法代碼示例

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


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

示例1: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public boolean onAccessibilityEvent(AccessibilityService service, AccessibilityEvent event) {
    if (event.getParcelableData() instanceof Notification) {
        Notification notification = (Notification) event.getParcelableData();
        Log.d(TAG, "onNotification: " + notification + "; " + event);
        onNotification(event, notification);
    } else {
        List<CharSequence> list = event.getText();
        Log.d(TAG, "onNotification: " + list + "; " + event);
        if (event.getPackageName().equals(mContext.getPackageName())) {
            return false;
        }
        if (list != null) {
            onNotification(event, new NotificationInfo(event.getPackageName(), list));
        }
    }
    return false;
}
 
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:19,代碼來源:NotificationListener.java

示例2: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
	if (event.getEventType()==AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) {
		List<CharSequence> texts = event.getText();
		if (!texts.isEmpty()) {
			for (CharSequence text : texts) {
				String content = text.toString();
				if (content.contains(TIXING)|content.contains(QITA)) {
					openNotify(event);
					return;
				}
			}
		}
	}
	openHongBao(event);
}
 
開發者ID:qq1198,項目名稱:mtoolbox,代碼行數:17,代碼來源:HongBaoService.java

示例3: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    final boolean result = super.dispatchPopulateAccessibilityEvent(event);
    final List<CharSequence> text = event.getText();
    text.clear();
    // Populate event with a fake title based on the current state.
    if (mState == State.APPS) {
        text.add(getString(R.string.all_apps_button_label));
    } else if (mState == State.WIDGETS) {
        text.add(getString(R.string.widget_button_text));
    } else if (mWorkspace != null) {
        text.add(mWorkspace.getCurrentPageDescription());
    } else {
        text.add(getString(R.string.all_apps_home_button_label));
    }
    return result;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:18,代碼來源:Launcher.java

示例4: onViewTextChanged

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
private void onViewTextChanged(AccessibilityEvent event) {
    List<CharSequence> text = event.getText();
    if (text == null
            || text.size()==0
            || text.get(0).length() == 0
            || event.isPassword()) {
        this.mEvent = null;

    } else {
        onNewText(text.get(0), event);
    }
}
 
開發者ID:PrivacyStreams,項目名稱:PrivacyStreams,代碼行數:13,代碼來源:TextEntryProvider.java

示例5: sendNotify

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
public static void sendNotify(AccessibilityEvent event) {
    List<CharSequence> texts = event.getText();
    if (!texts.isEmpty()) {
        String message = texts.get(0).toString();

        //過濾微信內部通知消息
        if (isInside(message)) {
            return;
        }

        //模擬打開通知欄消息
        if (event.getParcelableData() != null && event.getParcelableData() instanceof Notification) {
            Log.i("demo", "標題欄canReply=true");
            try {
                Notification notification = (Notification) event.getParcelableData();
                PendingIntent pendingIntent = notification.contentIntent;
                pendingIntent.send();
            } catch (PendingIntent.CanceledException e) {
                e.printStackTrace();
            }
        }
    }
}
 
開發者ID:kaixuanluo,項目名稱:pc-android-controller-android,代碼行數:24,代碼來源:WeChatMsg.java

示例6: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public boolean onAccessibilityEvent(android.accessibilityservice.AccessibilityService service, AccessibilityEvent event) {
    if (event.getParcelableData() instanceof Notification) {
        android.app.Notification notification = (android.app.Notification) event.getParcelableData();
        Log.d(TAG, "onNotification: " + notification + "; " + event);
        onNotification(Notification.create(notification, event.getPackageName().toString()));
    } else {
        List<CharSequence> list = event.getText();
        Log.d(TAG, "onNotification: " + list + "; " + event);
        if (event.getPackageName().equals(mContext.getPackageName())) {
            return false;
        }
        if (list != null) {
            onToast(event, new Toast(event.getPackageName().toString(), list));
        }
    }

    return false;
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:20,代碼來源:AccessibilityNotificationObserver.java

示例7: monitorNotifications

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
/**
 * notification監控
 */
private void monitorNotifications(AccessibilityEvent event) {
    if (event.getEventType() != AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) return;
    if (event.getText() == null ||
            (event.getText().toString() != null && !event.getText().toString().contains(SelfConst.WX_RED_NOTIFICATION_TEXT)))
        return;
    //模擬點擊Notification
    if (event.getParcelableData() != null && event.getParcelableData() instanceof Notification) {
        Notification notification = (Notification) event.getParcelableData();
        try {
            notification.contentIntent.send();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:WanAndroid,項目名稱:GetRedPackets,代碼行數:19,代碼來源:WXRedPluginService.java

示例8: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public boolean dispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
  // Special case to handle window state change events. As far as
  // accessibility services are concerned, state changes from
  // DrawerLayout invalidate the entire contents of the screen (like
  // an Activity or Dialog) and they should announce the title of the
  // new content.
  if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
    final List<CharSequence> eventText = event.getText();
    final View visibleDrawer = findVisibleDrawer();
    if (visibleDrawer != null) {
      final int edgeGravity = getDrawerViewAbsoluteGravity(visibleDrawer);
      final CharSequence title = getDrawerTitle(edgeGravity);
      if (title != null) {
        eventText.add(title);
      }
    }

    return true;
  }

  return super.dispatchPopulateAccessibilityEvent(host, event);
}
 
開發者ID:rogues-dev,項目名稱:superglue,代碼行數:24,代碼來源:DebugDrawerLayout.java

示例9: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent event)
{
	final int eventType = event.getEventType(); // ClassName:
	// com.tencent.mm.ui.LauncherUI

	// 通知欄事件
	if (eventType == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
	{
		List<CharSequence> texts = event.getText();
		if (!texts.isEmpty())
		{
			for (CharSequence t : texts)
			{
				String text = String.valueOf(t);
				if (text.contains(WX_HONGBAO_TEXT_KEY) || text.contains(QQ_HONGBAO_TEXT_KEY))
				{
					openNotify(event);
					break;
				}
			}
		}
	} else if (eventType == AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE)
	{
		// 從微信主界麵進入聊天界麵
		openHongBao(event);
	} else if (eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
	{
		// 處理微信聊天界麵
		openHongBao(event);
	}
}
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:33,代碼來源:MD5_jni.java

示例10: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
   public void onAccessibilityEvent(AccessibilityEvent event)
   {
SharedPreferences sharedPreferences = getSharedPreferences("nico.styTool_preferences", MODE_PRIVATE); 
boolean isFirstRun = sharedPreferences.getBoolean("ok_c", true); 
//Editor editor = sharedPreferences.edit(); 
if (isFirstRun) 
{ 
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
    builder.setSmallIcon(R.mipmap.ic_launcher);
    builder.setContentTitle("妮媌");
    builder.setContentText("QQ搶紅包正在運行");
    builder.setOngoing(true);
    Notification notification = builder.build();
    NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    manager.notify(NOTIFICATION_ID, notification);
}
else 
{ 

}

if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
{
    List<CharSequence> texts = event.getText();
    if (!texts.isEmpty())
    {
	for (CharSequence text : texts)
	{
	    String content = text.toString();
	    if (content.contains(QQ_KEYWORD_NOTIFICATION))
	    {
		openNotify(event);
		return;
	    }
	}
    }
}
openHongBao(event);
   }
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:41,代碼來源:dex_smali.java

示例11: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
public boolean dispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
    if (event.getEventType() != 32) {
        return super.dispatchPopulateAccessibilityEvent(host, event);
    }
    List<CharSequence> eventText = event.getText();
    View visibleDrawer = DrawerLayout.this.findVisibleDrawer();
    if (visibleDrawer != null) {
        CharSequence title = DrawerLayout.this.getDrawerTitle(DrawerLayout.this.getDrawerViewAbsoluteGravity(visibleDrawer));
        if (title != null) {
            eventText.add(title);
        }
    }
    return true;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:15,代碼來源:DrawerLayout.java

示例12: 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

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

示例14: notificationEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
/** 處理通知欄事件 */
private void notificationEvent(AccessibilityEvent event) {
    // 小細節, 搶完紅包幹啥
    if(!isRunningForeground(context())){
        mAppState = APP_STATE_BACKGROUND;
    }else {
        mAppState = APP_STATE_FOREGROUND;
    }

    Parcelable data = event.getParcelableData();
    if (data == null || !(data instanceof Notification)) {
        return;
    }

    List<CharSequence> texts = event.getText();
    if (!texts.isEmpty()) {
        String text = String.valueOf(texts.get(0));
        LogUtils.printOut(TAG, text);
        int index = text.lastIndexOf(":");
        if(index != -1) {
            text = text.substring(index + 1);
        }
        if(text.contains(KEY)) {
            isReceived = true;
            Notification nf = (Notification) data;
            PendingIntent pendingIntent = nf.contentIntent;
            if(NotifyUtils.isLockScreen()) {  // 是否為鎖屏或黑屏狀態
                if(config().isLockScreenRob()){
                    NotifyUtils.wakeAndUnlock();
                    NotifyUtils.send(pendingIntent); // 打開微信
                }else{
                    NotifyUtils.showNotify(context(), String.valueOf(nf.tickerText), pendingIntent); // 顯示有紅包通知
                }
            } else {
                NotifyUtils.send(pendingIntent); // 打開微信
            }

            // 播放聲音和震動
            NotifyUtils.playEffect(context(), config());
        }
    }
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:43,代碼來源:WeChatAccessibilityJob.java

示例15: notificationEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
/** 通知欄狀態變化 */
private void notificationEvent(AccessibilityEvent event) {
    // 小細節, 搶完紅包幹啥
    if(!isRunningForeground(context())){
        mAppState = APP_STATE_BACKGROUND;
    }else {
        mAppState = APP_STATE_FOREGROUND;
    }

    Parcelable data = event.getParcelableData();
    if (data == null || !(data instanceof Notification)) {
        return;
    }

    List<CharSequence> texts = event.getText();
    if (!texts.isEmpty()) {
        String text = String.valueOf(texts.get(0));
        LogUtils.printOut(TAG, text);
        int index = text.lastIndexOf(":");
        if(index != -1) {
            text = text.substring(index + 1);
        }
        if(text.contains(KEY)) {
            isReceived = true;
            Notification nf = (Notification) data;
            PendingIntent pendingIntent = nf.contentIntent;
            if(NotifyUtils.isLockScreen()) {  // 是否為鎖屏或黑屏狀態
                if(config().isLockScreenRob()){
                    NotifyUtils.wakeAndUnlock();
                    NotifyUtils.send(pendingIntent); // 打開QQ
                }else{
                    NotifyUtils.showNotify(context(), String.valueOf(nf.tickerText), pendingIntent); // 顯示有紅包通知
                }
            } else {
                NotifyUtils.send(pendingIntent); // 打開QQ
            }

            // 播放聲音和震動
            NotifyUtils.playEffect(context(), config());
        }
    }
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:43,代碼來源:QQAccessibilityJob.java


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