diff --git a/app/core/src/main/java/com/fsck/k9/K9.kt b/app/core/src/main/java/com/fsck/k9/K9.kt index 1fe5fafaa4132876a6166163dd41e3f7cd8632dd..b4cd2e65bdab6f7144585bf4ddf54f5eeeba965d 100644 --- a/app/core/src/main/java/com/fsck/k9/K9.kt +++ b/app/core/src/main/java/com/fsck/k9/K9.kt @@ -169,13 +169,13 @@ object K9 : EarlyInit { var isShowMessageListStars = true @JvmStatic - var messageListPreviewLines = 2 + var messageListPreviewLines = 1 @JvmStatic var isShowCorrespondentNames = true @JvmStatic - var isMessageListSenderAboveSubject = false + var isMessageListSenderAboveSubject = true @JvmStatic var isShowContactName = false @@ -234,7 +234,7 @@ object K9 : EarlyInit { private val sortAscending = mutableMapOf() @JvmStatic - var isUseBackgroundAsUnreadIndicator = false + var isUseBackgroundAsUnreadIndicator = true @get:Synchronized @set:Synchronized @@ -316,9 +316,9 @@ object K9 : EarlyInit { isUseVolumeKeysForListNavigation = storage.getBoolean("useVolumeKeysForListNavigation", false) isShowUnifiedInbox = storage.getBoolean("showUnifiedInbox", true) isShowStarredCount = storage.getBoolean("showStarredCount", false) - isMessageListSenderAboveSubject = storage.getBoolean("messageListSenderAboveSubject", false) + isMessageListSenderAboveSubject = storage.getBoolean("messageListSenderAboveSubject", true) isShowMessageListStars = storage.getBoolean("messageListStars", true) - messageListPreviewLines = storage.getInt("messageListPreviewLines", 2) + messageListPreviewLines = storage.getInt("messageListPreviewLines", 1) isAutoFitWidth = storage.getBoolean("autofitWidth", true) @@ -361,7 +361,7 @@ object K9 : EarlyInit { splitViewMode = storage.getEnum("splitViewMode", SplitViewMode.NEVER) - isUseBackgroundAsUnreadIndicator = storage.getBoolean("useBackgroundAsUnreadIndicator", false) + isUseBackgroundAsUnreadIndicator = storage.getBoolean("useBackgroundAsUnreadIndicator", true) isThreadedViewEnabled = storage.getBoolean("threadedView", true) fontSizes.load(storage) diff --git a/app/k9mail-jmap/src/main/res/layout/fragment_add_account.xml b/app/k9mail-jmap/src/main/res/layout/fragment_add_account.xml index fe5d1701389231beec207c85d93dcd999695c92f..2a4a672b917afa1cb767ba5583b80c4a2d8f913f 100644 --- a/app/k9mail-jmap/src/main/res/layout/fragment_add_account.xml +++ b/app/k9mail-jmap/src/main/res/layout/fragment_add_account.xml @@ -107,6 +107,7 @@ android:enabled="@{viewModel.isNextButtonEnabled()}" android:onClick="@{() -> viewModel.onNextButtonClicked()}" android:text="@string/next_action" + android:textColor="@android:color/white" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/emailPasswordLayout" diff --git a/app/k9mail-jmap/src/main/res/values/themes.xml b/app/k9mail-jmap/src/main/res/values/themes.xml index 700b046c83e1ea06bdcda35a463f0209ef1f4e38..092f7eb934696f27557acfa698a642282382d040 100644 --- a/app/k9mail-jmap/src/main/res/values/themes.xml +++ b/app/k9mail-jmap/src/main/res/values/themes.xml @@ -93,7 +93,7 @@ @drawable/ic_messagelist_forwarded @drawable/ic_messagelist_answered_forwarded @drawable/btn_check_star - #fbbc04 + #EB621E #ffffffff @drawable/ic_person_plus #e8e8e8 @@ -212,7 +212,7 @@ @drawable/ic_messagelist_forwarded @drawable/ic_messagelist_answered_forwarded @drawable/btn_check_star - #fdd663 + #EB621E #000000 @drawable/ic_person_plus #313131 diff --git a/app/k9mail/src/main/res/values-night/colors.xml b/app/k9mail/src/main/res/values-night/colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..8289f8c154fb7ecdb29942b1549b45b603fae3bc --- /dev/null +++ b/app/k9mail/src/main/res/values-night/colors.xml @@ -0,0 +1,5 @@ + + + #1FFFFFFF + #61FFFFFF + \ No newline at end of file diff --git a/app/k9mail/src/main/res/values/colors.xml b/app/k9mail/src/main/res/values/colors.xml index 0abca75b7f0c80c5248a00902ad64f6aa3c84c6d..cfe20f6213607e7e1216835b499735545620e575 100644 --- a/app/k9mail/src/main/res/values/colors.xml +++ b/app/k9mail/src/main/res/values/colors.xml @@ -8,4 +8,10 @@ @lineageos.platform:color/color_default_primary_text @lineageos.platform:color/color_default_secondary_text @lineageos.platform:color/color_default_divider + @lineageos.platform:color/color_default_gray1 + @lineageos.platform:color/color_default_gray2 + + @lineageos.platform:color/color_default_selector_background + #1F000000 + #61000000 \ No newline at end of file diff --git a/app/k9mail/src/main/res/values/themes.xml b/app/k9mail/src/main/res/values/themes.xml index 1fd70067e1943617e402000662f0df86b50f20be..1a3da0b4b82bddd8382745afe07f832dcab288b7 100644 --- a/app/k9mail/src/main/res/values/themes.xml +++ b/app/k9mail/src/main/res/values/themes.xml @@ -86,15 +86,15 @@ @drawable/ic_import_status @color/color_default_primary_text @color/color_default_secondary_text - #8038B8E2 - #c0cdcdcd - #00ffffff + @color/color_message_list_selected_background + @color/color_default_background + @color/color_message_list_unread_background ?android:attr/colorBackground @drawable/thread_count_box_light - #ff2ea7d1 - #ff696969 + @color/color_default_accent + @color/color_default_secondary_text @color/color_default_divider - #bbbbbb + @color/default_icon_color @lineageos.platform:drawable/ic_attachment @drawable/ic_messagelist_answered @drawable/ic_messagelist_forwarded @@ -212,13 +212,13 @@ @drawable/ic_import_status @color/color_default_primary_text @color/color_default_secondary_text - #8038B8E2 + @color/color_message_list_selected_background #c0cdcdcd #00ffffff ?android:attr/colorBackground @drawable/thread_count_box_light - #ff2ea7d1 - #ff696969 + @color/color_default_accent + @color/color_default_secondary_text @color/color_default_divider #bbbbbb @lineageos.platform:drawable/ic_attachment diff --git a/app/ui/base/src/main/res/color/star_color.xml b/app/ui/base/src/main/res/color/star_color.xml index 63583273b80eaaa76baf7748d04e9cbf1c1ba338..9a9b7155b546a7550541648d41e6e768b3a1e50b 100644 --- a/app/ui/base/src/main/res/color/star_color.xml +++ b/app/ui/base/src/main/res/color/star_color.xml @@ -1,5 +1,5 @@ - + diff --git a/app/ui/base/src/main/res/values-night/colors.xml b/app/ui/base/src/main/res/values-night/colors.xml deleted file mode 100644 index 23b1ad86c15f3d11680109b5f12f7bee30f7f6de..0000000000000000000000000000000000000000 --- a/app/ui/base/src/main/res/values-night/colors.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - #A2A2A2 - \ No newline at end of file diff --git a/app/ui/base/src/main/res/values/colors.xml b/app/ui/base/src/main/res/values/colors.xml index 26498a59f38d040316e3f35461e5b0f234eadf61..053a88e20b920f0f354ad8a81052e30077c7c45e 100644 --- a/app/ui/base/src/main/res/values/colors.xml +++ b/app/ui/base/src/main/res/values/colors.xml @@ -1,7 +1,7 @@ - #717171 - #0088ED + @lineageos.platform:color/color_default_icon + @lineageos.platform:color/color_default_blue3 @lineageos.platform:color/color_default_primary @lineageos.platform:color/color_default_primary_dark diff --git a/app/ui/base/src/main/res/values/styles.xml b/app/ui/base/src/main/res/values/styles.xml index f6c3327afaf10cb2ff59f55bb6120053cd41c616..808e7c55ee3f6aadc4ef3ec4d265ce221f3afd22 100644 --- a/app/ui/base/src/main/res/values/styles.xml +++ b/app/ui/base/src/main/res/values/styles.xml @@ -2,5 +2,7 @@ \ No newline at end of file diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index c177feba4346a65b6cdce2f11981e2717bc310ed..ec96a46b60e483c6311c1efb267225595d0d3f4d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -45,7 +45,6 @@ import com.fsck.k9.fragment.MessageListFragment.MessageListFragmentListener import com.fsck.k9.helper.Contacts import com.fsck.k9.helper.ParcelableUtil import com.fsck.k9.mailstore.SearchStatusManager - import com.fsck.k9.notification.NotificationChannelManager import com.fsck.k9.preferences.GeneralSettingsManager import com.fsck.k9.search.LocalSearch @@ -103,7 +102,6 @@ open class MessageList : private val generalSettingsManager: GeneralSettingsManager by inject() private val messagingController: MessagingController by inject() - private val permissionUiHelper: PermissionUiHelper = K9PermissionUiHelper(this) private lateinit var actionBar: ActionBar diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt index d6e017e9ee7432a84c71f68e277569d184cdc3bb..8557259efb4351f92d0636ad7cc5eaec7a4b1da2 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt @@ -13,6 +13,7 @@ import android.text.style.ForegroundColorSpan import android.text.style.StyleSpan import android.view.LayoutInflater import android.view.View +import android.view.View.GONE import android.view.View.OnClickListener import android.view.ViewGroup import android.widget.BaseAdapter @@ -58,6 +59,12 @@ class MessageListAdapter internal constructor( notifyDataSetChanged() } + var isInSelectionMode: Boolean = false + set(value) { + field = value + notifyDataSetChanged() + } + var activeMessage: MessageReference? = null var selected: Set = emptySet() @@ -82,12 +89,6 @@ class MessageListAdapter internal constructor( listItemListener.onToggleMessageSelection(messageListItem) } - private fun recipientSigil(toMe: Boolean, ccMe: Boolean) = when { - toMe -> res.getString(R.string.messagelist_sent_to_me_sigil) - ccMe -> res.getString(R.string.messagelist_sent_cc_me_sigil) - else -> "" - } - override fun hasStableIds(): Boolean = true override fun getCount(): Int = messages.size @@ -118,8 +119,8 @@ class MessageListAdapter internal constructor( appearance.fontSizes.setViewTextSize(holder.date, appearance.fontSizes.messageListDate) - // 1 preview line is needed even if it is set to 0, because subject is part of the same text view - holder.preview.setLines(max(appearance.previewLines, 1)) + holder.preview.setLines(max(appearance.previewLines, 0)) + appearance.fontSizes.setViewTextSize(holder.displayName, appearance.fontSizes.messageListSender) appearance.fontSizes.setViewTextSize(holder.preview, appearance.fontSizes.messageListPreview) appearance.fontSizes.setViewTextSize(holder.threadCount, appearance.fontSizes.messageListSubject) // thread count is next to subject @@ -139,8 +140,13 @@ class MessageListAdapter internal constructor( val holder = view.tag as MessageViewHolder if (appearance.showContactPicture) { - if (isSelected) { + if(isInSelectionMode) { holder.contactPicture.isVisible = false + if(isSelected) { + holder.selected.setImageResource(R.drawable.ic_check_circle_large) + } else { + holder.selected.setImageResource(R.drawable.ic_non_check_circle_large) + } holder.selected.isVisible = true } else { holder.selected.isVisible = false @@ -170,16 +176,15 @@ class MessageListAdapter internal constructor( setBackgroundColor(view, isSelected, isRead, isActive) updateWithThreadCount(holder, displayThreadCount) val beforePreviewText = if (appearance.senderAboveSubject) subject else displayName - val sigil = recipientSigil(toMe, ccMe) - val messageStringBuilder = SpannableStringBuilder(sigil) - .append(beforePreviewText) + holder.displayName.setText(beforePreviewText, TextView.BufferType.SPANNABLE) + formatDisplayText(holder.displayName, isRead) if (appearance.previewLines > 0) { val preview = getPreview(isMessageEncrypted, previewText) - messageStringBuilder.append(" ").append(preview) + holder.preview.setText(preview, TextView.BufferType.SPANNABLE) + formatPreviewText(holder.preview) + } else { + holder.preview.visibility = GONE } - holder.preview.setText(messageStringBuilder, TextView.BufferType.SPANNABLE) - - formatPreviewText(holder.preview, beforePreviewText, sigil, isRead) holder.subject.typeface = Typeface.create(holder.subject.typeface, maybeBoldTypeface) if (appearance.senderAboveSubject) { @@ -201,21 +206,23 @@ class MessageListAdapter internal constructor( } } - private fun formatPreviewText( - preview: TextView, - beforePreviewText: CharSequence, - sigil: String, + private fun formatDisplayText( + display: TextView, messageRead: Boolean ) { - val previewText = preview.text as Spannable + val displayText = display.text as Spannable + addBeforePreviewSpan(displayText, displayText.length, messageRead) + } - val beforePreviewLength = beforePreviewText.length + sigil.length - addBeforePreviewSpan(previewText, beforePreviewLength, messageRead) + private fun formatPreviewText( + preview: TextView + ) { + val previewText = preview.text as Spannable // Set span (color) for preview message previewText.setSpan( ForegroundColorSpan(previewTextColor), - beforePreviewLength, + 0, previewText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE ) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListFragment.kt index ecc400c3e985ebdee0311a04c4cd5bed1c820ee1..2998b5be0b9dc498aa62cea85740e779904ed4cc 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListFragment.kt @@ -835,7 +835,7 @@ class MessageListFragment : actionMode = null } - adapter.notifyDataSetChanged() + adapter.isInSelectionMode = (selectedCount != 0) } private fun toggleMessageSelect(listViewPosition: Int) { @@ -883,7 +883,7 @@ class MessageListFragment : updateActionMode() computeSelectAllVisibility() - adapter.notifyDataSetChanged() + adapter.isInSelectionMode = (selectedCount != 0) } override fun onToggleMessageSelection(item: MessageListItem) { @@ -1488,6 +1488,7 @@ class MessageListFragment : currentFolder.moreMessages = messageListInfo.hasMoreMessages updateFooterView() } + adapter.isInSelectionMode = (selectedCount != 0) } private fun cleanupSelected(messageListItems: List) { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageViewHolder.kt b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageViewHolder.kt index 9afd334390f5600a7fa9c15effbd421da3a2b3e8..0c5b296b18fff104931ce0703105f7e70e2e99e4 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageViewHolder.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageViewHolder.kt @@ -9,9 +9,10 @@ import com.fsck.k9.ui.R class MessageViewHolder(view: View) { var position = -1 - val selected: View = view.findViewById(R.id.selected) + val selected: ImageView = view.findViewById(R.id.selected) val contactPicture: ImageView = view.findViewById(R.id.contact_picture) val subject: TextView = view.findViewById(R.id.subject) + val displayName: TextView = view.findViewById(R.id.displayName) val preview: TextView = view.findViewById(R.id.preview) val date: TextView = view.findViewById(R.id.date) val chip: ImageView = view.findViewById(R.id.account_color_chip) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt index 7c8262c284f1c3cd9762afee01ece61271b283eb..fdbd3c50c4f80875670f2274cd95efb8de3708cc 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt @@ -11,6 +11,10 @@ import android.view.View import android.widget.ImageView import android.widget.LinearLayout import android.widget.Toast +import androidx.appcompat.content.res.AppCompatResources +import androidx.core.content.ContextCompat +import androidx.core.content.res.ResourcesCompat +import androidx.core.graphics.drawable.DrawableCompat import androidx.core.view.GravityCompat import androidx.drawerlayout.widget.DrawerLayout import androidx.swiperefreshlayout.widget.SwipeRefreshLayout @@ -112,6 +116,9 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K drawer.addDrawerListener(parent.createDrawerListener()) sliderView.tintStatusBar = true + val drawerPadding = parent.resources.getDimension(R.dimen.material_drawer_vertical_padding).toInt() + sliderView.recyclerView.setPadding((-1) * drawerPadding, 0, (-1) * drawerPadding, sliderView.recyclerView.paddingBottom) + sliderView.headerView?.setPadding(drawerPadding, 0, drawerPadding, 0) sliderView.onDrawerItemClickListener = { _, item, _ -> handleItemClickListener(item) false @@ -163,7 +170,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K } private fun configureAccountHeader() { - headerView.headerBackground = ImageHolder(R.drawable.blue_background) + headerView.headerBackground = ImageHolder(R.drawable.header_background) headerView.onAccountHeaderListener = { _, profile, _ -> val account = (profile as ProfileDrawerItem).tag as Account @@ -365,8 +372,13 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K } folderList.unifiedInbox?.let { unifiedInbox -> - val unifiedInboxItem = PrimaryDrawerItem().apply { + val unwrappedDrawable = AppCompatResources.getDrawable(parent.applicationContext, R.drawable.ic_inbox_multiple) + val wrappedSelectedDrawable = DrawableCompat.wrap(unwrappedDrawable!!) + DrawableCompat.setTint(wrappedSelectedDrawable, ContextCompat.getColor(parent.applicationContext, R.color.color_default_accent)) + + val unifiedInboxItem = FolderDrawerItem().apply { iconRes = R.drawable.ic_inbox_multiple //getResId(R.attr.iconUnifiedInbox) + selectedIcon = ImageHolder(wrappedSelectedDrawable) identifier = DRAWER_ID_UNIFIED_INBOX nameRes = R.string.integrated_inbox_title selectedColorInt = selectedBackgroundColor @@ -391,8 +403,14 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K val folder = displayFolder.folder val drawerId = accountOffset + folder.id + val iconId = folderIconProvider.getFolderIcon(folder.type) + val unwrappedDrawable = AppCompatResources.getDrawable(parent.applicationContext, iconId) + val wrappedSelectedDrawable = DrawableCompat.wrap(unwrappedDrawable!!) + DrawableCompat.setTint(wrappedSelectedDrawable, ContextCompat.getColor(parent.applicationContext, R.color.color_default_accent)) + val drawerItem = FolderDrawerItem().apply { - iconRes = folderIconProvider.getFolderIcon(folder.type) + iconRes = iconId + selectedIcon = ImageHolder(wrappedSelectedDrawable) identifier = drawerId tag = folder nameText = getFolderDisplayName(folder) @@ -461,14 +479,9 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K ) private fun getDrawerColorsForAccount(account: Account): DrawerColors { - val baseColor = if (themeManager.appTheme == Theme.DARK) { - getDarkThemeAccentColor(account.chipColor) - } else { - account.chipColor - } return DrawerColors( - accentColor = baseColor, - selectedColor = baseColor.and(0xffffff).or(0x22000000) + accentColor = ResourcesCompat.getColor(resources, R.color.color_default_accent, null), + selectedColor = ResourcesCompat.getColor(resources, R.color.color_selected_background, null) ) } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/view/EllipsizingTextView.kt b/app/ui/legacy/src/main/java/com/fsck/k9/view/EllipsizingTextView.kt new file mode 100644 index 0000000000000000000000000000000000000000..7184338116c609b05eafdd2a74a3b39532ebfa1c --- /dev/null +++ b/app/ui/legacy/src/main/java/com/fsck/k9/view/EllipsizingTextView.kt @@ -0,0 +1,184 @@ +package com.fsck.k9.view + +import android.annotation.SuppressLint +import android.content.Context +import android.graphics.Canvas +import android.text.Layout +import android.text.StaticLayout +import android.text.TextUtils.TruncateAt +import android.util.AttributeSet +import android.widget.TextView +import androidx.appcompat.widget.AppCompatTextView + +class EllipsizingTextView : AppCompatTextView { + interface EllipsizeListener { + fun ellipsizeStateChanged(ellipsized: Boolean) + } + + private val ellipsizeListeners: MutableList = ArrayList() + var isEllipsized = false + private set + private var isStale = true + private var programmaticChange = false + private var fullText: String? = null + private var customLineSpacingMultiplier = 1.0f + private var lineAdditionalVerticalPadding = 0.0f + + constructor(context: Context?) : super(context!!) {} + constructor(context: Context?, attrs: AttributeSet?) : super(context!!, attrs) {} + constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super( + context!!, attrs, defStyle + ) { + } + + fun addEllipsizeListener(listener: EllipsizeListener?) { + if (listener == null) { + throw NullPointerException() + } + ellipsizeListeners.add(listener) + } + + fun removeEllipsizeListener(listener: EllipsizeListener) { + ellipsizeListeners.remove(listener) + } + + override fun setLineSpacing(add: Float, mult: Float) { + lineAdditionalVerticalPadding = add + customLineSpacingMultiplier = mult + super.setLineSpacing(add, mult) + } + + override fun onTextChanged(text: CharSequence, start: Int, before: Int, after: Int) { + super.onTextChanged(text, start, before, after) + if (!programmaticChange) { + fullText = text.toString() + isStale = true + } + } + + override fun onDraw(canvas: Canvas) { + if (isStale) { + resetText() + } + super.onDraw(canvas) + } + + @SuppressLint("DiscouragedPrivateApi") + override fun getMaxLines(): Int { + val textViewClassInstance = TextView::class.java + try { + val MaxMode = textViewClassInstance.getDeclaredField("mMaxMode") + MaxMode.isAccessible = true + val mMaxMode = MaxMode.getInt(this) + val Maximum = textViewClassInstance.getDeclaredField("mMaximum") + Maximum.isAccessible = true + val mMaximum = Maximum.getInt(this) + val LINES = textViewClassInstance.getDeclaredField("LINES") + LINES.isAccessible = true + val mLINES = LINES.getInt(this) + return if (mMaxMode == mLINES) mMaximum else -1 + } catch (e: NoSuchFieldException) { + e.printStackTrace() + } catch (e: IllegalAccessException) { + e.printStackTrace() + } catch (e: IllegalArgumentException) { + e.printStackTrace() + } + return -1 + } + + private fun resetText() { + val maxLines = maxLines + var workingText = fullText + var ellipsized = false + if (maxLines != -1) { + val layout = createWorkingLayout(workingText) + val originalLineCount = layout.lineCount + if (originalLineCount > maxLines) { + if (this.ellipsize == TruncateAt.START) { + workingText = + fullText!!.substring(layout.getLineStart(originalLineCount - maxLines - 1)).trim { it <= ' ' } + while (createWorkingLayout(ELLIPSIS + workingText).lineCount > maxLines) { + val firstSpace = workingText!!.indexOf(' ') + workingText = if (firstSpace == -1) { + workingText.substring(1) + } else { + workingText.substring(firstSpace + 1) + } + } + workingText = ELLIPSIS + workingText + } else if (this.ellipsize == TruncateAt.END) { + workingText = fullText!!.substring(0, layout.getLineEnd(maxLines - 1)).trim { it <= ' ' } + while (createWorkingLayout(workingText + ELLIPSIS).lineCount > maxLines) { + val lastSpace = workingText!!.lastIndexOf(' ') + workingText = if (lastSpace == -1) { + workingText.substring(0, workingText.length - 1) + } else { + workingText.substring(0, lastSpace) + } + } + workingText = workingText + ELLIPSIS + } else if (this.ellipsize == TruncateAt.MIDDLE) { + var shrinkLeft = false + val firstOffset = layout.getLineEnd(maxLines / 2) + val secondOffset = layout.getLineEnd(originalLineCount - 1) - firstOffset + 1 + var firstWorkingText = fullText!!.substring(0, firstOffset).trim { it <= ' ' } + var secondWorkingText = fullText!!.substring(secondOffset).trim { it <= ' ' } + while (createWorkingLayout(firstWorkingText + ELLIPSIS + secondWorkingText).lineCount > maxLines) { + if (shrinkLeft) { + shrinkLeft = false + val lastSpace = firstWorkingText.lastIndexOf(' ') + firstWorkingText = if (lastSpace == -1) { + firstWorkingText.substring( + 0, firstWorkingText.length - 1 + ) + } else { + firstWorkingText.substring( + 0, lastSpace + ) + } + } else { + shrinkLeft = true + val firstSpace = secondWorkingText.indexOf(' ') + secondWorkingText = if (firstSpace == -1) { + secondWorkingText + .substring(1) + } else { + secondWorkingText + .substring(firstSpace + 1) + } + } + } + workingText = firstWorkingText + ELLIPSIS + secondWorkingText + } + ellipsized = true + } + } + if (workingText != text) { + programmaticChange = true + text = try { + workingText + } finally { + programmaticChange = false + } + } + isStale = false + if (ellipsized != isEllipsized) { + isEllipsized = ellipsized + for (listener in ellipsizeListeners) { + listener.ellipsizeStateChanged(ellipsized) + } + } + } + + private fun createWorkingLayout(workingText: String?): Layout { + return StaticLayout( + workingText, paint, width - paddingLeft - paddingRight, + Layout.Alignment.ALIGN_NORMAL, customLineSpacingMultiplier, lineAdditionalVerticalPadding, false + ) + } + + companion object { + private const val ELLIPSIS = "..." + } +} \ No newline at end of file diff --git a/app/ui/legacy/src/main/res/drawable/btn_check_star.xml b/app/ui/legacy/src/main/res/drawable/btn_check_star.xml index 339bb252837165e0634daf2ded1dc805e41f9175..c8444f6dccd29b79501f41b509f6660e4d219d83 100644 --- a/app/ui/legacy/src/main/res/drawable/btn_check_star.xml +++ b/app/ui/legacy/src/main/res/drawable/btn_check_star.xml @@ -1,5 +1,5 @@ - - + + diff --git a/app/ui/legacy/src/main/res/drawable/blue_background.xml b/app/ui/legacy/src/main/res/drawable/header_background.xml similarity index 64% rename from app/ui/legacy/src/main/res/drawable/blue_background.xml rename to app/ui/legacy/src/main/res/drawable/header_background.xml index 73ab390fc5f18f475874fc9bab832995bc09d907..401e975603965ce80b851f245be45bab39719cf4 100644 --- a/app/ui/legacy/src/main/res/drawable/blue_background.xml +++ b/app/ui/legacy/src/main/res/drawable/header_background.xml @@ -1,6 +1,6 @@ - + diff --git a/app/ui/legacy/src/main/res/drawable/ic_non_check_circle_large.xml b/app/ui/legacy/src/main/res/drawable/ic_non_check_circle_large.xml new file mode 100644 index 0000000000000000000000000000000000000000..7bbffe9f6f74534b8c22bacdaa158fb0f59ef74d --- /dev/null +++ b/app/ui/legacy/src/main/res/drawable/ic_non_check_circle_large.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/app/ui/legacy/src/main/res/drawable/ic_opened_envelope.xml b/app/ui/legacy/src/main/res/drawable/ic_opened_envelope.xml index 6013d5ada9c5bcad0ce5572815ec871907c0a5d2..2d2b1557d1b39bdfdd1e8b99e17e6247da0eec49 100644 --- a/app/ui/legacy/src/main/res/drawable/ic_opened_envelope.xml +++ b/app/ui/legacy/src/main/res/drawable/ic_opened_envelope.xml @@ -2,7 +2,8 @@ android:width="24dp" android:height="24dp" android:viewportWidth="24" - android:viewportHeight="24"> + android:viewportHeight="24" + android:tint="?android:attr/colorControlNormal"> diff --git a/app/ui/legacy/src/main/res/drawable/ic_star.xml b/app/ui/legacy/src/main/res/drawable/ic_star.xml index 9b3f2e1ae40f4ca2a97ed544d014e6f5b9f26240..7bd436f286527e2da49ab2f61956b8ae4da3f06d 100644 --- a/app/ui/legacy/src/main/res/drawable/ic_star.xml +++ b/app/ui/legacy/src/main/res/drawable/ic_star.xml @@ -1,6 +1,6 @@ diff --git a/app/ui/legacy/src/main/res/drawable/ic_star_border.xml b/app/ui/legacy/src/main/res/drawable/ic_star_border.xml index 720a8af027b8ce34d313b49f396153e072c3c232..84549a9dd8e433aa53bcc0b564a8b3e9d3771ef2 100644 --- a/app/ui/legacy/src/main/res/drawable/ic_star_border.xml +++ b/app/ui/legacy/src/main/res/drawable/ic_star_border.xml @@ -1,6 +1,6 @@ - + diff --git a/app/ui/legacy/src/main/res/layout/drawer_folder_list_item.xml b/app/ui/legacy/src/main/res/layout/drawer_folder_list_item.xml index cf783ffce28d2b73e05a6a6f470a885e660465fb..fc3b5b4d785eee9ac0cb5d18ec33a51008e70fc8 100644 --- a/app/ui/legacy/src/main/res/layout/drawer_folder_list_item.xml +++ b/app/ui/legacy/src/main/res/layout/drawer_folder_list_item.xml @@ -17,6 +17,7 @@ android:paddingTop="@dimen/material_drawer_item_primary_icon_padding" android:paddingEnd="@dimen/material_drawer_item_primary_icon_padding_right" android:paddingBottom="@dimen/material_drawer_item_primary_icon_padding" + android:layout_marginStart="@dimen/material_drawer_vertical_padding" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -68,7 +69,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/material_drawer_padding" - android:layout_marginEnd="0dp" + android:layout_marginEnd="@dimen/material_drawer_vertical_padding" android:fontFamily="sans-serif" android:gravity="center" android:lines="1" diff --git a/app/ui/legacy/src/main/res/layout/fragment_settings_export.xml b/app/ui/legacy/src/main/res/layout/fragment_settings_export.xml index 378b77b41cde133256d23de5560c42087303b3b0..412f786d001b1afe83a10bbb2613b433b85150cd 100644 --- a/app/ui/legacy/src/main/res/layout/fragment_settings_export.xml +++ b/app/ui/legacy/src/main/res/layout/fragment_settings_export.xml @@ -37,6 +37,7 @@ android:layout_marginBottom="4dp" android:enabled="false" android:text="@string/settings_export_button" + android:textColor="@android:color/white" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -50,6 +51,7 @@ android:layout_marginEnd="8dp" android:layout_marginBottom="4dp" android:text="@string/settings_export_share_button" + android:textColor="@android:color/white" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/ui/legacy/src/main/res/layout/fragment_settings_import.xml b/app/ui/legacy/src/main/res/layout/fragment_settings_import.xml index 713895d70cf363dea2136e31c4d9fbe98401b1a2..d0b61cbd6df911f18293dee7be8a156f77594af9 100644 --- a/app/ui/legacy/src/main/res/layout/fragment_settings_import.xml +++ b/app/ui/legacy/src/main/res/layout/fragment_settings_import.xml @@ -28,6 +28,7 @@ android:layout_marginEnd="16dp" android:layout_marginBottom="16dp" android:text="@string/settings_import_pick_document_button" + android:textColor="@android:color/white" app:layout_constraintBottom_toTopOf="@+id/bottomBar" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -65,6 +66,7 @@ android:layout_marginBottom="4dp" android:enabled="false" android:text="@string/settings_import_button" + android:textColor="@android:color/white" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" @@ -79,6 +81,7 @@ android:layout_marginEnd="8dp" android:layout_marginBottom="4dp" android:text="@string/okay_action" + android:textColor="@android:color/white" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/ui/legacy/src/main/res/layout/message.xml b/app/ui/legacy/src/main/res/layout/message.xml index 66b1b24c21784054c0a88f4965617a8e47fd2a0a..8deb75ec0690c371c4d22a4cc63c27df3034517e 100644 --- a/app/ui/legacy/src/main/res/layout/message.xml +++ b/app/ui/legacy/src/main/res/layout/message.xml @@ -35,6 +35,7 @@ android:layout_marginRight="6dip" android:layout_marginTop="4dip" android:text="@string/message_view_show_pictures_action" + android:textColor="@android:color/white" android:visibility="gone" tools:visibility="visible"/> @@ -94,6 +95,7 @@ android:id="@+id/download_remainder" style="@style/Widget.AppCompat.Button.Colored" android:text="@string/message_view_download_remainder" + android:textColor="@android:color/white" android:layout_height="wrap_content" android:visibility="gone" android:layout_width="fill_parent" diff --git a/app/ui/legacy/src/main/res/layout/message_list_item.xml b/app/ui/legacy/src/main/res/layout/message_list_item.xml index b9909b1c4de6653aa8cf887e8b54704b549eb4b0..76435e58c652a535737b7dabc3545b08ad536e9c 100644 --- a/app/ui/legacy/src/main/res/layout/message_list_item.xml +++ b/app/ui/legacy/src/main/res/layout/message_list_item.xml @@ -6,8 +6,7 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:layout_gravity="center_vertical" - tools:layout_height="?android:attr/listPreferredItemHeight" - > + tools:layout_height="?android:attr/listPreferredItemHeight"> + + + + + + + + + + + android:layout_toStartOf="@+id/date"> + + - - + tools:tint="@color/color_default_accent" + android:contentDescription="@null" /> - - - - - - - + - - diff --git a/app/ui/legacy/src/main/res/values/colors.xml b/app/ui/legacy/src/main/res/values/colors.xml index 4c9815c4a9c008d1b3465fbdd1d0beb8bebbff95..e06953f0e810764d0897101e3124c26264073f5b 100644 --- a/app/ui/legacy/src/main/res/values/colors.xml +++ b/app/ui/legacy/src/main/res/values/colors.xml @@ -16,6 +16,8 @@ #F9F9F9 + @lineageos.platform:color/color_default_selector_background + @lineageos.platform:color/color_default_primary @lineageos.platform:color/color_default_primary_dark @lineageos.platform:color/color_default_accent @@ -24,4 +26,5 @@ @lineageos.platform:color/color_default_primary_text @lineageos.platform:color/color_default_secondary_text @lineageos.platform:color/color_default_divider + @lineageos.platform:color/color_default_gray2 diff --git a/app/ui/legacy/src/main/res/values/styles.xml b/app/ui/legacy/src/main/res/values/styles.xml index 3f6dc1702d279d60f9360630767fcc545da4a2fd..2ea6ee4e45f2ee9b6d497d08f197dcf130d0971d 100644 --- a/app/ui/legacy/src/main/res/values/styles.xml +++ b/app/ui/legacy/src/main/res/values/styles.xml @@ -68,16 +68,14 @@