Merge pull request #1097 from TeamNewPipe/router
merge RouterActivity and RouterVideoActivity and add Hooktube support
This commit is contained in:
commit
c3ec9b2ad7
10 changed files with 16 additions and 22 deletions
|
@ -55,7 +55,7 @@ dependencies {
|
||||||
exclude module: 'support-annotations'
|
exclude module: 'support-annotations'
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:4fb49d54b5'
|
implementation 'com.github.TeamNewPipe:NewPipeExtractor:e51bc58a856dcf3'
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:1.10.19'
|
testImplementation 'org.mockito:mockito-core:1.10.19'
|
||||||
|
|
|
@ -189,7 +189,7 @@
|
||||||
<data android:scheme="http"/>
|
<data android:scheme="http"/>
|
||||||
<data android:scheme="https"/>
|
<data android:scheme="https"/>
|
||||||
<data android:host="hooktube.com"/>
|
<data android:host="hooktube.com"/>
|
||||||
<data android:host="*.youtube.com"/>
|
<data android:host="*.hooktube.com"/>
|
||||||
<!-- video prefix -->
|
<!-- video prefix -->
|
||||||
<data android:pathPrefix="/v/"/>
|
<data android:pathPrefix="/v/"/>
|
||||||
<data android:pathPrefix="/embed/"/>
|
<data android:pathPrefix="/embed/"/>
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class RouterActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add some sort of "capabilities" field to services (audio only, video and audio, etc.)
|
// TODO: Add some sort of "capabilities" field to services (audio only, video and audio, etc.)
|
||||||
if (currentService == ServiceList.SoundCloud.getService()) {
|
if (currentService == ServiceList.SoundCloud) {
|
||||||
handleChoice(getString(R.string.background_player_key));
|
handleChoice(getString(R.string.background_player_key));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ public class RouterActivity extends AppCompatActivity {
|
||||||
final RadioGroup radioGroup = rootLayout.findViewById(android.R.id.list);
|
final RadioGroup radioGroup = rootLayout.findViewById(android.R.id.list);
|
||||||
|
|
||||||
final AdapterChoiceItem[] choices = {
|
final AdapterChoiceItem[] choices = {
|
||||||
new AdapterChoiceItem(getString(R.string.info_screen_key), getString(R.string.info_screen),
|
new AdapterChoiceItem(getString(R.string.info_screen_key), getString(R.string.show_info),
|
||||||
resolveResourceIdFromAttr(themeWrapper, R.attr.info)),
|
resolveResourceIdFromAttr(themeWrapper, R.attr.info)),
|
||||||
new AdapterChoiceItem(getString(R.string.video_player_key), getString(R.string.video_player),
|
new AdapterChoiceItem(getString(R.string.video_player_key), getString(R.string.video_player),
|
||||||
resolveResourceIdFromAttr(themeWrapper, R.attr.play)),
|
resolveResourceIdFromAttr(themeWrapper, R.attr.play)),
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
// Constants
|
// Constants
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
private static final int FALLBACK_SERVICE_ID = ServiceList.YouTube.getId();
|
private static final int FALLBACK_SERVICE_ID = ServiceList.YouTube.getServiceId();
|
||||||
private static final String FALLBACK_CHANNEL_URL = "https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ";
|
private static final String FALLBACK_CHANNEL_URL = "https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ";
|
||||||
private static final String FALLBACK_CHANNEL_NAME = "Music";
|
private static final String FALLBACK_CHANNEL_NAME = "Music";
|
||||||
private static final String FALLBACK_KIOSK_ID = "Trending";
|
private static final String FALLBACK_KIOSK_ID = "Trending";
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
.putString(getString(R.string.main_page_selectd_kiosk_id), kioskId).apply();
|
.putString(getString(R.string.main_page_selectd_kiosk_id), kioskId).apply();
|
||||||
String serviceName = "";
|
String serviceName = "";
|
||||||
try {
|
try {
|
||||||
serviceName = NewPipe.getService(service_id).getServiceInfo().name;
|
serviceName = NewPipe.getService(service_id).getServiceInfo().getName();
|
||||||
} catch (ExtractionException e) {
|
} catch (ExtractionException e) {
|
||||||
onError(e);
|
onError(e);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
|
|
||||||
String summary =
|
String summary =
|
||||||
String.format(getString(R.string.service_kiosk_string),
|
String.format(getString(R.string.service_kiosk_string),
|
||||||
service.getServiceInfo().name,
|
service.getServiceInfo().getName(),
|
||||||
kioskName);
|
kioskName);
|
||||||
|
|
||||||
mainPagePref.setSummary(summary);
|
mainPagePref.setSummary(summary);
|
||||||
|
|
|
@ -122,11 +122,11 @@ public class SelectKioskFragment extends DialogFragment {
|
||||||
|
|
||||||
for(StreamingService service : NewPipe.getServices()) {
|
for(StreamingService service : NewPipe.getServices()) {
|
||||||
//TODO: Multi-service support
|
//TODO: Multi-service support
|
||||||
if (service.getServiceId() != ServiceList.YouTube.getId()) continue;
|
if (service.getServiceId() != ServiceList.YouTube.getServiceId()) continue;
|
||||||
|
|
||||||
for(String kioskId : service.getKioskList().getAvailableKiosks()) {
|
for(String kioskId : service.getKioskList().getAvailableKiosks()) {
|
||||||
String name = String.format(getString(R.string.service_kiosk_string),
|
String name = String.format(getString(R.string.service_kiosk_string),
|
||||||
service.getServiceInfo().name,
|
service.getServiceInfo().getName(),
|
||||||
KioskTranslator.getTranslatedKioskName(kioskId, getContext()));
|
KioskTranslator.getTranslatedKioskName(kioskId, getContext()));
|
||||||
kioskList.add(new Entry(
|
kioskList.add(new Entry(
|
||||||
ServiceHelper.getIcon(service.getServiceId()),
|
ServiceHelper.getIcon(service.getServiceId()),
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.schabi.newpipe.extractor.StreamingService;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
|
|
||||||
public class ServiceHelper {
|
public class ServiceHelper {
|
||||||
private static final StreamingService DEFAULT_FALLBACK_SERVICE = ServiceList.YouTube.getService();
|
private static final StreamingService DEFAULT_FALLBACK_SERVICE = ServiceList.YouTube;
|
||||||
|
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
public static int getIcon(int serviceId) {
|
public static int getIcon(int serviceId) {
|
||||||
|
@ -45,9 +45,9 @@ public class ServiceHelper {
|
||||||
public static void setSelectedServiceId(Context context, int serviceId) {
|
public static void setSelectedServiceId(Context context, int serviceId) {
|
||||||
String serviceName;
|
String serviceName;
|
||||||
try {
|
try {
|
||||||
serviceName = NewPipe.getService(serviceId).getServiceInfo().name;
|
serviceName = NewPipe.getService(serviceId).getServiceInfo().getName();
|
||||||
} catch (ExtractionException e) {
|
} catch (ExtractionException e) {
|
||||||
serviceName = DEFAULT_FALLBACK_SERVICE.getServiceInfo().name;
|
serviceName = DEFAULT_FALLBACK_SERVICE.getServiceInfo().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedServicePreferences(context, serviceName);
|
setSelectedServicePreferences(context, serviceName);
|
||||||
|
@ -55,7 +55,7 @@ public class ServiceHelper {
|
||||||
|
|
||||||
public static void setSelectedServiceId(Context context, String serviceName) {
|
public static void setSelectedServiceId(Context context, String serviceName) {
|
||||||
int serviceId = NewPipe.getIdOfService(serviceName);
|
int serviceId = NewPipe.getIdOfService(serviceName);
|
||||||
if (serviceId == -1) serviceName = DEFAULT_FALLBACK_SERVICE.getServiceInfo().name;
|
if (serviceId == -1) serviceName = DEFAULT_FALLBACK_SERVICE.getServiceInfo().getName();
|
||||||
|
|
||||||
setSelectedServicePreferences(context, serviceName);
|
setSelectedServicePreferences(context, serviceName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class ThemeHelper {
|
||||||
else if (selectedTheme.equals(blackTheme)) themeName = "BlackTheme";
|
else if (selectedTheme.equals(blackTheme)) themeName = "BlackTheme";
|
||||||
else if (selectedTheme.equals(darkTheme)) themeName = "DarkTheme";
|
else if (selectedTheme.equals(darkTheme)) themeName = "DarkTheme";
|
||||||
|
|
||||||
themeName += "." + service.getServiceInfo().name;
|
themeName += "." + service.getServiceInfo().getName();
|
||||||
int resourceId = context.getResources().getIdentifier(themeName, "style", context.getPackageName());
|
int resourceId = context.getResources().getIdentifier(themeName, "style", context.getPackageName());
|
||||||
|
|
||||||
if (resourceId > 0) {
|
if (resourceId > 0) {
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<string name="channel_unsubscribed">Channel unsubscribed</string>
|
<string name="channel_unsubscribed">Channel unsubscribed</string>
|
||||||
<string name="subscription_change_failed">Unable to change subscription</string>
|
<string name="subscription_change_failed">Unable to change subscription</string>
|
||||||
<string name="subscription_update_failed">Unable to update subscription</string>
|
<string name="subscription_update_failed">Unable to update subscription</string>
|
||||||
<string name="info_screen">Info Screen</string>
|
<string name="show_info">Show info</string>
|
||||||
|
|
||||||
<string name="tab_main">Main</string>
|
<string name="tab_main">Main</string>
|
||||||
<string name="tab_subscriptions">Subscriptions</string>
|
<string name="tab_subscriptions">Subscriptions</string>
|
||||||
|
@ -369,7 +369,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- Preferred player -->
|
<!-- Preferred player -->
|
||||||
<string name="preferred_player_share_menu_title" translatable="false">@string/preferred_player_settings_title</string>
|
<string name="preferred_player_share_menu_title" translatable="false">NewPipe</string>
|
||||||
<string name="preferred_player_share_menu_dialog_title">Open with preferred player</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="preferred_player_settings_title">Preferred player</string>
|
||||||
|
|
||||||
|
|
|
@ -74,12 +74,6 @@
|
||||||
android:layout="@layout/settings_category_header_layout"
|
android:layout="@layout/settings_category_header_layout"
|
||||||
android:title="@string/settings_category_player_behavior_title">
|
android:title="@string/settings_category_player_behavior_title">
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="@string/autoplay_through_intent_key"
|
|
||||||
android:summary="@string/autoplay_by_calling_app_summary"
|
|
||||||
android:title="@string/autoplay_by_calling_app_title"/>
|
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="@string/preferred_player_default"
|
android:defaultValue="@string/preferred_player_default"
|
||||||
android:entries="@array/preferred_player_description_list"
|
android:entries="@array/preferred_player_description_list"
|
||||||
|
|
Loading…
Reference in a new issue