1
0
Fork 0

For #1456 - Fixes missing delete button

master
Jeff Boek 2019-04-08 09:42:51 -07:00
parent 5b2417826e
commit 8f6dca99dc
5 changed files with 3 additions and 129 deletions

View File

@ -22,9 +22,7 @@ private fun SessionControlState.toAdapterList(): List<AdapterItem> {
if (tabs.isNotEmpty()) {
items.add(AdapterItem.TabHeader)
tabs.map(AdapterItem::TabItem).forEach { items.add(it) }
if (mode == Mode.Private) {
items.add(AdapterItem.ArchiveTabs)
}
items.add(if (mode == Mode.Private) AdapterItem.DeleteTabs else AdapterItem.ArchiveTabs)
} else {
if (mode == Mode.Private) {
items.add(AdapterItem.PrivateBrowsingDescription)
@ -55,7 +53,7 @@ class SessionControlUIView(
) {
override val view: RecyclerView = LayoutInflater.from(container.context)
.inflate(R.layout.component_home, container, true)
.inflate(R.layout.component_session_control, container, true)
.findViewById(R.id.home_component)
private val sessionControlAdapter = SessionControlAdapter(actionEmitter)

View File

@ -20,7 +20,7 @@ class DeleteTabsViewHolder(
init {
view.delete_session_button.setOnClickListener {
actionEmitter.onNext(TabAction.Archive)
actionEmitter.onNext(TabAction.CloseAll(true))
}
}
companion object {

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/session_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:clipToPadding="false" />

View File

@ -1,116 +0,0 @@
<?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/. -->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/tabs_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:visibility="gone">
<TextView
android:id="@+id/header_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/tabs_header_title"
android:textAppearance="@style/HeaderTextStyle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/add_tab_button"
android:layout_width="@dimen/glyph_button_width"
android:layout_height="@dimen/glyph_button_height"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/add_tab"
android:src="@drawable/ic_new"
android:tint="?attr/toolbarTextColor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tabs_overflow_button"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/tabs_overflow_button"
android:layout_width="@dimen/glyph_button_width"
android:layout_height="@dimen/glyph_button_height"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/tab_menu"
android:src="@drawable/ic_menu"
android:tint="?attr/toolbarTextColor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabs_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:padding="12dp"/>
<FrameLayout
android:id="@+id/save_session_button"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_margin="16dp"
android:background="@drawable/button_background"
android:backgroundTint="@color/save_session_button_color"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
android:padding="6dp"
android:visibility="gone">
<TextView
android:id="@+id/save_session_button_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:drawableTint="@color/save_session_button_text_color"
android:drawableStart="@drawable/ic_archive"
android:drawablePadding="8dp"
android:focusable="false"
android:gravity="center"
android:textStyle="bold"
android:text="@string/session_save"
android:textColor="@color/save_session_button_text_color" />
</FrameLayout>
<FrameLayout
android:id="@+id/delete_session_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="@drawable/button_background"
android:backgroundTint="@color/delete_session_button_background"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
android:padding="6dp"
android:visibility="gone">
<TextView
android:id="@+id/delete_session_button_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:drawableStart="@drawable/ic_delete"
android:drawablePadding="8dp"
android:focusable="false"
android:textStyle="bold"
android:gravity="center"
android:text="@string/session_delete"
android:textColor="@color/color_primary_dark"
android:textSize="16sp" />
</FrameLayout>
</merge>