Add preferred player

This commit is contained in:
Mauricio Colli 2018-01-22 22:40:00 -02:00
parent 1f8e90858e
commit a473e3d623
36 changed files with 843 additions and 333 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="200" android:exitFadeDuration="200">
<item android:drawable="@color/dark_ripple_color" android:state_checked="true" android:state_pressed="true" />
<item android:drawable="@color/dark_ripple_color" android:state_pressed="true" />
<item android:drawable="@color/dark_selected_color" android:state_checked="true" />
<item android:drawable="@android:color/transparent" />
</selector>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="200" android:exitFadeDuration="200">
<item android:drawable="@color/light_ripple_color" android:state_checked="true" android:state_pressed="true" />
<item android:drawable="@color/light_ripple_color" android:state_pressed="true" />
<item android:drawable="@color/light_selected_color" android:state_checked="true" />
<item android:drawable="@android:color/transparent" />
</selector>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@null"
android:drawablePadding="24dp"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:maxLines="2"
android:minHeight="?attr/listPreferredItemHeightSmall"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
android:paddingRight="?attr/listPreferredItemPaddingRight"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:background="?attr/checked_selector_drawable"
android:textColor="?attr/textColorAlertDialogListItem"
tools:drawableLeft="?attr/play"
tools:text="Lorem ipsum dolor sit amet" />

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="?attr/listPreferredItemPaddingLeft" />

View file

@ -22,10 +22,12 @@
<attr name="selected" format="reference"/>
<attr name="search_add" format="reference"/>
<attr name="options" format="reference"/>
<attr name="play" format="reference"/>
<!-- Can't refer to colors directly into drawable's xml-->
<attr name="toolbar_shadow_drawable" format="reference"/>
<attr name="selector_drawable" format="reference"/>
<attr name="checked_selector_drawable" format="reference"/>
<attr name="separator_color" format="color"/>
<attr name="queue_background_color" format="color"/>

View file

@ -8,6 +8,7 @@
<color name="light_youtube_accent_color">#000000</color>
<color name="light_separator_color">#32000000</color>
<color name="light_ripple_color">#48868686</color>
<color name="light_selected_color">#2a868686</color>
<color name="light_contrast_background_color">#1fa6a6a6</color>
<color name="light_shadow_start_color">#5a000000</color>
<color name="light_license_background_color">#ffffff</color>
@ -21,6 +22,7 @@
<color name="dark_youtube_accent_color">#FFFFFF</color>
<color name="dark_separator_color">#0affffff</color>
<color name="dark_ripple_color">#48ffffff</color>
<color name="dark_selected_color">#2affffff</color>
<color name="dark_contrast_background_color">#1f717171</color>
<color name="dark_shadow_start_color">#82000000</color>
<color name="dark_license_background_color">#424242</color>

View file

@ -149,6 +149,29 @@
<string name="default_file_charset_value" translatable="false">@string/charset_most_special_characters_value</string>
<!-- Preferred player -->
<string name="preferred_player_key" translatable="false">preferred_player_key</string>
<string name="preferred_player_default" translatable="false">@string/always_ask_player_key</string>
<string name="preferred_player_last_selected_key" translatable="false">preferred_player_last_selected</string>
<string name="video_player_key" translatable="false">video_player</string>
<string name="background_player_key" translatable="false">background_player</string>
<string name="popup_player_key" translatable="false">popup_player</string>
<string name="always_ask_player_key" translatable="false">always_ask_player</string>
<string-array name="preferred_player_description_list" translatable="false">
<item>@string/video_player</item>
<item>@string/background_player</item>
<item>@string/popup_player</item>
<item>@string/always_ask_player</item>
</string-array>
<string-array name="preferred_player_values_list" translatable="false">
<item>@string/video_player_key</item>
<item>@string/background_player_key</item>
<item>@string/popup_player_key</item>
<item>@string/always_ask_player_key</item>
</string-array>
<!-- alternatively, load these from some local android data store -->
<string-array name="language_codes" translatable="false">
<item>af</item>

View file

