diff --git a/Listify/app/src/main/java/com/example/listify/ListPage.java b/Listify/app/src/main/java/com/example/listify/ListPage.java index f33608e..a019fd1 100644 --- a/Listify/app/src/main/java/com/example/listify/ListPage.java +++ b/Listify/app/src/main/java/com/example/listify/ListPage.java @@ -48,6 +48,9 @@ public class ListPage extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { + // Read list ID from caller + final int listID = (int) getIntent().getSerializableExtra("listID"); + Properties configs = new Properties(); try { configs = AuthManager.loadProperties(this, "android.resource://" + getPackageName() + "/raw/auths.json"); @@ -57,7 +60,7 @@ public class ListPage extends AppCompatActivity { requestor = new Requestor(am, configs.getProperty("apiKey")); SynchronousReceiver lr = new SynchronousReceiver<>(); //ListReceiver lr = new ListReceiver<>(); - requestor.getObject("39", List.class, lr); + requestor.getObject(Integer.toString(listID), List.class, lr); List list; diff --git a/Listify/app/src/main/java/com/example/listify/ui/lists/ListsFragment.java b/Listify/app/src/main/java/com/example/listify/ui/lists/ListsFragment.java index b7ab345..06274f3 100644 --- a/Listify/app/src/main/java/com/example/listify/ui/lists/ListsFragment.java +++ b/Listify/app/src/main/java/com/example/listify/ui/lists/ListsFragment.java @@ -1,5 +1,6 @@ package com.example.listify.ui.lists; +import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; @@ -14,8 +15,11 @@ import com.amplifyframework.auth.AuthException; import com.example.listify.AuthManager; import com.example.listify.CreateListAddDialogFragment; import com.example.listify.CreateListDialogFragment; +import com.example.listify.ItemDetails; +import com.example.listify.ListPage; import com.example.listify.R; import com.example.listify.Requestor; +import com.example.listify.SearchResults; import com.example.listify.SynchronousReceiver; import com.example.listify.adapter.DisplayShoppingListsAdapter; import com.example.listify.data.List; @@ -72,7 +76,11 @@ public class ListsFragment extends Fragment implements CreateListDialogFragment. shoppingListsView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { - Toast.makeText(getContext(), "open and display " + shoppingLists.get(position).getName(), Toast.LENGTH_SHORT).show(); + Intent listPage = new Intent(getContext(), ListPage.class); + + // Send the list ID + listPage.putExtra("listID", shoppingLists.get(position).getItemID()); + startActivity(listPage); } });