targetClazz,
@Nullable final PlayQueue playQueue) {
- return getPlayerIntent(context, targetClazz, playQueue)
+ // see comment in `getPlayerEnqueueIntent` as to why `resumePlayback` is false
+ return getPlayerIntent(context, targetClazz, playQueue, false)
.putExtra(Player.ENQUEUE_NEXT, true);
}
@@ -495,6 +506,27 @@ public final class NavigationHelper {
context.startActivity(intent);
}
+ /**
+ * Opens {@link ChannelFragment}.
+ * Use this instead of {@link #openChannelFragment(FragmentManager, int, String, String)}
+ * when no fragments are used / no FragmentManager is available.
+ * @param context
+ * @param serviceId
+ * @param url
+ * @param title
+ */
+ public static void openChannelFragmentUsingIntent(final Context context,
+ final int serviceId,
+ final String url,
+ @NonNull final String title) {
+ final Intent intent = getOpenIntent(context, url, serviceId,
+ StreamingService.LinkType.CHANNEL);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.putExtra(Constants.KEY_TITLE, title);
+
+ context.startActivity(intent);
+ }
+
public static void openMainActivity(final Context context) {
final Intent mIntent = new Intent(context, MainActivity.class);
mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
diff --git a/app/src/main/java/org/schabi/newpipe/util/NewPipeTextViewHelper.java b/app/src/main/java/org/schabi/newpipe/util/NewPipeTextViewHelper.java
new file mode 100644
index 000000000..cf1a9a03a
--- /dev/null
+++ b/app/src/main/java/org/schabi/newpipe/util/NewPipeTextViewHelper.java
@@ -0,0 +1,61 @@
+package org.schabi.newpipe.util;
+
+import android.content.Context;
+import android.text.Selection;
+import android.text.Spannable;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import org.schabi.newpipe.util.external_communication.ShareUtils;
+import org.schabi.newpipe.views.NewPipeEditText;
+import org.schabi.newpipe.views.NewPipeTextView;
+
+public final class NewPipeTextViewHelper {
+ private NewPipeTextViewHelper() {
+ }
+
+ /**
+ * Share the selected text of {@link NewPipeTextView NewPipeTextViews} and
+ * {@link NewPipeEditText NewPipeEditTexts} with
+ * {@link ShareUtils#shareText(Context, String, String)}.
+ *
+ *
+ * This allows EMUI users to get the Android share sheet instead of the EMUI share sheet when
+ * using the {@code Share} command of the popup menu which appears when selecting text.
+ *
+ *
+ * @param textView the {@link TextView} on which sharing the selected text. It should be a
+ * {@link NewPipeTextView} or a {@link NewPipeEditText} (even if
+ * {@link TextView standard TextViews} are supported).
+ */
+ public static void shareSelectedTextWithShareUtils(@NonNull final TextView textView) {
+ final CharSequence textViewText = textView.getText();
+ shareSelectedTextIfNotNullAndNotEmpty(textView, getSelectedText(textView, textViewText));
+ if (textViewText instanceof Spannable) {
+ Selection.setSelection((Spannable) textViewText, textView.getSelectionEnd());
+ }
+ }
+
+ @Nullable
+ private static CharSequence getSelectedText(@NonNull final TextView textView,
+ @Nullable final CharSequence text) {
+ if (!textView.hasSelection() || text == null) {
+ return null;
+ }
+
+ final int start = textView.getSelectionStart();
+ final int end = textView.getSelectionEnd();
+ return String.valueOf(start > end ? text.subSequence(end, start)
+ : text.subSequence(start, end));
+ }
+
+ private static void shareSelectedTextIfNotNullAndNotEmpty(
+ @NonNull final TextView textView,
+ @Nullable final CharSequence selectedText) {
+ if (selectedText != null && selectedText.length() != 0) {
+ ShareUtils.shareText(textView.getContext(), "", selectedText.toString());
+ }
+ }
+}
diff --git a/app/src/main/java/org/schabi/newpipe/views/NewPipeEditText.java b/app/src/main/java/org/schabi/newpipe/views/NewPipeEditText.java
new file mode 100644
index 000000000..2adc28d0e
--- /dev/null
+++ b/app/src/main/java/org/schabi/newpipe/views/NewPipeEditText.java
@@ -0,0 +1,45 @@
+package org.schabi.newpipe.views;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.widget.AppCompatEditText;
+
+import org.schabi.newpipe.util.NewPipeTextViewHelper;
+import org.schabi.newpipe.util.external_communication.ShareUtils;
+
+/**
+ * An {@link AppCompatEditText} which uses {@link ShareUtils#shareText(Context, String, String)}
+ * when sharing selected text by using the {@code Share} command of the floating actions.
+ *
+ * This allows NewPipe to show Android share sheet instead of EMUI share sheet when sharing text
+ * from {@link AppCompatEditText} on EMUI devices.
+ *
+ */
+public class NewPipeEditText extends AppCompatEditText {
+
+ public NewPipeEditText(@NonNull final Context context) {
+ super(context);
+ }
+
+ public NewPipeEditText(@NonNull final Context context, @Nullable final AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public NewPipeEditText(@NonNull final Context context,
+ @Nullable final AttributeSet attrs,
+ final int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ public boolean onTextContextMenuItem(final int id) {
+ if (id == android.R.id.shareText) {
+ NewPipeTextViewHelper.shareSelectedTextWithShareUtils(this);
+ return true;
+ }
+ return super.onTextContextMenuItem(id);
+ }
+}
diff --git a/app/src/main/java/org/schabi/newpipe/views/NewPipeTextView.java b/app/src/main/java/org/schabi/newpipe/views/NewPipeTextView.java
new file mode 100644
index 000000000..8fdac32db
--- /dev/null
+++ b/app/src/main/java/org/schabi/newpipe/views/NewPipeTextView.java
@@ -0,0 +1,45 @@
+package org.schabi.newpipe.views;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.widget.AppCompatTextView;
+
+import org.schabi.newpipe.util.NewPipeTextViewHelper;
+import org.schabi.newpipe.util.external_communication.ShareUtils;
+
+/**
+ * An {@link AppCompatTextView} which uses {@link ShareUtils#shareText(Context, String, String)}
+ * when sharing selected text by using the {@code Share} command of the floating actions.
+ *
+ * This allows NewPipe to show Android share sheet instead of EMUI share sheet when sharing text
+ * from {@link AppCompatTextView} on EMUI devices.
+ *
+ */
+public class NewPipeTextView extends AppCompatTextView {
+
+ public NewPipeTextView(@NonNull final Context context) {
+ super(context);
+ }
+
+ public NewPipeTextView(@NonNull final Context context, @Nullable final AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public NewPipeTextView(@NonNull final Context context,
+ @Nullable final AttributeSet attrs,
+ final int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ public boolean onTextContextMenuItem(final int id) {
+ if (id == android.R.id.shareText) {
+ NewPipeTextViewHelper.shareSelectedTextWithShareUtils(this);
+ return true;
+ }
+ return super.onTextContextMenuItem(id);
+ }
+}
diff --git a/app/src/main/res/layout-land/activity_player_queue_control.xml b/app/src/main/res/layout-land/activity_player_queue_control.xml
index 4b79d92f6..c2359552e 100644
--- a/app/src/main/res/layout-land/activity_player_queue_control.xml
+++ b/app/src/main/res/layout-land/activity_player_queue_control.xml
@@ -60,7 +60,7 @@
android:padding="8dp"
tools:ignore="RtlHardcoded,RtlSymmetry">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -82,7 +82,7 @@
-
-
-
-
-
-
-
-
+ android:layout_above="@+id/playback_controls">
-
+ android:background="?attr/selectableItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:orientation="vertical"
+ android:padding="8dp"
+ tools:ignore="RtlHardcoded,RtlSymmetry">
-
+
+
+
+
+
-
+ android:layout_centerInParent="true"
+ android:background="#c0000000"
+ android:paddingLeft="30dp"
+ android:paddingTop="5dp"
+ android:paddingRight="30dp"
+ android:paddingBottom="5dp"
+ android:textColor="@android:color/white"
+ android:textSize="22sp"
+ android:textStyle="bold"
+ android:visibility="gone"
+ tools:ignore="RtlHardcoded"
+ tools:text="1:06:29"
+ tools:visibility="visible" />
+
+ android:paddingRight="12dp">
-
-
-
+
diff --git a/app/src/main/res/layout/channel_header.xml b/app/src/main/res/layout/channel_header.xml
index aebb5d613..9366faf2c 100644
--- a/app/src/main/res/layout/channel_header.xml
+++ b/app/src/main/res/layout/channel_header.xml
@@ -49,7 +49,7 @@
tools:visibility="visible" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -85,14 +85,14 @@
android:layout_gravity="end"
android:text="@string/give_back" />
-
-
@@ -105,14 +105,14 @@
android:layout_gravity="end"
android:text="@string/open_in_browser" />
-
-
diff --git a/app/src/main/res/layout/fragment_channel.xml b/app/src/main/res/layout/fragment_channel.xml
index 873f3c884..9e2257539 100644
--- a/app/src/main/res/layout/fragment_channel.xml
+++ b/app/src/main/res/layout/fragment_channel.xml
@@ -30,7 +30,7 @@
android:visibility="gone"
tools:visibility="visible">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -->
-
-
-
- -->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ tools:listitem="@layout/select_channel_item" />
-
-
-
+ tools:listitem="@layout/select_kiosk_item" />
diff --git a/app/src/main/res/layout/select_kiosk_item.xml b/app/src/main/res/layout/select_kiosk_item.xml
index 6cd04ae34..680767bba 100644
--- a/app/src/main/res/layout/select_kiosk_item.xml
+++ b/app/src/main/res/layout/select_kiosk_item.xml
@@ -22,7 +22,7 @@
app:tint="@color/contrastColor"
tools:ignore="RtlHardcoded" />
-
-
-
-
diff --git a/app/src/main/res/layout/settings_category_header_title.xml b/app/src/main/res/layout/settings_category_header_title.xml
index 679b9048c..c7d6920b0 100644
--- a/app/src/main/res/layout/settings_category_header_title.xml
+++ b/app/src/main/res/layout/settings_category_header_title.xml
@@ -1,5 +1,5 @@
-
-
-
-
-
-
-
-
-
-
+
diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml
index daf999abf..0f37ff1f0 100644
--- a/app/src/main/res/values/settings_keys.xml
+++ b/app/src/main/res/values/settings_keys.xml
@@ -384,6 +384,7 @@
update_app_key
+ manual_update_key
update_pref_screen_key
update_expiry_key
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 710425217..e67016142 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -538,6 +538,8 @@
Updates
Show a notification to prompt app update when a new version is available
+ Check for updates
+ Manually check for new versions
Minimize on app switch
Action when switching to other app from main video player — %s
@@ -568,6 +570,7 @@
recovering
Queue
Action denied by the system
+ Checking for updates…
Download failed
diff --git a/app/src/main/res/xml/update_settings.xml b/app/src/main/res/xml/update_settings.xml
index adaa47352..ef121ec4e 100644
--- a/app/src/main/res/xml/update_settings.xml
+++ b/app/src/main/res/xml/update_settings.xml
@@ -12,4 +12,11 @@
app:singleLineTitle="false"
app:iconSpaceReserved="false" />
+
+
diff --git a/build.gradle b/build.gradle
index 4617611a8..1bcddd7cc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.5.30'
+ ext.kotlin_version = '1.5.31'
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.0.2'
+ classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
diff --git a/fastlane/metadata/android/en-US/changelogs/979.txt b/fastlane/metadata/android/en-US/changelogs/979.txt
new file mode 100644
index 000000000..520d92993
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/979.txt
@@ -0,0 +1,2 @@
+- Fixed resuming playback
+- Improvements to ensure that the service which determines if NewPipe should check for a new version checks is not started in background
\ No newline at end of file