mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 09:49:21 +02:00
tweak archive (#2441)
* basic layout of new archive-link, including icon and unread counter * remove 'archived chats' from main menu * vertically align elements of new archive-link * show unread indicator also for archived chats * show muted unread counter in grey * use shorter label for the 'Archive' link
This commit is contained in:
parent
4f6fb1cd15
commit
fc542dbe7e
10 changed files with 30 additions and 102 deletions
|
@ -146,7 +146,7 @@
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity android:name=".ConversationListArchiveActivity"
|
<activity android:name=".ConversationListArchiveActivity"
|
||||||
android:label="@string/chat_archived_chats_title"
|
android:label="@string/chat_archived_label"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
||||||
android:parentActivityName=".ConversationListActivity">
|
android:parentActivityName=".ConversationListActivity">
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<org.thoughtcrime.securesms.ConversationListItemAction
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="70dp">
|
|
||||||
|
|
||||||
<TextView android:id="@+id/description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
tools:text="Archived conversations (2)"/>
|
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.ConversationListItemAction>
|
|
|
@ -10,9 +10,6 @@
|
||||||
<item android:title="@string/menu_new_chat"
|
<item android:title="@string/menu_new_chat"
|
||||||
android:id="@+id/menu_new_chat" />
|
android:id="@+id/menu_new_chat" />
|
||||||
|
|
||||||
<item android:title="@string/chat_archived_chats_title"
|
|
||||||
android:id="@+id/menu_archived_chats" />
|
|
||||||
|
|
||||||
<item android:title="@string/menu_show_global_map"
|
<item android:title="@string/menu_show_global_map"
|
||||||
android:id="@+id/menu_global_map"
|
android:id="@+id/menu_global_map"
|
||||||
android:visible="false"
|
android:visible="false"
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
<color name="primary_alpha33">#552090ea</color>
|
<color name="primary_alpha33">#552090ea</color>
|
||||||
|
|
||||||
<color name="unread_count">#ff3792fc</color>
|
<color name="unread_count">#ff3792fc</color>
|
||||||
|
<color name="unread_count_muted">#b6b6bb</color>
|
||||||
|
<color name="unread_count_muted_dark">#3b3b3b</color>
|
||||||
|
|
||||||
<color name="white">#ffffffff</color>
|
<color name="white">#ffffffff</color>
|
||||||
<color name="black">#ff000000</color>
|
<color name="black">#ff000000</color>
|
||||||
|
|
|
@ -317,9 +317,6 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||||
case R.id.menu_new_chat:
|
case R.id.menu_new_chat:
|
||||||
createChat();
|
createChat();
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_archived_chats:
|
|
||||||
onSwitchToArchive();
|
|
||||||
return true;
|
|
||||||
case R.id.menu_settings:
|
case R.id.menu_settings:
|
||||||
startActivity(new Intent(this, ApplicationPreferencesActivity.class));
|
startActivity(new Intent(this, ApplicationPreferencesActivity.class));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -32,6 +32,7 @@ import com.b44t.messenger.DcLot;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||||
|
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -101,14 +102,15 @@ class ConversationListAdapter extends RecyclerView.Adapter {
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
if (viewType == MESSAGE_TYPE_SWITCH_ARCHIVE) {
|
if (viewType == MESSAGE_TYPE_SWITCH_ARCHIVE) {
|
||||||
ConversationListItemAction action = (ConversationListItemAction) inflater.inflate(R.layout.conversation_list_item_action,
|
final ConversationListItem item = (ConversationListItem)inflater.inflate(R.layout.conversation_list_item_view, parent, false);
|
||||||
parent, false);
|
item.getLayoutParams().height = ViewUtil.dpToPx(54);
|
||||||
|
item.findViewById(R.id.subject).setVisibility(View.GONE);
|
||||||
action.setOnClickListener(v -> {
|
item.findViewById(R.id.date).setVisibility(View.GONE);
|
||||||
|
item.setOnClickListener(v -> {
|
||||||
if (clickListener != null) clickListener.onSwitchToArchive();
|
if (clickListener != null) clickListener.onSwitchToArchive();
|
||||||
});
|
});
|
||||||
|
|
||||||
return new ViewHolder(action);
|
return new ViewHolder(item);
|
||||||
} else if (viewType == MESSAGE_TYPE_INBOX_ZERO) {
|
} else if (viewType == MESSAGE_TYPE_INBOX_ZERO) {
|
||||||
return new ViewHolder((ConversationListItemInboxZero)inflater.inflate(R.layout.conversation_list_item_inbox_zero, parent, false));
|
return new ViewHolder((ConversationListItemInboxZero)inflater.inflate(R.layout.conversation_list_item_inbox_zero, parent, false));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,9 +33,9 @@ public class ConversationListArchiveActivity extends PassphraseRequiredActionBar
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
if (isRelayingMessageContent(this)) {
|
if (isRelayingMessageContent(this)) {
|
||||||
getSupportActionBar().setTitle(isSharing(this) ? R.string.chat_share_with_title : R.string.forward_to);
|
getSupportActionBar().setTitle(isSharing(this) ? R.string.chat_share_with_title : R.string.forward_to);
|
||||||
getSupportActionBar().setSubtitle(R.string.chat_archived_chats_title);
|
getSupportActionBar().setSubtitle(R.string.chat_archived_label);
|
||||||
} else {
|
} else {
|
||||||
getSupportActionBar().setTitle(R.string.chat_archived_chats_title);
|
getSupportActionBar().setTitle(R.string.chat_archived_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class ConversationListItem extends RelativeLayout
|
||||||
thread.isSendingLocations()? R.drawable.ic_location_chatlist : 0, 0
|
thread.isSendingLocations()? R.drawable.ic_location_chatlist : 0, 0
|
||||||
);
|
);
|
||||||
|
|
||||||
setStatusIcons(thread.getVisibility(), state, unreadCount, thread.isContactRequest());
|
setStatusIcons(thread.getVisibility(), state, unreadCount, thread.isContactRequest(), thread.isMuted() || chatId == DcChat.DC_CHAT_ID_ARCHIVED_LINK);
|
||||||
setBatchState(batchMode);
|
setBatchState(batchMode);
|
||||||
setBgColor(thread);
|
setBgColor(thread);
|
||||||
|
|
||||||
|
@ -250,39 +250,23 @@ public class ConversationListItem extends RelativeLayout
|
||||||
return msgId;
|
return msgId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setStatusIcons(int visibility, int state, int unreadCount, boolean isContactRequest) {
|
private void setStatusIcons(int visibility, int state, int unreadCount, boolean isContactRequest, boolean isMuted) {
|
||||||
if (visibility==DcChat.DC_CHAT_VISIBILITY_ARCHIVED)
|
if (visibility==DcChat.DC_CHAT_VISIBILITY_ARCHIVED)
|
||||||
{
|
{
|
||||||
archivedBadgeView.setVisibility(View.VISIBLE);
|
archivedBadgeView.setVisibility(View.VISIBLE);
|
||||||
requestBadgeView.setVisibility(isContactRequest ? View.VISIBLE : View.GONE);
|
requestBadgeView.setVisibility(isContactRequest ? View.VISIBLE : View.GONE);
|
||||||
deliveryStatusIndicator.setNone();
|
deliveryStatusIndicator.setNone();
|
||||||
unreadIndicator.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
else if (isContactRequest) {
|
else if (isContactRequest) {
|
||||||
requestBadgeView.setVisibility(View.VISIBLE);
|
requestBadgeView.setVisibility(View.VISIBLE);
|
||||||
archivedBadgeView.setVisibility(View.GONE);
|
archivedBadgeView.setVisibility(View.GONE);
|
||||||
deliveryStatusIndicator.setNone();
|
deliveryStatusIndicator.setNone();
|
||||||
unreadIndicator.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
requestBadgeView.setVisibility(View.GONE);
|
requestBadgeView.setVisibility(View.GONE);
|
||||||
archivedBadgeView.setVisibility(View.GONE);
|
archivedBadgeView.setVisibility(View.GONE);
|
||||||
|
|
||||||
if(unreadCount==0) {
|
|
||||||
unreadIndicator.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
unreadIndicator.setImageDrawable(TextDrawable.builder()
|
|
||||||
.beginConfig()
|
|
||||||
.width(ViewUtil.dpToPx(getContext(), 24))
|
|
||||||
.height(ViewUtil.dpToPx(getContext(), 24))
|
|
||||||
.textColor(Color.WHITE)
|
|
||||||
.bold()
|
|
||||||
.endConfig()
|
|
||||||
.buildRound(String.valueOf(unreadCount), getResources().getColor(R.color.unread_count)));
|
|
||||||
unreadIndicator.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == DcMsg.DC_STATE_OUT_FAILED) {
|
if (state == DcMsg.DC_STATE_OUT_FAILED) {
|
||||||
deliveryStatusIndicator.setFailed();
|
deliveryStatusIndicator.setFailed();
|
||||||
} else if (state == DcMsg.DC_STATE_OUT_MDN_RCVD) {
|
} else if (state == DcMsg.DC_STATE_OUT_MDN_RCVD) {
|
||||||
|
@ -303,6 +287,21 @@ public class ConversationListItem extends RelativeLayout
|
||||||
deliveryStatusIndicator.resetTint();
|
deliveryStatusIndicator.resetTint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(unreadCount==0 || isContactRequest) {
|
||||||
|
unreadIndicator.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
final int color = getResources().getColor(isMuted ? (ThemeUtil.isDarkTheme(getContext()) ? R.color.unread_count_muted_dark : R.color.unread_count_muted) : R.color.unread_count);
|
||||||
|
unreadIndicator.setImageDrawable(TextDrawable.builder()
|
||||||
|
.beginConfig()
|
||||||
|
.width(ViewUtil.dpToPx(getContext(), 24))
|
||||||
|
.height(ViewUtil.dpToPx(getContext(), 24))
|
||||||
|
.textColor(Color.WHITE)
|
||||||
|
.bold()
|
||||||
|
.endConfig()
|
||||||
|
.buildRound(String.valueOf(unreadCount), color));
|
||||||
|
unreadIndicator.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBgColor(ThreadRecord thread) {
|
private void setBgColor(ThreadRecord thread) {
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
package org.thoughtcrime.securesms;
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Build;
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.b44t.messenger.DcLot;
|
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
|
||||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
|
||||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class ConversationListItemAction extends LinearLayout implements BindableConversationListItem {
|
|
||||||
|
|
||||||
private TextView description;
|
|
||||||
|
|
||||||
public ConversationListItemAction(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConversationListItemAction(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
|
||||||
public ConversationListItemAction(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFinishInflate() {
|
|
||||||
super.onFinishInflate();
|
|
||||||
this.description = ViewUtil.findById(this, R.id.description);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bind(@NonNull ThreadRecord thread, int msgId, @NonNull DcLot dcSummary, @NonNull GlideRequests glideRequests, @NonNull Locale locale, @NonNull Set<Long> selectedThreads, boolean batchMode) {
|
|
||||||
this.description.setText(thread.getRecipient().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unbind() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -146,7 +146,7 @@ public class DcHelper {
|
||||||
dcContext.setStockTranslation(35, context.getString(R.string.contact_verified));
|
dcContext.setStockTranslation(35, context.getString(R.string.contact_verified));
|
||||||
dcContext.setStockTranslation(36, context.getString(R.string.contact_not_verified));
|
dcContext.setStockTranslation(36, context.getString(R.string.contact_not_verified));
|
||||||
dcContext.setStockTranslation(37, context.getString(R.string.contact_setup_changed));
|
dcContext.setStockTranslation(37, context.getString(R.string.contact_setup_changed));
|
||||||
dcContext.setStockTranslation(40, context.getString(R.string.chat_archived_chats_title));
|
dcContext.setStockTranslation(40, context.getString(R.string.chat_archived_label));
|
||||||
dcContext.setStockTranslation(42, context.getString(R.string.autocrypt_asm_subject));
|
dcContext.setStockTranslation(42, context.getString(R.string.autocrypt_asm_subject));
|
||||||
dcContext.setStockTranslation(43, context.getString(R.string.autocrypt_asm_general_body));
|
dcContext.setStockTranslation(43, context.getString(R.string.autocrypt_asm_general_body));
|
||||||
dcContext.setStockTranslation(60, context.getString(R.string.login_error_cannot_login));
|
dcContext.setStockTranslation(60, context.getString(R.string.login_error_cannot_login));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue