improved dm entry profile image on pre-lollipop devices

This commit is contained in:
Mariotaku Lee 2017-03-07 17:39:26 +08:00
parent a4368d699e
commit a0d68b91d2
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
6 changed files with 27 additions and 24 deletions

View File

@ -60,7 +60,7 @@ class AccountDetailsAdapter(
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
val view = super.getView(position, convertView, parent)
val holder = view.tag as? AccountViewHolder ?: run {
val h = AccountViewHolder(view, this)
val h = AccountViewHolder(this, view)
view.tag = h
return@run h
}

View File

@ -23,6 +23,7 @@ import android.content.Context
import android.view.ViewGroup
import com.bumptech.glide.RequestManager
import org.mariotaku.twidere.R
import org.mariotaku.twidere.view.holder.MediaStatusViewHolder
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder
/**

View File

@ -121,11 +121,17 @@ fun RequestManager.loadProfileImage(context: Context, conversation: ParcelableMe
return loadProfileImage(context, user, shapeStyle, cornerRadius, cornerRadiusRatio, size)
} else {
// 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 {
return loadProfileImage(context, conversation.conversation_avatar, shapeStyle, cornerRadius,
cornerRadiusRatio, size).placeholder(R.drawable.ic_profile_image_default_group)
if (conversation.conversation_avatar != null) {
return loadProfileImage(context, conversation.conversation_avatar, shapeStyle, cornerRadius,
cornerRadiusRatio, size)
} else {
return loadProfileImage(context, R.drawable.ic_profile_image_default_group, shapeStyle,
cornerRadius, cornerRadiusRatio)
}
}
}

View File

@ -1,18 +1,18 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* 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
class AccountViewHolder(
itemView: View,
val adapter: AccountDetailsAdapter
val adapter: AccountDetailsAdapter,
itemView: View
) : RecyclerView.ViewHolder(itemView) {
private val content = itemView as IColorLabelView

View File

@ -17,7 +17,7 @@
* 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.view.View
@ -36,14 +36,17 @@ import org.mariotaku.twidere.view.ProfileImageView
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder
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 {
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
override val profileTypeView: ImageView?

View File

@ -50,13 +50,6 @@
android:scaleType="centerCrop"
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>
<org.mariotaku.twidere.view.ColorLabelRelativeLayout