From 99a8d4ca9f0f56ceacf69cdc8b171ac27628658c Mon Sep 17 00:00:00 2001 From: Clayton Wilson Date: Sat, 28 Nov 2020 21:14:57 -0500 Subject: [PATCH 1/2] Finished pull-to-refresh on list activity --- .../java/com/example/listify/ListPage.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 fd6c3fe..1cfeb24 100644 --- a/Listify/app/src/main/java/com/example/listify/ListPage.java +++ b/Listify/app/src/main/java/com/example/listify/ListPage.java @@ -205,19 +205,20 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver { @Override public void acceptDelivery(Object delivered) { // Clear out old values + pNames.clear(); + pStores.clear(); + pPrices.clear(); + pQuantity.clear(); + pImages.clear(); + totalPriceByStore.clear(); + storeID2Name.clear(); + storeHeaderIndex.clear(); + pListItemPair.clear(); + totalPrice = 0; + 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)); } }); From b12509cf5b97dcff3d27694592fe0e5afd3e1f6d Mon Sep 17 00:00:00 2001 From: Clayton Wilson Date: Sun, 29 Nov 2020 12:55:30 -0500 Subject: [PATCH 2/2] Display android sharesheet --- .../java/com/example/listify/ListPage.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) 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 1cfeb24..ef5a684 100644 --- a/Listify/app/src/main/java/com/example/listify/ListPage.java +++ b/Listify/app/src/main/java/com/example/listify/ListPage.java @@ -3,6 +3,7 @@ package com.example.listify; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.*; @@ -194,6 +195,17 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver { 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; } @@ -215,13 +227,6 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver { storeHeaderIndex.clear(); pListItemPair.clear(); totalPrice = 0; - - runOnUiThread(new Runnable() { - @Override - public void run() { - tvTotalPrice.setText(String.format("$%.2f", totalPrice)); - } - }); List list = (List) delivered; @@ -313,6 +318,13 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver { }); } + runOnUiThread(new Runnable() { + @Override + public void run() { + tvTotalPrice.setText(String.format("$%.2f", totalPrice)); + } + }); + refreshList.setRefreshing(false); }