mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-20 19:25:01 +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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
messageNotificationLevel.setValue(stringValue);
|
if (messageNotificationLevel != null) {
|
||||||
|
messageNotificationLevel.setValue(stringValue);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setProperNotificationValue(conversation);
|
setProperNotificationValue(conversation);
|
||||||
}
|
}
|
||||||
@ -320,15 +322,17 @@ public class ConversationInfoController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setProperNotificationValue(Conversation conversation) {
|
private void setProperNotificationValue(Conversation conversation) {
|
||||||
if (conversation.getType().equals(Conversation.RoomType.ROOM_TYPE_ONE_TO_ONE_CALL)) {
|
if (messageNotificationLevel != null) {
|
||||||
// hack to see if we get mentioned always or just on mention
|
if (conversation.getType().equals(Conversation.RoomType.ROOM_TYPE_ONE_TO_ONE_CALL)) {
|
||||||
if (conversationUser.hasSpreedCapabilityWithName("mention-flag")) {
|
// hack to see if we get mentioned always or just on mention
|
||||||
messageNotificationLevel.setValue("always");
|
if (conversationUser.hasSpreedCapabilityWithName("mention-flag")) {
|
||||||
|
messageNotificationLevel.setValue("always");
|
||||||
|
} else {
|
||||||
|
messageNotificationLevel.setValue("mention");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
messageNotificationLevel.setValue("mention");
|
messageNotificationLevel.setValue("mention");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
messageNotificationLevel.setValue("mention");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ import android.text.style.ForegroundColorSpan;
|
|||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -178,10 +179,8 @@ public class DisplayUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static float convertDpToPixel(float dp, Context context) {
|
public static float convertDpToPixel(float dp, Context context) {
|
||||||
Resources resources = context.getResources();
|
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
|
||||||
DisplayMetrics metrics = resources.getDisplayMetrics();
|
context.getResources().getDisplayMetrics()) + 0.5f);
|
||||||
float px = dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
|
|
||||||
return px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Solution inspired by https://stackoverflow.com/questions/34936590/why-isnt-my-vector-drawable-scaling-as-expected
|
// Solution inspired by https://stackoverflow.com/questions/34936590/why-isnt-my-vector-drawable-scaling-as-expected
|
||||||
|
Loading…
Reference in New Issue
Block a user