Commit 9a91549a authored by Grigory Fedorov's avatar Grigory Fedorov

ContactViewer: options menu with edit contact option.

parent 07aa56b8
...@@ -18,6 +18,9 @@ import android.content.Context; ...@@ -18,6 +18,9 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import com.xabber.android.data.Application; import com.xabber.android.data.Application;
...@@ -220,6 +223,26 @@ public class ContactViewer extends ManagedActivity implements ...@@ -220,6 +223,26 @@ public class ContactViewer extends ManagedActivity implements
contactViewerFragment.updateVCard(vCard); contactViewerFragment.updateVCard(vCard);
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater=getMenuInflater();
inflater.inflate(R.menu.edit_contact, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_edit_contact:
startActivity(ContactEditor.createIntent(this, account, bareAddress));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private ContactViewerFragment getFragment() { private ContactViewerFragment getFragment() {
return (ContactViewerFragment) getFragmentManager() return (ContactViewerFragment) getFragmentManager()
.findFragmentById(R.id.scrollable_container); .findFragmentById(R.id.scrollable_container);
......
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_edit_contact"
android:title="@string/contact_editor"
app:showAsAction="always"
android:orderInCategory="100"
android:icon="@drawable/ic_create_white_24dp"
/>
</menu>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment