1
0
Fork 0

Polish homescreen (#11065)

* For #10505 - Adjusts wordmark margins

* For #10505 - Removes topsite header, fixes collections header size and removes divider

* For #10505 - Restyle the top site items on the homescreen
master
Jeff Boek 2020-05-29 15:09:12 -07:00 committed by GitHub
parent 20e358228e
commit 3946ec11de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 69 deletions

View File

@ -30,7 +30,6 @@ import org.mozilla.fenix.home.sessioncontrol.viewholders.SaveTabGroupViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TabHeaderViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TabInCollectionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TabViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSiteHeaderViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSiteViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingAutomaticSignInViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding.OnboardingFinishViewHolder
@ -75,7 +74,6 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) {
}
}
object TopSiteHeader : AdapterItem(TopSiteHeaderViewHolder.LAYOUT_ID)
data class TopSiteList(val topSites: List<TopSite>) : AdapterItem(TopSiteViewHolder.LAYOUT_ID)
object SaveTabGroup : AdapterItem(SaveTabGroupViewHolder.LAYOUT_ID)
@ -170,7 +168,6 @@ class SessionControlAdapter(
return when (viewType) {
ButtonTipViewHolder.LAYOUT_ID -> ButtonTipViewHolder(view, interactor)
TabHeaderViewHolder.LAYOUT_ID -> TabHeaderViewHolder(view, interactor)
TopSiteHeaderViewHolder.LAYOUT_ID -> TopSiteHeaderViewHolder(view)
TabViewHolder.LAYOUT_ID -> TabViewHolder(view, interactor)
TopSiteViewHolder.LAYOUT_ID -> TopSiteViewHolder(view, interactor)
SaveTabGroupViewHolder.LAYOUT_ID -> SaveTabGroupViewHolder(view, interactor)

View File

@ -51,7 +51,6 @@ private fun normalModeAdapterItems(
tip?.let { items.add(AdapterItem.TipItem(it)) }
if (topSites.isNotEmpty()) {
items.add(AdapterItem.TopSiteHeader)
items.add(AdapterItem.TopSiteList(topSites))
}

View File

@ -1,15 +0,0 @@
/* 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/. */
package org.mozilla.fenix.home.sessioncontrol.viewholders
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import org.mozilla.fenix.R
class TopSiteHeaderViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
companion object {
const val LAYOUT_ID = R.layout.top_sites_header
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="@android:color/white" />
<stroke android:width="1dp" android:color="?toolbarDivider" />
</shape>

View File

@ -2,33 +2,11 @@
<!-- 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/. -->
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/collections_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<View
android:id="@+id/divider_line"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_marginStart="23dp"
android:layout_marginEnd="23dp"
android:background="?neutralFaded"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/collections_header_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4.5dp"
android:layout_marginTop="20dp"
android:text="@string/collections_header"
android:textAppearance="@style/HeaderTextStyle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/divider_line" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/collections_header_text"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginStart="4.5dp"
android:gravity="center_vertical"
android:text="@string/collections_header"
android:textAppearance="@style/HeaderTextStyle" />

View File

@ -7,4 +7,6 @@
android:id="@+id/top_sites_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="12dp"
android:paddingEnd="12dp"
tools:listitem="@layout/top_site_item" />

View File

@ -46,9 +46,9 @@
android:id="@+id/wordmark"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_marginStart="28dp"
android:layout_marginTop="56dp"
android:layout_marginBottom="40dp"
android:adjustViewBounds="true"
android:clickable="false"
android:contentDescription="@string/app_name"

View File

@ -2,41 +2,47 @@
<!-- 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/. -->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/top_site_item"
android:layout_width="wrap_content"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:padding="4dp"
android:paddingBottom="6dp">
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp">
<ImageView
android:id="@+id/favicon_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="2dp"
android:adjustViewBounds="true"
android:importantForAccessibility="no"
android:scaleType="fitCenter"
<FrameLayout
android:id="@+id/favicon_wrapper"
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="4dp"
android:background="@drawable/top_sites_background"
app:layout_constraintBottom_toTopOf="@id/top_site_title"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/favicon_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:adjustViewBounds="true"
android:importantForAccessibility="no"
android:scaleType="centerInside" />
</FrameLayout>
<TextView
android:id="@+id/top_site_title"
android:layout_width="60dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="2dp"
android:singleLine="true"
android:textColor="?primaryText"
android:textSize="10sp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/favicon_image" />
app:layout_constraintTop_toBottomOf="@id/favicon_wrapper" />
</androidx.constraintlayout.widget.ConstraintLayout>