improved dm entry profile image on pre-lollipop devices
This commit is contained in:
parent
a4368d699e
commit
a0d68b91d2
|
@ -60,7 +60,7 @@ class AccountDetailsAdapter(
|
||||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
||||||
val view = super.getView(position, convertView, parent)
|
val view = super.getView(position, convertView, parent)
|
||||||
val holder = view.tag as? AccountViewHolder ?: run {
|
val holder = view.tag as? AccountViewHolder ?: run {
|
||||||
val h = AccountViewHolder(view, this)
|
val h = AccountViewHolder(this, view)
|
||||||
view.tag = h
|
view.tag = h
|
||||||
return@run h
|
return@run h
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.content.Context
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.bumptech.glide.RequestManager
|
import com.bumptech.glide.RequestManager
|
||||||
import org.mariotaku.twidere.R
|
import org.mariotaku.twidere.R
|
||||||
|
import org.mariotaku.twidere.view.holder.MediaStatusViewHolder
|
||||||
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder
|
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -121,11 +121,17 @@ fun RequestManager.loadProfileImage(context: Context, conversation: ParcelableMe
|
||||||
return loadProfileImage(context, user, shapeStyle, cornerRadius, cornerRadiusRatio, size)
|
return loadProfileImage(context, user, shapeStyle, cornerRadius, cornerRadiusRatio, size)
|
||||||
} else {
|
} else {
|
||||||
// TODO: show default conversation icon
|
// TODO: show default conversation icon
|
||||||
return loadProfileImage(context, R.drawable.ic_profile_image_default_group, shapeStyle)
|
return loadProfileImage(context, R.drawable.ic_profile_image_default_group, shapeStyle,
|
||||||
|
cornerRadius, cornerRadiusRatio)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return loadProfileImage(context, conversation.conversation_avatar, shapeStyle, cornerRadius,
|
if (conversation.conversation_avatar != null) {
|
||||||
cornerRadiusRatio, size).placeholder(R.drawable.ic_profile_image_default_group)
|
return loadProfileImage(context, conversation.conversation_avatar, shapeStyle, cornerRadius,
|
||||||
|
cornerRadiusRatio, size)
|
||||||
|
} else {
|
||||||
|
return loadProfileImage(context, R.drawable.ic_profile_image_default_group, shapeStyle,
|
||||||
|
cornerRadius, cornerRadiusRatio)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Twidere - Twitter client for Android
|
* Twidere - Twitter client for Android
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
* Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
@ -34,8 +34,8 @@ import org.mariotaku.twidere.view.ProfileImageView
|
||||||
import org.mariotaku.twidere.view.iface.IColorLabelView
|
import org.mariotaku.twidere.view.iface.IColorLabelView
|
||||||
|
|
||||||
class AccountViewHolder(
|
class AccountViewHolder(
|
||||||
itemView: View,
|
val adapter: AccountDetailsAdapter,
|
||||||
val adapter: AccountDetailsAdapter
|
itemView: View
|
||||||
) : RecyclerView.ViewHolder(itemView) {
|
) : RecyclerView.ViewHolder(itemView) {
|
||||||
|
|
||||||
private val content = itemView as IColorLabelView
|
private val content = itemView as IColorLabelView
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mariotaku.twidere.adapter
|
package org.mariotaku.twidere.view.holder
|
||||||
|
|
||||||
import android.support.v7.widget.RecyclerView
|
import android.support.v7.widget.RecyclerView
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -36,14 +36,17 @@ import org.mariotaku.twidere.view.ProfileImageView
|
||||||
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder
|
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder
|
||||||
|
|
||||||
class MediaStatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View) : RecyclerView.ViewHolder(itemView), IStatusViewHolder, View.OnClickListener, View.OnLongClickListener {
|
class MediaStatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View) : RecyclerView.ViewHolder(itemView), IStatusViewHolder, View.OnClickListener, View.OnLongClickListener {
|
||||||
|
override val profileImageView: ProfileImageView = itemView.mediaProfileImage
|
||||||
|
|
||||||
|
private val mediaImageContainer = itemView.mediaImageContainer
|
||||||
|
|
||||||
|
private val mediaImageView = itemView.mediaImage
|
||||||
|
private val mediaTextView = itemView.mediaText
|
||||||
|
|
||||||
private val aspectRatioSource = SimpleAspectRatioSource().apply {
|
private val aspectRatioSource = SimpleAspectRatioSource().apply {
|
||||||
setSize(100, 100)
|
setSize(100, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val mediaImageContainer = itemView.mediaImageContainer
|
|
||||||
private val mediaImageView = itemView.mediaImage
|
|
||||||
override val profileImageView: ProfileImageView = itemView.mediaProfileImage
|
|
||||||
private val mediaTextView = itemView.mediaText
|
|
||||||
private var listener: IStatusViewHolder.StatusClickListener? = null
|
private var listener: IStatusViewHolder.StatusClickListener? = null
|
||||||
|
|
||||||
override val profileTypeView: ImageView?
|
override val profileTypeView: ImageView?
|
||||||
|
|
|
@ -50,13 +50,6 @@
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
tools:src="@drawable/featured_graphics"/>
|
tools:src="@drawable/featured_graphics"/>
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/mediaImageProgress"
|
|
||||||
style="?android:progressBarStyleHorizontal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_margin="@dimen/element_spacing_small"/>
|
|
||||||
</com.commonsware.cwac.layouts.AspectLockedFrameLayout>
|
</com.commonsware.cwac.layouts.AspectLockedFrameLayout>
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||||
|
|
Loading…
Reference in New Issue