little bit better now
authorkenstir <kenstir@gmail.com>
Sun, 6 Dec 2015 04:57:21 +0000 (23:57 -0500)
committerkenstir <kenstir@gmail.com>
Sun, 6 Dec 2015 04:57:21 +0000 (23:57 -0500)
Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchCatalogListView.java
Open-ILS/src/Android/core/src/org/open_ils/test/org/evergreen_ils/views/VolleyWranglerTest.java
Open-ILS/src/Android/opensrf/src/org/opensrf/util/GatewayResponse.java [new file with mode: 0644]

index 1b14104..c61185f 100644 (file)
@@ -149,7 +149,6 @@ public class SearchCatalogListView extends ActionBarActivity {
         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);
@@ -185,7 +184,6 @@ public class SearchCatalogListView extends ActionBarActivity {
                         InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                         imm.hideSoftInputFromWindow(searchText.getWindowToken(), 0);
 
-                        //searchOptionsMenu.setVisibility(View.GONE);
                         searchResultsNumber.setVisibility(View.VISIBLE);
 
                         progressDialog = ProgressDialog.show(
@@ -299,10 +297,7 @@ public class SearchCatalogListView extends ActionBarActivity {
 
                     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);
@@ -324,12 +319,6 @@ public class SearchCatalogListView extends ActionBarActivity {
                     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)) {
index e8c1c3a..6282862 100644 (file)
@@ -12,11 +12,8 @@ import com.android.volley.toolbox.StringRequest;
 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;
@@ -155,22 +152,6 @@ public class VolleyWranglerTest
         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,
@@ -184,8 +165,8 @@ public class VolleyWranglerTest
 
         assertNotNull(mStringResponse);
 
-        OSRFResponse response = new OSRFResponse();
-        response.parse(mStringResponse);
+        GatewayResponse response = GatewayResponse.create(mStringResponse);
+
         assertNull(response.ex);
 
         assertNotNull(response.map);
diff --git a/Open-ILS/src/Android/opensrf/src/org/opensrf/util/GatewayResponse.java b/Open-ILS/src/Android/opensrf/src/org/opensrf/util/GatewayResponse.java
new file mode 100644 (file)
index 0000000..3413fc3
--- /dev/null
@@ -0,0 +1,27 @@
+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;
+    }
+}