diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..151dac0 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Jarvis Client Android \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index d2ce72d..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 85b88eb..c8c4fbe 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,9 +3,12 @@ diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..29f0cab --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 31 + + defaultConfig { + applicationId "ch.mathieubroillet.jarvis.android" + minSdk 27 + targetSdk 31 + 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 { + + implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'com.google.android.material:material:1.4.0' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + + implementation 'ai.picovoice:porcupine-android:1.9.5' +} \ No newline at end of file diff --git a/jarvis-client-app/proguard-rules.pro b/app/proguard-rules.pro similarity index 94% rename from jarvis-client-app/proguard-rules.pro rename to app/proguard-rules.pro index f1b4245..481bb43 100644 --- a/jarvis-client-app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,4 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/ch/mathieubroillet/jarvis/android/ExampleInstrumentedTest.java b/app/src/androidTest/java/ch/mathieubroillet/jarvis/android/ExampleInstrumentedTest.java new file mode 100644 index 0000000..2be8d16 --- /dev/null +++ b/app/src/androidTest/java/ch/mathieubroillet/jarvis/android/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package ch.mathieubroillet.jarvis.android; + +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("ch.mathieubroillet.jarvis.android", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/jarvis-client-app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml similarity index 65% rename from jarvis-client-app/src/main/AndroidManifest.xml rename to app/src/main/AndroidManifest.xml index be02c10..692739b 100644 --- a/jarvis-client-app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="ch.mathieubroillet.jarvis.android"> @@ -8,29 +8,34 @@ + android:showOnLockScreen="true" + android:theme="@style/Theme.JarvisClientAndroid"> - + android:exported="false"/> - + + + - + \ No newline at end of file diff --git a/app/src/main/java/ch/mathieubroillet/jarvis/android/ListeningActivity.java b/app/src/main/java/ch/mathieubroillet/jarvis/android/ListeningActivity.java new file mode 100644 index 0000000..3da7d67 --- /dev/null +++ b/app/src/main/java/ch/mathieubroillet/jarvis/android/ListeningActivity.java @@ -0,0 +1,24 @@ +package ch.mathieubroillet.jarvis.android; + +import android.app.KeyguardManager; +import android.content.Context; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; + +public class ListeningActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // used for turning on the screen and show the activity + setShowWhenLocked(true); + setTurnScreenOn(true); + KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); + if (keyguardManager != null) + keyguardManager.requestDismissKeyguard(this, null); + + setContentView(R.layout.activity_listening); + + } +} \ No newline at end of file diff --git a/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/MainActivity.java b/app/src/main/java/ch/mathieubroillet/jarvis/android/Main.java similarity index 95% rename from jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/MainActivity.java rename to app/src/main/java/ch/mathieubroillet/jarvis/android/Main.java index 23a24b9..70f7e19 100644 --- a/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/MainActivity.java +++ b/app/src/main/java/ch/mathieubroillet/jarvis/android/Main.java @@ -12,9 +12,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; -import ai.picovoice.android.R; - -public class MainActivity extends AppCompatActivity { +public class Main extends AppCompatActivity { private boolean hasPermissions() { return ActivityCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED && diff --git a/app/src/main/java/ch/mathieubroillet/jarvis/android/Notifications.java b/app/src/main/java/ch/mathieubroillet/jarvis/android/Notifications.java new file mode 100644 index 0000000..820e1e0 --- /dev/null +++ b/app/src/main/java/ch/mathieubroillet/jarvis/android/Notifications.java @@ -0,0 +1,19 @@ +package ch.mathieubroillet.jarvis.android; + + +import android.app.NotificationChannel; +import android.app.NotificationManager; + +public class Notifications { + + public static final String CHANNEL_ID = "JarvisChannel"; + + public static void createNotificationChannel(NotificationManager manager) { + NotificationChannel notificationChannel = new NotificationChannel( + CHANNEL_ID, + "Jarvis", + NotificationManager.IMPORTANCE_HIGH); + + manager.createNotificationChannel(notificationChannel); + } +} diff --git a/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/PorcupineService.java b/app/src/main/java/ch/mathieubroillet/jarvis/android/PorcupineService.java similarity index 74% rename from jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/PorcupineService.java rename to app/src/main/java/ch/mathieubroillet/jarvis/android/PorcupineService.java index 6e4ceef..68c0af3 100644 --- a/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/PorcupineService.java +++ b/app/src/main/java/ch/mathieubroillet/jarvis/android/PorcupineService.java @@ -1,5 +1,6 @@ package ch.mathieubroillet.jarvis.android; + import android.app.Notification; import android.app.Service; import android.content.Intent; @@ -23,6 +24,7 @@ public class PorcupineService extends Service { Notification notification = new NotificationCompat.Builder(this, Notifications.CHANNEL_ID) .setContentTitle("Jarvis") .setContentText("Say 'Jarvis' and ask me anything.") + .setSmallIcon(R.drawable.ic_launcher_foreground) .build(); startForeground(4002, notification); @@ -41,17 +43,6 @@ public class PorcupineService extends Service { Toast.makeText(this, "Jarvis detecté", Toast.LENGTH_SHORT).show(); - - /*Notification n = new NotificationCompat.Builder(this, CHANNEL_ID) - .setContentTitle("Wake word") - .setContentText("Detected") - .setSmallIcon(R.drawable.ic_launcher_background) - .setContentIntent(contentIntent) - .build(); - - NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - assert notificationManager != null; - notificationManager.notify(1234, n);*/ }); porcupineManager.start(); } catch (PorcupineException e) { diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jarvis-client-app/src/main/res/drawable/rounded.xml b/app/src/main/res/drawable/rounded_white_on_top.xml similarity index 82% rename from jarvis-client-app/src/main/res/drawable/rounded.xml rename to app/src/main/res/drawable/rounded_white_on_top.xml index b019eee..977bcce 100644 --- a/jarvis-client-app/src/main/res/drawable/rounded.xml +++ b/app/src/main/res/drawable/rounded_white_on_top.xml @@ -12,8 +12,7 @@ android:top="15dp" /> - + \ No newline at end of file diff --git a/jarvis-client-app/src/main/res/layout/activity_listening.xml b/app/src/main/res/layout/activity_listening.xml similarity index 57% rename from jarvis-client-app/src/main/res/layout/activity_listening.xml rename to app/src/main/res/layout/activity_listening.xml index 7d95359..52810c9 100644 --- a/jarvis-client-app/src/main/res/layout/activity_listening.xml +++ b/app/src/main/res/layout/activity_listening.xml @@ -7,19 +7,24 @@ android:layout_height="match_parent" android:background="#66000000" - tools:context="ch.mathieubroillet.jarvis.android.android.ListeningActivity"> + tools:context="ch.mathieubroillet.jarvis.android.ListeningActivity"> + android:layout_alignParentStart="false" + android:layout_alignParentBottom="true" + android:background="@drawable/rounded_white_on_top"> + android:layout_height="wrap_content" + android:layout_alignParentStart="true" + android:layout_alignParentEnd="true" + android:layout_alignParentBottom="true" /> diff --git a/jarvis-client-app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml similarity index 78% rename from jarvis-client-app/src/main/res/layout/activity_main.xml rename to app/src/main/res/layout/activity_main.xml index 205adef..b7e0382 100644 --- a/jarvis-client-app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="ch.mathieubroillet.jarvis.android.android.MainActivity"> + tools:context=".Main"> + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/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/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..287aba7 --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..d7b274c --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Jarvis Client Android + \ No newline at end of file diff --git a/jarvis-client-app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml similarity index 57% rename from jarvis-client-app/src/main/res/values/styles.xml rename to app/src/main/res/values/styles.xml index 380205b..8d625f5 100644 --- a/jarvis-client-app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,13 +1,6 @@ + - - - - - + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..76c29b4 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app/src/test/java/ch/mathieubroillet/jarvis/android/ExampleUnitTest.java b/app/src/test/java/ch/mathieubroillet/jarvis/android/ExampleUnitTest.java new file mode 100644 index 0000000..73ca48e --- /dev/null +++ b/app/src/test/java/ch/mathieubroillet/jarvis/android/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package ch.mathieubroillet.jarvis.android; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index e7b6ea7..216d57c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,23 +1,17 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.0' + classpath "com.android.tools.build:gradle:7.0.0" - } -} - -allprojects { - repositories { - google() - mavenCentral() + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files } } task clean(type: Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 199d16e..52f5917 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,15 +6,14 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx1536m +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true # AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK +# Android operating system, and which are packaged with your app"s APK # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true - +android.enableJetifier=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index f6b961f..e708b1c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aedd0bd..0589ead 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Nov 26 20:47:00 PST 2020 +#Fri Aug 13 21:34:17 CEST 2021 distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index cccdd3d..4f906e0 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -66,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -109,10 +126,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -138,19 +156,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -159,14 +177,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f955316..107acd3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/jarvis-client-app/.gitignore b/jarvis-client-app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/jarvis-client-app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/jarvis-client-app/build.gradle b/jarvis-client-app/build.gradle deleted file mode 100644 index 4429ac9..0000000 --- a/jarvis-client-app/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion 30 - defaultConfig { - applicationId "com.example.androidforegroundservice" - minSdkVersion 19 - targetSdkVersion 30 - versionCode 1 - versionName "1.0" - } - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } - buildFeatures { - viewBinding true - } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.3.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' - implementation 'ai.picovoice:porcupine-android:1.9.5' - implementation 'com.google.android.material:material:1.4.0' - implementation 'androidx.navigation:navigation-fragment:2.3.5' - implementation 'androidx.navigation:navigation-ui:2.3.5' -} diff --git a/jarvis-client-app/src/main/ic_launcher-playstore.png b/jarvis-client-app/src/main/ic_launcher-playstore.png deleted file mode 100644 index 8c2c990..0000000 Binary files a/jarvis-client-app/src/main/ic_launcher-playstore.png and /dev/null differ diff --git a/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/ListeningActivity.java b/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/ListeningActivity.java deleted file mode 100644 index 32ac552..0000000 --- a/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/ListeningActivity.java +++ /dev/null @@ -1,35 +0,0 @@ -package ch.mathieubroillet.jarvis.android; - -import android.app.KeyguardManager; -import android.content.Context; -import android.os.Build; -import android.os.Bundle; -import android.view.WindowManager; - -import androidx.appcompat.app.AppCompatActivity; - -import ai.picovoice.android.R; - -public class ListeningActivity extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // used for turning on the screen and show the activity - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { - setShowWhenLocked(true); - setTurnScreenOn(true); - KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); - if (keyguardManager != null) - keyguardManager.requestDismissKeyguard(this, null); - } else { - getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | - WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | - WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); - } - - setContentView(R.layout.activity_listening); - - } -} \ No newline at end of file diff --git a/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/Notifications.java b/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/Notifications.java deleted file mode 100644 index 8f27e7c..0000000 --- a/jarvis-client-app/src/main/java/ch/mathieubroillet/jarvis/android/Notifications.java +++ /dev/null @@ -1,22 +0,0 @@ -package ch.mathieubroillet.jarvis.android; - -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.os.Build; - -public class Notifications { - - public static final String CHANNEL_ID = "JarvisChannel"; - - - public static void createNotificationChannel(NotificationManager manager) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel notificationChannel = new NotificationChannel( - CHANNEL_ID, - "Jarvis", - NotificationManager.IMPORTANCE_HIGH); - - manager.createNotificationChannel(notificationChannel); - } - } -} diff --git a/jarvis-client-app/src/main/res/navigation/nav_graph.xml b/jarvis-client-app/src/main/res/navigation/nav_graph.xml deleted file mode 100644 index ce447c6..0000000 --- a/jarvis-client-app/src/main/res/navigation/nav_graph.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/jarvis-client-app/src/main/res/values-land/dimens.xml b/jarvis-client-app/src/main/res/values-land/dimens.xml deleted file mode 100644 index 22d7f00..0000000 --- a/jarvis-client-app/src/main/res/values-land/dimens.xml +++ /dev/null @@ -1,3 +0,0 @@ - - 48dp - \ No newline at end of file diff --git a/jarvis-client-app/src/main/res/values-w1240dp/dimens.xml b/jarvis-client-app/src/main/res/values-w1240dp/dimens.xml deleted file mode 100644 index d73f4a3..0000000 --- a/jarvis-client-app/src/main/res/values-w1240dp/dimens.xml +++ /dev/null @@ -1,3 +0,0 @@ - - 200dp - \ No newline at end of file diff --git a/jarvis-client-app/src/main/res/values-w600dp/dimens.xml b/jarvis-client-app/src/main/res/values-w600dp/dimens.xml deleted file mode 100644 index 22d7f00..0000000 --- a/jarvis-client-app/src/main/res/values-w600dp/dimens.xml +++ /dev/null @@ -1,3 +0,0 @@ - - 48dp - \ No newline at end of file diff --git a/jarvis-client-app/src/main/res/values/colors.xml b/jarvis-client-app/src/main/res/values/colors.xml deleted file mode 100644 index 9a782b1..0000000 --- a/jarvis-client-app/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - #377DFF - #25187E - #00E5C3 - diff --git a/jarvis-client-app/src/main/res/values/dimens.xml b/jarvis-client-app/src/main/res/values/dimens.xml deleted file mode 100644 index 125df87..0000000 --- a/jarvis-client-app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,3 +0,0 @@ - - 16dp - \ No newline at end of file diff --git a/jarvis-client-app/src/main/res/values/strings.xml b/jarvis-client-app/src/main/res/values/strings.xml deleted file mode 100644 index 09b20ec..0000000 --- a/jarvis-client-app/src/main/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - Jarvis Service - ListeningActivity - diff --git a/jarvis-client-app/src/main/res/values/themes.xml b/jarvis-client-app/src/main/res/values/themes.xml deleted file mode 100644 index d907dd5..0000000 --- a/jarvis-client-app/src/main/res/values/themes.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - -