Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
anprimordi committed Nov 12, 2019
0 parents commit da65587
Show file tree
Hide file tree
Showing 58 changed files with 1,192 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
39 changes: 39 additions & 0 deletions app/build.gradle
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'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
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
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)
}
}
24 changes: 24 additions & 0 deletions app/src/main/AndroidManifest.xml
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>
Binary file added app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 app/src/main/java/com/makaryostudio/lovebird/base/BaseView.kt
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
}
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
}
}
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)
}
}
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>)
}
}
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()
}
}
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)
}
}
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))
}
}
}
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()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.makaryostudio.lovebird.repository

class DatabaseHelper {
}
Loading

0 comments on commit da65587

Please sign in to comment.