Improve failed avatar

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-05-28 21:50:38 +02:00
parent d7e7c29713
commit 05f358a270
3 changed files with 8 additions and 2 deletions

View file

@ -157,6 +157,7 @@ dependencies {
implementation 'eu.davidea:flipview:1.1.3'
implementation 'com.webianks.library:popup-bubble:1.0.5'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'

View file

@ -47,6 +47,7 @@ import android.view.inputmethod.EditorInfo;
import android.widget.AbsListView;
import android.widget.ImageView;
import com.amulyakhare.textdrawable.TextDrawable;
import com.bluelinelabs.conductor.RouterTransaction;
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
import com.bumptech.glide.load.DataSource;
@ -56,7 +57,6 @@ import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.nextcloud.talk.utils.ApplicationWideCurrentRoomHolder;
import com.nextcloud.talk.R;
import com.nextcloud.talk.activities.CallActivity;
import com.nextcloud.talk.adapters.messages.MagicIncomingTextMessageViewHolder;
@ -76,6 +76,7 @@ import com.nextcloud.talk.models.json.rooms.Room;
import com.nextcloud.talk.models.json.rooms.RoomsOverall;
import com.nextcloud.talk.presenters.MentionAutocompletePresenter;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.ApplicationWideCurrentRoomHolder;
import com.nextcloud.talk.utils.KeyboardUtils;
import com.nextcloud.talk.utils.bundle.BundleKeys;
import com.nextcloud.talk.utils.database.user.UserUtils;
@ -282,7 +283,10 @@ public class ChatController extends BaseController implements MessagesListAdapte
.listener(new RequestListener<Bitmap>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
imageView.setVisibility(View.GONE);
TextDrawable drawable = TextDrawable.builder().beginConfig().bold()
.width(imageView.getMeasuredWidth()).height(imageView.getMeasuredHeight())
.endConfig().buildRound("?", getResources().getColor(R.color.nc_grey));
imageView.setImageDrawable(drawable);
return true;
}

View file

@ -16,5 +16,6 @@
<color name="nc_material_yellow">#FFEB3B</color>
<color name="nc_light_grey">#E8E8E8</color>
<color name="grey_600">#757575</color>
<color name="nc_grey">#D5D5D5</color>
</resources>