For #139 - Adds the sessions placeholder
parent
38431dac41
commit
4179a8ff78
@ -0,0 +1,53 @@
|
||||
/* 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.sessions
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.mozilla.fenix.R
|
||||
|
||||
|
||||
class SessionsAdapter() : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(viewType, parent, false)
|
||||
|
||||
return when(viewType) {
|
||||
HeaderViewHolder.LAYOUT_ID -> HeaderViewHolder(view)
|
||||
EmptyListViewHolder.LAYOUT_ID -> EmptyListViewHolder(view)
|
||||
else -> EmptyListViewHolder(view)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int) = when (position) {
|
||||
0 -> HeaderViewHolder.LAYOUT_ID
|
||||
1 -> EmptyListViewHolder.LAYOUT_ID
|
||||
else -> -1
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = 2
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
if (holder is HeaderViewHolder) {
|
||||
holder.headerText.text = "Today"
|
||||
}
|
||||
}
|
||||
|
||||
private class HeaderViewHolder(private val view: View): RecyclerView.ViewHolder(view) {
|
||||
val headerText = view.findViewById<TextView>(R.id.header_text)
|
||||
|
||||
companion object {
|
||||
const val LAYOUT_ID = R.layout.session_list_header
|
||||
}
|
||||
}
|
||||
|
||||
private class EmptyListViewHolder(private val view: View): RecyclerView.ViewHolder(view) {
|
||||
companion object {
|
||||
const val LAYOUT_ID = R.layout.session_list_empty
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<?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/. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="44dp"
|
||||
android:height="60dp"
|
||||
android:viewportWidth="44"
|
||||
android:viewportHeight="60">
|
||||
<path
|
||||
android:pathData="M24,46C25.6569,46 27,47.3431 27,49C27,50.6569 25.6569,52 24,52L9,52C4.0294,52 0,47.9706 0,43L0,9C0,4.0294 4.0294,0 9,0L35,0C39.9706,0 44,4.0294 44,9L44,43C44,47.9706 39.9706,52 35,52L34,52C32.3431,52 31,50.6569 31,49C31,47.3431 32.3431,46 34,46L35,46C36.6569,46 38,44.6569 38,43L38,9C38,7.3431 36.6569,6 35,6L9,6C7.3431,6 6,7.3431 6,9L6,43C6,44.6569 7.3431,46 9,46L24,46Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#665BFD"
|
||||
android:fillType="nonZero"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M9,46h13v6h-13z"
|
||||
android:strokeWidth="1"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startY="49"
|
||||
android:startX="20.763313"
|
||||
android:endY="49"
|
||||
android:endX="9.27464"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#A30B1043"/>
|
||||
<item android:offset="0.40306628" android:color="#510B1043"/>
|
||||
<item android:offset="1" android:color="#000B1043"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:pathData="M13.8787,43.1213C12.7071,41.9497 12.7071,40.0503 13.8787,38.8787C15.0503,37.7071 16.9497,37.7071 18.1213,38.8787L26.1213,46.8787C27.2929,48.0503 27.2929,49.9497 26.1213,51.1213L18.1213,59.1213C16.9497,60.2929 15.0503,60.2929 13.8787,59.1213C12.7071,57.9497 12.7071,56.0503 13.8787,54.8787L19.7574,49L13.8787,43.1213Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#665BFD"
|
||||
android:fillType="nonZero"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M35,46.0281C37.4195,46.1246 39.3314,45.8435 40.7358,45.1849C42.5965,44.3123 43.6623,42.9675 43.933,41.1506L43.9128,31L37.9345,31L37.9345,42.3681C38.013,43.607 37.7233,44.5204 37.0655,45.1083C36.4642,45.6456 35.7757,45.9522 35,46.0281Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startY="46.1246"
|
||||
android:startX="41.02018"
|
||||
android:endY="34.49148"
|
||||
android:endX="41.02018"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#A30B1043"/>
|
||||
<item android:offset="0.40306628" android:color="#510B1043"/>
|
||||
<item android:offset="1" android:color="#000B1043"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:pathData="M8.933,6.0185C6.5136,5.922 4.6016,6.2031 3.1973,6.8617C1.3365,7.7343 0.2708,9.0791 0,10.896L0.0202,21.0466L5.9986,21.0466L5.9986,9.6785C5.9201,8.4396 6.2098,7.5262 6.8676,6.9383C7.4688,6.401 8.1573,6.0943 8.933,6.0185Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startY="21.0466"
|
||||
android:startX="6.020179"
|
||||
android:endY="9.413482"
|
||||
android:endX="6.020179"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#A30B1043"/>
|
||||
<item android:offset="0.40306628" android:color="#510B1043"/>
|
||||
<item android:offset="1" android:color="#000B1043"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</vector>
|
@ -0,0 +1,17 @@
|
||||
<?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">
|
||||
<solid android:color="@color/session_list_empty_bg"/>
|
||||
|
||||
<padding android:left="2dp"
|
||||
android:top="2dp"
|
||||
android:right="2dp"
|
||||
android:bottom="2dp"/>
|
||||
|
||||
<corners android:bottomRightRadius="8dp"
|
||||
android:bottomLeftRadius="8dp"
|
||||
android:topLeftRadius="8dp"
|
||||
android:topRightRadius="8dp"/>
|
||||
</shape>
|
@ -0,0 +1,34 @@
|
||||
<?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/. -->
|
||||
<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/no_sessions"
|
||||
android:background="@drawable/session_list_empty_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@drawable/ic_sessions_intro"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/sessions_intro_description"
|
||||
android:textColor="@color/session_list_empty_fg"
|
||||
android:layout_marginStart="23dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/imageView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toTopOf="@id/imageView" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,12 @@
|
||||
<?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/. -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/header_text"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textSize="12dp"
|
||||
android:textColor="@color/session_list_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</TextView>
|
Loading…
Reference in New Issue