Search in sources :

Example 51 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project Remindy by abicelis.

the class ProgrammedLocationBasedTaskViewHolder method onClick.

@Override
public void onClick(View view) {
    int id = view.getId();
    switch(id) {
        case R.id.item_task_programmed_location_based_container:
            Pair[] pairs = new Pair[1];
            pairs[0] = new Pair<View, String>(mCategoryIcon, mFragment.getResources().getString(R.string.transition_task_list_category));
            //pairs[1] = new Pair<View, String>(mTitle, mFragment.getResources().getString(R.string.transition_task_list_title));
            //pairs[2] = new Pair<View, String>(mDescription, mFragment.getResources().getString(R.string.transition_task_list_description));
            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(mFragment.getActivity(), pairs);
            Intent openTaskDetailActivity = new Intent(mFragment.getActivity(), TaskDetailActivity.class);
            openTaskDetailActivity.putExtra(TaskDetailActivity.TASK_ID_TO_DISPLAY, mCurrent.getId());
            openTaskDetailActivity.putExtra(TaskDetailActivity.TASK_POSITION, mReminderPosition);
            if (mClickListener != null) {
                mClickListener.onItemClicked(mReminderPosition, openTaskDetailActivity, options.toBundle());
            }
            break;
    }
}
Also used : Intent(android.content.Intent) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) Pair(android.support.v4.util.Pair)

Example 52 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project Remindy by abicelis.

the class ProgrammedRepeatingTaskViewHolder method onClick.

@Override
public void onClick(View view) {
    int id = view.getId();
    switch(id) {
        case R.id.item_task_programmed_repeating_container:
            Pair[] pairs = new Pair[1];
            pairs[0] = new Pair<View, String>(mCategoryIcon, mFragment.getResources().getString(R.string.transition_task_list_category));
            //pairs[1] = new Pair<View, String>(mTitle, mFragment.getResources().getString(R.string.transition_task_list_title));
            //pairs[2] = new Pair<View, String>(mDescription, mFragment.getResources().getString(R.string.transition_task_list_description));
            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(mFragment.getActivity(), pairs);
            Intent openTaskDetailActivity = new Intent(mFragment.getActivity(), TaskDetailActivity.class);
            openTaskDetailActivity.putExtra(TaskDetailActivity.TASK_ID_TO_DISPLAY, mCurrent.getId());
            openTaskDetailActivity.putExtra(TaskDetailActivity.TASK_POSITION, mReminderPosition);
            if (mClickListener != null) {
                mClickListener.onItemClicked(mReminderPosition, openTaskDetailActivity, options.toBundle());
            }
            break;
    }
}
Also used : Intent(android.content.Intent) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) Pair(android.support.v4.util.Pair)

Example 53 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project Tapad by berict.

the class IntentHelper method intentSharedElementWithExtra.

public void intentSharedElementWithExtra(final Activity activity, final String target_name, final int start_element_id, final String transition_name, final String extra_name, final String extra, int delay, final View v) {
    final String classname = "com.bedrock.padder." + target_name;
    final Class<Object> classToLoad;
    try {
        classToLoad = (Class<Object>) Class.forName(classname);
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {

            @Override
            public void run() {
                if (Build.VERSION.SDK_INT >= 21) {
                    Intent intent = new Intent(activity, classToLoad);
                    intent.putExtra(extra_name, extra);
                    View view = v.findViewById(start_element_id);
                    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, // The view which starts the transition
                    view, // The transitionName of the view we’re transitioning to
                    transition_name);
                    ActivityCompat.startActivity(activity, intent, options.toBundle());
                } else {
                    intentWithExtra(activity, target_name, extra_name, extra, 0);
                }
            }
        }, delay);
    } catch (ClassNotFoundException e) {
        Log.i("IntentHelper", "Error, there is no such class");
    }
}
Also used : Handler(android.os.Handler) Intent(android.content.Intent) View(android.view.View) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Aggregations

ActivityOptionsCompat (android.support.v4.app.ActivityOptionsCompat)53 Intent (android.content.Intent)45 View (android.view.View)17 Pair (android.support.v4.util.Pair)12 ImageView (android.widget.ImageView)9 RecyclerView (android.support.v7.widget.RecyclerView)8 TextView (android.widget.TextView)8 Activity (android.app.Activity)7 OnClick (butterknife.OnClick)5 Handler (android.os.Handler)3 ActivityOptions (android.app.ActivityOptions)2 CardView (android.support.v7.widget.CardView)2 Explode (android.transition.Explode)2 LayoutInflater (android.view.LayoutInflater)2 FrameLayout (android.widget.FrameLayout)2 TargetApi (android.annotation.TargetApi)1 Context (android.content.Context)1 Resources (android.content.res.Resources)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1