mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-15 13:35:04 -05:00
proper account send to publish avatar activity
This commit is contained in:
parent
5073069adb
commit
629ff3afcd
@ -100,7 +100,9 @@ public class ManageAccountActivity extends XmppActivity {
|
|||||||
.updateAccount(selectedAccountForActionMode);
|
.updateAccount(selectedAccountForActionMode);
|
||||||
mode.finish();
|
mode.finish();
|
||||||
} else if (item.getItemId() == R.id.mgmt_account_publish_avatar) {
|
} else if (item.getItemId() == R.id.mgmt_account_publish_avatar) {
|
||||||
startActivity(new Intent(getApplicationContext(), PublishProfilePictureActivity.class));
|
Intent intent = new Intent(getApplicationContext(), PublishProfilePictureActivity.class);
|
||||||
|
intent.putExtra("account", selectedAccountForActionMode.getJid());
|
||||||
|
startActivity(intent);
|
||||||
} else if (item.getItemId() == R.id.mgmt_account_delete) {
|
} else if (item.getItemId() == R.id.mgmt_account_delete) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||||
builder.setTitle(getString(R.string.mgmt_account_are_you_sure));
|
builder.setTitle(getString(R.string.mgmt_account_are_you_sure));
|
||||||
|
@ -11,6 +11,7 @@ import android.widget.Button;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.utils.PhoneHelper;
|
import eu.siacs.conversations.utils.PhoneHelper;
|
||||||
|
|
||||||
public class PublishProfilePictureActivity extends XmppActivity {
|
public class PublishProfilePictureActivity extends XmppActivity {
|
||||||
@ -24,6 +25,8 @@ public class PublishProfilePictureActivity extends XmppActivity {
|
|||||||
|
|
||||||
private Uri avatarUri;
|
private Uri avatarUri;
|
||||||
|
|
||||||
|
private Account account;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -37,7 +40,7 @@ public class PublishProfilePictureActivity extends XmppActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (avatarUri!=null) {
|
if (avatarUri!=null) {
|
||||||
xmppConnectionService.pushAvatar(null, avatarUri);
|
xmppConnectionService.pushAvatar(account, avatarUri);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,7 +70,6 @@ public class PublishProfilePictureActivity extends XmppActivity {
|
|||||||
protected void onActivityResult(int requestCode, int resultCode,
|
protected void onActivityResult(int requestCode, int resultCode,
|
||||||
final Intent data) {
|
final Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
Log.d("xmppService","on activity result");
|
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
if (requestCode == REQUEST_CHOOSE_FILE) {
|
if (requestCode == REQUEST_CHOOSE_FILE) {
|
||||||
Log.d("xmppService","bla");
|
Log.d("xmppService","bla");
|
||||||
@ -78,14 +80,20 @@ public class PublishProfilePictureActivity extends XmppActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBackendConnected() {
|
protected void onBackendConnected() {
|
||||||
Log.d("xmppService","on backend connected");
|
if (getIntent()!=null) {
|
||||||
|
String jid = getIntent().getStringExtra("account");
|
||||||
|
if (jid!=null) {
|
||||||
|
this.account = xmppConnectionService.findAccountByJid(jid);
|
||||||
if (this.avatarUri == null) {
|
if (this.avatarUri == null) {
|
||||||
avatarUri = PhoneHelper.getSefliUri(getApplicationContext());
|
avatarUri = PhoneHelper.getSefliUri(getApplicationContext());
|
||||||
}
|
}
|
||||||
loadImageIntoPreview(avatarUri);
|
loadImageIntoPreview(avatarUri);
|
||||||
String explainText = getString(R.string.publish_avatar_explanation,"daniel@gultsch.de");
|
String explainText = getString(R.string.publish_avatar_explanation,account.getJid());
|
||||||
this.explanation.setText(explainText);
|
this.explanation.setText(explainText);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected void loadImageIntoPreview(Uri uri) {
|
protected void loadImageIntoPreview(Uri uri) {
|
||||||
Bitmap bm = xmppConnectionService.getFileBackend().cropCenterSquare(uri, 384);
|
Bitmap bm = xmppConnectionService.getFileBackend().cropCenterSquare(uri, 384);
|
||||||
|
Loading…
Reference in New Issue
Block a user