mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-02-02 12:19:16 +00:00
Use custom EmptyStateSpec for bookmark fragment
This commit is contained in:
parent
1cd5563b27
commit
55e4014036
@ -38,6 +38,7 @@ import org.schabi.newpipe.local.holder.LocalBookmarkPlaylistItemHolder;
|
|||||||
import org.schabi.newpipe.local.holder.RemoteBookmarkPlaylistItemHolder;
|
import org.schabi.newpipe.local.holder.RemoteBookmarkPlaylistItemHolder;
|
||||||
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
|
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
|
||||||
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
|
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
|
||||||
|
import org.schabi.newpipe.ui.emptystate.EmptyStateSpec;
|
||||||
import org.schabi.newpipe.ui.emptystate.EmptyStateUtil;
|
import org.schabi.newpipe.ui.emptystate.EmptyStateUtil;
|
||||||
import org.schabi.newpipe.util.NavigationHelper;
|
import org.schabi.newpipe.util.NavigationHelper;
|
||||||
import org.schabi.newpipe.util.OnClickGesture;
|
import org.schabi.newpipe.util.OnClickGesture;
|
||||||
@ -124,7 +125,10 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
|
|||||||
super.initViews(rootView, savedInstanceState);
|
super.initViews(rootView, savedInstanceState);
|
||||||
|
|
||||||
itemListAdapter.setUseItemHandle(true);
|
itemListAdapter.setUseItemHandle(true);
|
||||||
EmptyStateUtil.setEmptyStateComposable(rootView.findViewById(R.id.empty_state_view));
|
EmptyStateUtil.setEmptyStateComposable(
|
||||||
|
rootView.findViewById(R.id.empty_state_view),
|
||||||
|
EmptyStateSpec.Companion.getNoBookmarkedPlaylist()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,6 +28,7 @@ import org.schabi.newpipe.error.ErrorUtil;
|
|||||||
import org.schabi.newpipe.error.UserAction;
|
import org.schabi.newpipe.error.UserAction;
|
||||||
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
|
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
|
||||||
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
|
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
|
||||||
|
import org.schabi.newpipe.ui.emptystate.EmptyStateSpec;
|
||||||
import org.schabi.newpipe.ui.emptystate.EmptyStateUtil;
|
import org.schabi.newpipe.ui.emptystate.EmptyStateUtil;
|
||||||
import org.schabi.newpipe.util.image.CoilHelper;
|
import org.schabi.newpipe.util.image.CoilHelper;
|
||||||
|
|
||||||
@ -64,7 +65,8 @@ public class SelectPlaylistFragment extends DialogFragment {
|
|||||||
recyclerView = v.findViewById(R.id.items_list);
|
recyclerView = v.findViewById(R.id.items_list);
|
||||||
emptyView = v.findViewById(R.id.empty_state_view);
|
emptyView = v.findViewById(R.id.empty_state_view);
|
||||||
|
|
||||||
EmptyStateUtil.setEmptyStateText(emptyView, R.string.no_playlist_bookmarked_yet);
|
EmptyStateUtil.setEmptyStateComposable(emptyView,
|
||||||
|
EmptyStateSpec.Companion.getNoBookmarkedPlaylist());
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
final SelectPlaylistAdapter playlistAdapter = new SelectPlaylistAdapter();
|
final SelectPlaylistAdapter playlistAdapter = new SelectPlaylistAdapter();
|
||||||
recyclerView.setAdapter(playlistAdapter);
|
recyclerView.setAdapter(playlistAdapter);
|
||||||
|
@ -113,5 +113,12 @@ data class EmptyStateSpec(
|
|||||||
emojiText = { "(︶︹︺)" },
|
emojiText = { "(︶︹︺)" },
|
||||||
descriptionText = { stringResource(id = R.string.content_not_supported) },
|
descriptionText = { stringResource(id = R.string.content_not_supported) },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val NoBookmarkedPlaylist =
|
||||||
|
EmptyStateSpec(
|
||||||
|
modifier = { it },
|
||||||
|
emojiText = { "(╥﹏╥)" },
|
||||||
|
descriptionText = { stringResource(id = R.string.no_playlist_bookmarked_yet) },
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
package org.schabi.newpipe.ui.emptystate
|
package org.schabi.newpipe.ui.emptystate
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.ui.platform.ComposeView
|
import androidx.compose.ui.platform.ComposeView
|
||||||
@ -12,21 +11,6 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import org.schabi.newpipe.ui.theme.AppTheme
|
import org.schabi.newpipe.ui.theme.AppTheme
|
||||||
import androidx.compose.runtime.mutableStateOf as composeRuntimeMutableStateOf
|
import androidx.compose.runtime.mutableStateOf as composeRuntimeMutableStateOf
|
||||||
|
|
||||||
@JvmOverloads
|
|
||||||
fun ComposeView.setEmptyStateText(
|
|
||||||
@StringRes stringRes: Int,
|
|
||||||
strategy: ViewCompositionStrategy = ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed,
|
|
||||||
) = apply {
|
|
||||||
setViewCompositionStrategy(strategy)
|
|
||||||
setContent {
|
|
||||||
AppTheme {
|
|
||||||
Text(
|
|
||||||
text = stringResource(id = stringRes),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun ComposeView.setEmptyStateComposable(
|
fun ComposeView.setEmptyStateComposable(
|
||||||
spec: EmptyStateSpec = EmptyStateSpec.GenericError,
|
spec: EmptyStateSpec = EmptyStateSpec.GenericError,
|
||||||
|
Loading…
Reference in New Issue
Block a user