当前位置: 首页>>代码示例>>Java>>正文


Java RemoteInput.getResultsFromIntent方法代码示例

本文整理汇总了Java中android.support.v4.app.RemoteInput.getResultsFromIntent方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteInput.getResultsFromIntent方法的具体用法?Java RemoteInput.getResultsFromIntent怎么用?Java RemoteInput.getResultsFromIntent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.RemoteInput的用法示例。


在下文中一共展示了RemoteInput.getResultsFromIntent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onReceive

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    ApplicationLoader.postInitApplication();
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput == null) {
        return;
    }
    CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY);
    if (text == null || text.length() == 0) {
        return;
    }
    long dialog_id = intent.getLongExtra("dialog_id", 0);
    int max_id = intent.getIntExtra("max_id", 0);
    if (dialog_id == 0 || max_id == 0) {
        return;
    }
    SendMessagesHelper.getInstance().sendMessage(text.toString(), dialog_id, null, null, true, null, null, null);
    MessagesController.getInstance().markDialogAsRead(dialog_id, max_id, max_id, 0, true, false);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:20,代码来源:WearReplyReceiver.java

示例2: onStartCommand

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    String action = intent != null ? intent.getAction() : null;

    if (ACTION_ADD_MESSAGE.equals(action)) {
        int accountId = intent.getExtras().getInt(Extra.ACCOUNT_ID);
        int peerId = intent.getExtras().getInt(Extra.PEER_ID);

        Bundle msg = RemoteInput.getResultsFromIntent(intent);
        if (msg != null) {
            CharSequence body = msg.getCharSequence(Extra.BODY);
            addMessage(accountId, peerId, body);
        }
    } else {
        send();
    }

    return START_NOT_STICKY;
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:20,代码来源:SendService.java

示例3: replyToNotification

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
private void replyToNotification(Context context, Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    final int changeId = intent.getIntExtra(Constants.EXTRA_LEGACY_CHANGE_ID, -1);
    final String accountId = intent.getStringExtra(Constants.EXTRA_ACCOUNT_HASH);
    final int groupId = intent.getIntExtra(Constants.EXTRA_NOTIFICATION_GROUP_ID, 0);
    if (remoteInput != null && groupId != 0 && changeId >= 0 && accountId != null) {
        final Account account = ModelHelper.getAccountFromHash(context, accountId);
        if (account == null) {
            return;
        }

        CharSequence message = remoteInput.getCharSequence(Constants.EXTRA_COMMENT);
        if (message == null) {
            return;
        }

        performSendReply(context, account, groupId, changeId, message.toString());
    } else {
        // What happens here? Dismiss the notification in case, but don't mark as read
        NotificationsHelper.dismissNotification(context, groupId);
        NotificationEntity.dismissGroupNotifications(context, groupId);
    }
}
 
开发者ID:jruesga,项目名称:rview,代码行数:24,代码来源:NotificationReceiver.java

示例4: onCreate

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_wearable_replay);

    CharSequence replayString;

    //get the voice replays from the remote input.
    Bundle bundle = RemoteInput.getResultsFromIntent(getIntent());
    if (bundle != null) {
        replayString = bundle.getCharSequence(WearableNotification.REMOTE_INPUT_LABEL);
    } else {
        replayString = "No replay from the response.";
    }

    Toast.makeText(this, replayString, Toast.LENGTH_LONG).show();

    finish();
}
 
开发者ID:kevalpatel2106,项目名称:android-samples,代码行数:20,代码来源:WearableReplayActivity.java

示例5: onReceive

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {

    if (intent != null) {
        Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
        if (remoteInput != null) {
            //入力データを取得
            String value = (String) remoteInput.getCharSequence(KEY_DIRECT_REPLY);
            Toast.makeText(context, value, Toast.LENGTH_SHORT).show();

            //通知に反映して更新
            ArrayList<String> history = new ArrayList<>();
            history.add("コメント:" + value);
            NotiUtils.createNoti(context, history);
        }
    }
}
 
开发者ID:yokmama,项目名称:honki_android2,代码行数:18,代码来源:NotiBroadcastReceiver.java

