Skip to content

Commit

Permalink
Add app shortcut (videos)
Browse files Browse the repository at this point in the history
  • Loading branch information
moneytoo committed Oct 10, 2021
1 parent d777143 commit a33fb0b
Show file tree
Hide file tree
Showing 30 changed files with 77 additions and 17 deletions.
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\.WEBM" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\.WEBM" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<activity
android:name=".MediaStoreChooserActivity"
Expand Down
24 changes: 8 additions & 16 deletions app/src/main/java/com/brouken/player/PlayerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.LocaleList;
import android.provider.DocumentsContract;
import android.provider.Settings;
Expand Down Expand Up @@ -191,17 +190,20 @@ protected void onCreate(Bundle savedInstanceState) {

isTvBox = Utils.isTvBox(this);

if (getIntent().getData() != null) {
Intent intent = getIntent();
final Intent launchIntent = getIntent();
final String action = launchIntent.getAction();

Bundle bundle = intent.getExtras();
if ("com.brouken.player.action.SHORTCUT_VIDEOS".equals(action)) {
openFile(Utils.getMoviesFolderUri());
} else if (launchIntent.getData() != null) {
Bundle bundle = launchIntent.getExtras();
if (bundle != null) {
apiAccess = bundle.containsKey(API_POSITION) || bundle.containsKey(API_RETURN_RESULT);
if (apiAccess)
mPrefs.setPersistent(false);
}

mPrefs.updateMedia(this, intent.getData(), intent.getType());
mPrefs.updateMedia(this, launchIntent.getData(), launchIntent.getType());
searchSubtitles();
focusPlay = true;

Expand Down Expand Up @@ -1273,17 +1275,7 @@ private void loadSubtitleFile(Uri pickerInitialUri) {

private void requestDirectoryAccess() {
enableRotation();

Uri initialUri = null;

if (Build.VERSION.SDK_INT >= 26) {
final String authority = "com.android.externalstorage.documents";
final String documentId = "primary:" + Environment.DIRECTORY_MOVIES;
initialUri = DocumentsContract.buildDocumentUri(authority, documentId);
}

final Intent intent = createBaseFileIntent(Intent.ACTION_OPEN_DOCUMENT_TREE, initialUri);

final Intent intent = createBaseFileIntent(Intent.ACTION_OPEN_DOCUMENT_TREE, Utils.getMoviesFolderUri());
safelyStartActivityForResult(intent, REQUEST_CHOOSER_SCOPE_DIR);
}

Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/com/brouken/player/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,4 +555,14 @@ public void onCancel(DialogInterface dialog) {
public static boolean isPiPSupported(Context context) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE);
}

public static Uri getMoviesFolderUri() {
Uri uri = null;
if (Build.VERSION.SDK_INT >= 26) {
final String authority = "com.android.externalstorage.documents";
final String documentId = "primary:" + Environment.DIRECTORY_MOVIES;
uri = DocumentsContract.buildDocumentUri(authority, documentId);
}
return uri;
}
}
15 changes: 15 additions & 0 deletions app/src/main/res/drawable/shortcut_videos_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#747474">
<group android:scaleX="1.7226"
android:scaleY="1.7226"
android:translateX="33.3288"
android:translateY="33.3288">
<path
android:fillColor="@android:color/white"
android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM12,14.5v-9l6,4.5 -6,4.5z"/>
</group>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/mipmap-anydpi-v26/shortcut_videos.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/shortcut_background"/>
<foreground android:drawable="@drawable/shortcut_videos_foreground"/>
</adaptive-icon>
1 change: 1 addition & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<string name="open_subtitles">تحميل الترجمات</string>
<string name="onboarding_open_description">انقر لفتح ملف فيديو. اضغط ضغطة مطوّلة لتحميل الترجمات الخارجية.</string>
<string name="onboarding_open_title">اختر مقطع فيديو لتشغيله</string>
<string name="shortcut_videos">الفيديوهات</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
<string name="pref_skip_silence_off">Přehrávat obsah tak, jak je</string>
<string name="pref_repeat_toggle">Přepínač opakování</string>
<string name="pref_repeat_toggle_summary">Extra tlačítko na nekonečné přehrávání videa dokola (vyžaduje restart aplikace)</string>
<string name="shortcut_videos">Videa</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
<string name="pref_title">Einstellungen</string>
<string name="pref_repeat_toggle">Wiederholung umschalten</string>
<string name="pref_repeat_toggle_summary">Zusätzliches Steuerelement, um Videoschleifen auf unbestimmte Zeit zu ermöglichen (erfordert einen Neustart der Anwendung)</string>
<string name="shortcut_videos">Videos</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
<string name="pref_title">Ρυθμίσεις</string>
<string name="pref_repeat_toggle">Εναλλαγή επανάληψης</string>
<string name="pref_repeat_toggle_summary">Πρόσθετος έλεγχος για να επιτρέπεται επ\' αόριστον η επανάληψη βίντεο (απαιτεί επανεκκίνηση της εφαρμογής)</string>
<string name="shortcut_videos">Βίντεο</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<string name="pref_tunneling">Reproducción en túnel</string>
<string name="pref_framerate_matching_off">No cambiar la frecuencia de actualización de la pantalla</string>
<string name="pref_framerate_matching_on">Cambia la frecuencia de actualización de la pantalla para que coincida con la frecuencia de fotogramas del video</string>
<string name="shortcut_videos">Vídeos</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
<string name="pref_title">Paramètres</string>
<string name="pref_repeat_toggle_summary">Commande supplémentaire pour permettre de jouer la vidéo en boucle indéfiniment (nécessite le redémarrage de l\'application)</string>
<string name="pref_repeat_toggle">Activer/désactiver la répétition</string>
<string name="shortcut_videos">Vidéos</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-hr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<string name="pref_auto_pip">Automatska slika u slici</string>
<string name="pref_general_header">Opće</string>
<string name="pref_title">Postavke</string>
<string name="shortcut_videos">Videozapisi</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
<string name="onboarding_open_description">Koppintson egyszer videófájl megnyitásához. Tartsa nyomva feliratok megnyitásához.</string>
<string name="onboarding_open_title">Válasszon egy videót a lejátszáshoz</string>
<string name="video_orientation_video">Videó tájolása</string>
<string name="shortcut_videos">Videók</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<string name="pref_framerate_matching">Pencocokan frame rate otomatis</string>
<string name="pref_general_header">Umum</string>
<string name="pref_title">Pengaturan</string>
<string name="shortcut_videos">Video</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
<string name="pref_title">Impostazioni</string>
<string name="pref_repeat_toggle">Attiva/diattiva la ripetizione</string>
<string name="pref_repeat_toggle_summary">Controllo aggiuntivo per permettere di riprodurre il video indefinitamente (richiede il riavvio dell\'app)</string>
<string name="shortcut_videos">Video</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
<string name="video_orientation_video">映像の向き</string>
<string name="video_resize_fit">画面に丁度収める</string>
<string name="video_resize_crop">切り抜く</string>
<string name="shortcut_videos">動画</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-nb-rNO/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<string name="delete_confirmation">Slett</string>
<string name="delete_query">Slett denne filen\?</string>
<string name="pref_skip_silence_on">Hoppe over deler med stillhet på audio stream</string>
<string name="shortcut_videos">Videoer</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
<string name="video_orientation_sensor">Obrót automatyczny</string>
<string name="onboarding_open_title">Wybierz wideo do odtworzenia</string>
<string name="error_files_missing">Aplikacja Pliki jest wyłączona lub jej brakuje</string>
<string name="shortcut_videos">Filmy</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
<string name="request_scope">Para carregar automaticamente legendas externas ou permitir saltar para o próximo arquivo em um diretório, conceda a %s acesso à pasta mais alta que contém seus vídeos (por exemplo: Filmes).</string>
<string name="delete_confirmation">Apagar</string>
<string name="delete_query">Apagar este arquivo\?</string>
<string name="shortcut_videos">Vídeos</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
<string name="pref_title">Definições</string>
<string name="pref_repeat_toggle">Repetição</string>
<string name="pref_repeat_toggle_summary">Controlo extra para permitir a repetição infinita do vídeo (tem que reiniciar)</string>
<string name="shortcut_videos">Vídeos</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<string name="pref_framerate_matching">Автоматическое согласование частоты кадров</string>
<string name="pref_general_header">Общие</string>
<string name="pref_title">Настройки</string>
<string name="shortcut_videos">Видео</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-sr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
<string name="video_orientation_video">Video orijentacija</string>
<string name="video_resize_crop">Iseci</string>
<string name="video_resize_fit">Uklopi</string>
<string name="shortcut_videos">Видео снимци</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-th/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
<string name="delete_confirmation">ลบ</string>
<string name="delete_query">ลบไฟล์นี้ \?</string>
<string name="request_scope">ในการโหลดคำบรรยายภายนอกโดยอัตโนมัติ หรือ เปิดใช้งานการข้ามไปยังไฟล์ถัดไปในไดเร็กทอรี ให้ %s เข้าถึงโฟลเดอร์นอกสุดที่มีวิดีโอของคุณ (เช่น ภาพยนตร์)</string>
<string name="shortcut_videos">วิดีโอ</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<string name="pref_framerate_matching">Otomatik kare hızı eşleştirme</string>
<string name="pref_general_header">Genel</string>
<string name="pref_title">Ayarlar</string>
<string name="shortcut_videos">Videolar</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
<string name="video_orientation_video">Орієнтація відео</string>
<string name="video_resize_crop">Обрізати</string>
<string name="video_resize_fit">Підігнати</string>
<string name="shortcut_videos">Відео</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
<string name="pref_title">设置</string>
<string name="pref_repeat_toggle">重复切换</string>
<string name="pref_repeat_toggle_summary">允许无限循环视频的额外控制(需要重新启动应用程序)</string>
<string name="shortcut_videos">视频</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="green">#3DDC84</color>
<color name="shortcut_background">#F5F5F5</color>

<color name="ui_controls_background">#98000000</color>
<color name="exo_bottom_bar_background" tools:keep="@color/exo_bottom_bar_background">@color/ui_controls_background</color>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
<string name="pref_skip_silence_off">Play content as is</string>
<string name="pref_repeat_toggle">Repeat toggle</string>
<string name="pref_repeat_toggle_summary">Extra control to allow indefinitely loop video (requires app restart)</string>
<string name="shortcut_videos">Videos</string>
</resources>
12 changes: 12 additions & 0 deletions app/src/main/res/xml/shortcuts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="videos"
android:enabled="true"
android:icon="@mipmap/shortcut_videos"
android:shortcutShortLabel="@string/shortcut_videos">
<intent
android:action="com.brouken.player.action.SHORTCUT_VIDEOS"
android:targetPackage="com.brouken.player"
android:targetClass="com.brouken.player.PlayerActivity" />
</shortcut>
</shortcuts>
2 changes: 1 addition & 1 deletion fastlane/metadata/android/el/short_description_google.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Πρόγραμμα αναπαραγωγής βίντεο ανοιχτού κώδικα χωρίς καθυστέρηση ήχου σε σύνδεση με Bluetooth και υποστήριξη για διάφορους κωδικοποιητές
Πρόγραμμα αναπαραγωγής βίντεο ανοιχτού κώδικα χωρίς καθυστέρηση ήχου

0 comments on commit a33fb0b

Please sign in to comment.