Added view contact activity
This commit is contained in:
@@ -66,11 +66,18 @@
|
||||
android:value="i2p.bote.android.EmailListActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".addressbook.EditContactActivity"
|
||||
android:name=".addressbook.ViewContactActivity"
|
||||
android:parentActivityName=".addressbook.AddressBookActivity" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="i2p.bote.android.addressbook.AddressBookActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".addressbook.EditContactActivity"
|
||||
android:parentActivityName=".addressbook.ViewContactActivity" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="i2p.bote.android.addressbook.ViewContactActivity" />
|
||||
<intent-filter>
|
||||
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
@@ -35,12 +35,12 @@ public class AddressBookActivity extends ActionBarActivity implements
|
||||
public void onContactSelected(Contact contact) {
|
||||
if (getIntent().getAction() == Intent.ACTION_PICK) {
|
||||
Intent result = new Intent();
|
||||
result.putExtra(EditContactFragment.CONTACT_DESTINATION, contact.getBase64Dest());
|
||||
result.putExtra(ViewContactFragment.CONTACT_DESTINATION, contact.getBase64Dest());
|
||||
setResult(Activity.RESULT_OK, result);
|
||||
finish();
|
||||
} else {
|
||||
Intent i = new Intent(this, EditContactActivity.class);
|
||||
i.putExtra(EditContactFragment.CONTACT_DESTINATION, contact.getBase64Dest());
|
||||
Intent i = new Intent(this, ViewContactActivity.class);
|
||||
i.putExtra(ViewContactFragment.CONTACT_DESTINATION, contact.getBase64Dest());
|
||||
startActivityForResult(i, ALTER_CONTACT_LIST);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package i2p.bote.android.addressbook;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.nfc.NdefMessage;
|
||||
import android.nfc.NdefRecord;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.nfc.NfcEvent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
@@ -14,9 +12,6 @@ import android.support.v7.app.ActionBarActivity;
|
||||
import i2p.bote.android.InitActivities;
|
||||
|
||||
public class EditContactActivity extends ActionBarActivity {
|
||||
NfcAdapter mNfcAdapter;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -37,42 +32,20 @@ public class EditContactActivity extends ActionBarActivity {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(android.R.id.content, f).commit();
|
||||
}
|
||||
|
||||
// NFC send only works on API 10+
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
|
||||
if (mNfcAdapter != null &&
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
mNfcAdapter.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() {
|
||||
@Override
|
||||
public NdefMessage createNdefMessage(NfcEvent nfcEvent) {
|
||||
return getNdefMessage();
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (mNfcAdapter != null &&
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
mNfcAdapter.enableForegroundNdefPush(this, getNdefMessage());
|
||||
// NFC receive only works on API 10+
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
// Check to see that the Activity started due to an Android Beam
|
||||
if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction()) ||
|
||||
NfcAdapter.ACTION_TAG_DISCOVERED.equals(getIntent().getAction())) {
|
||||
processIntent(getIntent());
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see that the Activity started due to an Android Beam
|
||||
if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction()) ||
|
||||
NfcAdapter.ACTION_TAG_DISCOVERED.equals(getIntent().getAction())) {
|
||||
processIntent(getIntent());
|
||||
}
|
||||
}
|
||||
|
||||
private NdefMessage getNdefMessage() {
|
||||
EditContactFragment f = (EditContactFragment) getSupportFragmentManager()
|
||||
.findFragmentById(android.R.id.content);
|
||||
return f.createNdefMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,15 +75,4 @@ public class EditContactActivity extends ActionBarActivity {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, f).commit();
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (mNfcAdapter != null &&
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
mNfcAdapter.disableForegroundNdefPush(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
package i2p.bote.android.addressbook;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.nfc.NdefMessage;
|
||||
import android.nfc.NdefRecord;
|
||||
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;
|
||||
@@ -26,7 +17,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@@ -132,57 +122,9 @@ public class EditContactFragment extends EditPictureFragment {
|
||||
});
|
||||
}
|
||||
|
||||
public NdefMessage createNdefMessage() {
|
||||
NdefMessage msg = new NdefMessage(new NdefRecord[]{
|
||||
createNameRecord(),
|
||||
createDestinationRecord()
|
||||
});
|
||||
return msg;
|
||||
}
|
||||
|
||||
private NdefRecord createNameRecord() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
|
||||
return new NdefRecord(
|
||||
NdefRecord.TNF_EXTERNAL_TYPE,
|
||||
"i2p.bote:contact".getBytes(),
|
||||
new byte[0],
|
||||
mNameField.getText().toString().getBytes()
|
||||
);
|
||||
else
|
||||
return NdefRecord.createExternal(
|
||||
"i2p.bote", "contact", mNameField.getText().toString().getBytes()
|
||||
);
|
||||
}
|
||||
|
||||
private NdefRecord createDestinationRecord() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
|
||||
return new NdefRecord(
|
||||
NdefRecord.TNF_EXTERNAL_TYPE,
|
||||
"i2p.bote:contactDestination".getBytes(),
|
||||
new byte[0],
|
||||
mDestinationField.getText().toString().getBytes()
|
||||
);
|
||||
else
|
||||
return NdefRecord.createExternal(
|
||||
"i2p.bote", "contactDestination", mDestinationField.getText().toString().getBytes()
|
||||
);
|
||||
}
|
||||
|
||||
@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);
|
||||
} else
|
||||
item.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -215,41 +157,6 @@ public class EditContactFragment extends EditPictureFragment {
|
||||
}
|
||||
return true;
|
||||
|
||||
case R.id.action_delete_contact:
|
||||
DialogFragment df = new DialogFragment() {
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setMessage(R.string.delete_contact)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
try {
|
||||
String err = BoteHelper.deleteContact(mDestination);
|
||||
if (err == null) {
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
} else
|
||||
mError.setText(err);
|
||||
} catch (PasswordException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (GeneralSecurityException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
};
|
||||
df.show(getActivity().getSupportFragmentManager(), "deletecontact");
|
||||
return true;
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package i2p.bote.android.addressbook;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.nfc.NdefMessage;
|
||||
import android.nfc.NdefRecord;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.nfc.NfcEvent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
|
||||
import i2p.bote.android.InitActivities;
|
||||
|
||||
public class ViewContactActivity extends ActionBarActivity {
|
||||
NfcAdapter mNfcAdapter;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Initialize I2P settings
|
||||
InitActivities init = new InitActivities(this);
|
||||
init.initialize();
|
||||
|
||||
// Enable ActionBar app icon to behave as action to go back
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
String destination = null;
|
||||
Bundle args = getIntent().getExtras();
|
||||
if (args != null)
|
||||
destination = args.getString(ViewContactFragment.CONTACT_DESTINATION);
|
||||
ViewContactFragment f = ViewContactFragment.newInstance(destination);
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(android.R.id.content, f).commit();
|
||||
}
|
||||
|
||||
// NFC send only works on API 10+
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
|
||||
if (mNfcAdapter != null &&
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
mNfcAdapter.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() {
|
||||
@Override
|
||||
public NdefMessage createNdefMessage(NfcEvent nfcEvent) {
|
||||
return getNdefMessage();
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (mNfcAdapter != null &&
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
mNfcAdapter.enableForegroundNdefPush(this, getNdefMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private NdefMessage getNdefMessage() {
|
||||
ViewContactFragment f = (ViewContactFragment) getSupportFragmentManager()
|
||||
.findFragmentById(android.R.id.content);
|
||||
return f.createNdefMessage();
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (mNfcAdapter != null &&
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
mNfcAdapter.disableForegroundNdefPush(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package i2p.bote.android.addressbook;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.nfc.NdefMessage;
|
||||
import android.nfc.NdefRecord;
|
||||
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;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
|
||||
import i2p.bote.android.R;
|
||||
import i2p.bote.android.util.BoteHelper;
|
||||
import i2p.bote.fileencryption.PasswordException;
|
||||
import i2p.bote.packet.dht.Contact;
|
||||
|
||||
public class ViewContactFragment extends Fragment {
|
||||
public static final String CONTACT_DESTINATION = "contact_destination";
|
||||
|
||||
private String mDestination;
|
||||
private Contact mContact;
|
||||
|
||||
ImageView mContactPicture;
|
||||
TextView mNameField;
|
||||
TextView mTextField;
|
||||
TextView mCryptoField;
|
||||
TextView mDestinationField;
|
||||
|
||||
public static ViewContactFragment newInstance(String destination) {
|
||||
ViewContactFragment f = new ViewContactFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(CONTACT_DESTINATION, destination);
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
mDestination = getArguments().getString(CONTACT_DESTINATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_view_contact, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mContactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
mNameField = (TextView) view.findViewById(R.id.contact_name);
|
||||
mTextField = (TextView) view.findViewById(R.id.text);
|
||||
mCryptoField = (TextView) view.findViewById(R.id.crypto_impl);
|
||||
mDestinationField = (TextView) view.findViewById(R.id.destination);
|
||||
|
||||
if (mDestination != null) {
|
||||
try {
|
||||
mContact = BoteHelper.getContact(mDestination);
|
||||
} catch (PasswordException e) {
|
||||
// TODO Handle
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (mContact != null) {
|
||||
Bitmap picture = BoteHelper.decodePicture(mContact.getPictureBase64());
|
||||
if (picture != null)
|
||||
mContactPicture.setImageBitmap(picture);
|
||||
|
||||
mNameField.setText(mContact.getName());
|
||||
mTextField.setText(mContact.getText());
|
||||
mCryptoField.setText(mContact.getDestination().getCryptoImpl().getName());
|
||||
mDestinationField.setText(mDestination);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.view_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
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_edit_contact:
|
||||
Intent ei = new Intent(getActivity(), EditContactActivity.class);
|
||||
ei.putExtra(EditContactFragment.CONTACT_DESTINATION, mDestination);
|
||||
startActivity(ei);
|
||||
return true;
|
||||
|
||||
case R.id.action_delete_contact:
|
||||
DialogFragment df = new DialogFragment() {
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setMessage(R.string.delete_contact)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
try {
|
||||
String err = BoteHelper.deleteContact(mDestination);
|
||||
if (err == null) {
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
} else
|
||||
Toast.makeText(getActivity(), err, Toast.LENGTH_SHORT).show();
|
||||
} catch (PasswordException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (GeneralSecurityException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
};
|
||||
df.show(getActivity().getSupportFragmentManager(), "deletecontact");
|
||||
return true;
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
public NdefMessage createNdefMessage() {
|
||||
NdefMessage msg = new NdefMessage(new NdefRecord[]{
|
||||
createNameRecord(),
|
||||
createDestinationRecord()
|
||||
});
|
||||
return msg;
|
||||
}
|
||||
|
||||
private NdefRecord createNameRecord() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
|
||||
return new NdefRecord(
|
||||
NdefRecord.TNF_EXTERNAL_TYPE,
|
||||
"i2p.bote:contact".getBytes(),
|
||||
new byte[0],
|
||||
mContact.getName().getBytes()
|
||||
);
|
||||
else
|
||||
return NdefRecord.createExternal(
|
||||
"i2p.bote", "contact", mContact.getName().getBytes()
|
||||
);
|
||||
}
|
||||
|
||||
private NdefRecord createDestinationRecord() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
|
||||
return new NdefRecord(
|
||||
NdefRecord.TNF_EXTERNAL_TYPE,
|
||||
"i2p.bote:contactDestination".getBytes(),
|
||||
new byte[0],
|
||||
mContact.getDestination().getKey().getBytes()
|
||||
);
|
||||
else
|
||||
return NdefRecord.createExternal(
|
||||
"i2p.bote", "contactDestination", mContact.getDestination().getKey().getBytes()
|
||||
);
|
||||
}
|
||||
}
|
||||
65
app/src/main/res/layout/fragment_view_contact.xml
Normal file
65
app/src/main/res/layout/fragment_view_contact.xml
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_picture"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="54dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_contact_picture" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contact_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/contact_picture"
|
||||
android:layout_toRightOf="@+id/contact_picture"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:ems="10"
|
||||
android:textSize="20dp"
|
||||
android:text="@string/public_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/contact_picture"
|
||||
android:layout_marginTop="5dp"
|
||||
android:ems="10"
|
||||
android:text="@string/description" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Address information"
|
||||
android:id="@+id/title_key_info"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/text"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/crypto_impl"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/title_key_info"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="Crypto implementation" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/destination"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/crypto_impl"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="Destination" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -2,21 +2,10 @@
|
||||
<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"
|
||||
android:title="@string/save_contact"
|
||||
i2pandroid:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_delete_contact"
|
||||
android:title="@string/action_delete"
|
||||
i2pandroid:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
22
app/src/main/res/menu/view_contact.xml
Normal file
22
app/src/main/res/menu/view_contact.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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_contact"
|
||||
android:icon="@drawable/ic_content_edit"
|
||||
android:title="@string/edit_contact"
|
||||
i2pandroid:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_delete_contact"
|
||||
android:title="@string/action_delete"
|
||||
i2pandroid:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
@@ -115,6 +115,7 @@
|
||||
<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="edit_contact">Edit contact</string>
|
||||
<string name="select_a_picture">Select a picture</string>
|
||||
<string name="no_image_cropping_app_found">No image cropping app found</string>
|
||||
<string name="select_a_cropping_app">Select a cropping app</string>
|
||||
|
||||
Reference in New Issue
Block a user