Fix some bugs + coloring

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-05-04 15:53:06 +02:00
parent d7467b4fb6
commit c1c536496c
4 changed files with 21 additions and 24 deletions

View file

@ -86,7 +86,6 @@ public class MagicIncomingTextMessageViewHolder
if (individualHashMap.get("type").equals("user")) {
int color;
if (!individualHashMap.get("id").equals(message.getActorId())) {
if (individualHashMap.get("id").equals(currentUser.getUserId())) {
color = NextcloudTalkApplication.getSharedApplication().getResources().getColor(R.color
.nc_incoming_text_mention_you);
@ -99,7 +98,6 @@ public class MagicIncomingTextMessageViewHolder
messageString, "@" + individualHashMap.get("name"), color);
}
}
}
}

View file

@ -60,7 +60,6 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
private Context context;
private String roomToken;
private List<AbstractFlexibleItem> userItemList = new ArrayList<>();
public MentionAutocompletePresenter(Context context) {
super(context);
@ -77,7 +76,7 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
@Override
protected RecyclerView.Adapter instantiateAdapter() {
adapter = new FlexibleAdapter<>(userItemList, context, true);
adapter = new FlexibleAdapter<>(new ArrayList<AbstractFlexibleItem>(), context, true);
adapter.addListener(this);
return adapter;
}
@ -105,21 +104,18 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
List<AbstractFlexibleItem> internalUserItemList = new ArrayList<>();
if (mentionsList.size() == 0 ||
(mentionsList.size() == 1 && mentionsList.get(0).getId().equals(query.toString()))) {
userItemList = new ArrayList<>();
adapter.notifyDataSetChanged();
} else {
for (Mention mention : mentionsList) {
internalUserItemList.add(new MentionAutocompleteItem(mention.getId(), mention
.getLabel(), currentUser));
}
userItemList = internalUserItemList;
adapter.updateDataSet(internalUserItemList, true);
}
}
@Override
public void onError(Throwable e) {
userItemList = new ArrayList<>();
adapter.updateDataSet(new ArrayList<>(), false);
}
@ -129,7 +125,6 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
}
});
} else {
userItemList = new ArrayList<>();
adapter.updateDataSet(new ArrayList<>(), false);
}
}
@ -137,11 +132,13 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
@Override
public boolean onItemClick(View view, int position) {
Mention mention = new Mention();
MentionAutocompleteItem mentionAutocompleteItem = (MentionAutocompleteItem) userItemList.get(position);
MentionAutocompleteItem mentionAutocompleteItem = (MentionAutocompleteItem) adapter.getItem(position);
if (mentionAutocompleteItem != null) {
mention.setId(mentionAutocompleteItem.getUserId());
mention.setLabel(mentionAutocompleteItem.getDisplayName());
mention.setSource("users");
dispatchClick(mention);
}
return true;
}
}

View file

@ -40,7 +40,9 @@
app:outcomingTextSize="@dimen/chat_text_size"
app:outcomingTimeTextSize="12sp"
app:outcomingTextColor="@color/nc_outcoming_text_default"
app:outcomingTextLinkColor="@color/nc_outcoming_text_default"
app:incomingTextColor="@color/nc_incoming_text_default"
app:incomingTextLinkColor="@color/nc_incoming_text_default"
app:textAutoLink="all"/>
<View

View file

@ -6,9 +6,9 @@
<color name="secondaryColorAccent">#7CC4E6</color>
<color name="nc_outcoming_text_default">#99DBFF</color>
<color name="nc_outcoming_text_mention_others">@color/white</color>
<color name="nc_incoming_text_default">#27292B</color>
<color name="nc_incoming_text_default">#37505D</color>
<color name="nc_incoming_text_mention_you">#C98879</color>
<color name="nc_incoming_text_mention_others">#1D1F20</color>
<color name="nc_incoming_text_mention_others">#37505D</color>
<color name="nc_darkRed">#D32F2F</color>
<color name="nc_darkGreen">#006400</color>