1
0
mirror of https://gitlab.com/openlp/android.git synced 2024-12-22 11:52:49 +00:00

Added next/prev buttons to service list and live list.

This commit is contained in:
Tomas Groth 2015-10-06 23:40:40 +01:00
parent aea3b07f78
commit 18bd1f5bd6
4 changed files with 62 additions and 4 deletions

View File

@ -121,23 +121,29 @@ public class OpenLP extends ActionBarActivity
.replace(R.id.container, HomeFragment.newInstance()) .replace(R.id.container, HomeFragment.newInstance())
.commit(); .commit();
mTitle = getString(R.string.home); mTitle = getString(R.string.home);
toggerContainer(R.id.next_button, View.GONE);
toggerContainer(R.id.prev_button, View.GONE);
break; break;
case NavigationOptions.ServiceList: case NavigationOptions.ServiceList:
singleTab(); singleTab();
fragmentManager.beginTransaction() fragmentManager.beginTransaction()
.replace(R.id.container, ServiceListFragment.newInstance()) .replace(R.id.container, ServiceListFragment.newInstance(), "servicelist")
.commit(); .commit();
mTitle = getString(R.string.service_list); mTitle = getString(R.string.service_list);
toggerContainer(R.id.next_button, View.VISIBLE);
toggerContainer(R.id.prev_button, View.VISIBLE);
break; break;
case NavigationOptions.LiveList: case NavigationOptions.LiveList:
duelTab(); duelTab();
fragmentManager.beginTransaction() fragmentManager.beginTransaction()
.replace(R.id.container_left, ServiceListFragment.newInstance()) .replace(R.id.container_left, ServiceListFragment.newInstance(), "servicelist")
.commit(); .commit();
fragmentManager.beginTransaction() fragmentManager.beginTransaction()
.replace(R.id.container_right, LiveListFragment.newInstance()) .replace(R.id.container_right, LiveListFragment.newInstance())
.commit(); .commit();
mTitle = getString(R.string.live_list); mTitle = getString(R.string.live_list);
toggerContainer(R.id.next_button, View.VISIBLE);
toggerContainer(R.id.prev_button, View.VISIBLE);
break; break;
case NavigationOptions.StageView: case NavigationOptions.StageView:
singleTab(); singleTab();
@ -145,6 +151,8 @@ public class OpenLP extends ActionBarActivity
.replace(R.id.container, StageWebFragment.newInstance()) .replace(R.id.container, StageWebFragment.newInstance())
.commit(); .commit();
mTitle = getString(R.string.stage_view); mTitle = getString(R.string.stage_view);
toggerContainer(R.id.next_button, View.GONE);
toggerContainer(R.id.prev_button, View.GONE);
break; break;
case NavigationOptions.LiveView: case NavigationOptions.LiveView:
singleTab(); singleTab();
@ -152,6 +160,8 @@ public class OpenLP extends ActionBarActivity
.replace(R.id.container, LiveWebFragment.newInstance()) .replace(R.id.container, LiveWebFragment.newInstance())
.commit(); .commit();
mTitle = getString(R.string.live_view); mTitle = getString(R.string.live_view);
toggerContainer(R.id.next_button, View.GONE);
toggerContainer(R.id.prev_button, View.GONE);
break; break;
} }
} }
@ -256,4 +266,14 @@ public class OpenLP extends ActionBarActivity
fragment.refreshDisplay(); 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();
}
} }

View File

@ -30,6 +30,7 @@ import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.TextHttpResponseHandler; import com.loopj.android.http.TextHttpResponseHandler;
import org.apache.http.Header; import org.apache.http.Header;
import org.openlp.android2.R; import org.openlp.android2.R;
import org.openlp.android2.api.Api;
abstract public class OpenLPFragment extends ListFragment{ abstract public class OpenLPFragment extends ListFragment{
@ -83,4 +84,14 @@ abstract public class OpenLPFragment extends ListFragment{
processUpdate(response, notInError); 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);
}
} }

View File

@ -32,7 +32,29 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dp" /> android:layout_marginLeft="5dp" />
</LinearLayout> </LinearLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:text="@string/next"
android:onClick="next"
android:visibility="gone" />
<Button
android:id="@+id/prev_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:text="@string/previous"
android:onClick="previous"
android:visibility="gone" />
</FrameLayout>
<!-- android:layout_gravity="start" tells DrawerLayout to treat <!-- android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right this as a sliding drawer on the left side for left-to-right
languages and on the right side for right-to-left languages. languages and on the right side for right-to-left languages.

View File

@ -28,7 +28,7 @@
<string name="custom_timeout">Set Custom Timeout</string> <string name="custom_timeout">Set Custom Timeout</string>
<string name="display_blank_summary">Select the required display</string> <string name="display_blank_summary">Select the required display</string>
<string name="display_desktop">Display Desktop background</string> <string name="display_desktop">Display Desktop background</string>
<string name="display_list_autoscroll">Allow the selected item to sctoll to the centre of the list</string> <string name="display_list_autoscroll">Allow the selected item to scroll to the centre of the list</string>
<string name="display_reset">Show Live display</string> <string name="display_reset">Show Live display</string>
<string name="display_settings">Display Setting</string> <string name="display_settings">Display Setting</string>
<string name="display_screen">Display Black only</string> <string name="display_screen">Display Black only</string>
@ -39,11 +39,13 @@
<string name="home">Home</string> <string name="home">Home</string>
<string name="httpreturn_unauthorised">Unauthorised Access, please enter valid username and password</string> <string name="httpreturn_unauthorised">Unauthorised Access, please enter valid username and password</string>
<string name="live_list">Live List</string> <string name="live_list">Live List</string>
<string name="live_view">LiveView</string> <string name="live_view">Live View</string>
<string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string>
<string name="next">Next</string>
<string name="none">None</string> <string name="none">None</string>
<string name="port">Port</string> <string name="port">Port</string>
<string name="previous">Previous</string>
<string name="process">Process</string> <string name="process">Process</string>
<string name="service_list">Service List</string> <string name="service_list">Service List</string>
<string name="stage_view">Stage View</string> <string name="stage_view">Stage View</string>
@ -52,4 +54,7 @@
<string name="title_activity_settings">Settings</string> <string name="title_activity_settings">Settings</string>
<string name="url_hint">Hostname or IP</string> <string name="url_hint">Hostname or IP</string>
<string name="unable">Unable to process request - check network settings</string> <string name="unable">Unable to process request - check network settings</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources> </resources>