List of usage examples for android.content Intent getBooleanExtra
public boolean getBooleanExtra(String name, boolean defaultValue)
From source file:com.commonsware.android.tte.DocumentStorageService.java
@Override protected void onHandleIntent(Intent intent) { if (Intent.ACTION_OPEN_DOCUMENT.equals(intent.getAction())) { load(intent.getData());// w w w.j a va2 s .c o m } else if (Intent.ACTION_EDIT.equals(intent.getAction())) { save(intent.getData(), intent.getStringExtra(Intent.EXTRA_TEXT), intent.getBooleanExtra(EXTRA_CLOSING, false)); } }
From source file:com.netpace.expressit.activity.UploadVideoStoryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_upload_video_story); getSupportActionBar().setTitle("retake"); getSupportActionBar().setDisplayShowHomeEnabled(false); Intent intent = getIntent(); isGalleryVideo = intent.getBooleanExtra("isGalleryVideo", false); if (!isGalleryVideo) { videoMedia = (ADProcessedVideoMedia) intent.getSerializableExtra(VIDEO_PATH); video_filePath = videoMedia.getOutputFile().getPath(); } else {//from w w w. j a v a 2 s . co m video_filePath = intent.getStringExtra(VIDEO_PATH); } Point screenDimenions = getDisplayDimensions(); videoView = (ADCustomVideoView) findViewById(R.id.videoView); videoView.setDimensions(screenDimenions.x, screenDimenions.y - screenDimenions.y / 3); videoView.setVideoURI(Uri.parse(video_filePath)); playBtn = (Button) findViewById(R.id.playButton); playBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playVideoClip(); } }); titleTextView = (TypefaceEditText) findViewById(R.id.story_title_txt_field); button_save = (Button) findViewById(R.id.shareButton); button_save.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Util.showToast(R.string.in_progress); } }); if (!isGalleryVideo) { videoSlicePanal = (LinearLayout) findViewById(R.id.videoSlicePanal); String sessionDirPath = videoMedia.getDirectoryPath() + "/"; File dir = new File(sessionDirPath); String[] fileNames = dir.list(); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(140, 140); lp.setMargins(3, 3, 3, 3); for (int i = 0; i < fileNames.length; i++) { if (fileNames[i] == "output.mp4") continue; String filePath = sessionDirPath + fileNames[i]; ADCustomVideoView vv = new ADCustomVideoView(this); vv.setLayoutParams(lp); vv.setDimensions(140, 140); vv.setVideoURI(Uri.parse(filePath)); videoSlicePanal.addView(vv); } } }
From source file:com.filepager.afilechooser.FileChooserActivity.java
@Override protected void onActivityResult(int requestcode, int resultcode, Intent data) { // TODO Auto-generated method stub if (resultcode == RESULT_OK) { boolean multiple = data.getBooleanExtra(IntentConstants.IS_MULTIPLE, false); final String path = data.getStringExtra("path"); File f = new File(path); finishWithResult(f, null);// ww w. j a v a2s .co m } else { } super.onActivityResult(requestcode, resultcode, data); }
From source file:com.google.android.leanbackjank.ui.MainFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Define defaults. int categoryCount = IntentDefaults.CATEGORY_COUNT; int entriesPerCat = IntentDefaults.ENTRIES_PER_CATEGORY; boolean disableShadows = IntentDefaults.DISABLE_SHADOWS; int cardWidth = IntentDefaults.CARD_WIDTH; int cardHeight = IntentDefaults.CARD_HEIGHT; int whichVideo = IntentDefaults.WHICH_VIDEO; boolean useSingleBitmap = IntentDefaults.USE_SINGLE_BITMAP; Intent intent = getActivity().getIntent(); if (intent.getExtras() != null) { categoryCount = intent.getIntExtra(IntentKeys.CATEGORY_COUNT, categoryCount); entriesPerCat = intent.getIntExtra(IntentKeys.ENTRIES_PER_CATEGORY, entriesPerCat); disableShadows = intent.getBooleanExtra(IntentKeys.DISABLE_SHADOWS, disableShadows); cardWidth = intent.getIntExtra(IntentKeys.CARD_WIDTH, cardWidth); cardHeight = intent.getIntExtra(IntentKeys.CARD_HEIGHT, cardHeight); whichVideo = intent.getIntExtra(IntentKeys.WHICH_VIDEO, whichVideo); useSingleBitmap = intent.getBooleanExtra(IntentKeys.USE_SINGLE_BITMAP, useSingleBitmap); }/*from www . jav a 2 s .c o m*/ loadVideoData(categoryCount, entriesPerCat, disableShadows, useSingleBitmap, cardWidth, cardHeight); setBackground(); setupUIElements(); if (whichVideo != IntentKeys.NO_VIDEO) { int resource = 0; /* For info on how to generate videos see: * https://docs.google.com/document/d/1HV8O-Nm4rc2DwVwiZmT4Wa9pf8XttWndg9saGncTRGw */ if (whichVideo == IntentKeys.VIDEO_2160P_60FPS) { resource = R.raw.bbb_sunflower_2160p_60fps; } else if (whichVideo == IntentKeys.VIDEO_1080P_60FPS) { resource = R.raw.testvideo_1080p_60fps; } else if (whichVideo == IntentKeys.VIDEO_480P_60FPS) { resource = R.raw.bbb_480p; } else if (whichVideo == IntentKeys.VIDEO_360P_60FPS) { resource = R.raw.bbb_360p; } Uri uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + resource); Intent videoIntent = new Intent(Intent.ACTION_VIEW, uri, getActivity(), VideoActivity.class); startActivity(videoIntent); } }
From source file:com.hrs.filltheform.service.MyAccessibilityService.java
private void checkCompanionActions(Intent intent) { if (fillTheFormDialog == null) { return;//w w w. ja v a2s. c o m } String action = intent.getAction(); switch (action) { case FillTheFormCompanion.INTENT_READ_CONFIGURATION_FILE: showConfigurationSuccessMessage = intent .getBooleanExtra(FillTheFormCompanion.INTENT_EXTRA_SHOW_CONFIGURATION_SUCCESS_MESSAGE, false); String configurationFilePath = intent .getStringExtra(FillTheFormCompanion.INTENT_EXTRA_CONFIGURATION_FILE_PATH); @FillTheFormCompanion.ConfigurationSource int configurationFileSource = intent.getIntExtra( FillTheFormCompanion.INTENT_EXTRA_CONFIGURATION_FILE_SOURCE, FillTheFormCompanion.SOURCE_ASSETS); configuration.init(this, configurationFileSource, configurationFilePath); fillTheFormDialog.setConfigurationVariablePattern(configuration.getConfigurationVariablePattern()); break; case FillTheFormCompanion.INTENT_HIDE_FILL_THE_FORM_DIALOG: fillTheFormDialog.hideDialog(); break; case FillTheFormCompanion.INTENT_SET_FAST_MODE: fillTheFormDialog.setFastMode(); break; case FillTheFormCompanion.INTENT_SET_NORMAL_MODE: fillTheFormDialog.setNormalMode(); break; case FillTheFormCompanion.INTENT_REQUEST_NUMBER_OF_PROFILES: int numberOfProfiles = configuration.getNumberOfProfiles(); // Answer with number of profiles Intent broadcastIntent = new Intent(); broadcastIntent.setAction(FillTheFormCompanion.INTENT_SEND_NUMBER_OF_PROFILES); broadcastIntent.putExtra(FillTheFormCompanion.INTENT_EXTRA_NUMBER_OF_PROFILES, numberOfProfiles); sendBroadcast(broadcastIntent); break; case FillTheFormCompanion.INTENT_SELECT_NEXT_PROFILE: fillTheFormDialog.selectNextProfile(); break; default: break; } }
From source file:com.mobile.godot.activity.LauncherActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_launcher); this.initializeFullScreenMode(); etUsername = (EditText) findViewById(R.id.et_username); etPassword = (EditText) findViewById(R.id.et_password); btnLogin = (Button) findViewById(R.id.button_login); btnRegister = (Button) findViewById(R.id.button_register); btnLogin.setOnClickListener(mLoginClickListener); btnRegister.setOnClickListener(mRegisterClickListener); etUsername.addTextChangedListener(mDelayHideTextWatcher); etPassword.addTextChangedListener(mDelayHideTextWatcher); btnLogin.setOnTouchListener(mDelayHideTouchListener); dialogUserRegistration = buildDialogUserRegistration(); this.loginController = LoginController.getInstance(this.getApplicationContext(), this.mHandler); Intent intentBackToLogin = this.getIntent(); boolean loginMode = intentBackToLogin.getBooleanExtra(GodotIntentExtra.EXTRA_LOGIN_MODE, true); this.setAutoLogin(loginMode); }
From source file:org.ohmage.auth.AuthenticatorTest.java
private void verifyNotifyUserBundle(Bundle bundle) { Intent intent = bundle.getParcelable(AccountManager.KEY_INTENT); assertNotNull(intent);//from w w w. ja va 2 s.c om assertEquals(intent.getComponent().getClassName(), AuthenticatorActivity.class.getName()); assertTrue(intent.getBooleanExtra(AuthenticatorActivity.EXTRA_FROM_AUTHENTICATOR, false)); }
From source file:com.github.marcosalis.kraken.utils.network.NetworkBroadcastReceiver.java
private void logNetworkInfo(@Nonnull Intent intent) { if (DroidConfig.DEBUG) { // debugging network info final NetworkInfo otherNetworkInfo = (NetworkInfo) intent .getParcelableExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO); final String reason = intent.getStringExtra(ConnectivityManager.EXTRA_REASON); final boolean failover = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false); Log.i(TAG,// w w w .j av a 2 s.c o m "Network info: " + " otherNetworkInfo = " + (otherNetworkInfo == null ? "[none]" : otherNetworkInfo) + ", failover=" + failover + ", reason=" + reason); } }
From source file:com.android.cts.intent.sender.IntentSenderTest.java
/** * Ensure that sender is only able to send data that it has access to. *//*from w w w .j a v a2 s . com*/ public void testSecurity() throws Exception { // Pick a URI that neither of us have access to; it doens't matter if // its missing, since we expect a SE before a FNFE. final Uri uri = Uri.parse("content://media/external/images/media/10240"); final Intent intent = new Intent(ACTION_READ_FROM_URI); intent.setClipData(ClipData.newRawUri("", uri)); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // We're expecting to run into a security exception final Intent result = mActivity.getResult(intent); if (result == null) { // This is fine; probably of a SecurityException when off in the // system somewhere. } else { // But if we somehow came through, make sure they threw. assertTrue(result.getBooleanExtra("extra_caught_security_exception", false)); } }
From source file:ca.hoogit.garagepi.Main.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == Consts.RESULT_SETTINGS && resultCode == RESULT_OK) { User user = UserManager.getInstance().user(); if (!user.canAuthenticate()) { showCredentialsDialog(R.string.dialog_missing_cred, R.string.dialog_missing_cred_content); } else if (data.getBooleanExtra(Consts.KEY_THEME_CHANGED, false)) { Handler handler = new Handler(); handler.postDelayed(this::recreate, 0); }// w w w . j a v a 2 s.co m } }