Merge pull request #1175 from TomHennen/episode_tablayout
Collapsed "New Episodes" and "All Episodes" in to "Episodes"
This commit is contained in:
commit
4697607e92
|
@ -12,6 +12,7 @@ dependencies {
|
|||
compile 'com.android.support:appcompat-v7:22.2.1'
|
||||
compile 'com.android.support:gridlayout-v7:22.2.1'
|
||||
compile 'com.android.support:cardview-v7:22.2.1'
|
||||
compile 'com.android.support:design:22.2.1'
|
||||
compile 'org.apache.commons:commons-lang3:3.3.2'
|
||||
compile('org.shredzone.flattr4j:flattr4j-core:2.12') {
|
||||
exclude group: 'org.json', module: 'json'
|
||||
|
|
|
@ -18,9 +18,8 @@ import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
|
|||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||
import de.danoeh.antennapod.fragment.AllEpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.DownloadsFragment;
|
||||
import de.danoeh.antennapod.fragment.NewEpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.EpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
|
||||
import de.danoeh.antennapod.fragment.QueueFragment;
|
||||
import de.danoeh.antennapod.preferences.PreferenceController;
|
||||
|
@ -98,17 +97,11 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
|
|||
solo.waitForView(android.R.id.list);
|
||||
assertEquals(solo.getString(R.string.queue_label), getActionbarTitle());
|
||||
|
||||
// new episodes
|
||||
// episodes
|
||||
openNavDrawer();
|
||||
solo.clickOnText(solo.getString(R.string.new_episodes_label));
|
||||
solo.clickOnText(solo.getString(R.string.episodes_label));
|
||||
solo.waitForView(android.R.id.list);
|
||||
assertEquals(solo.getString(R.string.new_episodes_label), getActionbarTitle());
|
||||
|
||||
// all episodes
|
||||
openNavDrawer();
|
||||
solo.clickOnText(solo.getString(R.string.all_episodes_label));
|
||||
solo.waitForView(android.R.id.list);
|
||||
assertEquals(solo.getString(R.string.all_episodes_label), getActionbarTitle());
|
||||
assertEquals(solo.getString(R.string.episodes_label), getActionbarTitle());
|
||||
|
||||
// downloads
|
||||
openNavDrawer();
|
||||
|
@ -156,18 +149,18 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
|
|||
openNavDrawer();
|
||||
solo.clickLongOnText(solo.getString(R.string.queue_label));
|
||||
solo.waitForDialogToOpen();
|
||||
solo.clickOnText(solo.getString(R.string.all_episodes_label));
|
||||
solo.clickOnText(solo.getString(R.string.episodes_label));
|
||||
solo.clickOnText(solo.getString(R.string.playback_history_label));
|
||||
solo.clickOnText(solo.getString(R.string.confirm_label));
|
||||
solo.waitForDialogToClose();
|
||||
List<String> hidden = UserPreferences.getHiddenDrawerItems();
|
||||
assertEquals(2, hidden.size());
|
||||
assertTrue(hidden.contains(AllEpisodesFragment.TAG));
|
||||
assertTrue(hidden.contains(EpisodesFragment.TAG));
|
||||
assertTrue(hidden.contains(PlaybackHistoryFragment.TAG));
|
||||
}
|
||||
|
||||
public void testDrawerPreferencesUnhideSomeElements() {
|
||||
List<String> hidden = Arrays.asList(NewEpisodesFragment.TAG, DownloadsFragment.TAG);
|
||||
List<String> hidden = Arrays.asList(PlaybackHistoryFragment.TAG, DownloadsFragment.TAG);
|
||||
UserPreferences.setHiddenDrawerItems(getInstrumentation().getTargetContext(), hidden);
|
||||
openNavDrawer();
|
||||
solo.clickLongOnText(solo.getString(R.string.queue_label));
|
||||
|
@ -179,7 +172,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
|
|||
hidden = UserPreferences.getHiddenDrawerItems();
|
||||
assertEquals(2, hidden.size());
|
||||
assertTrue(hidden.contains(QueueFragment.TAG));
|
||||
assertTrue(hidden.contains(NewEpisodesFragment.TAG));
|
||||
assertTrue(hidden.contains(PlaybackHistoryFragment.TAG));
|
||||
}
|
||||
|
||||
public void testDrawerPreferencesHideAllElements() {
|
||||
|
@ -195,7 +188,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
|
|||
solo.clickOnText(solo.getString(R.string.confirm_label));
|
||||
solo.waitForDialogToClose();
|
||||
List<String> hidden = UserPreferences.getHiddenDrawerItems();
|
||||
assertEquals(6, hidden.size());
|
||||
assertEquals(titles.length, hidden.size());
|
||||
for(String tag : MainActivity.NAV_DRAWER_TAGS) {
|
||||
assertTrue(hidden.contains(tag));
|
||||
}
|
||||
|
|
|
@ -86,8 +86,8 @@ public class PlaybackTest extends ActivityInstrumentationTestCase2<MainActivity>
|
|||
|
||||
private void startLocalPlayback() {
|
||||
openNavDrawer();
|
||||
|
||||
solo.clickOnText(solo.getString(R.string.all_episodes_label));
|
||||
solo.clickOnText(solo.getString(R.string.episodes_label));
|
||||
solo.clickOnText(solo.getString(R.string.all_episodes_short_label));
|
||||
final List<FeedItem> episodes = DBReader.getRecentlyPublishedEpisodes(context, 10);
|
||||
assertTrue(solo.waitForView(solo.getView(R.id.butSecondaryAction)));
|
||||
|
||||
|
|
|
@ -45,11 +45,10 @@ import de.danoeh.antennapod.core.storage.DBReader;
|
|||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
||||
import de.danoeh.antennapod.fragment.AddFeedFragment;
|
||||
import de.danoeh.antennapod.fragment.AllEpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.DownloadsFragment;
|
||||
import de.danoeh.antennapod.fragment.EpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.ExternalPlayerFragment;
|
||||
import de.danoeh.antennapod.fragment.ItemlistFragment;
|
||||
import de.danoeh.antennapod.fragment.NewEpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
|
||||
import de.danoeh.antennapod.fragment.QueueFragment;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
|
@ -82,8 +81,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
|
|||
|
||||
public static final String[] NAV_DRAWER_TAGS = {
|
||||
QueueFragment.TAG,
|
||||
NewEpisodesFragment.TAG,
|
||||
AllEpisodesFragment.TAG,
|
||||
EpisodesFragment.TAG,
|
||||
DownloadsFragment.TAG,
|
||||
PlaybackHistoryFragment.TAG,
|
||||
AddFeedFragment.TAG
|
||||
|
@ -169,10 +167,17 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
|
|||
transaction.replace(R.id.main_view, mainFragment);
|
||||
} else {
|
||||
String lastFragment = getLastNavFragment();
|
||||
if(ArrayUtils.contains(NAV_DRAWER_TAGS, lastFragment)) {
|
||||
if (ArrayUtils.contains(NAV_DRAWER_TAGS, lastFragment)) {
|
||||
loadFragment(lastFragment, null);
|
||||
} else {
|
||||
loadFeedFragmentById(Integer.valueOf(lastFragment), null);
|
||||
try {
|
||||
loadFeedFragmentById(Integer.valueOf(lastFragment), null);
|
||||
} catch (NumberFormatException e) {
|
||||
// it's not a number, this happens if we removed
|
||||
// a label from the NAV_DRAWER_TAGS
|
||||
// give them a nice default...
|
||||
loadFragment(QueueFragment.TAG, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
externalPlayerFragment = new ExternalPlayerFragment();
|
||||
|
@ -281,11 +286,8 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
|
|||
case QueueFragment.TAG:
|
||||
fragment = new QueueFragment();
|
||||
break;
|
||||
case NewEpisodesFragment.TAG:
|
||||
fragment = new NewEpisodesFragment();
|
||||
break;
|
||||
case AllEpisodesFragment.TAG:
|
||||
fragment = new AllEpisodesFragment();
|
||||
case EpisodesFragment.TAG:
|
||||
fragment = new EpisodesFragment();
|
||||
break;
|
||||
case DownloadsFragment.TAG:
|
||||
fragment = new DownloadsFragment();
|
||||
|
@ -296,6 +298,10 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
|
|||
case AddFeedFragment.TAG:
|
||||
fragment = new AddFeedFragment();
|
||||
break;
|
||||
default:
|
||||
// default to the queue
|
||||
fragment = new QueueFragment();
|
||||
break;
|
||||
}
|
||||
currentTitle = navAdapter.getLabel(tag);
|
||||
getSupportActionBar().setTitle(currentTitle);
|
||||
|
@ -538,7 +544,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
|
|||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
if(getSelectedNavListIndex() == position) {
|
||||
loadFragment(NewEpisodesFragment.TAG, null);
|
||||
loadFragment(EpisodesFragment.TAG, null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -33,6 +33,7 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
|
|||
import de.danoeh.antennapod.fragment.AddFeedFragment;
|
||||
import de.danoeh.antennapod.fragment.AllEpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.DownloadsFragment;
|
||||
import de.danoeh.antennapod.fragment.EpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.NewEpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
|
||||
import de.danoeh.antennapod.fragment.QueueFragment;
|
||||
|
@ -94,6 +95,9 @@ public class NavListAdapter extends BaseAdapter
|
|||
case NewEpisodesFragment.TAG:
|
||||
icon = R.attr.ic_new;
|
||||
break;
|
||||
case EpisodesFragment.TAG:
|
||||
icon = R.attr.feed;
|
||||
break;
|
||||
case AllEpisodesFragment.TAG:
|
||||
icon = R.attr.feed;
|
||||
break;
|
||||
|
@ -212,7 +216,7 @@ public class NavListAdapter extends BaseAdapter
|
|||
} else {
|
||||
holder.count.setVisibility(View.GONE);
|
||||
}
|
||||
} else if (tags.get(position).equals(NewEpisodesFragment.TAG)) {
|
||||
} else if (tags.get(position).equals(EpisodesFragment.TAG)) {
|
||||
int unreadItems = itemAccess.getNumberOfNewItems();
|
||||
if (unreadItems > 0) {
|
||||
holder.count.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -105,7 +105,6 @@ public class AllEpisodesFragment extends Fragment {
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setRetainInstance(true);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
|
@ -270,16 +269,14 @@ public class AllEpisodesFragment extends Fragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return onCreateViewHelper(inflater, container, savedInstanceState,
|
||||
R.layout.all_episodes_fragment, R.string.all_episodes_label);
|
||||
R.layout.all_episodes_fragment);
|
||||
}
|
||||
|
||||
protected View onCreateViewHelper(LayoutInflater inflater,
|
||||
ViewGroup container,
|
||||
Bundle savedInstanceState,
|
||||
int fragmentResource,
|
||||
int titleString) {
|
||||
int fragmentResource) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
((MainActivity) getActivity()).getSupportActionBar().setTitle(titleString);
|
||||
|
||||
View root = inflater.inflate(fragmentResource, container, false);
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package de.danoeh.antennapod.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
|
@ -25,15 +28,24 @@ public class DownloadsFragment extends Fragment {
|
|||
public static final int POS_COMPLETED = 1;
|
||||
public static final int POS_LOG = 2;
|
||||
|
||||
private ViewPager pager;
|
||||
private static final String PREF_LAST_TAB_POSITION = "tab_position";
|
||||
|
||||
private ViewPager viewPager;
|
||||
private TabLayout tabLayout;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View root = inflater.inflate(R.layout.pager_fragment, container, false);
|
||||
pager = (ViewPager) root.findViewById(R.id.pager);
|
||||
|
||||
viewPager = (ViewPager)root.findViewById(R.id.viewpager);
|
||||
DownloadsPagerAdapter pagerAdapter = new DownloadsPagerAdapter(getChildFragmentManager(), getResources());
|
||||
pager.setAdapter(pagerAdapter);
|
||||
viewPager.setAdapter(pagerAdapter);
|
||||
|
||||
// Give the TabLayout the ViewPager
|
||||
tabLayout = (TabLayout) root.findViewById(R.id.sliding_tabs);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
@ -42,10 +54,30 @@ public class DownloadsFragment extends Fragment {
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
int tab = getArguments().getInt(ARG_SELECTED_TAB);
|
||||
pager.setCurrentItem(tab, false);
|
||||
viewPager.setCurrentItem(tab, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
// save our tab selection
|
||||
SharedPreferences prefs = getActivity().getSharedPreferences(TAG, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putInt(PREF_LAST_TAB_POSITION, tabLayout.getSelectedTabPosition());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
// restore our last position
|
||||
SharedPreferences prefs = getActivity().getSharedPreferences(TAG, Context.MODE_PRIVATE);
|
||||
int lastPosition = prefs.getInt(PREF_LAST_TAB_POSITION, 0);
|
||||
viewPager.setCurrentItem(lastPosition);
|
||||
}
|
||||
|
||||
public class DownloadsPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
Resources resources;
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
package de.danoeh.antennapod.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
|
||||
public class EpisodesFragment extends Fragment {
|
||||
|
||||
public static final String TAG = "EpisodesFragment";
|
||||
private static final String PREF_LAST_TAB_POSITION = "tab_position";
|
||||
|
||||
public static final int POS_NEW_EPISODES = 0;
|
||||
public static final int POS_ALL_EPISODES = 1;
|
||||
public static final int TOTAL_COUNT = 2;
|
||||
|
||||
|
||||
private TabLayout tabLayout;
|
||||
private ViewPager viewPager;
|
||||
|
||||
//Mandatory Constructor
|
||||
public EpisodesFragment() {
|
||||
}
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setRetainInstance(true);
|
||||
}
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.episodes_label);
|
||||
|
||||
View rootView = inflater.inflate(R.layout.pager_fragment, container, false);
|
||||
viewPager = (ViewPager)rootView.findViewById(R.id.viewpager);
|
||||
viewPager.setAdapter(new EpisodesPagerAdapter(getChildFragmentManager(), getResources()));
|
||||
|
||||
// Give the TabLayout the ViewPager
|
||||
tabLayout = (TabLayout) rootView.findViewById(R.id.sliding_tabs);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
// save our tab selection
|
||||
SharedPreferences prefs = getActivity().getSharedPreferences(TAG, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putInt(PREF_LAST_TAB_POSITION, tabLayout.getSelectedTabPosition());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
// restore our last position
|
||||
SharedPreferences prefs = getActivity().getSharedPreferences(TAG, Context.MODE_PRIVATE);
|
||||
int lastPosition = prefs.getInt(PREF_LAST_TAB_POSITION, 0);
|
||||
viewPager.setCurrentItem(lastPosition);
|
||||
}
|
||||
|
||||
public static class EpisodesPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
private final Resources resources;
|
||||
|
||||
public EpisodesPagerAdapter(FragmentManager fm, Resources resources) {
|
||||
super(fm);
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
switch (position) {
|
||||
case POS_ALL_EPISODES:
|
||||
return new AllEpisodesFragment();
|
||||
case POS_NEW_EPISODES:
|
||||
return new NewEpisodesFragment();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return TOTAL_COUNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
switch (position) {
|
||||
case POS_ALL_EPISODES:
|
||||
return resources.getString(R.string.all_episodes_short_label);
|
||||
case POS_NEW_EPISODES:
|
||||
return resources.getString(R.string.new_label);
|
||||
default:
|
||||
return super.getPageTitle(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -63,7 +63,7 @@ public class NewEpisodesFragment extends AllEpisodesFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View root = super.onCreateViewHelper(inflater, container, savedInstanceState,
|
||||
R.layout.new_episodes_fragment, R.string.new_episodes_label);
|
||||
R.layout.new_episodes_fragment);
|
||||
|
||||
listView.setRemoveListener(new DragSortListView.RemoveListener() {
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package de.danoeh.antennapod.fragment.gpodnet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
|
@ -17,16 +20,49 @@ import de.danoeh.antennapod.R;
|
|||
*/
|
||||
public class GpodnetMainFragment extends Fragment {
|
||||
|
||||
public static final String TAG = "GpodnetMainFragment";
|
||||
|
||||
private static final String PREF_LAST_TAB_POSITION = "tab_position";
|
||||
private TabLayout tabLayout;
|
||||
private ViewPager viewPager;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View root = inflater.inflate(R.layout.pager_fragment, container, false);
|
||||
ViewPager pager = (ViewPager) root.findViewById(R.id.pager);
|
||||
|
||||
viewPager = (ViewPager)root.findViewById(R.id.viewpager);
|
||||
GpodnetPagerAdapter pagerAdapter = new GpodnetPagerAdapter(getChildFragmentManager(), getResources());
|
||||
pager.setAdapter(pagerAdapter);
|
||||
viewPager.setAdapter(pagerAdapter);
|
||||
|
||||
// Give the TabLayout the ViewPager
|
||||
tabLayout = (TabLayout) root.findViewById(R.id.sliding_tabs);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
// save our tab selection
|
||||
SharedPreferences prefs = getActivity().getSharedPreferences(TAG, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putInt(PREF_LAST_TAB_POSITION, tabLayout.getSelectedTabPosition());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
// restore our last position
|
||||
SharedPreferences prefs = getActivity().getSharedPreferences(TAG, Context.MODE_PRIVATE);
|
||||
int lastPosition = prefs.getInt(PREF_LAST_TAB_POSITION, 0);
|
||||
viewPager.setCurrentItem(lastPosition);
|
||||
}
|
||||
|
||||
public class GpodnetPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v4.view.PagerTabStrip
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top" />
|
||||
</android.support.v4.view.ViewPager>
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/sliding_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed" />
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
|
@ -36,7 +36,7 @@ dependencies {
|
|||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:support-v4:22.2.1'
|
||||
compile 'com.android.support:appcompat-v7:22.2.1'
|
||||
compile 'com.android.support:support-v4:22.2.1'
|
||||
compile 'com.android.support:design:22.2.1'
|
||||
compile 'org.apache.commons:commons-lang3:3.3.2'
|
||||
compile ('org.shredzone.flattr4j:flattr4j-core:2.12') {
|
||||
exclude group: 'org.json', module: 'json'
|
||||
|
|
|
@ -120,8 +120,7 @@
|
|||
|
||||
<string-array name="nav_drawer_titles">
|
||||
<item>@string/queue_label</item>
|
||||
<item>@string/new_episodes_label</item>
|
||||
<item>@string/all_episodes_label</item>
|
||||
<item>@string/episodes_label</item>
|
||||
<item>@string/downloads_label</item>
|
||||
<item>@string/playback_history_label</item>
|
||||
<item>@string/add_feed_label</item>
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
<string name="feeds_label">Feeds</string>
|
||||
<string name="add_feed_label">Add Podcast</string>
|
||||
<string name="podcasts_label">PODCASTS</string>
|
||||
<string name="episodes_label">EPISODES</string>
|
||||
<string name="episodes_label">Episodes</string>
|
||||
<string name="new_episodes_label">New Episodes</string>
|
||||
<string name="all_episodes_label">All Episodes</string>
|
||||
<string name="all_episodes_short_label">All</string>
|
||||
<string name="new_label">New</string>
|
||||
<string name="waiting_list_label">Waiting List</string>
|
||||
<string name="settings_label">Settings</string>
|
||||
|
|
Loading…
Reference in New Issue