diff --git a/app/src/main/java/org/openlp/android2/OpenLP.java b/app/src/main/java/org/openlp/android2/OpenLP.java index 9b435ae..5312d6b 100644 --- a/app/src/main/java/org/openlp/android2/OpenLP.java +++ b/app/src/main/java/org/openlp/android2/OpenLP.java @@ -121,23 +121,29 @@ public class OpenLP extends ActionBarActivity .replace(R.id.container, HomeFragment.newInstance()) .commit(); mTitle = getString(R.string.home); + toggerContainer(R.id.next_button, View.GONE); + toggerContainer(R.id.prev_button, View.GONE); break; case NavigationOptions.ServiceList: singleTab(); fragmentManager.beginTransaction() - .replace(R.id.container, ServiceListFragment.newInstance()) + .replace(R.id.container, ServiceListFragment.newInstance(), "servicelist") .commit(); mTitle = getString(R.string.service_list); + toggerContainer(R.id.next_button, View.VISIBLE); + toggerContainer(R.id.prev_button, View.VISIBLE); break; case NavigationOptions.LiveList: duelTab(); fragmentManager.beginTransaction() - .replace(R.id.container_left, ServiceListFragment.newInstance()) + .replace(R.id.container_left, ServiceListFragment.newInstance(), "servicelist") .commit(); fragmentManager.beginTransaction() .replace(R.id.container_right, LiveListFragment.newInstance()) .commit(); mTitle = getString(R.string.live_list); + toggerContainer(R.id.next_button, View.VISIBLE); + toggerContainer(R.id.prev_button, View.VISIBLE); break; case NavigationOptions.StageView: singleTab(); @@ -145,6 +151,8 @@ public class OpenLP extends ActionBarActivity .replace(R.id.container, StageWebFragment.newInstance()) .commit(); mTitle = getString(R.string.stage_view); + toggerContainer(R.id.next_button, View.GONE); + toggerContainer(R.id.prev_button, View.GONE); break; case NavigationOptions.LiveView: singleTab(); @@ -152,6 +160,8 @@ public class OpenLP extends ActionBarActivity .replace(R.id.container, LiveWebFragment.newInstance()) .commit(); mTitle = getString(R.string.live_view); + toggerContainer(R.id.next_button, View.GONE); + toggerContainer(R.id.prev_button, View.GONE); break; } } @@ -256,4 +266,14 @@ public class OpenLP extends ActionBarActivity fragment.refreshDisplay(); } } + + public void next(View view) { + ServiceListFragment serviceListFragment = (ServiceListFragment) getFragmentManager().findFragmentByTag("servicelist"); + serviceListFragment.next(); + } + + public void previous(View view) { + ServiceListFragment serviceListFragment = (ServiceListFragment) getFragmentManager().findFragmentByTag("servicelist"); + serviceListFragment.previous(); + } } diff --git a/app/src/main/java/org/openlp/android2/common/OpenLPFragment.java b/app/src/main/java/org/openlp/android2/common/OpenLPFragment.java index 3c2aa9d..6a6d769 100644 --- a/app/src/main/java/org/openlp/android2/common/OpenLPFragment.java +++ b/app/src/main/java/org/openlp/android2/common/OpenLPFragment.java @@ -30,6 +30,7 @@ import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.TextHttpResponseHandler; import org.apache.http.Header; import org.openlp.android2.R; +import org.openlp.android2.api.Api; abstract public class OpenLPFragment extends ListFragment{ @@ -83,4 +84,14 @@ abstract public class OpenLPFragment extends ListFragment{ processUpdate(response, notInError); } } + + public void next() { + Log.d(LOG_TAG, "Going to next slide"); + triggerTextRequest(Api.LIVE_NEXT); + } + + public void previous() { + Log.d(LOG_TAG, "Going to previous slide"); + triggerTextRequest(Api.LIVE_PREVIOUS); + } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 684abf0..a6e5246 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -32,7 +32,29 @@ android:layout_height="wrap_content" android:layout_marginLeft="5dp" /> + +