本文整理匯總了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());
}
}
}