示例6: onConnect

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onConnect(@Nullable String message) {
    if (message != null) {
        Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
    } else {
        Intent intent = new Intent(this, HomeActivity.class);

        if (getIntent().hasExtra(HomeActivity.EXTRA_CHANNEL_ID))
            intent.putExtra(HomeActivity.EXTRA_CHANNEL_ID, getIntent().getStringExtra(HomeActivity.EXTRA_CHANNEL_ID));

        if (getIntent().hasExtra(HomeActivity.EXTRA_INSTANT_ID))
            intent.putExtra(HomeActivity.EXTRA_INSTANT_ID, getIntent().getStringExtra(HomeActivity.EXTRA_INSTANT_ID));

        Bundle remoteInput = RemoteInput.getResultsFromIntent(getIntent());
        if (remoteInput != null) {
            intent.putExtra(BaseMessageFragment.EXTRA_REPLY, remoteInput.getCharSequence(BaseMessageFragment.EXTRA_REPLY, "").toString());
            Log.d("RemoteInput", remoteInput.getCharSequence(BaseMessageFragment.EXTRA_REPLY, "").toString());
        }

        startActivity(intent);
    }

    finish();
}
 
开发者ID:DoubleDotLabs,项目名称:ButterySlack,代码行数:25,代码来源:MainActivity.java

示例7: onReceive

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    QiscusComment comment = intent.getParcelableExtra("data");
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        CharSequence message = remoteInput.getCharSequence(QiscusPushNotificationUtil.KEY_NOTIFICATION_REPLY);
        NotificationManager notificationManager = (NotificationManager) context.getSystemService(
                Context.NOTIFICATION_SERVICE);
        if (notificationManager != null) {
            notificationManager.cancel(comment.getRoomId());
        }
        QiscusComment qiscusComment = QiscusComment.generateMessage((String) message, comment.getRoomId(), comment.getTopicId());
        Qiscus.getChatConfig().getReplyNotificationHandler().onSend(context, qiscusComment);
    } else {
        Qiscus.getChatConfig().getNotificationClickListener().onClick(context, comment);
    }
}
 
开发者ID:qiscus,项目名称:qiscus-sdk-android,代码行数:18,代码来源:QiscusPushNotificationClickReceiver.java

示例8: onReceive

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    switch (intent.getAction()) {
        case GBApplication.ACTION_QUIT: {
            finish();
            break;
        }
        case ACTION_REPLY: {
            Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
            CharSequence reply = remoteInput.getCharSequence(EXTRA_REPLY);
            LOG.info("got wearable reply: " + reply);
            GB.toast(context, "got wearable reply: " + reply, Toast.LENGTH_SHORT, GB.INFO);
            break;
        }
        case DeviceService.ACTION_HEARTRATE_MEASUREMENT: {
            int hrValue = intent.getIntExtra(DeviceService.EXTRA_HEART_RATE_VALUE, -1);
            GB.toast(DebugActivity.this, "Heart Rate measured: " + hrValue, Toast.LENGTH_LONG, GB.INFO);
            break;
        }
    }
}
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:22,代码来源:DebugActivity.java

示例9: onReceive

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    Bundle bundle = intent.getExtras();
    if (remoteInput != null && bundle != null) {
        if (intent.getAction().equals(ACTION_REPLY)) {

            Message message = new Message(
                    remoteInput.getCharSequence(EXTRA_VOICE_REPLY).toString(),
                    new String[]{bundle.getString(EXTRA_ADDRESS)}
            );

            Transaction sendTransaction = new Transaction(context, SmsHelper.getSendSettings(context));
            sendTransaction.sendNewMessage(message, bundle.getLong(EXTRA_THREAD_ID));

            Intent i = new Intent(context, MarkReadService.class);
            i.putExtra(EXTRA_THREAD_ID, bundle.getLong(EXTRA_THREAD_ID));
            context.startService(i);
        }
    }
}
 
开发者ID:moezbhatti,项目名称:qksms,代码行数:22,代码来源:RemoteMessagingReceiver.java

示例10: processPushBundle

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
/**
 * Takes the pushBundle extras from the intent,
 * and sends it through to the PushPlugin for processing.
 */
private boolean processPushBundle(boolean isPushPluginActive, Intent intent) {
    Bundle extras = getIntent().getExtras();
    Bundle remoteInput = null;

    if (extras != null) {
        Bundle originalExtras = extras.getBundle(PUSH_BUNDLE);

        originalExtras.putBoolean(FOREGROUND, false);
        originalExtras.putBoolean(COLDSTART, !isPushPluginActive);
        originalExtras.putBoolean(DISMISSED, extras.getBoolean(DISMISSED));
        originalExtras.putString(ACTION_CALLBACK, extras.getString(CALLBACK));
        originalExtras.remove(NO_CACHE);

        remoteInput = RemoteInput.getResultsFromIntent(intent);
        if (remoteInput != null) {
            String inputString = remoteInput.getCharSequence(INLINE_REPLY).toString();
            Log.d(LOG_TAG, "response: " + inputString);
            originalExtras.putString(INLINE_REPLY, inputString);
        }

        PushPlugin.sendExtras(originalExtras);
    }
    return remoteInput == null;
}
 
