List of usage examples for android.content Intent getBooleanExtra
public boolean getBooleanExtra(String name, boolean defaultValue)
From source file:com.antew.redditinpictures.library.ui.RedditFragmentActivity.java
private void handleLoginComplete(Intent intent) { boolean successful = intent.getBooleanExtra(Constants.Extra.EXTRA_SUCCESS, false); if (!successful) { String username = intent.getStringExtra(Constants.Extra.EXTRA_USERNAME); if (Strings.notEmpty(username)) { LoginDialogFragment loginFragment = LoginDialogFragment.newInstance(username); loginFragment.show(getFragmentManager(), Constants.Dialog.DIALOG_LOGIN); }//from w w w . ja v a 2 s. com String errorMessage = intent.getStringExtra(Constants.Extra.EXTRA_ERROR_MESSAGE); Toast.makeText(this, getString(R.string.error) + errorMessage, Toast.LENGTH_SHORT).show(); } }
From source file:com.nks.nksmod.otaupdater.OTAUpdaterActivity.java
private boolean handleNotifAction(Intent intent) { String action = intent.getAction(); if (ROM_NOTIF_ACTION.equals(action)) { RomInfo.FACTORY.clearUpdateNotif(this); bar.setSelectedNavigationItem(romTabIdx); if (intent.getBooleanExtra(EXTRA_FLAG_DOWNLOAD_DIALOG, false)) { DownloadBarFragment.showDownloadingDialog(this, cfg.getRomDownloadID(), this); } else {// w w w . ja v a 2 s. c o m RomInfo info = RomInfo.FACTORY.fromIntent(intent); if (info == null) info = cfg.getStoredRomUpdate(); if (info != null) info.showUpdateDialog(this, this); } /* } else if (KERNEL_NOTIF_ACTION.equals(action)) { KernelInfo.FACTORY.clearUpdateNotif(this); bar.setSelectedNavigationItem(kernelTabIdx); if (intent.getBooleanExtra(EXTRA_FLAG_DOWNLOAD_DIALOG, false)) { DownloadBarFragment.showDownloadingDialog(this, cfg.getKernelDownloadID(), this); } else { KernelInfo info = KernelInfo.FACTORY.fromIntent(intent); if (info == null) info = cfg.getStoredKernelUpdate(); if (info != null) info.showUpdateDialog(this, this); } */ } else { return false; } return true; }
From source file:com.facebook.appevents.AppEventsLogger.java
/** * Source Application setters and getters *//*from w w w .j a v a2s. c o m*/ private static void setSourceApplication(Activity activity) { ComponentName callingApplication = activity.getCallingActivity(); if (callingApplication != null) { String callingApplicationPackage = callingApplication.getPackageName(); if (callingApplicationPackage.equals(activity.getPackageName())) { // open by own app. resetSourceApplication(); return; } sourceApplication = callingApplicationPackage; } // Tap icon to open an app will still get the old intent if the activity was opened by an // intent before. Introduce an extra field in the intent to force clear the // sourceApplication. Intent openIntent = activity.getIntent(); if (openIntent == null || openIntent.getBooleanExtra(SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT, false)) { resetSourceApplication(); return; } Bundle applinkData = AppLinks.getAppLinkData(openIntent); if (applinkData == null) { resetSourceApplication(); return; } isOpenedByApplink = true; Bundle applinkReferrerData = applinkData.getBundle("referer_app_link"); if (applinkReferrerData == null) { sourceApplication = null; return; } String applinkReferrerPackage = applinkReferrerData.getString("package"); sourceApplication = applinkReferrerPackage; // Mark this intent has been used to avoid use this intent again and again. openIntent.putExtra(SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT, true); return; }
From source file:com.nttec.everychan.ui.tabs.TabsTrackerService.java
@Override public void onStart(Intent intent, int startId) { Logger.d(TAG, "TabsTrackerService starting"); enableNotification = settings.isAutoupdateNotification(); immediately = intent != null && intent.getBooleanExtra(EXTRA_UPDATE_IMMEDIATELY, false); backgroundTabs = settings.isAutoupdateBackground(); timerDelay = settings.getAutoupdateDelay(); if (running) { Logger.d(TAG, "TabsTrackerService service already running"); return;//from w w w . j a v a 2 s. c o m } clearUnread(); clearSubscriptions(); TrackerLoop loop = new TrackerLoop(); task = loop; Async.runAsync(loop); running = true; }
From source file:com.locosoft.imageselector.MultiImageSelectorActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mFakeR = new FakeR(this); setContentView(mFakeR.getId("layout", "activity_image_selector")); Intent intent = getIntent(); mDefaultCount = intent.getIntExtra(EXTRA_SELECT_COUNT, 9); int mode = intent.getIntExtra(EXTRA_SELECT_MODE, MODE_MULTI); boolean isShow = intent.getBooleanExtra(EXTRA_SHOW_CAMERA, true); if (mode == MODE_MULTI && intent.hasExtra(EXTRA_DEFAULT_SELECTED_LIST)) { resultList = intent.getStringArrayListExtra(EXTRA_DEFAULT_SELECTED_LIST); }/*from w w w. ja v a2s. c o m*/ desiredWidth = intent.getIntExtra(EXTRA_WIDTH, 0); desiredHeight = intent.getIntExtra(EXTRA_HEIGHT, 0); quality = intent.getIntExtra(EXTRA_QUALITY, 0); fixRotation = intent.getBooleanExtra(EXTRA_FIXROTATION, false); Bundle bundle = new Bundle(); bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_COUNT, mDefaultCount); bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_MODE, mode); bundle.putBoolean(MultiImageSelectorFragment.EXTRA_SHOW_CAMERA, isShow); bundle.putStringArrayList(MultiImageSelectorFragment.EXTRA_DEFAULT_SELECTED_LIST, resultList); getSupportFragmentManager().beginTransaction().add(mFakeR.getId("id", "imageselector_image_grid"), Fragment.instantiate(this, MultiImageSelectorFragment.class.getName(), bundle)).commit(); // back button findViewById(mFakeR.getId("id", "imageselector_btn_back")).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { setResult(RESULT_CANCELED); finish(); } }); // done button mSubmitButton = (Button) findViewById(mFakeR.getId("id", "imageselector_commit")); if (resultList == null || resultList.size() <= 0) { mSubmitButton.setText(mFakeR.getId("string", "imageselector_done")); mSubmitButton.setEnabled(false); } else { mSubmitButton.setText(getResources().getString(mFakeR.getId("string", "imageselector_done")) + "(" + resultList.size() + "/" + mDefaultCount + ")"); mSubmitButton.setEnabled(true); } mSubmitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (resultList != null && resultList.size() > 0) { // return the selection array list if (desiredHeight == 0 && desiredWidth == 0 && quality == 100 && !fixRotation) { Intent data = new Intent(); data.putStringArrayListExtra(EXTRA_RESULT, resultList); setResult(RESULT_OK, data); finish(); } else { postProcessImages(); } } } }); progress = new ProgressDialog(this); progress.setTitle(getResources().getString(mFakeR.getId("string", "imageselector_progress_title"))); progress.setMessage(getResources().getString(mFakeR.getId("string", "imageselector_progress_content"))); }
From source file:com.near.chimerarevo.services.NewsService.java
@Override protected void onHandleIntent(Intent i) { ConnectivityManager mConnManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (mConnManager != null) { mWifi = mConnManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); mMobile = mConnManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); if (!isMobileConnected() && !isWiFiConnected()) return; }/*from w ww . j a v a 2s . c o m*/ if (i.getBooleanExtra("shouldNotCreateNotification", false)) mHandler.post(new DisplayToast(this, getResources().getString(R.string.text_loading))); Request request = new Request.Builder().url(URLUtils.getUrl()).build(); try { Response response = OkHttpUtils.getInstance().newCall(request).execute(); String body = response.body().string().trim(); if (!body.isEmpty()) if (readOfflineFile(body)) { ArrayList<String> mJson = new ArrayList<>(); mJson.add((new JsonParser()).parse(body).toString()); SysUtils.writeOfflineFile(this, mJson, "posts.ser"); Intent update = new Intent(this, PostsListWidgetProvider.class); update.setAction(PostsListWidgetProvider.REFRESH_VIEWS_ACTION); sendBroadcast(update); update = new Intent(this, PostsLRWidgetProvider.class); update.setAction(PostsLRWidgetProvider.REFRESH_VIEWS_ACTION); sendBroadcast(update); if (!i.getBooleanExtra("shouldNotCreateNotification", false)) createNotification(); } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.mobicage.rogerthat.GetLocationActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case TURNING_ON_GPS: if (mLocationManager != null) mUseGPS.setChecked(mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)); break;/*w w w. j ava2 s . com*/ case LOCATION_REQUEST_CODE: if (data != null && data.getBooleanExtra(MapDetailActivity.VERIFIED, false)) { Intent intent = getIntent(); intent.putExtra(MapDetailActivity.LATITUDE, mLocation.getLatitude()); intent.putExtra(MapDetailActivity.LONGITUDE, mLocation.getLongitude()); setResult(RESULT_OK, intent); finish(); } break; } }
From source file:me.piebridge.prevent.framework.SystemReceiver.java
protected void onPackageRemoved(Intent intent) { String packageName = PackageUtils.getPackageName(intent); SafeActionUtils.onPackageChanged(packageName); onPackageRemoved(packageName);/*w ww .j a v a 2 s .c o m*/ if (BuildConfig.APPLICATION_ID.equals(packageName) && !intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) { SystemHook.setSupported(false); PreventListUtils.getInstance().onRemoved(mContext); } else if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) { mPreventPackages.remove(packageName); PreventListUtils.getInstance().save(mContext, mPreventPackages.keySet(), true); } }
From source file:com.javadog.cgeowear.cgeoWearService.java
/** * Initializes the watch-side service's local variables from the intent passed to onStartCommand. * * @param startIntent The Intent passed to * {@link com.javadog.cgeowear.cgeoWearService#onStartCommand(android.content.Intent, int, int)} *//*from www. j av a2 s . c o m*/ private void initLocalVars(final Intent startIntent) { cacheName = startIntent.getStringExtra(MessageDataset.KEY_CACHE_NAME); geocode = startIntent.getStringExtra(MessageDataset.KEY_GEOCODE); distance = startIntent.getFloatExtra(MessageDataset.KEY_DISTANCE, 0f); direction = startIntent.getFloatExtra(MessageDataset.KEY_DIRECTION, 0f); useWatchCompass = startIntent.getBooleanExtra(MessageDataset.KEY_WATCH_COMPASS, true); if (useWatchCompass) { Location cacheLoc = new Location("phoneApp"); cacheLoc.setLatitude(startIntent.getFloatExtra(MessageDataset.KEY_CACHE_LATITUDE, 0f)); cacheLoc.setLongitude(startIntent.getFloatExtra(MessageDataset.KEY_CACHE_LONGITUDE, 0f)); cacheLocation = cacheLoc; } }
From source file:at.jclehner.rxdroid.NotificationReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (intent == null) return;/*from www .j ava 2 s . co m*/ Settings.init(); Database.init(); final boolean isAlarmRepetition = intent.getBooleanExtra(EXTRA_IS_ALARM_REPETITION, false); final int doseTime = intent.getIntExtra(EXTRA_DOSE_TIME, Schedule.TIME_INVALID); if (doseTime != Schedule.TIME_INVALID) { if (!isAlarmRepetition) { final Date date = (Date) intent.getSerializableExtra(EXTRA_DATE); final boolean isDoseTimeEnd = intent.getBooleanExtra(EXTRA_IS_DOSE_TIME_END, false); final String eventName = isDoseTimeEnd ? "onDoseTimeEnd" : "onDoseTimeBegin"; sEventMgr.post(eventName, EVENT_HANDLER_ARG_TYPES, date, doseTime); } } mContext = context; mAlarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); mDoPostSilent = intent.getBooleanExtra(EXTRA_SILENT, false); mForceUpdate = isAlarmRepetition ? true : intent.getBooleanExtra(EXTRA_FORCE_UPDATE, false); mAllDrugs = Database.getAll(Drug.class); rescheduleAlarms(); updateCurrentNotifications(); }