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'
|
||||
}
|
||||
|
||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:4fb49d54b5'
|
||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:e51bc58a856dcf3'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.mockito:mockito-core:1.10.19'
|
||||
|
|
|
@ -189,7 +189,7 @@
|
|||
<data android:scheme="http"/>
|
||||
<data android:scheme="https"/>
|
||||
<data android:host="hooktube.com"/>
|
||||
<data android:host="*.youtube.com"/>
|
||||
<data android:host="*.hooktube.com"/>
|
||||
<!-- video prefix -->
|
||||
<data android:pathPrefix="/v/"/>
|
||||
<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.)
|
||||
if (currentService == ServiceList.SoundCloud.getService()) {
|
||||
if (currentService == ServiceList.SoundCloud) {
|
||||
handleChoice(getString(R.string.background_player_key));
|
||||
return;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ public class RouterActivity extends AppCompatActivity {
|
|||
final RadioGroup radioGroup = rootLayout.findViewById(android.R.id.list);
|
||||
|
||||
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)),
|
||||
new AdapterChoiceItem(getString(R.string.video_player_key), getString(R.string.video_player),
|
||||
resolveResourceIdFromAttr(themeWrapper, R.attr.play)),
|
||||
|
|
|
@ -47,7 +47,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
|||
// 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_NAME = "Music";
|
||||
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();
|
||||
String serviceName = "";
|
||||
try {
|
||||
serviceName = NewPipe.getService(service_id).getServiceInfo().name;
|
||||
serviceName = NewPipe.getService(service_id).getServiceInfo().getName();
|
||||
} catch (ExtractionException e) {
|
||||
onError(e);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
|||
|
||||
String summary =
|
||||
String.format(getString(R.string.service_kiosk_string),
|
||||
service.getServiceInfo().name,
|
||||
service.getServiceInfo().getName(),
|
||||
kioskName);
|
||||
|
||||
mainPagePref.setSummary(summary);
|
||||
|
|
|
@ -122,11 +122,11 @@ public class SelectKioskFragment extends DialogFragment {
|
|||
|
||||
for(StreamingService service : NewPipe.getServices()) {
|
||||
//TODO: Multi-service support
|
||||
if (service.getServiceId() != ServiceList.YouTube.getId()) continue;
|
||||
if (service.getServiceId() != ServiceList.YouTube.getServiceId()) continue;
|
||||
|
||||
for(String kioskId : service.getKioskList().getAvailableKiosks()) {
|
||||
String name = String.format(getString(R.string.service_kiosk_string),
|
||||
service.getServiceInfo().name,
|
||||
service.getServiceInfo().getName(),
|
||||
KioskTranslator.getTranslatedKioskName(kioskId, getContext()));
|
||||
kioskList.add(new Entry(
|
||||
ServiceHelper.getIcon(service.getServiceId()),
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.schabi.newpipe.extractor.StreamingService;
|
|||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
|
||||
public class ServiceHelper {
|
||||
private static final StreamingService DEFAULT_FALLBACK_SERVICE = ServiceList.YouTube.getService();
|
||||
private static final StreamingService DEFAULT_FALLBACK_SERVICE = ServiceList.YouTube;
|
||||
|
||||
@DrawableRes
|
||||
public static int getIcon(int serviceId) {
|
||||
|
@ -45,9 +45,9 @@ public class ServiceHelper {
|
|||
public static void setSelectedServiceId(Context context, int serviceId) {
|
||||
String serviceName;
|
||||
try {
|
||||
serviceName = NewPipe.getService(serviceId).getServiceInfo().name;
|
||||
serviceName = NewPipe.getService(serviceId).getServiceInfo().getName();
|
||||
} catch (ExtractionException e) {
|
||||
serviceName = DEFAULT_FALLBACK_SERVICE.getServiceInfo().name;
|
||||
serviceName = DEFAULT_FALLBACK_SERVICE.getServiceInfo().getName();
|
||||
}
|
||||
|
||||
setSelectedServicePreferences(context, serviceName);
|
||||
|
@ -55,7 +55,7 @@ public class ServiceHelper {
|
|||
|
||||
public static void setSelectedServiceId(Context context, String 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);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ThemeHelper {
|
|||
else if (selectedTheme.equals(blackTheme)) themeName = "BlackTheme";
|
||||
else if (selectedTheme.equals(darkTheme)) themeName = "DarkTheme";
|
||||
|
||||
themeName += "." + service.getServiceInfo().name;
|
||||
themeName += "." + service.getServiceInfo().getName();
|
||||
int resourceId = context.getResources().getIdentifier(themeName, "style", context.getPackageName());
|
||||
|
||||
if (resourceId > 0) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<string name="channel_unsubscribed">Channel unsubscribed</string>
|
||||
<string name="subscription_change_failed">Unable to change 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_subscriptions">Subscriptions</string>
|
||||
|
@ -369,7 +369,7 @@
|
|||
|
||||
|
||||
<!-- 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_settings_title">Preferred player</string>
|
||||
|
||||
|
|
|
@ -74,12 +74,6 @@
|
|||
android:layout="@layout/settings_category_header_layout"
|
||||
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
|
||||
android:defaultValue="@string/preferred_player_default"
|
||||
android:entries="@array/preferred_player_description_list"
|
||||
|
|
Loading…
Reference in a new issue