mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-03-11 02:55:04 +00:00
@@ -14,6 +14,7 @@ import androidx.navigation.ui.AppBarConfiguration;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
import com.amplifyframework.auth.AuthException;
|
||||
import com.example.listify.data.Item;
|
||||
import com.example.listify.data.ItemSearch;
|
||||
import com.example.listify.data.List;
|
||||
import com.example.listify.data.ListEntry;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
@@ -21,7 +22,6 @@ import org.json.JSONException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
@@ -84,7 +84,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
//The name is the only part of this that is used, the rest is generated by the Lambda.
|
||||
List testList = new List(-1, "New List", "user filled by lambda", Instant.now().toEpochMilli());
|
||||
//Everything except addedDate is used for ItemEntry
|
||||
ListEntry entry = new ListEntry(1, 1, new Random().nextInt(), Instant.now().atZone(ZoneOffset.UTC).toLocalDateTime(),false);
|
||||
ListEntry entry = new ListEntry(1, 4, Math.abs(new Random().nextInt()), Instant.now().toEpochMilli(),false);
|
||||
SynchronousReceiver<Integer> idReceiver = new SynchronousReceiver<>();
|
||||
try {
|
||||
requestor.postObject(testList, idReceiver, idReceiver);
|
||||
@@ -100,10 +100,13 @@ public class MainActivity extends AppCompatActivity {
|
||||
requestor.getObject("39", List.class, listReceiver, listReceiver);
|
||||
SynchronousReceiver<Integer[]> listIdsReceiver = new SynchronousReceiver<>();
|
||||
requestor.getListOfIds(List.class, listIdsReceiver, listIdsReceiver);
|
||||
SynchronousReceiver<ItemSearch> itemSearchReceiver = new SynchronousReceiver<>();
|
||||
requestor.getObject("r", ItemSearch.class, itemSearchReceiver, itemSearchReceiver);
|
||||
try {
|
||||
System.out.println(itemReceiver.await());
|
||||
System.out.println(listReceiver.await());
|
||||
System.out.println(Arrays.toString(listIdsReceiver.await()));
|
||||
System.out.println(itemSearchReceiver.await());
|
||||
} catch (Exception receiverError) {
|
||||
receiverError.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.example.listify.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class Item {
|
||||
Integer productID;
|
||||
@@ -11,11 +10,11 @@ public class Item {
|
||||
BigDecimal price;
|
||||
String imageURL;
|
||||
String department;
|
||||
LocalDateTime retrievedDate;
|
||||
long retrievedDate;
|
||||
Integer fetchCounts;
|
||||
|
||||
public Item(Integer productID, Integer chainID, String upc, String description, BigDecimal price,
|
||||
String imageURL, String department, LocalDateTime retrievedDate, Integer fetchCounts) {
|
||||
String imageURL, String department, long retrievedDate, Integer fetchCounts) {
|
||||
this.productID = productID;
|
||||
this.chainID = chainID;
|
||||
this.upc = upc;
|
||||
@@ -37,7 +36,7 @@ public class Item {
|
||||
", price=" + price +
|
||||
", imageURL='" + imageURL + '\'' +
|
||||
", department='" + department + '\'' +
|
||||
", retrievedDate=" + (retrievedDate == null ? null : retrievedDate) +
|
||||
", retrievedDate=" + retrievedDate +
|
||||
", fetchCounts=" + fetchCounts +
|
||||
'}';
|
||||
}
|
||||
@@ -98,11 +97,11 @@ public class Item {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public LocalDateTime getRetrievedDate() {
|
||||
public long getRetrievedDate() {
|
||||
return retrievedDate;
|
||||
}
|
||||
|
||||
public void setRetrievedDate(LocalDateTime retrievedDate) {
|
||||
public void setRetrievedDate(long retrievedDate) {
|
||||
this.retrievedDate = retrievedDate;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.listify.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ItemSearch {
|
||||
ArrayList<Item> results;
|
||||
|
||||
public ItemSearch(ArrayList<Item> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ItemSearch{" +
|
||||
"results=" + results +
|
||||
'}';
|
||||
}
|
||||
|
||||
public ArrayList<Item> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(ArrayList<Item> results) {
|
||||
this.results = results;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.example.listify.data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class ListEntry {
|
||||
Integer listID;
|
||||
Integer productID;
|
||||
Integer quantity;
|
||||
LocalDateTime addedDate;
|
||||
long addedDate;
|
||||
Boolean purchased;
|
||||
|
||||
public ListEntry(Integer listID, Integer productID, Integer quantity, LocalDateTime addedDate, Boolean purchased) {
|
||||
public ListEntry(Integer listID, Integer productID, Integer quantity, long addedDate, Boolean purchased) {
|
||||
this.listID = listID;
|
||||
this.productID = productID;
|
||||
this.quantity = quantity;
|
||||
@@ -52,11 +50,11 @@ public class ListEntry {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public LocalDateTime getAddedDate() {
|
||||
public long getAddedDate() {
|
||||
return addedDate;
|
||||
}
|
||||
|
||||
public void setAddedDate(LocalDateTime addedDate) {
|
||||
public void setAddedDate(long addedDate) {
|
||||
this.addedDate = addedDate;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user