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 86bbdee..c882416 100644 --- a/Listify/app/src/main/java/com/example/listify/ListPage.java +++ b/Listify/app/src/main/java/com/example/listify/ListPage.java @@ -2,6 +2,7 @@ package com.example.listify; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.text.Editable; @@ -220,6 +221,17 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver, R exportItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { + String listContent = ""; + + + Intent sendIntent = new Intent(); + sendIntent.setAction(Intent.ACTION_SEND); + sendIntent.putExtra(Intent.EXTRA_TEXT, "this is my text test"); + sendIntent.setType("text/plain"); + + Intent shareIntent = Intent.createChooser(sendIntent, null); + startActivity(shareIntent); + Toast.makeText(ListPage.this, "Export List", Toast.LENGTH_SHORT).show(); return false; } @@ -231,22 +243,16 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver, R @Override public void acceptDelivery(Object delivered) { // Clear out old values - runOnUiThread(new Runnable() { - @Override - public void run() { - pNames.clear(); - pStores.clear(); - pPrices.clear(); - pQuantity.clear(); - pImages.clear(); - totalPriceByStore.clear(); - storeID2Name.clear(); - storeHeaderIndex.clear(); - pListItemPair.clear(); - totalPrice = 0; - tvTotalPrice.setText(String.format("$%.2f", totalPrice)); - } - }); + pNames.clear(); + pStores.clear(); + pPrices.clear(); + pQuantity.clear(); + pImages.clear(); + totalPriceByStore.clear(); + storeID2Name.clear(); + storeHeaderIndex.clear(); + pListItemPair.clear(); + totalPrice = 0; List list = (List) delivered; @@ -344,6 +350,13 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver, R }); } + runOnUiThread(new Runnable() { + @Override + public void run() { + tvTotalPrice.setText(String.format("$%.2f", totalPrice)); + } + }); + refreshList.setRefreshing(false); }