mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 02:38:47 +00:00
Connect ListsFragment to ListPage
This commit is contained in:
parent
e16fafeaa0
commit
73639b50e2
@ -48,6 +48,9 @@ public class ListPage extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
// Read list ID from caller
|
||||||
|
final int listID = (int) getIntent().getSerializableExtra("listID");
|
||||||
|
|
||||||
Properties configs = new Properties();
|
Properties configs = new Properties();
|
||||||
try {
|
try {
|
||||||
configs = AuthManager.loadProperties(this, "android.resource://" + getPackageName() + "/raw/auths.json");
|
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"));
|
requestor = new Requestor(am, configs.getProperty("apiKey"));
|
||||||
SynchronousReceiver<List> lr = new SynchronousReceiver<>();
|
SynchronousReceiver<List> lr = new SynchronousReceiver<>();
|
||||||
//ListReceiver<List> lr = new ListReceiver<>();
|
//ListReceiver<List> lr = new ListReceiver<>();
|
||||||
requestor.getObject("39", List.class, lr);
|
requestor.getObject(Integer.toString(listID), List.class, lr);
|
||||||
|
|
||||||
List list;
|
List list;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.example.listify.ui.lists;
|
package com.example.listify.ui.lists;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -14,8 +15,11 @@ import com.amplifyframework.auth.AuthException;
|
|||||||
import com.example.listify.AuthManager;
|
import com.example.listify.AuthManager;
|
||||||
import com.example.listify.CreateListAddDialogFragment;
|
import com.example.listify.CreateListAddDialogFragment;
|
||||||
import com.example.listify.CreateListDialogFragment;
|
import com.example.listify.CreateListDialogFragment;
|
||||||
|
import com.example.listify.ItemDetails;
|
||||||
|
import com.example.listify.ListPage;
|
||||||
import com.example.listify.R;
|
import com.example.listify.R;
|
||||||
import com.example.listify.Requestor;
|
import com.example.listify.Requestor;
|
||||||
|
import com.example.listify.SearchResults;
|
||||||
import com.example.listify.SynchronousReceiver;
|
import com.example.listify.SynchronousReceiver;
|
||||||
import com.example.listify.adapter.DisplayShoppingListsAdapter;
|
import com.example.listify.adapter.DisplayShoppingListsAdapter;
|
||||||
import com.example.listify.data.List;
|
import com.example.listify.data.List;
|
||||||
@ -72,7 +76,11 @@ public class ListsFragment extends Fragment implements CreateListDialogFragment.
|
|||||||
shoppingListsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
shoppingListsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user