diff --git a/OsmAnd-telegram/res/layout/fragment_my_location_tab.xml b/OsmAnd-telegram/res/layout/fragment_my_location_tab.xml index 66f55f8a3b..5107615441 100644 --- a/OsmAnd-telegram/res/layout/fragment_my_location_tab.xml +++ b/OsmAnd-telegram/res/layout/fragment_my_location_tab.xml @@ -50,7 +50,7 @@ android:id="@+id/text_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/content_padding_standard" + android:layout_marginBottom="@dimen/content_padding_half" android:animateLayoutChanges="true" android:orientation="vertical" android:paddingLeft="@dimen/my_location_text_sides_margin" @@ -58,7 +58,7 @@ + android:layout_height="wrap_content"> + 8dp + 14dp 2dp 4dp 8dp @@ -51,7 +53,7 @@ 12dp - 168dp + 148dp 32dp 60dp diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt index 376ddea62b..154116af0b 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt @@ -52,6 +52,8 @@ class MyLocationTabFragment : Fragment(), TelegramListener { private var textMarginBig: Int = 0 private var searchBoxHeight: Int = 0 private var searchBoxSidesMargin: Int = 0 + private var titlePaddingSmall: Int = 0 + private var titlePaddingBig: Int = 0 private var appBarScrollRange: Int = -1 @@ -109,6 +111,8 @@ class MyLocationTabFragment : Fragment(), TelegramListener { textMarginBig = resources.getDimensionPixelSize(R.dimen.my_location_text_sides_margin) searchBoxHeight = resources.getDimensionPixelSize(R.dimen.search_box_height) searchBoxSidesMargin = resources.getDimensionPixelSize(R.dimen.content_padding_half) + titlePaddingSmall = resources.getDimensionPixelSize(R.dimen.app_bar_title_padding_small) + titlePaddingBig = resources.getDimensionPixelSize(R.dimen.app_bar_title_padding_big) sharingMode = settings.hasAnyChatToShareLocation() @@ -176,7 +180,6 @@ class MyLocationTabFragment : Fragment(), TelegramListener { if (Build.VERSION.SDK_INT >= 16) { layoutTransition.enableTransitionType(LayoutTransition.CHANGING) } - AndroidUtils.addStatusBarPadding19v(app, this) title = findViewById(R.id.title) description = findViewById(R.id.description) } @@ -402,10 +405,19 @@ class MyLocationTabFragment : Fragment(), TelegramListener { private fun adjustText() { val gravity = if (appBarCollapsed) Gravity.START else Gravity.CENTER val padding = if (appBarCollapsed) textMarginSmall else textMarginBig + val titlePadding = if (appBarCollapsed) titlePaddingBig else titlePaddingSmall textContainer.apply { setPadding(padding, paddingTop, padding, paddingBottom) + if (appBarCollapsed) { + AndroidUtils.addStatusBarPadding19v(app, this) + } else { + AndroidUtils.removeStatusBarPadding19v(app, this) + } + } + title.apply { + this.gravity = gravity + setPadding(paddingLeft, titlePadding, paddingRight, titlePadding) } - title.gravity = gravity description.gravity = gravity } diff --git a/OsmAnd-telegram/src/net/osmand/telegram/utils/AndroidUtils.kt b/OsmAnd-telegram/src/net/osmand/telegram/utils/AndroidUtils.kt index 2b0a0c1313..a30a58dbe7 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/utils/AndroidUtils.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/utils/AndroidUtils.kt @@ -106,6 +106,14 @@ object AndroidUtils { } } + fun removeStatusBarPadding19v(ctx: Context, view: View) { + if (Build.VERSION.SDK_INT >= 19) { + view.apply { + setPadding(paddingLeft, paddingTop - getStatusBarHeight(ctx), paddingRight, paddingBottom) + } + } + } + fun getNavBarHeight(ctx: Context): Int { if (!hasNavBar(ctx)) { return 0