adapter = new SearchArrayAdapter(getApplicationContext(),
R.layout.search_result_item, recordList);
- //searchOptionsMenu = findViewById(R.id.search_preference_options);
searchClassSpinner = (Spinner) findViewById(R.id.search_qtype_spinner);
searchFormatSpinner = (Spinner) findViewById(R.id.search_format_spinner);
searchResultsNumber = (TextView) findViewById(R.id.search_result_number);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(searchText.getWindowToken(), 0);
- //searchOptionsMenu.setVisibility(View.GONE);
searchResultsNumber.setVisibility(View.VISIBLE);
progressDialog = ProgressDialog.show(
searchThreadwithOffset.start();
} else {
- // start activity with book details
-
Intent intent = new Intent(getBaseContext(), SampleUnderlinesNoFade.class);
- // serialize object and pass it to next activity
intent.putExtra("recordInfo", info);
intent.putExtra("orgID", search.selectedOrganization.id);
intent.putExtra("depth", search.selectedOrganization.level);
int visibleItemCount, int totalItemCount) {
if (!loadingElements) {
-
- /*
- Log.d(TAG, " Scroll adapter " + totalItemCount + " "
- + visibleItemCount + " " + firstVisibleItem + " "
- + adapter.getCount() + " " + search.visible);
- */
if (totalItemCount > 0
&& (((totalItemCount - visibleItemCount) <= (firstVisibleItem)) && adapter
.getCount() < search.visible)) {
import org.evergreen_ils.net.VolleyWrangler;
import org.json.JSONArray;
import org.json.JSONObject;
-import org.opensrf.util.JSONException;
-import org.opensrf.util.JSONReader;
+import org.opensrf.util.GatewayResponse;
-import java.util.List;
-import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
assertNotNull(version);
}
- public class OSRFResponse {
- List<Object> responseList = null;
- public Map<String, ?> map = null;
- public Exception ex = null;
- private OSRFResponse() {
- }
- public void parse(String json) {
- try {
- map = (Map<String, ?>) new JSONReader(json).readObject();
- responseList = (List<Object>) map.get("payload");
- } catch (JSONException e) {
- ex = e;
- }
- }
- }
-
public void testVolley_osrf() throws Exception {
String url = "http://bark.cwmars.org/osrf-gateway-v1?service=open-ils.actor&method=opensrf.open-ils.system.ils_version";
StringRequest request = new StringRequest(Request.Method.GET, url,
assertNotNull(mStringResponse);
- OSRFResponse response = new OSRFResponse();
- response.parse(mStringResponse);
+ GatewayResponse response = GatewayResponse.create(mStringResponse);
+
assertNull(response.ex);
assertNotNull(response.map);
--- /dev/null
+package org.opensrf.util;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by kenstir on 12/5/2015.
+ */
+public class GatewayResponse {
+ public List<Object> responseList = null;
+ public Map<String, ?> map = null;
+ public Exception ex = null;
+
+ private GatewayResponse() {
+ }
+
+ public static GatewayResponse create(String json) {
+ GatewayResponse resp = new GatewayResponse();
+ try {
+ resp.map = (Map<String, ?>) new JSONReader(json).readObject();
+ resp.responseList = (List<Object>) resp.map.get("payload");
+ } catch (JSONException e) {
+ resp.ex = e;
+ }
+ return resp;
+ }
+}