Search in sources :

Example 6 with ActivityOptionsCompat

use of androidx.core.app.ActivityOptionsCompat in project twicalico by moko256.

the class MainActivity method startMyUserActivity.

private void startMyUserActivity() {
    ActivityOptionsCompat animation = ActivityOptionsCompat.makeSceneTransitionAnimation(this, userImage, "icon_image");
    startActivity(ShowUserActivity.getIntent(this, client.getAccessToken().getUserId()), animation.toBundle());
}
Also used : ActivityOptionsCompat(androidx.core.app.ActivityOptionsCompat)

Example 7 with ActivityOptionsCompat

use of androidx.core.app.ActivityOptionsCompat in project twicalico by moko256.

the class UsersAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, final int i) {
    User item = userCache.get(data.get(i));
    if (item != null) {
        requestManager.load(converter.convertProfileIconUriBySize(item, DpToPxKt.dpToPx(context, 40))).circleCrop().transition(DrawableTransitionOptions.withCrossFade()).into(viewHolder.userUserImage);
        CharSequence userNameText = TwitterStringUtils.plusUserMarks(item.getName(), viewHolder.userUserName, item.isProtected(), item.isVerified());
        viewHolder.userUserName.setText(userNameText);
        Emoji[] userNameEmojis = item.getEmojis();
        if (userNameEmojis != null) {
            viewHolder.disposable.add(new EmojiToTextViewSetter(requestManager, viewHolder.userUserName, userNameText, userNameEmojis));
        }
        viewHolder.userUserId.setText(TwitterStringUtils.plusAtMark(item.getScreenName()));
        viewHolder.itemView.setOnClickListener(v -> {
            ActivityOptionsCompat animation = ActivityOptionsCompat.makeSceneTransitionAnimation(((Activity) context), viewHolder.userUserImage, "icon_image");
            context.startActivity(GlobalApplicationKt.setAccountKeyForActivity(ShowUserActivity.getIntent(context, item.getId()), ((Activity) context)), animation.toBundle());
        });
    }
}
Also used : User(com.github.moko256.latte.client.base.entity.User) EmojiToTextViewSetter(com.github.moko256.twitlatte.view.EmojiToTextViewSetter) Emoji(com.github.moko256.latte.client.base.entity.Emoji) Activity(android.app.Activity) ActivityOptionsCompat(androidx.core.app.ActivityOptionsCompat)

Example 8 with ActivityOptionsCompat

use of androidx.core.app.ActivityOptionsCompat in project FlexibleAdapter by davideas.

the class MainActivity method onNavigationItemSelected.

/* =======================================
	 * NAVIGATION DRAWER & FRAGMENT MANAGEMENT
	 * ======================================= */
