episodes fragment with tabs. layout of item info is messed up for some reason.

This commit is contained in:
Tom Hennen 2015-09-05 14:22:28 -04:00
parent 98a0b46bed
commit 1d38db32d5
7 changed files with 94 additions and 2 deletions

View File

@ -47,6 +47,7 @@ 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;
@ -82,6 +83,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
public static final String[] NAV_DRAWER_TAGS = {
QueueFragment.TAG,
EpisodesFragment.TAG,
NewEpisodesFragment.TAG,
AllEpisodesFragment.TAG,
DownloadsFragment.TAG,
@ -281,6 +283,9 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
case QueueFragment.TAG:
fragment = new QueueFragment();
break;
case EpisodesFragment.TAG:
fragment = new EpisodesFragment();
break;
case NewEpisodesFragment.TAG:
fragment = new NewEpisodesFragment();
break;

View File

@ -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;

View File

@ -105,7 +105,7 @@ public class AllEpisodesFragment extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
//setRetainInstance(true);
setHasOptionsMenu(true);
}

View File

@ -0,0 +1,49 @@
package de.danoeh.antennapod.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTabHost;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import de.danoeh.antennapod.R;
public class EpisodesFragment extends Fragment {
public static final String TAG = "EpisodesFragment";
private FragmentTabHost mTabHost;
//Mandatory Constructor
public EpisodesFragment() {
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.episodes_fragment, container, false);
mTabHost = (FragmentTabHost) rootView.findViewById(android.R.id.tabhost);
mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent);
mTabHost.addTab(mTabHost.newTabSpec(NewEpisodesFragment.TAG).setIndicator(
getResources().getString(R.string.new_episodes_label)),
NewEpisodesFragment.class, null);
mTabHost.addTab(mTabHost.newTabSpec(AllEpisodesFragment.TAG).setIndicator(
getResources().getString(R.string.all_episodes_label)),
AllEpisodesFragment.class, null);
return rootView;
}
}

View File

@ -0,0 +1,33 @@
<android.support.v4.app.FragmentTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TabWidget
android:id="@android:id/tabs"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</android.support.v4.app.FragmentTabHost>

View File

@ -120,6 +120,7 @@
<string-array name="nav_drawer_titles">
<item>@string/queue_label</item>
<item>@string/episodes_label</item>
<item>@string/new_episodes_label</item>
<item>@string/all_episodes_label</item>
<item>@string/downloads_label</item>

View File

@ -9,7 +9,7 @@
<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="new_label">New</string>