1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 04:22:30 +01:00

Made youtu.be links be vieweble through NewPipe, and fixed InfoBar design.

This commit is contained in:
Christian Schabesberger 2015-09-10 20:42:39 +02:00
parent e38f90757a
commit fde0b2ae7f
7 changed files with 69 additions and 13 deletions

View File

@ -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"

View File

@ -120,7 +120,7 @@ public class PlayVideoActivity extends AppCompatActivity {
} }
} }
}); });
hideUi(); showUi();
} }
@Override @Override

View File

@ -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);
} }

View File

@ -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);
if(uri.getHost().contains("youtube")) {
String query = uri.getQuery();
String queryElements[] = query.split("&"); String queryElements[] = query.split("&");
Map<String, String> queryArguments = new HashMap<>(); Map<String, String> queryArguments = new HashMap<>();
for(String e : queryElements) { for (String e : queryElements) {
String[] s = e.split("="); String[] s = e.split("=");
queryArguments.put(s[0], s[1]); queryArguments.put(s[0], s[1]);
} }
return queryArguments.get("v"); 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);
}
} 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

View 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>

View File

@ -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>

View File

@ -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">