Fix small UI issues

This commit is contained in:
Alex Sytnyk 2018-06-27 19:00:40 +03:00
parent b56ffe8fc7
commit f7b49495e3
4 changed files with 36 additions and 17 deletions

View file

@ -28,21 +28,27 @@
android:paddingLeft="@dimen/my_location_text_sides_margin"
android:paddingRight="@dimen/my_location_text_sides_margin">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_height">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:text="@string/start_location_sharing"
android:textColor="?attr/ctrl_active_color"
android:textSize="@dimen/title_text_size"
android:textStyle="bold"/>
</FrameLayout>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding_half"
android:gravity="center"
android:text="@string/location_sharing_description"
android:textColor="?android:attr/textColorSecondary"

View file

@ -34,4 +34,6 @@
<color name="primary_btn_text_light">#ffffff</color>
<color name="primary_btn_text_dark">#cccccc</color>
<color name="app_bar_title_light">#333333</color>
</resources>

View file

@ -6,7 +6,7 @@
<dimen name="progress_bar_size_small">32dp</dimen>
<dimen name="action_bar_height">60dp</dimen>
<dimen name="action_bar_height">56dp</dimen>
<dimen name="dialog_padding_vertical">24dp</dimen>
<dimen name="dialog_padding_horizontal">60dp</dimen>

View file

@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.os.Build
import android.os.Bundle
import android.support.annotation.ColorRes
import android.support.design.widget.AppBarLayout
import android.support.v4.app.Fragment
import android.support.v4.content.ContextCompat
@ -218,22 +219,32 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
val animatorSet = AnimatorSet()
animatorSet.duration = 200
animatorSet.playTogether(cornerAnimator, marginAnimator)
if (Build.VERSION.SDK_INT >= 21) {
if (appBarCollapsed) {
animatorSet.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
if (Build.VERSION.SDK_INT >= 21 && appBarCollapsed) {
if (appBarCollapsed) {
updateTitleTextColor(R.color.app_bar_title_light)
if (Build.VERSION.SDK_INT >= 21) {
appBarLayout.outlineProvider = appBarOutlineProvider
}
}
}
})
} else {
updateTitleTextColor(R.color.ctrl_active_light)
if (Build.VERSION.SDK_INT >= 21) {
appBarLayout.outlineProvider = null
}
}
animatorSet.start()
}
private fun updateTitleTextColor(@ColorRes color: Int) {
context?.also {
title.setTextColor(ContextCompat.getColor(it, color))
}
}
private fun updateList() {
val chatList = telegramHelper.getChatList()
val chats: MutableList<TdApi.Chat> = mutableListOf()