mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-01-07 00:20:08 +02:00
Chat view by default and add a privacy indicator
This commit is contained in:
parent
9a08f5eb5f
commit
6e15bc93d1
4 changed files with 39 additions and 3 deletions
|
@ -211,7 +211,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
//--- DATE ---
|
//--- DATE ---
|
||||||
holder.binding.lastMessageDate.setText(Helper.dateDiff(context, conversation.last_status.created_at));
|
holder.binding.lastMessageDate.setText(Helper.dateDiff(context, conversation.last_status.created_at));
|
||||||
|
|
||||||
boolean chatMode = sharedpreferences.getBoolean(context.getString(R.string.SET_CHAT_FOR_CONVERSATION), false);
|
boolean chatMode = sharedpreferences.getBoolean(context.getString(R.string.SET_CHAT_FOR_CONVERSATION), true);
|
||||||
holder.binding.statusContent.setOnClickListener(v -> {
|
holder.binding.statusContent.setOnClickListener(v -> {
|
||||||
Intent intent;
|
Intent intent;
|
||||||
if (chatMode) {
|
if (chatMode) {
|
||||||
|
|
|
@ -260,6 +260,26 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
|
||||||
}
|
}
|
||||||
MastodonHelper.loadPPMastodon(holder.binding.userPp, status.account);
|
MastodonHelper.loadPPMastodon(holder.binding.userPp, status.account);
|
||||||
holder.binding.date.setText(Helper.longDateToString(status.created_at));
|
holder.binding.date.setText(Helper.longDateToString(status.created_at));
|
||||||
|
|
||||||
|
if (status.visibility.equalsIgnoreCase("direct")) {
|
||||||
|
holder.binding.visibility.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
int ressource = R.drawable.ic_baseline_public_24;
|
||||||
|
holder.binding.visibility.setContentDescription(context.getString(R.string.v_public));
|
||||||
|
switch (status.visibility) {
|
||||||
|
case "unlisted":
|
||||||
|
holder.binding.visibility.setContentDescription(context.getString(R.string.v_unlisted));
|
||||||
|
ressource = R.drawable.ic_baseline_lock_open_24;
|
||||||
|
break;
|
||||||
|
case "private":
|
||||||
|
ressource = R.drawable.ic_baseline_lock_24;
|
||||||
|
holder.binding.visibility.setContentDescription(context.getString(R.string.v_private));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
holder.binding.visibility.setImageResource(ressource);
|
||||||
|
holder.binding.visibility.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
//Owner account
|
//Owner account
|
||||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
@ -270,12 +290,14 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
|
||||||
holder.binding.date.setTextColor(ThemeHelper.getAttColor(context, R.attr.colorOnSecondary));
|
holder.binding.date.setTextColor(ThemeHelper.getAttColor(context, R.attr.colorOnSecondary));
|
||||||
holder.binding.messageContent.setTextColor(ThemeHelper.getAttColor(context, R.attr.colorOnSecondary));
|
holder.binding.messageContent.setTextColor(ThemeHelper.getAttColor(context, R.attr.colorOnSecondary));
|
||||||
holder.binding.userName.setTextColor(ThemeHelper.getAttColor(context, R.attr.colorOnSecondary));
|
holder.binding.userName.setTextColor(ThemeHelper.getAttColor(context, R.attr.colorOnSecondary));
|
||||||
|
Helper.changeDrawableColor(context, holder.binding.visibility, ThemeHelper.getAttColor(context, R.attr.colorOnSecondary));
|
||||||
} else {
|
} else {
|
||||||
holder.binding.mainContainer.setBackgroundResource(R.drawable.bubble_left_tail);
|
holder.binding.mainContainer.setBackgroundResource(R.drawable.bubble_left_tail);
|
||||||
layoutParams.setMargins(0, (int) Helper.convertDpToPixel(12, context), (int) Helper.convertDpToPixel(50, context), 0);
|
layoutParams.setMargins(0, (int) Helper.convertDpToPixel(12, context), (int) Helper.convertDpToPixel(50, context), 0);
|
||||||
holder.binding.date.setTextColor(ContextCompat.getColor(context, R.color.black));
|
holder.binding.date.setTextColor(ContextCompat.getColor(context, R.color.black));
|
||||||
holder.binding.messageContent.setTextColor(ContextCompat.getColor(context, R.color.black));
|
holder.binding.messageContent.setTextColor(ContextCompat.getColor(context, R.color.black));
|
||||||
holder.binding.userName.setTextColor(ContextCompat.getColor(context, R.color.black));
|
holder.binding.userName.setTextColor(ContextCompat.getColor(context, R.color.black));
|
||||||
|
Helper.changeDrawableColor(context, holder.binding.visibility, R.color.black);
|
||||||
}
|
}
|
||||||
holder.binding.mainContainer.setLayoutParams(layoutParams);
|
holder.binding.mainContainer.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,26 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:textColor="?attr/colorOnPrimary"
|
android:textColor="?attr/colorOnPrimary"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@+id/visibility"
|
||||||
app:layout_constraintStart_toEndOf="@+id/user_pp"
|
app:layout_constraintStart_toEndOf="@+id/user_pp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/date"
|
app:layout_constraintBottom_toTopOf="@+id/date"
|
||||||
tools:text="@tools:sample/full_names" />
|
tools:text="@tools:sample/full_names" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/visibility"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/user_name"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/date"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:tint="?attr/colorOnPrimary"
|
||||||
|
tools:src="@drawable/ic_baseline_public_24"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/date"
|
android:id="@+id/date"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
app:singleLineTitle="false"
|
app:singleLineTitle="false"
|
||||||
app:title="@string/group_reblogs" />
|
app:title="@string/group_reblogs" />
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="false"
|
android:defaultValue="true"
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
app:key="@string/SET_CHAT_FOR_CONVERSATION"
|
app:key="@string/SET_CHAT_FOR_CONVERSATION"
|
||||||
app:singleLineTitle="false"
|
app:singleLineTitle="false"
|
||||||
|
|
Loading…
Reference in a new issue