1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-07-04 11:13:36 +00:00

Added open archive on pulldown

This commit is contained in:
NekoInverter 2020-02-20 20:35:34 +08:00
parent c3da4abed9
commit 097f212062
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
4 changed files with 36 additions and 2 deletions

View File

@ -623,6 +623,20 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
((DialogCell) view).startOutAnimation();
archivePullViewState = ARCHIVE_ITEM_STATE_SHOWED;
if (NekoConfig.openArchiveOnPull) {
AndroidUtilities.runOnUIThread(() -> {
// Open the folder.
// Delay was taken from PullForegroundDrawable::startOutAnimation().
Bundle args = new Bundle();
args.putInt("folderId", 1); // 1 is the ID of the archive folder.
args.putInt("dialogsType", dialogsType);
args.putBoolean("onlySelect", onlySelect);
DialogsActivity dialogsActivity = new DialogsActivity(args);
dialogsActivity.setDelegate(delegate);
presentFragment(dialogsActivity, onlySelect);
}, 200);
}
}
}

View File

@ -27,6 +27,7 @@ public class NekoConfig {
public static boolean unlimitedFavedStickers = false;
public static boolean disablePhotoSideAction = true;
public static boolean unlimitedPinnedDialogs = false;
public static boolean openArchiveOnPull = false;
public static boolean showAddToSavedMessages = true;
public static boolean showReport = false;
@ -83,6 +84,7 @@ public class NekoConfig {
editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers);
editor.putBoolean("unlimitedPinnedDialogs", unlimitedPinnedDialogs);
editor.putBoolean("disablePhotoSideAction", disablePhotoSideAction);
editor.putBoolean("openArchiveOnPull", openArchiveOnPull);
editor.putInt("translationProvider", translationProvider);
editor.putInt("eventType", eventType);
editor.putInt("actionBarDecoration", actionBarDecoration);
@ -130,6 +132,7 @@ public class NekoConfig {
unlimitedPinnedDialogs = preferences.getBoolean("unlimitedPinnedDialogs", false);
translationProvider = preferences.getInt("translationProvider", 1);
disablePhotoSideAction = preferences.getBoolean("disablePhotoSideAction", true);
openArchiveOnPull = preferences.getBoolean("openArchiveOnPull", false);
configLoaded = true;
}
}
@ -373,4 +376,11 @@ public class NekoConfig {
editor.commit();
}
public static void toggleOpenArchiveOnPull() {
openArchiveOnPull = !openArchiveOnPull;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("openArchiveOnPull", openArchiveOnPull);
editor.commit();
}
}

View File

@ -91,6 +91,7 @@ public class NekoSettingsActivity extends BaseFragment {
private int nameOrderRow;
private int transparentStatusBarRow;
private int forceTabletRow;
private int openArchiveOnPullRow;
private int eventTypeRow;
private int newYearRow;
private int actionBarDecorationRow;
@ -500,6 +501,11 @@ public class NekoSettingsActivity extends BaseFragment {
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.unlimitedPinnedDialogs);
}
} else if (position == openArchiveOnPullRow) {
NekoConfig.toggleOpenArchiveOnPull();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.openArchiveOnPull);
}
}
});
@ -539,6 +545,7 @@ public class NekoSettingsActivity extends BaseFragment {
typefaceRow = rowCount++;
transparentStatusBarRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? rowCount++ : -1;
forceTabletRow = rowCount++;
openArchiveOnPullRow = rowCount++;
nameOrderRow = rowCount++;
eventTypeRow = rowCount++;
newYearRow = rowCount++;
@ -1021,6 +1028,8 @@ public class NekoSettingsActivity extends BaseFragment {
textCell.setTextAndCheck(LocaleController.getString("DisablePhotoViewerSideAction", R.string.DisablePhotoViewerSideAction), NekoConfig.disablePhotoSideAction, true);
} else if (position == unlimitedPinnedDialogsRow) {
textCell.setTextAndValueAndCheck(LocaleController.getString("UnlimitedPinnedDialogs", R.string.UnlimitedPinnedDialogs), LocaleController.getString("UnlimitedPinnedDialogsAbout", R.string.UnlimitedPinnedDialogsAbout), NekoConfig.unlimitedPinnedDialogs, true, true);
} else if (position == openArchiveOnPullRow) {
textCell.setTextAndCheck(LocaleController.getString("OpenArchiveOnPull", R.string.OpenArchiveOnPull), NekoConfig.openArchiveOnPull, true);
}
break;
}
@ -1058,7 +1067,7 @@ public class NekoSettingsActivity extends BaseFragment {
(position == disableFilteringRow && sensitiveCanChange) || position == stickerSizeRow ||
position == unlimitedFavedStickersRow || position == messageMenuRow || position == deleteAccountRow ||
position == translationProviderRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow;
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow;
}
@Override
@ -1110,7 +1119,7 @@ public class NekoSettingsActivity extends BaseFragment {
position == forceTabletRow || position == newYearRow ||
position == saveCacheToPrivateDirectoryRow || position == unlimitedFavedStickersRow ||
position == disableFilteringRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow) {
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow) {
return 3;
} else if (position == settingsRow || position == connectionRow || position == chatRow || position == experimentRow) {
return 4;

View File

@ -86,4 +86,5 @@
<string name="BotToken">Token</string>
<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>
</resources>