mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-21 19:55:07 +01:00
Bug fixes against crashes & dpToPx fixes
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
e3ad95da74
commit
d781247074
@ -294,7 +294,9 @@ public class ConversationInfoController extends BaseController {
|
||||
break;
|
||||
}
|
||||
|
||||
if (messageNotificationLevel != null) {
|
||||
messageNotificationLevel.setValue(stringValue);
|
||||
}
|
||||
} else {
|
||||
setProperNotificationValue(conversation);
|
||||
}
|
||||
@ -320,6 +322,7 @@ public class ConversationInfoController extends BaseController {
|
||||
}
|
||||
|
||||
private void setProperNotificationValue(Conversation conversation) {
|
||||
if (messageNotificationLevel != null) {
|
||||
if (conversation.getType().equals(Conversation.RoomType.ROOM_TYPE_ONE_TO_ONE_CALL)) {
|
||||
// hack to see if we get mentioned always or just on mention
|
||||
if (conversationUser.hasSpreedCapabilityWithName("mention-flag")) {
|
||||
@ -331,6 +334,7 @@ public class ConversationInfoController extends BaseController {
|
||||
messageNotificationLevel.setValue("mention");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadConversationAvatar() {
|
||||
if (conversationAvatarImageView != null) {
|
||||
|
@ -47,6 +47,7 @@ import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
@ -178,10 +179,8 @@ public class DisplayUtils {
|
||||
}
|
||||
|
||||
public static float convertDpToPixel(float dp, Context context) {
|
||||
Resources resources = context.getResources();
|
||||
DisplayMetrics metrics = resources.getDisplayMetrics();
|
||||
float px = dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
|
||||
return px;
|
||||
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
|
||||
context.getResources().getDisplayMetrics()) + 0.5f);
|
||||
}
|
||||
|
||||
// Solution inspired by https://stackoverflow.com/questions/34936590/why-isnt-my-vector-drawable-scaling-as-expected
|
||||
|
Loading…
Reference in New Issue
Block a user