search fixes

This commit is contained in:
Tim Bentley 2016-10-19 19:41:22 +01:00
parent 39cb07860d
commit 8efc0e69df
5 changed files with 27 additions and 12 deletions

View File

@ -6,7 +6,7 @@ android {
defaultConfig {
applicationId "org.openlp.android2"
minSdkVersion 15
minSdkVersion 16
targetSdkVersion 22
versionCode 5
versionName "2.0"

View File

@ -77,7 +77,6 @@ public class SearchFragment extends Fragment {
protected String updateUrl;
protected String searchedPlugin;
protected Map<String, String> pluginMap = new HashMap<String, String>();
protected ArrayList<JSONArray> jsonCache = new ArrayList<JSONArray>();
public SearchFragment() {
Log.d(LOG_TAG, "Constructor");
@ -248,11 +247,10 @@ public class SearchFragment extends Fragment {
}
}
jsonCache = new ArrayList<JSONArray>();
final StableArrayAdapter adapter = new StableArrayAdapter(context,
android.R.layout.simple_list_item_1,
listitems,
jsonCache);
listitems);
list.setAdapter(adapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@ -273,9 +271,9 @@ public class SearchFragment extends Fragment {
args.putString("plugin", searchedPlugin);
args.putString("text", it);
args.putString("key", Long.toString(id));
DialogFragment newFragment = new SearchSelectionDialog();
newFragment.setArguments(args);
newFragment.show(getFragmentManager(), "TAG");
DialogFragment SSDFragment = new SearchSelectionDialog();
SSDFragment.setArguments(args);
SSDFragment.show(getFragmentManager(), "TAG");
}
});
@ -285,12 +283,13 @@ public class SearchFragment extends Fragment {
private class StableArrayAdapter extends ArrayAdapter<JSONArray> {
HashMap<String, Integer> mIdMap = new HashMap<String, Integer>();
ArrayList<JSONArray> jsonCache = new ArrayList<JSONArray>();
public StableArrayAdapter(Context context,
int textViewResourceId,
List<JSONArray> objects,
ArrayList<JSONArray> jsonCache) {
List<JSONArray> objects) {
super(context, textViewResourceId, objects);
jsonCache = new ArrayList<JSONArray>();
for (int i = 0; i < objects.size(); ++i) {
JSONArray item = objects.get(i);
@ -310,6 +309,7 @@ public class SearchFragment extends Fragment {
String item = null;
try {
item = getItem(position).get(1).toString();
Log.i(LOG_TAG, "getView" + item);
} catch (JSONException e) {
e.printStackTrace();
}
@ -331,6 +331,7 @@ public class SearchFragment extends Fragment {
String item = null;
try {
item = getItem(position).get(1).toString();
Log.i(LOG_TAG, "getItemId" + item);
} catch (JSONException e) {
e.printStackTrace();
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90">
<shape
android:shape="line"
android:left="1dp">
<stroke
android:width="2dp"
android:color="#0008ff"
android:dashWidth="1dp"
android:dashGap="2dp" />
</shape>
</rotate>

View File

@ -24,7 +24,7 @@
android:id="@+id/serviceListText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textStyle="normal"
android:textColor="#000000"
android:textSize="14sp"
android:paddingTop="10dp"

View File

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files