diff --git a/app/app.iml b/app/app.iml index 12607fd..292e30e 100644 --- a/app/app.iml +++ b/app/app.iml @@ -4,6 +4,8 @@ @@ -17,7 +19,7 @@ + + + + - - + + - + + - - - + + + - - - + + + + @@ -72,6 +91,7 @@ + @@ -79,6 +99,7 @@ + @@ -86,6 +107,7 @@ + @@ -93,6 +115,7 @@ + @@ -100,127 +123,101 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 0399c0c..c144061 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,6 +19,12 @@ android { versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + externalNativeBuild { + cmake { + cppFlags "-std=c++14" + } + } + } buildTypes { release { @@ -26,22 +32,28 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + externalNativeBuild { + cmake { + path "src/main/cpp/CMakeLists.txt" + version "3.10.2" + } + } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50" implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:support-v4:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation "org.jetbrains.anko:anko:0.10.8" - implementation 'com.ealva:ealvatag:0.4.2' - implementation 'com.ealva:ealvalog:0.3.0' - implementation 'com.ealva:ealvalog-core:0.3.0' - implementation 'com.ealva:ealvalog-android:0.3.0' - implementation 'com.google.guava:guava:20.0' - implementation 'com.squareup.okio:okio:1.11.0' + implementation 'com.ealva:ealvatag:0.4.3' + implementation 'com.ealva:ealvalog:0.5.0' + implementation 'com.ealva:ealvalog-core:0.5.0' + implementation 'com.ealva:ealvalog-android:0.5.0' + implementation 'com.google.guava:guava:23.0' + implementation 'com.squareup.okio:okio:2.4.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt new file mode 100644 index 0000000..b3dff0e --- /dev/null +++ b/app/src/main/cpp/CMakeLists.txt @@ -0,0 +1,53 @@ +# For more information about using CMake with Android Studio, read the +# documentation: https://d.android.com/studio/projects/add-native-code.html + +# Sets the minimum version of CMake required to build the native library. + +cmake_minimum_required(VERSION 3.4.1) + +# Creates and names a library, sets it as either STATIC +# or SHARED, and provides the relative paths to its source code. +# You can define multiple libraries, and CMake builds them for you. +# Gradle automatically packages shared libraries with your APK. + + +set (HEADERS + model/Song.h + ) + + +add_library( # Sets the name of the library. + native-lib + + # Sets the library as a shared library. + SHARED + + # Provides a relative path to your source file(s). + Demo.cpp + ${HEADERS} + ) + + +# Searches for a specified prebuilt library and stores the path as a +# variable. Because CMake includes system libraries in the search path by +# default, you only need to specify the name of the public NDK library +# you want to add. CMake verifies that the library exists before +# completing its build. + +find_library( # Sets the name of the path variable. + log-lib + + # Specifies the name of the NDK library that + # you want CMake to locate. + log ) + +# Specifies libraries CMake should link to your target library. You +# can link multiple libraries, such as libraries you define in this +# build script, prebuilt third-party libraries, or system libraries. + +target_link_libraries( # Specifies the target library. + native-lib + + # Links the target library to the log library + # included in the NDK. + ${log-lib} ) \ No newline at end of file diff --git a/app/src/main/cpp/Demo.cpp b/app/src/main/cpp/Demo.cpp new file mode 100644 index 0000000..cfc3688 --- /dev/null +++ b/app/src/main/cpp/Demo.cpp @@ -0,0 +1,37 @@ +// +// Created by brahmix on 9/26/19. +// + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "model/Song.h" + +int demoCall() +{ + model::Song song; + song.title = "hello"; + song.artist = "some artist"; + std::cout << "testing" << std::endl; + return 0; +} + +extern "C" +JNIEXPORT void + JNICALL +Java_com_example_mear_activities_MainActivity_test( + JNIEnv *env, + jobject /* this */) { + + demoCall(); +} \ No newline at end of file diff --git a/app/src/main/cpp/model/Song.h b/app/src/main/cpp/model/Song.h new file mode 100644 index 0000000..f7a848d --- /dev/null +++ b/app/src/main/cpp/model/Song.h @@ -0,0 +1,25 @@ +// +// Created by brahmix on 9/26/19. +// + +#ifndef MEAR_SONG_H +#define MEAR_SONG_H + +#include + + +namespace model { + +struct Song +{ + int id; + std::string title; + std::string artist; + std::string album; + std::string genre; + int duration; + int year; +}; +} + +#endif //MEAR_SONG_H diff --git a/app/src/main/cpp/model/User.h b/app/src/main/cpp/model/User.h new file mode 100644 index 0000000..e96073e --- /dev/null +++ b/app/src/main/cpp/model/User.h @@ -0,0 +1,18 @@ +// +// Created by brahmix on 9/26/19. +// + +#ifndef MEAR_USER_H +#define MEAR_USER_H + +#include + +namespace model { +struct User +{ + std::string username; + std::string password; +}; +} + +#endif //MEAR_USER_H diff --git a/app/src/main/java/com/example/mear/activities/MainActivity.kt b/app/src/main/java/com/example/mear/activities/MainActivity.kt index e2d92a1..c6c4c0f 100644 --- a/app/src/main/java/com/example/mear/activities/MainActivity.kt +++ b/app/src/main/java/com/example/mear/activities/MainActivity.kt @@ -53,11 +53,15 @@ class MainActivity : BaseServiceActivity() { private var repeatOn: Boolean? = false private var shuffleOn: Boolean? = false + external fun test() + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) setSupportActionBar(toolbar) + test() + permissionPrompt() initialize() @@ -407,4 +411,10 @@ class MainActivity : BaseServiceActivity() { } } } + + companion object { + init { + System.loadLibrary("native-lib") + } + } } diff --git a/build.gradle b/build.gradle index d506b75..89f7f4c 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.3.2' + classpath 'com.android.tools.build:gradle:3.5.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/mear.iml b/mear.iml new file mode 100644 index 0000000..10919fe --- /dev/null +++ b/mear.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file