mirror of https://github.com/NekoX-Dev/NekoX.git
Allow show tabs on forward
This commit is contained in:
parent
659726d11e
commit
797e1ebde3
|
@ -614,9 +614,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
} else if (child == filterTabsView) {
|
||||
childTop = actionBar.getMeasuredHeight();
|
||||
} else if (child == searchListView || child == searchEmptyView) {
|
||||
childTop = (onlySelect ? 0 : actionBar.getMeasuredHeight()) + topPadding;
|
||||
childTop = (onlySelect && !(initialDialogsType == 3 && NekoConfig.showTabsOnForward) ? 0 : actionBar.getMeasuredHeight()) + topPadding;
|
||||
} else if (child instanceof ViewPage) {
|
||||
if (!onlySelect) {
|
||||
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward) || !onlySelect) {
|
||||
if (filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
|
||||
childTop = AndroidUtilities.dp(44);
|
||||
} else {
|
||||
|
@ -954,7 +954,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
@Override
|
||||
protected void onMeasure(int widthSpec, int heightSpec) {
|
||||
int t = 0;
|
||||
if (!onlySelect) {
|
||||
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward) || !onlySelect) {
|
||||
ignoreLayout = true;
|
||||
if (filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
|
||||
t = ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0);
|
||||
|
@ -987,7 +987,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
checkIfAdapterValid();
|
||||
super.onMeasure(widthSpec, heightSpec);
|
||||
if (!onlySelect) {
|
||||
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward) || !onlySelect) {
|
||||
if (appliedPaddingTop != t && viewPages != null && viewPages.length > 1) {
|
||||
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth());
|
||||
}
|
||||
|
@ -1646,7 +1646,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
actionBar.setSupportsHolidayImage(true);
|
||||
}
|
||||
}
|
||||
if (!onlySelect) {
|
||||
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward) || !onlySelect) {
|
||||
actionBar.setAddToContainer(false);
|
||||
actionBar.setCastShadows(false);
|
||||
actionBar.setClipContent(true);
|
||||
|
@ -1656,7 +1656,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
scrollToTop();
|
||||
});
|
||||
|
||||
if (initialDialogsType == 0 && folderId == 0 && !onlySelect) {
|
||||
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward) || initialDialogsType == 0 && folderId == 0 && !onlySelect) {
|
||||
scrimPaint = new Paint() {
|
||||
@Override
|
||||
public void setAlpha(int a) {
|
||||
|
@ -2098,7 +2098,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
ContentView contentView = new ContentView(context);
|
||||
fragmentView = contentView;
|
||||
|
||||
int pagesCount = folderId == 0 && initialDialogsType == 0 && !onlySelect ? 2 : 1;
|
||||
int pagesCount = (initialDialogsType == 3 && NekoConfig.showTabsOnForward) || (folderId == 0 && initialDialogsType == 0 && !onlySelect) ? 2 : 1;
|
||||
viewPages = new ViewPage[pagesCount];
|
||||
for (int a = 0; a < pagesCount; a++) {
|
||||
final ViewPage viewPage = new ViewPage(context) {
|
||||
|
@ -2837,7 +2837,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
if (filterTabsView != null) {
|
||||
contentView.addView(filterTabsView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 44));
|
||||
}
|
||||
if (!onlySelect) {
|
||||
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward) || !onlySelect) {
|
||||
contentView.addView(actionBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||
}
|
||||
|
||||
|
@ -2888,7 +2888,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
RecyclerView.Adapter currentAdapter = viewPages[a].listView.getAdapter();
|
||||
|
||||
if (viewPages[a].selectedType == Integer.MAX_VALUE) {
|
||||
viewPages[a].dialogsType = 0;
|
||||
viewPages[a].dialogsType = initialDialogsType;
|
||||
viewPages[a].listView.updatePullState();
|
||||
} else {
|
||||
MessagesController.DialogFilter filter = getMessagesController().dialogFilters.get(viewPages[a].selectedType);
|
||||
|
@ -2983,14 +2983,14 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
if (viewPages[0].selectedType != Integer.MAX_VALUE) {
|
||||
viewPages[0].selectedType = Integer.MAX_VALUE;
|
||||
viewPages[0].dialogsAdapter.setDialogsType(0);
|
||||
viewPages[0].dialogsType = 0;
|
||||
viewPages[0].dialogsAdapter.setDialogsType(initialDialogsType);
|
||||
viewPages[0].dialogsType = initialDialogsType;
|
||||
viewPages[0].dialogsAdapter.notifyDataSetChanged();
|
||||
}
|
||||
viewPages[1].setVisibility(View.GONE);
|
||||
viewPages[1].selectedType = Integer.MAX_VALUE;
|
||||
viewPages[1].dialogsAdapter.setDialogsType(0);
|
||||
viewPages[1].dialogsType = 0;
|
||||
viewPages[1].dialogsAdapter.setDialogsType(initialDialogsType);
|
||||
viewPages[1].dialogsType = initialDialogsType;
|
||||
viewPages[1].dialogsAdapter.notifyDataSetChanged();
|
||||
filterTabsView.setVisibility(View.GONE);
|
||||
for (int a = 0; a < viewPages.length; a++) {
|
||||
|
@ -5597,4 +5597,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
|
||||
return arrayList.toArray(new ThemeDescription[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSwipeBackEnabled(MotionEvent event) {
|
||||
return !((initialDialogsType == 3 && NekoConfig.showTabsOnForward) && viewPages[0].selectedType != filterTabsView.getFirstTabId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public class NekoConfig {
|
|||
public static boolean forceTablet = false;
|
||||
public static boolean openArchiveOnPull = false;
|
||||
public static boolean avatarAsDrawerBackground = false;
|
||||
public static boolean showTabsOnForward = false;
|
||||
public static int nameOrder = 1;
|
||||
public static int eventType = 0;
|
||||
public static boolean newYear = false;
|
||||
|
@ -93,6 +94,7 @@ public class NekoConfig {
|
|||
editor.putBoolean("showHiddenFeature", showHiddenFeature);
|
||||
editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground);
|
||||
editor.putBoolean("useSystemEmoji", useSystemEmoji);
|
||||
editor.putBoolean("showTabsOnForward", showTabsOnForward);
|
||||
editor.putFloat("stickerSize", stickerSize);
|
||||
editor.putInt("typeface", typeface);
|
||||
editor.putInt("nameOrder", nameOrder);
|
||||
|
@ -148,6 +150,7 @@ public class NekoConfig {
|
|||
hideKeyboardOnChatScroll = preferences.getBoolean("hideKeyboardOnChatScroll", false);
|
||||
avatarAsDrawerBackground = preferences.getBoolean("avatarAsDrawerBackground", false);
|
||||
useSystemEmoji = preferences.getBoolean("useSystemEmoji", SharedConfig.useSystemEmoji);
|
||||
showTabsOnForward = preferences.getBoolean("showTabsOnForward", showTabsOnForward);
|
||||
configLoaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -426,4 +429,12 @@ public class NekoConfig {
|
|||
editor.putBoolean("useSystemEmoji", useSystemEmoji);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static void toggleShowTabsOnForward() {
|
||||
showTabsOnForward = !showTabsOnForward;
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("showTabsOnForward", showTabsOnForward);
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
private int forceTabletRow;
|
||||
private int openArchiveOnPullRow;
|
||||
private int avatarAsDrawerBackgroundRow;
|
||||
private int showTabsOnForwardRow;
|
||||
private int eventTypeRow;
|
||||
private int newYearRow;
|
||||
private int actionBarDecorationRow;
|
||||
|
@ -510,6 +511,11 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.avatarAsDrawerBackground);
|
||||
}
|
||||
} else if (position == showTabsOnForwardRow) {
|
||||
NekoConfig.toggleShowTabsOnForward();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.showTabsOnForward);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -552,6 +558,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
forceTabletRow = rowCount++;
|
||||
openArchiveOnPullRow = rowCount++;
|
||||
avatarAsDrawerBackgroundRow = rowCount++;
|
||||
showTabsOnForwardRow = rowCount++;
|
||||
nameOrderRow = rowCount++;
|
||||
eventTypeRow = NekoConfig.showHiddenFeature ? rowCount++ : -1;
|
||||
newYearRow = NekoConfig.showHiddenFeature ? rowCount++ : -1;
|
||||
|
@ -1040,6 +1047,8 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
textCell.setTextAndCheck(LocaleController.getString("HideKeyboardOnChatScroll", R.string.HideKeyboardOnChatScroll), NekoConfig.hideKeyboardOnChatScroll, true);
|
||||
} else if (position == avatarAsDrawerBackgroundRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("UseAvatarAsDrawerBackground", R.string.UseAvatarAsDrawerBackground), NekoConfig.avatarAsDrawerBackground, true);
|
||||
} else if (position == showTabsOnForwardRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ShowTabsOnForward", R.string.ShowTabsOnForward), NekoConfig.showTabsOnForward, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1078,7 +1087,8 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
position == unlimitedFavedStickersRow || position == messageMenuRow || position == deleteAccountRow ||
|
||||
position == translationProviderRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
|
||||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow ||
|
||||
position == connection2Row || position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow;
|
||||
position == connection2Row || position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow ||
|
||||
position == showTabsOnForwardRow;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1132,7 +1142,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
position == saveCacheToPrivateDirectoryRow || position == unlimitedFavedStickersRow ||
|
||||
position == disableFilteringRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
|
||||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow ||
|
||||
position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow) {
|
||||
position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow || position == showTabsOnForwardRow) {
|
||||
return 3;
|
||||
} else if (position == settingsRow || position == connectionRow || position == chatRow || position == experimentRow) {
|
||||
return 4;
|
||||
|
|
|
@ -85,4 +85,5 @@
|
|||
<string name="UserRestrictionsSendStickers2">Send Stickers</string>
|
||||
<string name="UserRestrictionsSendGifs">Send GIFs</string>
|
||||
<string name="UseAvatarAsDrawerBackground">Use avatar as drawer background</string>
|
||||
<string name="ShowTabsOnForward">Show tabs on forward</string>
|
||||
</resources>
|
Loading…
Reference in New Issue