Minor fixes

This commit is contained in:
世界 2021-01-18 13:08:28 +08:00
parent 6469b03304
commit 917657bc5e
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
5 changed files with 31 additions and 34 deletions

View File

@ -21,6 +21,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
@ -4604,16 +4605,22 @@ public class NotificationsController extends BaseController {
private int getNotificationColor() {
int color = 0;
if (Theme.getActiveTheme().hasAccentColors()) {
color = Theme.getActiveTheme().getAccentColor(Theme.getActiveTheme().currentAccentId);
}
if (color == 0) {
color = Theme.getColor(Theme.key_actionBarDefault) | 0xff000000;
}
Configuration configuration = ApplicationLoader.applicationContext.getResources().getConfiguration();
boolean isDark = (configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if (isDark) {
color = 0xffffffff;
} else {
if (Theme.getActiveTheme().hasAccentColors()) {
color = Theme.getActiveTheme().getAccentColor(Theme.getActiveTheme().currentAccentId);
}
if (Theme.getActiveTheme().isDark() || color == 0) {
color = Theme.getColor(Theme.key_actionBarDefault);
}
// too bright
if (AndroidUtilities.computePerceivedBrightness(color) >= 0.721f) {
color = Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader) | 0xff000000;
}
}
return color;
}
}

View File

@ -1773,7 +1773,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
selectedMessagesCanCopyIds[a].clear();
selectedMessagesCanStarIds[a].clear();
}
hideActionMode();
clearSelectionMode();
if (messageObject != null && (messageObject.messageOwner.id > 0 || messageObject.messageOwner.id < 0 && currentEncryptedChat != null)) {
showFieldPanelForReply(messageObject);
}

View File

