deltachat/src/main/java/org/thoughtcrime/securesms/ProfileTextItem.java
bjoern 4663299951
re-focus profile (#3792)
* duplicate ProfileActivity to AllMediaActivity

* update CHANGELOG

* remove profile stuff from AllMediaActivity

* remove media stuff from ProfileActivity

* remove TabLayout from ProfileActivity

* decouple header from viewType

* easier name editing

* add link to 'apps & media'

* move bio up

* move 'send message' up

* prepare avatar/title/subtitle

* set title

* set subtitle to member count

* add address to profile

* rename ProfileSettings* to just Profile*

* set avatar

* use avatar view

* adaptive avatar cell height

* no endless growing of online-indicator

* simplify

* handle tap on avatars

* rename Profile* to AllMedia*

* set title accordingly

* move 'last seen' up

* edit name by tapping

* Revert "edit name by tapping"

This reverts commit 6727b16830.

Reason is that it introduces uncertainity what happens if the name is tapped -
we do not want to nudge ppl to edit the group name in a similar way.

we may revert this revert,
but for now, let's see if the icon atop isn't sufficient.

* add media count

* space below avatar

* refactor allmedia viewtypes

* select the first tab that has content

* format footer

* remove unused headers

* space above header

* add dividers

* tweak some spacings

* tap on avatar only for enlarge/set avatar

* immediate view of first tap

* tweak value display

* add icons to buttons

* tweak paddings

* no address for self-talk and device-chat

* use signature background for less cluttered UI

* avoid global state modification and showing eg. app-icon tinted also elsewhere

* tweak sizes

* move introduced-by/server down. these information become less important the more chats you have with the contact - and otherwise just clutter UI

* update CHANGELOG

* typo

* use more normal font and spacing for footer

* open "media" deterministically

remove the smart forwarding to "tab with content",
which results in unclear behaviour.

also, we want to push for apps,
which is also the thing that really changes.
when searching for an image, another tap is fine.
2025-07-05 11:16:30 +02:00

57 lines
1.6 KiB
Java

package org.thoughtcrime.securesms;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import org.thoughtcrime.securesms.util.ResUtil;
public class ProfileTextItem extends LinearLayout {
private TextView labelView;
private @Nullable TextView valueView;
public ProfileTextItem(Context context) {
super(context);
}
public ProfileTextItem(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
labelView = findViewById(R.id.label);
valueView = findViewById(R.id.value);
}
public void set(String label, int icon) {
labelView.setText(label);
if (icon != 0) {
Drawable orgDrawable = ContextCompat.getDrawable(getContext(), icon);
if (orgDrawable != null) {
Drawable drawable = orgDrawable.mutate(); // avoid global state modification and showing eg. app-icon tinted also elsewhere
drawable = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(drawable, getResources().getColor(R.color.delta_accent));
labelView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
}
}
}
public void setValue(String value) {
if (valueView != null) {
valueView.setText(value);
valueView.setVisibility(View.VISIBLE);
}
}
}