Java Code Examples for android.content.Intent#FLAG_ACTIVITY_BROUGHT_TO_FRONT
The following examples show how to use
android.content.Intent#FLAG_ACTIVITY_BROUGHT_TO_FRONT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyMainActivity.java From a with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // 避免从桌面启动程序后,会重新实例化入口类的activity if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish(); return; } if (!MApplication.getInstance().isChangeTheme() && preferences.getBoolean(getString(R.string.pk_default_read), false)) {//第一次运行且设置了自动打开最近阅读 MApplication.getInstance().setChangeTheme(false); startReadActivity(); } MApplication.getInstance().setChangeTheme(false); // if (savedInstanceState != null) { // resumed = savedInstanceState.getBoolean("resumed"); //} group = preferences.getInt("bookshelfGroup", 0); //super.onCreate(savedInstanceState); super.onCreate(savedInstanceState); }
Example 2
Source File: SplashActivity.java From Android-Application-ZJB with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_splash); ButterKnife.inject(this); //1.解决安装后直接打开,home键切换到后台再启动重复出现闪屏页面的问题 // http://stackoverflow.com/questions/2280361/app-always-starts-fresh-from-root-activity-instead-of-resuming-background-state if (!isTaskRoot()) { if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish(); return; } } //2.初始化 initialize(this); //3.显示广告图片 initView(); //4.执行闪屏alpha动画 animateSplash(); //5.跳转 jump(); }
Example 3
Source File: SplashActivity.java From LinkedME-Android-Deep-Linking-Demo with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.AppTheme); super.onCreate(savedInstanceState); setContentView(R.layout.splash_activity); Log.d("LinkedME", "origin onCreate: SplashActivity " + getIntent().getDataString()); //处理首次安装点击打开切到后台,点击桌面图标再回来重启的问题及通过应用宝唤起在特定条件下重走逻辑的问题 if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { // Activity was brought to front and not created, // Thus finishing this will get us to the last viewed activity finish(); return; } Intent intent = new Intent(SplashActivity.this, WelcomeActivity.class); startActivity(intent); finish(); }
Example 4
Source File: LoadingActivity.java From CloudReader with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 后台返回时可能启动这个页面 http://blog.csdn.net/jianiuqi/article/details/54091181 if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish(); return; } handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(LoadingActivity.this, MainActivity.class)); overridePendingTransition(R.anim.screen_zoom_in, R.anim.screen_zoom_out); finish(); } }, 200); }
Example 5
Source File: MainActivity.java From Lucid-Browser with Apache License 2.0 | 6 votes |
/** * When an app chooses to open a link with this browser (and the browser is already open), onNewIntent is called * @param intent provided by different app/activity */ @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Log.d("LB", "onNewIntent"); if ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) { drawerLayout.closeDrawers(); } if (intent.getAction()!=null && (intent.getAction().equals(Intent.ACTION_WEB_SEARCH) ||intent.getAction().equals(Intent.ACTION_VIEW))){ if (intent.getDataString()!=null){ int tabNumber = intent.getIntExtra("tabNumber", -1); //used if intent is coming from Lucid Browser if (tabNumber!=-1 && tabNumber < webWindows.size()){ webWindows.get(tabNumber).loadUrl(intent.getDataString()); }else tabNumber=-1; if (tabNumber==-1){ openURLInNewTab(intent.getDataString()); } } } }
Example 6
Source File: MyMainActivity.java From a with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // //super.onCreate(savedInstanceState); // 避免从桌面启动程序后,会重新实例化入口类的activity if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish(); return; } if (!MApplication.getInstance().isChangeTheme() && preferences.getBoolean(getString(R.string.pk_default_read), false)) {//第一次运行且设置了自动打开最近阅读 MApplication.getInstance().setChangeTheme(false); startReadActivity(); } MApplication.getInstance().setChangeTheme(false); if (savedInstanceState != null) { resumed = savedInstanceState.getBoolean("resumed"); } group = preferences.getInt("bookshelfGroup", 0); super.onCreate(savedInstanceState); }
Example 7
Source File: LauncherActivity.java From sealrtc-android with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 首次启动 Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT 为 0,再次点击图标启动时就不为零了 if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish(); return; } setContentView(R.layout.activity_launcher); ((TextView) findViewById(R.id.launcher_loading)) .setTextColor(getResources().getColor(R.color.blink_launcher_grey)); iv_logo = (ImageView) findViewById(R.id.iv_logo); if (iv_logo != null) { if (ServerUtils.usePrivateCloud()) { iv_logo.setImageResource(R.drawable.ic_launcher_privatecloud); } else { iv_logo.setImageResource(R.drawable.ic_launcher); } } SessionManager.getInstance().put(SettingActivity.IS_RONGRTC_CONNECTIONMODE, false); ServerUtils.APP_KEY = SessionManager.getInstance().getString(ServerUtils.APP_KEY_KEY); ServerUtils.NAV_SERVER = SessionManager.getInstance().getString(ServerUtils.NAV_SERVER_KEY); ServerUtils.APP_SECRET = SessionManager.getInstance().getString(ServerUtils.APP_SECRET_KEY); ServerUtils.API_SERVER = SessionManager.getInstance().getString(ServerUtils.API_SERVER_KEY); new Handler() .postDelayed( new Runnable() { @Override public void run() { skipToMainPage(); } }, 1000); }
Example 8
Source File: MainActivity.java From LaunchTime with GNU General Public License v3.0 | 5 votes |
@Override protected void onNewIntent(Intent intent) { if (mInitCalling) return; super.onNewIntent(intent); if (System.currentTimeMillis() - mPauseTime < 1000 && Intent.ACTION_MAIN.equals(intent.getAction())) { final boolean alreadyOnHome = ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); Log.d("LaunchTime", " new intent " + alreadyOnHome); if (alreadyOnHome && !mChildLock) { //mPrefs.edit().putString("category",getTopCategory()).apply(); switchCategory(getTopCategory()); // If we are on home screen, reset most things and go to top category. iconHandler.postDelayed(new Runnable() { @Override public void run() { try { mActionMenu.dismissAppinfo(); mSearchBox.setSearchText(""); mCategoriesScroller.smoothScrollTo(0, 0); showButtonBar(false, true); mIconSheetScroller.smoothScrollTo(0, 0); mQuickRow.scrollToStart(); mIconSheetScroller.smoothScrollTo(0, 0); mCategoriesScroller.smoothScrollTo(0, 0); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); } } }, 200); } } }
Example 9
Source File: Launcher.java From LaunchEnr with GNU General Public License v3.0 | 4 votes |
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); boolean alreadyOnHome = mHasFocus && ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); // Check this condition before handling isActionMain, as this will get reset. boolean shouldMoveToDefaultScreen = alreadyOnHome && mState == State.WORKSPACE && AbstractFloatingView.getTopOpenView(this) == null; boolean isActionMain = Intent.ACTION_MAIN.equals(intent.getAction()); if (isActionMain) { if (mWorkspace == null) { // Can be cases where mWorkspace is null, this prevents a NPE return; } // TODO: Log this case. mWorkspace.exitWidgetResizeMode(); // In all these cases, only animate if we're already on home AbstractFloatingView.closeAllOpenViews(this, alreadyOnHome); exitSpringLoadedDragMode(); // If we are already on home, then just animate back to the workspace, // otherwise, just wait until onResume to set the state back to Workspace if (alreadyOnHome) { showWorkspace(true); } else { mOnResumeState = State.WORKSPACE; } closeKeyboard(this); // Reset the apps view if (!alreadyOnHome && mAppsView != null) { mAppsView.scrollToTop(); } // Reset the widgets view if (!alreadyOnHome && mWidgetsView != null) { mWidgetsView.scrollToTop(); } if (mLauncherCallbacks != null) { mLauncherCallbacks.onHomeIntent(); } } PinItemDragListener.handleDragRequest(this, intent); if (mLauncherCallbacks != null) { mLauncherCallbacks.onNewIntent(intent); } // Defer moving to the default screen until after we callback to the LauncherCallbacks // as slow logic in the callbacks eat into the time the scroller expects for the snapToPage // animation. if (isActionMain) { boolean callbackAllowsMoveToDefaultScreen = mLauncherCallbacks != null ? mLauncherCallbacks.shouldMoveToDefaultScreenOnHomeIntent() : true; if (shouldMoveToDefaultScreen && !mWorkspace.isTouchActive() && callbackAllowsMoveToDefaultScreen) { // We use this flag to suppress noisy callbacks above custom content state // from onResume. mMoveToDefaultScreenFromNewIntent = true; mWorkspace.post(new Runnable() { @Override public void run() { if (mWorkspace != null) { mWorkspace.moveToDefaultScreen(true); if (GesturesUtils.isBoardEnabled(Launcher.this) && mBoard.getVisibility() == View.VISIBLE) { GesturesUtils.openOrCloseBoard(Launcher.this, false, false); } } } }); } } }
Example 10
Source File: Launcher.java From TurboLauncher with Apache License 2.0 | 4 votes |
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); // Close the menu if (Intent.ACTION_MAIN.equals(intent.getAction())) { // also will cancel mWaitingForResult. closeSystemDialogs(); if (mTransitionEffectDialog != null) { mTransitionEffectDialog.cancel(); } final boolean alreadyOnHome = mHasFocus && ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); if (mWorkspace == null) { // Can be cases where mWorkspace is null, this prevents a NPE return; } Folder openFolder = mWorkspace.getOpenFolder(); // In all these cases, only animate if we're already on home mWorkspace.exitWidgetResizeMode(); if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() && openFolder == null && shouldMoveToDefaultScreenOnHomeIntent()) { mWorkspace.moveToDefaultScreen(true); } closeFolder(); exitSpringLoadedDragMode(); // If we are already on home, then just animate back to the // workspace, // otherwise, just wait until onResume to set the state back to // Workspace if (alreadyOnHome) { showWorkspace(true); } else { mOnResumeState = State.WORKSPACE; } final View v = getWindow().peekDecorView(); if (v != null && v.getWindowToken() != null) { InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); } // Reset the apps customize page if (!alreadyOnHome && mAppsCustomizeLayout != null) { mAppsCustomizeLayout.reset(); } onHomeIntent(); } }