diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..1898f96 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,39 @@ +apply plugin: 'com.android.application' + +apply plugin: 'kotlin-android' + +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.1" + defaultConfig { + applicationId "com.makaryostudio.lovebird" + minSdkVersion 24 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.core:core-ktx:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation 'de.hdodenhof:circleimageview:3.0.1' + implementation 'androidx.recyclerview:recyclerview:1.0.0' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'com.google.android.material:material:1.0.0' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/makaryostudio/lovebird/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/makaryostudio/lovebird/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..3010fa2 --- /dev/null +++ b/app/src/androidTest/java/com/makaryostudio/lovebird/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.makaryostudio.lovebird + +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.makaryostudio.lovebird", appContext.packageName) + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..08c118c --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png new file mode 100644 index 0000000..bef070e Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ diff --git a/app/src/main/java/com/makaryostudio/lovebird/base/BasePresenter.kt b/app/src/main/java/com/makaryostudio/lovebird/base/BasePresenter.kt new file mode 100644 index 0000000..6803f94 --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/base/BasePresenter.kt @@ -0,0 +1,5 @@ +package com.makaryostudio.lovebird.base + +interface BasePresenter { + fun start() +} \ No newline at end of file diff --git a/app/src/main/java/com/makaryostudio/lovebird/base/BaseView.kt b/app/src/main/java/com/makaryostudio/lovebird/base/BaseView.kt new file mode 100644 index 0000000..f2546b5 --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/base/BaseView.kt @@ -0,0 +1,5 @@ +package com.makaryostudio.lovebird.base + +interface BaseView { + val presenter: T +} \ No newline at end of file diff --git a/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisActivity.kt b/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisActivity.kt new file mode 100644 index 0000000..6b37db6 --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisActivity.kt @@ -0,0 +1,59 @@ +package com.makaryostudio.lovebird.feature.diagnosis + +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.widget.Button +import android.widget.EditText +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.makaryostudio.lovebird.R +import com.makaryostudio.lovebird.feature.hasil.HasilActivity +import com.makaryostudio.lovebird.repository.model.Gejala + +class DiagnosisActivity : AppCompatActivity(), DiagnosisContract.View { + + override val presenter: DiagnosisContract.Presenter + get() = DiagnosisPresenter(this) + + private lateinit var rvGejala: RecyclerView + private lateinit var adapter: DiagnosisAdapter + private lateinit var textNamaBurung: EditText + private lateinit var btnDiagnosis: Button + + + override fun onLoadListGejalaSucceed(listGejala: List) { + + adapter.loadListData(listGejala) + } + + override fun onStart() { + super.onStart() + presenter.start() + } + + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_diagnosis) + + btnDiagnosis.setOnClickListener { + intent = Intent() + intent.putExtra("namaburung", textNamaBurung.toString()) + intent = Intent(this, HasilActivity::class.java) + startActivity(intent) + } + + bindView() + } + + private fun bindView() { + textNamaBurung = findViewById(R.id.edit_nama_burung) + btnDiagnosis = findViewById(R.id.button_diagnosis) + + rvGejala = findViewById(R.id.rv_gejala) + rvGejala.layoutManager = LinearLayoutManager(this) + adapter = DiagnosisAdapter(this) + rvGejala.adapter = adapter + } +} diff --git a/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisAdapter.kt b/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisAdapter.kt new file mode 100644 index 0000000..762b981 --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisAdapter.kt @@ -0,0 +1,56 @@ +package com.makaryostudio.lovebird.feature.diagnosis + +import android.content.Context +import android.content.Intent +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.CheckBox +import androidx.recyclerview.widget.RecyclerView +import com.makaryostudio.lovebird.R +import com.makaryostudio.lovebird.repository.model.Gejala + +class DiagnosisAdapter internal constructor(diagnosisActivity: DiagnosisActivity, private val context: Context) : + RecyclerView.Adapter() { + + private var mListData: List + + init { + mListData = ArrayList() + notifyDataSetChanged() + } + + //constructor mListData + fun loadListData(mListData: List) { + this.mListData = mListData + notifyDataSetChanged() + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.item_gejala, parent, false) + return ViewHolder(view) + } + + override fun getItemCount(): Int { + return mListData.size + } + + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + val gejala = mListData[position] + + holder.mCbGejala.text = gejala.gejalaDialami + holder.mCbGejala.isChecked = gejala.checked + + if (holder.mCbGejala.isChecked) { + val intent = Intent() +// intent.putExtra("checked", holder.mCbGejala.isChecked) + intent.putExtra("gejala", gejala) + context.startActivity(intent) + } + } + + class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + var mCbGejala: CheckBox = itemView.findViewById(R.id.checkbox_gejala) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisContract.kt b/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisContract.kt new file mode 100644 index 0000000..520bbe7 --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisContract.kt @@ -0,0 +1,15 @@ +package com.makaryostudio.lovebird.feature.diagnosis + +import com.makaryostudio.lovebird.base.BasePresenter +import com.makaryostudio.lovebird.base.BaseView +import com.makaryostudio.lovebird.repository.model.Gejala + +interface DiagnosisContract { + interface Presenter: BasePresenter{ + fun loadListGejala() + } + + interface View: BaseView{ + fun onLoadListGejalaSucceed(listGejala: List) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisPresenter.kt b/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisPresenter.kt new file mode 100644 index 0000000..ce9ebba --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisPresenter.kt @@ -0,0 +1,15 @@ +package com.makaryostudio.lovebird.feature.diagnosis + +class DiagnosisPresenter internal constructor(private val view: DiagnosisContract.View) : DiagnosisContract.Presenter{ + override fun loadListGejala() { + + TODO("what kind of database are we going to use?") +// val listGejala +// +// view.onLoadListGejalaSucceed(listGejala) + } + + override fun start() { + loadListGejala() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/makaryostudio/lovebird/feature/hasil/HasilActivity.kt b/app/src/main/java/com/makaryostudio/lovebird/feature/hasil/HasilActivity.kt new file mode 100644 index 0000000..f2917e5 --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/feature/hasil/HasilActivity.kt @@ -0,0 +1,13 @@ +package com.makaryostudio.lovebird.feature.hasil + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import com.makaryostudio.lovebird.R + +class HasilActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_hasil) + } +} diff --git a/app/src/main/java/com/makaryostudio/lovebird/feature/home/HomeActivity.kt b/app/src/main/java/com/makaryostudio/lovebird/feature/home/HomeActivity.kt new file mode 100644 index 0000000..224733b --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/feature/home/HomeActivity.kt @@ -0,0 +1,24 @@ +package com.makaryostudio.lovebird.feature.home + +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.widget.Button +import com.makaryostudio.lovebird.R +import com.makaryostudio.lovebird.feature.diagnosis.DiagnosisActivity + +class HomeActivity : AppCompatActivity() { + + lateinit var btnMulai: Button + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_home) + + btnMulai = findViewById(R.id.button_mulai) + + btnMulai.setOnClickListener { + startActivity(Intent(this, DiagnosisActivity::class.java)) + } + } +} diff --git a/app/src/main/java/com/makaryostudio/lovebird/feature/splashscreen/SplashScreenActivity.kt b/app/src/main/java/com/makaryostudio/lovebird/feature/splashscreen/SplashScreenActivity.kt new file mode 100644 index 0000000..8b797d6 --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/feature/splashscreen/SplashScreenActivity.kt @@ -0,0 +1,27 @@ +package com.makaryostudio.lovebird.feature.splashscreen + +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import com.makaryostudio.lovebird.R +import com.makaryostudio.lovebird.feature.home.HomeActivity + +class SplashScreenActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_splash_screen) + + val background = object : Thread() { + override fun run() { + try { + sleep(500) + startActivity(Intent(baseContext, HomeActivity::class.java)) + } catch (e: Exception) { + e.printStackTrace() + } + } + } + background.start() + } +} diff --git a/app/src/main/java/com/makaryostudio/lovebird/repository/DatabaseHelper.kt b/app/src/main/java/com/makaryostudio/lovebird/repository/DatabaseHelper.kt new file mode 100644 index 0000000..642711a --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/repository/DatabaseHelper.kt @@ -0,0 +1,4 @@ +package com.makaryostudio.lovebird.repository + +class DatabaseHelper { +} \ No newline at end of file diff --git a/app/src/main/java/com/makaryostudio/lovebird/repository/model/Gejala.kt b/app/src/main/java/com/makaryostudio/lovebird/repository/model/Gejala.kt new file mode 100644 index 0000000..d30e20c --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/repository/model/Gejala.kt @@ -0,0 +1,40 @@ +package com.makaryostudio.lovebird.repository.model + +import android.os.Parcel +import android.os.Parcelable + +data class Gejala( + var kodeGejala: String = "", + var gejalaDialami: String = "", + var bobot: Int, + var checked: Boolean +) : Parcelable { + constructor(parcel: Parcel) : this( + parcel.readString().toString(), + parcel.readString().toString(), + parcel.readInt(), + parcel.readByte() != 0.toByte() + ) { + } + + override fun writeToParcel(parcel: Parcel, flags: Int) { + parcel.writeString(kodeGejala) + parcel.writeString(gejalaDialami) + parcel.writeInt(bobot) + parcel.writeByte(if (checked) 1 else 0) + } + + override fun describeContents(): Int { + return 0 + } + + companion object CREATOR : Parcelable.Creator { + override fun createFromParcel(parcel: Parcel): Gejala { + return Gejala(parcel) + } + + override fun newArray(size: Int): Array { + return arrayOfNulls(size) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/makaryostudio/lovebird/repository/model/Penyakit.kt b/app/src/main/java/com/makaryostudio/lovebird/repository/model/Penyakit.kt new file mode 100644 index 0000000..aafd417 --- /dev/null +++ b/app/src/main/java/com/makaryostudio/lovebird/repository/model/Penyakit.kt @@ -0,0 +1,37 @@ +package com.makaryostudio.lovebird.repository.model + +import android.os.Parcel +import android.os.Parcelable + +data class Penyakit( + var kodePenyakit: Int, + var namaPenyakit: String?, + var deskripsiPenyakit: String? +) : Parcelable { + constructor(parcel: Parcel) : this( + parcel.readInt(), + parcel.readString(), + parcel.readString() + ) { + } + + override fun writeToParcel(parcel: Parcel, flags: Int) { + parcel.writeInt(kodePenyakit) + parcel.writeString(namaPenyakit) + parcel.writeString(deskripsiPenyakit) + } + + override fun describeContents(): Int { + return 0 + } + + companion object CREATOR : Parcelable.Creator { + override fun createFromParcel(parcel: Parcel): Penyakit { + return Penyakit(parcel) + } + + override fun newArray(size: Int): Array { + return arrayOfNulls(size) + } + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..1f6bb29 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/app_logo.png b/app/src/main/res/drawable/app_logo.png new file mode 100644 index 0000000..b55180b Binary files /dev/null and b/app/src/main/res/drawable/app_logo.png differ diff --git a/app/src/main/res/drawable/app_logo_splashscreen.png b/app/src/main/res/drawable/app_logo_splashscreen.png new file mode 100644 index 0000000..6c20342 Binary files /dev/null and b/app/src/main/res/drawable/app_logo_splashscreen.png differ diff --git a/app/src/main/res/drawable/app_logo_upper.png b/app/src/main/res/drawable/app_logo_upper.png new file mode 100644 index 0000000..d1f3770 Binary files /dev/null and b/app/src/main/res/drawable/app_logo_upper.png differ diff --git a/app/src/main/res/drawable/btn_rounded_blue.xml b/app/src/main/res/drawable/btn_rounded_blue.xml new file mode 100644 index 0000000..5eb8bf1 --- /dev/null +++ b/app/src/main/res/drawable/btn_rounded_blue.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_app_logo.xml b/app/src/main/res/drawable/ic_app_logo.xml new file mode 100644 index 0000000..cf41b83 --- /dev/null +++ b/app/src/main/res/drawable/ic_app_logo.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..0d025f9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_stethoscope_black_24dp.xml b/app/src/main/res/drawable/ic_stethoscope_black_24dp.xml new file mode 100644 index 0000000..bc0e514 --- /dev/null +++ b/app/src/main/res/drawable/ic_stethoscope_black_24dp.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/layout/activity_diagnosis.xml b/app/src/main/res/layout/activity_diagnosis.xml new file mode 100644 index 0000000..850828d --- /dev/null +++ b/app/src/main/res/layout/activity_diagnosis.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_hasil.xml b/app/src/main/res/layout/activity_hasil.xml new file mode 100644 index 0000000..73a46ed --- /dev/null +++ b/app/src/main/res/layout/activity_hasil.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml new file mode 100644 index 0000000..1f4a7a7 --- /dev/null +++ b/app/src/main/res/layout/activity_home.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + +