List of usage examples for android.content Intent getFlags
public @Flags int getFlags()
From source file:ren.qinc.markdowneditors.view.EditorActivity.java
private void getIntentData() { Intent intent = this.getIntent(); int flags = intent.getFlags(); if ((flags & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) { if (intent.getAction() != null && Intent.ACTION_VIEW.equals(intent.getAction())) { if (SCHEME_FILE.equals(intent.getScheme())) { // String type = getIntent().getType(); // mImportingUri=file:///storage/emulated/0/Vlog.xml intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); Uri uri = intent.getData(); if (uri != null && SCHEME_FILE.equalsIgnoreCase(uri.getScheme())) { // currentFilePath = FileUtils.uri2FilePath(getBaseContext(), uri); }//from www. j av a 2s .c o m } } } }
From source file:com.aniruddhc.acemusic.player.NowPlayingQueueActivity.NowPlayingQueueActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mContext = this; sharedPreferences = getSharedPreferences("com.aniruddhc.acemusic.player", Context.MODE_PRIVATE); //Get the screen's parameters. DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int screenWidth = displayMetrics.widthPixels; //Set the UI theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("DARK_THEME") || sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { setTheme(R.style.AppTheme);/*from w ww.j a va 2 s. c o m*/ } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); if (getOrientation().equals("PORTRAIT")) { //Finish this activity and relaunch the activity that called this one. Intent intent = new Intent(this, (Class<?>) getIntent().getSerializableExtra("CALLING_CLASS")); intent.putExtras(getIntent()); intent.putExtra("NEW_PLAYLIST", false); intent.putExtra("CALLED_FROM_FOOTER", true); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); finish(); startActivity(intent); return; } else { setContentView(R.layout.activity_now_playing_queue); final Fragment nowPlayingQueueFragment = new NowPlayingQueueFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.now_playing_queue_container, nowPlayingQueueFragment, "nowPlayingQueueFragment"); transaction.commit(); SpannableString s = new SpannableString(getResources().getString(R.string.current_queue)); s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Update the action bar title with the TypefaceSpan instance. ActionBar actionBar = getActionBar(); actionBar.setTitle(s); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.holo_gray_selector)); } }
From source file:com.Duo.music.player.NowPlayingQueueActivity.NowPlayingQueueActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mContext = this; sharedPreferences = getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE); //Get the screen's parameters. DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int screenWidth = displayMetrics.widthPixels; //Set the UI theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("DARK_THEME") || sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { setTheme(R.style.AppTheme);/*from www .j a v a2s .co m*/ } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); if (getOrientation().equals("PORTRAIT")) { //Finish this activity and relaunch the activity that called this one. Intent intent = new Intent(this, (Class<?>) getIntent().getSerializableExtra("CALLING_CLASS")); intent.putExtras(getIntent()); intent.putExtra("NEW_PLAYLIST", false); intent.putExtra("CALLED_FROM_FOOTER", true); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); finish(); startActivity(intent); return; } else { setContentView(R.layout.activity_now_playing_queue); final Fragment nowPlayingQueueFragment = new NowPlayingQueueFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.now_playing_queue_container, nowPlayingQueueFragment, "nowPlayingQueueFragment"); transaction.commit(); SpannableString s = new SpannableString(getResources().getString(R.string.current_queue)); s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Update the action bar title with the TypefaceSpan instance. ActionBar actionBar = getActionBar(); actionBar.setTitle(s); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.holo_gray_selector)); } }
From source file:com.jelly.music.player.NowPlayingQueueActivity.NowPlayingQueueActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mContext = this; sharedPreferences = getSharedPreferences("com.jelly.music.player", Context.MODE_PRIVATE); //Get the screen's parameters. DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int screenWidth = displayMetrics.widthPixels; //Set the UI theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("DARK_THEME") || sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { setTheme(R.style.AppTheme);/* w w w .jav a 2 s . com*/ } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); if (getOrientation().equals("PORTRAIT")) { //Finish this activity and relaunch the activity that called this one. Intent intent = new Intent(this, (Class<?>) getIntent().getSerializableExtra("CALLING_CLASS")); intent.putExtras(getIntent()); intent.putExtra("NEW_PLAYLIST", false); intent.putExtra("CALLED_FROM_FOOTER", true); intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); finish(); startActivity(intent); return; } else { setContentView(R.layout.activity_now_playing_queue); final Fragment nowPlayingQueueFragment = new NowPlayingQueueFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.now_playing_queue_container, nowPlayingQueueFragment, "nowPlayingQueueFragment"); transaction.commit(); SpannableString s = new SpannableString(getResources().getString(R.string.current_queue)); s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // Update the action bar title with the TypefaceSpan instance. ActionBar actionBar = getActionBar(); actionBar.setTitle(s); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.holo_gray_selector)); } }
From source file:com.allmycode.flags.MyActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);/*from w ww .ja v a2 s. com*/ targetActivity = (AutoCompleteTextView) findViewById(R.id.editText1); ArrayAdapter<String> targetsAdapter = new ArrayAdapter<String>(this, R.layout.list_item, TARGETS_LIST); targetActivity.setAdapter(targetsAdapter); flags = (AutoCompleteTextView) findViewById(R.id.editText2); ArrayAdapter<String> flagsAdapter = new ArrayAdapter<String>(this, R.layout.list_item, FLAGS_LIST_CONCISE); flags.setAdapter(flagsAdapter); cheatSheet = (EditText) findViewById(R.id.editText3); for (String item : FLAGS_LIST) { cheatSheet.append(item); cheatSheet.append("\n"); } Intent whoCalled = getIntent(); helloView = ((TextView) findViewById(R.id.textView3)); helloView.setTextColor(android.graphics.Color.WHITE); helloView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); helloView.setText("Flags: 0x" + Integer.toHexString(whoCalled.getFlags())); if (whoCalled.getExtras() != null) { boolean areErrors = whoCalled.getExtras().getBoolean("existErrors", false); if (areErrors) { helloView.append(" There were errors!"); helloView.setTextColor(android.graphics.Color.RED); helloView.setTypeface(Typeface.DEFAULT, Typeface.BOLD); } } ActivityManager am = (ActivityManager) getSystemService(Service.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> processes; processes = am.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo info : processes) { Log.i("Process:", info.processName); } }
From source file:uk.org.ngo.squeezer.framework.BaseActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if ((intent.getFlags() | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) > 0) { mIsRestoredToTop = true;// www . ja v a 2 s.c o m } }
From source file:com.vuze.android.remote.activity.IntentHandler.java
private boolean handleIntent(Intent intent, Bundle savedInstanceState) { boolean forceProfileListOpen = (intent.getFlags() & Intent.FLAG_ACTIVITY_CLEAR_TOP) > 0; if (AndroidUtils.DEBUG) { Log.d(TAG, "ForceOpen? " + forceProfileListOpen); Log.d(TAG, "IntentHandler intent = " + intent); }//w ww . j a v a2 s. co m appPreferences = VuzeRemoteApp.getAppPreferences(); Uri data = intent.getData(); if (data != null) { try { // check for vuze://remote//* String scheme = data.getScheme(); String host = data.getHost(); String path = data.getPath(); if ("vuze".equals(scheme) && "remote".equals(host) && path != null && path.length() > 1) { String ac = path.substring(1); if (AndroidUtils.DEBUG) { Log.d(TAG, "got ac '" + ac + "' from " + data); } intent.setData(null); if (ac.equals("cmd=advlogin")) { DialogFragmentGenericRemoteProfile dlg = new DialogFragmentGenericRemoteProfile(); AndroidUtils.showDialog(dlg, getSupportFragmentManager(), "GenericRemoteProfile"); forceProfileListOpen = true; } else if (ac.length() < 100) { RemoteProfile remoteProfile = new RemoteProfile("vuze", ac); new RemoteUtils(this).openRemote(remoteProfile, true); finish(); return true; } } // check for http[s]://remote.vuze.com/ac=* if (host != null && host.equals("remote.vuze.com") && data.getQueryParameter("ac") != null) { String ac = data.getQueryParameter("ac"); if (AndroidUtils.DEBUG) { Log.d(TAG, "got ac '" + ac + "' from " + data); } intent.setData(null); if (ac.length() < 100) { RemoteProfile remoteProfile = new RemoteProfile("vuze", ac); new RemoteUtils(this).openRemote(remoteProfile, true); finish(); return true; } } } catch (Exception e) { if (AndroidUtils.DEBUG) { e.printStackTrace(); } } } if (!forceProfileListOpen) { int numRemotes = getRemotesWithLocal().length; if (numRemotes == 0) { // New User: Send them to Login (Account Creation) Intent myIntent = new Intent(Intent.ACTION_VIEW, null, this, LoginActivity.class); myIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); startActivity(myIntent); finish(); return true; } else if (numRemotes == 1 || intent.getData() == null) { try { RemoteProfile remoteProfile = appPreferences.getLastUsedRemote(); if (remoteProfile != null) { if (savedInstanceState == null) { new RemoteUtils(this).openRemote(remoteProfile, true); finish(); return true; } } else { Log.d(TAG, "Has Remotes, but no last remote"); } } catch (Throwable t) { if (AndroidUtils.DEBUG) { Log.e(TAG, "onCreate", t); } VuzeEasyTracker.getInstance(this).logError(t); } } } return false; }
From source file:com.meiste.greg.ptw.GameActivity.java
private int getTab(final Intent intent) { // Recent applications caches intent with extras. Only want to listen // to INTENT_TAB extra if launched from notification. if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) { final int intent_tab = intent.getIntExtra(PTW.INTENT_EXTRA_TAB, -1); if (intent_tab >= 0) { return intent_tab; }/*from www .ja v a2 s . co m*/ } return Util.getState(this).getInt(LAST_TAB, 0); }
From source file:de.stadtrallye.rallyesoft.model.pictures.PictureManager.java
@TargetApi(19) private void takePersistableUriPermissionApi19(Intent data, Uri uri) { final int takeFlags = data.getFlags() & Intent.FLAG_GRANT_READ_URI_PERMISSION; // Check for the freshest data. context.getContentResolver().takePersistableUriPermission(uri, takeFlags); }
From source file:org.pixmob.appengine.client.AppEngineClient.java
private String getAuthToken() throws AppEngineAuthenticationException { // get an authentication token from the AccountManager: // this call is asynchronous, as the user may not respond immediately final AccountManagerFuture<Bundle> futureBundle = accountManager.getAuthToken(account, "ah", true, null, null);//ww w .ja va2 s.co m final Bundle authBundle; try { authBundle = futureBundle.getResult(); } catch (OperationCanceledException e) { throw new AppEngineAuthenticationException(AUTHENTICATION_UNAVAILABLE, e); } catch (AuthenticatorException e) { throw new AppEngineAuthenticationException(AUTHENTICATION_UNAVAILABLE, e); } catch (IOException e) { throw new AppEngineAuthenticationException(AUTHENTICATION_UNAVAILABLE, e); } final String authToken = authBundle.getString(AccountManager.KEY_AUTHTOKEN); if (authToken == null) { // no authentication token was given: the user should give its // permission through an item in the notification bar Log.i(TAG, "Authentication permission is required"); final Intent authPermIntent = (Intent) authBundle.get(AccountManager.KEY_INTENT); int flags = authPermIntent.getFlags(); flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK; authPermIntent.setFlags(flags); throw new AppEngineAuthenticationException(AUTHENTICATION_PENDING, authPermIntent); } return authToken; }