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