diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 6e294a9..2121c43 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -github: [TeodorHMX1] +github: [teogor] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 5fd25f1..6360028 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -3,7 +3,7 @@ name: Bug report about: Create a report to help us improve title: "[Component name] Short description of issue" labels: '@bug' -assignees: 'TeodorHMX1' +assignees: 'teogor' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 42fd487..508789c 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -3,7 +3,7 @@ name: Feature request about: Suggest an idea for this project title: "[Component name] Short description of request" labels: '@feature' -assignees: 'TeodorHMX1' +assignees: 'teogor' --- diff --git a/.gitignore b/.gitignore index ec4c59d..aa724b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,85 +1,15 @@ -# Built application files -*.apk -*.aar -*.ap_ -*.aab - -# Files for the ART/Dalvik VM -*.dex - -# Java class files -*.class - -# Generated files -bin/ -gen/ -out/ -# Uncomment the following line in case you need and you don't have the release build type files in your app -# release/ - -# Gradle files -.gradle/ -build/ - -# Local configuration file (sdk path, etc) -local.properties - -# Proguard folder generated by Eclipse -proguard/ - -# Log Files -*.log - -# Android Studio Navigation editor temp files -.navigation/ - -# Android Studio captures folder -captures/ - -# IntelliJ *.iml -.idea/workspace.xml -.idea/tasks.xml -.idea/gradle.xml -.idea/assetWizardSettings.xml -.idea/dictionaries -.idea/libraries -# Android Studio 3 in .gitignore file. -.idea/caches -.idea/modules.xml -# Comment next line if keeping position of elements in Navigation Editor is relevant for you -.idea/navEditor.xml - -# Keystore files -# Uncomment the following lines if you do not want to check your keystore files in. -#*.jks -#*.keystore - -# External native build folder generated in Android Studio 2.2 and later +.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/ - -# Google Services (e.g. APIs or Firebase) -# google-services.json - -# Freeline -freeline.py -freeline/ -freeline_project_description.json - -# fastlane -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots -fastlane/test_output -fastlane/readme.md - -# Version control -vcs.xml - -# lint -lint/intermediates/ -lint/generated/ -lint/outputs/ -lint/tmp/ -# lint/reports/ \ No newline at end of file +.cxx +local.properties diff --git a/.idea/.name b/.idea/.name index 91b3a1f..2c234f7 100644 --- a/.idea/.name +++ b/.idea/.name @@ -1 +1 @@ -Memo \ No newline at end of file +Memo-KTX \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8..b29169c 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,34 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..614e42a --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,28 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index 56bcf17..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index d5d35ec..a47d29e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,7 @@ - + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.zeobot/config.yml b/.zeobot/config.yml index 36d5aed..b84ac43 100644 --- a/.zeobot/config.yml +++ b/.zeobot/config.yml @@ -15,8 +15,7 @@ zeobot: # write down the users with access to restricted commands listen_to: users: - - TeodorHMX1 - - Teogor + - teogor # zeobot's features features: # if enabled, zeobot will post comments @@ -36,11 +35,9 @@ auto_assign: review_groups: assignee_groups: reviewers_to_add: - - TeodorHMX1 - - Teogor + - teogor assignees_to_add: - - TeodorHMX1 - - Teogor + - teogor skip_keywords: # Autodelete Merged Branches (AMB) @@ -77,8 +74,7 @@ enforce_branch_merge: - main # who has the right to write to protected branches give_access_to: - - TeodorHMX1 - - Teogor + - teogor # License Checker (LC) # branches that contains files without license will not be merged diff --git a/.zeobot/contributors.src b/.zeobot/contributors.src index 9dbc334..7535342 100644 --- a/.zeobot/contributors.src +++ b/.zeobot/contributors.src @@ -5,7 +5,7 @@ "repoHost": "https://github.com", "contributors": [ { - "login": "TeodorHMX1", + "login": "teogor", "name": "Teodor G.", "avatar_url": "https://avatars.githubusercontent.com/u/22307006?v=4", "profile": "http://team.zeoflow.com/teodor_g", diff --git a/README.md b/README.md index 1ef5cb4..b758c94 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,12 @@ dependencies { def memo_version = "x.y.z" // Memo Library - implementation("com.zeoflow:memo:$memo_version") + implementation("com.zeoflow.memo:memo:$memo_version") // Required if you want to use the injector - implementation("com.zeoflow:memo-annotation:$memo_version") - annotationProcessor("com.zeoflow:memo-compiler:$memo_version") + implementation("com.zeoflow.memo:memo-runtime:$memo_version") + annotationProcessor("com.zeoflow.memo:memo-compiler:$memo_version") // For kotlin projects use kapt instead of annotationProcessor - kapt("com.zeoflow:memo-compiler:$memo_version") + kapt("com.zeoflow.memo:memo-compiler-ktx:$memo_version") // ... } @@ -315,7 +315,7 @@ component.userProfile().usernameObserver((LifecycleOwner) this, new Observer

- +

