1
0
Fork 0

For #1843 - Adds the selected tabs button

master
Jeff Boek 2019-04-23 16:18:59 -07:00 committed by Emily Kager
parent 5c45064fbb
commit cddb4de79b
5 changed files with 87 additions and 4 deletions

View File

@ -4,7 +4,6 @@ package org.mozilla.fenix.collections
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/. */
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
@ -47,5 +46,13 @@ class CollectionCreationUIView(
override fun updateView() = Consumer<CollectionCreationState> {
collectionCreationTabListAdapter.updateData(it.tabs, it.selectedTabs)
val buttonText = if (it.selectedTabs.isEmpty()) {
view.context.getString(R.string.create_collection_save_to_collection_empty)
} else {
view.context.getString(R.string.create_collection_save_to_collection_full, it.selectedTabs.size)
}
view.add_tabs_button_text.text = buttonText
}
}

View File

@ -0,0 +1,9 @@
<?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">
<corners android:radius="8dp"/>
<solid android:color="?accentHighContrast" />
</shape>

View File

@ -6,6 +6,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Button
@ -30,7 +31,7 @@
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:textSize="16sp"
android:text="Select All"
android:text="@string/create_collection_select_all"
android:textAllCaps="false"
android:textColor="@color/neutral_text"
android:layout_margin="16dp"
@ -41,9 +42,61 @@
android:id="@+id/tab_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="16dp"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="30dp"
app:layout_constraintTop_toBottomOf="@id/back_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
app:layout_constraintBottom_toTopOf="@+id/add_tabs_button" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/add_tabs_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="@drawable/add_tabs_to_collection_background"
android:clipToPadding="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<ImageView
android:id="@+id/close_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/mozac_ic_close"
android:layout_margin="16dp"
android:tint="?neutral"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/add_tabs_button_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:singleLine="true"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?neutral"
android:text="@string/create_collection_save_to_collection_empty"
app:layout_constraintStart_toEndOf="@id/close_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android:id="@+id/save_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:tint="?neutral"
app:srcCompat="@drawable/ic_archive" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -9,6 +9,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/scrim_background"
android:fitsSystemWindows="true"
tools:context="org.mozilla.fenix.collections.CreateCollectionFragment">
</FrameLayout>

View File

@ -402,5 +402,18 @@
<string name="tracking_protection_on">On</string>
<!-- Summary of tracking protection preference if tracking protection is set to off -->
<string name="tracking_protection_off">Off</string>
<!-- Title for the "select tabs" step of the collection creator -->
<string name="create_collection_select_tabs">Select Tabs</string>
<!-- Button to select all tabs in the "select tabs" step of the collection creator -->
<string name="create_collection_select_all">Select All</string>
<!-- Text to prompt users to select the tabs to save in the "select tabs" stepof the collection creator -->
<string name="create_collection_save_to_collection_empty">Select tabs to save</string>
<!-- Text to prompt users to select how many tabs they have
selected in the "select tabs" stepof the collection creator -->
<string name="create_collection_save_to_collection_full">%d tabs selected</string>
</resources>