From 5db5442064f461f4f4077a8470b50ca599b6156a Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Wed, 24 Feb 2016 19:50:25 +0100 Subject: [PATCH] Improvements for Contacts - create contacts by manually entering the address (or pasting it) - share address --- app/src/main/AndroidManifest.xml | 2 +- .../apps/abit/AddressDetailFragment.java | 21 ++---- .../dissem/apps/abit/AddressListFragment.java | 6 +- ...tivity.java => CreateAddressActivity.java} | 61 +++++++++------- .../activity_create_bitmessage_address.xml | 71 +++++++++++++++++++ .../res/layout/fragment_address_detail.xml | 36 +++++----- app/src/main/res/menu/address.xml | 9 ++- app/src/main/res/values-de/strings.xml | 2 + app/src/main/res/values/strings.xml | 2 + 9 files changed, 143 insertions(+), 67 deletions(-) rename app/src/main/java/ch/dissem/apps/abit/{OpenBitmessageLinkActivity.java => CreateAddressActivity.java} (62%) create mode 100644 app/src/main/res/layout/activity_create_bitmessage_address.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3f83f18..f97947c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -89,7 +89,7 @@ diff --git a/app/src/main/java/ch/dissem/apps/abit/AddressDetailFragment.java b/app/src/main/java/ch/dissem/apps/abit/AddressDetailFragment.java index da08e12..dba8a03 100644 --- a/app/src/main/java/ch/dissem/apps/abit/AddressDetailFragment.java +++ b/app/src/main/java/ch/dissem/apps/abit/AddressDetailFragment.java @@ -23,8 +23,6 @@ import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.support.v4.app.Fragment; -import android.support.v4.view.MenuItemCompat; -import android.support.v7.widget.ShareActionProvider; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; @@ -71,7 +69,6 @@ public class AddressDetailFragment extends Fragment { private static final int QR_CODE_SIZE = 350; - private ShareActionProvider shareActionProvider; /** * The content this fragment is presenting. */ @@ -103,11 +100,8 @@ public class AddressDetailFragment extends Fragment { inflater.inflate(R.menu.address, menu); Drawables.addIcon(getActivity(), menu, R.id.write_message, GoogleMaterial.Icon.gmd_mail); - Drawables.addIcon(getActivity(), menu, R.id.delete, GoogleMaterial.Icon.gmd_delete); Drawables.addIcon(getActivity(), menu, R.id.share, GoogleMaterial.Icon.gmd_share); - - shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider( - menu.findItem(R.id.share)); + Drawables.addIcon(getActivity(), menu, R.id.delete, GoogleMaterial.Icon.gmd_delete); super.onCreateOptionsMenu(menu, inflater); } @@ -143,20 +137,15 @@ public class AddressDetailFragment extends Fragment { .show(); return true; case R.id.share: - new AlertDialog.Builder(ctx) - .setMessage("I have no fucking clue.") - .show(); + Intent shareIntent = new Intent(Intent.ACTION_SEND); + shareIntent.setType("text/plain"); + shareIntent.putExtra(Intent.EXTRA_TEXT, item.getAddress()); + startActivity(Intent.createChooser(shareIntent, null)); default: return false; } } - private void setShareIntent(Intent shareIntent) { - if (shareActionProvider != null) { - shareActionProvider.setShareIntent(shareIntent); - } - } - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { diff --git a/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.java b/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.java index be0ca68..9f0dc48 100644 --- a/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.java +++ b/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.java @@ -138,6 +138,8 @@ public class AddressListFragment extends AbstractItemListFragment + + + + + + + + + + + + + + + + +