Example usage for android.app ActivityOptions makeCustomAnimation

List of usage examples for android.app ActivityOptions makeCustomAnimation

Introduction

In this page you can find the example usage for android.app ActivityOptions makeCustomAnimation.

Prototype

public static ActivityOptions makeCustomAnimation(Context context, int enterResId, int exitResId) 

Source Link

Document

Create an ActivityOptions specifying a custom animation to run when the activity is displayed.

Usage

From source file:com.abhijitvalluri.android.fitnotifications.HomeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.fragment_home, container, false);

    mInstructionTV = (TextView) v.findViewById(R.id.instructionsTV);
    mAppSelectionTV = (TextView) v.findViewById(R.id.appSelectionTV);
    mServiceButton = (Button) v.findViewById(R.id.serviceButton);
    mDemoTV = (TextView) v.findViewById(R.id.demoNotifTV);
    mNotificationAccessTV = (TextView) v.findViewById(R.id.notificationAccessTV);
    mServiceStateTV = (TextView) v.findViewById(R.id.serviceStateText);
    mImproveTransliterationTV = (TextView) v.findViewById(R.id.improve_transliteration);
    mRateAppTV = (TextView) v.findViewById(R.id.rate_app);

    mContext = getContext();/* w w w .j ava 2s  . c om*/
    initializeSettings();
    initializeButtons();

    LAUNCH_ACTIVITY_ANIM_BUNDLE = ActivityOptions
            .makeCustomAnimation(mContext, R.transition.left_in, R.transition.left_out).toBundle();
    activateTextViewLinks();

    return v;
}

From source file:com.abhijitvalluri.android.fitnotifications.AppChoicesActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_app_selector);

    LAUNCH_ACTIVITY_ANIM_BUNDLE = ActivityOptions
            .makeCustomAnimation(AppChoicesActivity.this, R.transition.left_in, R.transition.left_out)
            .toBundle();/* w  w w.j a  v  a  2 s .c o m*/

    mPackageManager = getPackageManager();
    mAppSelectionsStore = AppSelectionsStore.get(this);
    mRecyclerView = (RecyclerView) findViewById(R.id.app_selections_recycler_view);
    mLoadingView = (TextView) findViewById(R.id.app_list_loading_text_view);
    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    PreferenceManager.setDefaultValues(this, R.xml.main_settings, false);
    mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    mShowOnlyEnabledApps = mPreferences.getBoolean(getString(R.string.show_enabled_apps_key), false);

    if (savedInstanceState != null && getSetupStatus(savedInstanceState)) {
        mAppSelections = savedInstanceState.getParcelableArrayList(STATE_APP_SELECTIONS);
        Parcelable listState = savedInstanceState.getParcelable(STATE_RECYCLER_VIEW);

        if (mShowOnlyEnabledApps) {
            List<AppSelection> appSelectionsSubList = new ArrayList<>();

            for (AppSelection appSelection : mAppSelections) {
                if (appSelection.isSelected()) {
                    appSelectionsSubList.add(appSelection);
                }
            }
            mAdapter = new ActivityAdapter(appSelectionsSubList);
        } else {
            mAdapter = new ActivityAdapter(mAppSelections);
        }
        mRecyclerView.setAdapter(mAdapter);
        mRecyclerView.getLayoutManager().onRestoreInstanceState(listState);
        mSetupComplete = getSetupStatus(savedInstanceState);
    } else {
        mLoadingView.setText(getString(R.string.app_list_loading_text));
        mRecyclerView.setVisibility(View.GONE);
        mLoadingView.setVisibility(View.VISIBLE);
        mProgressBar.setVisibility(View.VISIBLE);
        new AppListSetup().execute();
    }
}

