Connect ListsFragment to ListPage

This commit is contained in:
Clayton Wilson 2020-10-08 19:37:48 -04:00
parent e16fafeaa0
commit 73639b50e2
2 changed files with 13 additions and 2 deletions

View File

@ -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<List> lr = new SynchronousReceiver<>();
//ListReceiver<List> lr = new ListReceiver<>();
requestor.getObject("39", List.class, lr);
requestor.getObject(Integer.toString(listID), List.class, lr);
List list;

View File

@ -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);
}
});