Skip to content

Commit

Permalink
reapply 'Clean up pre-Lollipop checks' in reverse
Browse files Browse the repository at this point in the history
The patch is from commit [99104fc](evermind-zz/bnp-testing@99104fc)
'Clean up pre-Lollipop checks'
  • Loading branch information
ShareASmile committed Jun 16, 2024
1 parent 29c130b commit 43e85a8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.text.util.LinkifyCompat;

import org.schabi.newpipe.extractor.InfoItem;
import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
Expand All @@ -27,6 +28,7 @@
import org.schabi.newpipelegacy.util.external_communication.ShareUtils;
import org.schabi.newpipelegacy.util.external_communication.TimestampExtractor;

import java.io.IOException;
import java.util.regex.Matcher;

public class CommentsMiniInfoItemHolder extends InfoItemHolder {
Expand Down Expand Up @@ -114,7 +116,14 @@ public void updateFromItem(final InfoItem infoItem,
streamUrl = item.getUrl();

itemContentView.setLines(COMMENT_DEFAULT_LINES);
commentText = item.getCommentText();
try {
commentText = item.getCommentText().getContent().replace(" ", "")
.replace("<a href=", "").replace("</a>", " ")
.replace("<br>", " ").replace("<b>", " ")
.replace("</br>", " ").replace("</b>", " ");
} catch (Exception e) {
commentText = " ";
}
itemContentView.setText(commentText, TextView.BufferType.SPANNABLE);
itemContentView.setOnTouchListener(CommentTextOnTouchListener.INSTANCE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.provider.Settings;
import android.view.accessibility.CaptioningManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
Expand Down Expand Up @@ -427,8 +428,10 @@ protected void showOrHideButtons() {
public void showSystemUIPartially() {
if (isFullscreen) {
getParentActivity().map(Activity::getWindow).ifPresent(window -> {
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
}
final int visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.schabi.newpipelegacy.streams.io;

import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
Expand Down Expand Up @@ -73,6 +74,7 @@ public StoredFileHelper(@Nullable final Uri parent, final String filename, final
this.tag = tag;
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
StoredFileHelper(@Nullable final Context context, final DocumentFile tree,
final String filename, final String mime, final boolean safe)
throws IOException {
Expand Down Expand Up @@ -122,6 +124,7 @@ public StoredFileHelper(@Nullable final Uri parent, final String filename, final
this.srcType = mime;
}

@TargetApi(Build.VERSION_CODES.KITKAT)
public StoredFileHelper(final Context context, @Nullable final Uri parent,
@NonNull final Uri path, final String tag) throws IOException {
this.tag = tag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public static boolean checkStoragePermissions(final Activity activity, final int
if (NewPipeSettings.useStorageAccessFramework(activity)) {
return true; // Storage permissions are not needed for SAF
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {

if (!checkReadStoragePermissions(activity, requestCode)) {
return false;
}
}
return checkWriteStoragePermissions(activity, requestCode);
}

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public static boolean checkReadStoragePermissions(final Activity activity,
final int requestCode) {
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@
<string name="downloads_storage_ask_title">डोलोड कहाँ करने के लिए पूछे</string>
<string name="downloads_storage_ask_summary">आपको हर डाउनलोड का स्थान पूछा जाएगा</string>
<string name="downloads_storage_use_saf_title">SAF का उपयोग करें</string>
<string name="downloads_storage_use_saf_summary_api_19">'स्टोरेज एक्सेस फ्रेमवर्क' एंड्रॉइड किटकैट और उससे नीचे के संस्करण पर समर्थित नहीं है</string>
<string name="downloads_storage_use_saf_summary_api_29">केवल Android 10 से शुरू होकर \'Storage Access Framework\' समर्थित है</string>
<string name="clear_playback_states_title">प्लेबैक स्थानों को मिटाये</string>
<string name="clear_playback_states_summary">सारे प्लेबैक स्थानों को मिटाये</string>
<string name="delete_playback_states_alert">सारे प्लेबैक स्थानों को मिटाये\?</string>
Expand Down

0 comments on commit 43e85a8

Please sign in to comment.