From source file:com.piggate.samples.PiggateLogin.Activity_SingUp.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _piggate = new Piggate(this, null); //Initialize the Piggate object

    setContentView(R.layout.activity_register);
    //EditTexts for user email and password
    editEmail = (EditText) findViewById(R.id.editText1);
    editPass = (EditText) findViewById(R.id.editText2);
    final ImageButton return_button = (ImageButton) findViewById(R.id.return1);
    Button register = (Button) findViewById(R.id.buttonregister2);

    //Handles the top left back button of the activity
    return_button.setOnClickListener(new View.OnClickListener() {
        @Override//from w  w  w .jav a2s .c o m
        public void onClick(View v) {
            onBackPressed();
        }
    });

    //OnClick listener for the login button
    //Handles the login request to the server with the email and password fields
    register.setOnClickListener(new View.OnClickListener() {
        @Override
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;
                String email = editEmail.getText().toString();
                String pass = editPass.getText().toString();

                //If the internet connection is working
                if (checkInternetConnection() == true) {
                    RequestParams params = new RequestParams();
                    params.put("email", email);
                    params.put("password", pass);

                    //Request of the Piggate object. Handles the login into the application with the user email and password
                    _piggate.RequestNewUser(params).setListenerRequest(new Piggate.PiggateCallBack() {

                        //Method onComplete for JSONObject
                        //When the request is correct start Activity_Logged activity
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                            Intent slideactivity = new Intent(Activity_SingUp.this, Activity_Logged.class);
                            Bundle bndlanimation = ActivityOptions
                                    .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2)
                                    .toBundle();
                            startActivity(slideactivity, bndlanimation);
                        }

                        //Method onError for JSONObject
                        //If there's an error with the request displays the error message to the user
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                        }

                        //Method onComplete for JSONArray
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }

                        //Method onError for JSONArray
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }
                    }).exec();
                } else { //If the internet connection is not working
                    Toast.makeText(getApplicationContext(), "Network is not working", Toast.LENGTH_LONG).show();
                }
            }
        }
    });
}

From source file:com.piggate.samples.PiggateLoginApplication.Activity_SingIn.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _piggate = new Piggate(this, null); //Initialize the Piggate object

    setContentView(R.layout.activity_login);
    //EditTexts for user email and password
    editEmail = (EditText) findViewById(R.id.editText1);
    editPass = (EditText) findViewById(R.id.editText2);
    Button login = (Button) findViewById(R.id.buttonlogin2);
    final ImageButton return_button = (ImageButton) findViewById(R.id.return1);

    //Handles the top left back button of the activity
    return_button.setOnClickListener(new View.OnClickListener() {
        @Override/*  w  w  w .  j ava 2 s  .  co  m*/
        public void onClick(View v) {
            onBackPressed();
        }
    });

    //OnClick listener for the login button
    //Handles the login request to the server with the email and password fields
    login.setOnClickListener(new View.OnClickListener() {
        @Override
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;
                String email = editEmail.getText().toString();
                String pass = editPass.getText().toString();

                //If the internet connection is working
                if (checkInternetConnection() == true) {
                    RequestParams params = new RequestParams();
                    params.put("email", email);
                    params.put("password", pass);

                    //Request of the Piggate object. Handles the login into the application with the user email and password
                    _piggate.RequestOpenSession(params).setListenerRequest(new Piggate.PiggateCallBack() {

                        //Method onComplete for JSONObject
                        //When the request is correct start Activity_Logged activity
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                            Intent slideactivity = new Intent(Activity_SingIn.this, Activity_Logged.class);
                            Bundle bndlanimation = ActivityOptions
                                    .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2)
                                    .toBundle();
                            startActivity(slideactivity, bndlanimation);
                        }

                        //Method onError for JSONObject
                        //If there's an error with the request displays the error message to the user
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                            handledClick = false;

                        }

                        //Method onComplete for JSONArray
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }

                        //Method onError for JSONArray
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }
                    }).exec();
                } else { //If the internet connection is not working
                    Toast.makeText(getApplicationContext(), "Network is not working", Toast.LENGTH_LONG).show();
                    handledClick = false;

                }
            }
        }
    });
}

