mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
make the button look more like a button
This commit is contained in:
@@ -62,22 +62,24 @@ public class ProfileSettingsAdapter extends RecyclerView.Adapter
|
||||
int chatlistIndex;
|
||||
int settingsId;
|
||||
String label;
|
||||
int labelColor;
|
||||
int iconLeft;
|
||||
|
||||
ItemData(int type, int settingsId, String label, int iconLeft) {
|
||||
this(type, 0, 0, settingsId, label, iconLeft);
|
||||
ItemData(int type, int settingsId, String label, int labelColor, int iconLeft) {
|
||||
this(type, 0, 0, settingsId, label, labelColor, iconLeft);
|
||||
}
|
||||
|
||||
ItemData(int type, int contactId, int chatlistIndex) {
|
||||
this(type, contactId, chatlistIndex, 0, null, 0);
|
||||
this(type, contactId, chatlistIndex, 0, null, 0, 0);
|
||||
}
|
||||
|
||||
ItemData(int type, int contactId, int chatlistIndex, int settingsId, @Nullable String label, int iconLeft) {
|
||||
ItemData(int type, int contactId, int chatlistIndex, int settingsId, @Nullable String label, int labelColor, int iconLeft) {
|
||||
this.type = type;
|
||||
this.contactId = contactId;
|
||||
this.chatlistIndex = chatlistIndex;
|
||||
this.settingsId = settingsId;
|
||||
this.label = label;
|
||||
this.labelColor = labelColor;
|
||||
this.iconLeft = iconLeft;
|
||||
}
|
||||
};
|
||||
@@ -194,7 +196,7 @@ public class ProfileSettingsAdapter extends RecyclerView.Adapter
|
||||
int settingsId = itemData.get(i).settingsId;
|
||||
ProfileSettingsItem profileSettingsItem = (ProfileSettingsItem) holder.itemView;
|
||||
profileSettingsItem.setOnClickListener(view -> clickListener.onSettingsClicked(settingsId));
|
||||
profileSettingsItem.set(itemData.get(i).label, itemData.get(i).iconLeft);
|
||||
profileSettingsItem.set(itemData.get(i).label, itemData.get(i).labelColor, itemData.get(i).iconLeft);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,14 +322,14 @@ public class ProfileSettingsAdapter extends RecyclerView.Adapter
|
||||
if (!dcContact.getVerifierAddr().isEmpty()) {
|
||||
verifiedInfo = context.getString(R.string.verified_by, dcContact.getVerifierAddr());
|
||||
}
|
||||
itemData.add(new ItemData(ItemData.TYPE_PRIMARY_SETTING, SETTING_VERIFIED, verifiedInfo, R.drawable.ic_verified));
|
||||
itemData.add(new ItemData(ItemData.TYPE_PRIMARY_SETTING, SETTING_VERIFIED, verifiedInfo, 0, R.drawable.ic_verified));
|
||||
}
|
||||
itemData.add(new ItemData(ItemData.TYPE_PRIMARY_SETTING, SETTING_SEND_MESSAGE, context.getString(R.string.send_message), 0));
|
||||
itemData.add(new ItemData(ItemData.TYPE_PRIMARY_SETTING, SETTING_SEND_MESSAGE, context.getString(R.string.send_message), R.color.delta_accent, 0));
|
||||
}
|
||||
|
||||
itemDataStatusText = dcContact.getStatus();
|
||||
if (!itemDataStatusText.isEmpty()) {
|
||||
itemData.add(new ItemData(ItemData.TYPE_STATUS, 0, itemDataStatusText, 0));
|
||||
itemData.add(new ItemData(ItemData.TYPE_STATUS, 0, itemDataStatusText, 0, 0));
|
||||
}
|
||||
|
||||
itemDataSharedChats = sharedChats;
|
||||
|
||||
@@ -5,6 +5,10 @@ import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import org.thoughtcrime.securesms.util.ResUtil;
|
||||
|
||||
public class ProfileSettingsItem extends LinearLayout {
|
||||
|
||||
private TextView labelView;
|
||||
@@ -23,8 +27,15 @@ public class ProfileSettingsItem extends LinearLayout {
|
||||
labelView = findViewById(R.id.label);
|
||||
}
|
||||
|
||||
public void set(String label, int iconLeft) {
|
||||
public void set(String label, int labelColor, int iconLeft) {
|
||||
labelView.setText(label==null? "" : label);
|
||||
labelView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, 0,0,0);
|
||||
|
||||
// we need different color getters as `labelColor` is `R.color.name` while default is `R.attr.name`
|
||||
if (labelColor != 0) {
|
||||
labelView.setTextColor(ContextCompat.getColor(getContext(), labelColor));
|
||||
} else {
|
||||
labelView.setTextColor(ResUtil.getColor(getContext(), R.attr.emoji_text_color)); //
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user