本文整理汇总了Java中android.view.accessibility.AccessibilityEvent.getParcelableData方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityEvent.getParcelableData方法的具体用法?Java AccessibilityEvent.getParcelableData怎么用?Java AccessibilityEvent.getParcelableData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.AccessibilityEvent
的用法示例。
在下文中一共展示了AccessibilityEvent.getParcelableData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openNotify
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/**
* 打开通知栏消息
*/
private void openNotify(AccessibilityEvent event) {
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
return;
}
Notification notification = (Notification) event.getParcelableData();
if (notification == null) {
return;
}
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
if (mHandler == null) {
mHandler = new MHandler();
}
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
clickMoneyAndKey();
}
}, 200);
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例2: openNotification
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/**
* 打开通知栏消息
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void openNotification(AccessibilityEvent event) {
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
return;
}
//以下是精华,将微信的通知栏消息打开
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例3: sendNotifacationReply
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/**
* 拉起微信界面
* @param event
*/
private void sendNotifacationReply(AccessibilityEvent event) {
hasAction = true;
if (event.getParcelableData() != null
&& event.getParcelableData() instanceof Notification) {
Notification notification = (Notification) event
.getParcelableData();
String content = notification.tickerText.toString();
String[] cc = content.split(":");
name = cc[0].trim();
scontent = cc[1].trim();
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
}
示例4: 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;
}
示例5: 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
示例6: openNotify
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/** 打开通知栏消息*/
private void openNotify(AccessibilityEvent event) {
if(event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification)) {
return;
}
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例7: openNotify
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/** 打开通知栏消息 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void openNotify(AccessibilityEvent event)
{
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification))
{
return;
}
// 将微信的通知栏消息打开
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try
{
pendingIntent.send();
} catch (PendingIntent.CanceledException e)
{
e.printStackTrace();
}
}
示例8: openNotify
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/** 打开通知栏消息*/
private void openNotify(AccessibilityEvent event)
{
if (event.getParcelableData() == null || !(event.getParcelableData() instanceof Notification))
{
return;
}
Notification notification = (Notification) event.getParcelableData();
PendingIntent pendingIntent = notification.contentIntent;
try
{
pendingIntent.send();
}
catch (PendingIntent.CanceledException e)
{
e.printStackTrace();
}
}
示例9: 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();
}
}
}
}
示例10: 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;
}
示例11: 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();
}
}
}
示例12: openAppByNotification
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/**
* 根据收到的[通知事件] 打开通知
* @param event
*/
public void openAppByNotification(AccessibilityEvent event) {
if (event.getParcelableData() != null && event.getParcelableData() instanceof Notification) {
Notification notification = (Notification) event.getParcelableData();
// 获取通知的内容 ...
String content = notification.tickerText.toString();
try {
PendingIntent pendingIntent = notification.contentIntent;
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
}
示例13: sendNotifacationReply
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/**
*
* @param event
*/
private void sendNotifacationReply(AccessibilityEvent event)
{
hasAction = true;
if (event.getParcelableData() != null
&& event.getParcelableData() instanceof Notification)
{
Notification notification = (Notification) event
.getParcelableData();
String content = notification.tickerText.toString();
String[] cc = content.split(":");
name = cc[0].trim();
scontent = cc[1].trim();
// android.util.Log.i("maptrix", "sender name =" + name);
// android.util.Log.i("maptrix", "sender content =" + scontent);
PendingIntent pendingIntent = notification.contentIntent;
try
{
pendingIntent.send();
}
catch (PendingIntent.CanceledException e)
{
e.printStackTrace();
}
}
}
示例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());
}
}
}
示例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());
}
}
}