From source file:com.piggate.samples.PiggateLoginService.Activity_SingIn.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _piggate = new Piggate(this, null); //Initialize the Piggate object

    setContentView(R.layout.activity_login);
    //EditTexts for user email and password
    editEmail = (EditText) findViewById(R.id.editText1);
    editPass = (EditText) findViewById(R.id.editText2);
    Button login = (Button) findViewById(R.id.buttonlogin2);
    final ImageButton return_button = (ImageButton) findViewById(R.id.return1);

    //Handles the top left back button of the activity
    return_button.setOnClickListener(new View.OnClickListener() {
        @Override/* w w w  . j av  a 2s  . com*/
        public void onClick(View v) {
            onBackPressed();
        }
    });

    //OnClick listener for the login button
    //Handles the login request to the server with the email and password fields
    login.setOnClickListener(new View.OnClickListener() {
        @Override
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;
                String email = editEmail.getText().toString();
                String pass = editPass.getText().toString();

                //If the internet connection is working
                if (checkInternetConnection() == true) {
                    RequestParams params = new RequestParams();
                    params.put("email", email);
                    params.put("password", pass);

                    //Request of the Piggate object. Handles the login into the application with the user email and password
                    _piggate.RequestOpenSession(params).setListenerRequest(new Piggate.PiggateCallBack() {

                        //Method onComplete for JSONObject
                        //When the request is correct start Activity_Logged activity
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                            Intent slideactivity = new Intent(Activity_SingIn.this, Activity_Logged.class);
                            Bundle bndlanimation = ActivityOptions
                                    .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2)
                                    .toBundle();
                            startActivity(slideactivity, bndlanimation);
                        }

                        //Method onError for JSONObject
                        //If there's an error with the request displays the error message to the user
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                            handledClick = false;
                        }

                        //Method onComplete for JSONArray
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }

                        //Method onError for JSONArray
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }
                    }).exec();
                } else { //If the internet connection is not working
                    Toast.makeText(getApplicationContext(), "Network is not working", Toast.LENGTH_LONG).show();
                    handledClick = false;
                }
            }
        }
    });
}

From source file:com.piggate.samples.PiggateLogin.Activity_SingIn.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _piggate = new Piggate(this, null); //Initialize the Piggate object

    setContentView(R.layout.activity_login);
    //EditTexts for user email and password
    editEmail = (EditText) findViewById(R.id.editText1);
    editPass = (EditText) findViewById(R.id.editText2);
    Button login = (Button) findViewById(R.id.buttonlogin2);
    final ImageButton return_button = (ImageButton) findViewById(R.id.return1);

    //Handles the top left back button of the activity
    return_button.setOnClickListener(new View.OnClickListener() {
        @Override//from  w  w w  . j  a  v a2  s.  c o m
        public void onClick(View v) {
            onBackPressed();
        }
    });

    //OnClick listener for the login button
    //Handles the register request to the server with the email and password fields
    //and the login request if the fields are correct
    login.setOnClickListener(new View.OnClickListener() {
        @Override
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;
                String email = editEmail.getText().toString();
                String pass = editPass.getText().toString();

                //If the internet connection is working
                if (checkInternetConnection() == true) {
                    RequestParams params = new RequestParams();
                    params.put("email", email);
                    params.put("password", pass);

                    //Request of the Piggate object. Handles the register into the application
                    // and the login with the user email and password
                    _piggate.RequestOpenSession(params).setListenerRequest(new Piggate.PiggateCallBack() {

                        //Method onComplete for JSONObject
                        //When the request is correct start Activity_Logged activity
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                            Intent slideactivity = new Intent(Activity_SingIn.this, Activity_Logged.class);
                            Bundle bndlanimation = ActivityOptions
                                    .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2)
                                    .toBundle();
                            startActivity(slideactivity, bndlanimation);
                        }

                        //Method onError for JSONObject
                        //If there's an error with the request displays the error message to the user
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                            handledClick = false;

                        }

                        //Method onComplete for JSONArray
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }

                        //Method onError for JSONArray
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }
                    }).exec();
                } else { //If the internet connection is not working
                    Toast.makeText(getApplicationContext(), "Network is not working", Toast.LENGTH_LONG).show();
                    handledClick = false;

                }
            }
        }
    });
}

From source file:com.piggate.samples.PiggateLoginApplication.Activity_SingUp.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _piggate = new Piggate(this, null); //Initialize the Piggate object

    setContentView(R.layout.activity_register);
    //EditTexts for user email and password
    editEmail = (EditText) findViewById(R.id.editText1);
    editPass = (EditText) findViewById(R.id.editText2);
    final ImageButton return_button = (ImageButton) findViewById(R.id.return1);
    Button register = (Button) findViewById(R.id.buttonregister2);

    //Handles the top left back button of the activity
    return_button.setOnClickListener(new View.OnClickListener() {
        @Override//from  w ww  .jav  a 2  s  . c  om
        public void onClick(View v) {
            onBackPressed();
        }
    });

    //OnClick listener for the login button
    //Handles the register request to the server with the email and password fields
    //and the login request if the fields are correct
    register.setOnClickListener(new View.OnClickListener() {
        @Override
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;
                String email = editEmail.getText().toString();
                String pass = editPass.getText().toString();

                //If the internet connection is working
                if (checkInternetConnection() == true) {
                    RequestParams params = new RequestParams();
                    params.put("email", email);
                    params.put("password", pass);

                    //Request of the Piggate object. Handles the register into the application
                    // and the login with the user email and password
                    _piggate.RequestNewUser(params).setListenerRequest(new Piggate.PiggateCallBack() {

                        //Method onComplete for JSONObject
                        //When the request is correct start Activity_Logged activity
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                            Intent slideactivity = new Intent(Activity_SingUp.this, Activity_Logged.class);
                            Bundle bndlanimation = ActivityOptions
                                    .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2)
                                    .toBundle();
                            startActivity(slideactivity, bndlanimation);
                        }

                        //Method onError for JSONObject
                        //If there's an error with the request displays the error message to the user
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                        }

                        //Method onComplete for JSONArray
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }

                        //Method onError for JSONArray
                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {
                            //Unused
                        }
                    }).exec();

                } else { //If the internet connection is not working
                    Toast.makeText(getApplicationContext(), "Network is not working", Toast.LENGTH_LONG).show();
                }
            }
        }
    });
}

From source file:com.lithiumli.fiction.NowPlayingActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        Intent parentIntent = new Intent(this, LibraryActivity.class);
        parentIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        ActivityOptions options = ActivityOptions.makeCustomAnimation(this, R.anim.activity_slide_down,
                R.anim.activity_slide_up);
        startActivity(parentIntent, options.toBundle());
        finish();//from w ww .jav a 2s. c o  m
        return true;
    case R.id.select_artist_image:
        selectArtistImage();
    }
    return super.onOptionsItemSelected(item);
}

From source file:samples.piggate.com.piggateInfoDemo.InfoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_artwork);

    //Set action bar fields
    getSupportActionBar().setTitle(PiggateUser.getEmail());
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    title = (TextView) findViewById(R.id.InfoTitle);
    description = (TextView) findViewById(R.id.InfoDescription);
    image = (SmartImageView) findViewById(R.id.InfoImage);
    videoButton = (FloatingActionButton) findViewById(R.id.videoButton);

    errorDialog = new AlertDialog.Builder(this).create();
    errorDialog.setTitle("Logout error");
    errorDialog.setMessage("There is an error with the logout");
    errorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
        @Override/*from   ww  w. j a v a2 s .  c om*/
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    networkErrorDialog = new AlertDialog.Builder(this).create();
    networkErrorDialog.setTitle("Network error");
    networkErrorDialog.setMessage("There is an error with the network connection");
    networkErrorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    title.setText(getIntent().getExtras().getString("infoTitle"));
    description.setText(getIntent().getExtras().getString("infoDescription"));
    image.setImageUrl(getIntent().getExtras().getString("infoImageURL"));

    videoButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (checkInternetConnection() == true) { //If internet is working

                //Start the video here
                Intent slideactivity = new Intent(getApplicationContext(), VideoViewActivity.class);
                slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                //Information about selected content
                slideactivity.putExtra("infoTitle", getIntent().getExtras().getString("infoTitle"));
                slideactivity.putExtra("infoDescription", getIntent().getExtras().getString("infoDescription"));
                slideactivity.putExtra("infoImageURL", getIntent().getExtras().getString("infoImageURL"));
                slideactivity.putExtra("infoVideoURL", getIntent().getExtras().getString("infoVideoURL"));
                Bundle bndlanimation = ActivityOptions
                        .makeCustomAnimation(getApplicationContext(), R.anim.slidefromright, R.anim.slidetoleft)
                        .toBundle();
                getApplicationContext().startActivity(slideactivity, bndlanimation);
            } else {
                //If internet conexion is not working displays an error message
                networkErrorDialog.show();
            }
        }
    });
}

From source file:samples.piggate.com.piggateCompleteExample.Activity_Exchange.java

public void goBackActivity(boolean exchanged) {
    //Go back to the offer list passing the offer attributes (to exchange)
    Intent slideactivity = new Intent(Activity_Exchange.this, Activity_Logged.class);
    slideactivity.putExtra("exchanged", exchanged);
    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    Bundle bndlanimation = ActivityOptions
            .makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle();
    startActivity(slideactivity, bndlanimation);
}