Commit 8e10be53 authored by Grigory Fedorov's avatar Grigory Fedorov

New AccountViewer with menu option item to edit account user info (vCard).

parent 73bc5380
...@@ -244,6 +244,17 @@ ...@@ -244,6 +244,17 @@
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.ChatViewer" /> android:value="com.xabber.android.ui.ChatViewer" />
</activity> </activity>
<activity
android:name=".ui.AccountViewer"
android:parentActivityName=".ui.ContactList" >
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.ContactList" />
</activity>
<activity <activity
android:name=".ui.FingerprintViewer" android:name=".ui.FingerprintViewer"
android:label="@string/otr_verify_fingerprint" android:label="@string/otr_verify_fingerprint"
......
package com.xabber.android.ui;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.xabber.android.R;
import com.xabber.android.data.intent.EntityIntentBuilder;
import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.data.roster.RosterContact;
import com.xabber.android.data.roster.RosterManager;
public class AccountViewer extends ContactViewer implements Toolbar.OnMenuItemClickListener {
public static final int ACCOUNT_VIEWER_MENU = R.menu.account_viewer;
public static Intent createIntent(Context context, String account) {
return new EntityIntentBuilder(context, AccountViewer.class)
.setAccount(account).setUser(GroupManager.IS_ACCOUNT).build();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toolbar toolbar = contactTitleExpandableToolbarInflater.getToolbar();
toolbar.inflateMenu(ACCOUNT_VIEWER_MENU);
toolbar.setOnMenuItemClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
RosterContact rosterContact = RosterManager.getInstance().getRosterContact(getAccount(), getBareAddress());
if (rosterContact != null) {
getMenuInflater().inflate(ACCOUNT_VIEWER_MENU, menu);
}
return true;
}
@Override
public boolean onMenuItemClick(MenuItem item) {
return onOptionsItemSelected(item);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_edit_account_user_info:
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
...@@ -37,7 +37,7 @@ import com.xabber.android.data.roster.AbstractContact; ...@@ -37,7 +37,7 @@ import com.xabber.android.data.roster.AbstractContact;
import com.xabber.android.data.roster.Group; import com.xabber.android.data.roster.Group;
import com.xabber.android.data.roster.GroupManager; import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.data.roster.ShowOfflineMode; import com.xabber.android.data.roster.ShowOfflineMode;
import com.xabber.android.ui.ContactViewer; import com.xabber.android.ui.AccountViewer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
...@@ -277,7 +277,7 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat ...@@ -277,7 +277,7 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
viewHolder.avatar.setOnClickListener(new View.OnClickListener() { viewHolder.avatar.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
activity.startActivity(ContactViewer.createIntent(activity, account, GroupManager.IS_ACCOUNT)); activity.startActivity(AccountViewer.createIntent(activity, account));
} }
}); });
......
...@@ -38,11 +38,11 @@ import com.xabber.android.data.roster.AbstractContact; ...@@ -38,11 +38,11 @@ import com.xabber.android.data.roster.AbstractContact;
import com.xabber.android.data.roster.GroupManager; import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.data.roster.PresenceManager; import com.xabber.android.data.roster.PresenceManager;
import com.xabber.android.data.roster.ShowOfflineMode; import com.xabber.android.data.roster.ShowOfflineMode;
import com.xabber.android.ui.AccountViewer;
import com.xabber.android.ui.ChatViewer; import com.xabber.android.ui.ChatViewer;
import com.xabber.android.ui.ConferenceAdd; import com.xabber.android.ui.ConferenceAdd;
import com.xabber.android.ui.ContactAdd; import com.xabber.android.ui.ContactAdd;
import com.xabber.android.ui.ContactEditor; import com.xabber.android.ui.ContactEditor;
import com.xabber.android.ui.ContactViewer;
import com.xabber.android.ui.GroupEditor; import com.xabber.android.ui.GroupEditor;
import com.xabber.android.ui.StatusEditor; import com.xabber.android.ui.StatusEditor;
import com.xabber.android.ui.adapter.UpdatableAdapter; import com.xabber.android.ui.adapter.UpdatableAdapter;
...@@ -329,7 +329,7 @@ public class ContextMenuHelper { ...@@ -329,7 +329,7 @@ public class ContextMenuHelper {
new MenuItem.OnMenuItemClickListener() { new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
activity.startActivity(ContactViewer.createIntent(activity, account, GroupManager.IS_ACCOUNT)); activity.startActivity(AccountViewer.createIntent(activity, account));
return true; return true;
} }
}); });
......
<?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_account_user_info"
android:title="@string/edit_account_user_info"
app:showAsAction="never"
android:orderInCategory="100"
/>
</menu>
\ No newline at end of file
...@@ -13,4 +13,7 @@ ...@@ -13,4 +13,7 @@
<string name="add_new_group">Add new group…</string> <string name="add_new_group">Add new group…</string>
<string name="accept_contact">Authorize</string> <string name="accept_contact">Authorize</string>
<string name="decline_contact">Discard</string> <string name="decline_contact">Discard</string>
</resources> </resources>
\ No newline at end of file
...@@ -48,4 +48,5 @@ ...@@ -48,4 +48,5 @@
<string name="edit_alias">Edit alias</string> <string name="edit_alias">Edit alias</string>
<string name="edit_contact_groups">Edit groups</string> <string name="edit_contact_groups">Edit groups</string>
<string name="remove_contact">Remove contact</string> <string name="remove_contact">Remove contact</string>
<string name="edit_account_user_info">Edit user info</string>
</resources> </resources>
\ 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