android.content.Intent#getCharSequenceArrayListExtra ( )源码实例Demo

下面列出了android.content.Intent#getCharSequenceArrayListExtra ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public void onResult(Activity activity, int requestCode, int resultCode, Intent data) {
	if (resultCode == Activity.RESULT_CANCELED){
		flushResponse(TiC.PROPERTY_CANCEL, true, TiC.PROPERTY_SUCCESS, false, TiC.EVENT_PROPERTY_MESSAGE, "Result Cancelled");
		
	} else if (Defaults.REQUEST_CODE == requestCode && resultCode == Activity.RESULT_OK) {
		if (null != data && data.hasExtra(TiC.PROPERTY_SUCCESS) && data.hasExtra(Defaults.Params.IMAGES)) {
               ArrayList<CharSequence> imagePaths = data.getCharSequenceArrayListExtra(Defaults.Params.IMAGES);
               flushResponse(TiC.PROPERTY_CANCEL, false, TiC.PROPERTY_SUCCESS, true, Defaults.Params.IMAGES, imagePaths.toArray());
           }
	}
}
 
@Override
public void onResult(Activity activity, int requestCode, int resultCode, Intent data) {
	if (resultCode == Activity.RESULT_CANCELED){
		flushResponse(TiC.PROPERTY_CANCEL, true, TiC.PROPERTY_SUCCESS, false, TiC.EVENT_PROPERTY_MESSAGE, "Result Cancelled");
		
	} else if (Defaults.REQUEST_CODE == requestCode && resultCode == Activity.RESULT_OK) {
		if (null != data && data.hasExtra(TiC.PROPERTY_SUCCESS) && data.hasExtra(Defaults.Params.IMAGES)) {
               ArrayList<CharSequence> imagePaths = data.getCharSequenceArrayListExtra(Defaults.Params.IMAGES);
               flushResponse(TiC.PROPERTY_CANCEL, false, TiC.PROPERTY_SUCCESS, true, Defaults.Params.IMAGES, imagePaths.toArray());
           }
	}
}
 
源代码3 项目: Chimee   文件: CodeConverterDetailsActivity.java
private static ArrayList<CharSequence> getTextFromIntent(Intent intent) {
    ArrayList<CharSequence> renderedParagraphs = new ArrayList<>();
    ArrayList<CharSequence> paragraphs = intent.getCharSequenceArrayListExtra(DETAILS_TEXT_KEY);
    if (paragraphs == null || paragraphs.size() == 0)
        return renderedParagraphs;
    for (CharSequence paragraph : paragraphs) {
        List<String> renderedText = renderText(paragraph.toString());
        renderedParagraphs.addAll(renderedText);
    }
    return renderedParagraphs;
}
 
源代码4 项目: decorator-wechat   文件: MessagingBuilder.java
@Override public void onReceive(final Context context, final Intent proxy) {
	final PendingIntent reply_action = proxy.getParcelableExtra(EXTRA_REPLY_ACTION);
	final String result_key = proxy.getStringExtra(EXTRA_RESULT_KEY), reply_prefix = proxy.getStringExtra(EXTRA_REPLY_PREFIX);
	final Uri data = proxy.getData(); final Bundle results = RemoteInput.getResultsFromIntent(proxy);
	final CharSequence input = results != null ? results.getCharSequence(result_key) : null;
	if (data == null || reply_action == null || result_key == null || input == null) return;	// Should never happen

	final String key = data.getSchemeSpecificPart(), original_key = proxy.getStringExtra(EXTRA_ORIGINAL_KEY);
	if (BuildConfig.DEBUG && "debug".equals(input.toString())) {
		final Conversation conversation = mController.getConversation(proxy.getIntExtra(EXTRA_CONVERSATION_ID, 0));
		if (conversation != null) showDebugNotification(conversation, "Type: " + conversation.typeToString());
		mController.recastNotification(original_key != null ? original_key : key, null);
		return;
	}
	final CharSequence text;
	if (reply_prefix != null) {
		text = reply_prefix + input;
		results.putCharSequence(result_key, text);
		RemoteInput.addResultsToIntent(new RemoteInput[]{ new RemoteInput.Builder(result_key).build() }, proxy, results);
	} else text = input;
	final ArrayList<CharSequence> history = SDK_INT >= N ? proxy.getCharSequenceArrayListExtra(EXTRA_REMOTE_INPUT_HISTORY) : null;
	try {
		final Intent input_data = addTargetPackageAndWakeUp(reply_action);
		input_data.setClipData(proxy.getClipData());

		reply_action.send(mContext, 0, input_data, (pendingIntent, intent, _result_code, _result_data, _result_extras) -> {
			if (BuildConfig.DEBUG) Log.d(TAG, "Reply sent: " + intent.toUri(0));
			if (SDK_INT >= N) {
				final Bundle addition = new Bundle(); final CharSequence[] inputs;
				final boolean to_current_user = Process.myUserHandle().equals(pendingIntent.getCreatorUserHandle());
				if (to_current_user && context.getPackageManager().queryBroadcastReceivers(intent, 0).isEmpty()) {
					inputs = new CharSequence[] { context.getString(R.string.wechat_with_no_reply_receiver) };
				} else if (history != null) {
					history.add(0, text);
					inputs = history.toArray(new CharSequence[0]);
				} else inputs = new CharSequence[] { text };
				addition.putCharSequenceArray(EXTRA_REMOTE_INPUT_HISTORY, inputs);
				mController.recastNotification(original_key != null ? original_key : key, addition);
			}
			markRead(key);
		}, null);
	} catch (final PendingIntent.CanceledException e) {
		Log.w(TAG, "Reply action is already cancelled: " + key);
		abortBroadcast();
	}
}
 
源代码5 项目: Ticket-Analysis   文件: IntentUtil.java
public static ArrayList<CharSequence> getCharSequenceArrayListExtra(Intent intent, String name) {
    if (!hasIntent(intent) || !hasExtra(intent, name)) return null;
    return intent.getCharSequenceArrayListExtra(name);
}
 
 方法所在类
 同类方法