mirror of
https://github.com/MaintainTeam/LastPipeBender.git
synced 2025-02-28 21:38:20 +03:00
Merge branch 'dev_newpipe' into dev
# Conflicts: # .github/CONTRIBUTING.md # .github/workflows/ci.yml # README.md
This commit is contained in:
commit
f5c6565db4
16 changed files with 217 additions and 176 deletions
21
.idea/icon.svg
generated
Normal file
21
.idea/icon.svg
generated
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#CD201F;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
</style>
|
||||
<g id="Alapkör">
|
||||
<circle id="XMLID_23_" class="st0" cx="50" cy="50" r="50"/>
|
||||
</g>
|
||||
<g id="Elemek">
|
||||
<path id="XMLID_19_" class="st1" d="M47,28.2c-9-5.3-15.3-9-15.3-9v61.7c0,0,30.4-18,52.3-30.9C72.1,43,57.7,34.5,47,28.2z"/>
|
||||
</g>
|
||||
<g id="Fedő">
|
||||
<path id="XMLID_5_" class="st0" d="M48.4,40.1c-4.1-2.4-7-4.1-7-4.1V64c0,0,13.9-8.2,23.8-14C59.8,46.8,53.3,42.9,48.4,40.1z"/>
|
||||
<rect id="XMLID_4_" x="41.4" y="55.6" class="st0" width="6.2" height="21"/>
|
||||
</g>
|
||||
<g id="Vonalak">
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 850 B |
|
@ -289,7 +289,7 @@ dependencies {
|
|||
implementation "com.jakewharton.rxbinding4:rxbinding:4.0.0"
|
||||
|
||||
// Date and time formatting
|
||||
implementation "org.ocpsoft.prettytime:prettytime:5.0.7.Final"
|
||||
implementation "org.ocpsoft.prettytime:prettytime:5.0.8.Final"
|
||||
|
||||
/** Debugging **/
|
||||
// Memory leak detection
|
||||
|
|
|
@ -367,6 +367,7 @@
|
|||
<data android:host="tilvids.com" />
|
||||
<data android:host="video.lqdn.fr" />
|
||||
<data android:host="video.ploud.fr" />
|
||||
<data android:host="subscribeto.me" />
|
||||
|
||||
<data android:pathPrefix="/videos/" /> <!-- it contains playlists -->
|
||||
<data android:pathPrefix="/w/" /> <!-- short video URLs -->
|
||||
|
|
|
@ -54,7 +54,7 @@ class ErrorUtil {
|
|||
*/
|
||||
@JvmStatic
|
||||
fun showSnackbar(context: Context, errorInfo: ErrorInfo) {
|
||||
val rootView = if (context is Activity) context.findViewById<View>(R.id.content) else null
|
||||
val rootView = (context as? Activity)?.findViewById<View>(android.R.id.content)
|
||||
showSnackbar(context, rootView, errorInfo)
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class ErrorUtil {
|
|||
fun showSnackbar(fragment: Fragment, errorInfo: ErrorInfo) {
|
||||
var rootView = fragment.view
|
||||
if (rootView == null && fragment.activity != null) {
|
||||
rootView = fragment.requireActivity().findViewById(R.id.content)
|
||||
rootView = fragment.requireActivity().findViewById(android.R.id.content)
|
||||
}
|
||||
showSnackbar(fragment.requireContext(), rootView, errorInfo)
|
||||
}
|
||||
|
|
|
@ -245,10 +245,10 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
|||
// change the background and icon color of the tab layout:
|
||||
// service-colored at the top, app-background-colored at the bottom
|
||||
tabLayout.setBackgroundColor(ThemeHelper.resolveColorFromAttr(requireContext(),
|
||||
bottom ? R.attr.colorSecondary : R.attr.colorPrimary));
|
||||
bottom ? android.R.attr.windowBackground : R.attr.colorPrimary));
|
||||
|
||||
@ColorInt final int iconColor = bottom
|
||||
? ThemeHelper.resolveColorFromAttr(requireContext(), R.attr.colorAccent)
|
||||
? ThemeHelper.resolveColorFromAttr(requireContext(), android.R.attr.colorAccent)
|
||||
: Color.WHITE;
|
||||
tabLayout.setTabRippleColor(ColorStateList.valueOf(iconColor).withAlpha(32));
|
||||
tabLayout.setTabIconTint(ColorStateList.valueOf(iconColor));
|
||||
|
|
|
@ -22,6 +22,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.core.view.MenuProvider;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
@ -99,6 +100,7 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
private MenuItem menuRssButton;
|
||||
private MenuItem menuNotifyButton;
|
||||
private SubscriptionEntity channelSubscription;
|
||||
private MenuProvider menuProvider;
|
||||
|
||||
public static ChannelFragment getInstance(final int serviceId, final String url,
|
||||
final String name) {
|
||||
|
@ -121,7 +123,62 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
menuProvider = new MenuProvider() {
|
||||
@Override
|
||||
public void onCreateMenu(@NonNull final Menu menu,
|
||||
@NonNull final MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_channel, menu);
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onCreateOptionsMenu() called with: "
|
||||
+ "menu = [" + menu + "], inflater = [" + inflater + "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareMenu(@NonNull final Menu menu) {
|
||||
menuRssButton = menu.findItem(R.id.menu_item_rss);
|
||||
menuNotifyButton = menu.findItem(R.id.menu_item_notify);
|
||||
updateRssButton();
|
||||
updateNotifyButton(channelSubscription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemSelected(@NonNull final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_item_notify:
|
||||
final boolean value = !item.isChecked();
|
||||
item.setEnabled(false);
|
||||
setNotify(value);
|
||||
break;
|
||||
case R.id.action_settings:
|
||||
NavigationHelper.openSettings(requireContext());
|
||||
break;
|
||||
case R.id.menu_item_rss:
|
||||
if (currentInfo != null) {
|
||||
ShareUtils.openUrlInApp(requireContext(), currentInfo.getFeedUrl());
|
||||
}
|
||||
break;
|
||||
case R.id.menu_item_openInBrowser:
|
||||
if (currentInfo != null) {
|
||||
ShareUtils.openUrlInBrowser(requireContext(),
|
||||
currentInfo.getOriginalUrl());
|
||||
}
|
||||
break;
|
||||
case R.id.menu_item_share:
|
||||
if (currentInfo != null) {
|
||||
ShareUtils.shareText(requireContext(), name,
|
||||
currentInfo.getOriginalUrl(), currentInfo.getAvatars());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
activity.addMenuProvider(menuProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -183,67 +240,10 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
}
|
||||
disposables.clear();
|
||||
binding = null;
|
||||
activity.removeMenuProvider(menuProvider);
|
||||
menuProvider = null;
|
||||
}
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Menu
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull final Menu menu,
|
||||
@NonNull final MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_channel, menu);
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onCreateOptionsMenu() called with: "
|
||||
+ "menu = [" + menu + "], inflater = [" + inflater + "]");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(@NonNull final Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
menuRssButton = menu.findItem(R.id.menu_item_rss);
|
||||
menuNotifyButton = menu.findItem(R.id.menu_item_notify);
|
||||
updateNotifyButton(channelSubscription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_item_notify:
|
||||
final boolean value = !item.isChecked();
|
||||
item.setEnabled(false);
|
||||
setNotify(value);
|
||||
break;
|
||||
case R.id.action_settings:
|
||||
NavigationHelper.openSettings(requireContext());
|
||||
break;
|
||||
case R.id.menu_item_rss:
|
||||
if (currentInfo != null) {
|
||||
ShareUtils.openUrlInApp(requireContext(), currentInfo.getFeedUrl());
|
||||
}
|
||||
break;
|
||||
case R.id.menu_item_openInBrowser:
|
||||
if (currentInfo != null) {
|
||||
ShareUtils.openUrlInBrowser(requireContext(), currentInfo.getOriginalUrl());
|
||||
}
|
||||
break;
|
||||
case R.id.menu_item_share:
|
||||
if (currentInfo != null) {
|
||||
ShareUtils.shareText(requireContext(), name, currentInfo.getOriginalUrl(),
|
||||
currentInfo.getAvatars());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Channel Subscription
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
@ -408,6 +408,13 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
animate(binding.channelSubscribeButton, true, 100, AnimationType.LIGHT_SCALE_AND_ALPHA);
|
||||
}
|
||||
|
||||
private void updateRssButton() {
|
||||
if (menuRssButton == null || currentInfo == null) {
|
||||
return;
|
||||
}
|
||||
menuRssButton.setVisible(!TextUtils.isEmpty(currentInfo.getFeedUrl()));
|
||||
}
|
||||
|
||||
private void updateNotifyButton(@Nullable final SubscriptionEntity subscription) {
|
||||
if (menuNotifyButton == null) {
|
||||
return;
|
||||
|
@ -610,9 +617,7 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
binding.subChannelAvatarView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (menuRssButton != null) {
|
||||
menuRssButton.setVisible(!TextUtils.isEmpty(result.getFeedUrl()));
|
||||
}
|
||||
updateRssButton();
|
||||
|
||||
channelContentNotSupported = false;
|
||||
for (final Throwable throwable : result.getErrors()) {
|
||||
|
|
|
@ -356,6 +356,7 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
|||
});
|
||||
ellipsizer.setContent(description);
|
||||
headerBinding.playlistDescriptionReadMore.setOnClickListener(v -> ellipsizer.toggle());
|
||||
headerBinding.playlistDescription.setOnClickListener(v -> ellipsizer.toggle());
|
||||
} else {
|
||||
headerBinding.playlistDescription.setVisibility(View.GONE);
|
||||
headerBinding.playlistDescriptionReadMore.setVisibility(View.GONE);
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package org.schabi.newpipe.info_list.holder;
|
||||
|
||||
import static org.schabi.newpipe.util.ServiceHelper.getServiceById;
|
||||
import static org.schabi.newpipe.util.text.TouchUtils.getOffsetForHorizontalLine;
|
||||
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
@ -25,7 +29,6 @@ import org.schabi.newpipe.util.NavigationHelper;
|
|||
import org.schabi.newpipe.util.external_communication.ShareUtils;
|
||||
import org.schabi.newpipe.util.image.ImageStrategy;
|
||||
import org.schabi.newpipe.util.image.PicassoHelper;
|
||||
import org.schabi.newpipe.util.text.CommentTextOnTouchListener;
|
||||
import org.schabi.newpipe.util.text.TextEllipsizer;
|
||||
|
||||
public class CommentInfoItemHolder extends InfoItemHolder {
|
||||
|
@ -128,7 +131,26 @@ public class CommentInfoItemHolder extends InfoItemHolder {
|
|||
textEllipsizer.ellipsize();
|
||||
|
||||
//noinspection ClickableViewAccessibility
|
||||
itemContentView.setOnTouchListener(CommentTextOnTouchListener.INSTANCE);
|
||||
itemContentView.setOnTouchListener((v, event) -> {
|
||||
final CharSequence text = itemContentView.getText();
|
||||
if (text instanceof Spanned buffer) {
|
||||
final int action = event.getAction();
|
||||
|
||||
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_DOWN) {
|
||||
final int offset = getOffsetForHorizontalLine(itemContentView, event);
|
||||
final var links = buffer.getSpans(offset, offset, ClickableSpan.class);
|
||||
|
||||
if (links.length != 0) {
|
||||
if (action == MotionEvent.ACTION_UP) {
|
||||
links[0].onClick(itemContentView);
|
||||
}
|
||||
// we handle events that intersect links, so return true
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
itemView.setOnClickListener(view -> {
|
||||
textEllipsizer.toggle();
|
||||
|
|
|
@ -549,7 +549,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
|
|||
|
||||
var typeface = Typeface.DEFAULT
|
||||
var backgroundSupplier = { ctx: Context ->
|
||||
resolveDrawable(ctx, R.attr.selectableItemBackground)
|
||||
resolveDrawable(ctx, android.R.attr.selectableItemBackground)
|
||||
}
|
||||
if (doCheck) {
|
||||
// If the uploadDate is null or true we should highlight the item
|
||||
|
@ -562,7 +562,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
|
|||
LayerDrawable(
|
||||
arrayOf(
|
||||
resolveDrawable(ctx, R.attr.dashed_border),
|
||||
resolveDrawable(ctx, R.attr.selectableItemBackground)
|
||||
resolveDrawable(ctx, android.R.attr.selectableItemBackground)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -573,16 +573,16 @@ public final class PlayQueueActivity extends AppCompatActivity
|
|||
private void onPlayModeChanged(final int repeatMode, final boolean shuffled) {
|
||||
switch (repeatMode) {
|
||||
case com.google.android.exoplayer2.Player.REPEAT_MODE_OFF:
|
||||
queueControlBinding.controlRepeat
|
||||
.setImageResource(R.drawable.exo_controls_repeat_off);
|
||||
queueControlBinding.controlRepeat.setImageResource(
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_off);
|
||||
break;
|
||||
case com.google.android.exoplayer2.Player.REPEAT_MODE_ONE:
|
||||
queueControlBinding.controlRepeat
|
||||
.setImageResource(R.drawable.exo_controls_repeat_one);
|
||||
queueControlBinding.controlRepeat.setImageResource(
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_one);
|
||||
break;
|
||||
case com.google.android.exoplayer2.Player.REPEAT_MODE_ALL:
|
||||
queueControlBinding.controlRepeat
|
||||
.setImageResource(R.drawable.exo_controls_repeat_all);
|
||||
queueControlBinding.controlRepeat.setImageResource(
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_all);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -342,14 +342,14 @@ public class PlaybackParameterDialog extends DialogFragment {
|
|||
final Map<Boolean, TextView> pitchCtrlModeComponentMapping =
|
||||
getPitchControlModeComponentMappings();
|
||||
pitchCtrlModeComponentMapping.forEach((v, textView) -> textView.setBackground(
|
||||
resolveDrawable(requireContext(), R.attr.selectableItemBackground)));
|
||||
resolveDrawable(requireContext(), android.R.attr.selectableItemBackground)));
|
||||
|
||||
// Mark the selected textview
|
||||
final TextView textView = pitchCtrlModeComponentMapping.get(semitones);
|
||||
if (textView != null) {
|
||||
textView.setBackground(new LayerDrawable(new Drawable[]{
|
||||
resolveDrawable(requireContext(), R.attr.dashed_border),
|
||||
resolveDrawable(requireContext(), R.attr.selectableItemBackground)
|
||||
resolveDrawable(requireContext(), android.R.attr.selectableItemBackground)
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -415,14 +415,14 @@ public class PlaybackParameterDialog extends DialogFragment {
|
|||
// Bring all textviews into a normal state
|
||||
final Map<Double, TextView> stepSiteComponentMapping = getStepSizeComponentMappings();
|
||||
stepSiteComponentMapping.forEach((v, textView) -> textView.setBackground(
|
||||
resolveDrawable(requireContext(), R.attr.selectableItemBackground)));
|
||||
resolveDrawable(requireContext(), android.R.attr.selectableItemBackground)));
|
||||
|
||||
// Mark the selected textview
|
||||
final TextView textView = stepSiteComponentMapping.get(newStepSize);
|
||||
if (textView != null) {
|
||||
textView.setBackground(new LayerDrawable(new Drawable[]{
|
||||
resolveDrawable(requireContext(), R.attr.dashed_border),
|
||||
resolveDrawable(requireContext(), R.attr.selectableItemBackground)
|
||||
resolveDrawable(requireContext(), android.R.attr.selectableItemBackground)
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -69,41 +69,48 @@ public final class NotificationActionData {
|
|||
switch (selectedAction) {
|
||||
case NotificationConstants.PREVIOUS:
|
||||
return new NotificationActionData(ACTION_PLAY_PREVIOUS,
|
||||
ctx.getString(R.string.exo_controls_previous_description), baseActionIcon);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_previous_description), baseActionIcon);
|
||||
|
||||
case NotificationConstants.NEXT:
|
||||
return new NotificationActionData(ACTION_PLAY_NEXT,
|
||||
ctx.getString(R.string.exo_controls_next_description), baseActionIcon);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_next_description), baseActionIcon);
|
||||
|
||||
case NotificationConstants.REWIND:
|
||||
return new NotificationActionData(ACTION_FAST_REWIND,
|
||||
ctx.getString(R.string.exo_controls_rewind_description), baseActionIcon);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_rewind_description), baseActionIcon);
|
||||
|
||||
case NotificationConstants.FORWARD:
|
||||
return new NotificationActionData(ACTION_FAST_FORWARD,
|
||||
ctx.getString(R.string.exo_controls_fastforward_description),
|
||||
baseActionIcon);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_fastforward_description), baseActionIcon);
|
||||
|
||||
case NotificationConstants.SMART_REWIND_PREVIOUS:
|
||||
if (player.getPlayQueue() != null && player.getPlayQueue().size() > 1) {
|
||||
return new NotificationActionData(ACTION_PLAY_PREVIOUS,
|
||||
ctx.getString(R.string.exo_controls_previous_description),
|
||||
R.drawable.exo_notification_previous);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_previous_description),
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_notification_previous);
|
||||
} else {
|
||||
return new NotificationActionData(ACTION_FAST_REWIND,
|
||||
ctx.getString(R.string.exo_controls_rewind_description),
|
||||
R.drawable.exo_controls_rewind);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_rewind_description),
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_rewind);
|
||||
}
|
||||
|
||||
case NotificationConstants.SMART_FORWARD_NEXT:
|
||||
if (player.getPlayQueue() != null && player.getPlayQueue().size() > 1) {
|
||||
return new NotificationActionData(ACTION_PLAY_NEXT,
|
||||
ctx.getString(R.string.exo_controls_next_description),
|
||||
R.drawable.exo_notification_next);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_next_description),
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_notification_next);
|
||||
} else {
|
||||
return new NotificationActionData(ACTION_FAST_FORWARD,
|
||||
ctx.getString(R.string.exo_controls_fastforward_description),
|
||||
R.drawable.exo_controls_fastforward);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_fastforward_description),
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_fastforward);
|
||||
}
|
||||
|
||||
case NotificationConstants.PLAY_PAUSE_BUFFERING:
|
||||
|
@ -119,45 +126,56 @@ public final class NotificationActionData {
|
|||
case NotificationConstants.PLAY_PAUSE:
|
||||
if (player.getCurrentState() == Player.STATE_COMPLETED) {
|
||||
return new NotificationActionData(ACTION_PLAY_PAUSE,
|
||||
ctx.getString(R.string.exo_controls_pause_description),
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_pause_description),
|
||||
R.drawable.ic_replay);
|
||||
} else if (player.isPlaying()
|
||||
|| player.getCurrentState() == Player.STATE_PREFLIGHT
|
||||
|| player.getCurrentState() == Player.STATE_BLOCKED
|
||||
|| player.getCurrentState() == Player.STATE_BUFFERING) {
|
||||
return new NotificationActionData(ACTION_PLAY_PAUSE,
|
||||
ctx.getString(R.string.exo_controls_pause_description),
|
||||
R.drawable.exo_notification_pause);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_pause_description),
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_notification_pause);
|
||||
} else {
|
||||
return new NotificationActionData(ACTION_PLAY_PAUSE,
|
||||
ctx.getString(R.string.exo_controls_play_description),
|
||||
R.drawable.exo_notification_play);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_play_description),
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_notification_play);
|
||||
}
|
||||
|
||||
case NotificationConstants.REPEAT:
|
||||
if (player.getRepeatMode() == REPEAT_MODE_ALL) {
|
||||
return new NotificationActionData(ACTION_REPEAT,
|
||||
ctx.getString(R.string.exo_controls_repeat_all_description),
|
||||
R.drawable.exo_media_action_repeat_all);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_repeat_all_description),
|
||||
com.google.android.exoplayer2.ext.mediasession.R.drawable
|
||||
.exo_media_action_repeat_all);
|
||||
} else if (player.getRepeatMode() == REPEAT_MODE_ONE) {
|
||||
return new NotificationActionData(ACTION_REPEAT,
|
||||
ctx.getString(R.string.exo_controls_repeat_one_description),
|
||||
R.drawable.exo_media_action_repeat_one);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_repeat_one_description),
|
||||
com.google.android.exoplayer2.ext.mediasession.R.drawable
|
||||
.exo_media_action_repeat_one);
|
||||
} else /* player.getRepeatMode() == REPEAT_MODE_OFF */ {
|
||||
return new NotificationActionData(ACTION_REPEAT,
|
||||
ctx.getString(R.string.exo_controls_repeat_off_description),
|
||||
R.drawable.exo_media_action_repeat_off);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_repeat_off_description),
|
||||
com.google.android.exoplayer2.ext.mediasession.R.drawable
|
||||
.exo_media_action_repeat_off);
|
||||
}
|
||||
|
||||
case NotificationConstants.SHUFFLE:
|
||||
if (player.getPlayQueue() != null && player.getPlayQueue().isShuffled()) {
|
||||
return new NotificationActionData(ACTION_SHUFFLE,
|
||||
ctx.getString(R.string.exo_controls_shuffle_on_description),
|
||||
R.drawable.exo_controls_shuffle_on);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_shuffle_on_description),
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_shuffle_on);
|
||||
} else {
|
||||
return new NotificationActionData(ACTION_SHUFFLE,
|
||||
ctx.getString(R.string.exo_controls_shuffle_off_description),
|
||||
R.drawable.exo_controls_shuffle_off);
|
||||
ctx.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_shuffle_off_description),
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_shuffle_off);
|
||||
}
|
||||
|
||||
case NotificationConstants.CLOSE:
|
||||
|
|
|
@ -78,16 +78,16 @@ public final class NotificationConstants {
|
|||
@DrawableRes
|
||||
public static final int[] ACTION_ICONS = {
|
||||
0,
|
||||
R.drawable.exo_icon_previous,
|
||||
R.drawable.exo_icon_next,
|
||||
R.drawable.exo_icon_rewind,
|
||||
R.drawable.exo_icon_fastforward,
|
||||
R.drawable.exo_icon_previous,
|
||||
R.drawable.exo_icon_next,
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_icon_previous,
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_icon_next,
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_icon_rewind,
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_icon_fastforward,
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_icon_previous,
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_icon_next,
|
||||
R.drawable.ic_pause,
|
||||
R.drawable.ic_hourglass_top,
|
||||
R.drawable.exo_icon_repeat_all,
|
||||
R.drawable.exo_icon_shuffle_on,
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_icon_repeat_all,
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_icon_shuffle_on,
|
||||
R.drawable.ic_close,
|
||||
};
|
||||
|
||||
|
@ -122,29 +122,41 @@ public final class NotificationConstants {
|
|||
public static String getActionName(@NonNull final Context context, @Action final int action) {
|
||||
switch (action) {
|
||||
case PREVIOUS:
|
||||
return context.getString(R.string.exo_controls_previous_description);
|
||||
return context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_previous_description);
|
||||
case NEXT:
|
||||
return context.getString(R.string.exo_controls_next_description);
|
||||
return context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_next_description);
|
||||
case REWIND:
|
||||
return context.getString(R.string.exo_controls_rewind_description);
|
||||
return context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_rewind_description);
|
||||
case FORWARD:
|
||||
return context.getString(R.string.exo_controls_fastforward_description);
|
||||
return context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_fastforward_description);
|
||||
case SMART_REWIND_PREVIOUS:
|
||||
return Localization.concatenateStrings(
|
||||
context.getString(R.string.exo_controls_rewind_description),
|
||||
context.getString(R.string.exo_controls_previous_description));
|
||||
context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_rewind_description),
|
||||
context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_previous_description));
|
||||
case SMART_FORWARD_NEXT:
|
||||
return Localization.concatenateStrings(
|
||||
context.getString(R.string.exo_controls_fastforward_description),
|
||||
context.getString(R.string.exo_controls_next_description));
|
||||
context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_fastforward_description),
|
||||
context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_next_description));
|
||||
case PLAY_PAUSE:
|
||||
return Localization.concatenateStrings(
|
||||
context.getString(R.string.exo_controls_play_description),
|
||||
context.getString(R.string.exo_controls_pause_description));
|
||||
context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_play_description),
|
||||
context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_pause_description));
|
||||
case PLAY_PAUSE_BUFFERING:
|
||||
return Localization.concatenateStrings(
|
||||
context.getString(R.string.exo_controls_play_description),
|
||||
context.getString(R.string.exo_controls_pause_description),
|
||||
context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_play_description),
|
||||
context.getString(com.google.android.exoplayer2.ui.R.string
|
||||
.exo_controls_pause_description),
|
||||
context.getString(R.string.notification_action_buffering));
|
||||
case REPEAT:
|
||||
return context.getString(R.string.notification_action_repeat);
|
||||
|
|
|
@ -991,11 +991,14 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
|
|||
super.onRepeatModeChanged(repeatMode);
|
||||
|
||||
if (repeatMode == REPEAT_MODE_ALL) {
|
||||
binding.repeatButton.setImageResource(R.drawable.exo_controls_repeat_all);
|
||||
binding.repeatButton.setImageResource(
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_all);
|
||||
} else if (repeatMode == REPEAT_MODE_ONE) {
|
||||
binding.repeatButton.setImageResource(R.drawable.exo_controls_repeat_one);
|
||||
binding.repeatButton.setImageResource(
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_one);
|
||||
} else /* repeatMode == REPEAT_MODE_OFF */ {
|
||||
binding.repeatButton.setImageResource(R.drawable.exo_controls_repeat_off);
|
||||
binding.repeatButton.setImageResource(
|
||||
com.google.android.exoplayer2.ui.R.drawable.exo_controls_repeat_off);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
package org.schabi.newpipe.util.text;
|
||||
|
||||
import static org.schabi.newpipe.util.text.TouchUtils.getOffsetForHorizontalLine;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class CommentTextOnTouchListener implements View.OnTouchListener {
|
||||
public static final CommentTextOnTouchListener INSTANCE = new CommentTextOnTouchListener();
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouch(final View v, final MotionEvent event) {
|
||||
if (!(v instanceof TextView)) {
|
||||
return false;
|
||||
}
|
||||
final TextView widget = (TextView) v;
|
||||
final CharSequence text = widget.getText();
|
||||
if (text instanceof Spanned) {
|
||||
final Spanned buffer = (Spanned) text;
|
||||
final int action = event.getAction();
|
||||
|
||||
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_DOWN) {
|
||||
final int offset = getOffsetForHorizontalLine(widget, event);
|
||||
final ClickableSpan[] links = buffer.getSpans(offset, offset, ClickableSpan.class);
|
||||
|
||||
if (links.length != 0) {
|
||||
if (action == MotionEvent.ACTION_UP) {
|
||||
links[0].onClick(widget);
|
||||
}
|
||||
// we handle events that intersect links, so return true
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.enableJetifier=false
|
||||
android.nonFinalResIds=false
|
||||
android.nonTransitiveRClass=false
|
||||
android.nonTransitiveRClass=true
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx2048M --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
|
||||
systemProp.file.encoding=utf-8
|
||||
|
|
Loading…
Add table
Reference in a new issue