mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-21 18:42:35 +01:00
Made youtu.be links be vieweble through NewPipe, and fixed InfoBar design.
This commit is contained in:
parent
e38f90757a
commit
fde0b2ae7f
@ -55,6 +55,14 @@
|
|||||||
android:host="m.youtube.com"
|
android:host="m.youtube.com"
|
||||||
android:scheme="https"
|
android:scheme="https"
|
||||||
android:pathPrefix="/watch"/>
|
android:pathPrefix="/watch"/>
|
||||||
|
<data
|
||||||
|
android:host="youtu.be"
|
||||||
|
android:scheme="https"
|
||||||
|
android:pathPrefix="/"/>
|
||||||
|
<data
|
||||||
|
android:host="youtu.be"
|
||||||
|
android:scheme="http"
|
||||||
|
android:pathPrefix="/"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".PlayVideoActivity"
|
<activity android:name=".PlayVideoActivity"
|
||||||
|
@ -120,7 +120,7 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
hideUi();
|
showUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,7 +120,7 @@ public class VideoListAdapter extends BaseAdapter {
|
|||||||
holder.itemDurationView.setText(videoList.get(position).duration);
|
holder.itemDurationView.setText(videoList.get(position).duration);
|
||||||
|
|
||||||
if(listView.isItemChecked(position)) {
|
if(listView.isItemChecked(position)) {
|
||||||
convertView.setBackgroundColor(context.getResources().getColor(R.color.actionBarColorYoutube));
|
convertView.setBackgroundColor(context.getResources().getColor(R.color.primaryColorYoutube));
|
||||||
} else {
|
} else {
|
||||||
convertView.setBackgroundColor(0);
|
convertView.setBackgroundColor(0);
|
||||||
}
|
}
|
||||||
|
@ -95,19 +95,32 @@ public class YoutubeExtractor implements Extractor {
|
|||||||
@Override
|
@Override
|
||||||
public String getVideoId(String videoUrl) {
|
public String getVideoId(String videoUrl) {
|
||||||
try {
|
try {
|
||||||
String query = (new URI(videoUrl)).getQuery();
|
URI uri = new URI(videoUrl);
|
||||||
String queryElements[] = query.split("&");
|
if(uri.getHost().contains("youtube")) {
|
||||||
Map<String, String> queryArguments = new HashMap<>();
|
String query = uri.getQuery();
|
||||||
for(String e : queryElements) {
|
String queryElements[] = query.split("&");
|
||||||
String[] s = e.split("=");
|
Map<String, String> queryArguments = new HashMap<>();
|
||||||
queryArguments.put(s[0], s[1]);
|
for (String e : queryElements) {
|
||||||
|
String[] s = e.split("=");
|
||||||
|
queryArguments.put(s[0], s[1]);
|
||||||
|
}
|
||||||
|
return queryArguments.get("v");
|
||||||
|
} else if(uri.getHost().contains("youtu.be")) {
|
||||||
|
// uri.getRawPath() does somehow not return the last character.
|
||||||
|
// so we do a workaround instead.
|
||||||
|
//return uri.getRawPath();
|
||||||
|
String url[] = videoUrl.split("/");
|
||||||
|
return url[url.length-1];
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Error could not parse url: " + videoUrl);
|
||||||
|
|
||||||
}
|
}
|
||||||
return queryArguments.get("v");
|
} catch(Exception e) {
|
||||||
} catch(Exception e) {
|
|
||||||
Log.e(TAG, "Error could not parse url: " + videoUrl);
|
Log.e(TAG, "Error could not parse url: " + videoUrl);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
32
app/src/main/res/values-v21/styles.xml
Normal file
32
app/src/main/res/values-v21/styles.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light">
|
||||||
|
<item name="android:actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||||
|
<item name="actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||||
|
<item name="android:colorPrimary">@color/primaryColorYoutube</item>
|
||||||
|
<item name="android:colorPrimaryDark">@color/primaryColorDarkYoutube</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="NewPipeActionbarTheme" parent="Widget.AppCompat.Light.ActionBar.Solid" >
|
||||||
|
<item name="android:displayOptions">showHome</item>
|
||||||
|
<item name="displayOptions">showHome</item>
|
||||||
|
<item name="android:background">@color/primaryColorYoutube</item>
|
||||||
|
<item name="background">@color/primaryColorYoutube</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="FullscreenTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<item name="android:windowFullscreen">false</item>
|
||||||
|
<item name="android:windowActionBarOverlay">true</item>
|
||||||
|
<item name="windowActionBarOverlay">true</item>
|
||||||
|
<item name="android:actionBarStyle">@style/NewPipePlayerActionBarTheme</item>
|
||||||
|
<item name="actionBarStyle">@style/NewPipePlayerActionBarTheme</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="NewPipePlayerActionBarTheme" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse" >
|
||||||
|
<item name="android:displayOptions">showHome</item>
|
||||||
|
<item name="displayOptions">showHome</item>
|
||||||
|
<item name="android:background">@color/black_overlay</item>
|
||||||
|
<item name="background">@color/black_overlay</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="actionBarColorYoutube">#dd0000</color>
|
<color name="primaryColorYoutube">#dd0000</color>
|
||||||
|
<color name="primaryColorDarkYoutube">#bb0000</color>
|
||||||
<color name="black_overlay">#66000000</color>
|
<color name="black_overlay">#66000000</color>
|
||||||
</resources>
|
</resources>
|
@ -4,13 +4,15 @@
|
|||||||
<style name="AppTheme" parent="Theme.AppCompat.Light">
|
<style name="AppTheme" parent="Theme.AppCompat.Light">
|
||||||
<item name="android:actionBarStyle">@style/NewPipeActionbarTheme</item>
|
<item name="android:actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||||
<item name="actionBarStyle">@style/NewPipeActionbarTheme</item>
|
<item name="actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||||
|
<item name="colorPrimary">@color/primaryColorYoutube</item>
|
||||||
|
<item name="colorPrimaryDark">@color/primaryColorDarkYoutube</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="NewPipeActionbarTheme" parent="Widget.AppCompat.Light.ActionBar.Solid" >
|
<style name="NewPipeActionbarTheme" parent="Widget.AppCompat.Light.ActionBar.Solid" >
|
||||||
<item name="android:displayOptions">showHome</item>
|
<item name="android:displayOptions">showHome</item>
|
||||||
<item name="displayOptions">showHome</item>
|
<item name="displayOptions">showHome</item>
|
||||||
<item name="android:background">@color/actionBarColorYoutube</item>
|
<item name="android:background">@color/primaryColorYoutube</item>
|
||||||
<item name="background">@color/actionBarColorYoutube</item>
|
<item name="background">@color/primaryColorYoutube</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="FullscreenTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="FullscreenTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
Loading…
Reference in New Issue
Block a user