diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-03-20 22:04:46 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-03-20 22:04:46 +0100 |
commit | f249b9bf33e2b1c3df0ec164cd21776e662f0841 (patch) | |
tree | deafc2f36955a6e5686e1d340acb3323510386c9 /src/main | |
parent | 76e10f17a62f867116c146d7be9da3ea8dfc311d (diff) |
show own account if multi account is enabled
Diffstat (limited to 'src/main')
7 files changed, 39 insertions, 17 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/BlocklistActivity.java b/src/main/java/de/pixart/messenger/ui/BlocklistActivity.java index 175702b08..22641375a 100644 --- a/src/main/java/de/pixart/messenger/ui/BlocklistActivity.java +++ b/src/main/java/de/pixart/messenger/ui/BlocklistActivity.java @@ -86,7 +86,7 @@ public class BlocklistActivity extends AbstractSearchableListItemActivity implem EnterJidDialog dialog = new EnterJidDialog( this, mKnownHosts, null, getString(R.string.block_jabber_id), getString(R.string.block), - null, account.getJid().toBareJid().toString(), true + null, account.getJid().toBareJid().toString(), true, xmppConnectionService.multipleAccounts() ); dialog.setOnEnterJidDialogPositiveListener(new EnterJidDialog.OnEnterJidDialogPositiveListener() { diff --git a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java index 011c8b051..6ae1d1ff0 100644 --- a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java @@ -207,7 +207,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity { EnterJidDialog dialog = new EnterJidDialog( this, mKnownHosts, mActivatedAccounts, getString(R.string.enter_contact), getString(R.string.select), - null, getIntent().getStringExtra(EXTRA_ACCOUNT), true + null, getIntent().getStringExtra(EXTRA_ACCOUNT), true, xmppConnectionService.multipleAccounts() ); dialog.setOnEnterJidDialogPositiveListener(new EnterJidDialog.OnEnterJidDialogPositiveListener() { diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index fa77b9423..66c64a719 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -617,6 +617,11 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } ConferenceName.setText(mConversation.getName()); mAccountJid.setText(getString(R.string.using_account, account)); + if (xmppConnectionService.multipleAccounts()) { + mAccountJid.setVisibility(View.VISIBLE); + } else { + mAccountJid.setVisibility(View.GONE); + } mYourPhoto.setImageBitmap(avatarService().get(mConversation.getAccount(), getPixel(48))); setTitle(mConversation.getName()); mFullJid.setText(mConversation.getJid().toBareJid().toString()); diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index 824546266..d4b3218ee 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -530,6 +530,12 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp binding.detailsContactBadge.setImageBitmap(avatarService().get(contact, getPixel(Config.AVATAR_SIZE))); binding.detailsContactBadge.setOnClickListener(this.onBadgeClick); + if (xmppConnectionService.multipleAccounts()) { + binding.detailsAccount.setVisibility(View.VISIBLE); + } else { + binding.detailsAccount.setVisibility(View.GONE); + } + binding.detailsContactKeys.removeAllViews(); boolean hasKeys = false; LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); diff --git a/src/main/java/de/pixart/messenger/ui/EnterJidDialog.java b/src/main/java/de/pixart/messenger/ui/EnterJidDialog.java index d43c34ee4..b9ffcb35d 100644 --- a/src/main/java/de/pixart/messenger/ui/EnterJidDialog.java +++ b/src/main/java/de/pixart/messenger/ui/EnterJidDialog.java @@ -1,8 +1,8 @@ package de.pixart.messenger.ui; -import android.support.v7.app.AlertDialog; import android.app.Dialog; import android.content.Context; +import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.widget.ArrayAdapter; @@ -42,13 +42,14 @@ public class EnterJidDialog { public EnterJidDialog( final Context context, List<String> knownHosts, final List<String> activatedAccounts, final String title, final String positiveButton, - final String prefilledJid, final String account, boolean allowEditJid + final String prefilledJid, final String account, boolean allowEditJid, boolean multipleAccounts ) { - AlertDialog.Builder builder = new AlertDialog.Builder(context); + final AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); - View dialogView = LayoutInflater.from(context).inflate(R.layout.enter_jid_dialog, null); + final View dialogView = LayoutInflater.from(context).inflate(R.layout.enter_jid_dialog, null); final TextView jabberIdDesc = dialogView.findViewById(R.id.jabber_id); jabberIdDesc.setText(R.string.account_settings_jabber_id); + final TextView yourAccount = dialogView.findViewById(R.id.your_account); final Spinner spinner = dialogView.findViewById(R.id.account); final AutoCompleteTextView jid = dialogView.findViewById(R.id.jid); jid.setAdapter(new KnownHostsAdapter(context, R.layout.simple_list_item, knownHosts)); @@ -64,6 +65,14 @@ public class EnterJidDialog { jid.setHint(R.string.account_settings_example_jabber_id); + if (multipleAccounts) { + yourAccount.setVisibility(View.VISIBLE); + spinner.setVisibility(View.VISIBLE); + } else { + yourAccount.setVisibility(View.GONE); + spinner.setVisibility(View.GONE); + } + if (account == null) { StartConversationActivity.populateAccountSpinner(context, activatedAccounts, spinner); } else { @@ -130,4 +139,6 @@ public class EnterJidDialog { this.dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(this.dialogOnClick); return this.dialog; } + + } diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index dacc35a8d..8ee4bab96 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -433,7 +433,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU EnterJidDialog dialog = new EnterJidDialog( this, mKnownHosts, mActivatedAccounts, getString(R.string.create_contact), getString(R.string.create), - prefilledJid, null, invite == null || !invite.hasFingerprints() + prefilledJid, null, invite == null || !invite.hasFingerprints(), xmppConnectionService.multipleAccounts() ); dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid) -> { diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml index 35a779cf4..de0549e58 100644 --- a/src/main/res/layout/activity_muc_details.xml +++ b/src/main/res/layout/activity_muc_details.xml @@ -105,6 +105,16 @@ android:textIsSelectable="true" android:visibility="gone" android:textAppearance="@style/TextAppearance.AppCompat.Title" /> + + <TextView + android:id="@+id/details_account" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:layout_marginTop="32dp" + android:text="@string/using_account" + android:visibility="gone" + android:textAppearance="@style/TextAppearance.AppCompat.Caption" /> </LinearLayout> </android.support.v7.widget.CardView> @@ -248,16 +258,6 @@ android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> </TableRow> </TableLayout> - - <TextView - android:id="@+id/details_account" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:layout_marginTop="32dp" - android:text="@string/using_account" - android:visibility="gone" - android:textAppearance="@style/TextAppearance.AppCompat.Caption" /> </LinearLayout> </android.support.v7.widget.CardView> </LinearLayout> |