Merge pull request #1145 from mauriciocolli/dev

Implement subscriptions import/export
This commit is contained in:
Mauricio Colli 2018-03-10 12:11:13 -03:00 committed by GitHub
commit 3a2bc08a00
77 changed files with 2455 additions and 244 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/info_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/inputs_panel"
android:layout_alignParentTop="true"
android:gravity="center_vertical"
android:padding="16dp"
android:scrollbars="vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
tools:text="@string/import_soundcloud_instructions"/>
<LinearLayout
android:id="@+id/inputs_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">
<EditText
android:id="@+id/input_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:inputType="text"
android:visibility="gone"
tools:hint="@string/import_soundcloud_instructions_hint"
tools:visibility="visible"/>
<Button
android:id="@+id/input_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
tools:text="@string/import_title"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_alignParentTop="true"
android:background="?attr/toolbar_shadow_drawable"/>
</RelativeLayout>

View file

@ -9,10 +9,12 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/items_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
app:layoutManager="LinearLayoutManager"
tools:listitem="@layout/list_channel_item"/>
android:visibility="gone"
tools:listitem="@layout/list_channel_item"
tools:visibility="visible"/>
<!--ERROR PANEL-->
<include
@ -21,6 +23,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/items_list"
android:layout_marginTop="50dp"
android:visibility="gone"
tools:visibility="visible"/>
@ -31,6 +34,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_below="@id/items_list"
android:layout_marginTop="50dp"
android:visibility="gone"
tools:visibility="visible"/>

View file

@ -1,43 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<LinearLayout
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:layout_marginBottom="12dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true">
android:orientation="vertical"
android:paddingBottom="12dp">
<ImageView
android:id="@+id/whatsNewIcon"
android:layout_width="48dp"
android:layout_height="28dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:src="?attr/rss"
tools:ignore="ContentDescription,RtlHardcoded"/>
<TextView
android:id="@+id/whatsNew"
<LinearLayout
android:id="@+id/whats_new"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_toRightOf="@+id/whatsNewIcon"
android:gravity="left|center"
android:text="@string/fragment_whats_new"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp"
android:textStyle="bold"
tools:ignore="RtlHardcoded"/>
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/whats_new_icon"
android:layout_width="48dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:src="?attr/rss"
tools:ignore="ContentDescription,RtlHardcoded"/>
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="left|center"
android:text="@string/fragment_whats_new"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp"
android:textStyle="bold"
tools:ignore="RtlHardcoded"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/import_export"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@+id/import_export_icon"
android:layout_width="48dp"
android:layout_height="24dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:src="?attr/ic_import_export"
tools:ignore="ContentDescription,RtlHardcoded"/>
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_toRightOf="@+id/import_export_icon"
android:layout_toLeftOf="@+id/import_export_expand_icon"
android:gravity="left|center"
android:text="@string/import_export_title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp"
android:textStyle="bold"
tools:ignore="RtlHardcoded"/>
<ImageView
android:id="@+id/import_export_expand_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="24dp"
android:src="?attr/expand"
tools:ignore="ContentDescription,RtlHardcoded"/>
</RelativeLayout>
<org.schabi.newpipe.views.CollapsibleView
android:id="@+id/import_export_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="RtlSymmetry">
<TextView
android:id="@+id/import_from_title"
android:layout_width="match_parent"
android:layout_height="@dimen/subscription_import_export_item_height"
android:gravity="left|center"
android:maxLines="1"
android:paddingLeft="72dp"
android:text="@string/import_from"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="13sp"
tools:ignore="RtlHardcoded"/>
<LinearLayout
android:id="@+id/import_from_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="72dp"
android:layout_marginStart="72dp"
android:orientation="vertical"/>
<TextView
android:id="@+id/export_to_title"
android:layout_width="match_parent"
android:layout_height="@dimen/subscription_import_export_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="left|center"
android:maxLines="1"
android:paddingLeft="72dp"
android:text="@string/export_to"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="13sp"
tools:ignore="RtlHardcoded"/>
<LinearLayout
android:id="@+id/export_to_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="72dp"
android:layout_marginStart="72dp"
android:orientation="vertical"/>
</org.schabi.newpipe.views.CollapsibleView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/whatsNew"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="?attr/separator_color"/>
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal">
<ImageView
android:id="@android:id/icon1"
android:layout_width="48dp"
android:layout_height="@dimen/subscription_import_export_item_icon_size"
android:layout_marginTop="@dimen/subscription_import_export_item_icon_margin"
android:layout_marginBottom="@dimen/subscription_import_export_item_icon_margin"
android:scaleType="fitCenter"
tools:ignore="ContentDescription,RtlHardcoded"
tools:src="@drawable/place_holder_youtube"/>
<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="@dimen/subscription_import_export_item_height"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="13sp"
tools:text="@string/youtube"/>
</LinearLayout>

View file

@ -5,6 +5,7 @@
<item
android:id="@+id/action_search"
android:icon="?attr/search"
android:orderInCategory="1"
android:title="@string/search"
app:showAsAction="always"/>
</menu>

