Skip to content

Redesigned long press menu #12032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: refactor
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4e9f23f
Add Either type with left, right and match functions
Stypox Jan 28, 2025
b72bd63
Start implementing LongPressMenu
Stypox Jan 28, 2025
4861fad
Calculate button placing in long press menu
Stypox Jan 28, 2025
3fe9f7d
Treat decorations better
Stypox Jan 28, 2025
e4664e9
Add buttons to long press menu
Stypox Jan 28, 2025
aa1d5a1
Remove button background and make text 2 lines
Stypox Jan 28, 2025
cbb2590
Add small Edit button in LongPressMenu
Stypox Jan 31, 2025
febc725
Click on long press menu subtitle opens channel details
Stypox Feb 11, 2025
1927b36
Initial work on handling many long-press actions
Stypox Feb 11, 2025
3c60419
Make LongPressable a data class
Stypox Feb 11, 2025
5e7c30c
Move long press menu drag handle to its own composable
Stypox Feb 11, 2025
bd80dad
Improve how long press menu buttons are laid out
Stypox Feb 11, 2025
f415e5d
Dismiss long press menu after click on a button
Stypox Feb 11, 2025
f3f26aa
Add download long press menu action
Stypox Feb 11, 2025
07aa327
Move LongPressable builders to LongPressable class
Stypox Feb 11, 2025
ab3c29c
Replace InfoItemDialog with LongPressMenu
Stypox Feb 12, 2025
ee73f4c
Remove InfoItemDialog
Stypox Feb 12, 2025
62be90b
Slight adjustments to long press menu
Stypox Feb 12, 2025
1571bf5
Add more previews to LongPressMenu
Stypox Feb 13, 2025
0a10537
Use LongPressMenu in BookmarkFragment (wip)
Stypox Feb 14, 2025
3367e78
Tune transparencies of decorations in long press menu
Stypox Feb 14, 2025
78b92f2
Use faded marquee text in long press menu header
Stypox Feb 14, 2025
50fd885
Add long press actions to channels and playlists info items
Stypox Mar 14, 2025
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 @@ -2,6 +2,7 @@

import static org.schabi.newpipe.ktx.ViewUtils.animate;
import static org.schabi.newpipe.ktx.ViewUtils.animateHideRecyclerViewAllowingScrolling;
import static org.schabi.newpipe.ui.components.menu.LongPressMenuKt.openLongPressMenuInActivity;

import android.content.Context;
import android.content.SharedPreferences;
Expand All @@ -27,7 +28,8 @@
import org.schabi.newpipe.fragments.OnScrollBelowItemsListener;
import org.schabi.newpipe.info_list.InfoListAdapter;
import org.schabi.newpipe.info_list.ItemViewMode;
import org.schabi.newpipe.info_list.dialog.InfoItemDialog;
import org.schabi.newpipe.ui.components.menu.LongPressAction;
import org.schabi.newpipe.ui.components.menu.LongPressable;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.OnClickGesture;
import org.schabi.newpipe.util.StateSaver;
Expand Down Expand Up @@ -387,11 +389,11 @@ protected void onScrollToBottom() {
}

protected void showInfoItemDialog(final StreamInfoItem item) {
try {
new InfoItemDialog.Builder(getActivity(), getContext(), this, item).create().show();
} catch (final IllegalArgumentException e) {
InfoItemDialog.Builder.reportErrorDuringInitialization(e, item);
}
openLongPressMenuInActivity(
requireActivity(),
LongPressable.fromStreamInfoItem(item),
LongPressAction.fromStreamInfoItem(item)
);
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import static org.schabi.newpipe.extractor.utils.Utils.isBlank;
import static org.schabi.newpipe.ktx.ViewUtils.animate;
import static org.schabi.newpipe.ktx.ViewUtils.animateHideRecyclerViewAllowingScrolling;
import static org.schabi.newpipe.ui.components.menu.LongPressMenuKt.openLongPressMenuInActivity;
import static org.schabi.newpipe.util.ServiceHelper.getServiceById;

import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
Expand Down Expand Up @@ -42,12 +42,12 @@
import org.schabi.newpipe.extractor.stream.Description;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.info_list.dialog.InfoItemDialog;
import org.schabi.newpipe.info_list.dialog.StreamDialogDefaultEntry;
import org.schabi.newpipe.local.dialog.PlaylistDialog;
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.PlaylistPlayQueue;
import org.schabi.newpipe.ui.components.menu.LongPressAction;
import org.schabi.newpipe.ui.components.menu.LongPressable;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper;
Expand Down Expand Up @@ -150,21 +150,12 @@ private PlayQueue getPlayQueueStartingAt(final StreamInfoItem infoItem) {

@Override
protected void showInfoItemDialog(final StreamInfoItem item) {
final Context context = getContext();
try {
final InfoItemDialog.Builder dialogBuilder =
new InfoItemDialog.Builder(getActivity(), context, this, item);

dialogBuilder
.setAction(
StreamDialogDefaultEntry.START_HERE_ON_BACKGROUND,
(f, infoItem) -> NavigationHelper.playOnBackgroundPlayer(
context, getPlayQueueStartingAt(infoItem), true))
.create()
.show();
} catch (final IllegalArgumentException e) {
InfoItemDialog.Builder.reportErrorDuringInitialization(e, item);
}
openLongPressMenuInActivity(
activity,
LongPressable.fromStreamInfoItem(item),
// TODO handle play queue starting at
LongPressAction.fromStreamInfoItem(item)
);
}

@Override
Expand Down
Loading