This commit is contained in:
Roy Olav Purser 2021-05-26 14:02:47 +02:00
parent 007aafafd5
commit 2d2febb39e
Signed by: roypur
GPG Key ID: E14D26A036F21656
15 changed files with 45 additions and 21 deletions

View File

@ -10,8 +10,8 @@ android {
applicationId "it.purser.stream"
minSdkVersion 25
targetSdkVersion 29
versionCode 106
versionName "106.0"
versionCode 107
versionName "107.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -4,16 +4,25 @@ import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import java.util.HashSet;
import java.util.TreeMap;
import java.util.Locale;
public class ShareActivity extends Activity {
private Uri getSharedLink() {
HashSet<String> domains = new HashSet<>();
domains.add("youtu.be");
domains.add("youtube.com");
domains.add("www.youtube.com");
domains.add("tv.nrk.no");
private class Upstream {
private Uri uri = null;
private String provider = null;
private Upstream(Uri uri, String provider) {
this.uri = uri;
this.provider = provider;
}
}
private Upstream getSharedLink() {
TreeMap<String,String> domains = new TreeMap<>();
domains.put("youtu.be", "youtube");
domains.put("youtube.com", "youtube");
domains.put("www.youtube.com", "youtube");
domains.put("tv.nrk.no", "nrk");
domains.put("nx12210.your-storageshare.de", "nextcloud");
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
@ -22,7 +31,7 @@ public class ShareActivity extends Activity {
String txt = (String) bundle.get(key);
Uri uri = Uri.parse(txt);
String host = uri.getHost().toLowerCase(Locale.ROOT);
if(domains.contains(host)) {
if(domains.containsKey(host)) {
if(host.contains("youtube.com")) {
Uri.Builder builder = new Uri.Builder();
builder.authority(host);
@ -30,10 +39,10 @@ public class ShareActivity extends Activity {
String path = uri.getQueryParameter("v");
if(path != null) {
builder.path(path);
return builder.build();
return new Upstream(builder.build(), domains.get(host));
}
}
return uri;
return new Upstream(uri, domains.get(host));
}
} catch(Exception e) {}
}
@ -42,13 +51,13 @@ public class ShareActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri uri = getSharedLink();
if(uri != null) {
Upstream upstream = getSharedLink();
if(upstream != null) {
Uri.Builder builder = new Uri.Builder();
builder.authority("stream.purser.it");
builder.scheme("https");
builder.path(uri.getPath());
builder.appendQueryParameter("provider", "youtube");
builder.path(upstream.uri.getPath());
builder.appendQueryParameter("provider", upstream.provider);
builder.appendQueryParameter("render", "true");
Intent launch = new Intent(Intent.ACTION_VIEW, builder.build());
launch.setPackage("com.android.chrome");

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="1.08"
android:scaleY="1.08">
<path
android:pathData="M50,50m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0"
android:fillColor="#000000"/>
<path
android:pathData="M30,20l0,60l55,-30z"
android:fillColor="#32cd32"/>
</group>
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB