mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
duplicate lists functionality
This commit is contained in:
parent
f5d71a0fff
commit
0550ae4faf
@ -59,14 +59,16 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
Map<String, Integer> storeHeaderIndex = new HashMap<>();
|
Map<String, Integer> storeHeaderIndex = new HashMap<>();
|
||||||
|
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
int LIST_ID;
|
||||||
|
String LIST_NAME;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_list);
|
setContentView(R.layout.activity_list);
|
||||||
|
|
||||||
final int LIST_ID = (int) getIntent().getSerializableExtra("listID");
|
LIST_ID = (int) getIntent().getSerializableExtra("listID");
|
||||||
final String LIST_NAME = (String) getIntent().getSerializableExtra("listName");
|
LIST_NAME = (String) getIntent().getSerializableExtra("listName");
|
||||||
setTitle(LIST_NAME);
|
setTitle(LIST_NAME);
|
||||||
|
|
||||||
Properties configs = new Properties();
|
Properties configs = new Properties();
|
||||||
@ -193,7 +195,24 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
duplicateItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
duplicateItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
Toast.makeText(ListPage.this, "Duplicate List", Toast.LENGTH_SHORT).show();
|
|
||||||
|
ListDuplicate duplicate = new ListDuplicate(LIST_ID, String.format("%s copy", LIST_NAME));
|
||||||
|
|
||||||
|
Properties configs = new Properties();
|
||||||
|
try {
|
||||||
|
configs = AuthManager.loadProperties(ListPage.this, "android.resource://" + getPackageName() + "/raw/auths.json");
|
||||||
|
} catch (IOException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
requestor = new Requestor(am, configs.getProperty("apiKey"));
|
||||||
|
try {
|
||||||
|
requestor.postObject(duplicate);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.makeText(ListPage.this, "List duplicated", Toast.LENGTH_SHORT).show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user