modify my location screen ui
This commit is contained in:
parent
4b96de71c8
commit
ea4e6ed445
4 changed files with 29 additions and 5 deletions
|
@ -50,7 +50,7 @@
|
||||||
android:id="@+id/text_container"
|
android:id="@+id/text_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
android:layout_marginBottom="@dimen/content_padding_half"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="@dimen/my_location_text_sides_margin"
|
android:paddingLeft="@dimen/my_location_text_sides_margin"
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/action_bar_height">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<net.osmand.telegram.ui.views.TextViewEx
|
<net.osmand.telegram.ui.views.TextViewEx
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
|
@ -66,6 +66,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:paddingTop="@dimen/app_bar_title_padding_small"
|
||||||
|
android:paddingBottom="@dimen/app_bar_title_padding_small"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<dimen name="app_bar_title_padding_small">8dp</dimen>
|
||||||
|
<dimen name="app_bar_title_padding_big">14dp</dimen>
|
||||||
<dimen name="content_padding_tiny">2dp</dimen>
|
<dimen name="content_padding_tiny">2dp</dimen>
|
||||||
<dimen name="content_padding_small">4dp</dimen>
|
<dimen name="content_padding_small">4dp</dimen>
|
||||||
<dimen name="content_padding_half">8dp</dimen>
|
<dimen name="content_padding_half">8dp</dimen>
|
||||||
|
@ -51,7 +53,7 @@
|
||||||
|
|
||||||
<dimen name="image_button_padding">12dp</dimen>
|
<dimen name="image_button_padding">12dp</dimen>
|
||||||
|
|
||||||
<dimen name="my_location_image_height">168dp</dimen>
|
<dimen name="my_location_image_height">148dp</dimen>
|
||||||
<dimen name="my_location_text_sides_margin">32dp</dimen>
|
<dimen name="my_location_text_sides_margin">32dp</dimen>
|
||||||
<dimen name="my_location_user_icon_size">60dp</dimen>
|
<dimen name="my_location_user_icon_size">60dp</dimen>
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,8 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
|
||||||
private var textMarginBig: Int = 0
|
private var textMarginBig: Int = 0
|
||||||
private var searchBoxHeight: Int = 0
|
private var searchBoxHeight: Int = 0
|
||||||
private var searchBoxSidesMargin: Int = 0
|
private var searchBoxSidesMargin: Int = 0
|
||||||
|
private var titlePaddingSmall: Int = 0
|
||||||
|
private var titlePaddingBig: Int = 0
|
||||||
|
|
||||||
private var appBarScrollRange: Int = -1
|
private var appBarScrollRange: Int = -1
|
||||||
|
|
||||||
|
@ -108,6 +110,8 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
|
||||||
textMarginBig = resources.getDimensionPixelSize(R.dimen.my_location_text_sides_margin)
|
textMarginBig = resources.getDimensionPixelSize(R.dimen.my_location_text_sides_margin)
|
||||||
searchBoxHeight = resources.getDimensionPixelSize(R.dimen.search_box_height)
|
searchBoxHeight = resources.getDimensionPixelSize(R.dimen.search_box_height)
|
||||||
searchBoxSidesMargin = resources.getDimensionPixelSize(R.dimen.content_padding_half)
|
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()
|
sharingMode = settings.hasAnyChatToShareLocation()
|
||||||
|
|
||||||
|
@ -175,7 +179,6 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
|
||||||
if (Build.VERSION.SDK_INT >= 16) {
|
if (Build.VERSION.SDK_INT >= 16) {
|
||||||
layoutTransition.enableTransitionType(LayoutTransition.CHANGING)
|
layoutTransition.enableTransitionType(LayoutTransition.CHANGING)
|
||||||
}
|
}
|
||||||
AndroidUtils.addStatusBarPadding19v(app, this)
|
|
||||||
title = findViewById(R.id.title)
|
title = findViewById(R.id.title)
|
||||||
description = findViewById(R.id.description)
|
description = findViewById(R.id.description)
|
||||||
}
|
}
|
||||||
|
@ -400,10 +403,19 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
|
||||||
private fun adjustText() {
|
private fun adjustText() {
|
||||||
val gravity = if (appBarCollapsed) Gravity.START else Gravity.CENTER
|
val gravity = if (appBarCollapsed) Gravity.START else Gravity.CENTER
|
||||||
val padding = if (appBarCollapsed) textMarginSmall else textMarginBig
|
val padding = if (appBarCollapsed) textMarginSmall else textMarginBig
|
||||||
|
val titlePadding = if (appBarCollapsed) titlePaddingBig else titlePaddingSmall
|
||||||
textContainer.apply {
|
textContainer.apply {
|
||||||
setPadding(padding, paddingTop, padding, paddingBottom)
|
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
|
description.gravity = gravity
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
fun getNavBarHeight(ctx: Context): Int {
|
||||||
if (!hasNavBar(ctx)) {
|
if (!hasNavBar(ctx)) {
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in a new issue