diff options
author | Tom Hennen <tom.hennen@gmail.com> | 2015-09-05 14:22:28 -0400 |
---|---|---|
committer | Tom Hennen <tom.hennen@gmail.com> | 2015-09-07 21:25:18 -0400 |
commit | 1d38db32d5cbb1a86276600bc06f660f9c521ec9 (patch) | |
tree | 3c569fa1c868ebed87b482e1cd6b6d796bdc3620 /app/src/main | |
parent | 98a0b46bed65b6489923be7364bb9894901ae6fc (diff) | |
download | AntennaPod-1d38db32d5cbb1a86276600bc06f660f9c521ec9.zip |
episodes fragment with tabs. layout of item info is messed up for some reason.
Diffstat (limited to 'app/src/main')
5 files changed, 92 insertions, 1 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index e10e8041e..7f6cc1bda 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -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; diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java index c3bf8faa5..e3eb5d571 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java @@ -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; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java index b4c4f1822..55b1c4cb1 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java @@ -105,7 +105,7 @@ public class AllEpisodesFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setRetainInstance(true); + //setRetainInstance(true); setHasOptionsMenu(true); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesFragment.java new file mode 100644 index 000000000..698e1660b --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesFragment.java @@ -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; + } + +} diff --git a/app/src/main/res/layout/episodes_fragment.xml b/app/src/main/res/layout/episodes_fragment.xml new file mode 100644 index 000000000..70b288cdf --- /dev/null +++ b/app/src/main/res/layout/episodes_fragment.xml @@ -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>
\ No newline at end of file |