mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 02:38:47 +00:00
Display shopping list name in titlebar
This commit is contained in:
parent
bae3d77c57
commit
680c545d76
@ -70,7 +70,9 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_list);
|
setContentView(R.layout.activity_list);
|
||||||
|
|
||||||
final int listID = (int) getIntent().getSerializableExtra("listID");
|
final int LIST_ID = (int) getIntent().getSerializableExtra("listID");
|
||||||
|
final String LIST_NAME = (String) getIntent().getSerializableExtra("listName");
|
||||||
|
setTitle(LIST_NAME);
|
||||||
|
|
||||||
Properties configs = new Properties();
|
Properties configs = new Properties();
|
||||||
try {
|
try {
|
||||||
@ -79,7 +81,7 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
requestor = new Requestor(am, configs.getProperty("apiKey"));
|
requestor = new Requestor(am, configs.getProperty("apiKey"));
|
||||||
requestor.getObject(Integer.toString(listID), List.class, this);
|
requestor.getObject(Integer.toString(LIST_ID), List.class, this);
|
||||||
|
|
||||||
listView = findViewById(R.id.listView);
|
listView = findViewById(R.id.listView);
|
||||||
myAdapter = new MyAdapter(this, pNames, pStores, pPrices, pQuantity, pImages);
|
myAdapter = new MyAdapter(this, pNames, pStores, pPrices, pQuantity, pImages);
|
||||||
@ -125,7 +127,7 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
EditText sharedEmailText = (EditText) codeView.findViewById(R.id.editTextTextSharedEmail);
|
EditText sharedEmailText = (EditText) codeView.findViewById(R.id.editTextTextSharedEmail);
|
||||||
String sharedEmail = sharedEmailText.getText().toString();
|
String sharedEmail = sharedEmailText.getText().toString();
|
||||||
ListShare listShare = new ListShare(listID, sharedEmail);
|
ListShare listShare = new ListShare(LIST_ID, sharedEmail);
|
||||||
try {
|
try {
|
||||||
requestor.postObject(listShare);
|
requestor.postObject(listShare);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,8 +157,9 @@ public class ShoppingListsSwipeableAdapter extends BaseAdapter {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent listPage = new Intent(activity, ListPage.class);
|
Intent listPage = new Intent(activity, ListPage.class);
|
||||||
|
|
||||||
// Send the list ID
|
// Send the list ID and list name
|
||||||
listPage.putExtra("listID", curList.getItemID());
|
listPage.putExtra("listID", curList.getItemID());
|
||||||
|
listPage.putExtra("listName", curList.getName());
|
||||||
activity.startActivity(listPage);
|
activity.startActivity(listPage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
package com.example.listify.ui.home;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
|
||||||
import androidx.lifecycle.ViewModel;
|
|
||||||
|
|
||||||
public class HomeViewModel extends ViewModel {
|
|
||||||
|
|
||||||
private MutableLiveData<String> mText;
|
|
||||||
|
|
||||||
public HomeViewModel() {
|
|
||||||
mText = new MutableLiveData<>();
|
|
||||||
mText.setValue("This is home fragment");
|
|
||||||
}
|
|
||||||
|
|
||||||
public LiveData<String> getText() {
|
|
||||||
return mText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user