Skip to content

Commit

Permalink
[chats] add double tap action + fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
immat0x1 committed Feb 14, 2023
1 parent 516c364 commit 275f3d4
Show file tree
Hide file tree
Showing 31 changed files with 866 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public class ExteraConfig {
public static boolean hideStickerTime;
public static boolean unlimitedRecentStickers;
public static boolean stickersAutoReorder;
public static int doubleTapAction;
public static int doubleTapActionOutOwner;
public static boolean premiumAutoPlayback;
public static boolean hidePremiumStickersTab;
public static boolean hideFeaturedEmoji;
Expand All @@ -79,7 +81,6 @@ public class ExteraConfig {
public static boolean hideKeyboardOnScroll;
public static boolean hideShareButton;
public static boolean hideMuteUnmuteButton;
public static boolean disableReactions;
public static boolean disableGreetingSticker;
public static boolean disableJumpToNextChannel;
public static boolean dateOfForwardedMsg;
Expand Down Expand Up @@ -163,6 +164,8 @@ public static void loadConfig() {
hideStickerTime = preferences.getBoolean("hideStickerTime", false);
unlimitedRecentStickers = preferences.getBoolean("unlimitedRecentStickers", false);
stickersAutoReorder = preferences.getBoolean("stickersAutoReorder", false);
doubleTapAction = preferences.getInt("doubleTapAction", 1);
doubleTapActionOutOwner = preferences.getInt("doubleTapActionOutOwner", 1);
premiumAutoPlayback = preferences.getBoolean("premiumAutoPlayback", false);
hidePremiumStickersTab = preferences.getBoolean("hidePremiumStickersTab", true);
hideFeaturedEmoji = preferences.getBoolean("hideFeaturedEmoji", false);
Expand All @@ -173,7 +176,6 @@ public static void loadConfig() {
hideShareButton = preferences.getBoolean("hideShareButton", true);
hideMuteUnmuteButton = preferences.getBoolean("hideMuteUnmuteButton", false);
hideKeyboardOnScroll = preferences.getBoolean("hideKeyboardOnScroll", true);
disableReactions = preferences.getBoolean("disableReactions", false);
disableJumpToNextChannel = preferences.getBoolean("disableJumpToNextChannel", false);
disableGreetingSticker = preferences.getBoolean("disableGreetingSticker", false);
dateOfForwardedMsg = preferences.getBoolean("dateOfForwardedMsg", false);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.exteragram.messenger.ExteraConfig;

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.R;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.Easings;
Expand All @@ -52,7 +53,7 @@ public FabShape(Context context, boolean square) {

outlinePaint.setStyle(Paint.Style.STROKE);
outlinePaint.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_switchTrack), 0x3F));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(0.5f)));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(1f)));

setSelected(square && ExteraConfig.squareFab || !square && !ExteraConfig.squareFab, false);
}
Expand Down Expand Up @@ -99,7 +100,7 @@ private void setProgress(float progress) {
this.progress = progress;

outlinePaint.setColor(ColorUtils.blendARGB(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_switchTrack), 0x3F), Theme.getColor(Theme.key_windowBackgroundWhiteValueText), progress));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(AndroidUtilities.lerp(0.5f, 2f, progress))));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(AndroidUtilities.lerp(1f, 2f, progress))));
invalidate();
}

Expand All @@ -125,6 +126,7 @@ private void setSelected(boolean selected, boolean animate) {
public FabShapeCell(Context context) {
super(context);
setOrientation(HORIZONTAL);
setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
setPadding(AndroidUtilities.dp(13), AndroidUtilities.dp(15), AndroidUtilities.dp(13), AndroidUtilities.dp(21));

for (int a = 0; a < 2; a++) {
Expand Down Expand Up @@ -157,7 +159,7 @@ protected void onDraw(Canvas canvas) {
super.onDraw(canvas);

if (!ExteraConfig.disableDividers)
canvas.drawLine(AndroidUtilities.dp(21), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, Theme.dividerPaint);
canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(21), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(21) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class MainScreenSetupCell extends FrameLayout {
public MainScreenSetupCell(Context context, INavigationLayout fragment) {
super(context);
setWillNotDraw(false);
setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));

sizeBar = new SeekBarView(context);
sizeBar.setReportChanges(true);
Expand Down Expand Up @@ -100,7 +101,7 @@ protected void onDraw(Canvas canvas) {

outlinePaint.setStyle(Paint.Style.STROKE);
outlinePaint.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_switchTrack), 0x3F));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(0.5f)));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(1f)));

textPaint.setColor(ColorUtils.blendARGB(0x00, Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), titleProgress));
textPaint.setTextSize(AndroidUtilities.dp(20));
Expand Down Expand Up @@ -391,7 +392,7 @@ protected void onDraw(Canvas canvas) {
canvas.drawText(String.valueOf(Math.round(ExteraConfig.avatarCorners)), getMeasuredWidth() - AndroidUtilities.dp(39), AndroidUtilities.dp(28), textPaint);

if (!ExteraConfig.disableDividers)
canvas.drawLine(AndroidUtilities.dp(21), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, Theme.dividerPaint);
canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(21), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(21) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@
import androidx.core.graphics.ColorUtils;

import com.exteragram.messenger.ExteraConfig;
import com.exteragram.messenger.ExteraUtils;

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.R;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.Easings;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.LaunchActivity;

import java.util.Objects;

@SuppressLint("ViewConstructor")
public class SolarIconsPreview extends FrameLayout {
Expand Down Expand Up @@ -58,7 +55,7 @@ public class SolarIconsPreview extends FrameLayout {
public SolarIconsPreview(Context context) {
super(context);
setWillNotDraw(false);

setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
setPadding(AndroidUtilities.dp(21), AndroidUtilities.dp(15), AndroidUtilities.dp(21), AndroidUtilities.dp(21));
preview = new FrameLayout(context) {
@SuppressLint("DrawAllocation")
Expand All @@ -73,12 +70,12 @@ protected void onDraw(Canvas canvas) {

for (int i = 0; i < iconsRes.length; i++) {
icons[i] = ContextCompat.getDrawable(context, iconsRes[i]);
icons[i].setColorFilter(new PorterDuffColorFilter(ColorUtils.blendARGB(0x00, Theme.getColor(Theme.key_chats_menuItemIcon), iconChangingProgress[i]), PorterDuff.Mode.SRC_IN));
icons[i].setColorFilter(new PorterDuffColorFilter(ColorUtils.blendARGB(0x00, Theme.getColor(Theme.key_chats_menuItemIcon), iconChangingProgress[i]), PorterDuff.Mode.MULTIPLY));
}

outlinePaint.setStyle(Paint.Style.STROKE);
outlinePaint.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_switchTrack), 0x3F));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(0.5f)));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(1f)));

rect.set(0, 0, w, h);
Theme.dialogs_onlineCirclePaint.setColor(Color.argb(20, r, g, b));
Expand Down Expand Up @@ -150,7 +147,7 @@ public void invalidate() {
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!ExteraConfig.disableDividers)
canvas.drawLine(AndroidUtilities.dp(21), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, Theme.dividerPaint);
canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(21), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(21) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public StickerShape(Context context, boolean rounded, boolean roundedAsMsg) {

outlinePaint.setStyle(Paint.Style.STROKE);
outlinePaint.setColor(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_switchTrack), 0x3F));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(0.5f)));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(1f)));

setSelected(!isRounded && !isRoundedAsMsg && ExteraConfig.stickerShape == 0 || isRounded && ExteraConfig.stickerShape == 1 || isRoundedAsMsg && ExteraConfig.stickerShape == 2, false);
}
Expand Down Expand Up @@ -106,7 +106,7 @@ private void setProgress(float progress) {

textPaint.setColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), Theme.getColor(Theme.key_windowBackgroundWhiteValueText), progress));
outlinePaint.setColor(ColorUtils.blendARGB(ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_switchTrack), 0x3F), Theme.getColor(Theme.key_windowBackgroundWhiteValueText), progress));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(AndroidUtilities.lerp(0.5f, 2f, progress))));
outlinePaint.setStrokeWidth(Math.max(2, AndroidUtilities.dp(AndroidUtilities.lerp(1f, 2f, progress))));
invalidate();
}

Expand All @@ -132,6 +132,7 @@ private void setSelected(boolean selected, boolean animate) {
public StickerShapeCell(Context context) {
super(context);
setOrientation(HORIZONTAL);
setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
setPadding(AndroidUtilities.dp(13), AndroidUtilities.dp(10), AndroidUtilities.dp(13), 0);

for (int a = 0; a < 3; a++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ public class IconSetsController {
solar.put(R.drawable.msg_theme, R.drawable.msg_theme_solar);
solar.put(R.drawable.msg_timeredit, R.drawable.msg_timeredit_solar);
solar.put(R.drawable.msg_to_beginning, R.drawable.msg_to_beginning_solar);

solar.put(R.drawable.msg_tone_add, R.drawable.msg_tone_add_solar);
solar.put(R.drawable.msg_tone_off, R.drawable.msg_tone_off_solar);
solar.put(R.drawable.msg_tone_on, R.drawable.msg_tone_on_solar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ protected void updateRowsId() {
mainScreenHeaderRow = newRow();
actionBarSetupRow = newRow();
hideActionBarStatusRow = getUserConfig().isPremium() ? newRow() : -1;
centerTitleRow = newRow();
hideAllChatsRow = newRow();
centerTitleRow = newRow();
tabStyleRow = newRow();
actionBarTitle = newRow();
mainScreenInfoRow = newRow();
Expand All @@ -137,10 +137,10 @@ protected void updateRowsId() {
fabShapeRow = newRow();
useSystemFontsRow = newRow();
useSystemEmojiRow = newRow();
transparentStatusBarRow = newRow();
blurForAllThemesRow = newRow();
newSwitchStyleRow = newRow();
disableDividersRow = newRow();
transparentStatusBarRow = newRow();
transparentNavBarRow = newRow();
transparentNavBarInfoRow = newRow();

Expand Down Expand Up @@ -404,12 +404,10 @@ protected void rebuildFragments() {
parentLayout.rebuildAllFragmentViews(false, false);
}
};
fabShapeCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
fabShapeCell.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
return new RecyclerListView.Holder(fabShapeCell);
case 14:
mainScreenSetupCell = new MainScreenSetupCell(mContext, parentLayout);
mainScreenSetupCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
mainScreenSetupCell.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
return new RecyclerListView.Holder(mainScreenSetupCell);
case 15:
Expand All @@ -419,7 +417,6 @@ protected void reloadResources() {
((LaunchActivity) getParentActivity()).reloadIcons();
}
};
solarIconsPreview.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
solarIconsPreview.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
return new RecyclerListView.Holder(solarIconsPreview);
default:
Expand Down Expand Up @@ -521,7 +518,9 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (position == transparentNavBarInfoRow) {
cell.setText(LocaleController.getString("TransparentNavBarInfo", R.string.TransparentNavBarInfo));
} else if (position == solarIconsInfoRow) {
cell.setText(addLinkSpan(LocaleController.getString("SolarIconsInfo", R.string.SolarIconsInfo), "@Design480"));
cell.setText(addLinkSpan(LocaleController.getString("SolarIconsInfo", R.string.SolarIconsInfo), "@Design480", "@TierOhneNation"));

//cell.setText(addLinkSpan(LocaleController.getString("SolarIconsInfo", R.string.SolarIconsInfo), "@Design480") × addLinkSpan("R4IN80W", "@TierOhneNation"));
} else if (position == mainScreenInfoRow) {
cell.setText(LocaleController.getString("MainScreenSetupInfo", R.string.MainScreenSetupInfo));
}
Expand Down
Loading

0 comments on commit 275f3d4

Please sign in to comment.