1
0
Fork 0

For #1843 - Adds a better theme for the creation fragment

master
Jeff Boek 2019-04-22 21:00:01 -07:00 committed by Emily Kager
parent ba90b58d32
commit d39c15402e
6 changed files with 31 additions and 15 deletions

View File

@ -4,21 +4,29 @@ package org.mozilla.fenix.collections
License, v. 2.0. If a copy of the MPL was not distributed with this 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/. */ file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import kotlinx.android.synthetic.main.fragment_create_collection.view.* import kotlinx.android.synthetic.main.fragment_create_collection.view.*
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.mvi.ActionBusFactory import org.mozilla.fenix.mvi.ActionBusFactory
import org.mozilla.fenix.mvi.getManagedEmitter import org.mozilla.fenix.mvi.getManagedEmitter
class CreateCollectionFragment : Fragment() { class CreateCollectionFragment : DialogFragment() {
private lateinit var collectionCreationComponent: CollectionCreationComponent private lateinit var collectionCreationComponent: CollectionCreationComponent
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(DialogFragment.STYLE_NO_TITLE, R.style.CreateCollectionDialogStyle)
}
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle? savedInstanceState: Bundle?
@ -41,4 +49,8 @@ class CreateCollectionFragment : Fragment() {
getManagedEmitter<CollectionCreationChange>().onNext(CollectionCreationChange.TabListChange(tabs)) getManagedEmitter<CollectionCreationChange>().onNext(CollectionCreationChange.TabListChange(tabs))
} }
companion object {
const val createCollectionTag = "createCollection"
}
} }

View File

@ -33,6 +33,7 @@ import org.mozilla.fenix.BrowsingModeManager
import org.mozilla.fenix.DefaultThemeManager import org.mozilla.fenix.DefaultThemeManager
import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.collections.CreateCollectionFragment
import org.mozilla.fenix.collections.CreateCollectionViewModel import org.mozilla.fenix.collections.CreateCollectionViewModel
import org.mozilla.fenix.collections.Tab import org.mozilla.fenix.collections.Tab
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
@ -187,8 +188,8 @@ class HomeFragment : Fragment(), CoroutineScope {
ViewModelProviders.of(this).get(CreateCollectionViewModel::class.java) ViewModelProviders.of(this).get(CreateCollectionViewModel::class.java)
}!!.tabs = tabs }!!.tabs = tabs
val direction = HomeFragmentDirections.actionHomeFragmentToCreateCollectionFragment() CreateCollectionFragment()
Navigation.findNavController(view!!).navigate(direction) .show(requireActivity().supportFragmentManager, CreateCollectionFragment.createCollectionTag)
} }
is TabAction.MenuTapped -> { is TabAction.MenuTapped -> {
val isPrivate = (activity as HomeActivity).browsingModeManager.isPrivate val isPrivate = (activity as HomeActivity).browsingModeManager.isPrivate

View File

@ -4,6 +4,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient <gradient
android:startColor="?accentBright" android:startColor="#F5393473"
android:endColor="?accent" /> android:endColor="#F520123A"
android:angle="45" />
</shape> </shape>

View File

@ -4,7 +4,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/create_collection_background" android:background="@drawable/create_collection_background"
android:fitsSystemWindows="true"
tools:context="org.mozilla.fenix.collections.CreateCollectionFragment"> tools:context="org.mozilla.fenix.collections.CreateCollectionFragment">
</FrameLayout> </FrameLayout>

View File

@ -32,9 +32,6 @@
<action <action
android:id="@+id/action_homeFragment_to_settingsFragment" android:id="@+id/action_homeFragment_to_settingsFragment"
app:destination="@id/settingsFragment" /> app:destination="@id/settingsFragment" />
<action
android:id="@+id/action_homeFragment_to_createCollectionFragment"
app:destination="@id/createCollectionFragment" />
</fragment> </fragment>
<fragment <fragment
@ -287,10 +284,4 @@
android:id="@+id/trackingProtectionFragment" android:id="@+id/trackingProtectionFragment"
android:name="org.mozilla.fenix.settings.TrackingProtectionFragment" android:name="org.mozilla.fenix.settings.TrackingProtectionFragment"
android:label="TrackingProtectionFragment" /> android:label="TrackingProtectionFragment" />
<fragment
android:id="@+id/createCollectionFragment"
android:name="org.mozilla.fenix.collections.CreateCollectionFragment"
android:label="fragment_create_collection"
tools:layout="@layout/fragment_create_collection" >
</fragment>
</navigation> </navigation>

View File

@ -108,6 +108,18 @@
<item name="android:paddingEnd">24dp</item> <item name="android:paddingEnd">24dp</item>
</style> </style>
<style name="CreateCollectionDialogStyle" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowAnimationStyle">@style/Animation.Design.BottomSheetDialog</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
<style name="CurrentSessionBottomSheetDialogTheme" parent="Theme.MaterialComponents.Light.BottomSheetDialog"> <style name="CurrentSessionBottomSheetDialogTheme" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/CurrentSessionBottomSheetStyle</item> <item name="bottomSheetStyle">@style/CurrentSessionBottomSheetStyle</item>
<item name="android:textColor">@color/primary_text_normal_theme</item> <item name="android:textColor">@color/primary_text_normal_theme</item>