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

View File

@ -1,80 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/fragmentsearchlist"
android:layout_width="match_parent"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal|top"
android:weightSum="1"
android:paddingLeft="15dp">
android:paddingLeft="15dp"
android:paddingTop="15dp"
android:paddingRight="15dp"
>
<LinearLayout
android:orientation="horizontal"
android:id="@+id/fragmentsearchdetails"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1">
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Plugin"
android:id="@+id/search_title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:paddingLeft="30dp"
android:paddingRight="30dp"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<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"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Plugin"
android:id="@+id/search_title"
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
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>