Add user photo to the "Disable all sharing" dialog
This commit is contained in:
parent
c5dfef67be
commit
f843c219ce
3 changed files with 44 additions and 0 deletions
|
@ -27,6 +27,26 @@
|
||||||
android:background="?attr/card_bg_color"
|
android:background="?attr/card_bg_color"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/disable_sharing_image_height">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/img_turn_off_sharing"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/user_icon"
|
||||||
|
android:layout_width="@dimen/my_location_user_icon_size"
|
||||||
|
android:layout_height="@dimen/my_location_user_icon_size"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="@dimen/disable_sharing_icon_top_margin"
|
||||||
|
tools:src="@drawable/img_user_picture"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<net.osmand.telegram.ui.views.TextViewEx
|
<net.osmand.telegram.ui.views.TextViewEx
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
<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>
|
||||||
|
|
||||||
|
<dimen name="disable_sharing_image_height">132dp</dimen>
|
||||||
|
<dimen name="disable_sharing_icon_top_margin">30dp</dimen>
|
||||||
|
|
||||||
<dimen name="search_box_height">48dp</dimen>
|
<dimen name="search_box_height">48dp</dimen>
|
||||||
|
|
||||||
<dimen name="buttons_bottom_bar_height">56dp</dimen>
|
<dimen name="buttons_bottom_bar_height">56dp</dimen>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package net.osmand.telegram.ui
|
package net.osmand.telegram.ui
|
||||||
|
|
||||||
|
import android.graphics.ColorMatrix
|
||||||
|
import android.graphics.ColorMatrixColorFilter
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.design.widget.BottomSheetBehavior
|
import android.support.design.widget.BottomSheetBehavior
|
||||||
import android.support.v4.app.DialogFragment
|
import android.support.v4.app.DialogFragment
|
||||||
|
@ -8,12 +10,20 @@ import android.support.v4.app.FragmentManager
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import net.osmand.telegram.R
|
import net.osmand.telegram.R
|
||||||
|
import net.osmand.telegram.TelegramApplication
|
||||||
|
import net.osmand.telegram.helpers.TelegramUiHelper
|
||||||
import net.osmand.telegram.ui.views.BottomSheetDialog
|
import net.osmand.telegram.ui.views.BottomSheetDialog
|
||||||
|
|
||||||
class DisableSharingBottomSheet : DialogFragment() {
|
class DisableSharingBottomSheet : DialogFragment() {
|
||||||
|
|
||||||
|
private val app: TelegramApplication
|
||||||
|
get() = activity?.application as TelegramApplication
|
||||||
|
|
||||||
|
private val telegramHelper get() = app.telegramHelper
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?) = BottomSheetDialog(context!!)
|
override fun onCreateDialog(savedInstanceState: Bundle?) = BottomSheetDialog(context!!)
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
|
@ -37,6 +47,17 @@ class DisableSharingBottomSheet : DialogFragment() {
|
||||||
override fun onSlide(bottomSheet: View, slideOffset: Float) {}
|
override fun onSlide(bottomSheet: View, slideOffset: Float) {}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mainView.findViewById<ImageView>(R.id.user_icon).apply {
|
||||||
|
colorFilter = ColorMatrixColorFilter(ColorMatrix().apply { setSaturation(0f) })
|
||||||
|
TelegramUiHelper.setupPhoto(
|
||||||
|
app,
|
||||||
|
this,
|
||||||
|
telegramHelper.getUserPhotoPath(telegramHelper.getCurrentUser()),
|
||||||
|
R.drawable.img_user_picture,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
mainView.findViewById<TextView>(R.id.description).text =
|
mainView.findViewById<TextView>(R.id.description).text =
|
||||||
getString(R.string.disable_all_sharing_desc, arguments?.getInt(CHATS_COUNT_KEY, -1))
|
getString(R.string.disable_all_sharing_desc, arguments?.getInt(CHATS_COUNT_KEY, -1))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue