mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-09 23:53:04 +00:00
Merge pull request #1420 from nextcloud/bugfix/1417/botSystemConversationIcon
Use launcher icon as bot-avatar/system-conversation-icon
This commit is contained in:
commit
f8ae4ca8a3
@ -237,7 +237,6 @@ dependencies {
|
||||
implementation 'net.orange-box.storebox:storebox-lib:1.4.0'
|
||||
implementation "com.jakewharton:butterknife:${butterknifeVersion}"
|
||||
kapt "com.jakewharton:butterknife-compiler:${butterknifeVersion}"
|
||||
implementation 'com.github.HITGIF:TextFieldBoxes:1.4.5'
|
||||
implementation 'eu.davidea:flexible-adapter:5.1.0'
|
||||
implementation 'eu.davidea:flexible-adapter-ui:1.0.0'
|
||||
implementation 'org.webrtc:google-webrtc:1.0.32006'
|
||||
|
@ -27,9 +27,9 @@ import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.View;
|
||||
@ -215,13 +215,16 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
|
||||
}
|
||||
|
||||
if (Conversation.ConversationType.ROOM_SYSTEM.equals(conversation.getType())) {
|
||||
Drawable[] layers = new Drawable[2];
|
||||
layers[0] = context.getDrawable(R.drawable.ic_launcher_background);
|
||||
layers[1] = context.getDrawable(R.drawable.ic_launcher_foreground);
|
||||
LayerDrawable layerDrawable = new LayerDrawable(layers);
|
||||
|
||||
holder.dialogAvatar.getHierarchy().setPlaceholderImage(DisplayUtils.getRoundedDrawable(layerDrawable));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Drawable[] layers = new Drawable[2];
|
||||
layers[0] = ContextCompat.getDrawable(context, R.drawable.ic_launcher_background);
|
||||
layers[1] = ContextCompat.getDrawable(context, R.drawable.ic_launcher_foreground);
|
||||
LayerDrawable layerDrawable = new LayerDrawable(layers);
|
||||
|
||||
holder.dialogAvatar.getHierarchy().setPlaceholderImage(DisplayUtils.getRoundedDrawable(layerDrawable));
|
||||
} else {
|
||||
holder.dialogAvatar.getHierarchy().setPlaceholderImage(R.mipmap.ic_launcher);
|
||||
}
|
||||
shouldLoadAvatar = false;
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,11 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Build
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.SeekBar
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
@ -201,11 +201,15 @@ class IncomingVoiceMessageViewHolder(incomingView: View) : MessageHolders
|
||||
if (message.actorType == "guests") {
|
||||
// do nothing, avatar is set
|
||||
} else if (message.actorType == "bots" && message.actorId == "changelog") {
|
||||
val layers = arrayOfNulls<Drawable>(2)
|
||||
layers[0] = AppCompatResources.getDrawable(context!!, R.drawable.ic_launcher_background)
|
||||
layers[1] = AppCompatResources.getDrawable(context!!, R.drawable.ic_launcher_foreground)
|
||||
val layerDrawable = LayerDrawable(layers)
|
||||
binding.messageUserAvatar.setImageDrawable(DisplayUtils.getRoundedDrawable(layerDrawable))
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val layers = arrayOfNulls<Drawable>(2)
|
||||
layers[0] = ContextCompat.getDrawable(context!!, R.drawable.ic_launcher_background)
|
||||
layers[1] = ContextCompat.getDrawable(context!!, R.drawable.ic_launcher_foreground)
|
||||
val layerDrawable = LayerDrawable(layers)
|
||||
binding.messageUserAvatar.setImageDrawable(DisplayUtils.getRoundedDrawable(layerDrawable))
|
||||
} else {
|
||||
binding.messageUserAvatar.setImageResource(R.mipmap.ic_launcher)
|
||||
}
|
||||
} else if (message.actorType == "bots") {
|
||||
val drawable = TextDrawable.builder()
|
||||
.beginConfig()
|
||||
|
@ -27,6 +27,7 @@ import android.content.Intent
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.TextUtils
|
||||
@ -81,11 +82,15 @@ class MagicIncomingTextMessageViewHolder(itemView: View) : MessageHolders
|
||||
// do nothing, avatar is set
|
||||
} else if (message.actorType == "bots" && message.actorId == "changelog") {
|
||||
if (context != null) {
|
||||
val layers = arrayOfNulls<Drawable>(2)
|
||||
layers[0] = ContextCompat.getDrawable(context!!, R.drawable.ic_launcher_background)
|
||||
layers[1] = ContextCompat.getDrawable(context!!, R.drawable.ic_launcher_foreground)
|
||||
val layerDrawable = LayerDrawable(layers)
|
||||
binding.messageUserAvatar.setImageDrawable(DisplayUtils.getRoundedDrawable(layerDrawable))
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val layers = arrayOfNulls<Drawable>(2)
|
||||
layers[0] = ContextCompat.getDrawable(context!!, R.drawable.ic_launcher_background)
|
||||
layers[1] = ContextCompat.getDrawable(context!!, R.drawable.ic_launcher_foreground)
|
||||
val layerDrawable = LayerDrawable(layers)
|
||||
binding.messageUserAvatar.setImageDrawable(DisplayUtils.getRoundedDrawable(layerDrawable))
|
||||
} else {
|
||||
binding.messageUserAvatar.setImageResource(R.mipmap.ic_launcher)
|
||||
}
|
||||
}
|
||||
} else if (message.actorType == "bots") {
|
||||
val drawable = TextDrawable.builder()
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
package com.nextcloud.talk.components.filebrowser.webdav;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.nextcloud.talk.components.filebrowser.models.BrowserFile;
|
||||
import com.nextcloud.talk.components.filebrowser.models.DavResponse;
|
||||
import com.nextcloud.talk.dagger.modules.RestModule;
|
||||
@ -39,6 +41,7 @@ import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class ReadFilesystemOperation {
|
||||
private static final String TAG = "ReadFilesystemOperation";
|
||||
private final OkHttpClient okHttpClient;
|
||||
private final String url;
|
||||
private final int depth;
|
||||
@ -48,7 +51,14 @@ public class ReadFilesystemOperation {
|
||||
OkHttpClient.Builder okHttpClientBuilder = okHttpClient.newBuilder();
|
||||
okHttpClientBuilder.followRedirects(false);
|
||||
okHttpClientBuilder.followSslRedirects(false);
|
||||
okHttpClientBuilder.authenticator(new RestModule.MagicAuthenticator(ApiUtils.getCredentials(currentUser.getUsername(), currentUser.getToken()), "Authorization"));
|
||||
okHttpClientBuilder.authenticator(
|
||||
new RestModule.MagicAuthenticator(
|
||||
ApiUtils.getCredentials(
|
||||
currentUser.getUsername(),
|
||||
currentUser.getToken()
|
||||
),
|
||||
"Authorization")
|
||||
);
|
||||
this.okHttpClient = okHttpClientBuilder.build();
|
||||
this.basePath = currentUser.getBaseUrl() + DavUtils.DAV_PATH + currentUser.getUserId();
|
||||
this.url = basePath + path;
|
||||
@ -80,13 +90,10 @@ public class ReadFilesystemOperation {
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (DavException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException | DavException e) {
|
||||
Log.w("", "Error reading remote path");
|
||||
}
|
||||
|
||||
|
||||
remoteFiles.add(BrowserFile.getModelFromResponse(rootElement[0],
|
||||
rootElement[0].getHref().toString().substring(basePath.length())));
|
||||
for (Response memberElement : memberElements) {
|
||||
@ -97,5 +104,4 @@ public class ReadFilesystemOperation {
|
||||
davResponse.setData(remoteFiles);
|
||||
return davResponse;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class UserUtils {
|
||||
|
||||
public List getUsers() {
|
||||
Result findUsersQueryResult = dataStore.select(User.class).where
|
||||
(UserEntity.SCHEDULED_FOR_DELETION.notEqual(true)).get();
|
||||
(UserEntity.SCHEDULED_FOR_DELETION.notEqual(Boolean.TRUE)).get();
|
||||
|
||||
return findUsersQueryResult.toList();
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
DO NOT TOUCH; GENERATED BY DRONE
|
||||
<span class="mdl-layout-title">Lint Report: 3 errors and 274 warnings</span>
|
||||
<span class="mdl-layout-title">Lint Report: 3 errors and 272 warnings</span>
|
||||
|
Loading…
Reference in New Issue
Block a user