From f722ee9595207b3d110fbd9fc80a8f31e2a16993 Mon Sep 17 00:00:00 2001 From: Mondei1 Date: Mon, 19 Oct 2020 22:19:28 +0200 Subject: [PATCH] Android project added - Android can now send messages over RabbitMQ to the backend. --- android/.gitignore | 15 ++ android/.idea/.gitignore | 3 + android/.idea/.name | 1 + android/.idea/compiler.xml | 6 + android/.idea/gradle.xml | 23 ++ android/.idea/jarRepositories.xml | 25 ++ android/.idea/misc.xml | 9 + android/.idea/vcs.xml | 6 + android/app/.gitignore | 1 + android/app/build.gradle | 48 ++++ android/app/proguard-rules.pro | 21 ++ .../livebeat/ExampleInstrumentedTest.kt | 24 ++ android/app/src/main/AndroidManifest.xml | 28 +++ .../de/nicolasklier/livebeat/FirstFragment.kt | 31 +++ .../de/nicolasklier/livebeat/MainActivity.kt | 40 ++++ .../nicolasklier/livebeat/SecondFragment.kt | 31 +++ .../nicolasklier/livebeat/TrackerService.java | 96 ++++++++ .../drawable-v24/ic_launcher_foreground.xml | 30 +++ .../res/drawable/ic_launcher_background.xml | 170 +++++++++++++ .../app/src/main/res/layout/activity_main.xml | 33 +++ .../app/src/main/res/layout/content_main.xml | 19 ++ .../src/main/res/layout/fragment_first.xml | 28 +++ .../src/main/res/layout/fragment_second.xml | 27 +++ android/app/src/main/res/menu/menu_main.xml | 10 + .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3593 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5339 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2636 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 3388 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4926 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7472 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7909 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 11873 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10652 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 16570 bytes .../app/src/main/res/navigation/nav_graph.xml | 28 +++ .../app/src/main/res/values-night/themes.xml | 16 ++ android/app/src/main/res/values/colors.xml | 10 + android/app/src/main/res/values/dimens.xml | 3 + android/app/src/main/res/values/strings.xml | 12 + android/app/src/main/res/values/themes.xml | 25 ++ .../nicolasklier/livebeat/ExampleUnitTest.kt | 17 ++ android/build.gradle | 26 ++ android/gradle.properties | 21 ++ android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + android/gradlew | 172 ++++++++++++++ android/gradlew.bat | 84 +++++++ android/settings.gradle | 2 + backend/.gitignore | 4 +- backend/app.ts | 34 ++- backend/lib/rabbit.ts | 21 ++ backend/package-lock.json | 91 +++++++ backend/package.json | 4 +- logo.svg | 223 ++++++++++++++++++ 56 files changed, 1522 insertions(+), 12 deletions(-) create mode 100644 android/.gitignore create mode 100644 android/.idea/.gitignore create mode 100644 android/.idea/.name create mode 100644 android/.idea/compiler.xml create mode 100644 android/.idea/gradle.xml create mode 100644 android/.idea/jarRepositories.xml create mode 100644 android/.idea/misc.xml create mode 100644 android/.idea/vcs.xml create mode 100644 android/app/.gitignore create mode 100644 android/app/build.gradle create mode 100644 android/app/proguard-rules.pro create mode 100644 android/app/src/androidTest/java/de/nicolasklier/livebeat/ExampleInstrumentedTest.kt create mode 100644 android/app/src/main/AndroidManifest.xml create mode 100644 android/app/src/main/java/de/nicolasklier/livebeat/FirstFragment.kt create mode 100644 android/app/src/main/java/de/nicolasklier/livebeat/MainActivity.kt create mode 100644 android/app/src/main/java/de/nicolasklier/livebeat/SecondFragment.kt create mode 100644 android/app/src/main/java/de/nicolasklier/livebeat/TrackerService.java create mode 100644 android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 android/app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 android/app/src/main/res/layout/activity_main.xml create mode 100644 android/app/src/main/res/layout/content_main.xml create mode 100644 android/app/src/main/res/layout/fragment_first.xml create mode 100644 android/app/src/main/res/layout/fragment_second.xml create mode 100644 android/app/src/main/res/menu/menu_main.xml create mode 100644 android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/navigation/nav_graph.xml create mode 100644 android/app/src/main/res/values-night/themes.xml create mode 100644 android/app/src/main/res/values/colors.xml create mode 100644 android/app/src/main/res/values/dimens.xml create mode 100644 android/app/src/main/res/values/strings.xml create mode 100644 android/app/src/main/res/values/themes.xml create mode 100644 android/app/src/test/java/de/nicolasklier/livebeat/ExampleUnitTest.kt create mode 100644 android/build.gradle create mode 100644 android/gradle.properties create mode 100644 android/gradle/wrapper/gradle-wrapper.jar create mode 100644 android/gradle/wrapper/gradle-wrapper.properties create mode 100644 android/gradlew create mode 100644 android/gradlew.bat create mode 100644 android/settings.gradle create mode 100644 backend/lib/rabbit.ts create mode 100644 logo.svg diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/android/.idea/.gitignore b/android/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/android/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/android/.idea/.name b/android/.idea/.name new file mode 100644 index 0000000..2edba6b --- /dev/null +++ b/android/.idea/.name @@ -0,0 +1 @@ +Livebeat \ No newline at end of file diff --git a/android/.idea/compiler.xml b/android/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/android/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android/.idea/gradle.xml b/android/.idea/gradle.xml new file mode 100644 index 0000000..b617266 --- /dev/null +++ b/android/.idea/gradle.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/android/.idea/jarRepositories.xml b/android/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/android/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml new file mode 100644 index 0000000..d5d35ec --- /dev/null +++ b/android/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/android/.idea/vcs.xml b/android/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/android/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android/app/.gitignore b/android/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/android/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..fa4d776 --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,48 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.1" + + defaultConfig { + applicationId "de.nicolasklier.livebeat" + minSdkVersion 27 + targetSdkVersion 30 + 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 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.2.0' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'com.google.android.material:material:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2' + implementation 'androidx.navigation:navigation-ui-ktx:2.2.2' + implementation 'com.rabbitmq:amqp-client:5.9.0' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} \ No newline at end of file diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/android/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/android/app/src/androidTest/java/de/nicolasklier/livebeat/ExampleInstrumentedTest.kt b/android/app/src/androidTest/java/de/nicolasklier/livebeat/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..a809736 --- /dev/null +++ b/android/app/src/androidTest/java/de/nicolasklier/livebeat/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package de.nicolasklier.livebeat + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("de.nicolasklier.livebeat", appContext.packageName) + } +} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..61b823e --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/java/de/nicolasklier/livebeat/FirstFragment.kt b/android/app/src/main/java/de/nicolasklier/livebeat/FirstFragment.kt new file mode 100644 index 0000000..2b28dad --- /dev/null +++ b/android/app/src/main/java/de/nicolasklier/livebeat/FirstFragment.kt @@ -0,0 +1,31 @@ +package de.nicolasklier.livebeat + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import androidx.navigation.fragment.findNavController + +/** + * A simple [Fragment] subclass as the default destination in the navigation. + */ +class FirstFragment : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_first, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + view.findViewById