开发者ID:phonegap,项目名称:phonegap-plugin-push,代码行数:29,代码来源:PushHandlerActivity.java

示例11: onReceive

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(ACTION_EXAMPLE)) {
        if (mEnableMessages) {
            String message = intent.getStringExtra(NotificationUtil.EXTRA_MESSAGE);
            Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent);
            CharSequence replyMessage = null;
            if (remoteInputResults != null) {
                replyMessage = remoteInputResults.getCharSequence(NotificationUtil.EXTRA_REPLY);
            }
            if (replyMessage != null) {
                message = message + ": \"" + replyMessage + "\"";
            }
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
        }
    } else if (intent.getAction().equals(ACTION_ENABLE_MESSAGES)) {
        mEnableMessages = true;
    } else if (intent.getAction().equals(ACTION_DISABLE_MESSAGES)) {
        mEnableMessages = false;
    }
}
 
开发者ID:AndroidAvanzato,项目名称:Capitolo6,代码行数:22,代码来源:NotificationIntentReceiver.java

示例12: onStartCommand

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (null == intent || null == intent.getAction()) {
        return Service.START_STICKY;
    }
    String action = intent.getAction();
    if (action.equals(ACTION_RESPONSE)) {
        Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent);
        CharSequence replyMessage = "";
        if (remoteInputResults != null) {
            replyMessage = remoteInputResults.getCharSequence(EXTRA_REPLY);
        }
        processIncoming(replyMessage.toString());
    } else if (action.equals(MainActivity.ACTION_GET_CONVERSATION)) {
        broadcastMessage(mCompleteConversation.toString());
    }
    return Service.START_STICKY;
}
 
开发者ID:mauimauer,项目名称:AndroidWearable-Samples,代码行数:19,代码来源:ResponderService.java

示例13: triggerUserCommandFromRemoteInput

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
private void triggerUserCommandFromRemoteInput(final Context context, Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput == null) {
        return;
    }
    final String selectedCommand = remoteInput.getCharSequence(EXTRA_USER_COMMAND).toString();
    final PendingResult pendingResult = goAsync();
    final LiveData<Source> sourceLiveData = MuzeiDatabase.getInstance(context).sourceDao().getCurrentSource();
    sourceLiveData.observeForever(new Observer<Source>() {
        @Override
        public void onChanged(@Nullable final Source selectedSource) {
            sourceLiveData.removeObserver(this);
            if (selectedSource != null) {
                for (UserCommand action : selectedSource.commands) {
                    if (TextUtils.equals(selectedCommand, action.getTitle())) {
                        SourceManager.sendAction(context, action.getId());
                        break;
                    }
                    pendingResult.finish();
                }
            }
        }
    });
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:25,代码来源:NewWallpaperNotificationReceiver.java

示例14: onCreate

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_voice_noti);
	
	//note android developer page, shows this in a separate method, but not necessary.
	
	Bundle remoteInput = RemoteInput.getResultsFromIntent( getIntent());
    if (remoteInput != null) {
        info = remoteInput.getCharSequence(EXTRA_VOICE_REPLY).toString();
    } else {
		info = "No voice reponse.";
	} 
	logger = (TextView) findViewById(R.id.logger);
	logger.setText(info);
}
 
开发者ID:JimSeker,项目名称:wearable,代码行数:17,代码来源:VoiceNotiActivity.java

示例15: onCreate

import android.support.v4.app.RemoteInput; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_voice_noti);
	
	//note android developer page, shows this in a separate method, but not necessary.
	
	Bundle remoteInput = RemoteInput.getResultsFromIntent( getIntent());
    if (remoteInput != null) {
        info = remoteInput.getCharSequence(EXTRA_VOICE_REPLY).toString();
    } else {
		info = "No voice response.";
	} 
	logger = (TextView) findViewById(R.id.logger);
	logger.setText(info);
}
 
开发者ID:JimSeker,项目名称:wearable,代码行数:17,代码来源:VoiceNotiActivity.java


注:本文中的android.support.v4.app.RemoteInput.getResultsFromIntent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。