1
0
mirror of https://gitlab.com/openlp/android.git synced 2024-10-31 16:54:41 +00:00

Search finished

This commit is contained in:
Tim Bentley 2016-10-25 20:38:52 +01:00
parent 8439408875
commit a905a94e49
10 changed files with 10 additions and 67 deletions

View File

@ -144,7 +144,7 @@ public class OpenLP extends ActionBarActivity
.replace(R.id.container_left, ServiceListFragment.newInstance(), "servicelist") .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(), "livelist")
.commit(); .commit();
mTitle = getString(R.string.live_list); mTitle = getString(R.string.live_list);
toggerContainer(R.id.next_button, View.VISIBLE); toggerContainer(R.id.next_button, View.VISIBLE);

View File

@ -18,6 +18,8 @@
*******************************************************************************/ *******************************************************************************/
package org.openlp.android2.common; package org.openlp.android2.common;
import android.util.Log;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.json.JSONStringer; import org.json.JSONStringer;
@ -37,6 +39,7 @@ public class JsonHelpers {
responseJSON = new JSONStringer().object().key("request").value(jo) responseJSON = new JSONStringer().object().key("request").value(jo)
.endObject().toString(); .endObject().toString();
responseJSON = URLEncoder.encode(responseJSON, "UTF-8"); responseJSON = URLEncoder.encode(responseJSON, "UTF-8");
Log.d(LOG_TAG, String.format("createRequestJSON: %s : %s : %s", key, value, responseJSON));
return responseJSON; return responseJSON;
} catch (JSONException e) { } catch (JSONException e) {
throw new JSONHandlerException(e); throw new JSONHandlerException(e);

View File

@ -56,6 +56,8 @@ public class SearchSelectionDialog extends OpenLPDialog {
plugin = getArguments().getString("plugin"); plugin = getArguments().getString("plugin");
text = getArguments().getString("text"); text = getArguments().getString("text");
Log.d(LOG_TAG, String.format("onCreateDialog %s : %s : %s", key, plugin, text));
context = getActivity(); context = getActivity();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
@ -121,7 +123,7 @@ public class SearchSelectionDialog extends OpenLPDialog {
public void createService() { public void createService() {
try { try {
String request = JsonHelpers.createRequestJSON("id", key); String request = JsonHelpers.createRequestJSON("id", text);
String url = String.format(Api.SEARCH_PLUGIN_ADD, plugin.toLowerCase()); String url = String.format(Api.SEARCH_PLUGIN_ADD, plugin.toLowerCase());
triggerTextRequest(String.format("%s%s", url, request)); triggerTextRequest(String.format("%s%s", url, request));
Log.d(LOG_TAG, String.format("Setting list data. apiBase(%s), text(%s)", Api.SEARCH_PLUGIN_ADD, text)); Log.d(LOG_TAG, String.format("Setting list data. apiBase(%s), text(%s)", Api.SEARCH_PLUGIN_ADD, text));

View File

@ -128,10 +128,9 @@ public class LiveListFragment extends OpenLPFragment {
text1.setTextSize(TypedValue.COMPLEX_UNIT_SP, size); text1.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
TextView text2 = (TextView) view.findViewById(R.id.liveListNormal); TextView text2 = (TextView) view.findViewById(R.id.liveListNormal);
text2.setTextSize(TypedValue.COMPLEX_UNIT_SP, size); text2.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
Log.i(LOG_TAG, "aaa " + selected +" "+ position);
if (selected == position) { if (selected == position) {
text2.setTypeface(null, Typeface.BOLD_ITALIC); text2.setTypeface(null, Typeface.BOLD_ITALIC);
line.setBackgroundColor(0xffffff);
} else{ } else{
text2.setTypeface(null, Typeface.NORMAL); text2.setTypeface(null, Typeface.NORMAL);
line.setBackgroundColor(0xffffff); line.setBackgroundColor(0xffffff);

View File

@ -163,11 +163,10 @@ public class ServiceListFragment extends OpenLPFragment {
TextView line = (TextView) view.findViewById(R.id.servicelistLine); TextView line = (TextView) view.findViewById(R.id.servicelistLine);
TextView text1 = (TextView) view.findViewById(R.id.serviceListText); TextView text1 = (TextView) view.findViewById(R.id.serviceListText);
text1.setTextSize(TypedValue.COMPLEX_UNIT_SP, size); text1.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
Log.i(LOG_TAG, "bbb " + selected +" "+ position);
if (selected == position) { if (selected == position) {
text1.setTextColor(Color.parseColor("#000000")); text1.setTextColor(Color.parseColor("#000000"));
text1.setTypeface(null, Typeface.BOLD_ITALIC); text1.setTypeface(null, Typeface.BOLD_ITALIC);
line.setBackgroundColor(0xffffff);
} else{ } else{
text1.setTypeface(null, Typeface.NORMAL); text1.setTypeface(null, Typeface.NORMAL);
line.setBackgroundColor(0xffffff); line.setBackgroundColor(0xffffff);

View File

@ -4,7 +4,7 @@
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity"> tools:context=".OpenLP">
<!-- As the main content view, the view below consumes the entire <!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. --> space available using match_parent in both dimensions. -->

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" tools:context="org.openlp.android2.emptyFragment">
<GridView android:id="@android:id/list" android:layout_width="match_parent"
android:layout_height="match_parent" android:numColumns="2" />
<TextView android:id="@android:id/empty" android:layout_width="match_parent"
android:layout_height="match_parent" android:gravity="center" />
</FrameLayout>

View File

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.openlp.android2.fragments.LiveListFragment">
<GridView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="2" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_live_list_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:smoothScrollbar="true"
android:clickable="false"
android:longClickable="false">
<TextView
android:id="@+id/tag"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:paddingTop="10dp"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:paddingBottom="10dp"
android:layout_weight="1"/>
<TextView
android:id="@+id/liveListNormal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#ff2a2a2a"
android:textSize="14sp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:textStyle="normal"
android:layout_weight="1"/>
</LinearLayout>
</FrameLayout>

View File

@ -7,6 +7,5 @@
For more on layout aliases, see: For more on layout aliases, see:
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
--> -->
<item name="fragment_item" type="layout">@layout/fragment_item_grid</item>
</resources> </resources>

View File

@ -7,6 +7,4 @@
For more on layout aliases, see: For more on layout aliases, see:
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
--> -->
<item name="fragment_item" type="layout">@layout/fragment_item_grid</item>
</resources> </resources>