├── Java └── Application │ ├── app │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── values │ │ │ │ │ ├── dimens.xml │ │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── colors.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── menu │ │ │ │ │ ├── edite_note_menu.xml │ │ │ │ │ ├── menu_main.xml │ │ │ │ │ └── main_action_mode.xml │ │ │ │ ├── drawable │ │ │ │ │ ├── ic_add_black_24dp.xml │ │ │ │ │ ├── ic_home_black_24dp.xml │ │ │ │ │ ├── ic_delete_black_24dp.xml │ │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ │ ├── ic_note_black_24dp.xml │ │ │ │ │ ├── ic_dark_theme.xml │ │ │ │ │ ├── ic_share_black_24dp.xml │ │ │ │ │ └── ic_settings_black_24dp.xml │ │ │ │ ├── layout │ │ │ │ │ ├── content_main.xml │ │ │ │ │ ├── activity_main.xml │ │ │ │ │ ├── activity_edite_note.xml │ │ │ │ │ └── note_layout.xml │ │ │ │ └── drawable-v24 │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── ic_launcher-web.png │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── ixidev │ │ │ │ │ └── simplenotepad │ │ │ │ │ ├── callbacks │ │ │ │ │ ├── NoteEventListener.java │ │ │ │ │ └── MainActionModeCallback.java │ │ │ │ │ ├── utils │ │ │ │ │ └── NoteUtils.java │ │ │ │ │ ├── db │ │ │ │ │ ├── NotesDB.java │ │ │ │ │ └── NotesDao.java │ │ │ │ │ ├── model │ │ │ │ │ └── Note.java │ │ │ │ │ ├── EditNoteActivity.java │ │ │ │ │ ├── adapters │ │ │ │ │ └── NotesAdapter.java │ │ │ │ │ └── MainActivity.java │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── ixidev │ │ │ │ └── simplenotepad │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── com │ │ │ └── ixidev │ │ │ └── simplenotepad │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle │ ├── settings.gradle │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── .idea │ ├── caches │ │ └── build_file_checksums.ser │ ├── vcs.xml │ ├── misc.xml │ ├── runConfigurations.xml │ ├── gradle.xml │ └── codeStyles │ │ └── Project.xml │ ├── .gitignore │ ├── build.gradle │ ├── gradle.properties │ ├── gradlew.bat │ └── gradlew ├── Kotlin └── Application │ ├── .idea │ ├── .name │ ├── codeStyles │ │ ├── codeStyleConfig.xml │ │ └── Project.xml │ ├── vcs.xml │ ├── runConfigurations.xml │ ├── gradle.xml │ └── misc.xml │ ├── app │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── values │ │ │ │ │ ├── dimens.xml │ │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── colors.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── menu │ │ │ │ │ ├── edite_note_menu.xml │ │ │ │ │ └── main_action_mode.xml │ │ │ │ ├── drawable │ │ │ │ │ ├── ic_add_black_24dp.xml │ │ │ │ │ ├── ic_delete_black_24dp.xml │ │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ │ ├── ic_dark_theme.xml │ │ │ │ │ └── ic_share_black_24dp.xml │ │ │ │ └── layout │ │ │ │ │ ├── content_main.xml │ │ │ │ │ ├── activity_main.xml │ │ │ │ │ ├── activity_edit_note.xml │ │ │ │ │ └── note_layout.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── ixidev │ │ │ │ │ └── simplenotepad │ │ │ │ │ ├── utils │ │ │ │ │ ├── Constants.kt │ │ │ │ │ └── NoteUtils.kt │ │ │ │ │ ├── callbacks │ │ │ │ │ ├── NoteEventListener.kt │ │ │ │ │ └── MainActionModeCallback.kt │ │ │ │ │ ├── entity │ │ │ │ │ └── Note.kt │ │ │ │ │ ├── db │ │ │ │ │ ├── NotesDB.kt │ │ │ │ │ └── NotesDao.kt │ │ │ │ │ ├── EditNoteActivity.kt │ │ │ │ │ ├── adapters │ │ │ │ │ └── NotesAdapter.kt │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── ixidev │ │ │ │ └── simplenotepad │ │ │ │ └── ExampleUnitTest.kt │ │ └── androidTest │ │ │ └── java │ │ │ └── com │ │ │ └── ixidev │ │ │ └── simplenotepad │ │ │ ├── ExampleInstrumentedTest.kt │ │ │ └── db │ │ │ └── NotesDBTest.kt │ ├── proguard-rules.pro │ └── build.gradle │ ├── settings.gradle │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── build.gradle │ ├── gradle.properties │ ├── gradlew.bat │ └── gradlew ├── device-2020-04-16-203947.png ├── device-2020-04-16-204007.png ├── device-2020-04-16-204020.png ├── device-2020-04-16-204050.png ├── device-2020-04-16-204423.png └── README.md /Java/Application/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /Kotlin/Application/.idea/.name: -------------------------------------------------------------------------------- 1 | Simple Notepad -------------------------------------------------------------------------------- /Kotlin/Application/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /Java/Application/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /Kotlin/Application/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='Simple Notepad' 2 | include ':app' 3 | -------------------------------------------------------------------------------- /device-2020-04-16-203947.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/device-2020-04-16-203947.png -------------------------------------------------------------------------------- /device-2020-04-16-204007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/device-2020-04-16-204007.png -------------------------------------------------------------------------------- /device-2020-04-16-204020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/device-2020-04-16-204020.png -------------------------------------------------------------------------------- /device-2020-04-16-204050.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/device-2020-04-16-204050.png -------------------------------------------------------------------------------- /device-2020-04-16-204423.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/device-2020-04-16-204423.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 4 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 4 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /Java/Application/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Kotlin/Application/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Java/Application/.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB33 4 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB33 4 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Java/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Kotlin/Application/.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Java/Application/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /Java/Application/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixiDev/SimpleNotepadAndroid/HEAD/Kotlin/Application/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Kotlin/Application/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Kotlin/Application/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /Java/Application/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 13:20:59 WEST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip 7 | -------------------------------------------------------------------------------- /Kotlin/Application/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Apr 16 17:10:44 WET 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip 7 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/utils/Constants.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.utils 2 | 3 | /** 4 | * Created by ABDELMAJID ID ALI on 16/04/2020. 5 | * Email : abdelmajid.idali@gmail.com 6 | * Github : https://github.com/ixiDev 7 | */ 8 | const val THEME_Key = "app_theme" 9 | const val APP_PREFERENCES = "notepad_settings" -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/menu/edite_note_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/menu/edite_note_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Simple Notepad 3 | Whats in your mind 4 | Share Note 5 | Delete Notes 6 | No Notes ! 7 | 8 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/drawable/ic_add_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/drawable/ic_home_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/drawable/ic_add_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Simple Notepad 3 | Settings 4 | Whats in your mind 5 | Share Note 6 | Delete Notes 7 | No Notes ! 8 | 9 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/drawable/ic_delete_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/drawable/ic_delete_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/drawable/ic_note_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/test/java/com/ixidev/simplenotepad/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Java/Application/app/src/test/java/com/ixidev/simplenotepad/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF9800 4 | #F57C00 5 | #ffa008 6 | #c7c7C7 7 | 8 | 9 | #212121 10 | #FF9800 11 | #DE000000 12 | 13 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF9800 4 | #F57C00 5 | #ffa008 6 | #c7c7C7 7 | 8 | 9 | #212121 10 | #FF9800 11 | #DE000000 12 | 13 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/drawable/ic_dark_theme.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/callbacks/NoteEventListener.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.callbacks 2 | 3 | import com.ixidev.simplenotepad.entity.Note 4 | 5 | 6 | /** 7 | * Created by ixi.Dv on 22/07/2018. 8 | */ 9 | interface NoteEventListener { 10 | /** 11 | * call wen note clicked. 12 | * 13 | * @param note: note item 14 | */ 15 | fun onNoteClick(note: Note) 16 | 17 | /** 18 | * call wen long Click to note. 19 | * 20 | * @param note : item 21 | */ 22 | fun onNoteLongClick(note: Note) 23 | } -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/drawable/ic_dark_theme.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SimpleNotepadAndroid 2 | Saimple Notepad for android 3 | Follow video tutorial on youtube : https://www.youtube.com/playlist?list=PL7hEgwbTA5AoItKHCZrK2LH_YkNkh4oDW 4 | 5 | ## Light 6 |

7 | 8 | 9 | 10 |

11 | 12 | ## Dark 13 |

14 | 15 | 16 |

