mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/21087: Updates Recently Saved design
This commit is contained in:
parent
d10d841c11
commit
7ea5cdbe39
@ -6,7 +6,6 @@ package org.mozilla.fenix.home.recentbookmarks.view
|
||||
|
||||
import android.view.View
|
||||
import mozilla.components.concept.storage.BookmarkNode
|
||||
import mozilla.components.support.ktx.kotlin.tryGetHostFromUrl
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.databinding.RecentBookmarkItemBinding
|
||||
import org.mozilla.fenix.ext.components
|
||||
@ -23,7 +22,6 @@ class RecentBookmarkItemViewHolder(
|
||||
val binding = RecentBookmarkItemBinding.bind(view)
|
||||
|
||||
binding.bookmarkTitle.text = bookmark.title ?: bookmark.url
|
||||
binding.bookmarkSubtitle.text = bookmark.url?.tryGetHostFromUrl() ?: bookmark.title ?: ""
|
||||
|
||||
binding.bookmarkItem.setOnClickListener {
|
||||
interactor.onRecentBookmarkClicked(bookmark)
|
||||
|
@ -2,64 +2,40 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/bookmark_item"
|
||||
android:layout_width="@dimen/recent_bookmark_item_width"
|
||||
android:layout_height="@dimen/recent_bookmark_item_height"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:scrollbars="none"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:importantForAccessibility="no"
|
||||
style="@style/RecentBookmarks.FaviconCard">
|
||||
android:padding="4dp">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/favicon_image"
|
||||
style="@style/recentBookmarkFavicon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/tab_tray_item_divider_normal_theme"
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_marginTop="72dp"
|
||||
android:clickable="false"/>
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:paddingBottom="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bookmark_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bookmark_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="72dp"
|
||||
android:maxHeight="30dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="7dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:scrollbars="none"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:importantForAccessibility="yes"
|
||||
android:maxLines="1"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:importantForAccessibility="yes"
|
||||
android:textAppearance="@style/recentBookmarkItemTitleText"
|
||||
android:scrollbars="none"
|
||||
android:textAppearance="@style/recentBookmarkItemSubTitleText"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:text="Recently Saved bookmark item" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bookmark_subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginTop="105dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:scrollbars="none"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:textAppearance="@style/recentBookmarkItemSubTitleText"
|
||||
tools:text="Subtitle text"
|
||||
android:textColor="@color/home_recent_bookmarks_item_url" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -94,7 +94,6 @@
|
||||
|
||||
<!-- Home screen -->
|
||||
<color name="home_show_all_button_text">@color/photonLightGrey50</color>
|
||||
<color name="home_recent_bookmarks_item_url">@color/photonLightGrey50</color>
|
||||
|
||||
<!-- Search Widget -->
|
||||
<color name="search_widget_background">@color/inset_dark_theme</color>
|
||||
|
@ -283,7 +283,6 @@
|
||||
|
||||
<!-- Home screen -->
|
||||
<color name="home_show_all_button_text">@color/photonDarkGrey05</color>
|
||||
<color name="home_recent_bookmarks_item_url">@color/photonDarkGrey05</color>
|
||||
|
||||
<!-- Quick action buttons-->
|
||||
|
||||
|
@ -95,11 +95,11 @@
|
||||
<dimen name="home_item_elevation">5dp</dimen>
|
||||
|
||||
<!-- Home - Recently saved bookmarks -->
|
||||
<dimen name="recent_bookmark_item_height">128dp</dimen>
|
||||
<dimen name="recent_bookmark_item_width">152dp</dimen>
|
||||
<dimen name="recent_bookmark_item_height">132dp</dimen>
|
||||
<dimen name="recent_bookmark_item_width">161dp</dimen>
|
||||
<dimen name="recent_bookmark_item_favicon_height">72dp</dimen>
|
||||
<dimen name="recent_bookmark_item_favicon_elevation">0dp</dimen>
|
||||
<dimen name="recent_bookmark_item_favicon_corner_size">4dp</dimen>
|
||||
<dimen name="recent_bookmark_item_favicon_corner_size">8dp</dimen>
|
||||
|
||||
<!-- Browser Fragment -->
|
||||
<!--The size of the gap between the tab preview and content layout.-->
|
||||
|
@ -680,15 +680,6 @@
|
||||
<item name="cornerSize">@dimen/top_sites_favicon_corner_size</item>
|
||||
</style>
|
||||
|
||||
<style name="RecentBookmarks.FaviconCard" parent="Mozac.Widgets.Favicon">
|
||||
<item name="android:layout_width">@dimen/recent_bookmark_item_width</item>
|
||||
<item name="android:layout_height">@dimen/recent_bookmark_item_height</item>
|
||||
<item name="android:padding">16dp</item>
|
||||
<item name="cardBackgroundColor">?mozac_widget_favicon_background_color</item>
|
||||
<item name="cardCornerRadius">8dp</item>
|
||||
<item name="cardElevation">@dimen/home_item_elevation</item>
|
||||
</style>
|
||||
|
||||
<style name="recentBookmarkFavicon">
|
||||
<item name="android:layout_width">@dimen/recent_bookmark_item_width</item>
|
||||
<item name="android:layout_height">@dimen/recent_bookmark_item_favicon_height</item>
|
||||
@ -703,15 +694,6 @@
|
||||
<item name="cornerSize">@dimen/recent_bookmark_item_favicon_corner_size</item>
|
||||
</style>
|
||||
|
||||
<style name="recentBookmarkItemTitleText" parent="Body16TextStyle">
|
||||
<item name="android:gravity">start</item>
|
||||
<item name="android:textAlignment">gravity</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:textColor">?primaryText</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
<item name="android:maxLines">1</item>
|
||||
</style>
|
||||
|
||||
<style name="recentBookmarkItemSubTitleText" parent="Body12TextStyle">
|
||||
<item name="android:gravity">start</item>
|
||||
<item name="android:textColor">?primaryText</item>
|
||||
|
@ -8,7 +8,6 @@ import android.view.LayoutInflater
|
||||
import io.mockk.mockk
|
||||
import mozilla.components.concept.storage.BookmarkNode
|
||||
import mozilla.components.concept.storage.BookmarkNodeType
|
||||
import mozilla.components.support.ktx.kotlin.tryGetHostFromUrl
|
||||
import mozilla.components.support.test.robolectric.testContext
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
@ -65,13 +64,10 @@ class RecentBookmarkItemViewHolderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN a bookmark exists in the list THEN set the title text and subtitle from item`() {
|
||||
fun `GIVEN a bookmark exists in the list THEN set the title text`() {
|
||||
RecentBookmarkItemViewHolder(binding.root, interactor).bind(bookmarkWithUrl)
|
||||
|
||||
val hostFromUrl = bookmarkWithUrl.url?.tryGetHostFromUrl()
|
||||
|
||||
Assert.assertEquals(bookmarkWithUrl.title, binding.bookmarkTitle.text)
|
||||
Assert.assertEquals(hostFromUrl, binding.bookmarkSubtitle.text)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user