@ -4157,9 +4157,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
videoToSendMessageObject = null;
videoTimelineView.destroy();
boolean revButton = NekoConfig.useChatAttachMediaMenu;
if (videoSendButton != null && isInVideoMode() && !revButton) {
if (videoSendButton != null && isInVideoMode() && !NekoConfig.useChatAttachMediaMenu) {
videoSendButton.setVisibility(View.VISIBLE);
} else if (audioSendButton != null) {
audioSendButton.setVisibility(View.VISIBLE);
@ -5280,7 +5278,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
private void updateRecordIntefrace(int recordState) {
boolean revButton = NekoConfig.useChatAttachMediaMenu;
boolean isVid = isInVideoMode() && !NekoConfig.useChatAttachMediaMenu;
if (recordingAudioVideo) {
if (recordInterfaceState == 1) {
@ -5448,7 +5446,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
//EXIT TRANSITION
if (shouldShowFastTransition || recordState == RECORD_STATE_CANCEL_BY_TIME) {
if (videoSendButton != null && isInVideoMode() && !revButton) {
if (videoSendButton != null && isVid) {
videoSendButton.setVisibility(View.VISIBLE);
} else if (audioSendButton != null) {
audioSendButton.setVisibility(View.VISIBLE);
@ -5474,12 +5472,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (audioSendButton != null) {
audioSendButton.setScaleX(1f);
audioSendButton.setScaleY(1f);
runningAnimationAudio.playTogether(ObjectAnimator.ofFloat(audioSendButton, View.ALPHA, isInVideoMode() ^ revButton ? 0 : 1));
runningAnimationAudio.playTogether(ObjectAnimator.ofFloat(audioSendButton, View.ALPHA, isVid ? 0 : 1));
}
if (videoSendButton != null) {
videoSendButton.setScaleX(1f);
videoSendButton.setScaleY(1f);
runningAnimationAudio.playTogether(ObjectAnimator.ofFloat(videoSendButton, View.ALPHA, isInVideoMode() ^ revButton ? 1 : 0));
runningAnimationAudio.playTogether(ObjectAnimator.ofFloat(videoSendButton, View.ALPHA, isVid ? 1 : 0));
}
if (scheduledButton != null) {
runningAnimationAudio.playTogether(
@ -5585,14 +5583,14 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
);
if (videoSendButton != null) {
iconsAnimator.playTogether(
ObjectAnimator.ofFloat(videoSendButton, View.ALPHA, isInVideoMode() ^ revButton ? 1 : 0),
ObjectAnimator.ofFloat(videoSendButton, View.ALPHA, isVid ? 1 : 0),
ObjectAnimator.ofFloat(videoSendButton, View.SCALE_X, 1),
ObjectAnimator.ofFloat(videoSendButton, View.SCALE_Y, 1)
);
}
if (audioSendButton != null) {
iconsAnimator.playTogether(
ObjectAnimator.ofFloat(audioSendButton, View.ALPHA, isInVideoMode() ^ revButton ? 0 : 1),
ObjectAnimator.ofFloat(audioSendButton, View.ALPHA, isVid ? 0 : 1),
ObjectAnimator.ofFloat(audioSendButton, View.SCALE_X, 1),
ObjectAnimator.ofFloat(audioSendButton, View.SCALE_Y, 1)
);
@ -5661,7 +5659,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
});
} else if (recordState == RECORD_STATE_CANCEL || recordState == RECORD_STATE_CANCEL_BY_GESTURE) {
if (videoSendButton != null && isInVideoMode() && !revButton) {
if (videoSendButton != null && isVid) {
videoSendButton.setVisibility(View.VISIBLE);
} else if (audioSendButton != null) {
audioSendButton.setVisibility(View.VISIBLE);
@ -5728,12 +5726,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
);
}
if (videoSendButton != null) {
iconsAnimator.playTogether(ObjectAnimator.ofFloat(videoSendButton, View.ALPHA, isInVideoMode() ^ revButton ? 1 : 0));
iconsAnimator.playTogether(ObjectAnimator.ofFloat(videoSendButton, View.ALPHA, isVid ? 1 : 0));
iconsAnimator.playTogether(ObjectAnimator.ofFloat(videoSendButton, View.SCALE_X, 1));
iconsAnimator.playTogether(ObjectAnimator.ofFloat(videoSendButton, View.SCALE_Y, 1));
}
if (audioSendButton != null) {
iconsAnimator.playTogether(ObjectAnimator.ofFloat(audioSendButton, View.ALPHA, isInVideoMode() ^ revButton ? 0 : 1));
iconsAnimator.playTogether(ObjectAnimator.ofFloat(audioSendButton, View.ALPHA, isVid ? 0 : 1));
iconsAnimator.playTogether(ObjectAnimator.ofFloat(audioSendButton, View.SCALE_X, 1));
iconsAnimator.playTogether(ObjectAnimator.ofFloat(audioSendButton, View.SCALE_Y, 1));
}
@ -5768,10 +5766,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (audioSendButton != null) {
audioSendButton.setAlpha(isInVideoMode() ^ revButton ? 0 : 1f);
audioSendButton.setAlpha(isVid ? 0 : 1f);
}
if (videoSendButton != null) {
videoSendButton.setAlpha(isInVideoMode() ^ revButton ? 1f : 0);
videoSendButton.setAlpha(isVid ? 1f : 0);
}
}
});
@ -5813,7 +5811,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
recordDot.playDeleteAnimation();
} else {
if (videoSendButton != null && isInVideoMode() && !revButton) {
if (videoSendButton != null && isVid) {
videoSendButton.setVisibility(View.VISIBLE);
} else if (audioSendButton != null) {
audioSendButton.setVisibility(View.VISIBLE);
@ -5836,12 +5834,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (audioSendButton != null) {
audioSendButton.setScaleX(1f);
audioSendButton.setScaleY(1f);
iconsAnimator.playTogether(ObjectAnimator.ofFloat(audioSendButton, View.ALPHA, isInVideoMode() ^ revButton ? 0 : 1));
iconsAnimator.playTogether(ObjectAnimator.ofFloat(audioSendButton, View.ALPHA, isVid ? 0 : 1));
}
if (videoSendButton != null) {
videoSendButton.setScaleX(1f);
videoSendButton.setScaleY(1f);
iconsAnimator.playTogether(ObjectAnimator.ofFloat(videoSendButton, View.ALPHA, isInVideoMode() ^ revButton ? 1 : 0));
iconsAnimator.playTogether(ObjectAnimator.ofFloat(videoSendButton, View.ALPHA, isVid ? 1 : 0));
}
if (attachLayout != null) {
iconsAnimator.playTogether(

View File

@ -577,16 +577,6 @@ public class LoginActivity extends BaseFragment implements NotificationCenter.No
});
builder.addRadioItem(LocaleController.getString("CustomApiInput", R.string.CustomApiInput), dcType == 2, (cell) -> {
targetDc.set(2);
builder.doRadioCheck(cell);
return Unit.INSTANCE;
});
builder.addCancelButton();
builder.addButton(LocaleController.getString("Set", R.string.Set), (it) -> {

View File

@ -92,6 +92,8 @@ fun ChatActivity.translateMessages(target: Locale = NekoConfig.translateToLang?.
?: selectedObjectGroup?.messages?.toTypedArray()
?: emptyArray()) {
// TODO: Fix file group
if (messages.all { it.messageOwner.translated }) {
messages.forEach { messageObject ->