List of usage examples for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT
int FLAG_ACTIVITY_REORDER_TO_FRONT
To view the source code for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT.
Click Source Link
From source file:com.frostwire.android.gui.activities.MainActivity.java
private void openTorrentUrl(Intent intent) { try {//from w ww .j a v a 2 s .co m //Open a Torrent from a URL or from a local file :), say from Astro File Manager. //Show me the transfer tab Intent i = new Intent(this, MainActivity.class); i.setAction(Constants.ACTION_SHOW_TRANSFERS); i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(i); //go! final String uri = intent.getDataString(); intent.setAction(null); if (uri != null) { if (uri.startsWith("file") || uri.startsWith("http") || uri.startsWith("https") || uri.startsWith("magnet")) { TransferManager.instance().downloadTorrent(uri, new HandpickedTorrentDownloadDialogOnFetch(this)); } else if (uri.startsWith("content")) { String newUri = saveViewContent(this, Uri.parse(uri), "content-intent.torrent"); if (newUri != null) { TransferManager.instance().downloadTorrent(newUri, new HandpickedTorrentDownloadDialogOnFetch(this)); } } } else { LOG.warn( "MainActivity.onNewIntent(): Couldn't start torrent download from Intent's URI, intent.getDataString() -> null"); LOG.warn("(maybe URI is coming in another property of the intent object - #fragmentation)"); } } catch (Throwable e) { LOG.error("Error opening torrent from intent", e); } }
From source file:org.mariotaku.twidere.fragment.support.AccountsDrawerFragment.java
@Override public void onListItemClick(final ListView l, final View v, final int position, final long id) { final ListAdapter adapter = mAdapter.getAdapter(position); final Object item = mAdapter.getItem(position); if (adapter instanceof DrawerAccountsAdapter) { if (!(item instanceof Account)) return; final Account account = (Account) item; mAccountsAdapter.setSelectedAccountId(account.account_id); updateAccountOptionsSeparatorLabel(); updateDefaultAccountState();/*from w w w. j av a 2 s . c o m*/ } else if (adapter instanceof AccountOptionsAdapter) { final Account account = mAccountsAdapter.getSelectedAccount(); if (account == null || !(item instanceof OptionItem)) return; final OptionItem option = (OptionItem) item; switch (option.id) { case MENU_VIEW_PROFILE: { openUserProfile(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_SEARCH: { final FragmentActivity a = getActivity(); if (a instanceof HomeActivity) { ((HomeActivity) a).openSearchView(account); } else { getActivity().onSearchRequested(); } closeAccountsDrawer(); break; } case MENU_STATUSES: { openUserTimeline(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_FAVORITES: { openUserFavorites(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_LISTS: { openUserLists(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_LIST_MEMBERSHIPS: { openUserListMemberships(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_EDIT: { final Bundle bundle = new Bundle(); bundle.putLong(EXTRA_ACCOUNT_ID, account.account_id); final Intent intent = new Intent(INTENT_ACTION_EDIT_USER_PROFILE); intent.setClass(getActivity(), UserProfileEditorActivity.class); intent.putExtras(bundle); startActivity(intent); closeAccountsDrawer(); break; } case MENU_SET_COLOR: { final Intent intent = new Intent(getActivity(), ColorPickerDialogActivity.class); intent.putExtra(EXTRA_COLOR, account.color); intent.putExtra(EXTRA_ALPHA_SLIDER, false); startActivityForResult(intent, REQUEST_SET_COLOR); break; } case MENU_SET_AS_DEFAULT: { mPreferences.edit().putLong(KEY_DEFAULT_ACCOUNT_ID, account.account_id).commit(); break; } case MENU_DELETE: { final AccountDeletionDialogFragment f = new AccountDeletionDialogFragment(); final Bundle args = new Bundle(); args.putLong(EXTRA_ACCOUNT_ID, account.account_id); f.setArguments(args); f.show(getChildFragmentManager(), FRAGMENT_TAG_ACCOUNT_DELETION); break; } } } else if (adapter instanceof AppMenuAdapter) { if (!(item instanceof OptionItem)) return; final OptionItem option = (OptionItem) item; switch (option.id) { case MENU_ADD_ACCOUNT: { final Intent intent = new Intent(INTENT_ACTION_TWITTER_LOGIN); intent.setClass(getActivity(), SignInActivity.class); startActivity(intent); break; } case MENU_DRAFTS: { final Intent intent = new Intent(INTENT_ACTION_DRAFTS); intent.setClass(getActivity(), DraftsActivity.class); startActivity(intent); break; } case MENU_FILTERS: { final Intent intent = new Intent(getActivity(), FiltersActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); break; } case MENU_SETTINGS: { final Intent intent = new Intent(getActivity(), SettingsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); break; } } closeAccountsDrawer(); } }
From source file:de.vanita5.twittnuker.fragment.support.AccountsDrawerFragment.java
@Override public void onListItemClick(final ListView l, final View v, final int position, final long id) { final ListAdapter adapter = mAdapter.getAdapter(position); final Object item = mAdapter.getItem(position); if (adapter instanceof DrawerAccountsAdapter) { if (!(item instanceof Account)) return; final Account account = (Account) item; mAccountsAdapter.setSelectedAccountId(account.account_id); updateAccountOptionsSeparatorLabel(); updateDefaultAccountState();//from w w w. j a v a 2 s . com } else if (adapter instanceof AccountOptionsAdapter) { final Account account = mAccountsAdapter.getSelectedAccount(); if (account == null || !(item instanceof OptionItem)) return; final OptionItem option = (OptionItem) item; switch (option.id) { case MENU_VIEW_PROFILE: { openUserProfile(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_SEARCH: { final FragmentActivity a = getActivity(); if (a instanceof HomeActivity) { ((HomeActivity) a).openSearchView(account); } else { getActivity().onSearchRequested(); } closeAccountsDrawer(); break; } case MENU_STATUSES: { openUserTimeline(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_FAVORITES: { openUserFavorites(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_LISTS: { openUserLists(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_LIST_MEMBERSHIPS: { openUserListMemberships(getActivity(), account.account_id, account.account_id, account.screen_name); closeAccountsDrawer(); break; } case MENU_EDIT: { final Bundle bundle = new Bundle(); bundle.putLong(EXTRA_ACCOUNT_ID, account.account_id); final Intent intent = new Intent(INTENT_ACTION_EDIT_USER_PROFILE); intent.setClass(getActivity(), UserProfileEditorActivity.class); intent.putExtras(bundle); startActivity(intent); closeAccountsDrawer(); break; } case MENU_SET_COLOR: { final Intent intent = new Intent(getActivity(), ColorPickerDialogActivity.class); intent.putExtra(EXTRA_COLOR, account.color); intent.putExtra(EXTRA_ALPHA_SLIDER, false); startActivityForResult(intent, REQUEST_SET_COLOR); break; } case MENU_SET_AS_DEFAULT: { mPreferences.edit().putLong(KEY_DEFAULT_ACCOUNT_ID, account.account_id).apply(); break; } case MENU_DELETE: { final AccountDeletionDialogFragment f = new AccountDeletionDialogFragment(); final Bundle args = new Bundle(); args.putLong(EXTRA_ACCOUNT_ID, account.account_id); f.setArguments(args); f.show(getChildFragmentManager(), FRAGMENT_TAG_ACCOUNT_DELETION); break; } } } else if (adapter instanceof AppMenuAdapter) { if (!(item instanceof OptionItem)) return; final OptionItem option = (OptionItem) item; switch (option.id) { case MENU_ADD_ACCOUNT: { final Intent intent = new Intent(INTENT_ACTION_TWITTER_LOGIN); intent.setClass(getActivity(), SignInActivity.class); startActivity(intent); break; } case MENU_DRAFTS: { final Intent intent = new Intent(INTENT_ACTION_DRAFTS); intent.setClass(getActivity(), DraftsActivity.class); startActivity(intent); break; } case MENU_FILTERS: { final Intent intent = new Intent(getActivity(), FiltersActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); break; } case MENU_SETTINGS: { final Intent intent = new Intent(getActivity(), SettingsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivityForResult(intent, REQUEST_SETTINGS); break; } } closeAccountsDrawer(); } }
From source file:org.mariotaku.twidere.activity.TwitterLoginActivity.java
@Override public void onLoadFinished(final Loader<LoginResponse> loader, final TwitterLoginActivity.LoginResponse result) { if (result.succeed) { final ContentValues values = makeAccountContentValues(result.conf, result.basic_password, result.access_token, result.user, result.auth_type, result.color); if (values != null) { mResolver.insert(Accounts.CONTENT_URI, values); }/* w ww . j a va2s.c o m*/ mPreferences.edit().putBoolean(PREFERENCE_KEY_API_UPGRADE_CONFIRMED, true).commit(); final Intent intent = new Intent(INTENT_ACTION_HOME); final Bundle bundle = new Bundle(); bundle.putLongArray(INTENT_KEY_IDS, new long[] { mLoggedId }); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); finish(); } else if (result.already_logged_in) { Toast.makeText(TwitterLoginActivity.this, R.string.error_already_logged_in, Toast.LENGTH_SHORT).show(); } else { if (result.exception instanceof CallbackURLException) { showErrorToast(TwitterLoginActivity.this, getString(R.string.cannot_get_callback_url), true); } else { showErrorToast(TwitterLoginActivity.this, result.exception, true); } } setSupportProgressBarIndeterminateVisibility(false); mEditPassword.setEnabled(true); mEditUsername.setEnabled(true); mSignInButton.setEnabled(true); mSignUpButton.setEnabled(true); mSetColorButton.setEnabled(true); }
From source file:dentex.youtube.downloader.YTD.java
public static void NotificationHelper(Context ctx) { mBuilder = new NotificationCompat.Builder(ctx); // to reset its DEFAULTS pt1 = ctx.getString(R.string.notification_downloading_pt1); pt2 = ctx.getString(R.string.notification_downloading_pt2); Intent notificationIntent = new Intent(ctx, DashboardActivity.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, notificationIntent, 0); mBuilder.setSmallIcon(R.drawable.ic_stat_ytd).setOngoing(true) .setContentTitle(ctx.getString(R.string.app_name)) .setContentText(pt1 + " " + sequence.size() + " " + pt2).setContentIntent(contentIntent); mNotificationManager.notify(1, mBuilder.build()); }
From source file:com.nagravision.mediaplayer.FullscreenActivity.java
/** * *//*from ww w . j a v a 2 s .co m*/ @SuppressLint("InlinedApi") @Override protected void onCreate(Bundle inBundle) { Log.v(LOG_TAG, "FullscreenActivity::onCreate - Enter\n"); super.onCreate(inBundle); getApplication().registerActivityLifecycleCallbacks(this); if (Build.VERSION.SDK_INT < 16) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_fullscreen); mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); mMoviesList = (ListView) findViewById(R.id.start_drawer); mUrlsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_activated_1, MOVIES_ARR); mMoviesList.setAdapter(mUrlsAdapter); mVideoHolder = (VideoView) findViewById(R.id.fullscreen_content); View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN; if (Build.VERSION.SDK_INT >= 19) { uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE; } decorView.setSystemUiVisibility(uiOptions); // Remember that you should never show the action bar if the // status bar is hidden, so hide that too if necessary. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); actionBar.hide(); mNotifBuilder = new Notification.Builder(this); mNotifMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mExplicitIntent = new Intent(Intent.ACTION_VIEW); mExplicitIntent.setClass(this, this.getClass()); mDefaultIntent = PendingIntent.getActivity(this, REQUEST_DISPLAY, mExplicitIntent, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_DEBUG_LOG_RESOLUTION); mInfosActionIntent = new Intent(); mInfosActionIntent.setAction("com.nagravision.mediaplayer.VIDEO_INFOS"); mInfosActionIntent.addCategory(Intent.CATEGORY_DEFAULT); mInfosActionIntent.addCategory(Intent.CATEGORY_INFO); mInfosIntent = PendingIntent.getActivity(this, REQUEST_INFOS, mInfosActionIntent, Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_DEBUG_LOG_RESOLUTION); if (Build.VERSION.SDK_INT >= 19) { mVideoHolder.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE); } else { mVideoHolder.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN); } OnItemClickListener mMessageClickedHandler = new OnItemClickListener() { public void onItemClick(@SuppressWarnings("rawtypes") AdapterView parent, View v, int position, long id) { Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnItemClickListener::onItemClick - Enter\n"); ClickItem(position, 0); } }; mMoviesList.setOnItemClickListener(mMessageClickedHandler); getWindow().setFormat(PixelFormat.TRANSLUCENT); mControlsView = new MediaController(this, true); mControlsView.setPrevNextListeners(new View.OnClickListener() { /* * Next listener */ @Override public void onClick(View view) { Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnClickListener::onClick(next) - Enter\n"); mVideoHolder.stopPlayback(); int position = 0; if (mLastPosition > 0) position = mLastPosition + 1; if (position >= MOVIES_URLS.length) position = 0; ClickItem(position, 0); String toaststr = getResources().getString(R.string.next_movie_toast_string) + MOVIES_ARR[position]; Toast.makeText(FullscreenActivity.this, toaststr, Toast.LENGTH_LONG).show(); } }, new View.OnClickListener() { /* * Prev listener */ @Override public void onClick(View view) { Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnClickListener::onClick(prev) - Enter\n"); mVideoHolder.stopPlayback(); int position = 0; if (mLastPosition > 0) position = mLastPosition - 1; if (position < 0) position = MOVIES_URLS.length - 1; ClickItem(position, 0); String toaststr = getResources().getString(R.string.prev_movie_toast_string) + MOVIES_ARR[position]; Toast.makeText(FullscreenActivity.this, toaststr, Toast.LENGTH_LONG).show(); } }); mVideoHolder.setMediaController(mControlsView); // Set up an instance of SystemUiHider to control the system UI for // this activity. mSystemUiHider = SystemUiHider.getInstance(this, mVideoHolder, HIDER_FLAGS); mSystemUiHider.setup(); mSystemUiHider.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() { // Cached values. int mControlsHeight; int mShortAnimTime; @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public void onVisibilityChange(boolean visible) { Log.v(LOG_TAG, "FullscreenActivity.OnVisibilityChangeListener::onVisibilityChange - Enter\n"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { if (mControlsHeight == 0) mControlsHeight = mControlsView.getHeight(); if (mShortAnimTime == 0) mShortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); mControlsView.animate().translationY(visible ? 0 : mControlsHeight).setDuration(mShortAnimTime); } else mControlsView.setVisibility(visible ? View.VISIBLE : View.GONE); if (visible && AUTO_HIDE) delayedHide(AUTO_HIDE_DELAY_MILLIS); } }); // Set up the user interaction to manually show or hide the system UI. mVideoHolder.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TOGGLE_ON_CLICK) { mSystemUiHider.toggle(); } else { mSystemUiHider.show(); } } }); mDrawer.openDrawer(mMoviesList); }
From source file:org.mariotaku.twidere.fragment.support.AccountsDashboardFragment.java
@Override public void onItemClick(final AdapterView<?> parent, final View v, final int position, final long id) { final ListAdapter adapter = mAdapter.getAdapter(position); final Object item = mAdapter.getItem(position); if (adapter instanceof AccountOptionsAdapter) { final ParcelableAccount account = mAccountsAdapter.getSelectedAccount(); if (account == null || !(item instanceof OptionItem)) return; final OptionItem option = (OptionItem) item; switch (option.id) { case MENU_SEARCH: { final Intent intent = new Intent(getActivity(), QuickSearchBarActivity.class); intent.putExtra(EXTRA_ACCOUNT_ID, account.account_id); startActivity(intent);//from w ww. j a v a2 s.c o m closeAccountsDrawer(); break; } case MENU_COMPOSE: { final Intent composeIntent = new Intent(INTENT_ACTION_COMPOSE); composeIntent.setClass(getActivity(), ComposeActivity.class); composeIntent.putExtra(EXTRA_ACCOUNT_IDS, new long[] { account.account_id }); startActivity(composeIntent); break; } case MENU_FAVORITES: { openUserFavorites(getActivity(), account.account_id, account.account_id, account.screen_name); break; } case MENU_LISTS: { openUserLists(getActivity(), account.account_id, account.account_id, account.screen_name); break; } case MENU_EDIT: { Utils.openProfileEditor(getActivity(), account.account_id); break; } } } else if (adapter instanceof AppMenuAdapter) { if (!(item instanceof OptionItem)) return; final OptionItem option = (OptionItem) item; switch (option.id) { case MENU_ACCOUNTS: { Utils.openAccountsManager(getActivity()); break; } case MENU_DRAFTS: { Utils.openDrafts(getActivity()); break; } case MENU_FILTERS: { Utils.openFilters(getActivity()); break; } case MENU_SETTINGS: { final Intent intent = new Intent(getActivity(), SettingsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivityForResult(intent, REQUEST_SETTINGS); break; } } closeAccountsDrawer(); } }
From source file:org.getlantern.firetweet.fragment.support.AccountsDashboardFragment.java
@Override public void onListItemClick(final ListView l, final View v, final int position, final long id) { final ListAdapter adapter = mAdapter.getAdapter(position); final Object item = mAdapter.getItem(position); if (adapter instanceof AccountOptionsAdapter) { final ParcelableAccount account = mAccountsAdapter.getSelectedAccount(); if (account == null || !(item instanceof OptionItem)) return; final OptionItem option = (OptionItem) item; switch (option.id) { case MENU_SEARCH: { final Intent intent = new Intent(getActivity(), QuickSearchBarActivity.class); intent.putExtra(EXTRA_ACCOUNT_ID, account.account_id); startActivity(intent);//from w ww . j a v a2 s. co m closeAccountsDrawer(); break; } case MENU_COMPOSE: { final Intent composeIntent = new Intent(INTENT_ACTION_COMPOSE); composeIntent.setClass(getActivity(), ComposeActivity.class); composeIntent.putExtra(EXTRA_ACCOUNT_IDS, new long[] { account.account_id }); startActivity(composeIntent); break; } case MENU_FAVORITES: { openUserFavorites(getActivity(), account.account_id, account.account_id, account.screen_name); break; } case MENU_LISTS: { openUserLists(getActivity(), account.account_id, account.account_id, account.screen_name); break; } case MENU_EDIT: { final Bundle bundle = new Bundle(); bundle.putLong(EXTRA_ACCOUNT_ID, account.account_id); final Intent intent = new Intent(INTENT_ACTION_EDIT_USER_PROFILE); intent.setClass(getActivity(), UserProfileEditorActivity.class); intent.putExtras(bundle); startActivity(intent); break; } } } else if (adapter instanceof AppMenuAdapter) { if (!(item instanceof OptionItem)) return; final OptionItem option = (OptionItem) item; switch (option.id) { case MENU_ACCOUNTS: { final Intent intent = new Intent(getActivity(), AccountsManagerActivity.class); startActivity(intent); break; } case MENU_DRAFTS: { final Intent intent = new Intent(INTENT_ACTION_DRAFTS); intent.setClass(getActivity(), DraftsActivity.class); startActivity(intent); break; } case MENU_SIGNOUT: { // destroy Twitter instance and delete oauth access token final Twitter mTwitter = new TwitterFactory().getInstance(); mTwitter.setOAuthConsumer(Accounts.CONSUMER_KEY, Accounts.CONSUMER_SECRET); mTwitter.setOAuthAccessToken(null); mTwitter.shutdown(); // remove existing account mAccountsAdapter.setAccounts(null); Utils.removeAccounts(getActivity().getApplicationContext()); // close existing activity closeActivity(); // display sign in activity final Intent signInIntent = new Intent(getActivity().getApplicationContext(), MainActivity.class); signInIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(signInIntent); break; } case MENU_SETTINGS: { final Intent intent = new Intent(getActivity(), SettingsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivityForResult(intent, REQUEST_SETTINGS); break; } } closeAccountsDrawer(); } }
From source file:org.mariotaku.twidere.activity.SignInActivity.java
@Override public void onLoadFinished(final Loader<LoginResponse> loader, final SignInActivity.LoginResponse result) { if (result != null) { if (result.succeed) { final ContentValues values = makeAccountContentValues(result.conf, result.basic_password, result.access_token, result.user, result.auth_type, result.color); if (values != null) { mResolver.insert(Accounts.CONTENT_URI, values); }//from w ww. j ava2 s. co m mPreferences.edit().putBoolean(PREFERENCE_KEY_API_UPGRADE_CONFIRMED, true).commit(); final Intent intent = new Intent(INTENT_ACTION_HOME); final Bundle bundle = new Bundle(); bundle.putLongArray(INTENT_KEY_IDS, new long[] { mLoggedId }); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); finish(); } else if (result.already_logged_in) { Toast.makeText(SignInActivity.this, R.string.error_already_logged_in, Toast.LENGTH_SHORT).show(); } else { if (result.exception instanceof CallbackURLException) { showErrorToast(this, getString(R.string.cannot_get_callback_url), true); } else { showErrorToast(this, getString(R.string.signing_in), result.exception, true); } } } setSupportProgressBarIndeterminateVisibility(false); mEditPassword.setEnabled(true); mEditUsername.setEnabled(true); mSignInButton.setEnabled(true); mSignUpButton.setEnabled(true); mBrowserSignInButton.setEnabled(true); mSetColorButton.setEnabled(true); setSignInButton(); }
From source file:com.bt.download.android.gui.util.UIUtils.java
/** * Checks setting to show or not the transfers window right after a download has started. * This should probably be moved elsewhere (similar to GUIMediator on the desktop) * @param activity/*from ww w.j a v a 2 s . com*/ */ public static void showTransfersOnDownloadStart(Context context) { if (ConfigurationManager.instance().showTransfersOnDownloadStart() && context != null) { Intent i = new Intent(context, MainActivity.class); i.setAction(Constants.ACTION_SHOW_TRANSFERS); i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); context.startActivity(i); } }