Java Code Examples for android.content.Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT

The following are Jave code examples for showing how to use FLAG_ACTIVITY_BROUGHT_TO_FRONT of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: AndroidBackendlessChat   File: ChatSDKMainActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    exitHelper = new ExitHelper(this);

    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;
    }

    setContentView(R.layout.chat_sdk_activity_view_pager);

    firstTimeInApp();
    initViews();

    enableCheckOnlineOnResumed(true);

    if (!fromLoginActivity && savedInstanceState != null)
    {
        pager.setCurrentItem(savedInstanceState.getInt(PAGE_ADAPTER_POS));
    }

    mOpenFromPushChecker = new OpenFromPushChecker();
    if(mOpenFromPushChecker.checkOnCreate(getIntent(), savedInstanceState))
    {
        startChatActivityForID(getIntent().getExtras().getLong(ChatSDKAbstractChatActivity.THREAD_ID));
        return;
    }

}
 
Example 2
Project: LaunchTime   File: MainActivity.java   View Source Code Vote up 6 votes
@Override
protected void onNewIntent(Intent intent) {
    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) {

            // If we are on home screen, reset most things and go to top category.
            mCategoriesScroller.postDelayed(new Runnable() {
                @Override
                public void run() {
                    try {
                        mSearchBox.setSearchText("");
                        mCategoriesScroller.smoothScrollTo(0, 0);
                        showButtonBar(false, true);
                        mIconSheetScroller.smoothScrollTo(0, 0);
                        switchCategory(getTopCategory());
                        mQuickRow.scrollToStart();
                        mIconSheetScroller.smoothScrollTo(0, 0);
                        mCategoriesScroller.smoothScrollTo(0, 0);
                    } catch (Exception e) {
                        Log.e(TAG, e.getMessage(), e);
                    }

                }
            }, 200);
        }

    }
}
 
Example 3
Project: Hotspot-master-devp   File: SplashActivity.java   View Source Code Vote up 5 votes
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
            if(("application/pdf").equals(getIntent().getType())) {
                Uri data = getIntent().getData();
                Intent intent = new Intent(this,PdfPreviewActivity.class);
                intent.setDataAndType(data,getIntent().getType());
                startActivity(intent);
            }
            finish();
            return;
        }
        setContentView(R.layout.activity_splash);
        showSplashVideo();
        getViews();
        setViews();
        setListeners();
//        AppApi.postWaiterExtension(this,this,"waiter","101","101");
        startServerDiscoveryService();
        startJettyServer();
        getSmallPlatformUrl();
		uploadLogFile();
        reUploadWaiterData();
        OpenInstall.getInstall(new AppInstallListener() {
            @Override
            public void onInstallFinish(AppData appData, Error error) {
                if (error == null) {
                    //获取渠道数据
                    Log.d("SplashActivity", "channel = " + appData.getChannel());
                    //获取个性化安装数据
                    Log.d("SplashActivity", "install = " + appData.getData());
                    waiterData = appData.getData();
                    postWaiterToServer(waiterData);
                } else {
                    Log.d("SplashActivity", "error : "+error.toString());
                }
            }
        });

        startLocation();
        stopFirstUserServiceDelayed();
//        test();
    }
 
Example 4
Project: chat-sdk-android-push-firebase   File: ChatSDKMainActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    exitHelper = new ExitHelper(this);

    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;
    }

    setContentView(R.layout.chat_sdk_activity_view_pager);

    firstTimeInApp();
    initViews();

    enableCheckOnlineOnResumed(true);

    if (!fromLoginActivity && savedInstanceState != null)
    {
        pager.setCurrentItem(savedInstanceState.getInt(PAGE_ADAPTER_POS));
    }

    mOpenFromPushChecker = new OpenFromPushChecker();
    if(mOpenFromPushChecker.checkOnCreate(getIntent(), savedInstanceState))
    {
        startChatActivityForID(getIntent().getExtras().getLong(ChatSDKAbstractChatActivity.THREAD_ID));
        return;
    }

    //// Added by zhang for interstitial ADS
    MobileAds.initialize(this, "ca-app-pub-2734020869575782/3654782558");

    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId(getString(R.string.full_ad_unit_id));

    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded(){
            super.onAdLoaded();
            if (mInterstitialAd.isLoaded())
                mInterstitialAd.show();
        }

        @Override
        public void onAdClosed() {

        }
    });

}