List of usage examples for android.content Intent getClipData
public @Nullable ClipData getClipData()
From source file:com.cerema.cloud2.ui.activity.FileDisplayActivity.java
/** * Called, when the user selected something for uploading * *//* ww w . jav a 2 s . co m*/ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == ACTION_SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { //getClipData is only supported on api level 16+, Jelly Bean if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && data.getClipData() != null && data.getClipData().getItemCount() > 0) { for (int i = 0; i < data.getClipData().getItemCount(); i++) { Intent intent = new Intent(); intent.setData(data.getClipData().getItemAt(i).getUri()); requestSimpleUpload(intent, resultCode); } } else { requestSimpleUpload(data, resultCode); } } else if (requestCode == ACTION_SELECT_MULTIPLE_FILES && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { requestMultipleUpload(data, resultCode); } else if (requestCode == ACTION_MOVE_FILES && resultCode == RESULT_OK) { final Intent fData = data; final int fResultCode = resultCode; getHandler().postDelayed(new Runnable() { @Override public void run() { requestMoveOperation(fData, fResultCode); } }, DELAY_TO_REQUEST_OPERATIONS_LATER); } else if (requestCode == ACTION_COPY_FILES && resultCode == RESULT_OK) { final Intent fData = data; final int fResultCode = resultCode; getHandler().postDelayed(new Runnable() { @Override public void run() { requestCopyOperation(fData, fResultCode); } }, DELAY_TO_REQUEST_OPERATIONS_LATER); } else { super.onActivityResult(requestCode, resultCode, data); } }
From source file:com.slarker.tech.hi0734.view.widget.webview.AdvancedWebView.java
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { if (requestCode == mRequestCodeFilePicker) { if (resultCode == Activity.RESULT_OK) { if (intent != null) { if (mFileUploadCallbackFirst != null) { mFileUploadCallbackFirst.onReceiveValue(intent.getData()); mFileUploadCallbackFirst = null; } else if (mFileUploadCallbackSecond != null) { Uri[] dataUris = null; try { if (intent.getDataString() != null) { dataUris = new Uri[] { Uri.parse(intent.getDataString()) }; } else { if (Build.VERSION.SDK_INT >= 16) { if (intent.getClipData() != null) { final int numSelectedFiles = intent.getClipData().getItemCount(); dataUris = new Uri[numSelectedFiles]; for (int i = 0; i < numSelectedFiles; i++) { dataUris[i] = intent.getClipData().getItemAt(i).getUri(); }//from w ww .ja v a2 s . c o m } } } } catch (Exception ignored) { } mFileUploadCallbackSecond.onReceiveValue(dataUris); mFileUploadCallbackSecond = null; } } } else { if (mFileUploadCallbackFirst != null) { mFileUploadCallbackFirst.onReceiveValue(null); mFileUploadCallbackFirst = null; } else if (mFileUploadCallbackSecond != null) { mFileUploadCallbackSecond.onReceiveValue(null); mFileUploadCallbackSecond = null; } } } }
From source file:com.dycody.android.idealnote.DetailFragment.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void onActivityResultManageReceivedFiles(Intent intent) { List<Uri> uris = new ArrayList<>(); if (Build.VERSION.SDK_INT > 16 && intent.getClipData() != null) { for (int i = 0; i < intent.getClipData().getItemCount(); i++) { uris.add(intent.getClipData().getItemAt(i).getUri()); }/* ww w. j a va 2 s . c o m*/ } else { uris.add(intent.getData()); } for (Uri uri : uris) { String name = FileHelper.getNameFromUri(mainActivity, uri); new AttachmentTask(this, uri, name, this).execute(); } }
From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java
@SuppressWarnings("WrongConstant") @SuppressLint("NewApi") @Override//from w w w . j a va2s . c o m protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_SAVE) { changeState(stateSaveSkipCompleted); return; } else if (requestCode == IabConst.PURCHASE_REQUEST_CODE) { LWQApplication.getIabHelper().handleActivityResult(requestCode, resultCode, data); } else if (requestCode == REQUEST_CODE_ALBUM) { if (resultCode != RESULT_OK) { return; } List<String> resultUris = new ArrayList<>(); // final int takeFlags = data.getFlags() // & Intent.FLAG_GRANT_READ_URI_PERMISSION; if (data.getClipData() != null) { ClipData clipData = data.getClipData(); for (int i = 0; i < clipData.getItemCount(); i++) { Uri imageUri = clipData.getItemAt(i).getUri(); // getContentResolver().takePersistableUriPermission(imageUri, takeFlags); resultUris.add(imageUri.toString()); } } else if (data.getData() != null) { Uri imageUri = data.getData(); // getContentResolver().takePersistableUriPermission(imageUri, takeFlags); resultUris.add(imageUri.toString()); } chooseImageSourceModule.onImagesRecovered(resultUris); } super.onActivityResult(requestCode, resultCode, data); }
From source file:com.mb.android.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == PURCHASE_REQUEST) { if (resultCode == RESULT_OK) { if (currentProduct.getEmbyFeatureCode() != null) { AppstoreRegRequest request = new AppstoreRegRequest(); request.setStore(intent.getStringExtra("store")); request.setApplication(AppPackageName); request.setProduct(currentProduct.getSku()); request.setFeature(currentProduct.getEmbyFeatureCode()); request.setType(currentProduct.getProductType().toString()); if (intent.getStringExtra("storeId") != null) request.setStoreId(intent.getStringExtra("storeId")); request.setStoreToken(intent.getStringExtra("storeToken")); request.setEmail(purchaseEmail); request.setAmt(currentProduct.getPrice()); RespondToWebView(String.format("window.IapManager.onPurchaseComplete(" + jsonSerializer.SerializeToString(request) + ");")); } else { // no emby feature - just report success RespondToWebView(String.format("window.IapManager.onPurchaseComplete(true);")); }/*from w w w. j a v a 2 s.co m*/ } else { RespondToWebView(String.format("window.IapManager.onPurchaseComplete(false);")); } } else if (requestCode == REQUEST_DIRECTORY_SAF && resultCode == Activity.RESULT_OK) { Uri uri = intent.getData(); final int takeFlags = intent.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // Check for the freshest data. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getContentResolver().takePersistableUriPermission(uri, takeFlags); } RespondToWebviewWithSelectedPath(uri); } else if (requestCode == REQUEST_DIRECTORY && resultCode == RESULT_OK) { if (intent.getBooleanExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)) { // For JellyBean and above if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { ClipData clip = intent.getClipData(); if (clip != null) { for (int i = 0; i < clip.getItemCount(); i++) { Uri uri = clip.getItemAt(i).getUri(); RespondToWebviewWithSelectedPath(uri); } } // For Ice Cream Sandwich } else { ArrayList<String> paths = intent.getStringArrayListExtra(FilePickerActivity.EXTRA_PATHS); if (paths != null) { for (String path : paths) { Uri uri = Uri.parse(path); RespondToWebviewWithSelectedPath(uri); } } } } else { Uri uri = intent.getData(); // Do something with the URI if (uri != null) { RespondToWebviewWithSelectedPath(uri); } } } else if (requestCode == VIDEO_PLAYBACK) { /*boolean completed = resultCode == RESULT_OK; boolean error = resultCode == RESULT_OK ? false : (intent == null ? true : intent.getBooleanExtra("error", false)); long positionMs = intent == null || completed ? 0 : intent.getLongExtra("position", 0); String currentSrc = intent == null ? null : intent.getStringExtra(VideoPlayerActivity.PLAY_EXTRA_ITEM_LOCATION); if (currentSrc == null) { currentSrc = ""; } RespondToWebView(String.format("VideoRenderer.Current.onActivityClosed(%s, %s, %s, '%s');", !completed, error, positionMs, currentSrc));*/ } }
From source file:org.kontalk.ui.AbstractComposeFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // image from storage/picture from camera // since there are like up to 3 different ways of doing this... if (requestCode == SELECT_ATTACHMENT_OPENABLE || requestCode == SELECT_ATTACHMENT_PHOTO) { if (resultCode == Activity.RESULT_OK) { Uri[] uris = null;/*from w w w. ja v a 2 s . c o m*/ String[] mimes = null; // returning from camera if (requestCode == SELECT_ATTACHMENT_PHOTO) { if (mCurrentPhoto != null) { Uri uri = Uri.fromFile(mCurrentPhoto); // notify media scanner Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); mediaScanIntent.setData(uri); getActivity().sendBroadcast(mediaScanIntent); mCurrentPhoto = null; uris = new Uri[] { uri }; } } else { if (mCurrentPhoto != null) { mCurrentPhoto.delete(); mCurrentPhoto = null; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && data.getClipData() != null) { ClipData cdata = data.getClipData(); uris = new Uri[cdata.getItemCount()]; for (int i = 0; i < uris.length; i++) { ClipData.Item item = cdata.getItemAt(i); uris[i] = item.getUri(); } } else { uris = new Uri[] { data.getData() }; mimes = new String[] { data.getType() }; } // SAF available, request persistable permissions if (MediaStorage.isStorageAccessFrameworkAvailable()) { for (Uri uri : uris) { if (uri != null && !"file".equals(uri.getScheme())) { MediaStorage.requestPersistablePermissions(getActivity(), uri); } } } } for (int i = 0; uris != null && i < uris.length; i++) { Uri uri = uris[i]; if (uri == null) continue; String mime = (mimes != null && mimes.length >= uris.length) ? mimes[i] : null; if (mime == null || mime.startsWith("*/") || mime.endsWith("/*")) { mime = MediaStorage.getType(getActivity(), uri); Log.v(TAG, "using detected mime type " + mime); } if (ImageComponent.supportsMimeType(mime)) sendBinaryMessage(uri, mime, true, ImageComponent.class); else if (VCardComponent.supportsMimeType(mime)) sendBinaryMessage(uri, VCardComponent.MIME_TYPE, false, VCardComponent.class); else Toast.makeText(getActivity(), R.string.send_mime_not_supported, Toast.LENGTH_LONG).show(); } } // operation aborted else { // delete photo :) if (mCurrentPhoto != null) { mCurrentPhoto.delete(); mCurrentPhoto = null; } } } // contact card (vCard) else if (requestCode == SELECT_ATTACHMENT_CONTACT) { if (resultCode == Activity.RESULT_OK) { Uri uri = data.getData(); if (uri != null) { Uri vcardUri = null; // get lookup key final Cursor c = getContext().getContentResolver().query(uri, new String[] { Contacts.LOOKUP_KEY }, null, null, null); if (c != null) { try { if (c.moveToFirst()) { String lookupKey = c.getString(0); vcardUri = Uri.withAppendedPath(Contacts.CONTENT_VCARD_URI, lookupKey); } } catch (Exception e) { Log.w(TAG, "unable to lookup selected contact. Did you grant me the permission?", e); ReportingManager.logException(e); } finally { c.close(); } } if (vcardUri != null) { sendBinaryMessage(vcardUri, VCardComponent.MIME_TYPE, false, VCardComponent.class); } else { Toast.makeText(getContext(), R.string.err_no_contact, Toast.LENGTH_LONG).show(); } } } } // invite user else if (requestCode == REQUEST_INVITE_USERS) { if (resultCode == Activity.RESULT_OK) { ArrayList<Uri> uris; Uri threadUri = data.getData(); if (threadUri != null) { String userId = threadUri.getLastPathSegment(); addUsers(new String[] { userId }); } else if ((uris = data.getParcelableArrayListExtra("org.kontalk.contacts")) != null) { String[] users = new String[uris.size()]; for (int i = 0; i < users.length; i++) users[i] = uris.get(i).getLastPathSegment(); addUsers(users); } } } }
From source file:com.android.mail.compose.ComposeActivity.java
/** * Add attachment and update the compose area appropriately. *///from ww w. ja v a2 s .co m private void addAttachmentAndUpdateView(Intent data) { if (data == null) { return; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { final ClipData clipData = data.getClipData(); if (clipData != null) { for (int i = 0, size = clipData.getItemCount(); i < size; i++) { addAttachmentAndUpdateView(clipData.getItemAt(i).getUri()); } return; } } addAttachmentAndUpdateView(data.getData()); }
From source file:org.kontalk.ui.ComposeMessageFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // image from storage/picture from camera // since there are like up to 3 different ways of doing this... if (requestCode == SELECT_ATTACHMENT_OPENABLE || requestCode == SELECT_ATTACHMENT_PHOTO) { if (resultCode == Activity.RESULT_OK) { Uri[] uris = null;//from ww w . jav a 2s . com String[] mimes = null; // returning from camera if (data == null) { if (mCurrentPhoto != null) { Uri uri = Uri.fromFile(mCurrentPhoto); // notify media scanner Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); mediaScanIntent.setData(uri); getActivity().sendBroadcast(mediaScanIntent); mCurrentPhoto = null; uris = new Uri[] { uri }; } } else { if (mCurrentPhoto != null) { mCurrentPhoto.delete(); mCurrentPhoto = null; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && data.getClipData() != null) { ClipData cdata = data.getClipData(); uris = new Uri[cdata.getItemCount()]; for (int i = 0; i < uris.length; i++) { ClipData.Item item = cdata.getItemAt(i); uris[i] = item.getUri(); } } else { uris = new Uri[] { data.getData() }; mimes = new String[] { data.getType() }; } // SAF available, request persistable permissions if (MediaStorage.isStorageAccessFrameworkAvailable()) { for (Uri uri : uris) { if (uri != null && !"file".equals(uri.getScheme())) { MediaStorage.requestPersistablePermissions(getActivity(), uri); } } } } for (int i = 0; uris != null && i < uris.length; i++) { Uri uri = uris[i]; String mime = (mimes != null && mimes.length >= uris.length) ? mimes[i] : null; if (mime == null || mime.startsWith("*/") || mime.endsWith("/*")) { mime = MediaStorage.getType(getActivity(), uri); Log.v(TAG, "using detected mime type " + mime); } if (ImageComponent.supportsMimeType(mime)) sendBinaryMessage(uri, mime, true, ImageComponent.class); else if (VCardComponent.supportsMimeType(mime)) sendBinaryMessage(uri, VCardComponent.MIME_TYPE, false, VCardComponent.class); else Toast.makeText(getActivity(), R.string.send_mime_not_supported, Toast.LENGTH_LONG).show(); } } // operation aborted else { // delete photo :) if (mCurrentPhoto != null) { mCurrentPhoto.delete(); mCurrentPhoto = null; } } } // contact card (vCard) else if (requestCode == SELECT_ATTACHMENT_CONTACT) { if (resultCode == Activity.RESULT_OK) { Uri uri = data.getData(); if (uri != null) { // get lookup key final Cursor c = getActivity().getContentResolver().query(uri, new String[] { Contacts.LOOKUP_KEY }, null, null, null); if (c != null) { try { c.moveToFirst(); String lookupKey = c.getString(0); Uri vcardUri = Uri.withAppendedPath(Contacts.CONTENT_VCARD_URI, lookupKey); sendBinaryMessage(vcardUri, VCardComponent.MIME_TYPE, false, VCardComponent.class); } finally { c.close(); } } } } } }
From source file:org.naturenet.ui.MainActivity.java
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case (REQUEST_CODE_JOIN): { if (resultCode == Activity.RESULT_OK) { if (JoinActivity.EXTRA_LAUNCH.equals(data.getExtras().getString(JoinActivity.EXTRA_JOIN))) { showLaunchFragment();/*ww w . ja v a2 s . c o m*/ } else if (JoinActivity.EXTRA_LOGIN.equals(data.getExtras().getString(JoinActivity.EXTRA_JOIN))) { signed_user = data.getParcelableExtra(JoinActivity.EXTRA_NEW_USER); logout.setVisible(true); settings.setVisible(true); this.supportInvalidateOptionsMenu(); if (signed_user.avatar != null) { NatureNetUtils.showUserAvatar(this, nav_iv, signed_user.avatar); } display_name.setText(signed_user.displayName); mFirebase.child(Site.NODE_NAME).child(signed_user.affiliation).child(NAME) .addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot snapshot) { affiliation.setText((String) snapshot.getValue()); } @Override public void onCancelled(DatabaseError databaseError) { Timber.w("Could not get user's affiliation"); } }); sign_in.setVisibility(View.GONE); join.setVisibility(View.GONE); display_name.setVisibility(View.VISIBLE); affiliation.setVisibility(View.VISIBLE); goToExploreFragment(); drawer.openDrawer(GravityCompat.START); } } break; } case (REQUEST_CODE_LOGIN): { if (resultCode == Activity.RESULT_OK) { if (data.getStringExtra(LoginActivity.EXTRA_LOGIN).equals(LoginActivity.EXTRA_JOIN)) { goToJoinActivity(); } else { drawer.openDrawer(GravityCompat.START); } } break; } case REQUEST_CODE_CAMERA: { if (resultCode == MainActivity.RESULT_OK) { Timber.d("Camera Path: %s", cameraPhoto.getPhotoPath()); selectedImages.add(Uri.fromFile(new File(cameraPhoto.getPhotoPath()))); cameraPhoto.addToGallery(); setGallery(); goToAddObservationActivity(true); } break; } case REQUEST_CODE_GALLERY: { if (resultCode == MainActivity.RESULT_OK) { galleryPhoto.setPhotoUri(data.getData()); Timber.d("Gallery Path: %s", galleryPhoto.getPath()); observationPath = Uri.fromFile(new File(galleryPhoto.getPath())); setGallery(); goToAddObservationActivity(false); } break; } //This case is for retrieving images from the phone's Gallery app. case GALLERY_IMAGES: { //First, make sure the the user actually chose something. if (data != null) { //In this case, the user selected multiple images if (data.getClipData() != null) { for (int j = 0; j < data.getClipData().getItemCount(); j++) { selectedImages.add(data.getClipData().getItemAt(j).getUri()); Log.d("images", "selected image: " + data.getClipData().getItemAt(j).toString()); } } //in this case, the user selected just one image else if (data.getData() != null) { selectedImages.add(data.getData()); } //Here we should have our selected images goToAddObservationActivity(false); } break; } //This case is for retrieving images from the custom Gallery (phones using api <18). case IMAGE_PICKER_RESULTS: { if (resultCode == MainActivity.RESULT_OK) { selectedImages = data.getParcelableArrayListExtra("images"); goToAddObservationActivity(false); } break; } //Here we just handle the result of the Settings activity which isn't anything but we want to unhighlight it in the menu bar case SETTINGS: { navigationView.getMenu().findItem(R.id.nav_settings).setChecked(false); break; } } }
From source file:com.android.mail.compose.ComposeActivity.java
private void finishCreate() { final Bundle savedState = mInnerSavedState; findViews();/*from w ww .j a v a2s .c o m*/ final Intent intent = getIntent(); final Message message; final ArrayList<AttachmentPreview> previews; mShowQuotedText = false; final CharSequence quotedText; int action; // Check for any of the possibly supplied accounts.; final Account account; if (hadSavedInstanceStateMessage(savedState)) { action = savedState.getInt(EXTRA_ACTION, COMPOSE); account = savedState.getParcelable(Utils.EXTRA_ACCOUNT); message = savedState.getParcelable(EXTRA_MESSAGE); previews = savedState.getParcelableArrayList(EXTRA_ATTACHMENT_PREVIEWS); mRefMessage = savedState.getParcelable(EXTRA_IN_REFERENCE_TO_MESSAGE); quotedText = savedState.getCharSequence(EXTRA_QUOTED_TEXT); mExtraValues = savedState.getParcelable(EXTRA_VALUES); // Get the draft id from the request id if there is one. if (savedState.containsKey(EXTRA_REQUEST_ID)) { final int requestId = savedState.getInt(EXTRA_REQUEST_ID); if (sRequestMessageIdMap.containsKey(requestId)) { synchronized (mDraftLock) { mDraftId = sRequestMessageIdMap.get(requestId); } } } } else { account = obtainAccount(intent); action = intent.getIntExtra(EXTRA_ACTION, COMPOSE); // Initialize the message from the message in the intent message = intent.getParcelableExtra(ORIGINAL_DRAFT_MESSAGE); previews = intent.getParcelableArrayListExtra(EXTRA_ATTACHMENT_PREVIEWS); mRefMessage = intent.getParcelableExtra(EXTRA_IN_REFERENCE_TO_MESSAGE); mRefMessageUri = intent.getParcelableExtra(EXTRA_IN_REFERENCE_TO_MESSAGE_URI); quotedText = null; if (Analytics.isLoggable()) { if (intent.getBooleanExtra(Utils.EXTRA_FROM_NOTIFICATION, false)) { Analytics.getInstance().sendEvent("notification_action", "compose", getActionString(action), 0); } } } mAttachmentsView.setAttachmentPreviews(previews); setAccount(account); if (mAccount == null) { return; } initRecipients(); // Clear the notification and mark the conversation as seen, if necessary final Folder notificationFolder = intent.getParcelableExtra(EXTRA_NOTIFICATION_FOLDER); if (notificationFolder != null) { final Uri conversationUri = intent.getParcelableExtra(EXTRA_NOTIFICATION_CONVERSATION); Intent actionIntent; if (conversationUri != null) { actionIntent = new Intent(MailIntentService.ACTION_RESEND_NOTIFICATIONS_WEAR); actionIntent.putExtra(Utils.EXTRA_CONVERSATION, conversationUri); } else { actionIntent = new Intent(MailIntentService.ACTION_CLEAR_NEW_MAIL_NOTIFICATIONS); actionIntent.setData(Utils.appendVersionQueryParameter(this, notificationFolder.folderUri.fullUri)); } actionIntent.setPackage(getPackageName()); actionIntent.putExtra(Utils.EXTRA_ACCOUNT, account); actionIntent.putExtra(Utils.EXTRA_FOLDER, notificationFolder); startService(actionIntent); } if (intent.getBooleanExtra(EXTRA_FROM_EMAIL_TASK, false)) { mLaunchedFromEmail = true; } else if (Intent.ACTION_SEND.equals(intent.getAction())) { final Uri dataUri = intent.getData(); if (dataUri != null) { final String dataScheme = intent.getData().getScheme(); final String accountScheme = mAccount.composeIntentUri.getScheme(); mLaunchedFromEmail = TextUtils.equals(dataScheme, accountScheme); } } if (mRefMessageUri != null) { mShowQuotedText = true; mComposeMode = action; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); String wearReply = null; if (remoteInput != null) { LogUtils.d(LOG_TAG, "Got remote input from new api"); CharSequence input = remoteInput.getCharSequence(NotificationActionUtils.WEAR_REPLY_INPUT); if (input != null) { wearReply = input.toString(); } } else { // TODO: remove after legacy code has been removed. LogUtils.d(LOG_TAG, "No remote input from new api, falling back to compatibility mode"); ClipData clipData = intent.getClipData(); if (clipData != null && LEGACY_WEAR_EXTRA.equals(clipData.getDescription().getLabel())) { Bundle extras = clipData.getItemAt(0).getIntent().getExtras(); if (extras != null) { wearReply = extras.getString(NotificationActionUtils.WEAR_REPLY_INPUT); } } } if (!TextUtils.isEmpty(wearReply)) { createWearReplyTask(this, mRefMessageUri, UIProvider.MESSAGE_PROJECTION, mComposeMode, wearReply).execute(); finish(); return; } else { LogUtils.w(LOG_TAG, "remote input string is null"); } } getLoaderManager().initLoader(INIT_DRAFT_USING_REFERENCE_MESSAGE, null, this); return; } else if (message != null && action != EDIT_DRAFT) { initFromDraftMessage(message); initQuotedTextFromRefMessage(mRefMessage, action); mShowQuotedText = message.appendRefMessageContent; // if we should be showing quoted text but mRefMessage is null // and we have some quotedText, display that if (mShowQuotedText && mRefMessage == null) { if (quotedText != null) { initQuotedText(quotedText, false /* shouldQuoteText */); } else if (mExtraValues != null) { initExtraValues(mExtraValues); return; } } } else if (action == EDIT_DRAFT) { if (message == null) { throw new IllegalStateException("Message must not be null to edit draft"); } initFromDraftMessage(message); // Update the action to the draft type of the previous draft switch (message.draftType) { case UIProvider.DraftType.REPLY: action = REPLY; break; case UIProvider.DraftType.REPLY_ALL: action = REPLY_ALL; break; case UIProvider.DraftType.FORWARD: action = FORWARD; break; case UIProvider.DraftType.COMPOSE: default: action = COMPOSE; break; } LogUtils.d(LOG_TAG, "Previous draft had action type: %d", action); mShowQuotedText = message.appendRefMessageContent; if (message.refMessageUri != null) { // If we're editing an existing draft that was in reference to an existing message, // still need to load that original message since we might need to refer to the // original sender and recipients if user switches "reply <-> reply-all". mRefMessageUri = message.refMessageUri; mComposeMode = action; getLoaderManager().initLoader(REFERENCE_MESSAGE_LOADER, null, this); return; } } else if ((action == REPLY || action == REPLY_ALL || action == FORWARD)) { if (mRefMessage != null) { initFromRefMessage(action); mShowQuotedText = true; } } else { if (initFromExtras(intent)) { return; } } mComposeMode = action; finishSetup(action, intent, savedState); }