Merge pull request #134 from ClaytonWWilson/export-lists

Export lists to other apps
This commit is contained in:
Clayton Wilson 2020-11-29 13:42:02 -05:00 committed by GitHub
commit 578d360319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -221,12 +221,19 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver, R
exportItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
String listContent = "";
StringBuilder listContents = new StringBuilder();
for (int i = 0; i < pNames.size(); i++) {
if (Integer.parseInt(pQuantity.get(i)) == -1) {
listContents.append(String.format("\n%s\n", pNames.get(i)));
} else {
listContents.append(String.format(" %s of %s\n", pQuantity.get(i), pNames.get(i)));
}
}
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "this is my text test");
sendIntent.putExtra(Intent.EXTRA_TEXT, listContents.toString());
sendIntent.setType("text/plain");
Intent shareIntent = Intent.createChooser(sendIntent, null);