/**
 * IMPORTANT!! READ THE COMMENT FOR THE FRAGMENT REPLACE
 */
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    hideFabSilently();
    // Handle navigation view item clicks
    int id = item.getItemId();
    if (id == R.id.nav_overall) {
        mFragment = FragmentOverall.newInstance(2);
    } else if (id == R.id.nav_selection_modes) {
        mFragment = FragmentSelectionModes.newInstance(2);
    } else if (id == R.id.nav_filter) {
        mFragment = FragmentAsyncFilter.newInstance(true);
    } else if (id == R.id.nav_animator) {
        mFragment = FragmentAnimators.newInstance();
    } else if (id == R.id.nav_endless_scrolling) {
        mFragment = FragmentEndlessScrolling.newInstance(2);
        showFab();
    } else if (id == R.id.nav_instagram_headers) {
        mFragment = FragmentInstagramHeaders.newInstance();
    } else if (id == R.id.nav_db_headers_and_sections) {
        mFragment = FragmentDataBinding.newInstance(2);
    } else if (id == R.id.nav_headers_and_sections) {
        mFragment = FragmentHeadersSections.newInstance(2);
        showFab();
    } else if (id == R.id.nav_multi_level_expandable) {
        mFragment = FragmentExpandableMultiLevel.newInstance(2);
    } else if (id == R.id.nav_expandable_sections) {
        mFragment = FragmentExpandableSections.newInstance(3);
        showFab();
    } else if (id == R.id.nav_staggered) {
        mFragment = FragmentStaggeredLayout.newInstance(2);
    } else if (id == R.id.nav_model_holders) {
        mFragment = FragmentHolderSections.newInstance();
    } else if (id == R.id.nav_viewpager) {
        Intent intent = new Intent(this, ViewPagerActivity.class);
        ActivityOptionsCompat activityOptionsCompat = ActivityOptionsCompat.makeBasic();
        ActivityCompat.startActivity(this, intent, activityOptionsCompat.toBundle());
        // Close drawer
        mRecyclerView.post(new Runnable() {

            @Override
            public void run() {
                mDrawer.closeDrawer(GravityCompat.START);
            }
        });
        return true;
    } else if (id == R.id.nav_about) {
        MessageDialog.newInstance(R.drawable.ic_info_grey600_24dp, getString(R.string.about_title), getString(R.string.about_body, Utils.getVersionName(this))).show(getFragmentManager(), MessageDialog.TAG);
        return true;
    } else if (id == R.id.nav_github) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("https://github.com/davideas/FlexibleAdapter"));
        startActivity(Intent.createChooser(intent, getString(R.string.intent_chooser)));
        return true;
    }
    // Insert the fragment by replacing any existing fragment
    if (mFragment != null) {
        // Highlight the selected item has been done by NavigationView
        item.setChecked(true);
        // THIS IS VERY IMPORTANT. Because you are going to inflate a new RecyclerView, its
        // Adapter will be null, therefore the following method cannot be called automatically!
        // If your StickyHeaderContainer is in the main view, you must call this method to clean
        // the previous sticky view. Alternatively you can move the <include> of StickyHeaderLayout
        // in the Fragment view.
        mAdapter.onDetachedFromRecyclerView(mRecyclerView);
        // Inflate the new Fragment with the new RecyclerView and a new Adapter
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction().replace(R.id.recycler_view_container, mFragment).commit();
        // Close drawer
        mRecyclerView.post(new Runnable() {

            @Override
            public void run() {
                mDrawer.closeDrawer(GravityCompat.START);
            }
        });
        // mToolbar.setSubtitle(item.getTitle());
        mHeaderView.bindTo(getString(R.string.app_name), item.getTitle());
        return true;
    }
    return false;
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) Intent(android.content.Intent) ActivityOptionsCompat(androidx.core.app.ActivityOptionsCompat)

Example 9 with ActivityOptionsCompat

use of androidx.core.app.ActivityOptionsCompat in project FlexibleAdapter by davideas.

the class SplashActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (Utils.hasLollipop())
        requestWindowFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    super.onCreate(savedInstanceState);
    if (Utils.hasLollipop()) {
        getWindow().setExitTransition(new Fade());
    }
    Intent intent = new Intent(this, MainActivity.class);
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this);
    ActivityCompat.startActivity(this, intent, options.toBundle());
    ActivityCompat.finishAfterTransition(this);
}
Also used : Intent(android.content.Intent) Fade(android.transition.Fade) ActivityOptionsCompat(androidx.core.app.ActivityOptionsCompat)

Example 10 with ActivityOptionsCompat

use of androidx.core.app.ActivityOptionsCompat in project PhotoView by chrisbanes.

the class ActivityTransitionActivity method transition.

private void transition(View view) {
    if (Build.VERSION.SDK_INT < 21) {
        Toast.makeText(ActivityTransitionActivity.this, "21+ only, keep out", Toast.LENGTH_SHORT).show();
    } else {
        Intent intent = new Intent(ActivityTransitionActivity.this, ActivityTransitionToActivity.class);
        ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(ActivityTransitionActivity.this, view, getString(R.string.transition_test));
        startActivity(intent, options.toBundle());
    }
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(androidx.core.app.ActivityOptionsCompat)

Aggregations

ActivityOptionsCompat (androidx.core.app.ActivityOptionsCompat)14 Intent (android.content.Intent)12 View (android.view.View)4 Activity (android.app.Activity)2 TextView (android.widget.TextView)2 SuppressLint (android.annotation.SuppressLint)1 ClipData (android.content.ClipData)1 ClipboardManager (android.content.ClipboardManager)1 Context (android.content.Context)1 Bundle (android.os.Bundle)1 LinkMovementMethod (android.text.method.LinkMovementMethod)1 Fade (android.transition.Fade)1 Menu (android.view.Menu)1 MenuItem (android.view.MenuItem)1 GONE (android.view.View.GONE)1 VISIBLE (android.view.View.VISIBLE)1 Button (android.widget.Button)1 ImageView (android.widget.ImageView)1 Toast (android.widget.Toast)1 ActionBar (androidx.appcompat.app.ActionBar)1