17 | 18 | -------------------------------------------------------------------------------- /Java/Application/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/java/com/ixidev/simplenotepad/callbacks/NoteEventListener.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.callbacks; 2 | 3 | import com.ixidev.simplenotepad.model.Note; 4 | 5 | /** 6 | * Created by ixi.Dv on 22/07/2018. 7 | */ 8 | public interface NoteEventListener { 9 | /** 10 | * call wen note clicked. 11 | * 12 | * @param note: note item 13 | */ 14 | void onNoteClick(Note note); 15 | 16 | /** 17 | * call wen long Click to note. 18 | * 19 | * @param note : item 20 | */ 21 | void onNoteLongClick(Note note); 22 | } 23 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/utils/NoteUtils.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.utils 2 | 3 | import java.text.DateFormat 4 | import java.text.SimpleDateFormat 5 | import java.util.* 6 | 7 | /** 8 | * Created by ixi.Dv on 13/05/2018. 9 | */ 10 | object NoteUtils { 11 | /** 12 | * @param time that will be convert and formatted to string 13 | * @return string 14 | */ 15 | fun dateFromLong(time: Long): String { 16 | val format: DateFormat = 17 | SimpleDateFormat("EEE, dd MMM yyyy 'at' hh:mm aaa", Locale.US) 18 | return format.format(Date(time)) 19 | } 20 | } -------------------------------------------------------------------------------- /Java/Application/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /Kotlin/Application/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/java/com/ixidev/simplenotepad/utils/NoteUtils.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.utils; 2 | 3 | import java.text.DateFormat; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | import java.util.Locale; 7 | 8 | /** 9 | * Created by ixi.Dv on 13/05/2018. 10 | */ 11 | public class NoteUtils { 12 | /** 13 | * @param time that will be convert and formatted to string 14 | * @return string 15 | */ 16 | public static String dateFromLong(long time) { 17 | DateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy 'at' hh:mm aaa", Locale.US); 18 | return format.format(new Date(time)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Java/Application/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.6.0' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/entity/Note.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.entity 2 | 3 | import androidx.room.ColumnInfo 4 | import androidx.room.Entity 5 | import androidx.room.Ignore 6 | import androidx.room.PrimaryKey 7 | 8 | /** 9 | * Created by ABDELMAJID ID ALI on 16/04/2020. 10 | * Email : abdelmajid.idali@gmail.com 11 | * Github : https://github.com/ixiDev 12 | */ 13 | @Entity(tableName = "notes") 14 | data class Note( 15 | @PrimaryKey(autoGenerate = true) 16 | val id: Int, 17 | @ColumnInfo(name = "text") 18 | var noteText: String, 19 | @ColumnInfo(name = "date") 20 | var noteDate: Long 21 | ) { 22 | @Ignore 23 | var checked: Boolean = false 24 | } -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/drawable/ic_share_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/drawable/ic_share_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/menu/main_action_mode.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 14 | 19 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/menu/main_action_mode.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 14 | 19 | -------------------------------------------------------------------------------- /Kotlin/Application/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.3.61' 5 | repositories { 6 | google() 7 | jcenter() 8 | 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.6.0' 12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | google() 22 | jcenter() 23 | 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /Java/Application/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /Kotlin/Application/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /Java/Application/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | android.enableJetifier=true 10 | android.useAndroidX=true 11 | org.gradle.jvmargs=-Xmx1536m 12 | # When configured, Gradle will run in incubating parallel mode. 13 | # This option should only be used with decoupled projects. More details, visit 14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 15 | # org.gradle.parallel=true 16 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/androidTest/java/com/ixidev/simplenotepad/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.ixidev.simplenotepad", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Java/Application/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /Kotlin/Application/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /Java/Application/app/src/androidTest/java/com/ixidev/simplenotepad/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | /** 11 | * Instrumented test, which will execute on an Android device. 12 | * 13 | * @see Testing documentation 14 | */ 15 | @RunWith(AndroidJUnit4.class) 16 | public class ExampleInstrumentedTest { 17 | @Test 18 | public void useAppContext() { 19 | // Context of the app under test. 20 | Context appContext = InstrumentationRegistry.getTargetContext(); 21 | 22 | assertEquals("com.ixidev.simplenotepad", appContext.getPackageName()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/java/com/ixidev/simplenotepad/db/NotesDB.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.db; 2 | 3 | import androidx.room.Database; 4 | import androidx.room.Room; 5 | import androidx.room.RoomDatabase; 6 | import android.content.Context; 7 | 8 | import com.ixidev.simplenotepad.model.Note; 9 | 10 | /** 11 | * Created by ixi.Dv on 20/06/2018. 12 | */ 13 | @Database(entities = Note.class, version = 1) 14 | public abstract class NotesDB extends RoomDatabase { 15 | public abstract NotesDao notesDao(); 16 | 17 | public static final String DATABSE_NAME = "notesDb"; 18 | private static NotesDB instance; 19 | 20 | public static NotesDB getInstance(Context context) { 21 | if (instance == null) 22 | instance = Room.databaseBuilder(context, NotesDB.class, DATABSE_NAME) 23 | .allowMainThreadQueries() 24 | .build(); 25 | return instance; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/db/NotesDB.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.db 2 | 3 | import android.content.Context 4 | import androidx.room.Database 5 | import androidx.room.Room 6 | import androidx.room.RoomDatabase 7 | import com.ixidev.simplenotepad.entity.Note 8 | 9 | /** 10 | * Created by ixi.Dv on 20/06/2018. 11 | */ 12 | @Database(entities = [Note::class], version = 1) 13 | abstract class NotesDB : RoomDatabase() { 14 | abstract fun notesDao(): NotesDao 15 | companion object { 16 | private const val DATABSE_NAME = "notesDb" 17 | private var instance: NotesDB? = null 18 | fun getInstance(context: Context): NotesDB { 19 | if (instance == null) instance = 20 | Room.databaseBuilder( 21 | context, 22 | NotesDB::class.java, 23 | DATABSE_NAME 24 | ) 25 | .allowMainThreadQueries() 26 | .build() 27 | return instance as NotesDB 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Kotlin/Application/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 1.8 19 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/drawable/ic_settings_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Kotlin/Application/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 18 | 19 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/db/NotesDao.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.db 2 | 3 | import androidx.room.* 4 | import com.ixidev.simplenotepad.entity.Note 5 | 6 | /** 7 | * Notes Data Object access help to access the notes 8 | * Created by ixi.Dv on 20/06/2018. 9 | */ 10 | @Dao 11 | interface NotesDao { 12 | /** 13 | * Insert and save note to Database 14 | * 15 | * @param note 16 | */ 17 | @Insert(onConflict = OnConflictStrategy.REPLACE) 18 | fun insertNote(note: Note): Long 19 | 20 | /** 21 | * Delete note 22 | * 23 | * @param note that will be delete 24 | */ 25 | @Delete 26 | fun deleteNote(vararg note: Note) 27 | 28 | /** 29 | * Update note 30 | * 31 | * @param note the note that will be update 32 | */ 33 | @Update 34 | fun updateNote(note: Note) 35 | 36 | /** 37 | * List All Notes From Database 38 | * 39 | * @return list of Notes 40 | */ 41 | @get:Query("SELECT * FROM notes") 42 | val notes: List 43 | 44 | /** 45 | * @param noteId note id 46 | * @return Note 47 | */ 48 | @Query("SELECT * FROM notes WHERE id = :noteId") 49 | fun getNoteById(noteId: Int): Note 50 | 51 | /** 52 | * Delete Note by Id from DataBase 53 | * 54 | * @param noteId 55 | */ 56 | @Query("DELETE FROM notes WHERE id = :noteId") 57 | fun deleteNoteById(noteId: Int) 58 | } -------------------------------------------------------------------------------- /Kotlin/Application/app/src/androidTest/java/com/ixidev/simplenotepad/db/NotesDBTest.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.db 2 | 3 | import android.util.Log 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | import androidx.test.platform.app.InstrumentationRegistry 6 | import com.ixidev.simplenotepad.entity.Note 7 | import org.junit.Test 8 | import org.junit.runner.RunWith 9 | import java.util.* 10 | 11 | /** 12 | * Created by ABDELMAJID ID ALI on 16/04/2020. 13 | * Email : abdelmajid.idali@gmail.com 14 | * Github : https://github.com/ixiDev 15 | */ 16 | 17 | @RunWith(AndroidJUnit4::class) 18 | class NotesDBTest { 19 | private val TAG = "NotesDBTest" 20 | @Test 21 | fun testDao() { 22 | 23 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 24 | 25 | val dao = NotesDB.getInstance(appContext).notesDao() 26 | val time = Date().time 27 | val insertNote = dao.insertNote(Note(0, "test", time)) 28 | Log.i(TAG, "insertNote : $insertNote"); 29 | assert(insertNote > 0) 30 | /* val noteById = dao.getNoteById(insertNote.toInt()) 31 | assertEquals(time, noteById.noteDate)*/ 32 | } 33 | 34 | @Test 35 | fun testGatAllNotes() { 36 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 37 | val dao = NotesDB.getInstance(appContext).notesDao() 38 | val notes = dao.notes 39 | 40 | Log.i(TAG, "siz : ${notes.size}"); 41 | assert(notes.isNotEmpty()) 42 | 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 33 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 33 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/layout/activity_edite_note.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 19 | 20 | 36 | 37 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/layout/activity_edit_note.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 19 | 20 | 36 | 37 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/java/com/ixidev/simplenotepad/callbacks/MainActionModeCallback.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.callbacks; 2 | 3 | import android.view.ActionMode; 4 | import android.view.Menu; 5 | import android.view.MenuItem; 6 | 7 | import com.ixidev.simplenotepad.R; 8 | 9 | /** 10 | * Created by ixi.Dv on 22/07/2018. 11 | */ 12 | public abstract class MainActionModeCallback implements ActionMode.Callback { 13 | private ActionMode action; 14 | private MenuItem countItem; 15 | private MenuItem shareItem; 16 | 17 | @Override 18 | public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { 19 | actionMode.getMenuInflater().inflate(R.menu.main_action_mode, menu); 20 | this.action = actionMode; 21 | this.countItem = menu.findItem(R.id.action_checked_count); 22 | this.shareItem = menu.findItem(R.id.action_share_note); 23 | return true; 24 | } 25 | 26 | @Override 27 | public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) { 28 | return false; 29 | } 30 | 31 | @Override 32 | public void onDestroyActionMode(ActionMode actionMode) { 33 | 34 | } 35 | 36 | public void setCount(String chackedCount) { 37 | if (countItem != null) 38 | this.countItem.setTitle(chackedCount); 39 | } 40 | 41 | /** 42 | * if checked count > 1 hide shareItem else show it 43 | * 44 | * @param b :visible 45 | */ 46 | public void changeShareItemVisible(boolean b) { 47 | shareItem.setVisible(b); 48 | } 49 | 50 | public ActionMode getAction() { 51 | return action; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/callbacks/MainActionModeCallback.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.callbacks 2 | 3 | import android.view.Menu 4 | import android.view.MenuItem 5 | import androidx.appcompat.view.ActionMode 6 | import com.ixidev.simplenotepad.R 7 | 8 | /** 9 | * Created by ixi.Dv on 22/07/2018. 10 | */ 11 | public abstract class MainActionModeCallback : ActionMode.Callback { 12 | var action: ActionMode? = null 13 | private set 14 | private var countItem: MenuItem? = null 15 | private var shareItem: MenuItem? = null 16 | override fun onCreateActionMode( 17 | mode: ActionMode?, 18 | menu: Menu? 19 | ): Boolean { 20 | mode?.let { 21 | it.menuInflater.inflate(R.menu.main_action_mode, menu) 22 | action = it 23 | countItem = menu!!.findItem(R.id.action_checked_count) 24 | shareItem = menu.findItem(R.id.action_share_note) 25 | } 26 | return true 27 | } 28 | 29 | override fun onPrepareActionMode( 30 | actionMode: ActionMode, 31 | menu: Menu 32 | ): Boolean { 33 | return false 34 | } 35 | 36 | override fun onDestroyActionMode(actionMode: ActionMode) {} 37 | 38 | 39 | fun setCount(chackedCount: String?) { 40 | countItem?.apply { 41 | title = chackedCount 42 | } 43 | } 44 | 45 | /** 46 | * if checked count > 1 hide shareItem else show it 47 | * 48 | * @param b :visible 49 | */ 50 | fun changeShareItemVisible(b: Boolean) { 51 | shareItem?.apply { 52 | isVisible = b 53 | } 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /Java/Application/app/src/main/java/com/ixidev/simplenotepad/db/NotesDao.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.db; 2 | 3 | import androidx.room.Dao; 4 | import androidx.room.Delete; 5 | import androidx.room.Insert; 6 | import androidx.room.OnConflictStrategy; 7 | import androidx.room.Query; 8 | import androidx.room.Update; 9 | 10 | import com.ixidev.simplenotepad.model.Note; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Notes Data Object access help to access the notes 16 | * Created by ixi.Dv on 20/06/2018. 17 | */ 18 | @Dao 19 | public interface NotesDao { 20 | /** 21 | * Insert and save note to Database 22 | * 23 | * @param note 24 | */ 25 | @Insert(onConflict = OnConflictStrategy.REPLACE) 26 | void insertNote(Note note); 27 | 28 | /** 29 | * Delete note 30 | * 31 | * @param note that will be delete 32 | */ 33 | @Delete 34 | void deleteNote(Note... note); 35 | 36 | /** 37 | * Update note 38 | * 39 | * @param note the note that will be update 40 | */ 41 | @Update 42 | void updateNote(Note note); 43 | 44 | /** 45 | * List All Notes From Database 46 | * 47 | * @return list of Notes 48 | */ 49 | @Query("SELECT * FROM notes") 50 | List getNotes(); 51 | 52 | /** 53 | * @param noteId note id 54 | * @return Note 55 | */ 56 | @Query("SELECT * FROM notes WHERE id = :noteId") 57 | Note getNoteById(int noteId); 58 | 59 | /** 60 | * Delete Note by Id from DataBase 61 | * 62 | * @param noteId 63 | */ 64 | @Query("DELETE FROM notes WHERE id = :noteId") 65 | void deleteNoteById(int noteId); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /Java/Application/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | defaultConfig { 6 | applicationId "com.ixidev.simplenotepad" 7 | minSdkVersion 17 8 | targetSdkVersion 29 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | compileOptions { 20 | sourceCompatibility = 1.8 21 | targetCompatibility = 1.8 22 | } 23 | buildToolsVersion = '29.0.2' 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | implementation 'androidx.appcompat:appcompat:1.1.0' 29 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 30 | implementation 'com.google.android.material:material:1.1.0' 31 | testImplementation 'junit:junit:4.13' 32 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 34 | // this for Room database 35 | implementation 'androidx.room:room-runtime:2.2.5' 36 | annotationProcessor 'androidx.room:room-compiler:2.2.5' 37 | implementation 'androidx.paging:paging-runtime:2.1.2' 38 | testImplementation 'androidx.room:room-testing:2.2.5' 39 | 40 | // add this line for Material Drawer 41 | implementation('com.mikepenz:materialdrawer:7.0.0@aar') { 42 | transitive = true 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/java/com/ixidev/simplenotepad/model/Note.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.model; 2 | 3 | import androidx.room.ColumnInfo; 4 | import androidx.room.Entity; 5 | import androidx.room.Ignore; 6 | import androidx.room.PrimaryKey; 7 | 8 | /** 9 | * Created by ixi.Dv on 13/05/2018. 10 | */ 11 | 12 | @Entity(tableName = "notes") 13 | public class Note { 14 | @PrimaryKey(autoGenerate = true) 15 | private int id; // default value 16 | @ColumnInfo(name = "text") 17 | private String noteText; 18 | @ColumnInfo(name = "date") 19 | private long noteDate; 20 | 21 | @Ignore // we don't want to store this value on database so ignore it 22 | private boolean checked = false; 23 | 24 | public Note() { 25 | } 26 | 27 | public Note(String noteText, long noteDate) { 28 | this.noteText = noteText; 29 | this.noteDate = noteDate; 30 | } 31 | 32 | public String getNoteText() { 33 | return noteText; 34 | } 35 | 36 | public void setNoteText(String noteText) { 37 | this.noteText = noteText; 38 | } 39 | 40 | public long getNoteDate() { 41 | return noteDate; 42 | } 43 | 44 | public void setNoteDate(long noteDate) { 45 | this.noteDate = noteDate; 46 | } 47 | 48 | public int getId() { 49 | return id; 50 | } 51 | 52 | public void setId(int id) { 53 | this.id = id; 54 | } 55 | 56 | public boolean isChecked() { 57 | return checked; 58 | } 59 | 60 | public void setChecked(boolean checked) { 61 | this.checked = checked; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "Note{" + 67 | "id=" + id + 68 | ", noteDate=" + noteDate + 69 | '}'; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Kotlin/Application/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion 29 8 | buildToolsVersion "29.0.2" 9 | 10 | defaultConfig { 11 | applicationId "com.ixidev.simplenotepad" 12 | minSdkVersion 17 13 | targetSdkVersion 29 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | 27 | } 28 | 29 | dependencies { 30 | implementation fileTree(dir: 'libs', include: ['*.jar']) 31 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 32 | implementation 'androidx.appcompat:appcompat:1.1.0' 33 | implementation 'androidx.core:core-ktx:1.2.0' 34 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 35 | testImplementation 'junit:junit:4.12' 36 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 38 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 39 | implementation 'androidx.cardview:cardview:1.0.0' 40 | implementation 'com.google.android.material:material:1.1.0' 41 | // Room Database Persistence 42 | implementation 'androidx.room:room-ktx:2.2.5' 43 | kapt 'androidx.room:room-compiler:2.2.5' 44 | // matareial drawer 45 | implementation "com.mikepenz:materialdrawer:7.0.0" 46 | implementation "com.mikepenz:fontawesome-typeface:5.9.0.0-kotlin" 47 | } 48 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/layout/note_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 16 | 17 | 23 | 24 | 32 | 33 | 41 | 42 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/res/layout/note_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 16 | 17 | 23 | 24 | 32 | 33 | 41 | 42 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /Java/Application/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /Kotlin/Application/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/java/com/ixidev/simplenotepad/EditNoteActivity.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.os.Bundle; 6 | import android.view.Menu; 7 | import android.view.MenuItem; 8 | import android.widget.EditText; 9 | 10 | import androidx.appcompat.app.AppCompatActivity; 11 | import androidx.appcompat.widget.Toolbar; 12 | 13 | import com.ixidev.simplenotepad.db.NotesDB; 14 | import com.ixidev.simplenotepad.db.NotesDao; 15 | import com.ixidev.simplenotepad.model.Note; 16 | 17 | import java.util.Date; 18 | 19 | public class EditNoteActivity extends AppCompatActivity { 20 | private EditText inputNote; 21 | private NotesDao dao; 22 | private Note temp; 23 | public static final String NOTE_EXTRA_Key = "note_id"; 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | 28 | // set theme 29 | SharedPreferences sharedPreferences = getSharedPreferences(MainActivity.APP_PREFERENCES, Context.MODE_PRIVATE); 30 | int theme = sharedPreferences.getInt(MainActivity.THEME_Key, R.style.AppTheme); 31 | setTheme(theme); 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_edite_note); 34 | Toolbar toolbar = findViewById(R.id.edit_note_activity_toolbar); 35 | setSupportActionBar(toolbar); 36 | 37 | inputNote = findViewById(R.id.input_note); 38 | dao = NotesDB.getInstance(this).notesDao(); 39 | if (getIntent().getExtras() != null) { 40 | int id = getIntent().getExtras().getInt(NOTE_EXTRA_Key, 0); 41 | temp = dao.getNoteById(id); 42 | inputNote.setText(temp.getNoteText()); 43 | } else inputNote.setFocusable(true); 44 | 45 | } 46 | 47 | @Override 48 | public boolean onCreateOptionsMenu(Menu menu) { 49 | getMenuInflater().inflate(R.menu.edite_note_menu, menu); 50 | return super.onCreateOptionsMenu(menu); 51 | } 52 | 53 | @Override 54 | public boolean onOptionsItemSelected(MenuItem item) { 55 | int id = item.getItemId(); 56 | if (id == R.id.save_note) 57 | onSaveNote(); 58 | return super.onOptionsItemSelected(item); 59 | } 60 | 61 | private void onSaveNote() { 62 | // TODO: 20/06/2018 Save Note 63 | String text = inputNote.getText().toString(); 64 | if (!text.isEmpty()) { 65 | long date = new Date().getTime(); // get system time 66 | // if exist update els crete new 67 | if (temp == null) { 68 | temp = new Note(text, date); 69 | dao.insertNote(temp); // create new note and inserted to database 70 | } else { 71 | temp.setNoteText(text); 72 | temp.setNoteDate(date); 73 | dao.updateNote(temp); // change text and date and update note on database 74 | } 75 | 76 | finish(); // return to the MainActivity 77 | } 78 | 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/EditNoteActivity.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad 2 | 3 | import android.content.Context 4 | import android.os.Bundle 5 | import android.view.Menu 6 | import android.view.MenuItem 7 | import android.widget.EditText 8 | import androidx.appcompat.app.AppCompatActivity 9 | import com.ixidev.simplenotepad.db.NotesDB 10 | import com.ixidev.simplenotepad.db.NotesDao 11 | import com.ixidev.simplenotepad.entity.Note 12 | import com.ixidev.simplenotepad.utils.APP_PREFERENCES 13 | import com.ixidev.simplenotepad.utils.THEME_Key 14 | import kotlinx.android.synthetic.main.activity_edit_note.* 15 | import java.util.* 16 | 17 | 18 | class EditNoteActivity : AppCompatActivity() { 19 | 20 | private lateinit var inputNote: EditText 21 | private lateinit var dao: NotesDao 22 | private var temp: Note? = null 23 | 24 | companion object { 25 | val NOTE_EXTRA_Key = "note_id" 26 | } 27 | 28 | override fun onCreate(savedInstanceState: Bundle?) { 29 | setupTheme() 30 | super.onCreate(savedInstanceState) 31 | setContentView(R.layout.activity_edit_note) 32 | setSupportActionBar(edit_note_activity_toolbar) 33 | inputNote = input_note 34 | dao = NotesDB.getInstance(this).notesDao() 35 | 36 | if (intent.extras != null) { 37 | val id = intent.extras!!.getInt(NOTE_EXTRA_Key, 0) 38 | temp = dao.getNoteById(id) 39 | temp?.let { 40 | inputNote.setText(it.noteText) 41 | } 42 | } else inputNote.isFocusable = true 43 | } 44 | 45 | private fun setupTheme() { 46 | // set theme 47 | val sharedPreferences = 48 | getSharedPreferences(APP_PREFERENCES, Context.MODE_PRIVATE) 49 | val theme = sharedPreferences.getInt(THEME_Key, R.style.AppTheme) 50 | setTheme(theme) 51 | } 52 | 53 | 54 | override fun onCreateOptionsMenu(menu: Menu?): Boolean { 55 | menuInflater.inflate(R.menu.edite_note_menu, menu) 56 | return super.onCreateOptionsMenu(menu) 57 | } 58 | 59 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 60 | val id: Int = item.itemId 61 | if (id == R.id.save_note) onSaveNote() 62 | return super.onOptionsItemSelected(item) 63 | } 64 | 65 | private fun onSaveNote() { // TODO: 20/06/2018 Save Note 66 | val text = inputNote.toText() 67 | if (text.isNotEmpty()) { 68 | val date: Long = Date().time // get system time 69 | // if exist update els crete new 70 | if (temp == null) { 71 | temp = Note(0, text, date) 72 | dao.insertNote(temp!!) // create new note and inserted to database 73 | } else { 74 | temp!!.noteText = text 75 | temp!!.noteDate = date 76 | dao.updateNote(temp!!) // change text and date and update note on database 77 | } 78 | finish() // return to the MainActivity 79 | } 80 | } 81 | 82 | 83 | private fun EditText.toText(): String { 84 | return this.text.toString() 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Java/Application/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | xmlns:android 11 | 12 | ^$ 13 | 14 | 15 | 16 |
17 |
18 | 19 | 20 | 21 | xmlns:.* 22 | 23 | ^$ 24 | 25 | 26 | BY_NAME 27 | 28 |
29 |
30 | 31 | 32 | 33 | .*:id 34 | 35 | http://schemas.android.com/apk/res/android 36 | 37 | 38 | 39 |
40 |
41 | 42 | 43 | 44 | .*:name 45 | 46 | http://schemas.android.com/apk/res/android 47 | 48 | 49 | 50 |
51 |
52 | 53 | 54 | 55 | name 56 | 57 | ^$ 58 | 59 | 60 | 61 |
62 |
63 | 64 | 65 | 66 | style 67 | 68 | ^$ 69 | 70 | 71 | 72 |
73 |
74 | 75 | 76 | 77 | .* 78 | 79 | ^$ 80 | 81 | 82 | BY_NAME 83 | 84 |
85 |
86 | 87 | 88 | 89 | .* 90 | 91 | http://schemas.android.com/apk/res/android 92 | 93 | 94 | ANDROID_ATTRIBUTE_ORDER 95 | 96 |
97 |
98 | 99 | 100 | 101 | .* 102 | 103 | .* 104 | 105 | 106 | BY_NAME 107 | 108 |
109 |
110 |
111 |
112 |
113 |
-------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/adapters/NotesAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.adapters 2 | 3 | import android.content.Context 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.TextView 8 | import androidx.appcompat.widget.AppCompatCheckBox 9 | import androidx.recyclerview.widget.RecyclerView 10 | import com.ixidev.simplenotepad.R 11 | import com.ixidev.simplenotepad.adapters.NotesAdapter.NoteHolder 12 | import com.ixidev.simplenotepad.callbacks.NoteEventListener 13 | import com.ixidev.simplenotepad.entity.Note 14 | import com.ixidev.simplenotepad.utils.NoteUtils 15 | import kotlinx.android.synthetic.main.note_layout.view.* 16 | 17 | /** 18 | * Created by ixi.Dv on 13/05/2018. 19 | */ 20 | class NotesAdapter( 21 | private val context: Context, 22 | private var notes: List 23 | ) : 24 | RecyclerView.Adapter() { 25 | private var listener: NoteEventListener? = null 26 | private var multiCheckMode = false 27 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NoteHolder { 28 | val v = 29 | LayoutInflater.from(context).inflate(R.layout.note_layout, parent, false) 30 | return NoteHolder(v) 31 | } 32 | 33 | override fun onBindViewHolder(holder: NoteHolder, position: Int) { 34 | val note: Note? = getNote(position) 35 | note?.let { 36 | holder.noteText.text = it.noteText 37 | holder.noteDate.text = NoteUtils.dateFromLong(it.noteDate) 38 | // init note click event 39 | holder.itemView.setOnClickListener { listener!!.onNoteClick(note) } 40 | // init note long click 41 | holder.itemView.setOnLongClickListener { 42 | listener!!.onNoteLongClick(note) 43 | false 44 | } 45 | // check checkBox if note selected 46 | if (multiCheckMode) { 47 | holder.checkBox.visibility = View.VISIBLE // show checkBox if multiMode on 48 | holder.checkBox.isChecked = note.checked 49 | } else holder.checkBox.visibility = View.GONE // hide checkBox if multiMode off 50 | } 51 | } 52 | 53 | override fun getItemCount(): Int { 54 | return notes.size 55 | } 56 | 57 | private fun getNote(position: Int): Note? { 58 | return notes[position] 59 | } 60 | 61 | /** 62 | * get All checked notes 63 | * 64 | * @return Array 65 | */ 66 | fun getCheckedNotes(): List = notes.filter { note -> 67 | note.checked 68 | } 69 | 70 | 71 | inner class NoteHolder(itemView: View) : 72 | RecyclerView.ViewHolder(itemView) { 73 | var noteText: TextView 74 | var noteDate: TextView 75 | var checkBox: AppCompatCheckBox 76 | 77 | init { 78 | itemView.apply { 79 | noteText = note_text 80 | noteDate = note_date 81 | checkBox = check_Box 82 | } 83 | } 84 | /* var noteText: TextView = itemView.findViewById(R.id.note_text) 85 | var noteDate: TextView = itemView.findViewById(R.id.note_date) 86 | var checkBox: CheckBox = itemView.findViewById(R.id.checkBox)*/ 87 | 88 | } 89 | 90 | fun setListener(listener: NoteEventListener?) { 91 | this.listener = listener 92 | } 93 | 94 | fun setMultiCheckMode(multiCheckMode: Boolean) { 95 | this.multiCheckMode = multiCheckMode 96 | if (!multiCheckMode) 97 | notes.forEach { 98 | it.checked = false 99 | } 100 | notifyDataSetChanged() 101 | } 102 | 103 | } -------------------------------------------------------------------------------- /Kotlin/Application/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | xmlns:android 17 | 18 | ^$ 19 | 20 | 21 | 22 |
23 |
24 | 25 | 26 | 27 | xmlns:.* 28 | 29 | ^$ 30 | 31 | 32 | BY_NAME 33 | 34 |
35 |
36 | 37 | 38 | 39 | .*:id 40 | 41 | http://schemas.android.com/apk/res/android 42 | 43 | 44 | 45 |
46 |
47 | 48 | 49 | 50 | .*:name 51 | 52 | http://schemas.android.com/apk/res/android 53 | 54 | 55 | 56 |
57 |
58 | 59 | 60 | 61 | name 62 | 63 | ^$ 64 | 65 | 66 | 67 |
68 |
69 | 70 | 71 | 72 | style 73 | 74 | ^$ 75 | 76 | 77 | 78 |
79 |
80 | 81 | 82 | 83 | .* 84 | 85 | ^$ 86 | 87 | 88 | BY_NAME 89 | 90 |
91 |
92 | 93 | 94 | 95 | .* 96 | 97 | http://schemas.android.com/apk/res/android 98 | 99 | 100 | ANDROID_ATTRIBUTE_ORDER 101 | 102 |
103 |
104 | 105 | 106 | 107 | .* 108 | 109 | .* 110 | 111 | 112 | BY_NAME 113 | 114 |
115 |
116 |
117 |
118 | 119 | 121 |
122 |
-------------------------------------------------------------------------------- /Java/Application/app/src/main/java/com/ixidev/simplenotepad/adapters/NotesAdapter.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad.adapters; 2 | 3 | import android.content.Context; 4 | import androidx.annotation.NonNull; 5 | import androidx.recyclerview.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.CheckBox; 10 | import android.widget.TextView; 11 | 12 | import com.ixidev.simplenotepad.R; 13 | import com.ixidev.simplenotepad.callbacks.NoteEventListener; 14 | import com.ixidev.simplenotepad.model.Note; 15 | import com.ixidev.simplenotepad.utils.NoteUtils; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | /** 21 | * Created by ixi.Dv on 13/05/2018. 22 | */ 23 | public class NotesAdapter extends RecyclerView.Adapter { 24 | private Context context; 25 | private ArrayList notes; 26 | private NoteEventListener listener; 27 | private boolean multiCheckMode = false; 28 | 29 | 30 | public NotesAdapter(Context context, ArrayList notes) { 31 | this.context = context; 32 | this.notes = notes; 33 | } 34 | 35 | 36 | @NonNull 37 | @Override 38 | public NoteHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 39 | View v = LayoutInflater.from(context).inflate(R.layout.note_layout, parent, false); 40 | return new NoteHolder(v); 41 | } 42 | 43 | @Override 44 | public void onBindViewHolder(NoteHolder holder, int position) { 45 | final Note note = getNote(position); 46 | if (note != null) { 47 | holder.noteText.setText(note.getNoteText()); 48 | holder.noteDate.setText(NoteUtils.dateFromLong(note.getNoteDate())); 49 | // init note click event 50 | holder.itemView.setOnClickListener(new View.OnClickListener() { 51 | @Override 52 | public void onClick(View view) { 53 | listener.onNoteClick(note); 54 | } 55 | }); 56 | 57 | // init note long click 58 | holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { 59 | @Override 60 | public boolean onLongClick(View view) { 61 | listener.onNoteLongClick(note); 62 | return false; 63 | } 64 | }); 65 | 66 | // check checkBox if note selected 67 | if (multiCheckMode) { 68 | holder.checkBox.setVisibility(View.VISIBLE); // show checkBox if multiMode on 69 | holder.checkBox.setChecked(note.isChecked()); 70 | } else holder.checkBox.setVisibility(View.GONE); // hide checkBox if multiMode off 71 | 72 | 73 | } 74 | } 75 | 76 | @Override 77 | public int getItemCount() { 78 | return notes.size(); 79 | } 80 | 81 | private Note getNote(int position) { 82 | return notes.get(position); 83 | } 84 | 85 | 86 | /** 87 | * get All checked notes 88 | * 89 | * @return Array 90 | */ 91 | public List getCheckedNotes() { 92 | List checkedNotes = new ArrayList<>(); 93 | for (Note n : this.notes) { 94 | if (n.isChecked()) 95 | checkedNotes.add(n); 96 | } 97 | 98 | return checkedNotes; 99 | } 100 | 101 | 102 | class NoteHolder extends RecyclerView.ViewHolder { 103 | TextView noteText, noteDate; 104 | CheckBox checkBox; 105 | 106 | public NoteHolder(View itemView) { 107 | super(itemView); 108 | noteDate = itemView.findViewById(R.id.note_date); 109 | noteText = itemView.findViewById(R.id.note_text); 110 | checkBox = itemView.findViewById(R.id.checkBox); 111 | } 112 | } 113 | 114 | 115 | public void setListener(NoteEventListener listener) { 116 | this.listener = listener; 117 | } 118 | 119 | public void setMultiCheckMode(boolean multiCheckMode) { 120 | this.multiCheckMode = multiCheckMode; 121 | if (!multiCheckMode) 122 | for (Note note : this.notes) { 123 | note.setChecked(false); 124 | } 125 | notifyDataSetChanged(); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /Kotlin/Application/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ]; do 14 | ls=$(ls -ld "$PRG") 15 | link=$(expr "$ls" : '.*-> \(.*\)$') 16 | if expr "$link" : '/.*' >/dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=$(dirname "$PRG")"/$link" 20 | fi 21 | done 22 | SAVED="$(pwd)" 23 | cd "$(dirname \"$PRG\")/" >/dev/null 24 | APP_HOME="$(pwd -P)" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=$(basename "$0") 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn() { 37 | echo "$*" 38 | } 39 | 40 | die() { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "$(uname)" in 53 | CYGWIN*) 54 | cygwin=true 55 | ;; 56 | Darwin*) 57 | darwin=true 58 | ;; 59 | MINGW*) 60 | msys=true 61 | ;; 62 | NONSTOP*) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ]; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ]; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then 93 | MAX_FD_LIMIT=$(ulimit -H -n) 94 | if [ $? -eq 0 ]; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ]; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin; then 114 | APP_HOME=$(cygpath --path --mixed "$APP_HOME") 115 | CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") 116 | JAVACMD=$(cygpath --unix "$JAVACMD") 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) 120 | SEP="" 121 | for dir in $ROOTDIRSRAW; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ]; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@"; do 133 | CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) 134 | CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition 137 | eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") 138 | else 139 | eval $(echo args$i)="\"$arg\"" 140 | fi 141 | i=$((i + 1)) 142 | done 143 | case $i in 144 | 0) set -- ;; 145 | 1) set -- "$args0" ;; 146 | 2) set -- "$args0" "$args1" ;; 147 | 3) set -- "$args0" "$args1" "$args2" ;; 148 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save() { 159 | for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /Java/Application/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /Kotlin/Application/app/src/main/java/com/ixidev/simplenotepad/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad 2 | 3 | import android.content.Context 4 | import android.content.Intent 5 | import android.content.SharedPreferences 6 | import android.os.Bundle 7 | import android.view.MenuItem 8 | import android.view.View 9 | import android.widget.CompoundButton 10 | import android.widget.Toast 11 | import androidx.appcompat.app.AppCompatActivity 12 | import androidx.appcompat.view.ActionMode 13 | import com.ixidev.simplenotepad.EditNoteActivity.Companion.NOTE_EXTRA_Key 14 | import com.ixidev.simplenotepad.adapters.NotesAdapter 15 | import com.ixidev.simplenotepad.callbacks.MainActionModeCallback 16 | import com.ixidev.simplenotepad.callbacks.NoteEventListener 17 | import com.ixidev.simplenotepad.db.NotesDB 18 | import com.ixidev.simplenotepad.db.NotesDao 19 | import com.ixidev.simplenotepad.entity.Note 20 | import com.ixidev.simplenotepad.utils.APP_PREFERENCES 21 | import com.ixidev.simplenotepad.utils.NoteUtils.dateFromLong 22 | import com.ixidev.simplenotepad.utils.THEME_Key 23 | import com.mikepenz.materialdrawer.AccountHeader 24 | import com.mikepenz.materialdrawer.AccountHeaderBuilder 25 | import com.mikepenz.materialdrawer.Drawer 26 | import com.mikepenz.materialdrawer.DrawerBuilder 27 | import com.mikepenz.materialdrawer.interfaces.OnCheckedChangeListener 28 | import com.mikepenz.materialdrawer.model.ProfileDrawerItem 29 | import com.mikepenz.materialdrawer.model.SwitchDrawerItem 30 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 31 | import kotlinx.android.synthetic.main.activity_main.* 32 | import kotlinx.android.synthetic.main.content_main.* 33 | 34 | 35 | class MainActivity : AppCompatActivity(), Drawer.OnDrawerItemClickListener, NoteEventListener { 36 | private lateinit var settings: SharedPreferences 37 | private var themeId = 0 38 | private lateinit var dao: NotesDao 39 | private var notes = ArrayList() 40 | lateinit var adapter: NotesAdapter 41 | private var chackedCount = 0 42 | private lateinit var actionModeCallback: MainActionModeCallback 43 | 44 | override fun onCreate(savedInstanceState: Bundle?) { 45 | setupTheme() 46 | super.onCreate(savedInstanceState) 47 | setContentView(R.layout.activity_main) 48 | setSupportActionBar(toolbar) 49 | setupDrawerMenu(savedInstanceState) 50 | dao = NotesDB.getInstance(this).notesDao() 51 | 52 | fab.setOnClickListener { 53 | // Start EditNoteActivity.class for Create New Note 54 | startActivity(Intent(this, EditNoteActivity::class.java)) 55 | } 56 | } 57 | 58 | private fun setupTheme() { 59 | settings = getSharedPreferences(APP_PREFERENCES, Context.MODE_PRIVATE) 60 | themeId = settings.getInt(THEME_Key, R.style.AppTheme) 61 | setTheme(themeId) 62 | } 63 | 64 | private fun setupDrawerMenu(savedInstanceState: Bundle?) { 65 | // navigation menu header 66 | val header: AccountHeader = AccountHeaderBuilder().withActivity(this).apply { 67 | addProfiles( 68 | ProfileDrawerItem() 69 | .withEmail("feedback.mrzero@gmail.com") 70 | .withName("ixiDev") 71 | .withIcon(R.mipmap.ic_launcher_round) 72 | ) 73 | withSavedInstance(savedInstanceState) 74 | withHeaderBackground(R.drawable.ic_launcher_background) 75 | withSelectionListEnabledForSingleProfile(false) // we need just one profile 76 | }.build() 77 | 78 | val switchDrawerItem = SwitchDrawerItem().apply { 79 | withName("Dark Theme") 80 | withChecked(themeId == R.style.AppTheme_Dark) 81 | withIcon(R.drawable.ic_dark_theme) 82 | onCheckedChangeListener = object : OnCheckedChangeListener { 83 | override fun onCheckedChanged( 84 | drawerItem: IDrawerItem<*>, 85 | buttonView: CompoundButton, 86 | isChecked: Boolean 87 | ) { 88 | val tm = if (isChecked) R.style.AppTheme_Dark else R.style.AppTheme 89 | settings.edit().apply { 90 | putInt(THEME_Key, tm) 91 | apply() 92 | } 93 | recreate() 94 | /* TaskStackBuilder.create(this@MainActivity) 95 | .addNextIntent(Intent(this@MainActivity, 96 | MainActivity::class.java)) 97 | .addNextIntent(intent).startActivities()*/ 98 | } 99 | } 100 | } 101 | 102 | // Navigation drawer 103 | DrawerBuilder().apply { 104 | withActivity(this@MainActivity) // activity main 105 | withToolbar(toolbar) // toolbar 106 | withSavedInstance(savedInstanceState) // saveInstance of activity 107 | withTranslucentNavigationBar(true) 108 | withStickyDrawerItems(arrayListOf(switchDrawerItem)) // footer items 109 | withAccountHeader(header) // header of navigation 110 | withOnDrawerItemClickListener(this@MainActivity) // listener for menu items click 111 | }.build() 112 | } 113 | 114 | override fun onResume() { 115 | super.onResume() 116 | loadNotes() 117 | } 118 | 119 | private fun loadNotes() { 120 | notes.apply { 121 | clear() 122 | addAll(dao.notes) 123 | } 124 | notes_recycler_view.let { 125 | adapter = NotesAdapter(this, notes) 126 | adapter.setListener(this) 127 | it.adapter = adapter 128 | } 129 | showEmptyView() 130 | } 131 | 132 | /** 133 | * when no notes show msg in main_layout 134 | */ 135 | private fun showEmptyView() { 136 | if (notes.size == 0) { 137 | notes_recycler_view.visibility = View.GONE 138 | empty_notes_view.visibility = View.VISIBLE 139 | } else { 140 | notes_recycler_view.visibility = View.VISIBLE 141 | empty_notes_view.visibility = View.GONE 142 | } 143 | } 144 | 145 | override fun onItemClick(view: View?, position: Int, drawerItem: IDrawerItem<*>): Boolean { 146 | return false 147 | } 148 | 149 | override fun onNoteClick(note: Note) { 150 | // note clicked : edit note 151 | val edit = Intent(this, EditNoteActivity::class.java) 152 | edit.putExtra(NOTE_EXTRA_Key, note.id) 153 | startActivity(edit) 154 | } 155 | 156 | // note long clicked : delete , share .. 157 | override fun onNoteLongClick(note: Note) { 158 | note.checked = true 159 | chackedCount = 1 160 | adapter.setMultiCheckMode(true) 161 | actionModeCallback = object : MainActionModeCallback() { 162 | override fun onActionItemClicked( 163 | actionMode: ActionMode, 164 | menuItem: MenuItem 165 | ): Boolean { 166 | 167 | if (menuItem.itemId == R.id.action_delete_notes) 168 | onDeleteMultiNotes() 169 | else if (menuItem.itemId == R.id.action_share_note) 170 | onShareNote() 171 | 172 | actionMode.finish() 173 | return false 174 | } 175 | } 176 | 177 | // set new listener to adapter intend off MainActivity listener that we have implement 178 | adapter.setListener(object : NoteEventListener { 179 | override fun onNoteClick(note: Note) { 180 | note.checked = !note.checked // inverse selected 181 | // count 182 | if (note.checked) chackedCount++ else chackedCount-- 183 | 184 | if (chackedCount > 1) { 185 | actionModeCallback.changeShareItemVisible(false) 186 | } else actionModeCallback.changeShareItemVisible(true) 187 | actionModeCallback.setCount(chackedCount.toString() + "/" + notes.size) 188 | adapter.notifyDataSetChanged() 189 | } 190 | 191 | override fun onNoteLongClick(note: Note) {} 192 | }) 193 | 194 | // start action mode 195 | startSupportActionMode(actionModeCallback) 196 | // hide fab button 197 | fab.visibility = View.GONE 198 | actionModeCallback.setCount(chackedCount.toString() + "/" + notes.size) 199 | } 200 | 201 | override fun onSupportActionModeFinished(mode: ActionMode) { 202 | super.onSupportActionModeFinished(mode) 203 | adapter.setMultiCheckMode(false) // uncheck the notes 204 | adapter.setListener(this) // set back the old listener 205 | fab.visibility = View.VISIBLE 206 | } 207 | 208 | private fun onShareNote() { 209 | // we need share just one Note not multi 210 | val note: Note = adapter.getCheckedNotes()[0] 211 | val share = Intent(Intent.ACTION_SEND) 212 | share.type = "text/plain" 213 | val notetext: String = note.noteText + "\n\n Create on : " + 214 | dateFromLong(note.noteDate) + "\n By :" + 215 | getString(R.string.app_name) 216 | share.putExtra(Intent.EXTRA_TEXT, notetext) 217 | startActivity(share) 218 | } 219 | 220 | private fun onDeleteMultiNotes() { // TODO: 22/07/2018 delete multi notes 221 | val chackedNotes: List = adapter.getCheckedNotes() 222 | if (chackedNotes.isNotEmpty()) { 223 | // delete all checked notes 224 | dao.deleteNote(*chackedNotes.toTypedArray()) 225 | // refresh Notes 226 | loadNotes() 227 | Toast.makeText( 228 | this, "${chackedNotes.size} Note(s) Delete successfully !", Toast.LENGTH_SHORT 229 | ).show() 230 | } else Toast.makeText(this, "No Note(s) selected", Toast.LENGTH_SHORT).show() 231 | //adapter.setMultiCheckMode(false); 232 | } 233 | 234 | 235 | } 236 | -------------------------------------------------------------------------------- /Java/Application/app/src/main/java/com/ixidev/simplenotepad/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.ixidev.simplenotepad; 2 | 3 | import android.app.TaskStackBuilder; 4 | import android.content.Context; 5 | import android.content.DialogInterface; 6 | import android.content.Intent; 7 | import android.content.SharedPreferences; 8 | import android.os.Bundle; 9 | import android.view.ActionMode; 10 | import android.view.Menu; 11 | import android.view.MenuItem; 12 | import android.view.View; 13 | import android.widget.CompoundButton; 14 | import android.widget.Toast; 15 | 16 | import androidx.appcompat.app.AlertDialog; 17 | import androidx.appcompat.app.AppCompatActivity; 18 | import androidx.appcompat.widget.Toolbar; 19 | import androidx.recyclerview.widget.ItemTouchHelper; 20 | import androidx.recyclerview.widget.LinearLayoutManager; 21 | import androidx.recyclerview.widget.RecyclerView; 22 | 23 | import com.google.android.material.floatingactionbutton.FloatingActionButton; 24 | import com.ixidev.simplenotepad.adapters.NotesAdapter; 25 | import com.ixidev.simplenotepad.callbacks.MainActionModeCallback; 26 | import com.ixidev.simplenotepad.callbacks.NoteEventListener; 27 | import com.ixidev.simplenotepad.db.NotesDB; 28 | import com.ixidev.simplenotepad.db.NotesDao; 29 | import com.ixidev.simplenotepad.model.Note; 30 | import com.ixidev.simplenotepad.utils.NoteUtils; 31 | import com.mikepenz.materialdrawer.AccountHeader; 32 | import com.mikepenz.materialdrawer.AccountHeaderBuilder; 33 | import com.mikepenz.materialdrawer.Drawer; 34 | import com.mikepenz.materialdrawer.DrawerBuilder; 35 | import com.mikepenz.materialdrawer.interfaces.OnCheckedChangeListener; 36 | import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; 37 | import com.mikepenz.materialdrawer.model.ProfileDrawerItem; 38 | import com.mikepenz.materialdrawer.model.SwitchDrawerItem; 39 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; 40 | 41 | import java.util.ArrayList; 42 | import java.util.List; 43 | 44 | import static com.ixidev.simplenotepad.EditNoteActivity.NOTE_EXTRA_Key; 45 | 46 | public class MainActivity extends AppCompatActivity implements NoteEventListener, Drawer.OnDrawerItemClickListener { 47 | private static final String TAG = "MainActivity"; 48 | private RecyclerView recyclerView; 49 | private ArrayList notes; 50 | private NotesAdapter adapter; 51 | private NotesDao dao; 52 | private MainActionModeCallback actionModeCallback; 53 | private int chackedCount = 0; 54 | private FloatingActionButton fab; 55 | private SharedPreferences settings; 56 | public static final String THEME_Key = "app_theme"; 57 | public static final String APP_PREFERENCES="notepad_settings"; 58 | private int theme; 59 | 60 | @Override 61 | protected void onCreate(Bundle savedInstanceState) { 62 | settings = getSharedPreferences(APP_PREFERENCES, Context.MODE_PRIVATE); 63 | theme = settings.getInt(THEME_Key, R.style.AppTheme); 64 | setTheme(theme); 65 | super.onCreate(savedInstanceState); 66 | setContentView(R.layout.activity_main); 67 | Toolbar toolbar = findViewById(R.id.toolbar); 68 | setSupportActionBar(toolbar); 69 | 70 | setupNavigation(savedInstanceState, toolbar); 71 | // init recyclerView 72 | recyclerView = findViewById(R.id.notes_list); 73 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 74 | 75 | // init fab Button 76 | fab = (FloatingActionButton) findViewById(R.id.fab); 77 | fab.setOnClickListener(new View.OnClickListener() { 78 | @Override 79 | public void onClick(View view) { 80 | // TODO: 13/05/2018 add new note 81 | onAddNewNote(); 82 | } 83 | }); 84 | 85 | dao = NotesDB.getInstance(this).notesDao(); 86 | } 87 | 88 | private void setupNavigation(Bundle savedInstanceState, Toolbar toolbar) { 89 | 90 | // Navigation menu items 91 | // List iDrawerItems = new ArrayList<>(); fix error : removed on materialdrawer 7.0.0 92 | List> iDrawerItems = new ArrayList<>(); 93 | iDrawerItems.add(new PrimaryDrawerItem().withName("Home").withIcon(R.drawable.ic_home_black_24dp)); 94 | iDrawerItems.add(new PrimaryDrawerItem().withName("Notes").withIcon(R.drawable.ic_note_black_24dp)); 95 | 96 | // sticky DrawItems ; footer menu items 97 | 98 | // List stockyItems = new ArrayList<>(); removed on materialdrawer 7.0.0 99 | List> stockyItems = new ArrayList<>(); 100 | 101 | SwitchDrawerItem switchDrawerItem = new SwitchDrawerItem() 102 | .withName("Dark Theme") 103 | .withChecked(theme == R.style.AppTheme_Dark) 104 | .withIcon(R.drawable.ic_dark_theme) 105 | .withOnCheckedChangeListener(new OnCheckedChangeListener() { 106 | @Override 107 | public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) { 108 | // TODO: 02/10/2018 change to darck theme and save it to settings 109 | if (isChecked) { 110 | settings.edit().putInt(THEME_Key, R.style.AppTheme_Dark).apply(); 111 | } else { 112 | settings.edit().putInt(THEME_Key, R.style.AppTheme).apply(); 113 | } 114 | 115 | // recreate app or the activity // if it's not working follow this steps 116 | // MainActivity.this.recreate(); 117 | 118 | // this lines means wi want to close the app and open it again to change theme 119 | TaskStackBuilder.create(MainActivity.this) 120 | .addNextIntent(new Intent(MainActivity.this, MainActivity.class)) 121 | .addNextIntent(getIntent()).startActivities(); 122 | } 123 | }); 124 | 125 | stockyItems.add(new PrimaryDrawerItem().withName("Settings").withIcon(R.drawable.ic_settings_black_24dp)); 126 | stockyItems.add(switchDrawerItem); 127 | 128 | // navigation menu header 129 | AccountHeader header = new AccountHeaderBuilder().withActivity(this) 130 | .addProfiles(new ProfileDrawerItem() 131 | .withEmail("feedback.mrzero@gmail.com") 132 | .withName("ixiDev") 133 | .withIcon(R.mipmap.ic_launcher_round)) 134 | .withSavedInstance(savedInstanceState) 135 | .withHeaderBackground(R.drawable.ic_launcher_background) 136 | .withSelectionListEnabledForSingleProfile(false) // we need just one profile 137 | .build(); 138 | 139 | // Navigation drawer 140 | new DrawerBuilder() 141 | .withActivity(this) // activity main 142 | .withToolbar(toolbar) // toolbar 143 | .withSavedInstance(savedInstanceState) // saveInstance of activity 144 | .withDrawerItems(iDrawerItems) // menu items 145 | .withTranslucentNavigationBar(true) 146 | .withStickyDrawerItems(stockyItems) // footer items 147 | .withAccountHeader(header) // header of navigation 148 | .withOnDrawerItemClickListener(this) // listener for menu items click 149 | .build(); 150 | 151 | } 152 | 153 | private void loadNotes() { 154 | this.notes = new ArrayList<>(); 155 | List list = dao.getNotes();// get All notes from DataBase 156 | this.notes.addAll(list); 157 | this.adapter = new NotesAdapter(this, this.notes); 158 | // set listener to adapter 159 | this.adapter.setListener(this); 160 | this.recyclerView.setAdapter(adapter); 161 | showEmptyView(); 162 | // add swipe helper to recyclerView 163 | 164 | swipeToDeleteHelper.attachToRecyclerView(recyclerView); 165 | } 166 | 167 | /** 168 | * when no notes show msg in main_layout 169 | */ 170 | private void showEmptyView() { 171 | if (notes.size() == 0) { 172 | this.recyclerView.setVisibility(View.GONE); 173 | findViewById(R.id.empty_notes_view).setVisibility(View.VISIBLE); 174 | 175 | } else { 176 | this.recyclerView.setVisibility(View.VISIBLE); 177 | findViewById(R.id.empty_notes_view).setVisibility(View.GONE); 178 | } 179 | } 180 | 181 | /** 182 | * Start EditNoteActivity.class for Create New Note 183 | */ 184 | private void onAddNewNote() { 185 | startActivity(new Intent(this, EditNoteActivity.class)); 186 | 187 | } 188 | 189 | @Override 190 | public boolean onCreateOptionsMenu(Menu menu) { 191 | // Inflate the menu; this adds items to the action bar if it is present. 192 | getMenuInflater().inflate(R.menu.menu_main, menu); 193 | return true; 194 | } 195 | 196 | @Override 197 | public boolean onOptionsItemSelected(MenuItem item) { 198 | // Handle action bar item clicks here. The action bar will 199 | // automatically handle clicks on the Home/Up button, so long 200 | // as you specify a parent activity in AndroidManifest.xml. 201 | int id = item.getItemId(); 202 | 203 | //noinspection SimplifiableIfStatement 204 | if (id == R.id.action_settings) { 205 | return true; 206 | } 207 | 208 | return super.onOptionsItemSelected(item); 209 | } 210 | 211 | 212 | @Override 213 | protected void onResume() { 214 | super.onResume(); 215 | loadNotes(); 216 | } 217 | 218 | @Override 219 | public void onNoteClick(Note note) { 220 | // TODO: 22/07/2018 note clicked : edit note 221 | Intent edit = new Intent(this, EditNoteActivity.class); 222 | edit.putExtra(NOTE_EXTRA_Key, note.getId()); 223 | startActivity(edit); 224 | 225 | } 226 | 227 | @Override 228 | public void onNoteLongClick(Note note) { 229 | // TODO: 22/07/2018 note long clicked : delete , share .. 230 | note.setChecked(true); 231 | chackedCount = 1; 232 | adapter.setMultiCheckMode(true); 233 | 234 | // set new listener to adapter intend off MainActivity listener that we have implement 235 | adapter.setListener(new NoteEventListener() { 236 | @Override 237 | public void onNoteClick(Note note) { 238 | note.setChecked(!note.isChecked()); // inverse selected 239 | if (note.isChecked()) 240 | chackedCount++; 241 | else chackedCount--; 242 | 243 | if (chackedCount > 1) { 244 | actionModeCallback.changeShareItemVisible(false); 245 | } else actionModeCallback.changeShareItemVisible(true); 246 | 247 | if (chackedCount == 0) { 248 | // finish multi select mode wen checked count =0 249 | actionModeCallback.getAction().finish(); 250 | } 251 | 252 | actionModeCallback.setCount(chackedCount + "/" + notes.size()); 253 | adapter.notifyDataSetChanged(); 254 | } 255 | 256 | @Override 257 | public void onNoteLongClick(Note note) { 258 | 259 | } 260 | }); 261 | 262 | actionModeCallback = new MainActionModeCallback() { 263 | @Override 264 | public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) { 265 | if (menuItem.getItemId() == R.id.action_delete_notes) 266 | onDeleteMultiNotes(); 267 | else if (menuItem.getItemId() == R.id.action_share_note) 268 | onShareNote(); 269 | 270 | actionMode.finish(); 271 | return false; 272 | } 273 | 274 | }; 275 | 276 | // start action mode 277 | startActionMode(actionModeCallback); 278 | // hide fab button 279 | fab.setVisibility(View.GONE); 280 | actionModeCallback.setCount(chackedCount + "/" + notes.size()); 281 | } 282 | 283 | private void onShareNote() { 284 | // TODO: 22/07/2018 we need share just one Note not multi 285 | 286 | Note note = adapter.getCheckedNotes().get(0); 287 | // TODO: 22/07/2018 do your logic here to share note ; on social or something else 288 | Intent share = new Intent(Intent.ACTION_SEND); 289 | share.setType("text/plain"); 290 | String notetext = note.getNoteText() + "\n\n Create on : " + 291 | NoteUtils.dateFromLong(note.getNoteDate()) + "\n By :" + 292 | getString(R.string.app_name); 293 | share.putExtra(Intent.EXTRA_TEXT, notetext); 294 | startActivity(share); 295 | 296 | 297 | } 298 | 299 | private void onDeleteMultiNotes() { 300 | // TODO: 22/07/2018 delete multi notes 301 | 302 | List chackedNotes = adapter.getCheckedNotes(); 303 | if (chackedNotes.size() != 0) { 304 | for (Note note : chackedNotes) { 305 | dao.deleteNote(note); 306 | } 307 | // refresh Notes 308 | loadNotes(); 309 | Toast.makeText(this, chackedNotes.size() + " Note(s) Delete successfully !", Toast.LENGTH_SHORT).show(); 310 | } else Toast.makeText(this, "No Note(s) selected", Toast.LENGTH_SHORT).show(); 311 | 312 | //adapter.setMultiCheckMode(false); 313 | } 314 | 315 | @Override 316 | public void onActionModeFinished(ActionMode mode) { 317 | super.onActionModeFinished(mode); 318 | 319 | adapter.setMultiCheckMode(false); // uncheck the notes 320 | adapter.setListener(this); // set back the old listener 321 | fab.setVisibility(View.VISIBLE); 322 | } 323 | 324 | // swipe to right or to left te delete 325 | private ItemTouchHelper swipeToDeleteHelper = new ItemTouchHelper( 326 | new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { 327 | @Override 328 | public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { 329 | return false; 330 | } 331 | 332 | @Override 333 | public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { 334 | // TODO: 28/09/2018 delete note when swipe 335 | 336 | if (notes != null) { 337 | // get swiped note 338 | Note swipedNote = notes.get(viewHolder.getAdapterPosition()); 339 | if (swipedNote != null) { 340 | swipeToDelete(swipedNote, viewHolder); 341 | 342 | } 343 | 344 | } 345 | } 346 | }); 347 | 348 | private void swipeToDelete(final Note swipedNote, final RecyclerView.ViewHolder viewHolder) { 349 | new AlertDialog.Builder(MainActivity.this) 350 | .setMessage("Delete Note?") 351 | .setPositiveButton("Delete", new DialogInterface.OnClickListener() { 352 | @Override 353 | public void onClick(DialogInterface dialogInterface, int i) { 354 | // TODO: 28/09/2018 delete note 355 | dao.deleteNote(swipedNote); 356 | notes.remove(swipedNote); 357 | adapter.notifyItemRemoved(viewHolder.getAdapterPosition()); 358 | showEmptyView(); 359 | 360 | } 361 | }) 362 | .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 363 | @Override 364 | public void onClick(DialogInterface dialogInterface, int i) { 365 | // TODO: 28/09/2018 Undo swipe and restore swipedNote 366 | recyclerView.getAdapter().notifyItemChanged(viewHolder.getAdapterPosition()); 367 | 368 | 369 | } 370 | }) 371 | .setCancelable(false) 372 | .create().show(); 373 | 374 | } 375 | 376 | @Override 377 | public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { 378 | 379 | Toast.makeText(this, "" + position, Toast.LENGTH_SHORT).show(); 380 | return false; 381 | } 382 | } 383 | 384 | 385 | 386 | --------------------------------------------------------------------------------