Search in sources :

Example 1 with ArtistDetailFragment

use of com.wm.remusic.fragment.ArtistDetailFragment in project remusic by aa112901.

the class TabActivity method onCreate.

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getIntent().getExtras() != null) {
        page = getIntent().getIntExtra("page_number", 0);
        artistId = getIntent().getIntExtra("artist", 0);
        albumId = getIntent().getIntExtra("album", 0);
    }
    setContentView(R.layout.activity_tab);
    if (artistId != 0) {
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        ArtistDetailFragment fragment = ArtistDetailFragment.newInstance(artistId);
        transaction.hide(getSupportFragmentManager().findFragmentById(R.id.tab_container));
        transaction.add(R.id.tab_container, fragment);
        transaction.addToBackStack(null).commit();
    }
    if (albumId != 0) {
    }
    String[] title = { "单曲", "歌手", "专辑", "文件夹" };
    TabPagerFragment fragment = TabPagerFragment.newInstance(page, title);
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.add(R.id.tab_container, fragment);
    transaction.commitAllowingStateLoss();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) TabPagerFragment(com.wm.remusic.fragment.TabPagerFragment) ArtistDetailFragment(com.wm.remusic.fragment.ArtistDetailFragment)

Aggregations

FragmentTransaction (android.support.v4.app.FragmentTransaction)1 ArtistDetailFragment (com.wm.remusic.fragment.ArtistDetailFragment)1 TabPagerFragment (com.wm.remusic.fragment.TabPagerFragment)1