mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-04-25 13:55:04 +00:00
Try storing serialized search object
Does not seem to be the best solution (https://stackoverflow.com/questions/17662236/java-write-object-to-mysql-each-field-or-serialized-byte-array) and does not entirely work, but saving it for posterity because there are some interesting changes here
This commit is contained in:
@@ -60,6 +60,25 @@ public class Requestor {
|
||||
launchCall(deleteRequest, null, classType, failureHandler);
|
||||
}
|
||||
|
||||
public void putObject(Object toPost) throws JSONException {
|
||||
putObject(toPost, (RequestErrorHandler) null);
|
||||
}
|
||||
|
||||
public void putObject(Object toPost, RequestErrorHandler failureHandler) throws JSONException {
|
||||
putObject(toPost, null, failureHandler);
|
||||
}
|
||||
|
||||
public void putObject(Object toPost, Receiver<Integer> idReceiver) throws JSONException {
|
||||
putObject(toPost, idReceiver, null);
|
||||
}
|
||||
|
||||
public void putObject(Object toPut, Receiver<Integer> idReceiver, RequestErrorHandler failureHandler) throws JSONException {
|
||||
String putURL = DEV_BASEURL + "/" + toPut.getClass().getSimpleName();
|
||||
Request putRequest = buildBaseRequest(putURL, "PUT", new Gson().toJson(toPut));
|
||||
launchCall(putRequest, idReceiver, Integer.class, failureHandler);
|
||||
}
|
||||
|
||||
|
||||
public void postObject(Object toPost) throws JSONException {
|
||||
postObject(toPost, (RequestErrorHandler) null);
|
||||
}
|
||||
@@ -85,7 +104,7 @@ public class Requestor {
|
||||
String responseString = response.body().string();
|
||||
if (receiver != null) {
|
||||
if (classType == null) {
|
||||
Log.e("Requestor Contract Error", "classType while receiver populated");
|
||||
Log.e("Requestor Contract Error", "no/null classType while receiver populated");
|
||||
}
|
||||
try {
|
||||
receiver.acceptDelivery(new Gson().fromJson(responseString, classType));
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.example.listify.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SearchHistory {
|
||||
ArrayList<String> searches;
|
||||
|
||||
public SearchHistory(ArrayList<String> searches) {
|
||||
this.searches = searches;
|
||||
}
|
||||
|
||||
public ArrayList<String> getSearches() {
|
||||
return searches;
|
||||
}
|
||||
|
||||
public void setSearches(ArrayList<String> searches) {
|
||||
this.searches = searches;
|
||||
}
|
||||
|
||||
public void addSearch(String newSearch) {
|
||||
searches.add(newSearch);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user