2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00
This commit is contained in:
Jeff Boek 2020-05-20 22:11:26 -07:00
parent 8c770984a0
commit 18f664f477
7 changed files with 25 additions and 9 deletions

View File

@ -70,6 +70,7 @@ import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.IntentReceiverActivity import org.mozilla.fenix.IntentReceiverActivity
import org.mozilla.fenix.NavGraphDirections import org.mozilla.fenix.NavGraphDirections
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.browser.readermode.DefaultReaderModeController import org.mozilla.fenix.browser.readermode.DefaultReaderModeController
import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.FindInPageIntegration import org.mozilla.fenix.components.FindInPageIntegration
@ -219,7 +220,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
tabTrayDialog.dismiss() tabTrayDialog.dismiss()
} }
override fun onNewTabTapped() { override fun onNewTabTapped(private: Boolean) {
(activity as HomeActivity).browsingModeManager.mode = BrowsingMode.fromBoolean(private)
tabTrayDialog.dismiss() tabTrayDialog.dismiss()
findNavController().navigate(BrowserFragmentDirections.actionGlobalHome()) findNavController().navigate(BrowserFragmentDirections.actionGlobalHome())
} }

View File

@ -366,7 +366,8 @@ class HomeFragment : Fragment() {
(activity as HomeActivity).openToBrowser(BrowserDirection.FromHome) (activity as HomeActivity).openToBrowser(BrowserDirection.FromHome)
} }
override fun onNewTabTapped() { override fun onNewTabTapped(private: Boolean) {
(activity as HomeActivity).browsingModeManager.mode = BrowsingMode.fromBoolean(private)
tabTrayDialog.dismiss() tabTrayDialog.dismiss()
} }
} }

View File

@ -19,7 +19,7 @@ import org.mozilla.fenix.R
class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor { class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
interface Interactor { interface Interactor {
fun onTabSelected(tab: Tab) fun onTabSelected(tab: Tab)
fun onNewTabTapped() fun onNewTabTapped(private: Boolean)
} }
private lateinit var tabTrayView: TabTrayView private lateinit var tabTrayView: TabTrayView
@ -62,7 +62,7 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
} }
override fun onNewTabTapped(private: Boolean) { override fun onNewTabTapped(private: Boolean) {
interactor?.onNewTabTapped() interactor?.onNewTabTapped(private)
} }
override fun onTabTrayDismissed() { override fun onTabTrayDismissed() {

View File

@ -0,0 +1,8 @@
<?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/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?accent" android:state_selected="true" />
<item android:color="?secondaryText"/>
</selector>

View File

@ -11,8 +11,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_marginTop="40dp" android:layout_marginTop="40dp"
android:background="?foundation"
style="@style/BottomSheetModal" style="@style/BottomSheetModal"
android:backgroundTint="?foundation"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<View <View
android:id="@+id/handle" android:id="@+id/handle"
@ -28,7 +28,10 @@
android:id="@+id/tab_layout" android:id="@+id/tab_layout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="80dp" android:layout_height="80dp"
app:tabSelectedTextColor="?accent"
app:tabTextColor="?secondaryText"
app:tabIndicatorColor="?accent" app:tabIndicatorColor="?accent"
app:tabIconTint="@color/tab_icon"
app:tabRippleColor="@android:color/transparent" app:tabRippleColor="@android:color/transparent"
app:layout_constraintWidth_percent="0.5" app:layout_constraintWidth_percent="0.5"
app:layout_constraintTop_toBottomOf="@+id/handle" app:layout_constraintTop_toBottomOf="@+id/handle"
@ -45,7 +48,7 @@
android:id="@+id/private_tab_item" android:id="@+id/private_tab_item"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="0dp" android:layout_width="0dp"
android:icon="@drawable/private_browsing_button" android:icon="@drawable/ic_private_browsing"
android:text="Private" /> android:text="Private" />
</com.google.android.material.tabs.TabLayout> </com.google.android.material.tabs.TabLayout>
<ImageButton <ImageButton
@ -69,7 +72,7 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tab_layout" app:layout_constraintTop_toBottomOf="@+id/tab_layout"
mozac:tabsTrayItemBackgroundColor="?tabTrayItemBackground" mozac:tabsTrayItemBackgroundColor="?foundation"
mozac:tabsTrayItemTextColor="?tabTrayItemText" mozac:tabsTrayItemTextColor="?tabTrayItemText"
mozac:tabsTraySelectedItemBackgroundColor="?tabTrayItemSelectedBackground" mozac:tabsTraySelectedItemBackgroundColor="?tabTrayItemSelectedBackground"
mozac:tabsTraySelectedItemTextColor="?tabTrayItemText" mozac:tabsTraySelectedItemTextColor="?tabTrayItemText"

View File

@ -11,7 +11,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_margin="16dp"
android:backgroundTint="@color/photonBlue50" android:backgroundTint="?accent"
android:contentDescription="TODO: Changeme" android:contentDescription="TODO: Changeme"
app:srcCompat="@drawable/ic_new" app:srcCompat="@drawable/ic_new"
app:tint="@color/photonWhite" /> app:tint="@color/photonWhite" />

View File

@ -546,7 +546,9 @@
<item name="cornerFamily">rounded</item> <item name="cornerFamily">rounded</item>
<item name="cornerSizeTopLeft">16dp</item> <item name="cornerSizeTopLeft">16dp</item>
<item name="cornerSizeTopRight">16dp</item> <item name="cornerSizeTopRight">16dp</item>
<item name="colorSurface">?foundation</item> <item name="colorSurface">@color/photonPurple50</item>
<item name="android:backgroundTint">@color/photonPurple50</item>
<item name="android:colorBackground">@color/photonPurple50</item>
</style> </style>
<style name="BottomSheetModal" parent="Widget.Design.BottomSheet.Modal"> <style name="BottomSheetModal" parent="Widget.Design.BottomSheet.Modal">