diff --git a/app-java/.gitignore b/app-java/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app-java/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app-java/build.gradle b/app-java/build.gradle new file mode 100644 index 0000000..4983bcb --- /dev/null +++ b/app-java/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'com.android.application' +} + +android { + namespace 'com.zeoflow.memo.demo' + compileSdk 32 + + defaultConfig { + applicationId "com.zeoflow.memo.demo" + minSdk 21 + targetSdk 32 + 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(project(":memo")) + implementation(project(":memo-runtime")) + annotationProcessor annotationProcessor(project(':memo-compiler',)) + + implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' +} \ No newline at end of file diff --git a/demo/proguard-rules.pro b/app-java/proguard-rules.pro similarity index 71% rename from demo/proguard-rules.pro rename to app-java/proguard-rules.pro index 9b8d0e5..481bb43 100644 --- a/demo/proguard-rules.pro +++ b/app-java/proguard-rules.pro @@ -6,7 +6,7 @@ # 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 value to the JavaScript interface +# and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; @@ -17,7 +17,5 @@ #-keepattributes SourceFile,LineNumberTable # If you keep the line number information, uncomment this to -# hide the original source file value. -#-renamesourcefileattribute SourceFile - --keep public class * implements com.zeoflow.memo.annotation.IMemoStorageImpl { *; } \ No newline at end of file +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/demo/src/main/AndroidManifest.xml b/app-java/src/main/AndroidManifest.xml similarity index 57% rename from demo/src/main/AndroidManifest.xml rename to app-java/src/main/AndroidManifest.xml index b2bc5b1..d0100ce 100644 --- a/demo/src/main/AndroidManifest.xml +++ b/app-java/src/main/AndroidManifest.xml @@ -1,27 +1,22 @@ - + + android:theme="@style/Theme.KotlinProcessor"> + android:name="com.zeoflow.memo.demo.MainActivity" + android:exported="true"> - \ No newline at end of file diff --git a/app-java/src/main/java/com/zeoflow/memo/demo/MainActivity.java b/app-java/src/main/java/com/zeoflow/memo/demo/MainActivity.java new file mode 100644 index 0000000..721d7ac --- /dev/null +++ b/app-java/src/main/java/com/zeoflow/memo/demo/MainActivity.java @@ -0,0 +1,104 @@ +package com.zeoflow.memo.demo; + +import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; + +import com.zeoflow.memo.ConcealEncryption; +import com.zeoflow.memo.Memo; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + memoExample(); + } + + private void memoExample() { + timeMemoInit(); + timeMemoPut(); + timeMemoGet(); + timeMemoContains(); + timeMemoCount(); + timeMemoDelete(); + timeMemoEncrypt(); + timeMemoDecrypt(); + } + + private void timeMemoInit() { + long startTime = System.currentTimeMillis(); + + Memo.Companion.init().withEncryption( + new ConcealEncryption("dgdffhghdfhfgh") + ).build(); + + long endTime = System.currentTimeMillis(); + System.out.println("Memo.init: " + (endTime - startTime) + "ms"); + } + + private void timeMemoPut() { + long startTime = System.currentTimeMillis(); + + Memo.Companion.put("key", "value"); + + long endTime = System.currentTimeMillis(); + System.out.println("Memo.put: " + (endTime - startTime) + "ms"); + } + + private void timeMemoGet() { + long startTime = System.currentTimeMillis(); + + Memo.Companion.get("key"); + + long endTime = System.currentTimeMillis(); + System.out.println("Memo.get: " + (endTime - startTime) + "ms"); + } + + private void timeMemoCount() { + long startTime = System.currentTimeMillis(); + + Memo.Companion.count(); + + long endTime = System.currentTimeMillis(); + System.out.println("Memo.count: " + (endTime - startTime) + "ms"); + } + + private void timeMemoContains() { + long startTime = System.currentTimeMillis(); + + Memo.Companion.contains("key"); + + long endTime = System.currentTimeMillis(); + System.out.println("Memo.count: " + (endTime - startTime) + "ms"); + } + + private void timeMemoDelete() { + long startTime = System.currentTimeMillis(); + + Memo.Companion.delete("key"); + + long endTime = System.currentTimeMillis(); + System.out.println("Memo.count: " + (endTime - startTime) + "ms"); + } + + private void timeMemoEncrypt() { + long startTime = System.currentTimeMillis(); + + System.out.println("e: " + Memo.Companion.encrypt(42335)); + + long endTime = System.currentTimeMillis(); + System.out.println("Memo.encrypt: " + (endTime - startTime) + "ms"); + } + + private void timeMemoDecrypt() { + long startTime = System.currentTimeMillis(); + + System.out.println("v: " + Memo.Companion.decrypt(Memo.Companion.encrypt(42335))); + + long endTime = System.currentTimeMillis(); + System.out.println("Memo.decrypt: " + (endTime - startTime) + "ms"); + } +} \ No newline at end of file diff --git a/demo/src/main/java/com/zeoflow/demo/entities/Country.java b/app-java/src/main/java/com/zeoflow/memo/demo/entities/Country.java similarity index 52% rename from demo/src/main/java/com/zeoflow/demo/entities/Country.java rename to app-java/src/main/java/com/zeoflow/memo/demo/entities/Country.java index f7a2e2a..6424bde 100644 --- a/demo/src/main/java/com/zeoflow/demo/entities/Country.java +++ b/app-java/src/main/java/com/zeoflow/memo/demo/entities/Country.java @@ -1,26 +1,11 @@ -/* - * Copyright (C) 2017 zeoflow - * - * 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 - * - * http://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. - */ - -package com.zeoflow.demo.entities; + +package com.zeoflow.memo.demo.entities; import android.database.Observable; -import com.zeoflow.memo.annotation.KeyName; -import com.zeoflow.memo.annotation.MemoEntity; -import com.zeoflow.memo.annotation.MemoFunction; +import com.zeoflow.memo.common.KeyName; +import com.zeoflow.memo.common.MemoEntity; +import com.zeoflow.memo.common.MemoFunction; @MemoEntity("Country") public class Country diff --git a/app-java/src/main/java/com/zeoflow/memo/demo/entities/PrivateInfo.java b/app-java/src/main/java/com/zeoflow/memo/demo/entities/PrivateInfo.java new file mode 100644 index 0000000..790baa0 --- /dev/null +++ b/app-java/src/main/java/com/zeoflow/memo/demo/entities/PrivateInfo.java @@ -0,0 +1,34 @@ + +package com.zeoflow.memo.demo.entities; + +import androidx.annotation.NonNull; + +public class PrivateInfo +{ + + private final String firstName; + private final String lastName; + + public PrivateInfo(String firstName, String lastName) + { + this.firstName = firstName; + this.lastName = lastName; + } + + public String getFirstName() + { + return firstName; + } + public String getLastName() + { + return lastName; + } + + @NonNull + @Override + public String toString() + { + return "firstName=" + firstName + ", " + "lastName=" + lastName; + } + +} diff --git a/demo/src/main/java/com/zeoflow/demo/entities/User.java b/app-java/src/main/java/com/zeoflow/memo/demo/entities/User.java similarity index 84% rename from demo/src/main/java/com/zeoflow/demo/entities/User.java rename to app-java/src/main/java/com/zeoflow/memo/demo/entities/User.java index 9506a91..6bd73bc 100644 --- a/demo/src/main/java/com/zeoflow/demo/entities/User.java +++ b/app-java/src/main/java/com/zeoflow/memo/demo/entities/User.java @@ -1,12 +1,14 @@ -package com.zeoflow.demo.entities; +package com.zeoflow.memo.demo.entities; -import com.zeoflow.memo.annotation.EncryptEntity; -import com.zeoflow.memo.annotation.KeyName; -import com.zeoflow.memo.annotation.Listener; -import com.zeoflow.memo.annotation.MemoCompoundFunction; -import com.zeoflow.memo.annotation.MemoEntity; -import com.zeoflow.memo.annotation.MemoFunction; -import com.zeoflow.memo.annotation.Observable; +import com.zeoflow.memo.common.Default; +import com.zeoflow.memo.common.DefaultType; +import com.zeoflow.memo.common.EncryptEntity; +import com.zeoflow.memo.common.KeyName; +import com.zeoflow.memo.common.Listener; +import com.zeoflow.memo.common.MemoCompoundFunction; +import com.zeoflow.memo.common.MemoEntity; +import com.zeoflow.memo.common.MemoFunction; +import com.zeoflow.memo.common.Observable; /** * the entity generated will be named UserProfile_MemoEntity @@ -30,6 +32,7 @@ public class User */ @KeyName("username") @Observable + @Default(UsernameDefault.class) protected final String userUsername = "zeoflow"; /** @@ -133,3 +136,11 @@ public String getFullNameAndViews(PrivateInfo userinfo, int views) } } + +class UsernameDefault implements DefaultType { + + @Override + public String value() { + return "zeoflow"; + } +} \ No newline at end of file diff --git a/demo/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app-java/src/main/res/drawable-v24/ic_launcher_foreground.xml similarity index 97% rename from demo/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to app-java/src/main/res/drawable-v24/ic_launcher_foreground.xml index f43c0ad..2b068d1 100644 --- a/demo/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/app-java/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -22,7 +22,7 @@ + + + + + \ No newline at end of file diff --git a/demo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app-java/src/main/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from demo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to app-java/src/main/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/demo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app-java/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from demo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to app-java/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/app-java/src/main/res/mipmap-hdpi/ic_launcher.webp b/app-java/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/app-java/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app-java/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app-java/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/app-java/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app-java/src/main/res/mipmap-mdpi/ic_launcher.webp b/app-java/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/app-java/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app-java/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app-java/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/app-java/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app-java/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app-java/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/app-java/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app-java/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app-java/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/app-java/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app-java/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app-java/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/app-java/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app-java/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app-java/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/app-java/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app-java/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app-java/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app-java/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app-java/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app-java/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app-java/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app-java/src/main/res/values-night/themes.xml b/app-java/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..603d58e --- /dev/null +++ b/app-java/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app-java/src/main/res/values/colors.xml b/app-java/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/app-java/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-java/src/main/res/values/strings.xml b/app-java/src/main/res/values/strings.xml new file mode 100644 index 0000000..d854daa --- /dev/null +++ b/app-java/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Memo Java + \ No newline at end of file diff --git a/app-java/src/main/res/values/themes.xml b/app-java/src/main/res/values/themes.xml new file mode 100644 index 0000000..e677f49 --- /dev/null +++ b/app-java/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app-kotlin/.gitignore b/app-kotlin/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app-kotlin/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app-kotlin/build.gradle b/app-kotlin/build.gradle new file mode 100644 index 0000000..8cf7778 --- /dev/null +++ b/app-kotlin/build.gradle @@ -0,0 +1,45 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' + id 'kotlin-kapt' +} + +android { + namespace 'com.zeoflow.memo.demo' + compileSdk 32 + + defaultConfig { + applicationId "com.zeoflow.memo.demo" + minSdk 21 + targetSdk 32 + 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(project(":memo")) + implementation(project(":memo-runtime")) + kapt(project(":memo-compiler-ktx")) + + implementation 'androidx.core:core-ktx:1.8.0' + implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' +} \ No newline at end of file diff --git a/app-kotlin/proguard-rules.pro b/app-kotlin/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app-kotlin/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-kotlin/src/main/AndroidManifest.xml b/app-kotlin/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d0100ce --- /dev/null +++ b/app-kotlin/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app-kotlin/src/main/java/com/zeoflow/memo/demo/MainActivity.kt b/app-kotlin/src/main/java/com/zeoflow/memo/demo/MainActivity.kt new file mode 100644 index 0000000..a60a4e4 --- /dev/null +++ b/app-kotlin/src/main/java/com/zeoflow/memo/demo/MainActivity.kt @@ -0,0 +1,91 @@ +package com.zeoflow.memo.demo + +import android.os.Bundle +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import com.zeoflow.memo.ConcealEncryption +import com.zeoflow.memo.Memo +import com.zeoflow.memo.demo.entities.CityMemo + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + + val cityMemo = CityMemo() + memoExample() + cityMemo.nameObservable(this) { + println("name: $it") + } + } + + private fun memoExample() { + timeMemoInit() + timeMemoPut() + timeMemoGet() + timeMemoContains() + timeMemoCount() + timeMemoDelete() + timeMemoEncrypt() + timeMemoDecrypt() + } + + private fun timeMemoInit() { + val startTime = System.currentTimeMillis() + Memo.init().withEncryption( + ConcealEncryption("2343532sdafg54") + ).build() + val endTime = System.currentTimeMillis() + println("Memo.init: " + (endTime - startTime) + "ms") + } + + private fun timeMemoPut() { + val startTime = System.currentTimeMillis() + Memo.put("key", "value") + val endTime = System.currentTimeMillis() + println("Memo.put: " + (endTime - startTime) + "ms") + } + + private fun timeMemoGet() { + val startTime = System.currentTimeMillis() + Memo.get("key") + val endTime = System.currentTimeMillis() + println("Memo.get: " + (endTime - startTime) + "ms") + } + + private fun timeMemoCount() { + val startTime = System.currentTimeMillis() + Memo.count() + val endTime = System.currentTimeMillis() + println("Memo.count: " + (endTime - startTime) + "ms") + } + + private fun timeMemoContains() { + val startTime = System.currentTimeMillis() + Memo.contains("key") + val endTime = System.currentTimeMillis() + println("Memo.count: " + (endTime - startTime) + "ms") + } + + private fun timeMemoDelete() { + val startTime = System.currentTimeMillis() + Memo.delete("key") + val endTime = System.currentTimeMillis() + println("Memo.count: " + (endTime - startTime) + "ms") + } + + private fun timeMemoEncrypt() { + val startTime = System.currentTimeMillis() + println("e: " + Memo.encrypt(42335)) + val endTime = System.currentTimeMillis() + println("Memo.encrypt: " + (endTime - startTime) + "ms") + } + + private fun timeMemoDecrypt() { + val startTime = System.currentTimeMillis() + println("v: " + Memo.decrypt(Memo.encrypt(42335))) + val endTime = System.currentTimeMillis() + println("Memo.decrypt: " + (endTime - startTime) + "ms") + } +} \ No newline at end of file diff --git a/app-kotlin/src/main/java/com/zeoflow/memo/demo/entities/City.kt b/app-kotlin/src/main/java/com/zeoflow/memo/demo/entities/City.kt new file mode 100644 index 0000000..d727ed4 --- /dev/null +++ b/app-kotlin/src/main/java/com/zeoflow/memo/demo/entities/City.kt @@ -0,0 +1,47 @@ +package com.zeoflow.memo.demo.entities + +import com.zeoflow.memo.common.* + +/** + * the entity generated will be named UserProfile_MemoEntity + * it was annotated with @MemoEntity("UserProfile") + * + * the entity will be encrypted using the "G15y3aV9M8d" key + * it was annotated with @EncryptEntity("G15y3aV9M8d") + */ +@MemoEntity +//@EncryptEntity("G15y3aV9M8d") +data class City( + @KeyName("name") + @Default(NameDefault::class) + @Observable + val name: String = "Brasov", + + @KeyName("country") + @Default(CountryDefault::class) + @Observable + val country: String, + + @Observable + @Default(PopulationDefault::class) + val population: Int, +) + +class NameDefault : DefaultType { + override fun value(): String { + return "Brasov" + } +} + +class CountryDefault : DefaultType { + override fun value(): String { + return "Romania" + } +} + +class PopulationDefault : DefaultType { + override fun value(): Int { + return 2134357846 + } +} + diff --git a/demo/src/main/res/drawable/ic_launcher_foreground.xml b/app-kotlin/src/main/res/drawable-v24/ic_launcher_foreground.xml similarity index 97% rename from demo/src/main/res/drawable/ic_launcher_foreground.xml rename to app-kotlin/src/main/res/drawable-v24/ic_launcher_foreground.xml index f43c0ad..2b068d1 100644 --- a/demo/src/main/res/drawable/ic_launcher_foreground.xml +++ b/app-kotlin/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -22,7 +22,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app-kotlin/src/main/res/layout/activity_main.xml b/app-kotlin/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..408c228 --- /dev/null +++ b/app-kotlin/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/app-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher.webp b/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher.webp b/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app-kotlin/src/main/res/values-night/themes.xml b/app-kotlin/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..603d58e --- /dev/null +++ b/app-kotlin/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app-kotlin/src/main/res/values/colors.xml b/app-kotlin/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/app-kotlin/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-kotlin/src/main/res/values/strings.xml b/app-kotlin/src/main/res/values/strings.xml new file mode 100644 index 0000000..c211a60 --- /dev/null +++ b/app-kotlin/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Memo Kotlin + \ No newline at end of file diff --git a/app-kotlin/src/main/res/values/themes.xml b/app-kotlin/src/main/res/values/themes.xml new file mode 100644 index 0000000..e677f49 --- /dev/null +++ b/app-kotlin/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index a46457f..4de5dd6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,20 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.6.10' repositories { + google() mavenCentral() + maven { + url "https://plugins.gradle.org/m2/" + } } dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0' + classpath 'com.vanniktech:gradle-maven-publish-plugin:0.20.0' } } plugins { - id 'com.android.application' version '7.1.0-rc01' apply false - id 'com.android.library' version '7.1.0-rc01' apply false -} - -task clean(type: Delete) { - delete rootProject.buildDir + id 'com.android.application' version '7.4.0-alpha07' apply false + id 'com.android.library' version '7.4.0-alpha07' apply false + id 'org.jetbrains.kotlin.android' version '1.7.0' apply false + id 'org.jetbrains.kotlin.jvm' version '1.7.0' apply false } \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..b22ed73 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() +} \ No newline at end of file diff --git a/buildSrc/build/kotlin/buildSrcjar-classes.txt b/buildSrc/build/kotlin/buildSrcjar-classes.txt new file mode 100644 index 0000000..e69de29 diff --git a/buildSrc/build/libs/buildSrc.jar b/buildSrc/build/libs/buildSrc.jar new file mode 100644 index 0000000..9b9e6bd Binary files /dev/null and b/buildSrc/build/libs/buildSrc.jar differ diff --git a/buildSrc/build/pluginUnderTestMetadata/plugin-under-test-metadata.properties b/buildSrc/build/pluginUnderTestMetadata/plugin-under-test-metadata.properties new file mode 100644 index 0000000..0540064 --- /dev/null +++ b/buildSrc/build/pluginUnderTestMetadata/plugin-under-test-metadata.properties @@ -0,0 +1 @@ +implementation-classpath=G\:/Business/ZeoFlow/OpenSource/memo/buildSrc/build/classes/java/main;G\:/Business/ZeoFlow/OpenSource/memo/buildSrc/build/classes/groovy/main;G\:/Business/ZeoFlow/OpenSource/memo/buildSrc/build/classes/kotlin/main;G\:/Business/ZeoFlow/OpenSource/memo/buildSrc/build/resources/main diff --git a/buildSrc/build/reports/plugin-development/validation-report.txt b/buildSrc/build/reports/plugin-development/validation-report.txt new file mode 100644 index 0000000..e69de29 diff --git a/buildSrc/build/tmp/jar/MANIFEST.MF b/buildSrc/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/buildSrc/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/buildSrc/publish-module.gradle b/buildSrc/publish-module.gradle deleted file mode 100644 index 1b5184b..0000000 --- a/buildSrc/publish-module.gradle +++ /dev/null @@ -1,90 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' -apply plugin: 'org.jetbrains.dokka' - -task androidSourcesJar(type: Jar) { - archiveClassifier.set('sources') - if (project.plugins.findPlugin("com.android.library")) { - from android.sourceSets.main.java.srcDirs - from android.sourceSets.main.kotlin.srcDirs - } else { - from sourceSets.main.java.srcDirs - from sourceSets.main.kotlin.srcDirs - } -} - -tasks.withType(dokkaHtmlPartial.getClass()).configureEach { - pluginsMapConfiguration.set( - ["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""] - ) -} - -task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { - archiveClassifier.set('javadoc') - from dokkaJavadoc.outputDirectory -} - -artifacts { - archives androidSourcesJar - archives javadocJar -} - -group = PUBLISH_GROUP_ID -version = PUBLISH_VERSION - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - groupId PUBLISH_GROUP_ID - artifactId PUBLISH_ARTIFACT_ID - version PUBLISH_VERSION - if (project.plugins.findPlugin("com.android.library")) { - from components.release - } else { - from components.java - } - - artifact androidSourcesJar - artifact javadocJar - - pom { - name = PUBLISH_ARTIFACT_ID - description = 'Stream Chat official Android SDK' - url = 'https://github.com/getstream/stream-chat-android' - licenses { - license { - name = 'Stream License' - url = 'https://github.com/GetStream/stream-chat-android/blob/main/LICENSE' - } - } - developers { - developer { - id = 'zeoflow' - name = 'ZeoFlow SRL' - email = 'open-srouce@zeoflow.com' - } - developer { - id = 'teodorhmx1' - name = 'Teodor G.' - email = 'teo@zeoflow.com' - } - } - scm { - connection = 'scm:git:github.com/getstream/stream-chat-android.git' - developerConnection = 'scm:git:ssh://github.com/getstream/stream-chat-android.git' - url = 'https://github.com/getstream/stream-chat-android/tree/main' - } - } - } - } - } -} - -ext["signing.keyId"] = rootProject.ext["signing.keyId"] -ext["signing.password"] = rootProject.ext["signing.password"] -ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"] - -signing { - sign publishing.publications -} \ No newline at end of file diff --git a/buildSrc/publish.gradle b/buildSrc/publish.gradle deleted file mode 100644 index c3c0866..0000000 --- a/buildSrc/publish.gradle +++ /dev/null @@ -1,211 +0,0 @@ -apply plugin: 'maven-publish' - -task androidJavadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - android.libraryVariants.all { variant -> - if (variant.name == 'release') { - owner.classpath += variant.javaCompileProvider.get().classpath - } - } - - exclude '**/R.html', '**/R.*.html', '**/index.html' - options.encoding 'utf-8' - options { - addStringOption 'docencoding', 'utf-8' - addStringOption 'charset', 'utf-8' - links 'https://docs.oracle.com/javase/7/docs/api/' - links 'https://d.android.com/reference' - links 'https://developer.android.com/reference/androidx/' - } -} - -task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { - archiveClassifier.set('javadoc') - from androidJavadoc.destinationDir - - preserveFileTimestamps = false - reproducibleFileOrder = true -} - -task javaSourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs - - preserveFileTimestamps = false - reproducibleFileOrder = true -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - - from components.release - - artifact androidJavadocJar - artifact javaSourcesJar - - groupId = GROUP - version = VERSION_NAME - - pom { - name = artifactId - description = '' - url = '' - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL -// distribution POM_LICENCE_DIST - } - } - developers { - developer { - id = 'zeoflow' - name = 'ZeoFLow SRL' - email = 'open-source@zeoflow.com' - } - developer { - id = 'teodorhmx1' - name = 'Teodor G.' - email = 'teo@zeoflow.com' - } - } - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - } - } - } - repositories { - maven { - def releasesRepoUrl = layout.buildDirectory.dir('repos/releases') - def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots') - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username NEXUS_USERNAME - password NEXUS_PASSWORD - } - } - } - } -} - -//apply plugin: 'maven-publish' -//apply plugin: 'signing' - -//afterEvaluate { -// publishing { -// publications { -// mavenRelease(MavenPublication) { -// from components.release -// } -// } -// } -//} - -//def isReleaseBuild() { -// return VERSION_NAME.contains("SNAPSHOT") == false -//} -// -//def getReleaseRepositoryUrl() { -// return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL -// : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -//} -// -//def getSnapshotRepositoryUrl() { -// return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL -// : "https://oss.sonatype.org/content/repositories/snapshots/" -//} -// -//def getRepositoryUsername() { -// return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" -//} -// -//def getRepositoryPassword() { -// return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" -//} -// -//java { -// withJavadocJar() -// withSourcesJar() -//} -// -// -//afterEvaluate { -// publishing { -// publications { -// maven(MavenPublication) { -// groupId = GROUP -// artifactId = POM_ARTIFACT_ID -// version = VERSION_NAME -// pom { -// name POM_NAME -// packaging POM_PACKAGING -// description POM_DESCRIPTION -// url POM_URL -//// properties = [ -//// myProp: "value", -//// "prop.with.dots": "anotherValue" -//// ] -// licenses { -// license { -// name POM_LICENCE_NAME -// url POM_LICENCE_URL -// distribution POM_LICENCE_DIST -// } -// } -// developers { -// developer { -// id = 'zeoflow' -// name = 'ZeoFLow SRL' -// email = 'open-source@zeoflow.com' -// } -// developer { -// id = 'teodorhmx1' -// name = 'Teodor G.' -// email = 'teo@zeoflow.com' -// } -// } -// scm { -// url POM_SCM_URL -// connection POM_SCM_CONNECTION -// developerConnection POM_SCM_DEV_CONNECTION -// } -// } -// } -// } -// repositories { -// maven { -// def releasesRepoUrl = layout.buildDirectory.dir('repos/releases') -// def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots') -// url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl -// credentials { -// username NEXUS_USERNAME -// password NEXUS_PASSWORD -// } -// } -// } -// } -//} -// -//task cleanBuildPublishLocal(type: GradleBuild) { -// tasks = ['clean', 'build', 'publishToMavenLocal'] -//} -// -//task cleanBuildPublish(type: GradleBuild) { -// tasks = ['clean', 'build', 'publish'] -//} -// -//signing { -// sign configurations.archives -//} -// -//javadoc { -// if(JavaVersion.current().isJava9Compatible()) { -// options.addBooleanOption('html5', true) -// } -//} \ No newline at end of file diff --git a/demo/.gitignore b/demo/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/demo/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/demo/build.gradle b/demo/build.gradle deleted file mode 100644 index 2de19b0..0000000 --- a/demo/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -plugins { - id 'com.android.application' -} - -android { - compileSdk 31 - defaultConfig { - applicationId "com.zeoflow.memo.demo" - minSdk 21 - targetSdk 31 - versionCode 10 - versionName "1.2.0" - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -dependencies { - implementation project(path: ':memo') - implementation project(path: ':memo-annotation') - annotationProcessor project(path: ':memo-compiler') - - implementation("com.zeoflow:zson:1.3.0") - implementation('com.zeoflow:flow-kit:1.6.2') - implementation('com.zeoflow:material-elements:2.5.0') - - implementation('com.zeoflow:parcelled-runtime:1.1.1') - annotationProcessor('com.zeoflow:parcelled-compiler:1.1.1') -} diff --git a/demo/src/main/ic_launcher-playstore.png b/demo/src/main/ic_launcher-playstore.png deleted file mode 100644 index bec88d5..0000000 Binary files a/demo/src/main/ic_launcher-playstore.png and /dev/null differ diff --git a/demo/src/main/java/com/zeoflow/demo/LoginActivity.java b/demo/src/main/java/com/zeoflow/demo/LoginActivity.java deleted file mode 100644 index 5fb2fbb..0000000 --- a/demo/src/main/java/com/zeoflow/demo/LoginActivity.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2017 zeoflow - * - * 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 - * - * http://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. - */ - -package com.zeoflow.demo; - -import android.os.Bundle; -import android.widget.Button; -import android.widget.EditText; -import android.widget.Toast; - -import com.zeoflow.app.Activity; -import com.zeoflow.demo.components.AppStorage_Memo; -import com.zeoflow.demo.entities.PrivateInfo; -import com.zeoflow.demo.entities.User; -import com.zeoflow.demo.entities.UserProfile_MemoEntity; -import com.zeoflow.memo.annotation.InjectPreference; -import com.zeoflow.utils.string.StringCreator; - -public class LoginActivity extends Activity -{ - - /** - * UserProfile entity. {@link User} - */ - @InjectPreference - public AppStorage_Memo component; - @InjectPreference - public UserProfile_MemoEntity userProfile; - - @Override - protected void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_login); - AppStorage_Memo.getInstance().inject(this); - - final EditText editText_username = findViewById(R.id.login_editText_username); - final EditText editText_firstName = findViewById(R.id.login_editText_firstName); - final EditText editText_lastName = findViewById(R.id.login_editText_lastName); - final Button button = findViewById(R.id.login_button); - button.setOnClickListener(view -> - { - String inputUsername = editText_username.getText().toString(); - String inputFirstName = editText_firstName.getText().toString(); - String inputLastName = editText_lastName.getText().toString(); - if (!inputUsername.equals("") && !inputFirstName.equals("") && !inputLastName.equals("")) - { - userProfile.putLogin(true); - userProfile.putUsername(inputUsername); - userProfile.putUserinfo(new PrivateInfo(inputFirstName, inputLastName)); - finish(); - } else - { - Toast.makeText(getBaseContext(), "please fill all inputs", Toast.LENGTH_SHORT).show(); - } - }); - userProfile.addLoginListeners(login -> - { - String content = StringCreator.creator() - .add("User profile updated! Welcome, $N!", userProfile.getUsername()) - .asString(); - Toast.makeText(getBaseContext(), content, Toast.LENGTH_SHORT).show(); - }); - } - -} diff --git a/demo/src/main/java/com/zeoflow/demo/MainActivity.java b/demo/src/main/java/com/zeoflow/demo/MainActivity.java deleted file mode 100644 index c85720b..0000000 --- a/demo/src/main/java/com/zeoflow/demo/MainActivity.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (C) 2017 zeoflow - * - * 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 - * - * http://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. - */ - -package com.zeoflow.demo; - -import android.database.Observable; -import android.os.Bundle; -import android.widget.Button; -import android.widget.ListView; -import android.widget.Toast; - -import androidx.annotation.Nullable; -import androidx.core.view.ViewCompat; - -import com.zeoflow.app.Activity; -import com.zeoflow.demo.components.AppStorage; -import com.zeoflow.demo.components.AppStorage_Memo; -import com.zeoflow.demo.utils.ItemProfile; -import com.zeoflow.demo.utils.ListViewAdapter; -import com.zeoflow.memo.ConcealEncryption; -import com.zeoflow.memo.Memo; -import com.zeoflow.memo.annotation.InjectPreference; - -public class MainActivity extends Activity -{ - - /** - * userProfile Component. {@link AppStorage} - */ - @InjectPreference - public AppStorage_Memo component; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - AppStorage_Memo.getInstance() - .inject(this); - - initializeUI(); - - component.userProfile().usernameObserver(this, nickname -> initializeUI()); - -// memoExample(); - } - - private void memoExample() - { - timeMemoInit(); - timeMemoPut(); - timeMemoGet(); - timeMemoContains(); - timeMemoCount(); - timeMemoDelete(); - timeMemoEncrypt(); - timeMemoDecrypt(); - } - - private void timeMemoInit() - { - long startTime = System.currentTimeMillis(); - - Memo.init() - .setEncryption(new ConcealEncryption("dgdffhghdfhfgh")) - .build(); - - long endTime = System.currentTimeMillis(); - System.out.println("Memo.init: " + (endTime - startTime) + "ms"); - } - - private void timeMemoPut() - { - long startTime = System.currentTimeMillis(); - - Memo.put("key", "value"); - - long endTime = System.currentTimeMillis(); - System.out.println("Memo.put: " + (endTime - startTime) + "ms"); - } - - private void timeMemoGet() - { - long startTime = System.currentTimeMillis(); - - Memo.get("key"); - - long endTime = System.currentTimeMillis(); - System.out.println("Memo.get: " + (endTime - startTime) + "ms"); - } - - private void timeMemoCount() - { - long startTime = System.currentTimeMillis(); - - Memo.count(); - - long endTime = System.currentTimeMillis(); - System.out.println("Memo.count: " + (endTime - startTime) + "ms"); - } - - private void timeMemoContains() - { - long startTime = System.currentTimeMillis(); - - Memo.contains("key"); - - long endTime = System.currentTimeMillis(); - System.out.println("Memo.count: " + (endTime - startTime) + "ms"); - } - - private void timeMemoDelete() - { - long startTime = System.currentTimeMillis(); - - Memo.delete("key"); - - long endTime = System.currentTimeMillis(); - System.out.println("Memo.count: " + (endTime - startTime) + "ms"); - } - - private void timeMemoEncrypt() - { - long startTime = System.currentTimeMillis(); - - System.out.println("e: " + Memo.encrypt(42335)); - - long endTime = System.currentTimeMillis(); - System.out.println("Memo.encrypt: " + (endTime - startTime) + "ms"); - } - - private void timeMemoDecrypt() - { - long startTime = System.currentTimeMillis(); - - System.out.println("v: " + Memo.decrypt(Memo.encrypt(42335))); - - long endTime = System.currentTimeMillis(); - System.out.println("Memo.decrypt: " + (endTime - startTime) + "ms"); - } - - private void initializeUI() - { - if (!component.userProfile().getLogin()) - { - Toast.makeText(zContext, "No user registered. Please register one.", Toast.LENGTH_SHORT).show(); - configureNewActivity(LoginActivity.class) - .start(); - } else - { - Button needLoginView = findViewById(R.id.content_button); - needLoginView.setOnClickListener(view -> - { - configureNewActivity(LoginActivity.class) - .start(); - }); - ListViewAdapter adapter = new ListViewAdapter(this, R.layout.item_profile); - - ListView listView = findViewById(R.id.content_listView); - ViewCompat.setNestedScrollingEnabled(listView, true); - listView.setAdapter(adapter); - - adapter.addItem(new ItemProfile("Message", component.userProfile().getUsername())); - adapter.addItem(new ItemProfile("Full Name", component.userProfile().getFullName())); - adapter.addItem(new ItemProfile("First Name", component.userProfile().getUserinfo().getFirstName())); - adapter.addItem(new ItemProfile("Last Name", component.userProfile().getUserinfo().getLastName())); - adapter.addItem(new ItemProfile("Views", component.userProfile().getViews() + "")); - adapter.addItem(new ItemProfile("Details", component.userProfile().getFullNameAndViews())); - component.userProfile().putViews(component.userProfile().getViews()); - - if (component.country().getCountryCode() == null) - { - component.country().putCountry("Romania"); - component.country().putCountryCode("RO"); - } - adapter.addItem(new ItemProfile("country", component.country().getCountry())); - adapter.addItem(new ItemProfile("country code", component.country().getCountryCode())); - } - } - -} diff --git a/demo/src/main/java/com/zeoflow/demo/components/AppStorage.java b/demo/src/main/java/com/zeoflow/demo/components/AppStorage.java deleted file mode 100644 index 9e28854..0000000 --- a/demo/src/main/java/com/zeoflow/demo/components/AppStorage.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2017 zeoflow - * - * 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 - * - * http://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. - */ - -package com.zeoflow.demo.components; - -import com.zeoflow.demo.LoginActivity; -import com.zeoflow.demo.MainActivity; -import com.zeoflow.demo.entities.Country; -import com.zeoflow.demo.entities.User; -import com.zeoflow.memo.annotation.MemoComponent; - -/** - * Component that integrates memo entities; it must be an interface - * and annotated with @MemoComponent. The generated class will end in - * $_Memo (generated class for this interface will be AppStorage_Memo - * - * inside this Memo manager, the following MemoEntities are injected: - * - User - * - Country - */ -@MemoComponent(entities = {User.class, Country.class}) -public interface AppStorage -{ - - /** - * declare dependency injection target MaiActivity. - */ - void inject(MainActivity mainActivity); - - /** - * declare dependency injection target LoginActivity. - */ - void inject(LoginActivity loginActivity); - -} diff --git a/demo/src/main/java/com/zeoflow/demo/entities/PrivateInfo.java b/demo/src/main/java/com/zeoflow/demo/entities/PrivateInfo.java deleted file mode 100644 index 52cf9b0..0000000 --- a/demo/src/main/java/com/zeoflow/demo/entities/PrivateInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2017 zeoflow - * - * 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 - * - * http://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. - */ - -package com.zeoflow.demo.entities; - -import androidx.annotation.NonNull; - -public class PrivateInfo -{ - - private final String firstName; - private final String lastName; - - public PrivateInfo(String firstName, String lastName) - { - this.firstName = firstName; - this.lastName = lastName; - } - - public String getFirstName() - { - return firstName; - } - public String getLastName() - { - return lastName; - } - - @NonNull - @Override - public String toString() - { - return "firstName=" + firstName + ", " + "lastName=" + lastName; - } - -} diff --git a/demo/src/main/java/com/zeoflow/demo/utils/ItemProfile.java b/demo/src/main/java/com/zeoflow/demo/utils/ItemProfile.java deleted file mode 100644 index fa5288c..0000000 --- a/demo/src/main/java/com/zeoflow/demo/utils/ItemProfile.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2017 zeoflow - * - * 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 - * - * http://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. - */ - -package com.zeoflow.demo.utils; - -public class ItemProfile -{ - - private final String title; - private final String content; - - public ItemProfile(String title, String content) - { - this.title = title; - this.content = content; - } - - public String getTitle() - { - return title; - } - - public String getContent() - { - return content; - } - -} diff --git a/demo/src/main/java/com/zeoflow/demo/utils/ListViewAdapter.java b/demo/src/main/java/com/zeoflow/demo/utils/ListViewAdapter.java deleted file mode 100644 index 1320777..0000000 --- a/demo/src/main/java/com/zeoflow/demo/utils/ListViewAdapter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2017 zeoflow - * - * 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 - * - * http://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. - */ - -package com.zeoflow.demo.utils; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.TextView; - -import com.zeoflow.demo.R; - -import java.util.ArrayList; -import java.util.List; - -public class ListViewAdapter extends BaseAdapter -{ - - private final int layout; - private final LayoutInflater inflater; - private final List profileList; - - public ListViewAdapter(Context context, int layout) - { - this.profileList = new ArrayList<>(); - this.layout = layout; - this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - } - - @Override - public int getCount() - { - return profileList.size(); - } - - @Override - public Object getItem(int i) - { - return profileList.get(i); - } - - @Override - public long getItemId(int i) - { - return i; - } - - public void addItem(ItemProfile itemProfile) - { - this.profileList.add(itemProfile); - notifyDataSetChanged(); - } - - @Override - public View getView(int index, View view, ViewGroup viewGroup) - { - if (view == null) view = this.inflater.inflate(layout, viewGroup, false); - - ItemProfile itemProfile = profileList.get(index); - - TextView title = view.findViewById(R.id.item_profile_title); - title.setText(itemProfile.getTitle()); - - TextView content = view.findViewById(R.id.item_profile_content); - content.setText(itemProfile.getContent()); - return view; - } - -} diff --git a/demo/src/main/res/layout/activity_login.xml b/demo/src/main/res/layout/activity_login.xml deleted file mode 100644 index d118752..0000000 --- a/demo/src/main/res/layout/activity_login.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - -