Example usage for android.content Intent FLAG_ACTIVITY_NO_ANIMATION

List of usage examples for android.content Intent FLAG_ACTIVITY_NO_ANIMATION

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_NO_ANIMATION.

Prototype

int FLAG_ACTIVITY_NO_ANIMATION

To view the source code for android.content Intent FLAG_ACTIVITY_NO_ANIMATION.

Click Source Link

Document

If set in an Intent passed to Context#startActivity Context.startActivity() , this flag will prevent the system from applying an activity transition animation to go to the next activity state.

Usage

From source file:com.orange.oidc.secproxy_service.HttpOpenidConnect.java

public boolean getTokens(Context ctx, String id, String login) {

    if (mOcp == null)
        return false;

    try {//  w w  w  .j  av a  2  s  . c  o m

        String requestObject = null;
        String authorization_endpoint = null;
        try {

            // retrieve openid config
            JSONObject json = getHttpJSON(mOcp.m_server_url + openIdConfigurationUrl);
            if (json == null) {
                Logd(TAG, "could not get openid-configuration on server : " + mOcp.m_server_url);
                return false;
            }

            // get authorization end_point
            authorization_endpoint = json.optString("authorization_endpoint");

            Logd(TAG, "authorization_endpoint : " + authorization_endpoint);

            // TAZTAG : no use to define request object if key jwt is not used ?
            if (mUsePrivateKeyJWT) {
                // get jwks_uri of the server
                String jwks_uri = json.optString("jwks_uri");
                if (jwks_uri == null || jwks_uri.length() < 1) {
                    Logd(TAG, "could not get jwks_uri from openid-configuration on server : "
                            + mOcp.m_server_url);
                    return false;
                }
                Logd(TAG, "jwks_uri : " + jwks_uri);

                // get jwks
                String jwks = getHttpString(jwks_uri);
                if (jwks == null || jwks.length() < 1) {
                    Logd(TAG, "could not get jwks_uri content from : " + jwks_uri);
                    return false;
                }
                Logd(TAG, "jwks : " + jwks);

                // extract public key
                PublicKey serverPubKey = KryptoUtils.pubKeyFromJwk(jwks);
                if (serverPubKey == null) {
                    Logd(TAG, "could not extract public key from jwk : " + jwks);
                    return false;
                }

                // get oidc request object
                requestObject = secureProxy.getOidcRequestObject(mOcp.m_server_url, mOcp.m_client_id,
                        mOcp.m_scope, serverPubKey);
                Logd(TAG, "secureStorage requestObject : " + requestObject);
            }

        } catch (Exception ee) {
            // error generating request object
            ee.printStackTrace();
            return false;
        }

        // build post parameters
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(7);
        nameValuePairs.add(new BasicNameValuePair("redirect_uri", mOcp.m_redirect_uri));
        nameValuePairs.add(new BasicNameValuePair("response_type", "code"));
        nameValuePairs.add(new BasicNameValuePair("scope", mOcp.m_scope));

        nameValuePairs.add(new BasicNameValuePair("client_id", secureProxy.getClientId()));

        //         nameValuePairs.add(new BasicNameValuePair("nonce",         mOcp.m_nonce));
        nameValuePairs.add(new BasicNameValuePair("nonce", "1234567890"));
        if (!isEmpty(requestObject)) {
            nameValuePairs.add(new BasicNameValuePair("request", requestObject));
        }
        nameValuePairs.add(new BasicNameValuePair("prompt", "consent"));

        // get URL encoded string from list of key value pairs
        String postParams = getQuery(nameValuePairs);

        Log.d(TAG, "get URL encoded string from list of key value pairs : " + postParams);

        // launch webview

        // init intent
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setClass(ctx, WebViewActivity.class);

        // prepare request parameters
        intent.putExtra("id", id);

        intent.putExtra("server_url", authorization_endpoint);
        intent.putExtra("redirect_uri", mOcp.m_redirect_uri);
        intent.putExtra("client_id", mOcp.m_client_id);
        if (login != null)
            intent.putExtra("login", login);

        intent.putExtra("postParams", postParams);

        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP
                | Intent.FLAG_ACTIVITY_NO_ANIMATION);

        // display webview
        ctx.startActivity(intent);

    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    return true;
}

From source file:com.orange.oidc.tim.service.HttpOpenidConnect.java

