parent
82facbfa00
commit
60b68a265a
|
@ -35,6 +35,7 @@ import mozilla.components.browser.session.runWithSessionIdOrSelected
|
|||
import mozilla.components.browser.state.action.ContentAction
|
||||
import mozilla.components.browser.state.state.content.DownloadState
|
||||
import mozilla.components.browser.state.store.BrowserStore
|
||||
import mozilla.components.browser.thumbnails.BrowserThumbnails
|
||||
import mozilla.components.concept.engine.prompt.ShareData
|
||||
import mozilla.components.feature.accounts.FxaCapability
|
||||
import mozilla.components.feature.accounts.FxaWebChannelFeature
|
||||
|
@ -126,6 +127,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
private val appLinksFeature = ViewBoundFeatureWrapper<AppLinksFeature>()
|
||||
private val promptsFeature = ViewBoundFeatureWrapper<PromptFeature>()
|
||||
private val findInPageIntegration = ViewBoundFeatureWrapper<FindInPageIntegration>()
|
||||
private val thumbnailsFeature = ViewBoundFeatureWrapper<BrowserThumbnails>()
|
||||
private val toolbarIntegration = ViewBoundFeatureWrapper<ToolbarIntegration>()
|
||||
private val sitePermissionsFeature = ViewBoundFeatureWrapper<SitePermissionsFeature>()
|
||||
private val fullScreenFeature = ViewBoundFeatureWrapper<FullScreenFeature>()
|
||||
|
@ -230,6 +232,12 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
lifecycleOwner = viewLifecycleOwner
|
||||
)
|
||||
|
||||
thumbnailsFeature.set(
|
||||
feature = BrowserThumbnails(context, view.engineView, store),
|
||||
owner = this,
|
||||
view = view
|
||||
)
|
||||
|
||||
toolbarIntegration.set(
|
||||
feature = browserToolbarView.toolbarIntegration,
|
||||
owner = this,
|
||||
|
|
|
@ -22,6 +22,7 @@ import mozilla.components.browser.state.state.BrowserState
|
|||
import mozilla.components.browser.state.store.BrowserStore
|
||||
import mozilla.components.browser.storage.sync.PlacesBookmarksStorage
|
||||
import mozilla.components.browser.storage.sync.PlacesHistoryStorage
|
||||
import mozilla.components.browser.thumbnails.ThumbnailsMiddleware
|
||||
import mozilla.components.browser.thumbnails.storage.ThumbnailStorage
|
||||
import mozilla.components.concept.engine.DefaultSettings
|
||||
import mozilla.components.concept.engine.Engine
|
||||
|
@ -107,7 +108,8 @@ class Core(private val context: Context) {
|
|||
middleware = listOf(
|
||||
MediaMiddleware(context, MediaService::class.java),
|
||||
DownloadMiddleware(context, DownloadService::class.java),
|
||||
ReaderViewMiddleware()
|
||||
ReaderViewMiddleware(),
|
||||
ThumbnailsMiddleware(thumbnailStorage)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -39,8 +39,11 @@ class TabTrayViewHolder(
|
|||
) : TabViewHolder(itemView) {
|
||||
private val iconView: ImageView? = itemView.findViewById(R.id.mozac_browser_tabstray_icon)
|
||||
private val titleView: TextView = itemView.findViewById(R.id.mozac_browser_tabstray_title)
|
||||
private val closeView: AppCompatImageButton = itemView.findViewById(R.id.mozac_browser_tabstray_close)
|
||||
private val thumbnailView: TabThumbnailView = itemView.findViewById(R.id.mozac_browser_tabstray_thumbnail)
|
||||
private val closeView: AppCompatImageButton =
|
||||
itemView.findViewById(R.id.mozac_browser_tabstray_close)
|
||||
private val thumbnailView: TabThumbnailView =
|
||||
itemView.findViewById(R.id.mozac_browser_tabstray_thumbnail)
|
||||
|
||||
@VisibleForTesting
|
||||
internal val urlView: TextView? = itemView.findViewById(R.id.mozac_browser_tabstray_url)
|
||||
private val playPauseButtonView: ImageButton = itemView.findViewById(R.id.play_pause_button)
|
||||
|
@ -63,8 +66,16 @@ class TabTrayViewHolder(
|
|||
|
||||
// Drawables and theme
|
||||
updateBackgroundColor(isSelected2)
|
||||
thumbnailView.setImageBitmap(tab.thumbnail)
|
||||
iconView?.setImageBitmap(tab.icon)
|
||||
|
||||
if (tab.thumbnail != null) {
|
||||
thumbnailView.setImageBitmap(tab.thumbnail)
|
||||
thumbnailView.visibility = View.VISIBLE
|
||||
iconView?.visibility = View.INVISIBLE
|
||||
} else {
|
||||
iconView?.setImageBitmap(tab.icon)
|
||||
thumbnailView.visibility = View.INVISIBLE
|
||||
iconView?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
// Media state
|
||||
playPauseButtonView.increaseTapArea(PLAY_PAUSE_BUTTON_EXTRA_DPS)
|
||||
|
@ -139,6 +150,7 @@ class TabTrayViewHolder(
|
|||
}
|
||||
titleView.text = title
|
||||
}
|
||||
|
||||
private fun updateUrl(tab: Tab) {
|
||||
// Truncate to MAX_URI_LENGTH to prevent the UI from locking up for
|
||||
// extremely large URLs such as data URIs or bookmarklets. The same
|
||||
|
|
|
@ -12,33 +12,34 @@
|
|||
android:id="@+id/play_pause_button"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/mozac_feature_media_notification_action_pause"
|
||||
android:elevation="10dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="4dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="80dp"
|
||||
app:layout_constraintStart_toStartOf="@id/mozac_browser_tabstray_card"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/play_with_background" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/mozac_browser_tabstray_card"
|
||||
android:layout_width="92dp"
|
||||
android:layout_height="69dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:cardBackgroundColor="@color/photonWhite"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:cardBackgroundColor="@color/photonWhite">
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mozac_browser_tabstray_icon"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginStart="21dp"
|
||||
android:importantForAccessibility="no" />
|
||||
android:layout_marginTop="20dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<mozilla.components.browser.tabstray.thumbnail.TabThumbnailView
|
||||
android:id="@+id/mozac_browser_tabstray_thumbnail"
|
||||
|
@ -55,12 +56,12 @@
|
|||
android:layout_alignParentTop="true"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:textSize="16sp"
|
||||
android:paddingTop="22dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="22dp"
|
||||
android:textColor="@color/tab_tray_item_text_normal_theme"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/mozac_browser_tabstray_close"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@id/mozac_browser_tabstray_card"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
@ -71,11 +72,11 @@
|
|||
android:layout_alignParentTop="true"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:textSize="14sp"
|
||||
android:paddingStart="16dp"
|
||||
android:textColor="@color/tab_tray_item_url_normal_theme"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/mozac_browser_tabstray_close"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@id/mozac_browser_tabstray_card"
|
||||
app:layout_constraintTop_toBottomOf="@id/mozac_browser_tabstray_title" />
|
||||
|
||||
|
@ -83,12 +84,12 @@
|
|||
android:id="@+id/mozac_browser_tabstray_close"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:tint="@color/tab_tray_item_text_normal_theme"
|
||||
android:contentDescription="@string/close_tab"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/close_tab"
|
||||
android:tint="@color/tab_tray_item_text_normal_theme"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/mozac_ic_close" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
Loading…
Reference in New Issue