Made youtu.be links be vieweble through NewPipe, and fixed InfoBar design.
This commit is contained in:
parent
e38f90757a
commit
fde0b2ae7f
7 changed files with 69 additions and 13 deletions
|
@ -55,6 +55,14 @@
|
|||
android:host="m.youtube.com"
|
||||
android:scheme="https"
|
||||
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>
|
||||
</activity>
|
||||
<activity android:name=".PlayVideoActivity"
|
||||
|
|
|
@ -120,7 +120,7 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
});
|
||||
hideUi();
|
||||
showUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -120,7 +120,7 @@ public class VideoListAdapter extends BaseAdapter {
|
|||
holder.itemDurationView.setText(videoList.get(position).duration);
|
||||
|
||||
if(listView.isItemChecked(position)) {
|
||||
convertView.setBackgroundColor(context.getResources().getColor(R.color.actionBarColorYoutube));
|
||||
convertView.setBackgroundColor(context.getResources().getColor(R.color.primaryColorYoutube));
|
||||
} else {
|
||||
convertView.setBackgroundColor(0);
|
||||
}
|
||||
|
|
|
@ -95,19 +95,32 @@ public class YoutubeExtractor implements Extractor {
|
|||
@Override
|
||||
public String getVideoId(String videoUrl) {
|
||||
try {
|
||||
String query = (new URI(videoUrl)).getQuery();
|
||||
String queryElements[] = query.split("&");
|
||||
Map<String, String> queryArguments = new HashMap<>();
|
||||
for(String e : queryElements) {
|
||||
String[] s = e.split("=");
|
||||
queryArguments.put(s[0], s[1]);
|
||||
URI uri = new URI(videoUrl);
|
||||
if(uri.getHost().contains("youtube")) {
|
||||
String query = uri.getQuery();
|
||||
String queryElements[] = query.split("&");
|
||||
Map<String, String> queryArguments = new HashMap<>();
|
||||
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);
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@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"?>
|
||||
<resources>
|
||||
<color name="actionBarColorYoutube">#dd0000</color>
|
||||
<color name="primaryColorYoutube">#dd0000</color>
|
||||
<color name="primaryColorDarkYoutube">#bb0000</color>
|
||||
<color name="black_overlay">#66000000</color>
|
||||
</resources>
|
|
@ -4,13 +4,15 @@
|
|||
<style name="AppTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="android:actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||
<item name="actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||
<item name="colorPrimary">@color/primaryColorYoutube</item>
|
||||
<item name="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/actionBarColorYoutube</item>
|
||||
<item name="background">@color/actionBarColorYoutube</item>
|
||||
<item name="android:background">@color/primaryColorYoutube</item>
|
||||
<item name="background">@color/primaryColorYoutube</item>
|
||||
</style>
|
||||
|
||||
<style name="FullscreenTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
|
|
Loading…
Reference in a new issue