mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
move email-address to subtitle, this is a unique element also used at other places; copy-to-clipboard goes to the menu
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
android:id="@+id/edit_name"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:title="@string/menu_copy_to_clipboard"
|
||||
android:id="@+id/copy_addr_to_clipboard"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:title="@string/menu_mute"
|
||||
android:id="@+id/menu_mute_notifications"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
@@ -118,7 +118,8 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
avatar.setAvatar(glideRequests, DcHelper.getContext(getContext()).getRecipient(contact), false);
|
||||
title.setText(contact.getDisplayName());
|
||||
title.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||
subtitle.setVisibility(View.GONE);
|
||||
subtitle.setText(contact.getAddr());
|
||||
subtitle.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void hideAvatar() {
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.DcChat;
|
||||
import com.b44t.messenger.DcContact;
|
||||
@@ -34,6 +35,7 @@ import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
import java.io.File;
|
||||
@@ -128,8 +130,10 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
if (chatIsDeviceTalk) {
|
||||
menu.findItem(R.id.edit_name).setVisible(false);
|
||||
menu.findItem(R.id.show_encr_info).setVisible(false);
|
||||
menu.findItem(R.id.copy_addr_to_clipboard).setVisible(false);
|
||||
} else if (chatIsGroup) {
|
||||
menu.findItem(R.id.edit_name).setTitle(R.string.menu_group_name_and_image);
|
||||
menu.findItem(R.id.copy_addr_to_clipboard).setVisible(false);
|
||||
}
|
||||
} else {
|
||||
menu.findItem(R.id.menu_mute_notifications).setVisible(false);
|
||||
@@ -238,7 +242,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
else if (chatId > 0) {
|
||||
DcChat dcChat = dcContext.getChat(chatId);
|
||||
titleView.setTitle(GlideApp.with(this), dcChat, false);
|
||||
titleView.setTitle(GlideApp.with(this), dcChat, isContactProfile());
|
||||
}
|
||||
else if (isContactProfile()){
|
||||
titleView.setTitle(GlideApp.with(this), dcContext.getContact(contactId));
|
||||
@@ -357,6 +361,9 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
case R.id.edit_name:
|
||||
onEditName();
|
||||
break;
|
||||
case R.id.copy_addr_to_clipboard:
|
||||
onCopyAddrToClipboard();
|
||||
break;
|
||||
case R.id.show_encr_info:
|
||||
onEncrInfo();
|
||||
break;
|
||||
@@ -467,6 +474,12 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
}
|
||||
|
||||
private void onCopyAddrToClipboard() {
|
||||
DcContact dcContact = dcContext.getContact(contactId);
|
||||
Util.writeTextToClipboard(this, dcContact.getAddr());
|
||||
Toast.makeText(this, getString(R.string.copied_to_clipboard), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private void onEncrInfo() {
|
||||
String info_str = isContactProfile() ?
|
||||
dcContext.getContactEncrInfo(contactId) : dcContext.getChatEncrInfo(chatId);
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.Set;
|
||||
public class ProfileSettingsAdapter extends RecyclerView.Adapter
|
||||
implements StickyHeaderAdapter<ProfileSettingsAdapter.HeaderViewHolder>
|
||||
{
|
||||
public static final int SETTING_CONTACT_ADDR = 110;
|
||||
public static final int SETTING_NEW_CHAT = 120;
|
||||
|
||||
private final @NonNull Context context;
|
||||
@@ -272,7 +271,6 @@ public class ProfileSettingsAdapter extends RecyclerView.Adapter
|
||||
}
|
||||
else if (sharedChats!=null && dcContact!=null) {
|
||||
itemDataContact = dcContact;
|
||||
itemData.add(new ItemData(ItemData.TYPE_PRIMARY_SETTING, SETTING_CONTACT_ADDR,dcContact.getAddr()));
|
||||
itemData.add(new ItemData(ItemData.TYPE_PRIMARY_SETTING, SETTING_NEW_CHAT, context.getString(R.string.send_message)));
|
||||
itemDataSharedChats = sharedChats;
|
||||
int sharedChatsCnt = sharedChats.getCnt();
|
||||
|
||||
@@ -138,9 +138,6 @@ public class ProfileSettingsFragment extends Fragment
|
||||
@Override
|
||||
public void onSettingsClicked(int settingsId) {
|
||||
switch(settingsId) {
|
||||
case ProfileSettingsAdapter.SETTING_CONTACT_ADDR:
|
||||
onContactAddrClicked();
|
||||
break;
|
||||
case ProfileSettingsAdapter.SETTING_NEW_CHAT:
|
||||
onNewChat();
|
||||
break;
|
||||
@@ -212,21 +209,6 @@ public class ProfileSettingsFragment extends Fragment
|
||||
getActivity().finish();
|
||||
}
|
||||
|
||||
private void onContactAddrClicked() {
|
||||
String address = dcContext.getContact(contactId).getAddr();
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setTitle(address)
|
||||
.setItems(new CharSequence[]{
|
||||
getContext().getString(R.string.menu_copy_to_clipboard)
|
||||
},
|
||||
(dialogInterface, i) -> {
|
||||
Util.writeTextToClipboard(getContext(), address);
|
||||
Toast.makeText(getContext(), getString(R.string.copied_to_clipboard), Toast.LENGTH_SHORT).show();
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void onNewChat() {
|
||||
DcContact dcContact = dcContext.getContact(contactId);
|
||||
int chatId = dcContext.createChatByContactId(dcContact.getId());
|
||||
|
||||
Reference in New Issue
Block a user