View file

@ -46,4 +46,6 @@
<!-- Elements Size -->
<dimen name="playlist_item_thumbnail_stream_count_width">70dp</dimen>
<!-- File picker dimensions -->
<dimen name="file_picker_items_text_size">16sp</dimen>
</resources>

View file

@ -32,6 +32,9 @@
<attr name="ic_bookmark" format="reference"/>
<attr name="ic_playlist_add" format="reference"/>
<attr name="ic_playlist_check" format="reference"/>
<attr name="ic_import_export" format="reference"/>
<attr name="ic_save" format="reference"/>
<attr name="ic_backup" format="reference"/>
<!-- Can't refer to colors directly into drawable's xml-->
<attr name="toolbar_shadow_drawable" format="reference"/>

View file

@ -4,6 +4,7 @@
<!-- Light Theme -->
<color name="light_background_color">#EEEEEE</color>
<color name="light_dialog_background_color">#EEEEEE</color>
<color name="light_settings_accent_color">#e53935</color>
<color name="light_separator_color">#32000000</color>
<color name="light_ripple_color">#48868686</color>
@ -16,6 +17,7 @@
<!-- Dark Theme -->
<color name="dark_background_color">#222222</color>
<color name="dark_dialog_background_color">#424242</color>
<color name="dark_settings_accent_color">#ff5252</color>
<color name="dark_separator_color">#0affffff</color>
<color name="dark_ripple_color">#48ffffff</color>

View file

@ -25,6 +25,11 @@
<!-- Miscellaneous -->
<dimen name="popup_default_width">180dp</dimen>
<dimen name="popup_minimum_width">150dp</dimen>
<dimen name="subscription_import_export_item_height">42dp</dimen>
<dimen name="subscription_import_export_item_icon_size">24dp</dimen>
<!-- (item_height - item_icon_size) / 2-->
<dimen name="subscription_import_export_item_icon_margin">9dp</dimen>
<!-- Video Item Detail View Dimensions-->
<!-- Text Size -->
<dimen name="video_item_detail_title_text_size">15sp</dimen>
@ -75,4 +80,7 @@
<!-- Kiosk view Dimensions-->
<dimen name="kiosk_title_text_size">30sp</dimen>
<!-- File picker dimensions -->
<dimen name="file_picker_items_text_size">14sp</dimen>
</resources>

View file

