mirror of https://github.com/NekoX-Dev/NekoX.git
fix hide all chats
This commit is contained in:
parent
c15d817e81
commit
8e25de7902
|
@ -76,6 +76,7 @@ public class FilterTabsView extends FrameLayout {
|
|||
|
||||
public interface FilterTabsViewDelegate {
|
||||
void onPageSelected(Tab tab, boolean forward);
|
||||
|
||||
void onPageScrolled(float progress);
|
||||
|
||||
void onSamePageSelected();
|
||||
|
@ -232,8 +233,8 @@ public class FilterTabsView extends FrameLayout {
|
|||
@SuppressLint("DrawAllocation")
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
// boolean reorderEnabled = (!currentTab.isDefault || UserConfig.getInstance(UserConfig.selectedAccount).isPremium());
|
||||
boolean reorderEnabled = (!currentTab.isDefault);
|
||||
boolean reorderEnabled = (!currentTab.isDefault || UserConfig.getInstance(UserConfig.selectedAccount).isPremium());
|
||||
// boolean reorderEnabled = (!currentTab.isDefault);
|
||||
// TODO: NekoX try to unlock
|
||||
boolean showRemove = !currentTab.isDefault && reorderEnabled;
|
||||
if (reorderEnabled && editingAnimationProgress != 0) {
|
||||
|
@ -1080,7 +1081,7 @@ public class FilterTabsView extends FrameLayout {
|
|||
delegate.onPageSelected(tab, scrollingForward);
|
||||
}
|
||||
scrollToChild(position);
|
||||
if (NekoConfig.hideAllTab.Bool() && showAllChatsTab && !currentTabIsDefault())
|
||||
if (NekoConfig.hideAllTab.Bool() && !currentTabIsDefault())
|
||||
toggleAllTabs(false);
|
||||
}
|
||||
|
||||
|
@ -1091,6 +1092,13 @@ public class FilterTabsView extends FrameLayout {
|
|||
scrollToTab(tabs.get(0), 0);
|
||||
}
|
||||
|
||||
public void selectDefaultTab() {
|
||||
Tab defaultTab = findDefaultTab();
|
||||
if (defaultTab == null) return;
|
||||
if (defaultTab.id == getCurrentTabId()) return;
|
||||
scrollToTab(defaultTab, defaultTab.id);
|
||||
}
|
||||
|
||||
public void setAnimationIdicatorProgress(float value) {
|
||||
animatingIndicatorProgress = value;
|
||||
listView.invalidateViews();
|
||||
|
@ -1341,7 +1349,7 @@ public class FilterTabsView extends FrameLayout {
|
|||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
private Tab findDefaultTab() {
|
||||
public Tab findDefaultTab() {
|
||||
for (int i = 0; i < tabs.size(); i++) {
|
||||
if (tabs.get(i).isDefault) {
|
||||
return tabs.get(i);
|
||||
|
@ -1488,7 +1496,6 @@ public class FilterTabsView extends FrameLayout {
|
|||
invalidated = true;
|
||||
requestLayout();
|
||||
allTabsWidth = 0;
|
||||
if (showAllChatsTab)
|
||||
findDefaultTab().setTitle(LocaleController.getString("FilterAllChats", R.string.FilterAllChats));
|
||||
for (int b = 0; b < N; b++) {
|
||||
allTabsWidth += tabs.get(b).getWidth(true) + AndroidUtilities.dp(32);
|
||||
|
@ -1520,7 +1527,6 @@ public class FilterTabsView extends FrameLayout {
|
|||
listView.setItemAnimator(itemAnimator);
|
||||
adapter.notifyDataSetChanged();
|
||||
allTabsWidth = 0;
|
||||
if (showAllChatsTab)
|
||||
findDefaultTab().setTitle(LocaleController.getString("FilterAllChats", R.string.FilterAllChats));
|
||||
for (int b = 0, N = tabs.size(); b < N; b++) {
|
||||
allTabsWidth += tabs.get(b).getWidth(true) + AndroidUtilities.dp(32);
|
||||
|
@ -1642,7 +1648,7 @@ public class FilterTabsView extends FrameLayout {
|
|||
|
||||
@Override
|
||||
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
if (!isEditing || ((showAllChatsTab && viewHolder.getAdapterPosition() == 0) && !NekoConfig.pressTitleToOpenAllChats.Bool())) {
|
||||
if (!isEditing || (viewHolder.getAdapterPosition() == 0 && tabs.get(0).isDefault && !UserConfig.getInstance(UserConfig.selectedAccount).isPremium())) {
|
||||
return makeMovementFlags(0, 0);
|
||||
}
|
||||
return makeMovementFlags(ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT, 0);
|
||||
|
@ -1650,7 +1656,7 @@ public class FilterTabsView extends FrameLayout {
|
|||
|
||||
@Override
|
||||
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) {
|
||||
if (showAllChatsTab && (source.getAdapterPosition() == 0 || target.getAdapterPosition() == 0)) {
|
||||
if ((source.getAdapterPosition() == 0 || target.getAdapterPosition() == 0) && !UserConfig.getInstance(UserConfig.selectedAccount).isPremium()) {
|
||||
return false;
|
||||
}
|
||||
adapter.swapElements(source.getAdapterPosition(), target.getAdapterPosition());
|
||||
|
@ -1746,7 +1752,7 @@ public class FilterTabsView extends FrameLayout {
|
|||
MessagesController.DialogFilter dialogFilter = filters.get(a);
|
||||
if (filters.get(a).isDefault()) {
|
||||
if (showAllChatsTab)
|
||||
addTab(a, 0, LocaleController.getString("FilterAllChats", R.string.FilterAllChats), true, filters.get(a).locked);
|
||||
addTab(a, 0, LocaleController.getString("FilterAllChats", R.string.FilterAllChats), true, false);
|
||||
} else {
|
||||
switch (NekoConfig.tabsTitleType.Int()) {
|
||||
case NekoXConfig.TITLE_TYPE_TEXT:
|
||||
|
|
|
@ -408,6 +408,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
|
||||
private int topPadding;
|
||||
private int lastMeasuredTopPadding;
|
||||
|
||||
private int folderId;
|
||||
|
||||
private final static int pin = 100;
|
||||
|
@ -1559,7 +1560,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
}
|
||||
((DialogCell) view).startOutAnimation();
|
||||
|
||||
parentPage.archivePullViewState = ARCHIVE_ITEM_STATE_SHOWED;
|
||||
|
||||
if (NekoConfig.openArchiveOnPull.Bool()) {
|
||||
|
@ -2274,9 +2274,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
actionBar.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefault));
|
||||
actionBar.setOnLongClickListener(v -> {
|
||||
if (NekoConfig.hideAllTab.Bool() && NekoConfig.pressTitleToOpenAllChats.Bool() && filterTabsView != null && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE) {
|
||||
if (NekoConfig.hideAllTab.Bool() && filterTabsView != null && filterTabsView.getDefaultTabId() != filterTabsView.getCurrentTabId()) {
|
||||
filterTabsView.toggleAllTabs(true);
|
||||
filterTabsView.selectFirstTab();
|
||||
filterTabsView.selectDefaultTab();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
@ -2292,9 +2292,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
} else {
|
||||
actionBar.setTitle(LocaleController.getString("NekoX", R.string.NekoX));
|
||||
actionBar.setOnLongClickListener(v -> {
|
||||
if (NekoConfig.hideAllTab.Bool() && NekoConfig.pressTitleToOpenAllChats.Bool() && filterTabsView != null && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE) {
|
||||
if (NekoConfig.hideAllTab.Bool() && filterTabsView != null && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE) {
|
||||
filterTabsView.toggleAllTabs(true);
|
||||
filterTabsView.selectFirstTab();
|
||||
filterTabsView.selectDefaultTab();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
@ -2593,7 +2593,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
scrollView.addView(linearLayout, LayoutHelper.createScroll(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP));
|
||||
scrimPopupWindow = new ActionBarPopupWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
|
||||
@Override
|
||||
|
@ -4580,16 +4579,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
return false;
|
||||
} else if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && !tabsAnimationInProgress && !filterTabsView.isAnimatingIndicator()
|
||||
&& !startedTracking && !filterTabsView.isFirstTabSelected()) {
|
||||
if(!NekoConfig.hideAllTab.Bool()){
|
||||
filterTabsView.selectFirstTab();
|
||||
return false;
|
||||
}
|
||||
if (!NekoConfig.pressTitleToOpenAllChats.Bool() && filterTabsView != null) {
|
||||
// not hideAllTab OR hideAllTab but not pressTitleToOpenAllChats
|
||||
filterTabsView.toggleAllTabs(true);
|
||||
filterTabsView.selectFirstTab();
|
||||
return false;
|
||||
}
|
||||
// NekoX: remove scroll tabs when press back
|
||||
} else if (commentView != null && commentView.isPopupShowing()) {
|
||||
commentView.hidePopup(true);
|
||||
return false;
|
||||
|
|
|
@ -88,7 +88,7 @@ public class NekoConfig {
|
|||
public static ConfigItem showTabsOnForward = addConfig("ShowTabsOnForward", configTypeBool, false);
|
||||
public static ConfigItem rearVideoMessages = addConfig("RearVideoMessages", configTypeBool, false);
|
||||
public static ConfigItem hideAllTab = addConfig("HideAllTab", configTypeBool, false);
|
||||
public static ConfigItem pressTitleToOpenAllChats = addConfig("pressTitleToOpenAllChats", configTypeBool, false);
|
||||
// public static ConfigItem pressTitleToOpenAllChats = addConfig("pressTitleToOpenAllChats", configTypeBool, false);
|
||||
|
||||
public static ConfigItem disableChatAction = addConfig("DisableChatAction", configTypeBool, false);
|
||||
public static ConfigItem sortByUnread = addConfig("sort_by_unread", configTypeBool, false);
|
||||
|
@ -327,9 +327,6 @@ public class NekoConfig {
|
|||
rearVideoMessages.setConfigBool(preferences.getBoolean("rearVideoMessages", false));
|
||||
if (preferences.contains("hideAllTab"))
|
||||
hideAllTab.setConfigBool(preferences.getBoolean("hideAllTab", false));
|
||||
if (preferences.contains("pressTitleToOpenAllChats"))
|
||||
pressTitleToOpenAllChats.setConfigBool(preferences.getBoolean("pressTitleToOpenAllChats", false));
|
||||
|
||||
if (preferences.contains("disable_chat_action"))
|
||||
disableChatAction.setConfigBool(preferences.getBoolean("disable_chat_action", false));
|
||||
if (preferences.contains("sort_by_unread"))
|
||||
|
|
|
@ -120,7 +120,7 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
|
|||
private final AbstractConfigCell header3 = cellGroup.appendCell(new ConfigCellHeader(LocaleController.getString("Folder")));
|
||||
private final AbstractConfigCell showTabsOnForwardRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.showTabsOnForward));
|
||||
private final AbstractConfigCell hideAllTabRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.hideAllTab, LocaleController.getString("HideAllTabAbout")));
|
||||
private final AbstractConfigCell pressTitleToOpenAllChatsRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.pressTitleToOpenAllChats));
|
||||
// private final AbstractConfigCell pressTitleToOpenAllChatsRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.pressTitleToOpenAllChats));
|
||||
private final AbstractConfigCell tabsTitleTypeRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NekoConfig.tabsTitleType,
|
||||
new String[]{
|
||||
LocaleController.getString("TabTitleTypeText", R.string.TabTitleTypeText),
|
||||
|
@ -235,8 +235,6 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
|
|||
cellGroup.callBackSettingsChanged = (key, newValue) -> {
|
||||
if (key.equals(NekoConfig.hideAllTab.getKey())) {
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated);
|
||||
} else if (key.equals(NekoConfig.pressTitleToOpenAllChats.getKey())) {
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated);
|
||||
} else if (key.equals(NekoConfig.tabsTitleType.getKey())) {
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated);
|
||||
} else if (key.equals(NekoConfig.disableProximityEvents.getKey())) {
|
||||
|
|
Loading…
Reference in New Issue