diff --git a/OsmAnd-telegram/res/anim/slide_in_bottom.xml b/OsmAnd-telegram/res/anim/slide_in_bottom.xml
new file mode 100644
index 0000000000..e8e2aa6b8a
--- /dev/null
+++ b/OsmAnd-telegram/res/anim/slide_in_bottom.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/OsmAnd-telegram/res/anim/slide_out_bottom.xml b/OsmAnd-telegram/res/anim/slide_out_bottom.xml
new file mode 100644
index 0000000000..114d58362f
--- /dev/null
+++ b/OsmAnd-telegram/res/anim/slide_out_bottom.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/OsmAnd-telegram/res/layout/bottom_sheet_dialog.xml b/OsmAnd-telegram/res/layout/bottom_sheet_dialog.xml
new file mode 100644
index 0000000000..7f00842375
--- /dev/null
+++ b/OsmAnd-telegram/res/layout/bottom_sheet_dialog.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
diff --git a/OsmAnd-telegram/res/values/styles.xml b/OsmAnd-telegram/res/values/styles.xml
index 5346f00662..65da93a77e 100644
--- a/OsmAnd-telegram/res/values/styles.xml
+++ b/OsmAnd-telegram/res/values/styles.xml
@@ -73,4 +73,13 @@
- @drawable/btn_round
+
+
+
+
+
+
diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/views/BottomSheetDialog.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/views/BottomSheetDialog.kt
new file mode 100644
index 0000000000..a766be3c0f
--- /dev/null
+++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/views/BottomSheetDialog.kt
@@ -0,0 +1,70 @@
+package net.osmand.telegram.ui.views
+
+import android.app.Dialog
+import android.content.Context
+import android.os.Build
+import android.os.Bundle
+import android.view.View
+import android.view.ViewGroup
+import android.view.Window
+import android.view.WindowManager
+import net.osmand.telegram.R
+
+class BottomSheetDialog(ctx: Context, themeId: Int) : Dialog(ctx, themeId) {
+
+ init {
+ requestWindowFeature(Window.FEATURE_NO_TITLE)
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ window?.apply {
+ if (Build.VERSION.SDK_INT >= 21) {
+ clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
+ addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
+ }
+ setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
+ attributes?.windowAnimations = R.style.Animations_PopUpMenu_Bottom
+ }
+ }
+
+ override fun setContentView(layoutResID: Int) {
+ super.setContentView(wrapInContainer(layoutResID, null, null))
+ }
+
+ override fun setContentView(view: View?) {
+ super.setContentView(wrapInContainer(0, view, null))
+ }
+
+ override fun setContentView(view: View?, params: ViewGroup.LayoutParams?) {
+ super.setContentView(wrapInContainer(0, view, params))
+ }
+
+ private fun wrapInContainer(
+ layoutResId: Int,
+ view: View?,
+ params: ViewGroup.LayoutParams?
+ ): View {
+ val res = View.inflate(context, R.layout.bottom_sheet_dialog, null)
+ val container = res.findViewById(R.id.content_container)
+ var v = view
+
+ if (layoutResId != 0 && v == null) {
+ v = layoutInflater.inflate(layoutResId, container, false)
+ }
+ if (params == null) {
+ container.addView(v)
+ } else {
+ container.addView(v, params)
+ }
+
+ res.findViewById(R.id.touch_outside).setOnClickListener {
+ cancel()
+ }
+
+ // Consume the event and prevent it from falling through
+ container.setOnTouchListener { _, _ -> return@setOnTouchListener true }
+
+ return res
+ }
+}