Commit e2cd661b authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.Android...

Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.Android into userstatus-on-toolbar
parents 7bfaa153 81ef4d99
......@@ -83,7 +83,7 @@ public class RocketChatCache {
listener = (sharedPreferences, changedKey) -> {
if (key.equals(changedKey) && !emitter.isCancelled()) {
String value = getString(key, null);
emitter.onNext(Optional.of(value));
emitter.onNext(Optional.ofNullable(value));
}
};
......
......@@ -4,8 +4,10 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.TextViewCompat;
import android.text.TextUtils;
import android.util.AttributeSet;
......@@ -21,6 +23,8 @@ import chat.rocket.core.models.Attachment;
import chat.rocket.core.models.AttachmentAuthor;
import chat.rocket.core.models.AttachmentField;
import chat.rocket.core.models.AttachmentTitle;
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
import com.facebook.drawee.view.SimpleDraweeView;
import java.util.List;
......@@ -210,10 +214,20 @@ public class RocketChatMessageAttachmentsLayout extends LinearLayout {
imageContainer.setVisibility(VISIBLE);
final SimpleDraweeView attachedImage =
(SimpleDraweeView) attachmentView.findViewById(R.id.image);
final SimpleDraweeView attachedImage = attachmentView.findViewById(R.id.image);
final View load = attachmentView.findViewById(R.id.image_load);
// Fix for https://fabric.io/rocketchat3/android/apps/chat.rocket.android/issues/59982403be077a4dcc4d7dc3/sessions/599F217000CF00015C771EEF2021AA0F_f9320e3f88fd11e7935256847afe9799_0_v2?
// From: https://github.com/facebook/fresco/issues/1176#issuecomment-216830098
// android.support.v4.content.ContextCompat creates your vector drawable
Drawable placeholderDrawable = ContextCompat.getDrawable(getContext(), R.drawable.image_dummy);
// Set the placeholder image to the placeholder vector drawable
attachedImage.setHierarchy(
GenericDraweeHierarchyBuilder.newInstance(getResources())
.setPlaceholderImage(placeholderDrawable)
.build());
loadImage(absolutize(attachment.getImageUrl()), attachedImage, load, autoloadImages);
}
......
......@@ -220,6 +220,9 @@ public class AutocompleteManager {
}
private void replaceSelected(String autocompleteSuggestion) {
if (text == null) {
return;
}
final String preText = text.substring(0, fromIndex);
final String postText = text.substring(toIndex);
......
......@@ -12,7 +12,7 @@ public abstract class AutocompleteSource<A extends AutocompleteAdapter, I extend
new AutocompleteViewHolder.OnClickListener<I>() {
@Override
public void onClick(I autocompleteItem) {
if (autocompleteSelected != null) {
if (autocompleteSelected != null && autocompleteItem != null) {
autocompleteSelected.onSelected(getAutocompleteSuggestion(autocompleteItem));
}
}
......
......@@ -99,7 +99,7 @@ public class UserSource extends AutocompleteSource<UserAdapter, UserItem> {
@Override
protected String getAutocompleteSuggestion(UserItem autocompleteItem) {
return getTrigger() + autocompleteItem.getSuggestion();
return getTrigger() + (autocompleteItem == null ? "" : autocompleteItem.getSuggestion());
}
private List<UserItem> toUserItemList(List<SpotlightUser> users) {
......
......@@ -106,7 +106,6 @@
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginBottom="8dp"
fresco:placeholderImage="@drawable/image_dummy"
fresco:actualImageScaleType="fitStart" />
<TextView
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment