Remove FilterPopup
This commit is contained in:
parent
0df8b45e59
commit
7bb2228cc7
@ -53,7 +53,6 @@ import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import tw.nekomimi.nekogram.FilterPopup;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class MessagesController extends BaseController implements NotificationCenter.NotificationCenterDelegate {
|
||||
@ -1129,9 +1128,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
dialogsUsersOnly.clear();
|
||||
dialogMessagesByIds.clear();
|
||||
dialogMessagesByRandomIds.clear();
|
||||
|
||||
FilterPopup.getInstance(currentAccount).cleanup();
|
||||
|
||||
channelAdmins.clear();
|
||||
loadingChannelAdmins.clear();
|
||||
users.clear();
|
||||
@ -3014,9 +3010,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
dialogsGroupsOnly.remove(dialog);
|
||||
dialogsUsersOnly.remove(dialog);
|
||||
dialogsForward.remove(dialog);
|
||||
|
||||
FilterPopup.getInstance(currentAccount).remove(dialog);
|
||||
|
||||
dialogs_dict.remove(did);
|
||||
|
||||
ArrayList<TLRPC.Dialog> dialogs = dialogsByFolder.get(dialog.folder_id);
|
||||
@ -11127,9 +11120,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
dialogsGroupsOnly.remove(dialog);
|
||||
dialogsUsersOnly.remove(dialog);
|
||||
dialogsForward.remove(dialog);
|
||||
|
||||
FilterPopup.getInstance(currentAccount).remove(dialog);
|
||||
|
||||
dialogs_dict.remove(dialog.id);
|
||||
dialogs_read_inbox_max.remove(dialog.id);
|
||||
dialogs_read_outbox_max.remove(dialog.id);
|
||||
@ -11275,7 +11265,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
}
|
||||
|
||||
public void sortDialogs(SparseArray<TLRPC.Chat> chatsDict) {
|
||||
FilterPopup.getInstance(currentAccount).cleanup();
|
||||
dialogsServerOnly.clear();
|
||||
dialogsCanAddUsers.clear();
|
||||
dialogsChannelsOnly.clear();
|
||||
@ -11304,7 +11293,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
TLRPC.Dialog d = allDialogs.get(a);
|
||||
int high_id = (int) (d.id >> 32);
|
||||
int lower_id = (int) d.id;
|
||||
FilterPopup.getInstance(currentAccount).sortDialogs(d, high_id, lower_id);
|
||||
if (d instanceof TLRPC.TL_dialog) {
|
||||
boolean canAddToForward = true;
|
||||
if (lower_id != 0 && high_id != 1) {
|
||||
|
@ -55,8 +55,6 @@ import java.util.Collections;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import tw.nekomimi.nekogram.FilterPopup;
|
||||
|
||||
public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
|
||||
|
||||
private Context mContext;
|
||||
@ -167,7 +165,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
|
||||
boolean hasContacts = false;
|
||||
if (hasHints) {
|
||||
count += 2 + MessagesController.getInstance(currentAccount).hintDialogs.size();
|
||||
} else if (FilterPopup.DialogType.isDialogsType(dialogsType) && dialogsCount == 0 && folderId == 0) {
|
||||
} else if (dialogsType == 0 && dialogsCount == 0 && folderId == 0) {
|
||||
if (ContactsController.getInstance(currentAccount).contacts.isEmpty() && ContactsController.getInstance(currentAccount).isLoadingContacts()) {
|
||||
onlineContacts = null;
|
||||
return (currentCount = 0);
|
||||
@ -295,7 +293,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
|
||||
|
||||
@Override
|
||||
public void notifyDataSetChanged() {
|
||||
hasHints = folderId == 0 && FilterPopup.DialogType.isDialogsType(dialogsType) && !isOnlySelect && !MessagesController.getInstance(currentAccount).hintDialogs.isEmpty();
|
||||
hasHints = folderId == 0 && dialogsType == 0 && !isOnlySelect && !MessagesController.getInstance(currentAccount).hintDialogs.isEmpty();
|
||||
super.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@ -444,7 +442,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
|
||||
cell.useSeparator = (i != getItemCount() - 1);
|
||||
}
|
||||
cell.fullSeparator = dialog.pinned && nextDialog != null && !nextDialog.pinned;
|
||||
if (FilterPopup.DialogType.isDialogsType(dialogsType)) {
|
||||
if (dialogsType == 0) {
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
cell.setDialogSelected(dialog.id == openedDialogId);
|
||||
}
|
||||
|
@ -57,8 +57,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import tw.nekomimi.nekogram.FilterPopup;
|
||||
|
||||
public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||
|
||||
private Context mContext;
|
||||
@ -362,7 +360,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||
add = true;
|
||||
}
|
||||
}
|
||||
} else if (FilterPopup.DialogType.isDialogsType(dialogsType) || dialogsType == 3) {
|
||||
} else if (dialogsType == 0 || dialogsType == 3) {
|
||||
if (!encryptedToLoad.contains(high_id)) {
|
||||
encryptedToLoad.add(high_id);
|
||||
add = true;
|
||||
@ -549,7 +547,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||
chatsToLoad.add(-lower_id);
|
||||
}
|
||||
}
|
||||
} else if (FilterPopup.DialogType.isDialogsType(dialogsType) || dialogsType == 3) {
|
||||
} else if (dialogsType == 0 || dialogsType == 3) {
|
||||
if (!encryptedToLoad.contains(high_id)) {
|
||||
encryptedToLoad.add(high_id);
|
||||
}
|
||||
|
@ -58,8 +58,6 @@ import org.telegram.ui.DialogsActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tw.nekomimi.nekogram.FilterPopup;
|
||||
|
||||
public class DialogCell extends BaseCell {
|
||||
|
||||
public static class CustomDialog {
|
||||
@ -1011,7 +1009,7 @@ public class DialogCell extends BaseCell {
|
||||
}
|
||||
}
|
||||
|
||||
if (FilterPopup.DialogType.isDialogsType(dialogsType) && MessagesController.getInstance(currentAccount).isProxyDialog(currentDialogId, true)) {
|
||||
if (dialogsType == 0 && MessagesController.getInstance(currentAccount).isProxyDialog(currentDialogId, true)) {
|
||||
drawPinBackground = true;
|
||||
timeString = LocaleController.getString("UseProxySponsor", R.string.UseProxySponsor);
|
||||
}
|
||||
|
@ -137,10 +137,7 @@ import org.telegram.ui.Components.StickersAlert;
|
||||
import org.telegram.ui.Components.UndoView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import tw.nekomimi.nekogram.FilterPopup;
|
||||
import tw.nekomimi.nekogram.MessageHelper;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class DialogsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
@ -903,26 +900,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
super(args);
|
||||
}
|
||||
|
||||
public void updateDialogsType(int type) {
|
||||
int dialogsTypeOld = dialogsType;
|
||||
dialogsType = type;
|
||||
if (dialogsAdapter != null) {
|
||||
dialogsAdapter.setDialogsType(type);
|
||||
dialogsAdapter.notifyDataSetChanged();
|
||||
}
|
||||
hideFloatingButton(false);
|
||||
if (dialogsTypeOld == dialogsType) {
|
||||
scrollToTop();
|
||||
} else {
|
||||
if (archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN && hasHiddenArchive()) {
|
||||
layoutManager.scrollToPositionWithOffset(1, 0);
|
||||
} else {
|
||||
layoutManager.scrollToPositionWithOffset(0, 0);
|
||||
}
|
||||
}
|
||||
actionBar.setTitle(getNekoTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
super.onFragmentCreate();
|
||||
@ -945,7 +922,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
hasPoll = arguments.getInt("hasPoll", 0);
|
||||
}
|
||||
|
||||
if (FilterPopup.DialogType.isDialogsType(dialogsType)) {
|
||||
if (dialogsType == 0) {
|
||||
askAboutContacts = MessagesController.getGlobalNotificationsSettings().getBoolean("askAboutContacts", true);
|
||||
SharedConfig.loadProxyList();
|
||||
}
|
||||
@ -1145,26 +1122,18 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
actionBar.setBackButtonContentDescription(LocaleController.getString("AccDescrOpenMenu", R.string.AccDescrOpenMenu));
|
||||
}
|
||||
if (folderId != 0) {
|
||||
actionBar.setTitle(getNekoTitle());
|
||||
actionBar.setTitle(getNekoTitle(LocaleController.getString("ArchivedChats", R.string.ArchivedChats)));
|
||||
} else {
|
||||
if (BuildVars.DEBUG_VERSION) {
|
||||
actionBar.setTitle("Telegram Beta");
|
||||
} else {
|
||||
actionBar.setTitle(getNekoTitle());
|
||||
actionBar.setTitle(getNekoTitle(LocaleController.getString("Nekogram", R.string.Nekogram)));
|
||||
}
|
||||
}
|
||||
if (folderId == 0) {
|
||||
actionBar.setSupportsHolidayImage(true);
|
||||
}
|
||||
}
|
||||
actionBar.setOnTouchListener((v, event) -> {
|
||||
int x = (int) event.getX();
|
||||
int y = (int) event.getY();
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN && NekoConfig.openFilterByActionBar) {
|
||||
FilterPopup.getInstance(currentAccount).createMenu(this, x, y, folderId, false);
|
||||
}
|
||||
return NekoConfig.openFilterByActionBar;
|
||||
});
|
||||
actionBar.setTitleActionRunnable(() -> {
|
||||
hideFloatingButton(false);
|
||||
scrollToTop();
|
||||
@ -1622,21 +1591,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
floatingButtonContainer.setVisibility(onlySelect || folderId != 0 ? View.GONE : View.VISIBLE);
|
||||
contentView.addView(floatingButtonContainer, LayoutHelper.createFrame((Build.VERSION.SDK_INT >= 21 ? 56 : 60) + 20, (Build.VERSION.SDK_INT >= 21 ? 56 : 60) + 14, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, LocaleController.isRTL ? 4 : 0, 0, LocaleController.isRTL ? 0 : 4, 0));
|
||||
floatingButtonContainer.setOnClickListener(v -> {
|
||||
if (!NekoConfig.openFilterByFab) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("destroyAfterSelect", true);
|
||||
presentFragment(new ContactsActivity(args));
|
||||
} else {
|
||||
FilterPopup.getInstance(currentAccount).createMenu(this, floatingButtonContainer.getRight(), floatingButtonContainer.getTop() + actionBar.getHeight(), folderId, true);
|
||||
}
|
||||
});
|
||||
floatingButtonContainer.setOnLongClickListener(v -> {
|
||||
if (NekoConfig.openFilterByFab) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("destroyAfterSelect", true);
|
||||
presentFragment(new ContactsActivity(args));
|
||||
}
|
||||
return NekoConfig.openFilterByFab;
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("destroyAfterSelect", true);
|
||||
presentFragment(new ContactsActivity(args));
|
||||
});
|
||||
|
||||
floatingButton = new ImageView(context);
|
||||
@ -1904,7 +1861,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
showSearch(false, false);
|
||||
}
|
||||
|
||||
if (!onlySelect && FilterPopup.DialogType.isDialogsType(dialogsType)) {
|
||||
if (!onlySelect && dialogsType == 0) {
|
||||
FragmentContextView fragmentLocationContextView = new FragmentContextView(context, this, true);
|
||||
contentView.addView(fragmentLocationContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 39, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));
|
||||
|
||||
@ -2621,10 +2578,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
|
||||
private boolean hasHiddenArchive() {
|
||||
return listView.getAdapter() == dialogsAdapter && !onlySelect
|
||||
&& FilterPopup.DialogType.isDialogsType(dialogsType)
|
||||
&& folderId == 0
|
||||
&& FilterPopup.getInstance(currentAccount).hasHiddenArchive(dialogsType);
|
||||
return listView.getAdapter() == dialogsAdapter && !onlySelect && dialogsType == 0 && folderId == 0 && getMessagesController().hasHiddenArchive();
|
||||
}
|
||||
|
||||
private boolean waitingForDialogsAnimationEnd() {
|
||||
@ -3487,46 +3441,16 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
}
|
||||
|
||||
private String getNekoTitle() {
|
||||
String title;
|
||||
switch (dialogsType) {
|
||||
case FilterPopup.DialogType.Users:
|
||||
title = LocaleController.getString("Users", R.string.Users);
|
||||
break;
|
||||
case FilterPopup.DialogType.Groups:
|
||||
title = LocaleController.getString("Groups", R.string.Groups);
|
||||
break;
|
||||
case FilterPopup.DialogType.Bots:
|
||||
title = LocaleController.getString("Bots", R.string.Bots);
|
||||
break;
|
||||
case FilterPopup.DialogType.Channels:
|
||||
title = LocaleController.getString("Channels", R.string.Channels);
|
||||
break;
|
||||
case FilterPopup.DialogType.Admin:
|
||||
title = LocaleController.getString("Admins", R.string.Admins);
|
||||
break;
|
||||
case FilterPopup.DialogType.Unmuted:
|
||||
title = LocaleController.getString("NotificationsUnmuted", R.string.NotificationsUnmuted);
|
||||
break;
|
||||
default:
|
||||
if (folderId != 0) {
|
||||
title = LocaleController.getString("ArchivedChats", R.string.ArchivedChats);
|
||||
} else {
|
||||
title = LocaleController.getString("Nekogram", R.string.Nekogram);
|
||||
}
|
||||
}
|
||||
if (FilterPopup.getInstance(currentAccount).getTotalUnreadCount() == 0) {
|
||||
return LocaleController.getString("NekogramEmojiDialogs", R.string.NekogramEmojiDialogs) + " " + title;
|
||||
}
|
||||
return LocaleController.getString("NekogramEmojiDialogsUnread", R.string.NekogramEmojiDialogsUnread) + " " + title;
|
||||
private String getNekoTitle(String title) {
|
||||
return LocaleController.getString("NekogramEmojiDialogs", R.string.NekogramEmojiDialogs) + " " + title;
|
||||
//if (FilterPopup.getInstance(currentAccount).getTotalUnreadCount() == 0) {
|
||||
// return LocaleController.getString("NekogramEmojiDialogs", R.string.NekogramEmojiDialogs) + " " + title;
|
||||
//}
|
||||
//return LocaleController.getString("NekogramEmojiDialogsUnread", R.string.NekogramEmojiDialogsUnread) + " " + title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didReceivedNotification(int id, int account, Object... args) {
|
||||
if (actionBar != null && id != NotificationCenter.didUpdateConnectionState) {
|
||||
actionBar.setTitle(getNekoTitle());
|
||||
}
|
||||
|
||||
if (id == NotificationCenter.dialogsNeedReload) {
|
||||
if (dialogsListFrozen) {
|
||||
return;
|
||||
@ -3571,7 +3495,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
if (dialogsListFrozen) {
|
||||
return;
|
||||
}
|
||||
if (FilterPopup.DialogType.isDialogsType(dialogsType) && getMessagesController().getDialogs(folderId).isEmpty()) {
|
||||
if (dialogsType == 0 && getMessagesController().getDialogs(folderId).isEmpty()) {
|
||||
if (dialogsAdapter != null) {
|
||||
dialogsAdapter.notifyDataSetChanged();
|
||||
}
|
||||
@ -3579,7 +3503,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
updateVisibleRows(0);
|
||||
}
|
||||
} else if (id == NotificationCenter.openedChatChanged) {
|
||||
if (FilterPopup.DialogType.isDialogsType(dialogsType) && AndroidUtilities.isTablet()) {
|
||||
if (dialogsType == 0 && AndroidUtilities.isTablet()) {
|
||||
boolean close = (Boolean) args[1];
|
||||
long dialog_id = (Long) args[0];
|
||||
if (close) {
|
||||
@ -3688,7 +3612,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
if (frozen && frozenDialogsList != null) {
|
||||
return frozenDialogsList;
|
||||
}
|
||||
|
||||
MessagesController messagesController = AccountInstance.getInstance(currentAccount).getMessagesController();
|
||||
if (dialogsType == 0) {
|
||||
return messagesController.getDialogs(folderId);
|
||||
@ -3704,9 +3627,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
return messagesController.dialogsChannelsOnly;
|
||||
} else if (dialogsType == 6) {
|
||||
return messagesController.dialogsGroupsOnly;
|
||||
} else {
|
||||
return FilterPopup.getInstance(currentAccount).getDialogs(dialogsType, folderId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setSideMenu(RecyclerView recyclerView) {
|
||||
@ -3797,11 +3719,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
} else {
|
||||
if ((mask & MessagesController.UPDATE_MASK_NEW_MESSAGE) != 0) {
|
||||
cell.checkCurrentDialogIndex(dialogsListFrozen);
|
||||
if (FilterPopup.DialogType.isDialogsType(dialogsType) && AndroidUtilities.isTablet()) {
|
||||
if (dialogsType == 0 && AndroidUtilities.isTablet()) {
|
||||
cell.setDialogSelected(cell.getDialogId() == openedDialogId);
|
||||
}
|
||||
} else if ((mask & MessagesController.UPDATE_MASK_SELECT_DIALOG) != 0) {
|
||||
if (FilterPopup.DialogType.isDialogsType(dialogsType) && AndroidUtilities.isTablet()) {
|
||||
if (dialogsType == 0 && AndroidUtilities.isTablet()) {
|
||||
cell.setDialogSelected(cell.getDialogId() == openedDialogId);
|
||||
}
|
||||
} else {
|
||||
|
@ -1,424 +0,0 @@
|
||||
package tw.nekomimi.nekogram;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.GridLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.BaseController;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.DialogObject;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
|
||||
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.DialogsActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FilterPopup extends BaseController {
|
||||
private static volatile FilterPopup[] Instance = new FilterPopup[UserConfig.MAX_ACCOUNT_COUNT];
|
||||
private ArrayList<TLRPC.Dialog> dialogsAdmin = new ArrayList<>();
|
||||
private ArrayList<TLRPC.Dialog> dialogsUsers = new ArrayList<>();
|
||||
private ArrayList<TLRPC.Dialog> dialogsGroups = new ArrayList<>();
|
||||
private ArrayList<TLRPC.Dialog> dialogsChannels = new ArrayList<>();
|
||||
private ArrayList<TLRPC.Dialog> dialogsBots = new ArrayList<>();
|
||||
private ActionBarPopupWindow scrimPopupWindow;
|
||||
|
||||
public FilterPopup(int num) {
|
||||
super(num);
|
||||
}
|
||||
|
||||
public static FilterPopup getInstance(int num) {
|
||||
FilterPopup localInstance = Instance[num];
|
||||
if (localInstance == null) {
|
||||
synchronized (FilterPopup.class) {
|
||||
localInstance = Instance[num];
|
||||
if (localInstance == null) {
|
||||
Instance[num] = localInstance = new FilterPopup(num);
|
||||
}
|
||||
}
|
||||
}
|
||||
return localInstance;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
dialogsUsers.clear();
|
||||
dialogsGroups.clear();
|
||||
dialogsChannels.clear();
|
||||
dialogsBots.clear();
|
||||
dialogsAdmin.clear();
|
||||
}
|
||||
|
||||
public void remove(TLRPC.Dialog dialog) {
|
||||
dialogsUsers.remove(dialog);
|
||||
dialogsGroups.remove(dialog);
|
||||
dialogsChannels.remove(dialog);
|
||||
dialogsBots.remove(dialog);
|
||||
dialogsAdmin.remove(dialog);
|
||||
}
|
||||
|
||||
public void sortDialogs(TLRPC.Dialog dialog, int high_id, int lower_id) {
|
||||
if (lower_id != 0 && high_id != 1) {
|
||||
if (DialogObject.isChannel(dialog)) {
|
||||
TLRPC.Chat chat = getMessagesController().getChat(-lower_id);
|
||||
if (chat != null) {
|
||||
if (chat.megagroup) {
|
||||
dialogsGroups.add(dialog);
|
||||
} else {
|
||||
dialogsChannels.add(dialog);
|
||||
}
|
||||
}
|
||||
if (chat != null && (chat.creator || ChatObject.hasAdminRights(chat)))
|
||||
dialogsAdmin.add(dialog);
|
||||
} else if (lower_id < 0) {
|
||||
dialogsGroups.add(dialog);
|
||||
} else {
|
||||
TLRPC.User user = getMessagesController().getUser(lower_id);
|
||||
if (user != null) {
|
||||
if (user.bot)
|
||||
dialogsBots.add(dialog);
|
||||
else
|
||||
dialogsUsers.add(dialog);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TLRPC.EncryptedChat encryptedChat = getMessagesController().getEncryptedChat(high_id);
|
||||
if (encryptedChat != null)
|
||||
dialogsUsers.add(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasHiddenArchive(int type) {
|
||||
if (!SharedConfig.archiveHidden)
|
||||
return false;
|
||||
ArrayList<TLRPC.Dialog> dialogs = getDialogs(type, 0);
|
||||
if (dialogs == null)
|
||||
return getMessagesController().hasHiddenArchive();
|
||||
for (TLRPC.Dialog dialog : dialogs) {
|
||||
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private ArrayList<TLRPC.Dialog> filterUnmutedDialogs(ArrayList<TLRPC.Dialog> allDialogs) {
|
||||
ArrayList<TLRPC.Dialog> dialogs = new ArrayList<>();
|
||||
for (TLRPC.Dialog dialog : allDialogs) {
|
||||
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
||||
continue;
|
||||
}
|
||||
if (!getMessagesController().isDialogMuted(dialog.id)) {
|
||||
dialogs.add(dialog);
|
||||
}
|
||||
}
|
||||
return dialogs;
|
||||
}
|
||||
|
||||
public ArrayList<TLRPC.Dialog> getDialogs(int type, int folderId) {
|
||||
ArrayList<TLRPC.Dialog> allDialogs = new ArrayList<>(getMessagesController().getDialogs(folderId));
|
||||
ArrayList<TLRPC.Dialog> folders = new ArrayList<>();
|
||||
ArrayList<ArrayList<TLRPC.Dialog>> folderDialogs = new ArrayList<>();
|
||||
|
||||
for (TLRPC.Dialog dialog : allDialogs) {
|
||||
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
||||
folders.add(dialog);
|
||||
TLRPC.TL_dialogFolder dialogFolder = (TLRPC.TL_dialogFolder) dialog;
|
||||
folderDialogs.add(new ArrayList<>(getMessagesController().getDialogs(dialogFolder.folder.id)));
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<TLRPC.Dialog> dialogs = new ArrayList<>();
|
||||
switch (type) {
|
||||
case DialogType.Unmuted:
|
||||
for (int i = 0; i < folders.size(); i++) {
|
||||
folderDialogs.get(i).retainAll(filterUnmutedDialogs(folderDialogs.get(i)));
|
||||
if (!folderDialogs.get(i).isEmpty())
|
||||
dialogs.add(folders.get(i));
|
||||
}
|
||||
allDialogs.retainAll(filterUnmutedDialogs(allDialogs));
|
||||
break;
|
||||
case DialogType.Users:
|
||||
for (int i = 0; i < folders.size(); i++) {
|
||||
folderDialogs.get(i).retainAll(dialogsUsers);
|
||||
if (!folderDialogs.get(i).isEmpty())
|
||||
dialogs.add(folders.get(i));
|
||||
}
|
||||
allDialogs.retainAll(dialogsUsers);
|
||||
break;
|
||||
case DialogType.Groups:
|
||||
for (int i = 0; i < folders.size(); i++) {
|
||||
folderDialogs.get(i).retainAll(dialogsGroups);
|
||||
if (!folderDialogs.get(i).isEmpty())
|
||||
dialogs.add(folders.get(i));
|
||||
}
|
||||
allDialogs.retainAll(dialogsGroups);
|
||||
break;
|
||||
case DialogType.Channels:
|
||||
for (int i = 0; i < folders.size(); i++) {
|
||||
folderDialogs.get(i).retainAll(dialogsChannels);
|
||||
if (!folderDialogs.get(i).isEmpty())
|
||||
dialogs.add(folders.get(i));
|
||||
}
|
||||
allDialogs.retainAll(dialogsChannels);
|
||||
break;
|
||||
case DialogType.Bots:
|
||||
for (int i = 0; i < folders.size(); i++) {
|
||||
folderDialogs.get(i).retainAll(dialogsBots);
|
||||
if (!folderDialogs.get(i).isEmpty())
|
||||
dialogs.add(folders.get(i));
|
||||
}
|
||||
allDialogs.retainAll(dialogsBots);
|
||||
break;
|
||||
case DialogType.Admin:
|
||||
for (int i = 0; i < folders.size(); i++) {
|
||||
folderDialogs.get(i).retainAll(dialogsAdmin);
|
||||
if (!folderDialogs.get(i).isEmpty())
|
||||
dialogs.add(folders.get(i));
|
||||
}
|
||||
allDialogs.retainAll(dialogsAdmin);
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
if (folderId != 0 && allDialogs.isEmpty()) {
|
||||
allDialogs = new ArrayList<>(getMessagesController().getDialogs(folderId));
|
||||
}
|
||||
dialogs.addAll(allDialogs);
|
||||
return dialogs;
|
||||
}
|
||||
|
||||
public int getTotalUnreadCount() {
|
||||
ArrayList<TLRPC.Dialog> allDialogs = new ArrayList<>(getMessagesController().getDialogs(0));
|
||||
return getDialogsUnreadCount(allDialogs);
|
||||
}
|
||||
|
||||
private int getDialogsUnreadCount(ArrayList<TLRPC.Dialog> dialogs) {
|
||||
int count = 0;
|
||||
for (TLRPC.Dialog dialog : dialogs) {
|
||||
if (!(dialog instanceof TLRPC.TL_dialogFolder)
|
||||
&& !getMessagesController().isDialogMuted(dialog.id)) {
|
||||
count += dialog.unread_count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public void createMenu(DialogsActivity dialogsActivity, int x, int y, int folderId, boolean fab) {
|
||||
ArrayList<CharSequence> items = new ArrayList<>();
|
||||
final ArrayList<Integer> options = new ArrayList<>();
|
||||
ArrayList<Integer> unreadCounts = new ArrayList<>();
|
||||
|
||||
ArrayList<TLRPC.Dialog> allDialogs = new ArrayList<>(getMessagesController().getDialogs(folderId));
|
||||
|
||||
items.add(LocaleController.getString("All", R.string.All));
|
||||
options.add(DialogType.All);
|
||||
unreadCounts.add(getDialogsUnreadCount(allDialogs));
|
||||
|
||||
ArrayList<TLRPC.Dialog> temp = new ArrayList<>(allDialogs);
|
||||
temp.retainAll(dialogsUsers);
|
||||
if (!temp.isEmpty()) {
|
||||
items.add(LocaleController.getString("Users", R.string.Users));
|
||||
options.add(DialogType.Users);
|
||||
unreadCounts.add(getDialogsUnreadCount(temp));
|
||||
}
|
||||
|
||||
temp = new ArrayList<>(allDialogs);
|
||||
temp.retainAll(dialogsGroups);
|
||||
if (!temp.isEmpty()) {
|
||||
items.add(LocaleController.getString("Groups", R.string.Groups));
|
||||
options.add(DialogType.Groups);
|
||||
unreadCounts.add(getDialogsUnreadCount(temp));
|
||||
}
|
||||
|
||||
temp = new ArrayList<>(allDialogs);
|
||||
temp.retainAll(dialogsChannels);
|
||||
if (!temp.isEmpty()) {
|
||||
items.add(LocaleController.getString("Channels", R.string.Channels));
|
||||
options.add(DialogType.Channels);
|
||||
unreadCounts.add(getDialogsUnreadCount(temp));
|
||||
}
|
||||
|
||||
temp = new ArrayList<>(allDialogs);
|
||||
temp.retainAll(dialogsBots);
|
||||
if (!temp.isEmpty()) {
|
||||
items.add(LocaleController.getString("Bots", R.string.Bots));
|
||||
options.add(DialogType.Bots);
|
||||
unreadCounts.add(getDialogsUnreadCount(temp));
|
||||
}
|
||||
|
||||
temp = new ArrayList<>(allDialogs);
|
||||
temp.retainAll(dialogsAdmin);
|
||||
if (!temp.isEmpty()) {
|
||||
items.add(LocaleController.getString("Admins", R.string.Admins));
|
||||
options.add(DialogType.Admin);
|
||||
unreadCounts.add(getDialogsUnreadCount(temp));
|
||||
}
|
||||
|
||||
temp = new ArrayList<>(allDialogs);
|
||||
temp.retainAll(filterUnmutedDialogs(allDialogs));
|
||||
if (!temp.isEmpty()) {
|
||||
items.add(LocaleController.getString("NotificationsUnmuted", R.string.NotificationsUnmuted));
|
||||
options.add(DialogType.Unmuted);
|
||||
unreadCounts.add(getDialogsUnreadCount(temp));
|
||||
}
|
||||
|
||||
if (scrimPopupWindow != null) {
|
||||
scrimPopupWindow.dismiss();
|
||||
scrimPopupWindow = null;
|
||||
return;
|
||||
}
|
||||
|
||||
Rect rect = new Rect();
|
||||
|
||||
ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(dialogsActivity.getParentActivity());
|
||||
popupLayout.setOnTouchListener(new View.OnTouchListener() {
|
||||
|
||||
private int[] pos = new int[2];
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
if (scrimPopupWindow != null && scrimPopupWindow.isShowing()) {
|
||||
View contentView = scrimPopupWindow.getContentView();
|
||||
contentView.getLocationInWindow(pos);
|
||||
rect.set(pos[0], pos[1], pos[0] + contentView.getMeasuredWidth(), pos[1] + contentView.getMeasuredHeight());
|
||||
if (!rect.contains((int) event.getX(), (int) event.getY())) {
|
||||
scrimPopupWindow.dismiss();
|
||||
}
|
||||
}
|
||||
} else if (event.getActionMasked() == MotionEvent.ACTION_OUTSIDE) {
|
||||
if (scrimPopupWindow != null && scrimPopupWindow.isShowing()) {
|
||||
scrimPopupWindow.dismiss();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popupLayout.setDispatchKeyEventListener(keyEvent -> {
|
||||
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && keyEvent.getRepeatCount() == 0 && scrimPopupWindow != null && scrimPopupWindow.isShowing()) {
|
||||
scrimPopupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
Rect backgroundPaddings = new Rect();
|
||||
Drawable shadowDrawable = dialogsActivity.getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate();
|
||||
shadowDrawable.getPadding(backgroundPaddings);
|
||||
popupLayout.setBackgroundDrawable(shadowDrawable);
|
||||
popupLayout.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
|
||||
|
||||
LinearLayout linearLayout = new LinearLayout(dialogsActivity.getParentActivity());
|
||||
GridLayout gridLayout = new GridLayout(dialogsActivity.getParentActivity());
|
||||
RelativeLayout cascadeLayout = new RelativeLayout(dialogsActivity.getParentActivity()) {
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
setMeasuredDimension(gridLayout.getMeasuredWidth(), getMeasuredHeight());
|
||||
}
|
||||
};
|
||||
cascadeLayout.addView(gridLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
|
||||
cascadeLayout.addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||
|
||||
ScrollView scrollView;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
scrollView = new ScrollView(dialogsActivity.getParentActivity(), null, 0, R.style.scrollbarShapeStyle) {
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
setMeasuredDimension(cascadeLayout.getMeasuredWidth(), getMeasuredHeight());
|
||||
}
|
||||
};
|
||||
} else {
|
||||
scrollView = new ScrollView(dialogsActivity.getParentActivity());
|
||||
}
|
||||
scrollView.setClipToPadding(false);
|
||||
popupLayout.addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
|
||||
|
||||
gridLayout.setColumnCount(2);
|
||||
gridLayout.setMinimumWidth(AndroidUtilities.dp(200));
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
for (int a = 0, N = items.size(); a < N; a++) {
|
||||
ActionBarMenuSubItem cell = new ActionBarMenuSubItem(dialogsActivity.getParentActivity());
|
||||
cell.setText(items.get(a).toString());
|
||||
cell.setMinimumWidth(AndroidUtilities.dp(171));
|
||||
ActionBarMenuSubItem cell2 = new ActionBarMenuSubItem(dialogsActivity.getParentActivity());
|
||||
linearLayout.addView(cell2);
|
||||
gridLayout.addView(cell);
|
||||
UnreadCountBadgeView badge = new UnreadCountBadgeView(dialogsActivity.getParentActivity(), unreadCounts.get(a).toString());
|
||||
gridLayout.addView(badge);
|
||||
if (unreadCounts.get(a) == 0)
|
||||
badge.setVisibility(View.GONE);
|
||||
else
|
||||
badge.setVisibility(View.VISIBLE);
|
||||
final int i = a;
|
||||
cell2.setOnClickListener(v1 -> {
|
||||
dialogsActivity.updateDialogsType(options.get(i));
|
||||
if (scrimPopupWindow != null) {
|
||||
scrimPopupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
scrollView.addView(cascadeLayout, LayoutHelper.createScroll(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP));
|
||||
scrimPopupWindow = new ActionBarPopupWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
if (scrimPopupWindow != this) {
|
||||
return;
|
||||
}
|
||||
scrimPopupWindow = null;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
dialogsActivity.getParentActivity().getWindow().getDecorView().setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
}
|
||||
}
|
||||
};
|
||||
scrimPopupWindow.setDismissAnimationDuration(220);
|
||||
scrimPopupWindow.setOutsideTouchable(true);
|
||||
scrimPopupWindow.setClippingEnabled(true);
|
||||
scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation);
|
||||
scrimPopupWindow.setFocusable(true);
|
||||
popupLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST));
|
||||
scrimPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
|
||||
scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
|
||||
scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
|
||||
int popupX = x - popupLayout.getMeasuredWidth() + backgroundPaddings.left - AndroidUtilities.dp(28);
|
||||
if (popupX < AndroidUtilities.dp(6)) {
|
||||
popupX = AndroidUtilities.dp(6);
|
||||
} else if (popupX > dialogsActivity.getFragmentView().getMeasuredWidth() - AndroidUtilities.dp(6) - popupLayout.getMeasuredWidth()) {
|
||||
popupX = dialogsActivity.getFragmentView().getMeasuredWidth() - AndroidUtilities.dp(6) - popupLayout.getMeasuredWidth();
|
||||
}
|
||||
int totalHeight = dialogsActivity.getFragmentView().getHeight();
|
||||
int height = popupLayout.getMeasuredHeight();
|
||||
int popupY = height < totalHeight ? y - (fab ? height : 0) : AndroidUtilities.statusBarHeight;
|
||||
scrimPopupWindow.showAtLocation(dialogsActivity.getFragmentView(), Gravity.LEFT | Gravity.TOP, popupX, popupY);
|
||||
}
|
||||
|
||||
public static class DialogType {
|
||||
public static final int All = 0;
|
||||
public static final int Users = 7;
|
||||
public static final int Groups = 8;
|
||||
public static final int Channels = 9;
|
||||
public static final int Bots = 10;
|
||||
public static final int Admin = 11;
|
||||
public static final int Unmuted = 12;
|
||||
|
||||
public static boolean isDialogsType(int dialogsType) {
|
||||
return dialogsType == 0 || (dialogsType >= 7 && dialogsType <= 12);
|
||||
}
|
||||
}
|
||||
}
|
@ -16,9 +16,6 @@ public class NekoConfig {
|
||||
public static boolean useIPv6 = false;
|
||||
public static boolean showHiddenFeature = false;
|
||||
|
||||
public static boolean openFilterByActionBar = true;
|
||||
public static boolean openFilterByFab = false;
|
||||
|
||||
public static boolean ignoreBlocked = false;
|
||||
public static boolean hideProxySponsorChannel = false;
|
||||
public static boolean saveCacheToPrivateDirectory = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
|
||||
@ -89,8 +86,6 @@ public class NekoConfig {
|
||||
editor.putBoolean("disablePhotoSideAction", disablePhotoSideAction);
|
||||
editor.putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll);
|
||||
editor.putBoolean("openArchiveOnPull", openArchiveOnPull);
|
||||
editor.putBoolean("openFilterByActionBar", openFilterByActionBar);
|
||||
editor.putBoolean("openFilterByFab", openFilterByFab);
|
||||
editor.putBoolean("showHiddenFeature", showHiddenFeature);
|
||||
editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground);
|
||||
editor.putFloat("stickerSize", stickerSize);
|
||||
@ -144,8 +139,6 @@ public class NekoConfig {
|
||||
translationProvider = preferences.getInt("translationProvider", 1);
|
||||
disablePhotoSideAction = preferences.getBoolean("disablePhotoSideAction", true);
|
||||
openArchiveOnPull = preferences.getBoolean("openArchiveOnPull", false);
|
||||
openFilterByActionBar = preferences.getBoolean("openFilterByActionBar", true);
|
||||
openFilterByFab = preferences.getBoolean("openFilterByFab", false);
|
||||
showHiddenFeature = preferences.getBoolean("showHiddenFeature", false);
|
||||
hideKeyboardOnChatScroll = preferences.getBoolean("hideKeyboardOnChatScroll", false);
|
||||
avatarAsDrawerBackground = preferences.getBoolean("avatarAsDrawerBackground", false);
|
||||
@ -396,22 +389,6 @@ public class NekoConfig {
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static void toggleOpenFilterByFab() {
|
||||
openFilterByFab = !openFilterByFab;
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("openFilterByFab", openFilterByFab);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static void toggleOpenFilterByActionBar() {
|
||||
openFilterByActionBar = !openFilterByActionBar;
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("openFilterByActionBar", openFilterByActionBar);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static void toggleShowHiddenFeature() {
|
||||
showHiddenFeature = !showHiddenFeature;
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
||||
|
@ -70,11 +70,6 @@ public class NekoSettingsActivity extends BaseFragment {
|
||||
private int ipv6Row;
|
||||
private int connection2Row;
|
||||
|
||||
private int dialogsFilterRow;
|
||||
private int openFilterByActionBarRow;
|
||||
private int openFilterByFabRow;
|
||||
private int dialogsFilter2Row;
|
||||
|
||||
private int chatRow;
|
||||
private int inappCameraRow;
|
||||
private int useSystemEmojiRow;
|
||||
@ -146,17 +141,9 @@ public class NekoSettingsActivity extends BaseFragment {
|
||||
|
||||
listView = new RecyclerListView(context);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) {
|
||||
@Override
|
||||
public boolean supportsPredictiveItemAnimations() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
listView.setGlowColor(Theme.getColor(Theme.key_avatar_backgroundActionBarBlue));
|
||||
listView.setAdapter(listAdapter);
|
||||
listView.setItemAnimator(null);
|
||||
listView.setLayoutAnimation(null);
|
||||
listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
|
||||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
|
||||
listView.setAdapter(listAdapter);
|
||||
listView.setOnItemClickListener((view, position, x, y) -> {
|
||||
if (position == ipv6Row) {
|
||||
NekoConfig.toggleIPv6();
|
||||
@ -512,16 +499,6 @@ public class NekoSettingsActivity extends BaseFragment {
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.openArchiveOnPull);
|
||||
}
|
||||
} else if (position == openFilterByActionBarRow) {
|
||||
NekoConfig.toggleOpenFilterByActionBar();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.openFilterByActionBar);
|
||||
}
|
||||
} else if (position == openFilterByFabRow) {
|
||||
NekoConfig.toggleOpenFilterByFab();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.openFilterByFab);
|
||||
}
|
||||
} else if (position == connection2Row) {
|
||||
NekoConfig.toggleShowHiddenFeature();
|
||||
updateRows();
|
||||
@ -557,10 +534,6 @@ public class NekoSettingsActivity extends BaseFragment {
|
||||
connectionRow = rowCount++;
|
||||
ipv6Row = rowCount++;
|
||||
connection2Row = rowCount++;
|
||||
dialogsFilterRow = rowCount++;
|
||||
openFilterByActionBarRow = rowCount++;
|
||||
openFilterByFabRow = rowCount++;
|
||||
dialogsFilter2Row = rowCount++;
|
||||
chatRow = rowCount++;
|
||||
inappCameraRow = rowCount++;
|
||||
useSystemEmojiRow = rowCount++;
|
||||
@ -1066,10 +1039,6 @@ public class NekoSettingsActivity extends BaseFragment {
|
||||
textCell.setTextAndValueAndCheck(LocaleController.getString("UnlimitedPinnedDialogs", R.string.UnlimitedPinnedDialogs), LocaleController.getString("UnlimitedPinnedDialogsAbout", R.string.UnlimitedPinnedDialogsAbout), NekoConfig.unlimitedPinnedDialogs, true, deleteAccountRow != -1);
|
||||
} else if (position == openArchiveOnPullRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("OpenArchiveOnPull", R.string.OpenArchiveOnPull), NekoConfig.openArchiveOnPull, true);
|
||||
} else if (position == openFilterByActionBarRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("TapOnActionBar", R.string.TapOnActionBar), NekoConfig.openFilterByActionBar, true);
|
||||
} else if (position == openFilterByFabRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("TapOnFab", R.string.TapOnFab), NekoConfig.openFilterByFab, false);
|
||||
} else if (position == hideKeyboardOnChatScrollRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("HideKeyboardOnChatScroll", R.string.HideKeyboardOnChatScroll), NekoConfig.hideKeyboardOnChatScroll, true);
|
||||
} else if (position == avatarAsDrawerBackgroundRow) {
|
||||
@ -1087,8 +1056,6 @@ public class NekoSettingsActivity extends BaseFragment {
|
||||
headerCell.setText(LocaleController.getString("Chat", R.string.Chat));
|
||||
} else if (position == experimentRow) {
|
||||
headerCell.setText(LocaleController.getString("Experiment", R.string.Experiment));
|
||||
} else if (position == dialogsFilterRow) {
|
||||
headerCell.setText(LocaleController.getString("OpenDialogsFilterBy", R.string.OpenDialogsFilterBy));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1114,8 +1081,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
||||
position == unlimitedFavedStickersRow || position == messageMenuRow || position == deleteAccountRow ||
|
||||
position == translationProviderRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
|
||||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow ||
|
||||
position == openFilterByActionBarRow || position == openFilterByFabRow || position == connection2Row ||
|
||||
position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow;
|
||||
position == connection2Row || position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1156,7 +1122,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == connection2Row || position == chat2Row || position == experiment2Row || position == dialogsFilter2Row) {
|
||||
if (position == connection2Row || position == chat2Row || position == experiment2Row) {
|
||||
return 1;
|
||||
} else if (position == nameOrderRow || position == mapPreviewRow || position == stickerSizeRow || position == messageMenuRow ||
|
||||
position == deleteAccountRow || position == translationProviderRow || position == eventTypeRow || position == actionBarDecorationRow) {
|
||||
@ -1168,11 +1134,9 @@ public class NekoSettingsActivity extends BaseFragment {
|
||||
position == saveCacheToPrivateDirectoryRow || position == unlimitedFavedStickersRow ||
|
||||
position == disableFilteringRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
|
||||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow ||
|
||||
position == openFilterByActionBarRow || position == openFilterByFabRow || position == hideKeyboardOnChatScrollRow ||
|
||||
position == avatarAsDrawerBackgroundRow) {
|
||||
position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow) {
|
||||
return 3;
|
||||
} else if (position == settingsRow || position == connectionRow || position == chatRow || position == experimentRow ||
|
||||
position == dialogsFilterRow) {
|
||||
} else if (position == settingsRow || position == connectionRow || position == chatRow || position == experimentRow) {
|
||||
return 4;
|
||||
} else if (position == needRestartRow) {
|
||||
return 7;
|
||||
|
@ -26,12 +26,6 @@
|
||||
<string name="AddToSavedMessages">Save message</string>
|
||||
<string name="CreateMention">Create Mention</string>
|
||||
<string name="ForceTabletMode">Force tablet mode*</string>
|
||||
<string name="All">All</string>
|
||||
<string name="Users">Users</string>
|
||||
<string name="Groups">Groups</string>
|
||||
<string name="Channels">Channels</string>
|
||||
<string name="Bots">Bots</string>
|
||||
<string name="Admins">Administrating</string>
|
||||
<string name="Prpr">Peropero</string>
|
||||
<string name="TransparentStatusBar">Transparent status bar</string>
|
||||
<string name="EnableResidentNotification">Show a resident notification</string>
|
||||
@ -87,9 +81,6 @@
|
||||
<string name="UnlimitedPinnedDialogs">Unlimited pinned dialogs</string>
|
||||
<string name="UnlimitedPinnedDialogsAbout">Pin unlimited dialogs by turn their sync off.</string>
|
||||
<string name="OpenArchiveOnPull">Open Archive on pulldown</string>
|
||||
<string name="OpenDialogsFilterBy">Open dialogs filter by</string>
|
||||
<string name="TapOnActionBar">Tap on the title bar</string>
|
||||
<string name="TapOnFab">Tap on the pencil button</string>
|
||||
<string name="HideKeyboardOnChatScroll">Hide keyboard on chat scroll</string>
|
||||
<string name="UserRestrictionsSendStickers2">Send Stickers</string>
|
||||
<string name="UserRestrictionsSendGifs">Send GIFs</string>
|
||||
|
Loading…
Reference in New Issue
Block a user