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
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 androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.ViewModelProviders
import kotlinx.android.synthetic.main.fragment_create_collection.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.mvi.ActionBusFactory
import org.mozilla.fenix.mvi.getManagedEmitter
class CreateCollectionFragment : Fragment() {
class CreateCollectionFragment : DialogFragment() {
private lateinit var collectionCreationComponent: CollectionCreationComponent
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(DialogFragment.STYLE_NO_TITLE, R.style.CreateCollectionDialogStyle)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
@ -41,4 +49,8 @@ class CreateCollectionFragment : Fragment() {
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.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.collections.CreateCollectionFragment
import org.mozilla.fenix.collections.CreateCollectionViewModel
import org.mozilla.fenix.collections.Tab
import org.mozilla.fenix.components.metrics.Event
@ -187,8 +188,8 @@ class HomeFragment : Fragment(), CoroutineScope {
ViewModelProviders.of(this).get(CreateCollectionViewModel::class.java)
}!!.tabs = tabs
val direction = HomeFragmentDirections.actionHomeFragmentToCreateCollectionFragment()
Navigation.findNavController(view!!).navigate(direction)
CreateCollectionFragment()
.show(requireActivity().supportFragmentManager, CreateCollectionFragment.createCollectionTag)
}
is TabAction.MenuTapped -> {
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/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="?accentBright"
android:endColor="?accent" />
android:startColor="#F5393473"
android:endColor="#F520123A"
android:angle="45" />
</shape>

View File

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

View File

@ -32,9 +32,6 @@
<action
android:id="@+id/action_homeFragment_to_settingsFragment"
app:destination="@id/settingsFragment" />
<action
android:id="@+id/action_homeFragment_to_createCollectionFragment"
app:destination="@id/createCollectionFragment" />
</fragment>
<fragment
@ -287,10 +284,4 @@
android:id="@+id/trackingProtectionFragment"
android:name="org.mozilla.fenix.settings.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>

View File

@ -108,6 +108,18 @@
<item name="android:paddingEnd">24dp</item>
</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">
<item name="bottomSheetStyle">@style/CurrentSessionBottomSheetStyle</item>
<item name="android:textColor">@color/primary_text_normal_theme</item>