Merge pull request #397 from nextcloud/fix-385

Fix #385
This commit is contained in:
Mario Đanić 2018-12-27 19:24:57 +01:00 committed by GitHub
commit 38775e09b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 149 additions and 38 deletions

View file

@ -204,56 +204,87 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
holder.dialogAvatar.setVisibility(View.VISIBLE);
switch (conversation.getType()) {
case ROOM_TYPE_ONE_TO_ONE_CALL:
boolean shouldLoadAvatar = true;
String objectType;
if (TextUtils.isEmpty(objectType = conversation.getObjectType())) {
switch (objectType) {
case "share:password":
shouldLoadAvatar = false;
GlideApp.with(context)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(R.drawable.ic_file_password_request)
.centerInside()
.override(avatarSize, avatarSize)
.apply(RequestOptions.bitmapTransform(new CircleCrop()))
.into(holder.dialogAvatar);
break;
case "file":
shouldLoadAvatar = false;
GlideApp.with(context)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(R.drawable.ic_file_icon)
.centerInside()
.override(avatarSize, avatarSize)
.apply(RequestOptions.bitmapTransform(new CircleCrop()))
.into(holder.dialogAvatar);
break;
default:
break;
}
}
if (!TextUtils.isEmpty(conversation.getName())) {
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
conversation.getName(), R.dimen.avatar_size), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());
if (shouldLoadAvatar) {
switch (conversation.getType()) {
case ROOM_TYPE_ONE_TO_ONE_CALL:
if (!TextUtils.isEmpty(conversation.getName())) {
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
conversation.getName(), R.dimen.avatar_size), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());
GlideApp.with(context)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(glideUrl)
.centerInside()
.override(avatarSize, avatarSize)
.apply(RequestOptions.bitmapTransform(new CircleCrop()))
.into(holder.dialogAvatar);
} else {
holder.dialogAvatar.setVisibility(View.GONE);
}
break;
case ROOM_GROUP_CALL:
GlideApp.with(context)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(glideUrl)
.load(R.drawable.ic_people_group_white_24px)
.centerInside()
.override(avatarSize, avatarSize)
.apply(RequestOptions.bitmapTransform(new CircleCrop()))
.into(holder.dialogAvatar);
break;
case ROOM_PUBLIC_CALL:
GlideApp.with(context)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(R.drawable.ic_link_white_24px)
.centerInside()
.override(avatarSize, avatarSize)
.apply(RequestOptions.bitmapTransform(new CircleCrop()))
.into(holder.dialogAvatar);
} else {
break;
default:
holder.dialogAvatar.setVisibility(View.GONE);
}
break;
case ROOM_GROUP_CALL:
GlideApp.with(context)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(R.drawable.ic_people_group_white_24px)
.centerInside()
.override(avatarSize, avatarSize)
.apply(RequestOptions.bitmapTransform(new CircleCrop()))
.into(holder.dialogAvatar);
break;
case ROOM_PUBLIC_CALL:
GlideApp.with(context)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(R.drawable.ic_link_white_24px)
.centerInside()
.override(avatarSize, avatarSize)
.apply(RequestOptions.bitmapTransform(new CircleCrop()))
.into(holder.dialogAvatar);
break;
default:
holder.dialogAvatar.setVisibility(View.GONE);
}
}
}
@Override

View file

@ -0,0 +1,30 @@
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.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/>.
-->
<vector android:autoMirrored="true" android:height="24dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#D5D5D5" android:fillType="nonZero"
android:pathData="M0,0l24,0l0,24l-24,0z" android:strokeAlpha="0"
android:strokeColor="#000000" android:strokeWidth="1"/>
<path android:fillColor="#FFFFFF" android:fillType="nonZero"
android:pathData="M6.4825,5C6.2123,5 6,5.2123 6,5.4825L6,18.0275C6,18.2977 6.2123,18.51 6.4825,18.51L17.0975,18.51C17.3677,18.51 17.58,18.2977 17.58,18.0275L17.58,7.895L14.685,5L6.4825,5ZM7.93,6.93L13.72,6.93L13.72,7.895L7.93,7.895L7.93,6.93ZM7.93,9.825L12.755,9.825L12.755,10.79L7.93,10.79L7.93,9.825ZM7.93,12.72L15.65,12.72L15.65,13.685L7.93,13.685L7.93,12.72ZM7.93,15.615L11.79,15.615L11.79,16.58L7.93,16.58L7.93,15.615Z"
android:strokeColor="#00000000" android:strokeWidth="1"/>
</vector>

View file