@ -132,6 +132,7 @@
<string name="play_all">Play All</string>
<string name="always">Always</string>
<string name="just_once">Just Once</string>
<string name="file">File</string>
<string name="notification_channel_id" translatable="false">newpipe</string>
<string name="notification_channel_name">NewPipe Notification</string>
@ -169,6 +170,11 @@
<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>
<string name="invalid_directory">Invalid directory</string>
<string name="invalid_source">Invalid file/content source</string>
<string name="invalid_file">File doesn\'t exist or insufficient permission to read or write to it</string>
<string name="file_name_empty_error">File name cannot be empty</string>
<string name="error_occurred_detail">An error occurred: %1$s</string>
<!-- error activity -->
<string name="sorry_string">Sorry, that should not have happened.</string>
@ -427,4 +433,24 @@
<string name="enable_disposed_exceptions_title">Report Out-of-Lifecycle Errors</string>
<string name="enable_disposed_exceptions_summary">Force reporting of undeliverable Rx exceptions occurring outside of fragment or activity lifecycle after dispose</string>
<!-- Subscriptions import/export -->
<string name="import_export_title">Import/Export</string>
<string name="import_title">Import</string>
<string name="import_from">Import from</string>
<string name="export_to">Export to</string>
<string name="import_ongoing">Importing…</string>
<string name="export_ongoing">Exporting…</string>
<string name="import_file_title">Import file</string>
<string name="previous_export">Previous export</string>
<string name="subscriptions_import_unsuccessful">Subscriptions import failed</string>
<string name="subscriptions_export_unsuccessful">Subscriptions export failed</string>
<string name="import_youtube_instructions">To import your YouTube subscriptions you will need the export file, which can be downloaded following these instructions:\n\n1. Go to this url: %1$s\n2. Log in to your account when asked\n3. A download should start (that\'s the export file) </string>
<string name="import_soundcloud_instructions">To import your SoundCloud followings you have to know your profile url or id. If you do, just type either of them in the input below and you\'re ready to go.\n\nIf you don\'t, you can follow these steps:\n\n1. Enable \"desktop mode\" in some browser (the site is not available for mobile devices)\n2. Go to this url: %1$s\n3. Log in to your account when asked\n4. Copy the url that you were redirected to (that\'s your profile url)</string>
<string name="import_soundcloud_instructions_hint">yourid, soundcloud.com/yourid</string>
<string name="import_network_expensive_warning">Keep in mind that this operation can be network expensive.\n\nDo you want to continue?</string>
</resources>

View file

@ -48,6 +48,9 @@
<item name="ic_bookmark">@drawable/ic_bookmark_black_24dp</item>
<item name="ic_playlist_add">@drawable/ic_playlist_add_black_24dp</item>
<item name="ic_playlist_check">@drawable/ic_playlist_add_check_black_24dp</item>
<item name="ic_import_export">@drawable/ic_import_export_black_24dp</item>
<item name="ic_save">@drawable/ic_save_black_24dp</item>
<item name="ic_backup">@drawable/ic_backup_black_24dp</item>
<item name="separator_color">@color/light_separator_color</item>
<item name="contrast_background_color">@color/light_contrast_background_color</item>
@ -102,6 +105,9 @@
<item name="ic_bookmark">@drawable/ic_bookmark_white_24dp</item>
<item name="ic_playlist_add">@drawable/ic_playlist_add_white_24dp</item>
<item name="ic_playlist_check">@drawable/ic_playlist_add_check_white_24dp</item>
<item name="ic_import_export">@drawable/ic_import_export_white_24dp</item>
<item name="ic_save">@drawable/ic_save_white_24dp</item>
<item name="ic_backup">@drawable/ic_backup_white_24dp</item>
<item name="separator_color">@color/dark_separator_color</item>
<item name="contrast_background_color">@color/dark_contrast_background_color</item>
@ -130,6 +136,23 @@
<item name="android:windowAnimationStyle">@style/SwitchAnimation</item>
</style>
<!-- Dialogs -->
<style name="LightDialogTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">@color/light_youtube_primary_color</item>
<item name="colorPrimaryDark">@color/light_youtube_dark_color</item>
<item name="colorAccent">@color/light_youtube_accent_color</item>
<item name="android:windowBackground">@color/light_dialog_background_color</item>
<item name="windowBackground">@color/light_dialog_background_color</item>
</style>
<style name="DarkDialogTheme" parent="Theme.AppCompat.Dialog">
<item name="colorPrimary">@color/dark_youtube_primary_color</item>
<item name="colorPrimaryDark">@color/dark_youtube_dark_color</item>
<item name="colorAccent">@color/dark_youtube_accent_color</item>
<item name="android:windowBackground">@color/dark_dialog_background_color</item>
<item name="windowBackground">@color/dark_dialog_background_color</item>
</style>
<!-- Settings -->
<style name="LightSettingsTheme" parent="LightTheme">
<item name="colorAccent">@color/light_settings_accent_color</item>

View file

@ -9,47 +9,35 @@
<!--File picker styles-->
<style name="FilePickerThemeLight" parent="NNF_BaseTheme.Light">
<item name="colorPrimary">@color/light_youtube_primary_color</item>
<item name="colorPrimaryDark">@color/light_youtube_dark_color</item>
<item name="colorAccent">@color/light_youtube_accent_color</item>
<item name="android:background">@color/light_background_color</item>
<item name="colorAccent">@color/light_settings_accent_color</item>
<item name="android:windowBackground">@color/light_background_color</item>
<item name="nnf_separator_color">@color/light_separator_color</item>
<item name="alertDialogTheme">@style/FilePickerAlertDialogThemeLight</item>
<item name="nnf_toolbarTheme">@style/FilePickerToolbarLight</item>
</style>
<style name="FilePickerAlertDialogThemeLight" parent="Theme.AppCompat.Dialog.Alert">
<item name="colorPrimary">@color/light_youtube_primary_color</item>
<item name="colorPrimaryDark">@color/light_youtube_dark_color</item>
<item name="colorAccent">@color/light_youtube_accent_color</item>
<item name="colorAccent">@color/light_settings_accent_color</item>
</style>
<style name="FilePickerToolbarLight" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:background">@color/light_youtube_primary_color</item>
</style>
<style name="FilePickerThemeDark" parent="FilePickerThemeLight">
<style name="FilePickerThemeDark" parent="NNF_BaseTheme">
<item name="colorPrimary">@color/dark_youtube_primary_color</item>
<item name="colorPrimaryDark">@color/dark_youtube_dark_color</item>
<item name="colorAccent">@color/dark_youtube_accent_color</item>
<item name="android:background">@color/dark_background_color</item>
<item name="android:textColorPrimary">@color/dark_youtube_accent_color</item>
<item name="colorAccent">@color/dark_settings_accent_color</item>
<item name="android:windowBackground">@color/dark_background_color</item>
<item name="nnf_separator_color">@color/black_separator_color</item>
<item name="alertDialogTheme">@style/FilePickerAlertDialogThemeDark</item>
<item name="nnf_toolbarTheme">@style/FilePickerToolbarDark</item>
</style>
<style name="FilePickerAlertDialogThemeDark" parent="Theme.AppCompat.Dialog.Alert">
<item name="colorPrimary">@color/dark_youtube_primary_color</item>
<item name="colorPrimaryDark">@color/dark_youtube_dark_color</item>
<item name="colorAccent">@color/dark_youtube_accent_color</item>
</style>
<style name="FilePickerToolbarDark" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:background">@color/dark_youtube_primary_color</item>
<item name="colorAccent">@color/dark_settings_accent_color</item>
</style>
</resources>