@ -5,6 +5,7 @@
<string name="view_count_text">%1$s views</string>
<string name="upload_date_text">Published on %1$s</string>
<string name="no_player_found">No stream player found. Do you want to install VLC?</string>
<string name="no_player_found_toast">No stream player found (you can install VLC to play it)</string>
<string name="install">Install</string>
<string name="cancel">Cancel</string>
<string name="fdroid_vlc_url" translatable="false">https://f-droid.org/repository/browse/?fdfilter=vlc&amp;fdid=org.videolan.vlc</string>
@ -119,6 +120,8 @@
<string name="best_resolution">Best resolution</string>
<string name="undo">Undo</string>
<string name="play_all">Play All</string>
<string name="always">Always</string>
<string name="just_once">Just Once</string>
<string name="notification_channel_id" translatable="false">newpipe</string>
<string name="notification_channel_name">NewPipe Notification</string>
@ -148,6 +151,10 @@
<string name="player_stream_failure">Failed to play this stream</string>
<string name="player_unrecoverable_failure">Unrecoverable player error occurred</string>
<string name="player_recoverable_failure">Recovering from player error</string>
<string name="external_player_unsupported_link_type">External players don\'t support these types of links</string>
<string name="invalid_url_toast">Invalid URL</string>
<string name="video_streams_empty">No video streams found</string>
<string name="audio_streams_empty">No audio streams found</string>
<!-- error activity -->
<string name="sorry_string">Sorry, that should not have happened.</string>
@ -336,4 +343,17 @@
<string name="drawer_close">Close Drawer</string>
<string name="youtube" translatable="false">YouTube</string>
<string name="soundcloud" translatable="false">SoundCloud</string>
<!-- Preferred player -->
<string name="preferred_player_share_menu_title">@string/preferred_player_settings_title</string>
<string name="preferred_player_share_menu_dialog_title">Open with preferred player</string>
<string name="preferred_player_settings_title">Preferred player</string>
<string name="video_player">Video player</string>
<string name="background_player">Background player</string>
<string name="popup_player">Popup player</string>
<string name="always_ask_player">Always ask</string>
<string name="preferred_player_fetcher_notification_title">Getting info…</string>
<string name="preferred_player_fetcher_notification_message">"The requested content is loading"</string>
</resources>

View file

@ -29,9 +29,11 @@
<item name="selected">@drawable/ic_fiber_manual_record_black_24dp</item>
<item name="search_add">@drawable/ic_arrow_top_left_black_24dp</item>
<item name="options">@drawable/ic_more_vert_black_24dp</item>
<item name="play">@drawable/ic_play_arrow_black_24dp</item>
<item name="separator_color">@color/light_separator_color</item>
<item name="contrast_background_color">@color/light_contrast_background_color</item>
<item name="checked_selector_drawable">@drawable/light_checked_selector</item>
<item name="queue_background_color">@color/light_queue_background_color</item>
<item name="toolbar_shadow_drawable">@drawable/toolbar_shadow_light</item>
<item name="selector_drawable">@drawable/light_selector</item>
@ -69,9 +71,11 @@
<item name="selected">@drawable/ic_fiber_manual_record_white_24dp</item>
<item name="search_add">@drawable/ic_arrow_top_left_white_24dp</item>
<item name="options">@drawable/ic_more_vert_white_24dp</item>
<item name="play">@drawable/ic_play_arrow_white_24dp</item>
<item name="separator_color">@color/dark_separator_color</item>
<item name="contrast_background_color">@color/dark_contrast_background_color</item>
<item name="checked_selector_drawable">@drawable/dark_checked_selector</item>
<item name="queue_background_color">@color/dark_queue_background_color</item>
<item name="toolbar_shadow_drawable">@drawable/toolbar_shadow_dark</item>
<item name="selector_drawable">@drawable/dark_selector</item>
@ -164,12 +168,27 @@
<item name="android:background">@color/dark_youtube_primary_color</item>
</style>
<style name="PopupPermissionsTheme" parent="Theme.AppCompat.NoActionBar">
<style name="RouterActivityThemeLight" parent="LightTheme">
<item name="colorPrimary">@android:color/transparent</item>
<item name="colorPrimaryDark">@android:color/transparent</item>
<item name="colorAccent">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
<item name="android:windowNoDisplay">true</item>
<item name="android:windowAnimationStyle">@null</item>
</style>
<style name="RouterActivityThemeDark" parent="DarkTheme">
<item name="colorPrimary">@android:color/transparent</item>
<item name="colorPrimaryDark">@android:color/transparent</item>
<item name="colorAccent">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
</style>
</resources>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:title="@string/settings_category_video_audio_title">
<ListPreference
@ -81,6 +80,14 @@
android:summary="@string/autoplay_by_calling_app_summary"
android:title="@string/autoplay_by_calling_app_title"/>
<ListPreference
android:defaultValue="@string/preferred_player_default"
android:entries="@array/preferred_player_description_list"
android:entryValues="@array/preferred_player_values_list"
android:key="@string/preferred_player_key"
android:summary="%s"
android:title="@string/preferred_player_settings_title"/>
<SwitchPreference
android:defaultValue="false"
android:key="@string/resume_on_audio_focus_gain_key"