-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit da65587
Showing
58 changed files
with
1,192 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
24 changes: 24 additions & 0 deletions
24
app/src/androidTest/java/com/makaryostudio/lovebird/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.makaryostudio.lovebird"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".feature.hasil.HasilActivity"></activity> | ||
<activity android:name=".feature.diagnosis.DiagnosisActivity" /> | ||
<activity android:name=".feature.splashscreen.SplashScreenActivity" /> | ||
<activity android:name=".feature.home.HomeActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/makaryostudio/lovebird/base/BasePresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.makaryostudio.lovebird.base | ||
|
||
interface BasePresenter { | ||
fun start() | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/makaryostudio/lovebird/base/BaseView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.makaryostudio.lovebird.base | ||
|
||
interface BaseView<T> { | ||
val presenter: T | ||
} |
59 changes: 59 additions & 0 deletions
59
app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Gejala>) { | ||
|
||
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 | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<DiagnosisAdapter.ViewHolder>() { | ||
|
||
private var mListData: List<Gejala> | ||
|
||
init { | ||
mListData = ArrayList() | ||
notifyDataSetChanged() | ||
} | ||
|
||
//constructor mListData | ||
fun loadListData(mListData: List<Gejala>) { | ||
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) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisContract.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Presenter>{ | ||
fun onLoadListGejalaSucceed(listGejala: List<Gejala>) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisPresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/makaryostudio/lovebird/feature/hasil/HasilActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/makaryostudio/lovebird/feature/home/HomeActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/makaryostudio/lovebird/feature/splashscreen/SplashScreenActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
app/src/main/java/com/makaryostudio/lovebird/repository/DatabaseHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.makaryostudio.lovebird.repository | ||
|
||
class DatabaseHelper { | ||
} |
Oops, something went wrong.