public boolean getTokens(Context ctx, String id, boolean useTim, String login) {

    if (mOcp == null)
        return false;

    try {/*from  w w w .  j  av a  2  s  .co  m*/

        String requestObject = null;
        String authorization_endpoint = null;
        try {

            // retrieve openid config
            JSONObject json = getHttpJSON(mOcp.m_server_url + openIdConfigurationUrl);
            if (json == null) {
                Logd(TAG, "could not get openid-configuration on server : " + mOcp.m_server_url);
                return false;
            }

            // get authorization end_point
            authorization_endpoint = json.optString("authorization_endpoint");

            if (useTim) {
                // get jwks_uri of the server
                String jwks_uri = json.optString("jwks_uri");
                if (jwks_uri == null || jwks_uri.length() < 1) {
                    Logd(TAG, "could not get jwks_uri from openid-configuration on server : "
                            + mOcp.m_server_url);
                    return false;
                }

                // get jwks
                String jwks = getHttpString(jwks_uri);
                if (jwks == null || jwks.length() < 1) {
                    Logd(TAG, "could not get jwks_uri content from : " + jwks_uri);
                    return false;
                }

                // extract public key
                PublicKey serverPubKey = KryptoUtils.pubKeyFromJwk(jwks);
                if (serverPubKey == null) {
                    Logd(TAG, "could not extract public key from jwk : " + jwks);
                    return false;
                }

                // get tim request object
                requestObject = secureStorage.getTimRequestObject(mOcp.m_server_url, mOcp.m_client_id,
                        mOcp.m_scope, serverPubKey);
                Logd(TAG, "secureStorage requestObject : " + requestObject);
            }
        } catch (Exception ee) {
            // error generating request object
            ee.printStackTrace();
            return false;
        }

        // build post parameters
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(7);
        nameValuePairs.add(new BasicNameValuePair("redirect_uri", mOcp.m_redirect_uri));
        nameValuePairs.add(new BasicNameValuePair("response_type", "code"));
        nameValuePairs.add(new BasicNameValuePair("scope", mOcp.m_scope));
        if (useTim)
            nameValuePairs.add(new BasicNameValuePair("client_id", secureStorage.getClientId()));
        else
            nameValuePairs.add(new BasicNameValuePair("client_id", mOcp.m_client_id));
        nameValuePairs.add(new BasicNameValuePair("nonce", mOcp.m_nonce));
        if (!isEmpty(requestObject)) {
            nameValuePairs.add(new BasicNameValuePair("request", requestObject));
        }
        nameValuePairs.add(new BasicNameValuePair("prompt", "consent"));

        // get URL encoded string from list of key value pairs
        String postParams = getQuery(nameValuePairs);

        // launch webview

        // init intent
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setClass(ctx, WebViewActivity.class);

        // prepare request parameters
        intent.putExtra("id", id);

        intent.putExtra("server_url", authorization_endpoint);
        intent.putExtra("redirect_uri", mOcp.m_redirect_uri);
        intent.putExtra("client_id", mOcp.m_client_id);
        if (login != null)
            intent.putExtra("login", login);

        if (useTim) {
            intent.putExtra("use_tim", true);
        } else {
            intent.putExtra("client_secret", mOcp.m_client_secret);
        }
        intent.putExtra("postParams", postParams);

        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP
                | Intent.FLAG_ACTIVITY_NO_ANIMATION);

        // display webview
        ctx.startActivity(intent);

    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    return true;
}

From source file:info.guardianproject.pixelknot.PixelKnotActivity.java

private void restart() {
    h.post(new Runnable() {
        @Override/*from  w  w w .j ava 2s .c om*/
        public void run() {
            getIntent().setData(null);

            Intent intent = getIntent();
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_NO_ANIMATION);
            overridePendingTransition(0, 0);
            finish();

            overridePendingTransition(0, 0);
            startActivity(intent);
        }
    });
}

From source file:org.mozilla.gecko.overlays.service.sharemethods.SendTab.java

/**
 * Record our intention to redirect the user to a different activity when they attempt to share
 * with us, usually because we found something wrong with their Sync account (a need to login,
 * register, etc.)/* ww  w  .jav  a  2s.co m*/
 * This will be recorded in the OVERRIDE_INTENT field of the UI broadcast. Consumers should
 * dispatch this intent instead of attempting to share with this ShareMethod whenever it is
 * non-null.
 *
 * @param activityClass The class of the activity we wish to launch instead of invoking a share.
 */
protected void setOverrideIntent(Class<? extends Activity> activityClass) {
    Intent intent = new Intent(context, activityClass);
    // Per http://stackoverflow.com/a/8992365, this triggers a known bug with
    // the soft keyboard not being shown for the started activity. Why, Android, why?
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    Intent uiStateIntent = getUIStateIntent();
    uiStateIntent.putExtra(OVERRIDE_INTENT, intent);

    broadcastUIState(uiStateIntent);
}

