Start Search

This commit is contained in:
Tim Bentley 2015-10-18 19:43:08 +01:00
parent 11828d047e
commit 0bdb67e780
7 changed files with 168 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="OpenLP2" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="OpenLP2_search" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
@ -87,6 +87,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />

View File

@ -42,6 +42,7 @@ import org.openlp.android2.fragments.HomeFragment;
import org.openlp.android2.fragments.LiveListFragment;
import org.openlp.android2.fragments.LiveWebFragment;
import org.openlp.android2.fragments.NavigationDrawerFragment;
import org.openlp.android2.fragments.SearchFragment;
import org.openlp.android2.fragments.ServiceListFragment;
import org.openlp.android2.fragments.StageWebFragment;
@ -163,6 +164,15 @@ public class OpenLP extends ActionBarActivity
toggerContainer(R.id.next_button, View.GONE);
toggerContainer(R.id.prev_button, View.GONE);
break;
case NavigationOptions.Search:
singleTab();
fragmentManager.beginTransaction()
.replace(R.id.container, SearchFragment.newInstance())
.commit();
mTitle = getString(R.string.action_search);
toggerContainer(R.id.next_button, View.GONE);
toggerContainer(R.id.prev_button, View.GONE);
break;
}
}

View File

@ -24,4 +24,5 @@ public class NavigationOptions{
public final static int LiveList = 2;
public final static int StageView = 3;
public final static int LiveView = 4;
public final static int Search = 5;
}

View File

@ -152,6 +152,11 @@ public class NavigationDrawerFragment extends Fragment {
hm4.put("icon", Integer.toString(R.drawable.ic_ondemand_video_black));
aList.add(hm4);
HashMap<String, String> hm5 = new HashMap<String, String>();
hm4.put("title", getString(R.string.action_search));
hm4.put("icon", Integer.toString(R.drawable.ic_ondemand_video_black));
aList.add(hm5);
// Keys used in Hashmap
String[] from = {"icon", "title"};

View File

@ -0,0 +1,87 @@
package org.openlp.android2.fragments;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.openlp.android2.R;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link SearchFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link SearchFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SearchFragment extends Fragment {
private OnFragmentInteractionListener mListener;
public SearchFragment() {
// Required empty public constructor
}
public static SearchFragment newInstance() {
SearchFragment fragment = new SearchFragment();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_search, container, false);
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (OnFragmentInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
public void onFragmentInteraction(Uri uri);
}
}

View File

@ -0,0 +1,51 @@
<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.SearchFragment">
<!-- TODO: Update blank fragment layout -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal|top">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<Spinner
android:layout_width="288dp"
android:layout_height="wrap_content"
android:id="@+id/serach_spinner"
android:layout_weight="0.58" />
<SearchView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/searchView"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<TextView
android:id="@+id/SearchResultsList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="14sp"
android:paddingTop="10dp"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:paddingEnd="5dp"
android:paddingBottom="10dp" />
</LinearLayout>
</FrameLayout>

View File

@ -36,7 +36,7 @@
<string name="enable_custom_timeouts">Enable Custom Timeouts</string>
<string name="enter_alert_text">Enter Alert Text</string>
<string name="enable_autoscroll">Allow displays to auto center</string>
<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="live_list">Live List</string>
<string name="live_view">Live View</string>
@ -45,6 +45,14 @@
<string name="next">Next</string>
<string name="none">None</string>
<string name="port">Port</string>
<string-array name="plugins_array">
<item>Songs</item>
<item>Bibles</item>
<item>Presentations</item>
<item>Images</item>
<item>Media</item>
<item>Custom</item>
</string-array>
<string name="previous">Previous</string>
<string name="process">Process</string>
<string name="service_list">Service List</string>
@ -54,4 +62,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>