From f10f016f5319e6db0d96d56b63e9cc3769717ffc Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 3 Jan 2016 09:02:57 +0000 Subject: [PATCH] Search UI --- .../android2/fragments/SearchFragment.java | 24 +-- app/src/main/res/layout/fragment_search.xml | 150 ++++++++++-------- 2 files changed, 92 insertions(+), 82 deletions(-) diff --git a/app/src/main/java/org/openlp/android2/fragments/SearchFragment.java b/app/src/main/java/org/openlp/android2/fragments/SearchFragment.java index 018c766..b75b167 100644 --- a/app/src/main/java/org/openlp/android2/fragments/SearchFragment.java +++ b/app/src/main/java/org/openlp/android2/fragments/SearchFragment.java @@ -192,7 +192,7 @@ public class SearchFragment extends Fragment { public void populateListDisplay(String json, boolean notInError) { Log.i(LOG_TAG, "populateListDisplay - entry"); - ListView list = (ListView)getActivity().findViewById(R.id.fragmentsearchresults); + ListView list = (ListView)getActivity().findViewById(R.id.searchlistView); final ArrayList listitems = new ArrayList(); if (notInError) { try { @@ -208,9 +208,10 @@ public class SearchFragment extends Fragment { } final StableArrayAdapter adapter = new StableArrayAdapter(context, - android.R.layout.simple_list_item_1, listitems); - list.setAdapter(adapter); + android.R.layout.simple_list_item_1, listitems); + list.setAdapter(adapter); +/* list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override @@ -218,7 +219,7 @@ public class SearchFragment extends Fragment { int position, long id) { final String item = (String) parent.getItemAtPosition(position); 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() { @Override public void run() { @@ -226,9 +227,9 @@ public class SearchFragment extends Fragment { adapter.notifyDataSetChanged(); view.setAlpha(1); } - });*/ + }); } - }); + }); */ Log.i(LOG_TAG, "populateListDisplay - exit"); } @@ -261,14 +262,13 @@ public class SearchFragment extends Fragment { e.printStackTrace(); } // Check if an existing view is being reused, otherwise inflate the view - //if (convertView == null) { - // convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_user, parent, false); - //} + if (convertView == null) { + convertView = LayoutInflater.from(getContext()).inflate(R.layout.search_result, parent, false); + } // 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 - //tvName.setText(user.name); - //tvHome.setText(user.hometown); + //tvItem.setText(item); // Return the completed view to render on screen return convertView; } diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index 98a6f32..587b649 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -1,80 +1,90 @@ - - + android:paddingLeft="15dp" + android:paddingTop="15dp" + android:paddingRight="15dp" + > + android:layout_height="wrap_content"> - + - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + \ No newline at end of file