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

Search UI

This commit is contained in:
Tim Bentley 2016-01-03 09:02:57 +00:00
parent 689c148c3f
commit f10f016f53
2 changed files with 92 additions and 82 deletions

View File

@ -192,7 +192,7 @@ public class SearchFragment extends Fragment {
public void populateListDisplay(String json, boolean notInError) { public void populateListDisplay(String json, boolean notInError) {
Log.i(LOG_TAG, "populateListDisplay - entry"); Log.i(LOG_TAG, "populateListDisplay - entry");
ListView list = (ListView)getActivity().findViewById(R.id.fragmentsearchresults); ListView list = (ListView)getActivity().findViewById(R.id.searchlistView);
final ArrayList<JSONArray> listitems = new ArrayList<JSONArray>(); final ArrayList<JSONArray> listitems = new ArrayList<JSONArray>();
if (notInError) { if (notInError) {
try { try {
@ -208,9 +208,10 @@ public class SearchFragment extends Fragment {
} }
final StableArrayAdapter adapter = new StableArrayAdapter(context, final StableArrayAdapter adapter = new StableArrayAdapter(context,
android.R.layout.simple_list_item_1, listitems); android.R.layout.simple_list_item_1, listitems);
list.setAdapter(adapter);
list.setAdapter(adapter);
/*
list.setOnItemClickListener(new AdapterView.OnItemClickListener() { list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
@ -218,7 +219,7 @@ public class SearchFragment extends Fragment {
int position, long id) { int position, long id) {
final String item = (String) parent.getItemAtPosition(position); final String item = (String) parent.getItemAtPosition(position);
Toast.makeText(context, "Item Pressed " + String.valueOf(position), Toast.LENGTH_SHORT).show(); Toast.makeText(context, "Item Pressed " + String.valueOf(position), Toast.LENGTH_SHORT).show();
/* view.animate().setDuration(2000).alpha(0) view.animate().setDuration(2000).alpha(0)
.withEndAction(new Runnable() { .withEndAction(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -226,9 +227,9 @@ public class SearchFragment extends Fragment {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
view.setAlpha(1); view.setAlpha(1);
} }
});*/ });
} }
}); }); */
Log.i(LOG_TAG, "populateListDisplay - exit"); Log.i(LOG_TAG, "populateListDisplay - exit");
} }
@ -261,14 +262,13 @@ public class SearchFragment extends Fragment {
e.printStackTrace(); e.printStackTrace();
} }
// Check if an existing view is being reused, otherwise inflate the view // Check if an existing view is being reused, otherwise inflate the view
//if (convertView == null) { if (convertView == null) {
// convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_user, parent, false); convertView = LayoutInflater.from(getContext()).inflate(R.layout.search_result, parent, false);
//} }
// Lookup view for data population // Lookup view for data population
//TextView tvHome = (TextView) convertView.findViewById(R.id.searchresultsdetails); //TextView tvItem = (TextView) convertView.findViewById(R.id.searchresultsdetails);
// Populate the data into the template view using the data object // Populate the data into the template view using the data object
//tvName.setText(user.name); //tvItem.setText(item);
//tvHome.setText(user.hometown);
// Return the completed view to render on screen // Return the completed view to render on screen
return convertView; return convertView;
} }

View File

@ -1,80 +1,90 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout android:orientation="vertical" android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/fragmentsearchlist"
android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_horizontal|top" android:paddingLeft="15dp"
android:weightSum="1" android:paddingTop="15dp"
android:paddingLeft="15dp"> android:paddingRight="15dp"
>
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="vertical"
android:id="@+id/fragmentsearchdetails"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:weightSum="1">
<TextView <LinearLayout
android:layout_width="wrap_content" android:orientation="horizontal"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:text="Select Plugin" android:layout_height="match_parent">
android:id="@+id/search_title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:paddingLeft="30dp"
android:paddingRight="30dp"/>
<Spinner <TextView
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/search_spinner" android:text="Select Plugin"
android:layout_weight="0.4" android:id="@+id/search_title"
android:textAppearance="?android:attr/textAppearanceLarge"/> android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="40px"
android:height="70px"
android:paddingLeft="30dp"
android:paddingRight="30dp"/>
<Spinner
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/search_spinner"
android:layout_weight="0.4"
android:textAppearance="?android:attr/textAppearanceLarge"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Search Text"
android:textSize="40px"
android:height="70px"
android:id="@+id/search_value_desc"
android:paddingLeft="30dp"
android:paddingRight="30dp"/>
<EditText
android:imeOptions="actionSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/search_text"
style="@android:style/Animation.InputMethod"
android:layout_weight="0.87"
android:inputType="text"
android:textSize="40px"
android:height="70px"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<ListView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/searchlistView"
android:textAppearance="?android:attr/textAppearanceLarge"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:textSize="40px"
android:height="70px"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:id="@+id/fragmentsearchvalue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Search Text"
android:id="@+id/search_value_desc"
android:paddingLeft="30dp"
android:paddingRight="30dp"/>
<EditText
android:imeOptions="actionSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/search_text"
style="@android:style/Animation.InputMethod"
android:layout_weight="0.87"
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragmentsearchresults"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="333dp"
android:id="@+id/searchresultsdetails" />
</LinearLayout>
</LinearLayout> </LinearLayout>