1
0
Fork 0

For 10504 - Adds dialog style and fab

master
Jeff Boek 2020-05-20 20:20:29 -07:00
parent 97d66cce56
commit 34ac9df481
3 changed files with 73 additions and 0 deletions

View File

@ -4,8 +4,34 @@
package org.mozilla.fenix.tabtray
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.core.view.updatePadding
import kotlinx.android.synthetic.main.fragment_tab_tray_dialog.view.*
import org.mozilla.fenix.R
class TabTrayDialogFragment : AppCompatDialogFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NO_TITLE, R.style.TabTrayDialogStyle)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? = inflater.inflate(R.layout.fragment_tab_tray_dialog, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.tabLayout.setOnApplyWindowInsetsListener { v, insets ->
v.updatePadding(
bottom = v.paddingBottom + insets.systemWindowInsetBottom
)
insets
}
}
}

View File

@ -0,0 +1,21 @@
<?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.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tabLayout"
android:layout_height="match_parent"
android:layout_width="match_parent">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/new_tab_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:backgroundTint="@color/photonBlue50"
android:contentDescription="TODO: Changeme"
app:srcCompat="@drawable/ic_new"
app:tint="@color/photonWhite" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -529,4 +529,30 @@
<style name="AutoCompleteTextViewStyle" parent="Widget.AppCompat.AutoCompleteTextView">
<item name="android:textColorHint">@color/search_view_hint_color</item>
</style>
<style name="TabTrayDialogStyle" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/BottomSheetModal</item>
<item name="android:textAppearance">@style/TextAppearance.AppCompat</item>
<item name="android:colorBackground">?foundation</item>
<item name="android:windowAnimationStyle">@style/Animation.Design.BottomSheetDialog</item>
<item name="android:windowIsFloating">false</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">?foundation</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
<!-- Stuff to make the bottom sheet with round top borders -->
<style name="BottomSheetShapeAppearance" parent="ShapeAppearance.MaterialComponents.LargeComponent">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopLeft">16dp</item>
<item name="cornerSizeTopRight">16dp</item>
<item name="colorSurface">?foundation</item>
</style>
<style name="BottomSheetModal" parent="Widget.Design.BottomSheet.Modal">
<item name="shapeAppearance">@style/BottomSheetShapeAppearance</item>
<item name="behavior_halfExpandedRatio">0.4</item>
<item name="behavior_fitToContents">false</item>
</style>
</resources>