diff --git a/.gitignore b/.gitignore index 5c896ea..defe7d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,12 @@ *.pyc +app/gradle/wrapper/* +app/gradlew +app/gradlew.bat +app/gradle.properties +app/build/* +app/app/build/* +app/app/release/* +app/.idea/* +app/.gradle/* +app/gradle/* sources.json diff --git a/app/app/build.gradle b/app/app/build.gradle new file mode 100644 index 0000000..33479d4 --- /dev/null +++ b/app/app/build.gradle @@ -0,0 +1,35 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdkVersion 29 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "it.purser.stream" + minSdkVersion 25 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' +} \ No newline at end of file diff --git a/app/app/proguard-rules.pro b/app/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/app/src/androidTest/java/it/purser/stream/ExampleInstrumentedTest.java b/app/app/src/androidTest/java/it/purser/stream/ExampleInstrumentedTest.java new file mode 100644 index 0000000..79b9227 --- /dev/null +++ b/app/app/src/androidTest/java/it/purser/stream/ExampleInstrumentedTest.java @@ -0,0 +1,25 @@ +package it.purser.stream; + +import android.content.Context; +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("it.purser.stream", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/app/src/main/AndroidManifest.xml b/app/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..108e6b4 --- /dev/null +++ b/app/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/app/src/main/java/it/purser/stream/MainActivity.java b/app/app/src/main/java/it/purser/stream/MainActivity.java new file mode 100644 index 0000000..7ad1449 --- /dev/null +++ b/app/app/src/main/java/it/purser/stream/MainActivity.java @@ -0,0 +1,12 @@ +package it.purser.stream; + +import android.app.Activity; +import android.os.Bundle; + +public class MainActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } +} \ No newline at end of file diff --git a/app/app/src/main/java/it/purser/stream/ShareActivity.java b/app/app/src/main/java/it/purser/stream/ShareActivity.java new file mode 100644 index 0000000..0fc66ac --- /dev/null +++ b/app/app/src/main/java/it/purser/stream/ShareActivity.java @@ -0,0 +1,45 @@ +package it.purser.stream; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import java.util.HashSet; +import java.util.Locale; + +public class ShareActivity extends Activity { + private Uri getSharedLink() { + HashSet domains = new HashSet(); + domains.add("youtu.be"); + + Intent intent = getIntent(); + Bundle bundle = intent.getExtras(); + for(String key: bundle.keySet()) { + try { + String txt = (String) bundle.get(key); + Uri uri = Uri.parse(txt); + String host = uri.getHost().toLowerCase(Locale.ROOT); + if(domains.contains(host)) { + return uri; + } + } catch(Exception e) {} + } + return null; + } + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + Uri uri = getSharedLink(); + if(uri != null) { + Uri.Builder builder = new Uri.Builder(); + builder.authority("stream.purser.it"); + builder.scheme("https"); + builder.path(uri.getPath()); + builder.appendQueryParameter("provider", "youtube"); + builder.appendQueryParameter("render", "true"); + Intent launch = new Intent(Intent.ACTION_VIEW, builder.build()); + startActivity(launch); + } + } +} \ No newline at end of file diff --git a/app/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..1ee1493 --- /dev/null +++ b/app/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/app/src/main/res/drawable/ic_launcher_background.xml b/app/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..956b344 --- /dev/null +++ b/app/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/app/src/main/res/layout/activity_main.xml b/app/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..f9f6f0b --- /dev/null +++ b/app/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/app/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..bbd3e02 --- /dev/null +++ b/app/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..bbd3e02 --- /dev/null +++ b/app/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a571e60 Binary files /dev/null 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 new file mode 100644 index 0000000..61da551 Binary files /dev/null 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 new file mode 100644 index 0000000..c41dd28 Binary files /dev/null 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 new file mode 100644 index 0000000..db5080a Binary files /dev/null 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 new file mode 100644 index 0000000..6dba46d Binary files /dev/null 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 new file mode 100644 index 0000000..da31a87 Binary files /dev/null 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 new file mode 100644 index 0000000..15ac681 Binary files /dev/null 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 new file mode 100644 index 0000000..b216f2d Binary files /dev/null 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 new file mode 100644 index 0000000..f25a419 Binary files /dev/null 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 new file mode 100644 index 0000000..e96783c Binary files /dev/null and b/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/app/src/main/res/values-night/themes.xml b/app/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..3d57a7d --- /dev/null +++ b/app/app/src/main/res/values-night/themes.xml @@ -0,0 +1,4 @@ + + +