Commit faea0b38 authored by Grigory Fedorov's avatar Grigory Fedorov

Merge branch 'release/1.0.39'

parents 67a1a595 23515f73
...@@ -7,8 +7,8 @@ android { ...@@ -7,8 +7,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 22 targetSdkVersion 22
versionCode 211 versionCode 212
versionName '1.0.38' versionName '1.0.39'
} }
compileOptions { compileOptions {
......
...@@ -25,6 +25,7 @@ import com.xabber.android.data.account.AccountManager; ...@@ -25,6 +25,7 @@ import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.account.OnAccountRemovedListener; import com.xabber.android.data.account.OnAccountRemovedListener;
import com.xabber.android.data.connection.ConnectionItem; import com.xabber.android.data.connection.ConnectionItem;
import com.xabber.android.data.connection.ConnectionManager; import com.xabber.android.data.connection.ConnectionManager;
import com.xabber.android.data.connection.ConnectionThread;
import com.xabber.android.data.connection.OnPacketListener; import com.xabber.android.data.connection.OnPacketListener;
import com.xabber.android.data.extension.avatar.AvatarManager; import com.xabber.android.data.extension.avatar.AvatarManager;
import com.xabber.android.data.roster.OnRosterChangedListener; import com.xabber.android.data.roster.OnRosterChangedListener;
...@@ -35,8 +36,8 @@ import com.xabber.android.data.roster.StructuredName; ...@@ -35,8 +36,8 @@ import com.xabber.android.data.roster.StructuredName;
import com.xabber.xmpp.address.Jid; import com.xabber.xmpp.address.Jid;
import com.xabber.xmpp.vcard.VCardProperty; import com.xabber.xmpp.vcard.VCardProperty;
import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ.Type; import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Presence;
...@@ -261,8 +262,14 @@ public class VCardManager implements OnLoadListener, OnPacketListener, ...@@ -261,8 +262,14 @@ public class VCardManager implements OnLoadListener, OnPacketListener,
private void requestVCard(final String account, final String srcUser) { private void requestVCard(final String account, final String srcUser) {
final String user = Jid.getBareAddress(srcUser); final String user = Jid.getBareAddress(srcUser);
final XMPPConnection xmppConnection = AccountManager.getInstance().getAccount(account).getConnectionThread().getXMPPConnection(); ConnectionThread connectionThread = AccountManager.getInstance().getAccount(account).getConnectionThread();
final org.jivesoftware.smackx.vcardtemp.VCardManager vCardManager = org.jivesoftware.smackx.vcardtemp.VCardManager.getInstanceFor(xmppConnection); if (connectionThread == null) {
onVCardFailed(account, user);
return;
}
final org.jivesoftware.smackx.vcardtemp.VCardManager vCardManager
= org.jivesoftware.smackx.vcardtemp.VCardManager.getInstanceFor(connectionThread.getXMPPConnection());
final Thread thread = new Thread("Get vCard user " + user + " for account " + account) { final Thread thread = new Thread("Get vCard user " + user + " for account " + account) {
@Override @Override
...@@ -305,7 +312,13 @@ public class VCardManager implements OnLoadListener, OnPacketListener, ...@@ -305,7 +312,13 @@ public class VCardManager implements OnLoadListener, OnPacketListener,
} }
public void saveVCard(final String account, final VCard vCard) { public void saveVCard(final String account, final VCard vCard) {
final XMPPConnection xmppConnection = AccountManager.getInstance().getAccount(account).getConnectionThread().getXMPPConnection(); ConnectionThread connectionThread = AccountManager.getInstance().getAccount(account).getConnectionThread();
if (connectionThread == null) {
onVCardSaveFailed(account);
return;
}
final AbstractXMPPConnection xmppConnection = connectionThread.getXMPPConnection();
final org.jivesoftware.smackx.vcardtemp.VCardManager vCardManager = org.jivesoftware.smackx.vcardtemp.VCardManager.getInstanceFor(xmppConnection); final org.jivesoftware.smackx.vcardtemp.VCardManager vCardManager = org.jivesoftware.smackx.vcardtemp.VCardManager.getInstanceFor(xmppConnection);
final Thread thread = new Thread("Save vCard for account " + account) { final Thread thread = new Thread("Save vCard for account " + account) {
......
...@@ -73,6 +73,7 @@ public class AccountInfoEditor extends ManagedActivity implements Toolbar.OnMenu ...@@ -73,6 +73,7 @@ public class AccountInfoEditor extends ManagedActivity implements Toolbar.OnMenu
toolbar.inflateMenu(SAVE_MENU); toolbar.inflateMenu(SAVE_MENU);
toolbar.setOnMenuItemClickListener(this); toolbar.setOnMenuItemClickListener(this);
toolbar.getMenu().findItem(R.id.action_save).setEnabled(false);
} }
@Override @Override
...@@ -115,6 +116,10 @@ public class AccountInfoEditor extends ManagedActivity implements Toolbar.OnMenu ...@@ -115,6 +116,10 @@ public class AccountInfoEditor extends ManagedActivity implements Toolbar.OnMenu
@Override @Override
public void onVCardSavingFinished() { public void onVCardSavingFinished() {
toolbar.setTitle(R.string.edit_account_user_info); toolbar.setTitle(R.string.edit_account_user_info);
}
@Override
public void enableSave() {
toolbar.getMenu().findItem(R.id.action_save).setEnabled(true); toolbar.getMenu().findItem(R.id.action_save).setEnabled(true);
} }
} }
...@@ -9,7 +9,6 @@ import android.view.MenuItem; ...@@ -9,7 +9,6 @@ import android.view.MenuItem;
import com.xabber.android.R; import com.xabber.android.R;
import com.xabber.android.data.intent.EntityIntentBuilder; import com.xabber.android.data.intent.EntityIntentBuilder;
import com.xabber.android.data.roster.GroupManager;
import com.xabber.xmpp.address.Jid; import com.xabber.xmpp.address.Jid;
import com.xabber.xmpp.vcard.VCardProperty; import com.xabber.xmpp.vcard.VCardProperty;
...@@ -26,7 +25,7 @@ public class AccountViewer extends ContactViewer implements Toolbar.OnMenuItemCl ...@@ -26,7 +25,7 @@ public class AccountViewer extends ContactViewer implements Toolbar.OnMenuItemCl
public static Intent createIntent(Context context, String account) { public static Intent createIntent(Context context, String account) {
return new EntityIntentBuilder(context, AccountViewer.class) return new EntityIntentBuilder(context, AccountViewer.class)
.setAccount(account).setUser(GroupManager.IS_ACCOUNT).build(); .setAccount(account).setUser(Jid.getBareAddress(account)).build();
} }
@Override @Override
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
<string name="edit_account_user_info">Edit user info</string> <string name="edit_account_user_info">Edit user info</string>
<string name="account_user_info_save_success">Account user info saved successfully</string> <string name="account_user_info_save_success">Account user info saved successfully</string>
<string name="account_user_info_save_fail">Could not save account user info</string> <string name="account_user_info_save_fail">Could not save account user info</string>
<string name="account_user_info_save_started">Saving account user info…</string>
<string name="saving">Saving…</string> <string name="saving">Saving…</string>
<string name="choose_from_gallery">Choose from gallery</string> <string name="choose_from_gallery">Choose from gallery</string>
<string name="take_photo">Take photo</string> <string name="take_photo">Take photo</string>
......
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