From b3ca73002be134c58ca71da783f6d5cfbe0c823c Mon Sep 17 00:00:00 2001 From: Felix Date: Tue, 19 Sep 2017 17:20:48 +0200 Subject: [PATCH] move to single activity with fragments --- touch/src/main/AndroidManifest.xml | 3 +- .../touch/ConferenceGroupsFragmentPager.java | 4 +- .../touch/activities/BrowseActivity.java | 98 +++++++++++++++++ .../touch/activities/ConferencesActivity.java | 66 ----------- .../touch/activities/EventsActivity.java | 66 ----------- .../ConferenceRecyclerViewAdapter.java | 2 +- .../adapters/EventRecyclerViewAdapter.java | 2 +- .../adapters/ItemRecyclerViewAdapter.java | 6 +- ...ment.java => ConferenceGroupFragment.java} | 12 +- .../fragments/ConferencesBrowseFragment.java | 85 +++++++++++++++ .../touch/fragments/EventsFragment.java | 103 ++++++++++++++++++ .../res/layout/fragment_container_layout.xml | 5 + 12 files changed, 305 insertions(+), 147 deletions(-) create mode 100644 touch/src/main/java/de/nicidienase/chaosflix/touch/activities/BrowseActivity.java delete mode 100644 touch/src/main/java/de/nicidienase/chaosflix/touch/activities/ConferencesActivity.java delete mode 100644 touch/src/main/java/de/nicidienase/chaosflix/touch/activities/EventsActivity.java rename touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/{ConferencesFragment.java => ConferenceGroupFragment.java} (90%) create mode 100644 touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferencesBrowseFragment.java create mode 100644 touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/EventsFragment.java create mode 100644 touch/src/main/res/layout/fragment_container_layout.xml diff --git a/touch/src/main/AndroidManifest.xml b/touch/src/main/AndroidManifest.xml index 720259f1..de767615 100644 --- a/touch/src/main/AndroidManifest.xml +++ b/touch/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ android:supportsRtl="true" android:name=".ChaosflixApplication" android:theme="@style/Base.Theme.AppCompat.Light"> - @@ -21,7 +21,6 @@ - diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/ConferenceGroupsFragmentPager.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/ConferenceGroupsFragmentPager.java index 32982f0d..eb9a5eb5 100644 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/ConferenceGroupsFragmentPager.java +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/ConferenceGroupsFragmentPager.java @@ -12,7 +12,7 @@ import java.util.Map; import de.nicidienase.chaosflix.R; import de.nicidienase.chaosflix.common.entities.recording.Conference; import de.nicidienase.chaosflix.common.entities.recording.ConferencesWrapper; -import de.nicidienase.chaosflix.touch.fragments.ConferencesFragment; +import de.nicidienase.chaosflix.touch.fragments.ConferenceGroupFragment; /** * Created by felix on 18.09.17. @@ -32,7 +32,7 @@ public class ConferenceGroupsFragmentPager extends FragmentPagerAdapter { @Override public Fragment getItem(int position) { // ConferencesFragment conferenceFragment = ConferencesFragment.newInstance(getNumColumns()); - ConferencesFragment conferenceFragment = ConferencesFragment.newInstance(1); + ConferenceGroupFragment conferenceFragment = ConferenceGroupFragment.newInstance(1); List conferences = mConferenceMap.get(orderedConferencesList.get(position)); conferenceFragment.setContent(conferences); return conferenceFragment; diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/BrowseActivity.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/BrowseActivity.java new file mode 100644 index 00000000..4a42bc12 --- /dev/null +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/BrowseActivity.java @@ -0,0 +1,98 @@ +package de.nicidienase.chaosflix.touch.activities; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.design.widget.TabLayout; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentTransaction; +import android.support.v4.view.ViewPager; +import android.transition.TransitionInflater; +import android.util.Log; + +import de.nicidienase.chaosflix.R; +import de.nicidienase.chaosflix.common.entities.recording.Conference; +import de.nicidienase.chaosflix.common.entities.recording.Event; +import de.nicidienase.chaosflix.touch.adapters.ItemRecyclerViewAdapter; +import de.nicidienase.chaosflix.touch.ConferenceGroupsFragmentPager; +import de.nicidienase.chaosflix.touch.fragments.ConferencesBrowseFragment; +import de.nicidienase.chaosflix.touch.fragments.EventsFragment; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.CompositeDisposable; +import io.reactivex.disposables.Disposable; + +/** + * Created by felix on 17.09.17. + */ + +public class BrowseActivity extends TouchBaseActivity implements ItemRecyclerViewAdapter.OnListFragmentInteractionListener{ + + private static final String TAG = BrowseActivity.class.getSimpleName(); + CompositeDisposable mDisposables = new CompositeDisposable(); + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.fragment_container_layout); + Disposable disposable = getApiServiceObservable() + .subscribe(mediaApiService -> { + mediaApiService.getConferences() + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(conferencesWrapper -> { + ConferencesBrowseFragment browseFragment + = ConferencesBrowseFragment.newInstance(getNumColumns()); + browseFragment.setContent(conferencesWrapper); + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + ft.replace(R.id.fragment_container,browseFragment); + ft.commit(); + }); + }); + mDisposables.add(disposable); + } + + @Override + protected void onStop() { + super.onStop(); + mDisposables.dispose(); + } + + @Override + public void onListFragmentInteraction(Object item) { + if(item instanceof Conference){ + Conference con = (Conference) item; + Disposable disposable = getApiServiceObservable() + .subscribe(mediaApiService -> { + mediaApiService.getConference(con.getApiID()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(conference -> { + EventsFragment eventsFragment = EventsFragment.newInstance(getNumColumns()); + eventsFragment.setContent(conference); + FragmentManager fm = getSupportFragmentManager(); + Fragment oldFragment = fm.findFragmentById(R.id.fragment_container); + + TransitionInflater transitionInflater = TransitionInflater.from(this); + oldFragment.setExitTransition( + transitionInflater.inflateTransition(android.R.transition.fade)); + eventsFragment.setEnterTransition( + transitionInflater.inflateTransition(android.R.transition.slide_right)); + eventsFragment.setExitTransition( + transitionInflater.inflateTransition(android.R.transition.slide_right)); + + FragmentTransaction ft = fm.beginTransaction(); + ft.replace(R.id.fragment_container,eventsFragment); + ft.addToBackStack(null); + ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); + ft.commit(); + }); + }); + mDisposables.add(disposable); + } else if (item instanceof Event){ + Event event = (Event) item; + // TODO show event details + } + } + + private int getNumColumns() { + return getResources().getInteger(R.integer.num_columns); + } +} diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/ConferencesActivity.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/ConferencesActivity.java deleted file mode 100644 index 963a295b..00000000 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/ConferencesActivity.java +++ /dev/null @@ -1,66 +0,0 @@ -package de.nicidienase.chaosflix.touch.activities; - -import android.content.Intent; -import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.design.widget.TabLayout; -import android.support.v4.view.ViewPager; -import android.util.Log; - -import de.nicidienase.chaosflix.R; -import de.nicidienase.chaosflix.common.entities.recording.Conference; -import de.nicidienase.chaosflix.touch.adapters.ItemRecyclerViewAdapter; -import de.nicidienase.chaosflix.touch.ConferenceGroupsFragmentPager; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.CompositeDisposable; -import io.reactivex.disposables.Disposable; - -/** - * Created by felix on 17.09.17. - */ - -public class ConferencesActivity extends TouchBaseActivity implements ItemRecyclerViewAdapter.OnListFragmentInteractionListener{ - - private static final String TAG = ConferencesActivity.class.getSimpleName(); - CompositeDisposable mDisposables = new CompositeDisposable(); - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); -// setContentView(R.layout.touch_browse); - setContentView(R.layout.tab_layout); - Disposable disposable = getApiServiceObservable() - .subscribe(mediaApiService -> { - mediaApiService.getConferences() - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(conferencesWrapper -> { - ConferenceGroupsFragmentPager fragmentPager - = new ConferenceGroupsFragmentPager(ConferencesActivity.this,getSupportFragmentManager()); - fragmentPager.setContent(conferencesWrapper.getConferencesBySeries()); - - ViewPager pager = (ViewPager) findViewById(R.id.viewpager); - pager.setAdapter(fragmentPager); - - TabLayout tabLayout = (TabLayout) findViewById(R.id.sliding_tabs); - tabLayout.setupWithViewPager(pager); - }); - }); - mDisposables.add(disposable); - } - - @Override - protected void onStop() { - super.onStop(); - mDisposables.dispose(); - } - - @Override - public void onListFragmentInteraction(Conference item) { - Log.d(TAG,"Clicked " + item.getAcronym()); - Intent intent = new Intent(this, EventsActivity.class); - intent.putExtra(EventsActivity.CONFERENCE_KEY,item); - startActivity(intent); - } - - -} diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/EventsActivity.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/EventsActivity.java deleted file mode 100644 index feeb14d2..00000000 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/activities/EventsActivity.java +++ /dev/null @@ -1,66 +0,0 @@ -package de.nicidienase.chaosflix.touch.activities; - -import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; - -import java.util.List; - -import de.nicidienase.chaosflix.R; -import de.nicidienase.chaosflix.common.entities.recording.Conference; -import de.nicidienase.chaosflix.common.entities.recording.Event; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.CompositeDisposable; -import io.reactivex.disposables.Disposable; - -/** - * Created by felix on 18.09.17. - */ - -public class EventsActivity extends TouchBaseActivity implements EventsRecyclerViewAdapter.OnListFragmentInteractionListener { - public static String CONFERENCE_KEY = "conference"; - private CompositeDisposable mDisposable = new CompositeDisposable(); - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.recycler_view_layout); - RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list); - if(getNumColumns() <= 1){ - recyclerView.setLayoutManager(new LinearLayoutManager(this)); - } else { - recyclerView.setLayoutManager(new GridLayoutManager(this,getNumColumns())); - } - - Conference intentConference = (Conference) getIntent().getParcelableExtra(CONFERENCE_KEY); - Disposable disposable = getApiServiceObservable().subscribe(mediaApiService -> { - mediaApiService.getConference(intentConference.getApiID()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(conference -> { - getSupportActionBar().setTitle(conference.getTitle()); - List events = conference.getEvents(); - // TODO build Adapters, etc. - recyclerView.setAdapter(new EventsRecyclerViewAdapter(events,this)); - }); - } - ); - mDisposable.add(disposable); - } - - @Override - protected void onStop() { - super.onStop(); - mDisposable.dispose(); - } - - @Override - public void onListItemSelected(Event event) { - // TODO start detailview for Events - } - - private int getNumColumns() { - return getResources().getInteger(R.integer.num_columns); - } -} diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/ConferenceRecyclerViewAdapter.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/ConferenceRecyclerViewAdapter.java index 5d057b7b..51db6ea9 100644 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/ConferenceRecyclerViewAdapter.java +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/ConferenceRecyclerViewAdapter.java @@ -8,7 +8,7 @@ import de.nicidienase.chaosflix.common.entities.recording.Conference; public class ConferenceRecyclerViewAdapter extends ItemRecyclerViewAdapter { - public ConferenceRecyclerViewAdapter(List items, OnListFragmentInteractionListener listener) { + public ConferenceRecyclerViewAdapter(List items, OnListFragmentInteractionListener listener) { super(items, listener); } diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/EventRecyclerViewAdapter.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/EventRecyclerViewAdapter.java index 9d04a23e..8ee60419 100644 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/EventRecyclerViewAdapter.java +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/EventRecyclerViewAdapter.java @@ -8,7 +8,7 @@ import de.nicidienase.chaosflix.common.entities.recording.Event; public class EventRecyclerViewAdapter extends ItemRecyclerViewAdapter { - public EventRecyclerViewAdapter(List items, OnListFragmentInteractionListener listener) { + public EventRecyclerViewAdapter(List items, OnListFragmentInteractionListener listener) { super(items, listener); } diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/ItemRecyclerViewAdapter.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/ItemRecyclerViewAdapter.java index 94815185..3ba8aec3 100644 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/ItemRecyclerViewAdapter.java +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/adapters/ItemRecyclerViewAdapter.java @@ -16,7 +16,7 @@ public abstract class ItemRecyclerViewAdapter extends RecyclerView.Adapter mItems; protected final OnListFragmentInteractionListener mListener; - public ItemRecyclerViewAdapter(List items, OnListFragmentInteractionListener listener) { + public ItemRecyclerViewAdapter(List items, OnListFragmentInteractionListener listener) { mItems = items; mListener = listener; } @@ -55,7 +55,7 @@ public abstract class ItemRecyclerViewAdapter extends RecyclerView.Adapter { - void onListFragmentInteraction(T item); + public interface OnListFragmentInteractionListener { + void onListFragmentInteraction(Object item); } } diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferencesFragment.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferenceGroupFragment.java similarity index 90% rename from touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferencesFragment.java rename to touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferenceGroupFragment.java index d7e224d4..1a213db4 100644 --- a/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferencesFragment.java +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferenceGroupFragment.java @@ -18,23 +18,23 @@ import de.nicidienase.chaosflix.touch.adapters.ItemRecyclerViewAdapter; import java.util.ArrayList; import java.util.List; -public class ConferencesFragment extends Fragment { +public class ConferenceGroupFragment extends Fragment { private static final String ARG_COLUMN_COUNT = "column-count"; private int mColumnCount = 1; - private ItemRecyclerViewAdapter.OnListFragmentInteractionListener mListener; + private ItemRecyclerViewAdapter.OnListFragmentInteractionListener mListener; private List mItmes = new ArrayList<>(); - public ConferencesFragment() { + public ConferenceGroupFragment() { } public void setContent(List itmes){ mItmes = itmes; } - public static ConferencesFragment newInstance(int columnCount) { - ConferencesFragment fragment = new ConferencesFragment(); + public static ConferenceGroupFragment newInstance(int columnCount) { + ConferenceGroupFragment fragment = new ConferenceGroupFragment(); Bundle args = new Bundle(); args.putInt(ARG_COLUMN_COUNT, columnCount); fragment.setArguments(args); @@ -75,7 +75,7 @@ public class ConferencesFragment extends Fragment { public void onAttach(Context context) { super.onAttach(context); if (context instanceof ItemRecyclerViewAdapter.OnListFragmentInteractionListener) { - mListener = (ItemRecyclerViewAdapter.OnListFragmentInteractionListener) context; + mListener = (ItemRecyclerViewAdapter.OnListFragmentInteractionListener) context; } else { throw new RuntimeException(context.toString() + " must implement OnListFragmentInteractionListener"); diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferencesBrowseFragment.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferencesBrowseFragment.java new file mode 100644 index 00000000..158c5f70 --- /dev/null +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/ConferencesBrowseFragment.java @@ -0,0 +1,85 @@ +package de.nicidienase.chaosflix.touch.fragments; + +import android.content.Context; +import android.os.Bundle; +import android.support.design.widget.TabLayout; +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 de.nicidienase.chaosflix.R; +import de.nicidienase.chaosflix.common.entities.recording.Conference; +import de.nicidienase.chaosflix.common.entities.recording.ConferencesWrapper; +import de.nicidienase.chaosflix.touch.ConferenceGroupsFragmentPager; +import de.nicidienase.chaosflix.touch.adapters.ItemRecyclerViewAdapter; + +/** + * Created by felix on 19.09.17. + */ + +public class ConferencesBrowseFragment extends Fragment { + + private static final String ARG_COLUMN_COUNT = "column-count"; + private int mColumnCount = 1; + private ItemRecyclerViewAdapter.OnListFragmentInteractionListener mListener; + private ConferencesWrapper conferencesWrapper; + + public ConferencesBrowseFragment() { + } + + public void setContent(ConferencesWrapper conferencesWrapper){ + this.conferencesWrapper = conferencesWrapper; + } + + public static ConferencesBrowseFragment newInstance(int columnCount) { + ConferencesBrowseFragment fragment = new ConferencesBrowseFragment(); + Bundle args = new Bundle(); + args.putInt(ARG_COLUMN_COUNT, columnCount); + fragment.setArguments(args); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments() != null) { + mColumnCount = getArguments().getInt(ARG_COLUMN_COUNT); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.tab_layout, container, false); + ConferenceGroupsFragmentPager fragmentPager + = new ConferenceGroupsFragmentPager(this.getContext(),getChildFragmentManager()); + fragmentPager.setContent(conferencesWrapper.getConferencesBySeries()); + + ViewPager pager = (ViewPager) view.findViewById(R.id.viewpager); + pager.setAdapter(fragmentPager); + + TabLayout tabLayout = (TabLayout) view.findViewById(R.id.sliding_tabs); + tabLayout.setupWithViewPager(pager); + return view; + } + + + @Override + public void onAttach(Context context) { + super.onAttach(context); + if (context instanceof ItemRecyclerViewAdapter.OnListFragmentInteractionListener) { + mListener = (ItemRecyclerViewAdapter.OnListFragmentInteractionListener) context; + } else { + throw new RuntimeException(context.toString() + + " must implement OnListFragmentInteractionListener"); + } + } + + @Override + public void onDetach() { + super.onDetach(); + mListener = null; + } +} diff --git a/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/EventsFragment.java b/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/EventsFragment.java new file mode 100644 index 00000000..9d5590c0 --- /dev/null +++ b/touch/src/main/java/de/nicidienase/chaosflix/touch/fragments/EventsFragment.java @@ -0,0 +1,103 @@ +package de.nicidienase.chaosflix.touch.fragments; + +import android.content.Context; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.GridLayoutManager; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import java.util.ArrayList; +import java.util.List; + +import de.nicidienase.chaosflix.R; +import de.nicidienase.chaosflix.common.entities.recording.Conference; +import de.nicidienase.chaosflix.common.entities.recording.Event; +import de.nicidienase.chaosflix.touch.adapters.EventRecyclerViewAdapter; +import de.nicidienase.chaosflix.touch.adapters.ItemRecyclerViewAdapter; + +public class EventsFragment extends Fragment { + + + private static final String ARG_COLUMN_COUNT = "column-count"; + private int mColumnCount = 1; + private ItemRecyclerViewAdapter.OnListFragmentInteractionListener mListener; + private Conference mConference; + private List mItmes = new ArrayList<>(); + private CharSequence mPreviousTitle; + private ActionBar mActionBar; + + public EventsFragment() { + } + + public void setContent(Conference conference){ + mConference = conference; + mItmes = conference.getEvents(); + } + + public static EventsFragment newInstance(int columnCount) { + EventsFragment fragment = new EventsFragment(); + Bundle args = new Bundle(); + args.putInt(ARG_COLUMN_COUNT, columnCount); + fragment.setArguments(args); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments() != null) { + mColumnCount = getArguments().getInt(ARG_COLUMN_COUNT); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.recycler_view_layout, container, false); + + // Set the adapter + if (view instanceof RecyclerView) { + Context context = view.getContext(); + RecyclerView recyclerView = (RecyclerView) view; + if (mColumnCount <= 1) { + recyclerView.setLayoutManager(new LinearLayoutManager(context)); + } else { + recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount)); + } + + recyclerView.setAdapter(new EventRecyclerViewAdapter(mItmes, mListener) { + }); + } + return view; + } + + + @Override + public void onAttach(Context context) { + super.onAttach(context); + mActionBar = ((AppCompatActivity) context).getSupportActionBar(); + mPreviousTitle = mActionBar.getTitle(); + mActionBar.setTitle(mConference.getTitle()); + if (context instanceof ItemRecyclerViewAdapter.OnListFragmentInteractionListener) { + mListener = (ItemRecyclerViewAdapter.OnListFragmentInteractionListener) context; + } else { + throw new RuntimeException(context.toString() + + " must implement OnListFragmentInteractionListener"); + } + } + + @Override + public void onDetach() { + super.onDetach(); + mListener = null; + mActionBar.setTitle(mPreviousTitle); + } + + +} diff --git a/touch/src/main/res/layout/fragment_container_layout.xml b/touch/src/main/res/layout/fragment_container_layout.xml new file mode 100644 index 00000000..5b84dbf2 --- /dev/null +++ b/touch/src/main/res/layout/fragment_container_layout.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file