Minor fixes

This commit is contained in:
世界 2021-04-14 09:05:02 +08:00
parent 91db8f4bd7
commit c18c9ac4dc
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
4 changed files with 29 additions and 20 deletions

View File

@ -186,15 +186,17 @@ public class ActionBar extends FrameLayout {
Drawable drawable = Theme.getCurrentHolidayDrawable();
if (drawable != null && drawable.getBounds().contains((int) ev.getX(), (int) ev.getY())) {
manualStart = true;
if (snowflakesEffect != null) {
snowflakesEffect = null;
fireworksEffect = new FireworksEffect();
} else {
if (snowflakesEffect == null) {
fireworksEffect = null;
snowflakesEffect = new SnowflakesEffect();
titleTextView[0].invalidate();
invalidate();
} else {
snowflakesEffect = null;
fireworksEffect = new FireworksEffect();
titleTextView[0].invalidate();
invalidate();
}
titleTextView[0].invalidate();
invalidate();
}
}
return super.onInterceptTouchEvent(ev);
@ -217,15 +219,18 @@ public class ActionBar extends FrameLayout {
if (drawable != null) {
SimpleTextView titleView = (SimpleTextView) child;
if (titleView.getVisibility() == View.VISIBLE && titleView.getText() instanceof String) {
if (titleView.getVisibility() == View.VISIBLE) {
TextPaint textPaint = titleView.getTextPaint();
textPaint.getFontMetricsInt(fontMetricsInt);
textPaint.getTextBounds((String) titleView.getText(), 0, 1, rect);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
textPaint.getTextBounds(titleView.getText(), 0, 1, rect);
} else {
textPaint.getTextBounds(titleView.getText().toString(), 0, 1, rect);
}
int x = titleView.getTextStartX() + Theme.getCurrentHolidayDrawableXOffset() + (rect.width() - (drawable.getIntrinsicWidth() + Theme.getCurrentHolidayDrawableXOffset())) / 2;
int y = titleView.getTextStartY() + Theme.getCurrentHolidayDrawableYOffset() + (int) Math.ceil((titleView.getTextHeight() - rect.height()) / 2.0f);
drawable.setBounds(x, y - drawable.getIntrinsicHeight(), x + drawable.getIntrinsicWidth(), y);
drawable.setAlpha((int) (255 * titleView.getAlpha()));
drawable.setColorFilter(textPaint.getColor(), PorterDuff.Mode.MULTIPLY);
drawable.draw(canvas);
if (overlayTitleAnimationInProgress) {
child.invalidate();

View File

@ -264,11 +264,9 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter imple
if (!UserConfig.getInstance(UserConfig.selectedAccount).isClientActivated()) {
return;
}
int eventType = Theme.getEventType();
int contactsIcon = R.drawable.baseline_perm_contact_calendar_24;
int savedIcon = R.drawable.baseline_bookmark_24;
int settingsIcon = R.drawable.baseline_settings_24;
int inviteIcon = R.drawable.baseline_person_add_24;
int callsIcon = R.drawable.baseline_call_24;
items.add(new Item(6, LocaleController.getString("Contacts", R.string.Contacts), contactsIcon));
items.add(new Item(11, LocaleController.getString("SavedMessages", R.string.SavedMessages), savedIcon));

View File

@ -23,7 +23,6 @@ import android.os.Build;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
@ -32,7 +31,6 @@ import androidx.palette.graphics.Palette;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
@ -47,6 +45,7 @@ import org.telegram.ui.Components.AvatarDrawable;
import org.telegram.ui.Components.BackupImageView;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.EmojiTextView;
import org.telegram.ui.Components.FireworksEffect;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.SnowflakesEffect;
@ -68,6 +67,7 @@ public class DrawerProfileCell extends FrameLayout {
private Integer currentColor;
private Integer currentMoonColor;
private SnowflakesEffect snowflakesEffect;
private FireworksEffect fireworksEffect;
private boolean accountsShown;
private int darkThemeBackgroundColor;
@ -112,7 +112,7 @@ public class DrawerProfileCell extends FrameLayout {
paint.setColor((palette.getDarkMutedColor(0xFF547499) & 0x00FFFFFF) | 0x44000000);
canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), paint);
}
AndroidUtilities.runOnUIThread(() -> {
AndroidUtilities.runOnUIThread(() -> {
allowInvalidate = true;
imageReceiver.setCrossfadeWithOldImage(true);
imageReceiver.setImageBitmap(new BitmapDrawable(null, bitmap), false);
@ -168,6 +168,8 @@ public class DrawerProfileCell extends FrameLayout {
if (Theme.getEventType() == 0 || NekoConfig.actionBarDecoration == 1) {
snowflakesEffect = new SnowflakesEffect();
snowflakesEffect.setColorKey(Theme.key_chats_menuName);
} else if (NekoConfig.actionBarDecoration == 2) {
fireworksEffect = new FireworksEffect();
}
}
@ -252,7 +254,7 @@ public class DrawerProfileCell extends FrameLayout {
}
}
} else {
int visibility = drawCatsShadow? VISIBLE : INVISIBLE;
int visibility = drawCatsShadow ? VISIBLE : INVISIBLE;
if (shadowView.getVisibility() != visibility) {
shadowView.setVisibility(visibility);
}
@ -261,6 +263,8 @@ public class DrawerProfileCell extends FrameLayout {
if (snowflakesEffect != null) {
snowflakesEffect.onDraw(this, canvas);
} else if (fireworksEffect != null) {
fireworksEffect.onDraw(this, canvas);
}
}
@ -301,7 +305,7 @@ public class DrawerProfileCell extends FrameLayout {
} else if (!TextUtils.isEmpty(user.username)) {
phoneTextView.setText("@" + user.username);
} else {
phoneTextView.setText(LocaleController.getString("MobileHidden",R.string.MobileHidden));
phoneTextView.setText(LocaleController.getString("MobileHidden", R.string.MobileHidden));
}
AvatarDrawable avatarDrawable = new AvatarDrawable(user);
avatarDrawable.setColor(Theme.getColor(Theme.key_avatar_backgroundInProfileBlue));

View File

@ -386,10 +386,6 @@ public class UndoView extends FrameLayout {
if (currentActionRunnable != null) {
currentActionRunnable.run();
}
if (NekoConfig.disableUndo && !isTooltipAction()) {
if (actionRunnable != null) actionRunnable.run();
return;
}
isShown = true;
currentActionRunnable = actionRunnable;
currentCancelRunnable = cancelRunnable;
@ -397,6 +393,12 @@ public class UndoView extends FrameLayout {
currentAction = action;
timeLeft = 5000;
currentInfoObject = infoObject;
if (NekoConfig.disableUndo && !isTooltipAction()) {
if (actionRunnable != null) actionRunnable.run();
return;
}
lastUpdateTime = SystemClock.elapsedRealtime();
undoTextView.setText(LocaleController.getString("Undo", R.string.Undo).toUpperCase());
undoImageView.setVisibility(VISIBLE);