@ -0,0 +1,30 @@
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.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/>.
-->
<vector android:autoMirrored="true" android:height="24dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#D5D5D5" android:fillType="nonZero"
android:pathData="M0,0l24,0l0,24l-24,0z" android:strokeAlpha="0"
android:strokeColor="#000000" android:strokeWidth="1"/>
<path android:fillColor="#FFFFFF" android:fillType="nonZero"
android:pathData="M15.8787,9.9394L15.1731,9.9394L15.1731,8.5281C15.1731,6.5806 13.5925,5 11.645,5C9.6975,5 8.1169,6.5806 8.1169,8.5281L8.1169,9.9394L7.4113,9.9394C6.6351,9.9394 6,10.5744 6,11.3506L6,18.4069C6,19.1831 6.6351,19.8181 7.4113,19.8181L15.8787,19.8181C16.6549,19.8181 17.29,19.1831 17.29,18.4069L17.29,11.3506C17.29,10.5744 16.6549,9.9394 15.8787,9.9394ZM9.5281,8.5281C9.5281,7.3568 10.4737,6.4113 11.645,6.4113C12.8163,6.4113 13.7619,7.3568 13.7619,8.5281L13.7619,9.9394L9.5281,9.9394L9.5281,8.5281ZM15.8787,18.4069L7.4113,18.4069L7.4113,11.3506L15.8787,11.3506L15.8787,18.4069ZM11.645,16.29C12.4212,16.29 13.0562,15.6549 13.0562,14.8787C13.0562,14.1026 12.4212,13.4675 11.645,13.4675C10.8688,13.4675 10.2338,14.1026 10.2338,14.8787C10.2338,15.6549 10.8688,16.29 11.645,16.29Z"
android:strokeColor="#00000000" android:strokeWidth="1"/>
</vector>

View file

@ -0,0 +1,10 @@
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs></defs>
<g id="icon" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="vector" fill-rule="nonzero">
<polygon id="path" stroke-opacity="0" stroke="#000000" fill="#D5D5D5" points="0 0 24 0 24 24 0 24"></polygon>
<path d="M6.48250001,5 C6.2123,5 6,5.2123 6,5.48250001 L6,18.0275002 C6,18.2977002 6.2123,18.5100002 6.48250001,18.5100002 L17.0975002,18.5100002 C17.3677002,18.5100002 17.5800002,18.2977002 17.5800002,18.0275002 L17.5800002,7.89500005 L14.6850001,5 L6.48250001,5 Z M7.93000003,6.93000003 L13.7200001,6.93000003 L13.7200001,7.89500005 L7.93000003,7.89500005 L7.93000003,6.93000003 Z M7.93000003,9.82500008 L12.7550001,9.82500008 L12.7550001,10.7900001 L7.93000003,10.7900001 L7.93000003,9.82500008 Z M7.93000003,12.7200001 L15.6500002,12.7200001 L15.6500002,13.6850001 L7.93000003,13.6850001 L7.93000003,12.7200001 Z M7.93000003,15.6150002 L11.7900001,15.6150002 L11.7900001,16.5800002 L7.93000003,16.5800002 L7.93000003,15.6150002 Z" id="Shape" fill="#FFFFFF"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,10 @@
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs></defs>
<g id="Picon" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="file_password_request" fill-rule="nonzero">
<polygon id="path" stroke-opacity="0" stroke="#000000" fill="#D5D5D5" points="0 0 24 0 24 24 0 24"></polygon>
<path d="M15.87875,9.93937501 L15.173125,9.93937501 L15.173125,8.528125 C15.173125,6.58060001 13.592525,5 11.645,5 C9.69747502,5 8.116875,6.58060001 8.116875,8.528125 L8.116875,9.93937501 L7.41125,9.93937501 C6.63506251,9.93937501 6,10.5744375 6,11.350625 L6,18.4068749 C6,19.1830625 6.63506251,19.8181251 7.41125,19.8181251 L15.87875,19.8181251 C16.6549375,19.8181251 17.29,19.1830625 17.29,18.4068749 L17.29,11.350625 C17.29,10.5744375 16.6549375,9.93937501 15.87875,9.93937501 Z M9.52812502,8.528125 C9.52812502,7.35678751 10.4736626,6.41125001 11.645,6.41125001 C12.8163375,6.41125001 13.761875,7.35678751 13.761875,8.528125 L13.761875,9.93937501 L9.52812502,9.93937501 L9.52812502,8.528125 Z M15.87875,18.4068749 L7.41125,18.4068749 L7.41125,11.350625 L15.87875,11.350625 L15.87875,18.4068749 Z M11.645,16.2900001 C12.4211875,16.2900001 13.05625,15.6549376 13.05625,14.8787501 C13.05625,14.1025625 12.4211875,13.4675 11.645,13.4675 C10.8688125,13.4675 10.23375,14.1025625 10.23375,14.8787501 C10.23375,15.6549376 10.8688125,16.2900001 11.645,16.2900001 Z" id="Shape" fill="#FFFFFF"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB