diff --git a/app/app/.gitignore b/app/app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/app/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/app/app/app.iml b/app/app/app.iml deleted file mode 100644 index dc0ade1..0000000 --- a/app/app/app.iml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/app/build.gradle b/app/app/build.gradle deleted file mode 100644 index 9479ed6..0000000 --- a/app/app/build.gradle +++ /dev/null @@ -1,54 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' -apply plugin: 'realm-android' - -android { - compileSdkVersion 29 - - - defaultConfig { - applicationId "com.example.cryptopad" - minSdkVersion 16 - targetSdkVersion 29 - versionCode 1 - versionName anko_version - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - } - -} - -dependencies { - implementation 'io.realm:android-adapters:2.1.1' - implementation "io.realm:realm-gradle-plugin:6.0.2" - implementation "org.jetbrains.anko:anko-common:$anko_version" - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.core:core-ktx:1.3.1' - implementation 'com.google.android.material:material:1.2.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0' - implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' - testImplementation 'junit:junit:4.13' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' -} diff --git a/app/app/proguard-rules.pro b/app/app/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/app/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/app/app/src/androidTest/java/com/example/cryptopad/ExampleInstrumentedTest.kt b/app/app/src/androidTest/java/com/example/cryptopad/ExampleInstrumentedTest.kt deleted file mode 100644 index 04da20f..0000000 --- a/app/app/src/androidTest/java/com/example/cryptopad/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.example.cryptopad - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("com.example.notepad", appContext.packageName) - } -} diff --git a/app/app/src/main/AndroidManifest.xml b/app/app/src/main/AndroidManifest.xml deleted file mode 100644 index a9176b8..0000000 --- a/app/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/app/src/main/ic_launcher-playstore.png b/app/app/src/main/ic_launcher-playstore.png deleted file mode 100644 index 1d89551..0000000 Binary files a/app/app/src/main/ic_launcher-playstore.png and /dev/null differ diff --git a/app/app/src/main/java/com/example/cryptopad/.idea/misc.xml b/app/app/src/main/java/com/example/cryptopad/.idea/misc.xml deleted file mode 100644 index 1763e15..0000000 --- a/app/app/src/main/java/com/example/cryptopad/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/app/src/main/java/com/example/cryptopad/.idea/modules.xml b/app/app/src/main/java/com/example/cryptopad/.idea/modules.xml deleted file mode 100644 index a8abcc8..0000000 --- a/app/app/src/main/java/com/example/cryptopad/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/app/src/main/java/com/example/cryptopad/.idea/vcs.xml b/app/app/src/main/java/com/example/cryptopad/.idea/vcs.xml deleted file mode 100644 index 1dc5e8e..0000000 --- a/app/app/src/main/java/com/example/cryptopad/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/app/src/main/java/com/example/cryptopad/.idea/workspace.xml b/app/app/src/main/java/com/example/cryptopad/.idea/workspace.xml deleted file mode 100644 index 836d074..0000000 --- a/app/app/src/main/java/com/example/cryptopad/.idea/workspace.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - 1592606326891 - - - - \ No newline at end of file diff --git a/app/app/src/main/java/com/example/cryptopad/EditActivity.kt b/app/app/src/main/java/com/example/cryptopad/EditActivity.kt deleted file mode 100644 index 3041726..0000000 --- a/app/app/src/main/java/com/example/cryptopad/EditActivity.kt +++ /dev/null @@ -1,106 +0,0 @@ -package com.example.cryptopad - -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.view.View -import io.realm.Realm -import io.realm.kotlin.createObject -import io.realm.kotlin.where -import kotlinx.android.synthetic.main.activity_edit.* -import org.jetbrains.anko.alert -import org.jetbrains.anko.yesButton - -class EditActivity : AppCompatActivity() { - - - private lateinit var realm: Realm - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_edit) - - realm = Realm.getDefaultInstance() - - - - val noteId = intent.getLongExtra("note_id", -1L) - if (noteId != -1L) { - val note = realm.where().equalTo("id", noteId).findFirst() - titleEdit.setText(note?.title ?: "") - contentEdit.setText(note?.content ?: "") - delete.visibility = View.VISIBLE - } else { - delete.visibility = View.INVISIBLE - } - - save.setOnClickListener { - - var isValid = true - when (noteId) { - -1L -> { - - if (titleEdit.text.isEmpty()) { - titleEdit.error = "Title is Empty" - isValid = false - } - - if (contentEdit.text.isEmpty()) { - contentEdit.error = "Detail Is Empty" - isValid = false - } - - if (isValid) { - realm.executeTransaction { - val maxId = realm.where().max("id") - val nextId = (maxId?.toLong() ?: 0L) + 1 - val note = realm.createObject(nextId) - note.title = titleEdit.text.toString() - note.content = contentEdit.text.toString() - } - alert("Saved") { - yesButton { finish() } - }.show() - } - } - else -> { - - if (titleEdit.text.isEmpty()) { - titleEdit.error = "Title Empty" - isValid = false - } - - if (contentEdit.text.isEmpty()) { - contentEdit.error = "Detail Empty" - isValid = false - } - if (isValid) { - realm.executeTransaction { - val note = realm.where().equalTo("id", noteId).findFirst() - note?.title = titleEdit.text.toString() - note?.content = contentEdit.text.toString() - } - alert("Edited") { - yesButton { finish() } - }.show() - } - } - } - } - - delete.setOnClickListener { - realm.executeTransaction { - val note = realm.where().equalTo("id", noteId)?.findFirst() - note?.deleteFromRealm() - } - alert("Delete") { - yesButton { finish() } - }.show() - } - - } - - override fun onDestroy() { - super.onDestroy() - realm.close() - } -} diff --git a/app/app/src/main/java/com/example/cryptopad/MainActivity.kt b/app/app/src/main/java/com/example/cryptopad/MainActivity.kt deleted file mode 100644 index f5f106c..0000000 --- a/app/app/src/main/java/com/example/cryptopad/MainActivity.kt +++ /dev/null @@ -1,49 +0,0 @@ -package com.example.cryptopad - -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import androidx.recyclerview.widget.LinearLayoutManager -import io.realm.Realm -import io.realm.kotlin.where -import kotlinx.android.synthetic.main.activity_main.* -import org.jetbrains.anko.startActivity - -class MainActivity : AppCompatActivity() { - - - private lateinit var realm: Realm - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) - - - realm = Realm.getDefaultInstance() - - val notes = realm.where().findAll() - val recyclerView = noteList - val adapter = NoteAdapter(this, notes) { note -> - startActivity("note_id" to note.id) - } - - recyclerView.adapter = adapter - - - val layout = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, true) - layout.stackFromEnd = true - recyclerView.layoutManager = layout - - - fab.setOnClickListener { - startActivity() - } - - } - - - override fun onDestroy() { - super.onDestroy() - realm.close() - } - -} diff --git a/app/app/src/main/java/com/example/cryptopad/Migration.kt b/app/app/src/main/java/com/example/cryptopad/Migration.kt deleted file mode 100644 index 24837c9..0000000 --- a/app/app/src/main/java/com/example/cryptopad/Migration.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.example.cryptopad - -import io.realm.DynamicRealm -import io.realm.RealmMigration - -class Migration: RealmMigration { - - override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) { - var realmScheme = realm.schema - var oldVersion = oldVersion - - if (oldVersion == 0L ) { - val userSchema = realmScheme.get("Note") - userSchema?.renameField("deleteFlg", "isDelete") - oldVersion++ - } - } -} \ No newline at end of file diff --git a/app/app/src/main/java/com/example/cryptopad/Note.kt b/app/app/src/main/java/com/example/cryptopad/Note.kt deleted file mode 100644 index 5f7f225..0000000 --- a/app/app/src/main/java/com/example/cryptopad/Note.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.example.cryptopad - -import io.realm.RealmObject -import io.realm.annotations.PrimaryKey -import java.util.* - -open class Note: RealmObject() { - @PrimaryKey - var id: Long = 0 - var title: String = "" - var content: String = "" - var date: Date = Date() -} \ No newline at end of file diff --git a/app/app/src/main/java/com/example/cryptopad/NoteAdapter.kt b/app/app/src/main/java/com/example/cryptopad/NoteAdapter.kt deleted file mode 100644 index d5cdad3..0000000 --- a/app/app/src/main/java/com/example/cryptopad/NoteAdapter.kt +++ /dev/null @@ -1,54 +0,0 @@ -package com.example.cryptopad - -import android.content.Context -import android.text.format.DateFormat -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.recyclerview.widget.RecyclerView -import io.realm.OrderedRealmCollection -import io.realm.RealmRecyclerViewAdapter - -class NoteAdapter(context: Context, private val notes: OrderedRealmCollection, val onItemClicked: (Note) -> Unit) : - RealmRecyclerViewAdapter(notes, true) { - - - private val inflater = LayoutInflater.from(context) - - - override fun getItemCount(): Int { - return notes.size - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { - - val view = inflater.inflate(R.layout.list_row, parent, false) - - val viewHolder = MyViewHolder(view) - - view.setOnClickListener { - - val position = viewHolder.adapterPosition - - val note = notes[position] - onItemClicked(note) - } - return viewHolder - } - - override fun onBindViewHolder(holder: MyViewHolder, position: Int) { - - val note = notes[position] - - holder.title.text = note.title - holder.date.text = DateFormat.format("yyyy/MM/dd", note.date) - } - - - class MyViewHolder(view: View): RecyclerView.ViewHolder(view) { - - val title = view.findViewById(R.id.titleRow) - val date = view.findViewById(R.id.dateRow) - } -} diff --git a/app/app/src/main/java/com/example/cryptopad/NotePadApplication.kt b/app/app/src/main/java/com/example/cryptopad/NotePadApplication.kt deleted file mode 100644 index 0aca96c..0000000 --- a/app/app/src/main/java/com/example/cryptopad/NotePadApplication.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.cryptopad - -import android.app.Application -import io.realm.Realm -import io.realm.RealmConfiguration - -class NotePadApplication: Application() { - override fun onCreate() { - super.onCreate() - Realm.init(this) - val builder = RealmConfiguration.Builder() - val config = builder.deleteRealmIfMigrationNeeded().build() - Realm.setDefaultConfiguration(config) - } -} \ No newline at end of file diff --git a/app/app/src/main/java/com/example/cryptopad/cryptopad.iml b/app/app/src/main/java/com/example/cryptopad/cryptopad.iml deleted file mode 100644 index b107a2d..0000000 --- a/app/app/src/main/java/com/example/cryptopad/cryptopad.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/app/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/app/src/main/res/drawable/ic_launcher_background.xml b/app/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 0f169d5..0000000 --- a/app/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/app/src/main/res/layout/activity_edit.xml b/app/app/src/main/res/layout/activity_edit.xml deleted file mode 100644 index 8169657..0000000 --- a/app/app/src/main/res/layout/activity_edit.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - -