List of usage examples for android.content Intent getDataString
public @Nullable String getDataString()
From source file:com.contralabs.inmap.activities.MainActivity.java
private boolean verifyIntentSearch(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); EasyTracker.getTracker().sendEvent("UserAction", "Search", query, 0l); if (query.length() > 2 && query.endsWith("s")) // To search plurals as singular (pt) query = query.substring(0, query.length() - 1); mStoreListFragment.setStoreParameters(new StoreParameters().setText(query)); if (!isLeftMenuShowing()) toggleList();//from w ww. j a v a 2 s .c om if (!isShowingStoreList) showStoreList(); mDbAdapter.open(); try { mDbAdapter.saveSearchPerformed(null, query); // FIXME Get facebook id if logged in } finally { mDbAdapter.close(); } return true; } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { // Handle a suggestions click (because the suggestions all use ACTION_VIEW) long id = Long.parseLong(intent.getDataString()); Store store; mDbAdapter.open(); try { store = mDbAdapter.getStore(id); } finally { mDbAdapter.close(); } onStoreSelected(store); return true; } else if (intent.getBooleanExtra(SHOW_SEARCH, false)) { onSearchClicked(); return true; } return false; }
From source file:id.ridon.keude.AppDetailsData.java
public void tryOpenUri(String s) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(s)); if (intent.resolveActivity(getPackageManager()) == null) { Toast.makeText(this, getString(R.string.no_handler_app, intent.getDataString()), Toast.LENGTH_LONG) .show();/* w w w. j av a 2 s . com*/ return; } startActivity(intent); }
From source file:com.hybris.mobile.activity.AbstractProductDetailActivity.java
/** * Handle incoming intents. Do not load a product if we already have one. *//*from ww w. j av a2 s. c o m*/ @Override protected void onResume() { super.onResume(); String[] options = { InternalConstants.PRODUCT_OPTION_BASIC, InternalConstants.PRODUCT_OPTION_CATEGORIES, InternalConstants.PRODUCT_OPTION_CLASSIFICATION, InternalConstants.PRODUCT_OPTION_DESCRIPTION, InternalConstants.PRODUCT_OPTION_GALLERY, InternalConstants.PRODUCT_OPTION_PRICE, InternalConstants.PRODUCT_OPTION_PROMOTIONS, InternalConstants.PRODUCT_OPTION_REVIEW, InternalConstants.PRODUCT_OPTION_STOCK, InternalConstants.PRODUCT_OPTION_VARIANT }; String productCode = null; Intent intent = getIntent(); // Direct Call if (intent.hasExtra(DataConstants.PRODUCT_CODE)) //direct call from search list for example { productCode = intent.getStringExtra(DataConstants.PRODUCT_CODE); } // NFC Call else if (intent.hasExtra(NfcAdapter.EXTRA_TAG)) //NFC { Tag tag = getIntent().getExtras().getParcelable(NfcAdapter.EXTRA_TAG); Ndef ndef = Ndef.get(tag); NdefMessage message = ndef.getCachedNdefMessage(); NdefRecord record = message.getRecords()[0]; if (record.getTnf() == NdefRecord.TNF_WELL_KNOWN && Arrays.equals(record.getType(), NdefRecord.RTD_URI)) { productCode = RegexUtil .getProductCode(new String(record.getPayload(), 1, record.getPayload().length - 1)); } } // Call from another application (QR Code) else if (StringUtils.equals(intent.getAction(), Intent.ACTION_VIEW)) { productCode = RegexUtil.getProductCode(intent.getDataString()); } if (StringUtils.isNotEmpty(productCode)) { this.enableAndroidBeam(productCode); } // Only load if we don't have a product already if (mProduct == null) { populateProduct(productCode, options); } invalidateOptionsMenu(); }
From source file:org.openhab.habdroid.ui.OpenHABMainActivity.java
/** * This method is called when activity receives a new intent while running *//*from w ww . ja va2s. c o m*/ @Override public void onNewIntent(Intent newIntent) { if (newIntent.getAction() != null) { Log.d(TAG, "New intent received = " + newIntent.getAction()); if (newIntent.getAction().equals("android.nfc.action.NDEF_DISCOVERED")) { Log.d(TAG, "This is NFC action"); if (newIntent.getDataString() != null) { Log.d(TAG, "Action data = " + newIntent.getDataString()); onNfcTag(newIntent.getDataString()); } } else if (newIntent.getAction().equals("org.openhab.notification.selected")) { onNotificationSelected(newIntent); } else if (newIntent.getAction().equals("android.intent.action.VIEW")) { Log.d(TAG, "This is URL Action"); onNfcTag(newIntent.getDataString()); } } }
From source file:com.honglang.zxing.CaptureActivity.java
@Override protected void onResume() { super.onResume(); // CameraManager must be initialized here, not in onCreate(). This is // necessary because we don't // want to open the camera driver and measure the screen size if we're // going to show the help on // first launch. That led to bugs where the scanning rectangle was the // wrong size and partially // off screen. cameraManager = new CameraManager(getApplication()); viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view); viewfinderView.setCameraManager(cameraManager); // resultView = findViewById(R.id.result_view); statusView = (TextView) findViewById(R.id.status_view); handler = null;//w w w. j a v a 2 s. c o m lastResult = null; resetStatusView(); SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view); SurfaceHolder surfaceHolder = surfaceView.getHolder(); if (hasSurface) { // The activity was paused but not stopped, so the surface still // exists. Therefore // surfaceCreated() won't be called, so init the camera here. initCamera(surfaceHolder); } else { // Install the callback and wait for surfaceCreated() to init the // camera. surfaceHolder.addCallback(this); } beepManager.updatePrefs(); ambientLightManager.start(cameraManager); inactivityTimer.onResume(); Intent intent = getIntent(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); copyToClipboard = prefs.getBoolean(PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true) && (intent == null || intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true)); source = IntentSource.NONE; decodeFormats = null; characterSet = null; if (intent != null) { String action = intent.getAction(); String dataString = intent.getDataString(); if (Intents.Scan.ACTION.equals(action)) { // Scan the formats the intent requested, and return the result // to the calling activity. source = IntentSource.NATIVE_APP_INTENT; decodeFormats = DecodeFormatManager.parseDecodeFormats(intent); decodeHints = DecodeHintManager.parseDecodeHints(intent); if (intent.hasExtra(Intents.Scan.WIDTH) && intent.hasExtra(Intents.Scan.HEIGHT)) { int width = intent.getIntExtra(Intents.Scan.WIDTH, 0); int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0); if (width > 0 && height > 0) { cameraManager.setManualFramingRect(width, height); } } String customPromptMessage = intent.getStringExtra(Intents.Scan.PROMPT_MESSAGE); if (customPromptMessage != null) { statusView.setText(customPromptMessage); } } else if (dataString != null && dataString.contains("http://www.google") && dataString.contains("/m/products/scan")) { // Scan only products and send the result to mobile Product // Search. source = IntentSource.PRODUCT_SEARCH_LINK; sourceUrl = dataString; decodeFormats = DecodeFormatManager.PRODUCT_FORMATS; } else if (isZXingURL(dataString)) { // Scan formats requested in query string (all formats if none // specified). // If a return URL is specified, send the results there. // Otherwise, handle it ourselves. source = IntentSource.ZXING_LINK; sourceUrl = dataString; Uri inputUri = Uri.parse(dataString); // scanFromWebPageManager = new // ScanFromWebPageManager(inputUri); decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri); // Allow a sub-set of the hints to be specified by the caller. decodeHints = DecodeHintManager.parseDecodeHints(inputUri); } characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET); } }
From source file:org.dkf.jmule.activities.MainActivity.java
@Override protected void onNewIntent(Intent intent) { log.info("[main activity] on new intent {}", intent); if (intent == null) { return;/*from ww w. j a va 2 s . com*/ } if (isShutdown(intent)) { return; } String action = intent.getAction(); // view action here - check type of link and load data if (action != null && action.equals("android.intent.action.VIEW")) { try { final String uri = intent.getDataString(); if (uri != null && uri.startsWith("content")) { List<EMuleLink> links = parseCollectionContent(this, Uri.parse(uri)); log.info("link size {}", links.size()); if (!Engine.instance().isStarted()) { UIUtils.showInformationDialog(this, R.string.add_collection_session_stopped_body, R.string.add_collection_session_stopped_title, false, null); return; } if (!links.isEmpty()) { controller.showTransfers(TransferStatus.ALL); HandpickedCollectionDownloadDialog dialog = HandpickedCollectionDownloadDialog .newInstance(this, links); dialog.show(getFragmentManager()); } else { UIUtils.showInformationDialog(this, R.string.add_collection_empty, R.string.add_collection_session_stopped_title, false, null); } return; } EMuleLink link = EMuleLink.fromString(uri); if (link.getType().equals(EMuleLink.LinkType.SERVER)) { ServerMet sm = new ServerMet(); ConfigurationManager.instance().getSerializable(Constants.PREF_KEY_SERVERS_LIST, sm); try { sm.addServer(ServerMet.ServerMetEntry.create(link.getStringValue(), (int) link.getNumberValue(), "[" + link.getStringValue() + "]", "")); ConfigurationManager.instance().setSerializable(Constants.PREF_KEY_SERVERS_LIST, sm); servers.setupAdapter(); controller.showServers(); } catch (JED2KException e) { e.printStackTrace(); } } else if (link.getType().equals(EMuleLink.LinkType.SERVERS)) { final String serversLink = link.getStringValue(); final MainActivity main = this; AsyncTask<Void, Void, ServerMet> task = new AsyncTask<Void, Void, ServerMet>() { @Override protected ServerMet doInBackground(Void... voids) { try { byte[] data = IOUtils.toByteArray(new URI(serversLink)); ByteBuffer buffer = ByteBuffer.wrap(data); buffer.order(ByteOrder.LITTLE_ENDIAN); ServerMet sm = new ServerMet(); sm.get(buffer); return sm; } catch (Exception e) { log.error("unable to load servers {}", e); } return null; } @Override protected void onPostExecute(ServerMet result) { if (result != null) { lastLoadedServers = result; UIUtils.showYesNoDialog(main, R.string.add_servers_list_text, R.string.add_servers_list_title, main); } else { UIUtils.showInformationDialog(main, R.string.link_download_failed, R.string.link_download_failed, true, null); } } }; task.execute(); } else if (link.getType().equals(EMuleLink.LinkType.NODES)) { final String serversLink = link.getStringValue(); final MainActivity main = this; AsyncTask<Void, Void, KadNodesDat> task = new AsyncTask<Void, Void, KadNodesDat>() { @Override protected KadNodesDat doInBackground(Void... voids) { try { byte[] data = IOUtils.toByteArray(new URI(serversLink)); ByteBuffer buffer = ByteBuffer.wrap(data); buffer.order(ByteOrder.LITTLE_ENDIAN); KadNodesDat sm = new KadNodesDat(); sm.get(buffer); return sm; } catch (Exception e) { log.error("unable to load nodes dat {}", e); } return null; } @Override protected void onPostExecute(KadNodesDat result) { if (result != null) { if (!Engine.instance().addDhtNodes(result)) { UIUtils.showInformationDialog(main, R.string.nodes_link_open_error_text, R.string.nodes_link_open_error_title, false, null); } } else { UIUtils.showInformationDialog(main, R.string.link_download_failed, R.string.link_download_failed, true, null); } } }; task.execute(); } else if (link.getType().equals(EMuleLink.LinkType.FILE)) { transfers.startTransferFromLink(intent.getDataString()); controller.showTransfers(TransferStatus.ALL); } else { log.error("wtf? link unrecognized {}", intent.getDataString()); } } catch (JED2KException e) { log.error("intent get data parse error {}", e.toString()); UIUtils.showInformationDialog(this, R.string.intent_link_parse_error, R.string.add_servers_list_title, true, null); } } if (action != null) { if (action.equals(ED2KService.ACTION_SHOW_TRANSFERS)) { intent.setAction(null); controller.showTransfers(TransferStatus.ALL); } else if (action.equals(ED2KService.ACTION_REQUEST_SHUTDOWN)) { showShutdownDialog(); } } if (intent.hasExtra(ED2KService.EXTRA_DOWNLOAD_COMPLETE_NOTIFICATION)) { controller.showTransfers(TransferStatus.COMPLETED); try { ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) .cancel(Constants.NOTIFICATION_DOWNLOAD_TRANSFER_FINISHED); Bundle extras = intent.getExtras(); if (extras.containsKey(Constants.EXTRA_DOWNLOAD_COMPLETE_PATH)) { File file = new File(extras.getString(Constants.EXTRA_DOWNLOAD_COMPLETE_PATH)); if (file.isFile()) { //UIUtils.openFile(this, file.getAbsoluteFile()); } } } catch (Exception e) { log.warn("Error handling download complete notification", e); } } if (intent.hasExtra(Constants.EXTRA_FINISH_MAIN_ACTIVITY)) { finish(); } }
From source file:mgks.os.webview.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (Build.VERSION.SDK_INT >= 21) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimary)); Uri[] results = null;/* www. j a v a 2 s. com*/ if (resultCode == Activity.RESULT_OK) { if (requestCode == asw_file_req) { if (null == asw_file_path) { return; } if (intent == null || intent.getData() == null) { if (asw_cam_message != null) { results = new Uri[] { Uri.parse(asw_cam_message) }; } } else { String dataString = intent.getDataString(); if (dataString != null) { results = new Uri[] { Uri.parse(dataString) }; } else { if (ASWP_MULFILE) { if (intent.getClipData() != null) { final int numSelectedFiles = intent.getClipData().getItemCount(); results = new Uri[numSelectedFiles]; for (int i = 0; i < numSelectedFiles; i++) { results[i] = intent.getClipData().getItemAt(i).getUri(); } } } } } } } asw_file_path.onReceiveValue(results); asw_file_path = null; } else { if (requestCode == asw_file_req) { if (null == asw_file_message) return; Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData(); asw_file_message.onReceiveValue(result); asw_file_message = null; } } }
From source file:org.zirco.ui.activities.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); INSTANCE = this; Constants.initializeConstantsFromResources(this); Controller.getInstance().setPreferences(PreferenceManager.getDefaultSharedPreferences(this)); if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_SHOW_FULL_SCREEN, false)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); }//from w w w . j a va2 s. com if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_GENERAL_HIDE_TITLE_BARS, true)) { requestWindowFeature(Window.FEATURE_NO_TITLE); } setProgressBarVisibility(true); setContentView(R.layout.main); mCircularProgress = getResources().getDrawable(R.drawable.spinner); EventController.getInstance().addDownloadListener(this); mHideToolbarsRunnable = null; mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); buildComponents(); updateSwitchTabsMethod(); Intent i = getIntent(); if (i.getData() != null) { // App first launch from another app. addFirstTab(false); navigateToUrl(i.getDataString()); } else { // Normal start. int currentVersionCode = ApplicationUtils.getApplicationVersionCode(this); int savedVersionCode = PreferenceManager.getDefaultSharedPreferences(this) .getInt(Constants.PREFERENCES_LAST_VERSION_CODE, -1); // If currentVersionCode and savedVersionCode are different, the application has been updated. if (currentVersionCode != savedVersionCode) { // Save current version code. Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit(); editor.putInt(Constants.PREFERENCES_LAST_VERSION_CODE, currentVersionCode); editor.commit(); // Display changelog dialog. Intent changelogIntent = new Intent(this, ChangelogActivity.class); startActivity(changelogIntent); } addFirstTab(true); } initializeWebIconDatabase(); startToolbarsHideRunnable(); }
From source file:com.facebook.react.views.webview.ReactWebViewManager.java
@Override protected WebView createViewInstance(final ThemedReactContext reactContext) { final ReactWebView webView = new ReactWebView(reactContext); /**/* w w w .j a v a2s .c o m*/ * cookie? * 5.0???cookie,5.0?false * */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true); } webView.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); reactContext.getCurrentActivity().startActivity(intent); // DownloadManager.Request request = new DownloadManager.Request( // Uri.parse(url)); // // request.setMimeType(mimetype); // String cookies = CookieManager.getInstance().getCookie(url); // request.addRequestHeader("cookie", cookies); // request.addRequestHeader("User-Agent", userAgent); // request.allowScanningByMediaScanner(); //// request.setTitle() // request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed! // request.setDestinationInExternalPublicDir( // Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName( // url, contentDisposition, mimetype)); // DownloadManager dm = (DownloadManager) reactContext.getCurrentActivity().getSystemService(DOWNLOAD_SERVICE); // dm.enqueue(request); // Toast.makeText(reactContext, "...", //To notify the Client that the file is being downloaded // Toast.LENGTH_LONG).show(); } }); webView.setWebChromeClient(new WebChromeClient() { @Override public boolean onConsoleMessage(ConsoleMessage message) { if (ReactBuildConfig.DEBUG) { return super.onConsoleMessage(message); } // Ignore console logs in non debug builds. return true; } @Override public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { callback.invoke(origin, true, false); } private File createImageFile() throws IOException { // Create an image file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_"; File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); File imageFile = new File(storageDir, /* directory */ imageFileName + ".jpg" /* filename */ ); return imageFile; } public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) { if (mFilePathCallback != null) { mFilePathCallback.onReceiveValue(null); } mFilePathCallback = filePathCallback; Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent .resolveActivity(reactContext.getCurrentActivity().getPackageManager()) != null) { // Create the File where the photo should go File photoFile = null; try { photoFile = createImageFile(); takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); } catch (IOException ex) { // Error occurred while creating the File FLog.e(ReactConstants.TAG, "Unable to create Image File", ex); } // Continue only if the File was successfully created if (photoFile != null) { mCameraPhotoPath = "file:" + photoFile.getAbsolutePath(); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); } else { takePictureIntent = null; } } Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT); contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE); contentSelectionIntent.setType("*/*"); Intent[] intentArray; if (takePictureIntent != null) { intentArray = new Intent[] { takePictureIntent }; } else { intentArray = new Intent[0]; } Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER); chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent); chooserIntent.putExtra(Intent.EXTRA_TITLE, "?"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray); reactContext.getCurrentActivity().startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE); // final Intent galleryIntent = new Intent(Intent.ACTION_PICK); // galleryIntent.setType("image/*"); // final Intent chooserIntent = Intent.createChooser(galleryIntent, "Choose File"); // reactContext.getCurrentActivity().startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE); return true; } @Override public void onShowCustomView(View view, CustomViewCallback callback) { if (mVideoView != null) { callback.onCustomViewHidden(); return; } // Store the view and it's callback for later, so we can dispose of them correctly mVideoView = view; mCustomViewCallback = callback; view.setBackgroundColor(Color.BLACK); getRootView().addView(view, FULLSCREEN_LAYOUT_PARAMS); webView.setVisibility(View.GONE); UiThreadUtil.runOnUiThread(new Runnable() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void run() { // If the status bar is translucent hook into the window insets calculations // and consume all the top insets so no padding will be added under the status bar. View decorView = reactContext.getCurrentActivity().getWindow().getDecorView(); decorView.setOnApplyWindowInsetsListener(null); ViewCompat.requestApplyInsets(decorView); } }); reactContext.getCurrentActivity() .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } @Override public void onHideCustomView() { if (mVideoView == null) { return; } mVideoView.setVisibility(View.GONE); getRootView().removeView(mVideoView); mVideoView = null; mCustomViewCallback.onCustomViewHidden(); webView.setVisibility(View.VISIBLE); // View decorView = reactContext.getCurrentActivity().getWindow().getDecorView(); // // Show Status Bar. // int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE; // decorView.setSystemUiVisibility(uiOptions); UiThreadUtil.runOnUiThread(new Runnable() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void run() { // If the status bar is translucent hook into the window insets calculations // and consume all the top insets so no padding will be added under the status bar. View decorView = reactContext.getCurrentActivity().getWindow().getDecorView(); // decorView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { // @Override // public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // WindowInsets defaultInsets = v.onApplyWindowInsets(insets); // return defaultInsets.replaceSystemWindowInsets( // defaultInsets.getSystemWindowInsetLeft(), // 0, // defaultInsets.getSystemWindowInsetRight(), // defaultInsets.getSystemWindowInsetBottom()); // } // }); decorView.setOnApplyWindowInsetsListener(null); ViewCompat.requestApplyInsets(decorView); } }); reactContext.getCurrentActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } private ViewGroup getRootView() { return ((ViewGroup) reactContext.getCurrentActivity().findViewById(android.R.id.content)); } }); reactContext.addLifecycleEventListener(webView); reactContext.addActivityEventListener(new ActivityEventListener() { @Override public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) { return; } Uri[] results = null; // Check that the response is a good one if (resultCode == Activity.RESULT_OK) { if (data == null) { // If there is not data, then we may have taken a photo if (mCameraPhotoPath != null) { results = new Uri[] { Uri.parse(mCameraPhotoPath) }; } } else { String dataString = data.getDataString(); if (dataString != null) { results = new Uri[] { Uri.parse(dataString) }; } } } if (results == null) { mFilePathCallback.onReceiveValue(new Uri[] {}); } else { mFilePathCallback.onReceiveValue(results); } mFilePathCallback = null; return; } @Override public void onNewIntent(Intent intent) { } }); mWebViewConfig.configWebView(webView); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setDisplayZoomControls(false); webView.getSettings().setDomStorageEnabled(true); webView.getSettings().setDefaultFontSize(16); webView.getSettings().setTextZoom(100); // Fixes broken full-screen modals/galleries due to body height being 0. webView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WebView.setWebContentsDebuggingEnabled(true); } return webView; }