Search in sources :

Example 1 with ATabsFragment

use of org.aisen.android.ui.fragment.ATabsFragment in project AisenWeiBo by wangdan.

the class MainActivity method setFragemnt.

private void setFragemnt(final Fragment fragment, CharSequence title) {
    if (fragment == null)
        return;
    toolbarTitle = title.toString();
    getSupportActionBar().setTitle(toolbarTitle);
    // 如果是TabsFragment,显示TabLayout
    if (fragment instanceof ATabsFragment) {
        tabLayout.setVisibility(View.VISIBLE);
    } else {
        tabLayout.setVisibility(View.GONE);
    }
    // 显示AppBarLayout
    appBarLayout.setExpanded(true, true);
    // .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
    View view = findViewById(R.id.content_frame);
    view.setAlpha(0.0f);
    ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 1.0f);
    anim.setDuration(600);
    anim.start();
    getFragmentManager().beginTransaction().replace(R.id.content_frame, fragment, "MainFragment").commit();
}
Also used : ATabsFragment(org.aisen.android.ui.fragment.ATabsFragment) ObjectAnimator(android.animation.ObjectAnimator) View(android.view.View)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)1 View (android.view.View)1 ATabsFragment (org.aisen.android.ui.fragment.ATabsFragment)1