Java Code Examples for android.content.Intent#getCharSequenceArrayListExtra()

The following examples show how to use android.content.Intent#getCharSequenceArrayListExtra() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GalleryResultHandler.java    From titanium-imagepicker with Apache License 2.0 5 votes vote down vote up
@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());
           }
	}
}
 
Example 2
Source File: GalleryResultHandler.java    From titanium-imagepicker with Apache License 2.0 5 votes vote down vote up
@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());
           }
	}
}
 
Example 3
Source File: CodeConverterDetailsActivity.java    From Chimee with MIT License 5 votes vote down vote up
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;
}
 
Example 4
Source File: MessagingBuilder.java    From decorator-wechat with Apache License 2.0 4 votes vote down vote up
@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();
	}
}
 
Example 5
Source File: IntentUtil.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
public static ArrayList<CharSequence> getCharSequenceArrayListExtra(Intent intent, String name) {
    if (!hasIntent(intent) || !hasExtra(intent, name)) return null;
    return intent.getCharSequenceArrayListExtra(name);
}