From source file:com.yeldi.yeldibazaar.FDroid.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    switch (requestCode) {
    case REQUEST_APPDETAILS:
        break;/* w  w  w  . j av a 2s  .  c o m*/
    case REQUEST_MANAGEREPOS:
        if (data.hasExtra("update")) {
            AlertDialog.Builder ask_alrt = new AlertDialog.Builder(this);
            ask_alrt.setTitle(getString(R.string.repo_update_title));
            ask_alrt.setIcon(android.R.drawable.ic_menu_rotate);
            ask_alrt.setMessage(getString(R.string.repo_alrt));
            ask_alrt.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    updateRepos();
                }
            });
            ask_alrt.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    return;
                }
            });
            AlertDialog alert = ask_alrt.create();
            alert.show();
        }
        break;
    case REQUEST_PREFS:
        // The automatic update settings may have changed, so reschedule
        // (or
        // unschedule) the service accordingly. It's cheap, so no need
        // to
        // check if the particular setting has actually been changed.
        UpdateService.schedule(getBaseContext());
        if (data != null && data.hasExtra("update")) {
            updateRepos();
        } else if (data != null && data.hasExtra("restart")) {
            final Intent intent = getIntent();
            overridePendingTransition(0, 0);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            finish();
            overridePendingTransition(0, 0);
            startActivity(intent);
        } else {
            repopulateViews();
        }
        break;

    }
}

From source file:com.einzig.ipst2.activities.PSListActivity.java

public void sortMenuOptionSelected() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.set_sort_criteria).setItems(R.array.sortTypesEntries,
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    String[] some_array = getResources().getStringArray(R.array.sortTypesValues);
                    System.out.println("SELECTED: " + some_array[which]);
                    PreferencesHelper helper = new PreferencesHelper(getApplicationContext());
                    helper.set(helper.sortKey(), some_array[which]);
                    Intent i = getIntent();
                    i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                    i.putExtra(PORTAL_LIST_KEY_TYPE, TYPE);
                    i.putExtra(PORTAL_LIST_KEY_RANGE, RANGE);
                    startActivity(i);/*from w  w  w.  j  a  v a 2s  .co  m*/
                    finish();
                    overridePendingTransition(0, 0);
                }
            });
    AlertDialog alertDialog = builder.create();
    alertDialog.show();
}

From source file:at.jclehner.rxdroid.SplashScreenActivity.java

private void launchMainActivity() {
    (new Thread() {

        @SuppressWarnings("unused")
        @Override/* w w w  . j  a v a2  s. c  o  m*/
        public void run() {
            while (Database.hasPendingOperations()) {
                Log.i(TAG, "Waiting for database to settle");
                try {
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    Log.w(TAG, e);
                    break;
                }
            }

            final boolean isFirstLaunch;

            if (!BuildConfig.DEBUG && Database.countAll(Drug.class) != 0) {
                isFirstLaunch = false;
                Settings.putBoolean(Settings.Keys.IS_FIRST_LAUNCH, false);
            } else
                isFirstLaunch = Settings.getBoolean(Settings.Keys.IS_FIRST_LAUNCH, true);

            final Class<?> intentClass = isFirstLaunch ? DoseTimePreferenceActivity.class
                    : DrugListActivity.class;

            Intent intent = new Intent(getBaseContext(), intentClass);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION);
            intent.putExtra(DoseTimePreferenceActivity.EXTRA_IS_FIRST_LAUNCH, isFirstLaunch);
            intent.putExtra(DrugListActivity.EXTRA_DATE, mDate);
            startActivity(intent);

            finish();
        }
    }).start();
}

From source file:de.elanev.studip.android.app.backend.net.oauth.SignInFragment.java

/**
 * Starts the next activity after prefetching.
 *///w  ww  . j  a v  a  2s .c  o  m
public void startMainActivity() {
    Intent intent = new Intent(getActivity(), MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);

    Log.i(TAG, "Starting news Activity...");
    if (!ApiUtils.isOverApi11()) {
        getActivity().finish();
    }
}

From source file:org.catrobat.catroid.ui.MainMenuActivity.java

private void finishOnCreateAfterRunnable() {
    if (!STANDALONE_MODE) {
        findViewById(R.id.progress_circle).setVisibility(View.GONE);
        findViewById(R.id.main_menu_buttons_container).setVisibility(View.VISIBLE);
    }/*w ww  .  ja  v a2s. c om*/
    PreStageActivity.shutdownPersistentResources();
    if (!STANDALONE_MODE) {
        setMainMenuButtonContinueText();
        findViewById(R.id.main_menu_button_continue).setEnabled(true);
    } else {
        FlashUtil.initializeFlash();
    }
    String projectName = getIntent().getStringExtra(StatusBarNotificationManager.EXTRA_PROJECT_NAME);
    if (projectName != null) {
        loadProjectInBackground(projectName);
    }
    getIntent().removeExtra(StatusBarNotificationManager.EXTRA_PROJECT_NAME);

    if (ProjectManager.getInstance().getHandleNewSceneFromScriptActivity()) {
        Intent intent = new Intent(this, ProjectActivity.class);
        intent.putExtra(ProjectActivity.EXTRA_FRAGMENT_POSITION, ProjectActivity.FRAGMENT_SCENES);
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(intent);
    }
}