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())
.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();
}
}

View File

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

View File

@ -32,7 +32,29 @@
android:layout_height="wrap_content"
android:layout_marginLeft="5dp" />
</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
this as a sliding drawer on the left side for left-to-right
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="display_blank_summary">Select the required display</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_settings">Display Setting</string>
<string name="display_screen">Display Black only</string>
@ -42,8 +42,10 @@
<string name="live_view">Live View</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="next">Next</string>
<string name="none">None</string>
<string name="port">Port</string>
<string name="previous">Previous</string>
<string name="process">Process</string>
<string name="service_list">Service List</string>
<string name="stage_view">Stage View</string>
@ -52,4 +54,7 @@
<string name="title_activity_settings">Settings</string>
<string name="url_hint">Hostname or IP</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>