List of usage examples for android.content Intent getBooleanExtra
public boolean getBooleanExtra(String name, boolean defaultValue)
From source file:com.nttec.everychan.ui.MainActivity.java
private void handleUriIntent(Intent intent) { TabsTrackerService.clearUnread();// w w w . j a va2 s.co m if (intent != null) { if (intent.getBooleanExtra(TabsTrackerService.EXTRA_CLEAR_SUBSCRIPTIONS, false)) TabsTrackerService.clearSubscriptions(); if (MainApplication.getInstance().settings.useFakeBrowser()) FakeBrowser.dismiss(); if (intent.getData() != null && URLUtil.isFileUrl(intent.getDataString())) { LocalHandler.open(intent.getData().getPath(), this); return; } String url = intent.getDataString(); if (url != null && url.length() != 0) { UrlHandler.open(url, this, MainApplication.getInstance().settings.useFakeBrowser()); } intent.setData(null); } }
From source file:com.teinproductions.tein.papyrosprogress.UpdateCheckReceiver.java
@Override public void onReceive(Context context, Intent intent) { this.context = context; SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); // Check Internet connection ConnectivityManager connManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connManager.getActiveNetworkInfo(); if (networkInfo == null || !networkInfo.isConnected()) return;// ww w . j a v a 2 s . c o m // Check if progress has to be checked boolean notifications = pref.getBoolean(Constants.NOTIFICATION_PREFERENCE, true); boolean appWidgets = AbstractProgressWidget.areAppWidgetsEnabled(context); if (notifications || appWidgets) checkProgress(); // Check if blog has to be checked boolean extra = intent.getBooleanExtra(CHECK_BLOGS_EXTRA, true); if (extra && notifications) checkBlog(); }
From source file:uk.bowdlerize.service.CensorCensusService.java
private void performProbe(final Intent intent) { Intent newIntent = new Intent(); newIntent.setAction(ProgressFragment.ORG_BROADCAST); newIntent.putExtra(ProgressFragment.ORG_BROADCAST, ProgressFragment.TALKING_TO_ISP); sendBroadcast(newIntent);/*from w w w. j a va 2 s . c o m*/ //If this is user submitted send it up for further research if (intent.getBooleanExtra("local", false)) { new Thread() { public void run() { try { api.submitURL(intent.getStringExtra("url")); } catch (Exception e) { e.printStackTrace(); } } }.start(); } mBuilder.setStyle(new NotificationCompat.InboxStyle() .setBigContentTitle(getString(R.string.notifTitle) + " - " + getString(R.string.notifURLRecv)) .addLine(getString(R.string.notifNewURL)).addLine(getString(R.string.notifSanityCheck)) .setSummaryText(Integer.toString(checkedCount) + " " + getString(R.string.notifChecked) + " / " + Integer.toString(censoredCount) + " " + getString(R.string.notifPossBlock))) .setSmallIcon(R.drawable.ic_stat_in_progress) .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_ooni_large)) .setPriority(Notification.PRIORITY_MAX) .setTicker(getString(R.string.notifTitle) + " - " + getString(R.string.notifURLRecv)) .setAutoCancel(false); mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build()); new Thread(new Runnable() { @Override public void run() { String url = intent.getStringExtra("url"); String hash = intent.getStringExtra("hash"); //Pair<Boolean,Integer> wasCensored; CensorPayload censorPayload; String currentDateTimeString = DateFormat.getDateTimeInstance().format(new Date()); mBuilder.setStyle(new NotificationCompat.InboxStyle() .setBigContentTitle( getString(R.string.notifTitle) + " - " + getString(R.string.notifCheckURL)) .addLine(getString(R.string.notifStartAt) + " " + currentDateTimeString) .addLine(getString(R.string.notifCheckURL) + ".....").addLine("MD5: " + hash) .setSummaryText(Integer.toString(checkedCount) + " " + getString(R.string.notifChecked) + " / " + Integer.toString(censoredCount) + " " + getString(R.string.notifPossBlock))); mBuilder.setProgress(2, 1, true); mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build()); try { if (null == url) throw new NullPointerException(); //Do the actual check censorPayload = checkURL(url); //We're complete - update the time currentDateTimeString = DateFormat.getDateTimeInstance().format(new Date()); //Update our local stats setCounts(censorPayload.wasCensored()); censorPayload.MD5 = hash; Intent ORGCensorIntent = new Intent(); ORGCensorIntent.setAction(ProgressFragment.ORG_BROADCAST); ORGCensorIntent.putExtra("url", url); ORGCensorIntent.putExtra("hash", hash); ORGCensorIntent.putExtra("date", currentDateTimeString); if (censorPayload.wasCensored()) { ORGCensorIntent.putExtra(ProgressFragment.ORG_BROADCAST, ProgressFragment.BLOCKED); ORGCensorIntent.putExtra(ResultsGrid.INTENT_FILTER, LocalCache.RESULT_BLOCKED); mBuilder.setTicker(getString(R.string.notifFoundBlock)); mBuilder.setStyle(new NotificationCompat.InboxStyle() .setBigContentTitle( getString(R.string.notifTitle) + " - " + getString(R.string.notifWaiting)) .addLine(getString(R.string.notifLastChk) + ": " + currentDateTimeString) .addLine(getString(R.string.notifLastURLBlocked)) .addLine("MD5: " + intent.getStringExtra("hash")) .setSummaryText(Integer.toString(checkedCount) + " " + getString(R.string.notifChecked) + " / " + Integer.toString(censoredCount) + " " + getString(R.string.notifPossBlock)) ); mBuilder.setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_ooni_large_censored)); } else { ORGCensorIntent.putExtra(ProgressFragment.ORG_BROADCAST, ProgressFragment.OK); ORGCensorIntent.putExtra(ResultsGrid.INTENT_FILTER, LocalCache.RESULT_OK); mBuilder.setTicker( getString(R.string.notifTitle) + " - " + getString(R.string.notifLastChkNotBlock)); mBuilder.setStyle(new NotificationCompat.InboxStyle() .setBigContentTitle( getString(R.string.notifTitle) + " - " + getString(R.string.notifWaiting)) .addLine(getString(R.string.notifLastChk) + ": " + currentDateTimeString) .addLine(getString(R.string.notifLastChkNotBlock)) .setSummaryText(Integer.toString(checkedCount) + " " + getString(R.string.notifChecked) + " / " + Integer.toString(censoredCount) + " " + getString(R.string.notifPossBlock))); } sendBroadcast(ORGCensorIntent); } catch (Exception e) { e.printStackTrace(); //We're complete - update the time currentDateTimeString = DateFormat.getDateTimeInstance().format(new Date()); mBuilder.setStyle(new NotificationCompat.InboxStyle() .setBigContentTitle( getString(R.string.notifTitle) + " - " + getString(R.string.notifError)) .addLine(getString(R.string.notifLastChk) + ": " + currentDateTimeString) .addLine(getString(R.string.notifException)) .setSummaryText(Integer.toString(checkedCount) + " " + getString(R.string.notifChecked) + " / " + Integer.toString(censoredCount) + " " + getString(R.string.notifPossBlock))); censorPayload = null; Intent newIntent = new Intent(); newIntent.setAction(ProgressFragment.ORG_BROADCAST); newIntent.putExtra(ProgressFragment.ORG_BROADCAST, ProgressFragment.NO_URLS); sendBroadcast(newIntent); } mBuilder.setProgress(0, 0, false); mBuilder.setSmallIcon(R.drawable.ic_stat_waiting); mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build()); //Send the details back regardless (will chew DB space but will give a clearer picture) //api.notifyBackEnd(url,"",wasCensored, intent.getStringExtra("isp"), intent.getStringExtra("sim")); api.notifyBackEnd(censorPayload); /*if(sendtoORG) notifyOONIDirectly(url,wasCensored, intent.getStringExtra("isp"), intent.getStringExtra("sim")); */ onProbeFinish(); } }).start(); }
From source file:com.odoo.addons.calendar.CalendarDashboard.java
@Override public void onOdooActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CONVERT_TO_QUOTATION_WIZARD && resultCode == Activity.RESULT_OK) { crmLead.createQuotation(convertRequestRecord, data.getStringExtra("partner_id"), data.getBooleanExtra("mark_won", false), createQuotationListener); }//from w w w .j a va 2 s . c om }
From source file:com.deliciousdroid.activity.AddBookmark.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_bookmark); Intent intent = getIntent(); if (Intent.ACTION_SEND.equals(intent.getAction()) && intent.hasExtra(Intent.EXTRA_TEXT)) { bookmark = new Bookmark(); ShareCompat.IntentReader reader = ShareCompat.IntentReader.from(this); String url = StringUtils.getUrl(reader.getText().toString()); bookmark.setUrl(url);/*from ww w . j a v a 2 s . c om*/ if (reader.getSubject() != null) bookmark.setDescription(reader.getSubject()); if (url.equals("")) { Toast.makeText(this, R.string.add_bookmark_invalid_url, Toast.LENGTH_LONG).show(); } if (intent.hasExtra(Constants.EXTRA_DESCRIPTION)) { bookmark.setDescription(intent.getStringExtra(Constants.EXTRA_DESCRIPTION)); } bookmark.setNotes(intent.getStringExtra(Constants.EXTRA_NOTES)); bookmark.setTagString(intent.getStringExtra(Constants.EXTRA_TAGS)); bookmark.setShared(!intent.getBooleanExtra(Constants.EXTRA_PRIVATE, privateDefault)); try { Bookmark old = BookmarkManager.GetByUrl(bookmark.getUrl(), this); bookmark = old.copy(); } catch (Exception e) { } } else if (Intent.ACTION_EDIT.equals(intent.getAction())) { int id = Integer.parseInt(intent.getData().getLastPathSegment()); try { bookmark = BookmarkManager.GetById(id, this); oldBookmark = bookmark.copy(); update = true; } catch (ContentNotFoundException e) { e.printStackTrace(); } } if (update) setTitle(getString(R.string.add_bookmark_edit_title)); else setTitle(getString(R.string.add_bookmark_add_title)); frag = (AddBookmarkFragment) getSupportFragmentManager().findFragmentById(R.id.add_bookmark_fragment); frag.loadBookmark(bookmark, oldBookmark); }
From source file:com.achep.base.ui.activities.SettingsActivity.java
@Override protected void onCreate(Bundle savedState) { super.onCreate(savedState); // Should happen before any call to getIntent() getMetaData();// w ww . j a v a2 s .c om final Intent intent = getIntent(); if (intent.hasExtra(EXTRA_UI_OPTIONS)) { getWindow().setUiOptions(intent.getIntExtra(EXTRA_UI_OPTIONS, 0)); } // Getting Intent properties can only be done after the super.onCreate(...) final String initialFragmentName = intent.getStringExtra(EXTRA_SHOW_FRAGMENT); mIsShortcut = isShortCutIntent(intent) || isLikeShortCutIntent(intent) || intent.getBooleanExtra(EXTRA_SHOW_FRAGMENT_AS_SHORTCUT, false); final ComponentName cn = intent.getComponent(); final String className = cn.getClassName(); boolean isShowingDashboard = className.equals(Settings2.class.getName()); // This is a "Sub Settings" when: // - this is a real SubSettings // - or :settings:show_fragment_as_subsetting is passed to the Intent final boolean isSubSettings = className.equals(SubSettings.class.getName()) || intent.getBooleanExtra(EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, false); // If this is a sub settings, then apply the SubSettings Theme for the ActionBar content insets if (isSubSettings) { // Check also that we are not a Theme Dialog as we don't want to override them /* final int themeResId = getTheme(). getThemeResId(); if (themeResId != R.style.Theme_DialogWhenLarge && themeResId != R.style.Theme_SubSettingsDialogWhenLarge) { setTheme(R.style.Theme_SubSettings); } */ } setContentView(R.layout.settings_main_dashboard); mContent = (ViewGroup) findViewById(android.R.id.content); getSupportFragmentManager().addOnBackStackChangedListener(this); if (savedState != null) { // We are restarting from a previous saved state; used that to initialize, instead // of starting fresh. setTitleFromIntent(intent); ArrayList<DashboardCategory> categories = savedState.getParcelableArrayList(SAVE_KEY_CATEGORIES); if (categories != null) { mCategories.clear(); mCategories.addAll(categories); setTitleFromBackStack(); } mDisplayHomeAsUpEnabled = savedState.getBoolean(SAVE_KEY_SHOW_HOME_AS_UP); } else { if (!isShowingDashboard) { mDisplayHomeAsUpEnabled = isSubSettings; setTitleFromIntent(intent); Bundle initialArguments = intent.getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS); switchToFragment(initialFragmentName, initialArguments, true, false, mInitialTitleResId, mInitialTitle, false); } else { mDisplayHomeAsUpEnabled = false; mInitialTitleResId = R.string.app_name; switchToFragment(DashboardFragment.class.getName(), null, false, false, mInitialTitleResId, mInitialTitle, false); } } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(mDisplayHomeAsUpEnabled); actionBar.setHomeButtonEnabled(mDisplayHomeAsUpEnabled); } }
From source file:com.bullmobi.base.ui.activities.SettingsActivity.java
@Override protected void onCreate(Bundle savedState) { super.onCreate(savedState); // Should happen before any call to getIntent() getMetaData();//from w w w. j a v a2 s .c om final Intent intent = getIntent(); if (intent.hasExtra(EXTRA_UI_OPTIONS)) { getWindow().setUiOptions(intent.getIntExtra(EXTRA_UI_OPTIONS, 0)); } // Getting Intent properties can only be done after the super.onCreate(...) final String initialFragmentName = intent.getStringExtra(EXTRA_SHOW_FRAGMENT); mIsShortcut = isShortCutIntent(intent) || isLikeShortCutIntent(intent) || intent.getBooleanExtra(EXTRA_SHOW_FRAGMENT_AS_SHORTCUT, false); final ComponentName cn = intent.getComponent(); final String className = cn.getClassName(); boolean isShowingDashboard = className.equals(Settings2.class.getName()); // This is a "Sub Settings" when: // - this is a real SubSettings // - or :settings:show_fragment_as_subsetting is passed to the Intent final boolean isSubSettings = className.equals(SubSettings.class.getName()) || intent.getBooleanExtra(EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, false); // If this is a sub settings, then apply the SubSettings Theme for the ActionBar content insets if (isSubSettings) { // Check also that we are not a Theme Dialog as we don't want to override them /* final int themeResId = getTheme(). getThemeResId(); if (themeResId != R.style.Theme_DialogWhenLarge && themeResId != R.style.Theme_SubSettingsDialogWhenLarge) { setTheme(R.style.Theme_SubSettings); } */ } setContentView(R.layout.settings_main_dashboard); mContent = (ViewGroup) findViewById(R.id.main_content); getSupportFragmentManager().addOnBackStackChangedListener(this); if (savedState != null) { // We are restarting from a previous saved state; used that to initialize, instead // of starting fresh. setTitleFromIntent(intent); ArrayList<DashboardCategory> categories = savedState.getParcelableArrayList(SAVE_KEY_CATEGORIES); if (categories != null) { mCategories.clear(); mCategories.addAll(categories); setTitleFromBackStack(); } mDisplayHomeAsUpEnabled = savedState.getBoolean(SAVE_KEY_SHOW_HOME_AS_UP); } else { if (!isShowingDashboard) { mDisplayHomeAsUpEnabled = isSubSettings; setTitleFromIntent(intent); Bundle initialArguments = intent.getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS); switchToFragment(initialFragmentName, initialArguments, true, false, mInitialTitleResId, mInitialTitle, false); } else { mDisplayHomeAsUpEnabled = false; mInitialTitleResId = R.string.app_name; switchToFragment(DashboardFragment.class.getName(), null, false, false, mInitialTitleResId, mInitialTitle, false); } } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(mDisplayHomeAsUpEnabled); actionBar.setHomeButtonEnabled(mDisplayHomeAsUpEnabled); } }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.SwitcherListFragment.java
/** * {@inheritDoc}/*from ww w .j ava 2s. co m*/ */ @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case REQUEST_FLASH_ZIP: reloadRomsState(); break; case REQUEST_ROM_DETAILS: if (data != null && resultCode == Activity.RESULT_OK) { boolean wipedRom = data.getBooleanExtra(RomDetailActivity.EXTRA_RESULT_WIPED_ROM, false); if (wipedRom) { reloadRomsState(); } } break; case REQUEST_MBTOOL_ERROR: if (data != null && resultCode == Activity.RESULT_OK) { boolean canRetry = data.getBooleanExtra(MbtoolErrorActivity.EXTRA_RESULT_CAN_RETRY, false); if (canRetry) { reloadRomsState(); } } break; default: super.onActivityResult(requestCode, resultCode, data); break; } }
From source file:com.aimfire.gallery.cardboard.PhotoActivity.java
/** * Sets the view to our CardboardView and initializes the transformation matrices we will use * to render our scene./*from w ww. ja va 2 s . co m*/ */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_photo); loadDisplayPrefs(); /* * show error message in case no photo to be displayed */ mOverlayView = (CardboardOverlayView) findViewById(R.id.overlay); Intent intent = getIntent(); mIsMyMedia = intent.getBooleanExtra(MainConsts.EXTRA_MSG, false); mAssetColor = intent.getBooleanExtra(MainConsts.EXTRA_COLOR, true); Uri uri = intent.getData(); if (uri != null) { String filePath = getFilePathFromUri(uri); if (filePath == null) { Toast.makeText(this, "Please open downloaded file from a file manager/explorer.", Toast.LENGTH_LONG) .show(); finish(); return; } File f = new File(filePath); String fileName = f.getName(); if (!filePath.endsWith("jpg")) { /* * something's wrong. no point in continuing */ Toast.makeText(this, R.string.error_no_media, Toast.LENGTH_LONG).show(); finish(); return; } if (!filePath.contains(MainConsts.MEDIA_3D_ROOT_PATH)) { /* * in case we got here directly without going thru MainActivity * first, it's possible we don't have storage initialized yet. */ if (!FileUtils.initStorage()) { Toast.makeText(this, R.string.error_accessing_storage, Toast.LENGTH_LONG).show(); finish(); return; } /* * we are launched from external apps by host or file type. move the * file to our "shared with me" dir. if rename fails, we will have * to do the actual copy (rather than rename, as we may be copying * the file from internal to external storage; or we don't have * write permission on the source directory) */ String newFilePath = MainConsts.MEDIA_3D_SHARED_PATH + fileName; boolean success = false; try { File from = (new File(filePath)); File to = (new File(newFilePath)); success = from.renameTo(to); } catch (Exception e) { e.printStackTrace(); } if (!success) { FileUtils.copyFile(filePath, newFilePath); } filePath = newFilePath; /* * make MediaScanner aware of the new file */ MediaScanner.addItemMediaList(filePath); } mAssetList = MediaScanner.getNonEmptyPhotoList( mIsMyMedia ? MainConsts.MEDIA_3D_SAVE_DIR : MainConsts.MEDIA_3D_SHARED_DIR); if ((mAssetList != null) && (mAssetList.size() > 0)) { mAssetInd = mAssetList.indexOf(filePath); if (mAssetInd == -1) { if (BuildConfig.DEBUG) Log.e(TAG, "onCreate: specified photo not found, path=" + filePath); mAssetInd = 0; } if (BuildConfig.DEBUG) Log.d(TAG, "onCreate: mMovieList size=" + mAssetList.size() + ", index=" + mAssetInd); } else { if (BuildConfig.DEBUG) Log.e(TAG, "onCreate: no photo found!"); mOverlayView.show3DToast("no photo found!", 5000); } } else { if (BuildConfig.DEBUG) Log.d(TAG, "onCreate: no file uri specified in intent, are we " + "directly envoked by daydream?"); mAssetList = MediaScanner.getNonEmptyPhotoList( mIsMyMedia ? MainConsts.MEDIA_3D_SAVE_DIR : MainConsts.MEDIA_3D_SHARED_DIR); if ((mAssetList != null) && (mAssetList.size() > 0)) { mAssetInd = 0; if (BuildConfig.DEBUG) Log.d(TAG, "onCreate: mAssetList size=" + mAssetList.size() + ", index=" + mAssetInd); } else { if (BuildConfig.DEBUG) Log.e(TAG, "onCreate: no photo found!"); mOverlayView.show3DToast("no photo found!", 5000); } } /* * initialize cardboard related stuff */ mCardboardView = (GvrView) findViewById(R.id.cardboard_view); mCardboardView.setRenderer(this); mCardboardView.setOnTouchListener(otl); mCardboardView.setTransitionViewEnabled(true); // Enable Cardboard-trigger feedback with Daydream headsets. This is a simple way of supporting // Daydream controller input for basic interactions using the existing Cardboard trigger API. mCardboardView.enableCardboardTriggerEmulation(); setGvrView(mCardboardView); //debug //ScreenParams sp = mCardboardView.getScreenParams(); //if(BuildConfig.DEBUG) Log.i(TAG, "ScreenParams width=" + sp.getWidth() + ", height=" + sp.getHeight()); //mPicRotation = new float[16]; //mPicFrustum = new float[16]; mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); mHgd = new HeadGestureDetector(this); }
From source file:net.oschina.app.v2.activity.zxing.CaptureActivity.java
@Override protected void onResume() { super.onResume(); // historyManager must be initialized here to update the history preference // historyManager = new HistoryManager(this); // historyManager.trimHistory(); // 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;/*from w w w .j av a 2 s . c o m*/ lastResult = null; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if (prefs.getBoolean(PreferencesActivity.KEY_DISABLE_AUTO_ORIENTATION, true)) { //setRequestedOrientation(getCurrentOrientation()); } else { //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } resetStatusView(); beepManager.updatePrefs(); ambientLightManager.start(cameraManager); inactivityTimer.onResume(); Intent intent = getIntent(); copyToClipboard = prefs.getBoolean(PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true) && (intent == null || intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true)); source = IntentSource.NONE; sourceUrl = null; scanFromWebPageManager = null; 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); } } if (intent.hasExtra(Intents.Scan.CAMERA_ID)) { int cameraId = intent.getIntExtra(Intents.Scan.CAMERA_ID, -1); if (cameraId >= 0) { cameraManager.setManualCameraId(cameraId); } } 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); } 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); } }