Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat Folders: Shareable folders & Redesign (#502) #543

Merged
merged 28 commits into from Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
96dcf13
Chat Folders: Shareable folders & Redesign
nikita-toropov Dec 13, 2023
b705466
Merge branch 'main' into chat-folders
vkryl Jan 20, 2024
6c609ba
Move all `ViewController.OPTION_COLOR_*` constants to `OptionColor` i…
vkryl Jan 20, 2024
ad12274
Merge branch 'main' into chat-folders
vkryl Jan 20, 2024
80c0f40
Code style fixes
vkryl Jan 20, 2024
d0c4d1b
Merge branch 'main' into chat-folders
vkryl Jan 20, 2024
f33d846
Merge branch 'main' into chat-folders
vkryl Jan 20, 2024
b91b51f
Cleaning up
nikita-toropov Jan 24, 2024
26e6403
Disallow slide back gesture with unsaved changes on "Select Chats" sc…
nikita-toropov Jan 24, 2024
1b5b5e8
Add checkbox animation in DoubleTextWrapper
nikita-toropov Jan 24, 2024
afd60ef
Change header type on "Edit Chat Folder Invite Link" screen
nikita-toropov Jan 24, 2024
d13628c
Change header type on "Invite Link" popup
nikita-toropov Jan 24, 2024
a8d019e
Use circle done button on "Edit Chat Folder" screen
nikita-toropov Jan 31, 2024
280fce1
Fix compose button blinking
nikita-toropov Jan 31, 2024
e06669e
Use folder icon as default on icon selector panel
nikita-toropov Jan 31, 2024
3d7b47c
Add offset before first header on "Edit Chat Folder" screen
nikita-toropov Jan 31, 2024
167a039
Fix ViewPagerTopView measuring
nikita-toropov Feb 1, 2024
f5c9949
Show progress & tooltips on done button on "Edit Chat Folder Invite L…
nikita-toropov Feb 1, 2024
4823031
Do not show premium lock icon for premium users
nikita-toropov Feb 1, 2024
27ccd36
Add dynamic bottom offset on "Edit Chat Folder" screen
nikita-toropov Feb 1, 2024
106e51c
Add MainController.showFolderTooltip
nikita-toropov Feb 1, 2024
0832796
Merge remote-tracking branch 'origin/main' into chat-folders
nikita-toropov Feb 1, 2024
0b2c99d
Merge branch 'main' into chat-folders
vkryl Feb 3, 2024
2e01b73
Merge branch 'main' into chat-folders
vkryl Feb 5, 2024
e2c02cf
Merge branch 'main' into chat-folders
vkryl Feb 6, 2024
5d801d3
Merge branch 'main' into chat-folders
vkryl Feb 6, 2024
3f823b0
Do not use `import static` statements
vkryl Feb 6, 2024
8381ddd
Add copyright comments
vkryl Feb 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/src/main/java/org/thunderdog/challegram/MainActivity.java
Expand Up @@ -88,6 +88,7 @@
import org.thunderdog.challegram.ui.SettingsPrivacyController;
import org.thunderdog.challegram.ui.SettingsPrivacyKeyController;
import org.thunderdog.challegram.ui.SettingsThemeController;
import org.thunderdog.challegram.ui.EditChatFolderInviteLinkController;
import org.thunderdog.challegram.unsorted.Settings;
import org.thunderdog.challegram.util.Crash;
import org.thunderdog.challegram.widget.GearView;
Expand Down Expand Up @@ -1245,6 +1246,8 @@ private static ViewController<?> restoreController (BaseActivity context, Tdlib
restore = new SettingsFoldersController(context, tdlib);
} else if (id == R.id.controller_editChatFolders) {
restore = new EditChatFolderController(context, tdlib);
} else if (id == R.id.controller_editChatFolderInviteLink) {
restore = new EditChatFolderInviteLinkController(context, tdlib);
} else if (id == R.id.controller_bug_killer) {
restore = new SettingsBugController(context, tdlib);
} else {
Expand Down
12 changes: 9 additions & 3 deletions app/src/main/java/org/thunderdog/challegram/U.java
Expand Up @@ -107,7 +107,6 @@
import org.thunderdog.challegram.core.Background;
import org.thunderdog.challegram.core.Lang;
import org.thunderdog.challegram.data.TD;
import org.thunderdog.challegram.emoji.EmojiSpan;
import org.thunderdog.challegram.loader.ImageGalleryFile;
import org.thunderdog.challegram.loader.ImageLoader;
import org.thunderdog.challegram.loader.ImageReader;
Expand All @@ -128,6 +127,7 @@
import org.thunderdog.challegram.util.AppBuildInfo;
import org.thunderdog.challegram.util.AppInstallationUtil;
import org.thunderdog.challegram.util.Permissions;
import org.thunderdog.challegram.util.text.TextReplacementSpan;
import org.thunderdog.challegram.widget.NoScrollTextView;

import java.io.BufferedReader;
Expand Down Expand Up @@ -2056,7 +2056,7 @@ public static float measureEmojiText (@Nullable CharSequence in, final int start
}

final Spannable s = (Spannable) in;
EmojiSpan[] spans = s.getSpans(start, end, EmojiSpan.class);
TextReplacementSpan[] spans = s.getSpans(start, end, TextReplacementSpan.class);
if (spans == null || spans.length == 0) {
return measureText(in, start, end, p);
}
Expand All @@ -2069,7 +2069,7 @@ public static float measureEmojiText (@Nullable CharSequence in, final int start

float textWidth = 0;
int startIndex = start;
for (EmojiSpan span : spans) {
for (TextReplacementSpan span : spans) {
int spanStart = s.getSpanStart(span);
if (startIndex < spanStart) {
textWidth += measureText(in, startIndex, spanStart, p);
Expand Down Expand Up @@ -3682,4 +3682,10 @@ public static Set<Long> unmodifiableTreeSetOf (long[] array) {
}
return Collections.unmodifiableSet(set);
}

public static long[] concat (long[] first, long[] second) {
long[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
}
Expand Up @@ -91,6 +91,7 @@ public class SettingView extends FrameLayoutFix implements FactorAnimator.Target
public static final int TYPE_SETTING_INACTIVE = 0x04;
public static final int TYPE_INFO_MULTILINE = 0x05;
public static final int TYPE_INFO_COMPACT = 0x07;
public static final int TYPE_INFO_SUPERCOMPACT = 0x08;

private static final int FLAG_CENTER_ICON = 1 << 3;
private static final int FLAG_DATA_SUBTITLE = 1 << 5;
Expand Down Expand Up @@ -170,7 +171,8 @@ public void setType (int type) {
break;
}
case TYPE_SETTING:
case TYPE_SETTING_INACTIVE: {
case TYPE_SETTING_INACTIVE:
case TYPE_INFO_SUPERCOMPACT: {
setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Screen.dp(55f)));
break;
}
Expand Down Expand Up @@ -340,8 +342,8 @@ public void setIconOverlay (IconOverlay overlay) {
this.overlay = overlay;
}

public void setCenterIcon () {
flags |= FLAG_CENTER_ICON;
public void setCenterIcon (boolean centerIcon) {
flags = BitwiseUtils.setFlag(flags, FLAG_CENTER_ICON, centerIcon);
}

private int lastIconResource;
Expand Down Expand Up @@ -590,7 +592,10 @@ private void buildLayout (int totalWidth, int totalHeight) {

availWidth -= emojiStatusHelper.getWidth(Screen.dp(6));

if (type == TYPE_INFO_COMPACT) {
if (type == TYPE_INFO_SUPERCOMPACT) {
boolean hasName = !StringUtils.isEmpty(swapDataAndName ? itemData : itemName);
pTop = Screen.dp((hasName ? 10f : 21f) + 13f);
} else if (type == TYPE_INFO_COMPACT) {
pTop = Screen.dp(15f + 13f);
} else {
pTop = Screen.dp(21f + 13f);
Expand All @@ -604,7 +609,7 @@ private void buildLayout (int totalWidth, int totalHeight) {
displayItemName = itemName;
}

if (type == TYPE_INFO || type == TYPE_INFO_COMPACT || type == TYPE_INFO_MULTILINE) {
if (type == TYPE_INFO || type == TYPE_INFO_COMPACT || type == TYPE_INFO_SUPERCOMPACT || type == TYPE_INFO_MULTILINE) {
pDataLeft = pLeft;
pDataTop = pTop;
pTop = pTop + Screen.dp(20f);
Expand Down Expand Up @@ -766,9 +771,19 @@ public void setUnreadCounter (int unreadCount, boolean muted, boolean animated)
counter.setCount(unreadCount, muted, animated);
}

private @Nullable TooltipOverlayView.LocationProvider tooltipLocationProvider;

public void setTooltipLocationProvider (@Nullable TooltipOverlayView.LocationProvider tooltipLocationProvider) {
this.tooltipLocationProvider = tooltipLocationProvider;
}

@Override
public void getTargetBounds (View targetView, Rect outRect) {
if (type == TYPE_INFO || type == TYPE_INFO_COMPACT || (type == TYPE_INFO_MULTILINE && text == null)) {
if (tooltipLocationProvider != null) {
tooltipLocationProvider.getTargetBounds(targetView, outRect);
return;
}
if (type == TYPE_INFO || type == TYPE_INFO_COMPACT || type == TYPE_INFO_SUPERCOMPACT || (type == TYPE_INFO_MULTILINE && text == null)) {
if (itemData != null) {
int dataTop = (int) (pDataTop - Screen.dp(13f));
Paint.FontMetricsInt fm = Paints.getTextPaint16().getFontMetricsInt();
Expand Down Expand Up @@ -864,7 +879,7 @@ protected void onDraw (Canvas c) {

final int dataColor = defaultTextColor();

if (type == TYPE_INFO || type == TYPE_INFO_COMPACT || (type == TYPE_INFO_MULTILINE && text == null)) {
if (type == TYPE_INFO || type == TYPE_INFO_COMPACT || type == TYPE_INFO_SUPERCOMPACT || (type == TYPE_INFO_MULTILINE && text == null)) {
if (displayItemName != null) {
int subtitleColor = Theme.getColor(dataColorId != 0 ? dataColorId : ColorId.textLight);
if ((flags & FLAG_DATA_SUBTITLE) != 0) {
Expand Down