diff --git a/app/app/build.gradle b/app/app/build.gradle index ebc5c70..331b04c 100644 --- a/app/app/build.gradle +++ b/app/app/build.gradle @@ -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" } diff --git a/app/app/src/main/ic_launcher-playstore.png b/app/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..a61a702 Binary files /dev/null and b/app/app/src/main/ic_launcher-playstore.png differ diff --git a/app/app/src/main/java/it/purser/stream/ShareActivity.java b/app/app/src/main/java/it/purser/stream/ShareActivity.java index 6a65694..7007cc6 100644 --- a/app/app/src/main/java/it/purser/stream/ShareActivity.java +++ b/app/app/src/main/java/it/purser/stream/ShareActivity.java @@ -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 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 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"); diff --git a/app/app/src/main/res/drawable/ic_launcher_background.xml b/app/app/src/main/res/drawable/ic_launcher_background.xml index 956b344..ca3826a 100644 --- a/app/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,10 +1,10 @@ + android:height="108dp" + android:width="108dp" + android:viewportHeight="108" + android:viewportWidth="108" + xmlns:android="http://schemas.android.com/apk/res/android"> + + + + + diff --git a/app/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/app/src/main/res/mipmap-hdpi/ic_launcher.png index a571e60..2737590 100644 Binary files a/app/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index 61da551..4d9aa95 100644 Binary files a/app/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/app/src/main/res/mipmap-mdpi/ic_launcher.png index c41dd28..9a45049 100644 Binary files a/app/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index db5080a..396503b 100644 Binary files a/app/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 6dba46d..00d318e 100644 Binary files a/app/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index da31a87..018bc61 100644 Binary files a/app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 15ac681..e1fe804 100644 Binary files a/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index b216f2d..61f1433 100644 Binary files a/app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index f25a419..b543f21 100644 Binary files a/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index e96783c..1bbd3b2 100644 Binary files a/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