Browse Source

Removed hardcoded dark oval placeholder

Vadik Sirekanyan 7 years ago
parent
commit
a9e76dba5b

+ 3 - 2
app/src/main/java/me/vadik/knigopis/common/ImageView.kt

@@ -6,12 +6,13 @@ import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
 import com.bumptech.glide.request.RequestOptions
 import me.vadik.knigopis.R
 
-fun ImageView.setCircleImage(url: String?, placeholder: Int? = null) {
+fun ImageView.setCircleImage(url: String?) {
     Glide.with(context)
         .load(url)
         .apply(
             RequestOptions.circleCropTransform()
-                .placeholder(placeholder ?: R.drawable.oval_placeholder_background)
+                .placeholder(R.drawable.oval_placeholder_background)
+                .theme(context.theme)
         )
         .transition(DrawableTransitionOptions.withCrossFade())
         .into(this)

+ 1 - 1
app/src/main/java/me/vadik/knigopis/user/UserActivity.kt

@@ -54,7 +54,7 @@ class UserActivity : AppCompatActivity() {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.user_activity)
         toolbar.title = intent.getStringExtra(EXTRA_USER_NAME)
-        toolbarImage.setCircleImage(intent.getStringExtra(EXTRA_USER_PHOTO), R.drawable.oval_dark_placeholder_background)
+        toolbarImage.setCircleImage(intent.getStringExtra(EXTRA_USER_PHOTO))
         toolbarImage.setElevationRes(R.dimen.image_view_elevation)
         setSupportActionBar(toolbar)
         fab.setOnClickListener { view ->

+ 0 - 5
app/src/main/res/drawable/oval_dark_placeholder_background.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="oval">
-    <solid android:color="@color/image_placeholder_color_dark" />
-</shape>

+ 2 - 1
app/src/main/res/layout/user_activity.xml

@@ -44,7 +44,8 @@
         android:layout_marginLeft="16dp"
         android:layout_marginRight="16dp"
         android:layout_marginTop="56dp"
-        android:src="@drawable/oval_dark_placeholder_background"
+        android:src="@drawable/oval_placeholder_background"
+        android:theme="@style/DarkAppTheme"
         app:appBarLayout="@+id/app_bar"
         app:appBarMaxHeight="@dimen/app_bar_height"
         app:appBarMinHeight="@dimen/toolbar_height"