Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19072,19 +19072,33 @@ private void setMessageObjectInternal(MessageObject messageObject) {
if (isAdmin || isOwner) adminWidth += dp(12);
nameWidth -= adminWidth;
} else if (NekoConfig.labelChannelUser.Bool() && isMegagroup && currentChat != null && currentMessageObject.isSenderChannel()) {
final String channelStr = NaConfig.INSTANCE.getCustomChannelLabel().String();
adminString = new SpannableStringBuilder();
String aliasName = null;
if (NekoConfig.channelAlias.Bool()) {
String aliasName = NekoXConfig.getChannelAlias(currentMessageObject.messageOwner.from_id.channel_id);
aliasName = NekoXConfig.getChannelAlias(currentMessageObject.messageOwner.from_id.channel_id);
if (aliasName != null) {
adminString.append(aliasName + " ★");
adminString.append(aliasName + " ");
}
}
if (NaConfig.INSTANCE.getShowChannelIcon().Bool()) {
Drawable d = TimeStringHelper.getChannelDrawable();
if (d != null) {
ColoredImageSpan span = new ColoredImageSpan(d, ColoredImageSpan.ALIGN_CENTER);
span.setSize((int) Math.ceil(Theme.chat_adminPaint.getTextSize()));
adminString.append(" ");
var length = adminString.length();
adminString.setSpan(span, length - 1, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
} else {
if (aliasName != null) {
adminString.append("★");
} else {
final String channelStr = NaConfig.INSTANCE.getCustomChannelLabel().String();
adminString.append(channelStr);
}
} else {
adminString.append(channelStr);
}
Comment thread
omg-xtao marked this conversation as resolved.
adminWidth = (int) Math.ceil(Theme.chat_adminPaint.measureText(adminString.toString()));
StaticLayout staticLayout = new StaticLayout(adminString, Theme.chat_adminPaint, dp(300), Layout.Alignment.ALIGN_NORMAL, 0f, 0f, false);
adminWidth = (int) Math.ceil(staticLayout.getLineWidth(0));
nameWidth -= adminWidth;
} else {
adminString = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@

public class TimeStringHelper {
public static Drawable forwardsDrawable;
public static Drawable channelDrawable;
Comment thread
omg-xtao marked this conversation as resolved.

public static Drawable getForwardsDrawable() {
if (forwardsDrawable == null) {
forwardsDrawable = Objects.requireNonNull(ContextCompat.getDrawable(ApplicationLoader.applicationContext, R.drawable.forwards_solar)).mutate();
}
return forwardsDrawable;
}

public static Drawable getChannelDrawable() {
if (channelDrawable == null) {
channelDrawable = Objects.requireNonNull(ContextCompat.getDrawable(ApplicationLoader.applicationContext, R.drawable.menu_broadcast)).mutate();
}
return channelDrawable;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ public class NekoExperimentalSettingsActivity extends BaseNekoXSettingsActivity
// private final AbstractConfigCell useCustomEmojiRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.useCustomEmoji));
private final AbstractConfigCell localQuoteColorRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getUseLocalQuoteColor()));
private final AbstractConfigCell channelAliasRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.channelAlias));
private final AbstractConfigCell externalGhostModeRow = cellGroup.appendCell(new ConfigCellText("GhostMode", () -> {
presentFragment(new NekoGhostModeActivity());
}));
private final AbstractConfigCell showChannelIconRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowChannelIcon()));
private final AbstractConfigCell customCustomChannelLabelRow = cellGroup.appendCell(new ConfigCellTextInput(null, NaConfig.INSTANCE.getCustomChannelLabel(),
null, null,
(input) -> input.isEmpty() ? (String) NaConfig.INSTANCE.getCustomChannelLabel().defaultValue : input));
private final AbstractConfigCell externalGhostModeRow = cellGroup.appendCell(new ConfigCellText("GhostMode", () -> {
presentFragment(new NekoGhostModeActivity());
}));

// private final AbstractConfigCell smoothKeyboardRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.smoothKeyboard));
private final AbstractConfigCell enhancedFileLoaderRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.enhancedFileLoader));
Expand Down Expand Up @@ -336,6 +337,8 @@ public View createView(Context context) {
tooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
} else if (key.equals(NaConfig.INSTANCE.getDisableStories().getKey())) {
tooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
} else if (key.equals(NaConfig.INSTANCE.getShowChannelIcon().getKey())) {
updateRows();
Comment thread
omg-xtao marked this conversation as resolved.
Comment thread
omg-xtao marked this conversation as resolved.
}
};

Expand Down Expand Up @@ -546,6 +549,11 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, boole
protected void setCanNotChange() {
super.setCanNotChange();

cellGroup.rows.remove(customCustomChannelLabelRow);
if (!NaConfig.INSTANCE.getShowChannelIcon().Bool()) {
cellGroup.rows.add(cellGroup.rows.indexOf(showChannelIconRow) + 1, customCustomChannelLabelRow);
}

if (!NaConfig.INSTANCE.getShowHiddenFeature().Bool()) {
cellGroup.rows.remove(localPremiumRow);
cellGroup.rows.remove(localQuoteColorRow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,12 @@ object NaConfig {
ConfigItem.configTypeBool,
false
)
val showChannelIcon =
addConfig(
"ShowChannelIcon",
ConfigItem.configTypeBool,
false
)

private fun addConfig(
k: String,
Expand Down
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values/strings_na.xml
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,5 @@
<string name="RegistrationDateOlder">Older than %s</string>
<string name="RegistrationDateNewer">Newer than %s</string>
<string name="AlwaysSendVideosInHD">Always send videos in HD</string>
<string name="ShowChannelIcon">Show icon instead of channel alias</string>
</resources>
Loading