mirror of
https://gitlab.com/openlp/android.git
synced 2024-12-22 11:52:49 +00:00
Merge from A5
This commit is contained in:
parent
0c8f675589
commit
689c148c3f
@ -10,7 +10,7 @@ android {
|
|||||||
applicationId "org.openlp.android2"
|
applicationId "org.openlp.android2"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
versionCode 4
|
versionCode 5
|
||||||
versionName "2.0"
|
versionName "2.0"
|
||||||
}
|
}
|
||||||
android {
|
android {
|
||||||
|
@ -94,9 +94,9 @@ public class SearchFragment extends Fragment {
|
|||||||
(InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
(InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
String text = spinner.getSelectedItem().toString();
|
//String text = spinner.getSelectedItem().toString();
|
||||||
String text1 = v.getText().toString();
|
// String text1 = v.getText().toString();
|
||||||
Toast.makeText(context, "Search Called " + text + " " + text1, Toast.LENGTH_SHORT).show();
|
//Toast.makeText(context, "Search Called " + text + " " + text1, Toast.LENGTH_SHORT).show();
|
||||||
requestSearch(spinner.getSelectedItem().toString(), v.getText().toString());
|
requestSearch(spinner.getSelectedItem().toString(), v.getText().toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -163,6 +163,7 @@ public class SearchFragment extends Fragment {
|
|||||||
// called when response HTTP status is "200 OK"
|
// called when response HTTP status is "200 OK"
|
||||||
manageResponse(responseString, true);
|
manageResponse(responseString, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
|
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
|
||||||
// called when response HTTP status is "4XX" (eg. 401, 403, 404)
|
// called when response HTTP status is "4XX" (eg. 401, 403, 404)
|
||||||
@ -191,19 +192,14 @@ 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");
|
||||||
List<HashMap<String, String>> aList = new ArrayList<HashMap<String, String>>();
|
ListView list = (ListView)getActivity().findViewById(R.id.fragmentsearchresults);
|
||||||
|
final ArrayList<JSONArray> listitems = new ArrayList<JSONArray>();
|
||||||
if (notInError) {
|
if (notInError) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JSONArray items = new JSONObject(json).getJSONObject("results").getJSONArray("items");
|
JSONArray items = new JSONObject(json).getJSONObject("results").getJSONArray("items");
|
||||||
for (int i = 0; i < items.length(); ++i) {
|
for (int i = 0; i < items.length(); ++i) {
|
||||||
JSONArray item = items.getJSONArray(i);
|
JSONArray item = items.getJSONArray(i);
|
||||||
|
listitems.add(item);
|
||||||
HashMap<String, String> hm = new HashMap<String, String>();
|
|
||||||
//hm.put("tag", item.getString("tag"));
|
|
||||||
//hm.put("liveListNormal", Html.fromHtml(item.getString("html")).toString());
|
|
||||||
aList.add(hm);
|
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Log.e(LOG_TAG,json);
|
Log.e(LOG_TAG,json);
|
||||||
@ -211,41 +207,88 @@ public class SearchFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keys used in Hashmap
|
final StableArrayAdapter adapter = new StableArrayAdapter(context,
|
||||||
String[] from = {"tag", "liveListNormal", "liveListSelected"};
|
android.R.layout.simple_list_item_1, listitems);
|
||||||
|
list.setAdapter(adapter);
|
||||||
|
|
||||||
// Ids of views in live_list_fragment
|
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
int[] to = {R.id.tag, R.id.liveListNormal, R.id.liveListSelected};
|
|
||||||
|
|
||||||
|
|
||||||
ListView list = (ListView)getActivity().findViewById(R.id.searchresultsdetails);
|
|
||||||
int a = 1;
|
|
||||||
|
|
||||||
/* ArrayAdapter<String> LTRadapter = new ArrayAdapter<String>(getActivity(),
|
|
||||||
R.layout.spinner_list_item, categories);
|
|
||||||
|
|
||||||
// Instantiating an adapter to store each items
|
|
||||||
ListAdapter adapter = new SimpleAdapter(getActivity().getBaseContext(), aList,
|
|
||||||
R.layout.fragment_s, from, to) {
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
View view = super.getView(position, convertView, parent);
|
|
||||||
TextView text1 = (TextView) view.findViewById(R.id.tag);
|
|
||||||
text1.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
|
|
||||||
TextView text2 = (TextView) view.findViewById(R.id.liveListNormal);
|
|
||||||
text2.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
|
|
||||||
if (selected == position) {
|
|
||||||
text2.setTextColor(Color.parseColor("#000000"));
|
|
||||||
text2.setTypeface(null, Typeface.BOLD_ITALIC);
|
|
||||||
} else{
|
|
||||||
text2.setTypeface(null, Typeface.NORMAL);
|
|
||||||
}
|
|
||||||
return view;
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, final View view,
|
||||||
|
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)
|
||||||
|
.withEndAction(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
list.remove(item);
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
view.setAlpha(1);
|
||||||
|
}
|
||||||
|
});*/
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
setListAdapter(adapter);*/
|
|
||||||
|
|
||||||
Log.i(LOG_TAG, "populateListDisplay - exit");
|
Log.i(LOG_TAG, "populateListDisplay - exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class StableArrayAdapter extends ArrayAdapter<JSONArray> {
|
||||||
|
|
||||||
|
HashMap<String, Integer> mIdMap = new HashMap<String, Integer>();
|
||||||
|
|
||||||
|
public StableArrayAdapter(Context context, int textViewResourceId,
|
||||||
|
List<JSONArray> objects) {
|
||||||
|
super(context, textViewResourceId, objects);
|
||||||
|
for (int i = 0; i < objects.size(); ++i) {
|
||||||
|
JSONArray item = objects.get(i);
|
||||||
|
try {
|
||||||
|
mIdMap.put(item.get(1).toString(), Integer.valueOf(item.get(0).toString()));
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
// Get the data item for this position
|
||||||
|
//User user = getItem(position);
|
||||||
|
String item = null;
|
||||||
|
try {
|
||||||
|
item = getItem(position).get(1).toString();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
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);
|
||||||
|
//}
|
||||||
|
// Lookup view for data population
|
||||||
|
//TextView tvHome = (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);
|
||||||
|
// Return the completed view to render on screen
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
String item = null;
|
||||||
|
try {
|
||||||
|
item = getItem(position).get(1).toString();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return mIdMap.get(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasStableIds() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,22 +7,26 @@
|
|||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:weightSum="1">
|
android:weightSum="1">
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="294dp"
|
android:layout_width="315dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:text="@string/display_blank_summary"
|
android:text="@string/display_blank_summary"
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
android:textStyle="bold|italic"
|
android:textStyle="bold|italic"
|
||||||
android:textSize="40px"
|
android:textSize="40px"
|
||||||
android:height="45px"/>
|
android:height="70px"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp"/>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/display_reset"
|
android:text="@string/display_reset"
|
||||||
android:id="@+id/buttonReset"
|
android:id="@+id/buttonReset"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:height="40dp"
|
android:height="30dp"
|
||||||
android:clickable="true"/>
|
android:clickable="true"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="20dp"/>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -30,7 +34,9 @@
|
|||||||
android:id="@+id/buttonScreen"
|
android:id="@+id/buttonScreen"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:height="40dp"
|
android:height="40dp"
|
||||||
android:clickable="true"/>
|
android:clickable="true"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="20dp"/>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -38,7 +44,9 @@
|
|||||||
android:id="@+id/buttonTheme"
|
android:id="@+id/buttonTheme"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:height="40dp"
|
android:height="40dp"
|
||||||
android:clickable="true"/>
|
android:clickable="true"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="20dp"/>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -46,5 +54,7 @@
|
|||||||
android:id="@+id/buttonDesktop"
|
android:id="@+id/buttonDesktop"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:height="40dp"
|
android:height="40dp"
|
||||||
android:clickable="true"/>
|
android:clickable="true"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="20dp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -69,7 +69,7 @@
|
|||||||
android:id="@+id/fragmentsearchresults"
|
android:id="@+id/fragmentsearchresults"
|
||||||
android:weightSum="1">
|
android:weightSum="1">
|
||||||
|
|
||||||
<ListView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="333dp"
|
android:layout_height="333dp"
|
||||||
android:id="@+id/searchresultsdetails" />
|
android:id="@+id/searchresultsdetails" />
|
||||||
|
Loading…
Reference in New Issue
Block a user