2015-01-14 12:12:47 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Synced Synapse. All rights reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2015-03-09 22:35:18 +01:00
|
|
|
package org.xbmc.kore.ui;
|
2015-01-14 12:12:47 +01:00
|
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.support.v4.app.Fragment;
|
|
|
|
import android.support.v4.view.ViewPager;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
|
|
|
import com.astuetz.PagerSlidingTabStrip;
|
2015-08-22 20:03:09 +02:00
|
|
|
|
2015-03-09 22:35:18 +01:00
|
|
|
import org.xbmc.kore.R;
|
|
|
|
import org.xbmc.kore.utils.LogUtils;
|
|
|
|
import org.xbmc.kore.utils.TabsAdapter;
|
2015-01-14 12:12:47 +01:00
|
|
|
|
|
|
|
import butterknife.ButterKnife;
|
|
|
|
import butterknife.InjectView;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Container for the various music lists
|
|
|
|
*/
|
|
|
|
public class MusicListFragment extends Fragment {
|
|
|
|
private static final String TAG = LogUtils.makeLogTag(MusicListFragment.class);
|
|
|
|
|
2015-08-22 20:03:09 +02:00
|
|
|
private TabsAdapter tabsAdapter;
|
|
|
|
|
2015-01-14 12:12:47 +01:00
|
|
|
@InjectView(R.id.pager_tab_strip) PagerSlidingTabStrip pagerTabStrip;
|
|
|
|
@InjectView(R.id.pager) ViewPager viewPager;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
2015-11-26 20:28:25 +01:00
|
|
|
ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_default_view_pager, container, false);
|
2015-01-14 12:12:47 +01:00
|
|
|
ButterKnife.inject(this, root);
|
|
|
|
|
2015-08-22 20:03:09 +02:00
|
|
|
tabsAdapter = new TabsAdapter(getActivity(), getChildFragmentManager())
|
2015-01-14 12:12:47 +01:00
|
|
|
.addTab(ArtistListFragment.class, getArguments(), R.string.artists, 1)
|
|
|
|
.addTab(AlbumListFragment.class, getArguments(), R.string.albums, 2)
|
|
|
|
.addTab(AudioGenresListFragment.class, getArguments(), R.string.genres, 3)
|
|
|
|
.addTab(MusicVideoListFragment.class, getArguments(), R.string.music_videos, 4);
|
|
|
|
|
|
|
|
viewPager.setAdapter(tabsAdapter);
|
|
|
|
pagerTabStrip.setViewPager(viewPager);
|
|
|
|
|
|
|
|
return root;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onActivityCreated (Bundle savedInstanceState) {
|
|
|
|
super.onActivityCreated(savedInstanceState);
|
|
|
|
setHasOptionsMenu(false);
|
|
|
|
}
|
|
|
|
}
|