diff --git a/app/build.gradle b/app/build.gradle index 55072f4595..40b0b40286 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -117,6 +117,7 @@ dependencies { implementation applicationDependencies.tableView implementation applicationDependencies.permissionDisp implementation applicationDependencies.pickT + implementation applicationDependencies.emojiCompat implementation applicationDependencies.viewModel implementation applicationDependencies.viewModelExtensions diff --git a/app/src/main/java/com/agileburo/anytype/app/AndroidApplication.kt b/app/src/main/java/com/agileburo/anytype/app/AndroidApplication.kt index 033f2e1401..dd45cb606e 100644 --- a/app/src/main/java/com/agileburo/anytype/app/AndroidApplication.kt +++ b/app/src/main/java/com/agileburo/anytype/app/AndroidApplication.kt @@ -1,7 +1,11 @@ package com.agileburo.anytype.app import android.app.Application +import androidx.core.provider.FontRequest +import androidx.emoji.text.EmojiCompat +import androidx.emoji.text.FontRequestEmojiCompatConfig import com.agileburo.anytype.BuildConfig +import com.agileburo.anytype.R import com.agileburo.anytype.core_utils.tools.CrashlyticsTree import com.agileburo.anytype.di.common.ComponentManager import com.agileburo.anytype.di.main.* @@ -27,10 +31,23 @@ class AndroidApplication : Application() { override fun onCreate() { super.onCreate() + + setupEmojiCompat() setupTimber() setupStetho() } + private fun setupEmojiCompat() { + val fontRequest = FontRequest( + "com.google.android.gms.fonts", + "com.google.android.gms", + "Graphik Regular", + R.array.certs + ) + val config = FontRequestEmojiCompatConfig(this, fontRequest) + EmojiCompat.init(config) + } + private fun setupTimber() { if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree()) diff --git a/app/src/main/java/com/agileburo/anytype/ui/page/modals/PageIconPickerFragment.kt b/app/src/main/java/com/agileburo/anytype/ui/page/modals/PageIconPickerFragment.kt index ec62299ff9..e5eeb2b615 100644 --- a/app/src/main/java/com/agileburo/anytype/ui/page/modals/PageIconPickerFragment.kt +++ b/app/src/main/java/com/agileburo/anytype/ui/page/modals/PageIconPickerFragment.kt @@ -1,9 +1,11 @@ package com.agileburo.anytype.ui.page.modals +import android.app.Dialog import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.FrameLayout import androidx.core.os.bundleOf import androidx.fragment.app.DialogFragment import androidx.lifecycle.Observer @@ -19,6 +21,8 @@ import com.agileburo.anytype.presentation.page.picker.PageIconPickerViewModel import com.agileburo.anytype.presentation.page.picker.PageIconPickerViewModel.Contract import com.agileburo.anytype.presentation.page.picker.PageIconPickerViewModel.ViewState import com.agileburo.anytype.presentation.page.picker.PageIconPickerViewModelFactory +import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialog import kotlinx.android.synthetic.main.fragment_page_icon_picker.* import javax.inject.Inject @@ -80,6 +84,12 @@ class PageIconPickerFragment : BaseBottomSheetFragment() { savedInstanceState: Bundle? ): View? = inflater.inflate(R.layout.fragment_page_icon_picker, container, false) + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog + setModalToFullScreenState(dialog) + return dialog + } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -120,6 +130,11 @@ class PageIconPickerFragment : BaseBottomSheetFragment() { vm.state.observe(viewLifecycleOwner, Observer { render(it) }) } + override fun onDestroyView() { + dialog?.setOnShowListener { null } + super.onDestroyView() + } + fun render(state: ViewState) { when (state) { is ViewState.Success -> pageIconPickerAdapter.update(state.views) @@ -136,6 +151,21 @@ class PageIconPickerFragment : BaseBottomSheetFragment() { componentManager().pageIconPickerSubComponent.release() } + private fun setModalToFullScreenState(dialog: BottomSheetDialog) = + dialog.setOnShowListener { dialogInterface -> + (dialogInterface as? BottomSheetDialog)?.let { bottomSheetDialog -> + bottomSheetDialog.findViewById(com.google.android.material.R.id.design_bottom_sheet) + ?.let { bottomSheetView -> + BottomSheetBehavior.from(bottomSheetView).apply { + val lp = bottomSheetView.layoutParams + lp.height = activity?.window?.decorView?.measuredHeight ?: 0 + bottomSheetView.layoutParams = lp + state = BottomSheetBehavior.STATE_EXPANDED + } + } + } + } + companion object { fun newInstance( diff --git a/app/src/main/res/layout/fragment_page.xml b/app/src/main/res/layout/fragment_page.xml index 44fab32eba..6e212795f6 100644 --- a/app/src/main/res/layout/fragment_page.xml +++ b/app/src/main/res/layout/fragment_page.xml @@ -35,7 +35,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file diff --git a/core-ui/src/main/res/font/graphik_font.xml b/core-ui/src/main/res/font/graphik_font.xml index c37c12fce2..cc592adbf4 100644 --- a/core-ui/src/main/res/font/graphik_font.xml +++ b/core-ui/src/main/res/font/graphik_font.xml @@ -1,5 +1,9 @@ - + Color Background + + + MIIEqDCCA5CgAwIBAgIJA071MA0GCSqGSIb3DQEBBAUAMIGUMQsww... + + diff --git a/dependencies.gradle b/dependencies.gradle index 82bc721695..3d0275e239 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -19,6 +19,7 @@ ext { material_version = '1.1.0-beta02' fragment_version = "1.2.3" ktx_core_version = "1.2.0" + emoji_compat_version = '1.1.0-beta01' // Architecture Components lifecycle_version = '2.1.0' @@ -96,6 +97,7 @@ ext { androidAnnotations: "androidx.annotation:annotation:$appcompat_version", betterLinkMovement: "me.saket:better-link-movement-method:$better_link_method_version", ktxCore: "androidx.core:core-ktx:$ktx_core_version", + emojiCompat: "androidx.emoji:emoji-appcompat:$emoji_compat_version", glide: "com.github.bumptech.glide:glide:$glide_version", glideCompiler: "com.github.bumptech.glide:compiler:$glide_version", diff --git a/library-page-icon-picker-widget/build.gradle b/library-page-icon-picker-widget/build.gradle index 6b939e7138..a2f0614ee0 100644 --- a/library-page-icon-picker-widget/build.gradle +++ b/library-page-icon-picker-widget/build.gradle @@ -55,6 +55,7 @@ dependencies { implementation applicationDependencies.kotlin implementation applicationDependencies.coroutines implementation applicationDependencies.androidxCore + implementation applicationDependencies.emojiCompat implementation applicationDependencies.design implementation applicationDependencies.recyclerView diff --git a/library-page-icon-picker-widget/src/main/res/layout/item_page_icon_picker_emoji_item.xml b/library-page-icon-picker-widget/src/main/res/layout/item_page_icon_picker_emoji_item.xml index b0d545305c..0b263f6806 100644 --- a/library-page-icon-picker-widget/src/main/res/layout/item_page_icon_picker_emoji_item.xml +++ b/library-page-icon-picker-widget/src/main/res/layout/item_page_icon_picker_emoji_item.xml @@ -1,16 +1,16 @@ + android:layout_width="match_parent" + android:layout_height="wrap_content"> - \ No newline at end of file