mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/2529 - Remove "Delete Collection" button from private browsing
This commit is contained in:
parent
7ee012205b
commit
9160f1ca67
@ -11,7 +11,6 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import io.reactivex.Observer
|
import io.reactivex.Observer
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.SaveTabGroupViewHolder
|
import org.mozilla.fenix.home.sessioncontrol.viewholders.SaveTabGroupViewHolder
|
||||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.DeleteTabsViewHolder
|
|
||||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.NoTabMessageViewHolder
|
import org.mozilla.fenix.home.sessioncontrol.viewholders.NoTabMessageViewHolder
|
||||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.PrivateBrowsingDescriptionViewHolder
|
import org.mozilla.fenix.home.sessioncontrol.viewholders.PrivateBrowsingDescriptionViewHolder
|
||||||
import org.mozilla.fenix.home.sessioncontrol.viewholders.TabHeaderViewHolder
|
import org.mozilla.fenix.home.sessioncontrol.viewholders.TabHeaderViewHolder
|
||||||
@ -36,7 +35,6 @@ sealed class AdapterItem {
|
|||||||
object NoTabMessage : AdapterItem()
|
object NoTabMessage : AdapterItem()
|
||||||
data class TabItem(val tab: Tab) : AdapterItem()
|
data class TabItem(val tab: Tab) : AdapterItem()
|
||||||
object SaveTabGroup : AdapterItem()
|
object SaveTabGroup : AdapterItem()
|
||||||
object DeleteTabs : AdapterItem()
|
|
||||||
|
|
||||||
object PrivateBrowsingDescription : AdapterItem()
|
object PrivateBrowsingDescription : AdapterItem()
|
||||||
|
|
||||||
@ -65,7 +63,6 @@ sealed class AdapterItem {
|
|||||||
is TabItem -> TabViewHolder.LAYOUT_ID
|
is TabItem -> TabViewHolder.LAYOUT_ID
|
||||||
SaveTabGroup -> SaveTabGroupViewHolder.LAYOUT_ID
|
SaveTabGroup -> SaveTabGroupViewHolder.LAYOUT_ID
|
||||||
PrivateBrowsingDescription -> PrivateBrowsingDescriptionViewHolder.LAYOUT_ID
|
PrivateBrowsingDescription -> PrivateBrowsingDescriptionViewHolder.LAYOUT_ID
|
||||||
DeleteTabs -> DeleteTabsViewHolder.LAYOUT_ID
|
|
||||||
CollectionHeader -> CollectionHeaderViewHolder.LAYOUT_ID
|
CollectionHeader -> CollectionHeaderViewHolder.LAYOUT_ID
|
||||||
NoCollectionMessage -> NoCollectionMessageViewHolder.LAYOUT_ID
|
NoCollectionMessage -> NoCollectionMessageViewHolder.LAYOUT_ID
|
||||||
is CollectionItem -> CollectionViewHolder.LAYOUT_ID
|
is CollectionItem -> CollectionViewHolder.LAYOUT_ID
|
||||||
@ -105,7 +102,6 @@ class SessionControlAdapter(
|
|||||||
TabViewHolder.LAYOUT_ID -> TabViewHolder(view, actionEmitter, job)
|
TabViewHolder.LAYOUT_ID -> TabViewHolder(view, actionEmitter, job)
|
||||||
SaveTabGroupViewHolder.LAYOUT_ID -> SaveTabGroupViewHolder(view, actionEmitter)
|
SaveTabGroupViewHolder.LAYOUT_ID -> SaveTabGroupViewHolder(view, actionEmitter)
|
||||||
PrivateBrowsingDescriptionViewHolder.LAYOUT_ID -> PrivateBrowsingDescriptionViewHolder(view, actionEmitter)
|
PrivateBrowsingDescriptionViewHolder.LAYOUT_ID -> PrivateBrowsingDescriptionViewHolder(view, actionEmitter)
|
||||||
DeleteTabsViewHolder.LAYOUT_ID -> DeleteTabsViewHolder(view, actionEmitter)
|
|
||||||
CollectionHeaderViewHolder.LAYOUT_ID -> CollectionHeaderViewHolder(view)
|
CollectionHeaderViewHolder.LAYOUT_ID -> CollectionHeaderViewHolder(view)
|
||||||
NoCollectionMessageViewHolder.LAYOUT_ID -> NoCollectionMessageViewHolder(view)
|
NoCollectionMessageViewHolder.LAYOUT_ID -> NoCollectionMessageViewHolder(view)
|
||||||
CollectionViewHolder.LAYOUT_ID -> CollectionViewHolder(view, actionEmitter, job)
|
CollectionViewHolder.LAYOUT_ID -> CollectionViewHolder(view, actionEmitter, job)
|
||||||
|
@ -53,7 +53,6 @@ private fun privateModeAdapterItems(tabs: List<Tab>): List<AdapterItem> {
|
|||||||
|
|
||||||
if (tabs.isNotEmpty()) {
|
if (tabs.isNotEmpty()) {
|
||||||
items.addAll(tabs.reversed().map(AdapterItem::TabItem))
|
items.addAll(tabs.reversed().map(AdapterItem::TabItem))
|
||||||
items.add(AdapterItem.DeleteTabs)
|
|
||||||
} else {
|
} else {
|
||||||
items.add(AdapterItem.PrivateBrowsingDescription)
|
items.add(AdapterItem.PrivateBrowsingDescription)
|
||||||
}
|
}
|
||||||
|
@ -1,29 +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 io.reactivex.Observer
|
|
||||||
import kotlinx.android.synthetic.main.delete_tabs_button.view.*
|
|
||||||
import org.mozilla.fenix.R
|
|
||||||
import org.mozilla.fenix.home.sessioncontrol.SessionControlAction
|
|
||||||
import org.mozilla.fenix.home.sessioncontrol.TabAction
|
|
||||||
import org.mozilla.fenix.home.sessioncontrol.onNext
|
|
||||||
|
|
||||||
class DeleteTabsViewHolder(
|
|
||||||
view: View,
|
|
||||||
private val actionEmitter: Observer<SessionControlAction>
|
|
||||||
) : RecyclerView.ViewHolder(view) {
|
|
||||||
|
|
||||||
init {
|
|
||||||
view.delete_session_button.setOnClickListener {
|
|
||||||
actionEmitter.onNext(TabAction.CloseAll(true))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
companion object {
|
|
||||||
const val LAYOUT_ID = R.layout.delete_tabs_button
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +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/. -->
|
|
||||||
<FrameLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/delete_session_button"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:background="@drawable/button_background"
|
|
||||||
android:backgroundTint="?accent"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
|
||||||
android:padding="6dp">
|
|
||||||
|
|
||||||
<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/collection_delete"
|
|
||||||
android:textColor="?contrastText"
|
|
||||||
android:textSize="16sp" />
|
|
||||||
</FrameLayout>
|
|
Loading…
Reference in New Issue
Block a user