Easy Share the EmailDestination of identities and contacts
This commit is contained in:
2
TODO
2
TODO
@@ -15,7 +15,5 @@ Tasks:
|
||||
Features:
|
||||
- Public address book lookup
|
||||
- Import/export identities
|
||||
- Export Destination / make it copyable
|
||||
-- SMS / message
|
||||
- Add optional CC: and BCC: fields
|
||||
- "Empty trash" option in Trash folder
|
||||
|
||||
@@ -12,6 +12,8 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.ShareActionProvider;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -70,6 +72,7 @@ public class EditContactFragment extends EditPictureFragment {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
mDestination = getArguments().getString(CONTACT_DESTINATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +85,6 @@ public class EditContactFragment extends EditPictureFragment {
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mDestination = getArguments().getString(CONTACT_DESTINATION);
|
||||
String newName = getArguments().getString(NEW_NAME);
|
||||
|
||||
mNameField = (EditText) view.findViewById(R.id.contact_name);
|
||||
@@ -168,6 +170,17 @@ public class EditContactFragment extends EditPictureFragment {
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.edit_contact, menu);
|
||||
|
||||
MenuItem item = menu.findItem(R.id.menu_item_share);
|
||||
ShareActionProvider shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
|
||||
|
||||
if (mDestination != null) {
|
||||
Intent shareIntent = new Intent();
|
||||
shareIntent.setAction(Intent.ACTION_SEND);
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, mDestination);
|
||||
shareIntent.setType("text/plain");
|
||||
shareActionProvider.setShareIntent(shareIntent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,8 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.ShareActionProvider;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -52,6 +54,7 @@ public class ViewIdentityFragment extends Fragment {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
mKey = getArguments().getString(IDENTITY_KEY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +73,6 @@ public class ViewIdentityFragment extends Fragment {
|
||||
mCryptoField = (TextView) view.findViewById(R.id.crypto_impl);
|
||||
mKeyField = (TextView) view.findViewById(R.id.key);
|
||||
|
||||
mKey = getArguments().getString(IDENTITY_KEY);
|
||||
if (mKey != null) {
|
||||
try {
|
||||
mIdentity = BoteHelper.getIdentity(mKey);
|
||||
@@ -106,6 +108,17 @@ public class ViewIdentityFragment extends Fragment {
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.view_identity, menu);
|
||||
|
||||
MenuItem item = menu.findItem(R.id.menu_item_share);
|
||||
ShareActionProvider shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
|
||||
|
||||
if (mKey != null) {
|
||||
Intent shareIntent = new Intent();
|
||||
shareIntent.setAction(Intent.ACTION_SEND);
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, mKey);
|
||||
shareIntent.setType("text/plain");
|
||||
shareActionProvider.setShareIntent(shareIntent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:i2pandroid="http://schemas.android.com/apk/res-auto" >
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_item_share"
|
||||
android:title="@string/share"
|
||||
i2pandroid:showAsAction="ifRoom"
|
||||
i2pandroid:actionProviderClass="android.support.v7.widget.ShareActionProvider"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_save_contact"
|
||||
android:icon="@drawable/ic_content_save"
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:i2pandroid="http://schemas.android.com/apk/res-auto" >
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_item_share"
|
||||
android:title="@string/share"
|
||||
i2pandroid:showAsAction="ifRoom"
|
||||
i2pandroid:actionProviderClass="android.support.v7.widget.ShareActionProvider"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_edit_identity"
|
||||
android:icon="@drawable/ic_content_edit"
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
<string name="response_quote_wrote">%s wrote:</string>
|
||||
<string name="response_quote_wrote_hide" translatable="false">%s wrote:</string>
|
||||
<string name="address_book_empty">Address book is empty</string>
|
||||
<string name="share">Share</string>
|
||||
<string name="action_new_contact">New contact</string>
|
||||
<string name="contact_name">Contact name</string>
|
||||
<string name="email_destination">Email destination</string>
|
||||
|
||||
Reference in New Issue
Block a user