first commit
|
@ -0,0 +1,15 @@
|
|||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="E:/Program File/Gradle/gradle-6.6" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17_PREVIEW" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
/build
|
|
@ -0,0 +1,68 @@
|
|||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
id 'com.google.gms.google-services'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.capstone.aquacare'
|
||||
compileSdk 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.capstone.aquacare"
|
||||
minSdk 26
|
||||
targetSdk 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
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'
|
||||
}
|
||||
|
||||
viewBinding {
|
||||
enabled true
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
dataBinding true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.10.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
// implementation 'com.google.firebase:firebase-auth:22.3.1'
|
||||
implementation 'com.google.firebase:firebase-database:20.3.1'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
|
||||
implementation platform('com.google.firebase:firebase-bom:32.1.0')
|
||||
implementation 'com.google.firebase:firebase-auth-ktx'
|
||||
implementation 'com.google.android.gms:play-services-auth:21.0.0'
|
||||
|
||||
implementation 'com.github.bumptech.glide:glide:4.16.0'
|
||||
implementation 'com.github.clans:fab:1.6.4'
|
||||
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
|
||||
|
||||
implementation 'de.hdodenhof:circleimageview:3.1.0'
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "762708816606",
|
||||
"firebase_url": "https://aquacare-ddedd-default-rtdb.asia-southeast1.firebasedatabase.app",
|
||||
"project_id": "aquacare-ddedd",
|
||||
"storage_bucket": "aquacare-ddedd.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:762708816606:android:2eaa3255e2559acc07c84f",
|
||||
"android_client_info": {
|
||||
"package_name": "com.capstone.aquacare"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "762708816606-ieg98qv6jk7pa4bhpr9156hl0jd9eb6v.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.capstone.aquacare",
|
||||
"certificate_hash": "8f6c91d4dd9ef2ff88ba8065d5c2e2fead7806df"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "762708816606-b7q7lnlu2mjk5tguiqkhvm1plvmsu5sb.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyB-70FmdTvMOf_GL7yLNvPGBzOZ3Ca8Hl8"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "762708816606-b7q7lnlu2mjk5tguiqkhvm1plvmsu5sb.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,24 @@
|
|||
package com.capstone.aquacare
|
||||
|
||||
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.capstone.aquacare", appContext.packageName)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AquaCare"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
android:exported="true">
|
||||
<nav-graph android:value="@navigation/main_navigation" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.auth.AuthActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.SplashScreenActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,10 @@
|
|||
package com.capstone.aquacare.data
|
||||
|
||||
data class AquascapeData(
|
||||
val id: String? = null,
|
||||
val name: String? = null,
|
||||
val style: String? = null,
|
||||
val createDate: String? = null,
|
||||
val status: String? = null,
|
||||
val lastCheckDate: String? = null
|
||||
)
|
|
@ -0,0 +1,10 @@
|
|||
package com.capstone.aquacare.data
|
||||
|
||||
data class ArticleData(
|
||||
val id: String? = null,
|
||||
val title: String? = null,
|
||||
val image: String? = null,
|
||||
val type: String? = null,
|
||||
val body: String? = null,
|
||||
val link: String? = null
|
||||
)
|
|
@ -0,0 +1,12 @@
|
|||
package com.capstone.aquacare.data
|
||||
|
||||
data class IdentificationData(
|
||||
val id: String? = null,
|
||||
val result: String? = null,
|
||||
val date: String? = null,
|
||||
val temperature: String? = null,
|
||||
val ph: String? = null,
|
||||
val ammonia: String? = null,
|
||||
val kh: String? = null,
|
||||
val gh: String? = null
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
package com.capstone.aquacare.data
|
||||
|
||||
data class StatusParameter(
|
||||
val temperature: String,
|
||||
val ph: String,
|
||||
val ammonia: String,
|
||||
val kh: String,
|
||||
val gh: String
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
package com.capstone.aquacare.data
|
||||
|
||||
data class UserData(
|
||||
val id: String? = null,
|
||||
val name: String? = null,
|
||||
val email: String? = null,
|
||||
val accountType: String? = null,
|
||||
val userType: String? = null
|
||||
)
|
|
@ -0,0 +1,445 @@
|
|||
package com.capstone.aquacare.fuzzy
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.StatusParameter
|
||||
|
||||
class FuzzyDutchStyle(private val context: Context) {
|
||||
|
||||
private val good = context.getString(R.string.good)
|
||||
private val medium = context.getString(R.string.medium)
|
||||
private val bad = context.getString(R.string.bad)
|
||||
|
||||
// function identified water quality
|
||||
fun calculateWaterQuality(temperature: Double, ph: Double, ammonia: Double, kh: Double, gh: Double): String {
|
||||
|
||||
// Fuzzyfikasi
|
||||
val goodTemperature = fungsiKeanggotaanSuhuBaik(temperature)
|
||||
val badTemperature = fungsiKeanggotaanSuhuBuruk(temperature)
|
||||
|
||||
val goodPh = fungsiKeanggotaanPhBaik(ph)
|
||||
val mediumPh = fungsiKeanggotaanPhSedang(ph)
|
||||
val badPh = fungsiKeanggotaanPhBuruk(ph)
|
||||
|
||||
val goodAmmonia = fungsiKeanggotaanAmmoniaBaik(ammonia)
|
||||
val badAmmonia = fungsiKeanggotaanAmmoniaBuruk(ammonia)
|
||||
|
||||
val goodKh = fungsiKeanggotaanKhBaik(kh)
|
||||
val mediumKh = fungsiKeanggotaanKhSedang(kh)
|
||||
val badKh = fungsiKeanggotaanKhBuruk(kh)
|
||||
|
||||
val goodGh = fungsiKeanggotaanGhBaik(gh)
|
||||
val badGh = fungsiKeanggotaanGhBuruk(gh)
|
||||
|
||||
// Inferensi
|
||||
val inferensi1 = minOf(goodTemperature, goodPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi2 = minOf(goodTemperature, mediumPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi3 = minOf(goodTemperature, badPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi4 = minOf(goodTemperature, goodPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi5 = minOf(goodTemperature, goodPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi6 = minOf(goodTemperature, goodPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi7 = minOf(goodTemperature, goodPh, goodAmmonia, goodKh, badGh)
|
||||
|
||||
val inferensi8 = minOf(goodTemperature, mediumPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi9 = minOf(goodTemperature, mediumPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi10 = minOf(goodTemperature, mediumPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi11 = minOf(goodTemperature, mediumPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi12 = minOf(goodTemperature, mediumPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi13 = minOf(goodTemperature, mediumPh, badAmmonia, badKh, badGh)
|
||||
val inferensi14 = minOf(goodTemperature, mediumPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi15 = minOf(goodTemperature, mediumPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi16 = minOf(goodTemperature, mediumPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi17 = minOf(goodTemperature, mediumPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi18 = minOf(goodTemperature, mediumPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi19 = minOf(goodTemperature, badPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi20 = minOf(goodTemperature, badPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi21 = minOf(goodTemperature, badPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi22 = minOf(goodTemperature, badPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi23 = minOf(goodTemperature, badPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi24 = minOf(goodTemperature, badPh, badAmmonia, badKh, badGh)
|
||||
val inferensi25 = minOf(goodTemperature, badPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi26 = minOf(goodTemperature, badPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi27 = minOf(goodTemperature, badPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi28 = minOf(goodTemperature, badPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi29 = minOf(goodTemperature, badPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi30 = minOf(goodTemperature, goodPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi31 = minOf(goodTemperature, goodPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi32 = minOf(goodTemperature, goodPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi33 = minOf(goodTemperature, goodPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi34 = minOf(goodTemperature, goodPh, badAmmonia, badKh, badGh)
|
||||
val inferensi35 = minOf(goodTemperature, goodPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi36 = minOf(goodTemperature, goodPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi37 = minOf(badTemperature, mediumPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi38 = minOf(badTemperature, mediumPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi39 = minOf(badTemperature, mediumPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi40 = minOf(badTemperature, mediumPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi41 = minOf(badTemperature, mediumPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi42 = minOf(badTemperature, mediumPh, badAmmonia, badKh, badGh)
|
||||
val inferensi43 = minOf(badTemperature, mediumPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi44 = minOf(badTemperature, mediumPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi45 = minOf(badTemperature, mediumPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi46 = minOf(badTemperature, mediumPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi47 = minOf(badTemperature, mediumPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi48 = minOf(badTemperature, mediumPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi49 = minOf(badTemperature, badPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi50 = minOf(badTemperature, badPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi51 = minOf(badTemperature, badPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi52 = minOf(badTemperature, badPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi53 = minOf(badTemperature, badPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi54 = minOf(badTemperature, badPh, badAmmonia, badKh, badGh)
|
||||
val inferensi55 = minOf(badTemperature, badPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi56 = minOf(badTemperature, badPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi57 = minOf(badTemperature, badPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi58 = minOf(badTemperature, badPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi59 = minOf(badTemperature, badPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi60 = minOf(badTemperature, badPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi61 = minOf(badTemperature, goodPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi62 = minOf(badTemperature, goodPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi63 = minOf(badTemperature, goodPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi64 = minOf(badTemperature, goodPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi65 = minOf(badTemperature, goodPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi66 = minOf(badTemperature, goodPh, badAmmonia, badKh, badGh)
|
||||
val inferensi67 = minOf(badTemperature, goodPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi68 = minOf(badTemperature, goodPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi69 = minOf(badTemperature, goodPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi70 = minOf(badTemperature, goodPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi71 = minOf(badTemperature, goodPh, goodAmmonia, badKh, badGh)
|
||||
val inferensi72 = minOf(badTemperature, goodPh, badAmmonia, goodKh, badGh)
|
||||
|
||||
// Hasil Inferensi
|
||||
val hasilInferensi1 = fungsiKeanggotaanStatusBaik(inferensi1)
|
||||
val hasilInferensi2 = fungsiKeanggotaanStatusBaik(inferensi2)
|
||||
val hasilInferensi3 = fungsiKeanggotaanStatusSedang(inferensi3)
|
||||
val hasilInferensi4 = fungsiKeanggotaanStatusBuruk(inferensi4)
|
||||
val hasilInferensi5 = fungsiKeanggotaanStatusSedang(inferensi5)
|
||||
val hasilInferensi6 = fungsiKeanggotaanStatusBuruk(inferensi6)
|
||||
val hasilInferensi7 = fungsiKeanggotaanStatusSedang(inferensi7)
|
||||
|
||||
val hasilInferensi8 = fungsiKeanggotaanStatusBuruk(inferensi8)
|
||||
val hasilInferensi9 = fungsiKeanggotaanStatusBuruk(inferensi9)
|
||||
val hasilInferensi10 = fungsiKeanggotaanStatusBuruk(inferensi10)
|
||||
val hasilInferensi11 = fungsiKeanggotaanStatusBuruk(inferensi11)
|
||||
val hasilInferensi12 = fungsiKeanggotaanStatusBuruk(inferensi12)
|
||||
val hasilInferensi13 = fungsiKeanggotaanStatusBuruk(inferensi13)
|
||||
val hasilInferensi14 = fungsiKeanggotaanStatusSedang(inferensi14)
|
||||
val hasilInferensi15 = fungsiKeanggotaanStatusBuruk(inferensi15)
|
||||
val hasilInferensi16 = fungsiKeanggotaanStatusSedang(inferensi16)
|
||||
val hasilInferensi17 = fungsiKeanggotaanStatusBuruk(inferensi17)
|
||||
val hasilInferensi18 = fungsiKeanggotaanStatusBuruk(inferensi18)
|
||||
|
||||
val hasilInferensi19 = fungsiKeanggotaanStatusBuruk(inferensi19)
|
||||
val hasilInferensi20 = fungsiKeanggotaanStatusBuruk(inferensi20)
|
||||
val hasilInferensi21 = fungsiKeanggotaanStatusBuruk(inferensi21)
|
||||
val hasilInferensi22 = fungsiKeanggotaanStatusBuruk(inferensi22)
|
||||
val hasilInferensi23 = fungsiKeanggotaanStatusBuruk(inferensi23)
|
||||
val hasilInferensi24 = fungsiKeanggotaanStatusBuruk(inferensi24)
|
||||
val hasilInferensi25 = fungsiKeanggotaanStatusSedang(inferensi25)
|
||||
val hasilInferensi26 = fungsiKeanggotaanStatusBuruk(inferensi26)
|
||||
val hasilInferensi27 = fungsiKeanggotaanStatusSedang(inferensi27)
|
||||
val hasilInferensi28 = fungsiKeanggotaanStatusSedang(inferensi28)
|
||||
val hasilInferensi29 = fungsiKeanggotaanStatusBuruk(inferensi29)
|
||||
|
||||
val hasilInferensi30 = fungsiKeanggotaanStatusBuruk(inferensi30)
|
||||
val hasilInferensi31 = fungsiKeanggotaanStatusBuruk(inferensi31)
|
||||
val hasilInferensi32 = fungsiKeanggotaanStatusBuruk(inferensi32)
|
||||
val hasilInferensi33 = fungsiKeanggotaanStatusBuruk(inferensi33)
|
||||
val hasilInferensi34 = fungsiKeanggotaanStatusBuruk(inferensi34)
|
||||
val hasilInferensi35 = fungsiKeanggotaanStatusSedang(inferensi35)
|
||||
val hasilInferensi36 = fungsiKeanggotaanStatusBuruk(inferensi36)
|
||||
|
||||
val hasilInferensi37 = fungsiKeanggotaanStatusBuruk(inferensi37)
|
||||
val hasilInferensi38 = fungsiKeanggotaanStatusBuruk(inferensi38)
|
||||
val hasilInferensi39 = fungsiKeanggotaanStatusBuruk(inferensi39)
|
||||
val hasilInferensi40 = fungsiKeanggotaanStatusBuruk(inferensi40)
|
||||
val hasilInferensi41 = fungsiKeanggotaanStatusBuruk(inferensi41)
|
||||
val hasilInferensi42 = fungsiKeanggotaanStatusBuruk(inferensi42)
|
||||
val hasilInferensi43 = fungsiKeanggotaanStatusSedang(inferensi43)
|
||||
val hasilInferensi44 = fungsiKeanggotaanStatusSedang(inferensi44)
|
||||
val hasilInferensi45 = fungsiKeanggotaanStatusBuruk(inferensi45)
|
||||
val hasilInferensi46 = fungsiKeanggotaanStatusSedang(inferensi46)
|
||||
val hasilInferensi47 = fungsiKeanggotaanStatusBuruk(inferensi47)
|
||||
val hasilInferensi48 = fungsiKeanggotaanStatusBuruk(inferensi48)
|
||||
|
||||
val hasilInferensi49 = fungsiKeanggotaanStatusBuruk(inferensi49)
|
||||
val hasilInferensi50 = fungsiKeanggotaanStatusBuruk(inferensi50)
|
||||
val hasilInferensi51 = fungsiKeanggotaanStatusBuruk(inferensi51)
|
||||
val hasilInferensi52 = fungsiKeanggotaanStatusBuruk(inferensi52)
|
||||
val hasilInferensi53 = fungsiKeanggotaanStatusBuruk(inferensi53)
|
||||
val hasilInferensi54 = fungsiKeanggotaanStatusBuruk(inferensi54)
|
||||
val hasilInferensi55 = fungsiKeanggotaanStatusSedang(inferensi55)
|
||||
val hasilInferensi56 = fungsiKeanggotaanStatusBuruk(inferensi56)
|
||||
val hasilInferensi57 = fungsiKeanggotaanStatusBuruk(inferensi57)
|
||||
val hasilInferensi58 = fungsiKeanggotaanStatusBuruk(inferensi58)
|
||||
val hasilInferensi59 = fungsiKeanggotaanStatusBuruk(inferensi59)
|
||||
val hasilInferensi60 = fungsiKeanggotaanStatusBuruk(inferensi60)
|
||||
|
||||
val hasilInferensi61 = fungsiKeanggotaanStatusBuruk(inferensi61)
|
||||
val hasilInferensi62 = fungsiKeanggotaanStatusBuruk(inferensi62)
|
||||
val hasilInferensi63 = fungsiKeanggotaanStatusBuruk(inferensi63)
|
||||
val hasilInferensi64 = fungsiKeanggotaanStatusBuruk(inferensi64)
|
||||
val hasilInferensi65 = fungsiKeanggotaanStatusBuruk(inferensi65)
|
||||
val hasilInferensi66 = fungsiKeanggotaanStatusBuruk(inferensi66)
|
||||
val hasilInferensi67 = fungsiKeanggotaanStatusSedang(inferensi67)
|
||||
val hasilInferensi68 = fungsiKeanggotaanStatusBuruk(inferensi68)
|
||||
val hasilInferensi69 = fungsiKeanggotaanStatusSedang(inferensi69)
|
||||
val hasilInferensi70 = fungsiKeanggotaanStatusSedang(inferensi70)
|
||||
val hasilInferensi71 = fungsiKeanggotaanStatusBuruk(inferensi71)
|
||||
val hasilInferensi72 = fungsiKeanggotaanStatusBuruk(inferensi72)
|
||||
|
||||
// Defuzzyfikasi
|
||||
val defuzzifikasi1 = ((inferensi1 * hasilInferensi1) + (inferensi2 * hasilInferensi2) + (inferensi3 * hasilInferensi3) + (inferensi4 * hasilInferensi4) + (inferensi5 * hasilInferensi5) + (inferensi6 * hasilInferensi6) + (inferensi7 * hasilInferensi7) + (inferensi8 * hasilInferensi8) + (inferensi9 * hasilInferensi9) + (inferensi10 * hasilInferensi10) + (inferensi11 * hasilInferensi11) + (inferensi12 * hasilInferensi12) + (inferensi13 * hasilInferensi13) + (inferensi14 * hasilInferensi14) + (inferensi15 * hasilInferensi15))
|
||||
val defuzzifikasi2 = ((inferensi16 * hasilInferensi16) + (inferensi17 * hasilInferensi17) + (inferensi18 * hasilInferensi18) + (inferensi19 * hasilInferensi19) + (inferensi20 * hasilInferensi20) + (inferensi21 * hasilInferensi21) + (inferensi22 * hasilInferensi22) + (inferensi23 * hasilInferensi23) + (inferensi24 * hasilInferensi24) + (inferensi25 * hasilInferensi25) + (inferensi26 * hasilInferensi26) + (inferensi27 * hasilInferensi27) + (inferensi28 * hasilInferensi28) + (inferensi29 * hasilInferensi29) + (inferensi30 * hasilInferensi30))
|
||||
val defuzzifikasi3 = ((inferensi31 * hasilInferensi31) + (inferensi32 * hasilInferensi32) + (inferensi33 * hasilInferensi33) + (inferensi34 * hasilInferensi34) + (inferensi35 * hasilInferensi35) + (inferensi36 * hasilInferensi36) + (inferensi37 * hasilInferensi37) + (inferensi38 * hasilInferensi38) + (inferensi39 * hasilInferensi39) + (inferensi40 * hasilInferensi40) + (inferensi41 * hasilInferensi41) + (inferensi42 * hasilInferensi42) + (inferensi43 * hasilInferensi43) + (inferensi44 * hasilInferensi44) + (inferensi45 * hasilInferensi45))
|
||||
val defuzzifikasi4 = ((inferensi46 * hasilInferensi46) + (inferensi47 * hasilInferensi47) + (inferensi48 * hasilInferensi48) + (inferensi49 * hasilInferensi49) + (inferensi50 * hasilInferensi50) + (inferensi51 * hasilInferensi51) + (inferensi52 * hasilInferensi52) + (inferensi53 * hasilInferensi53) + (inferensi54 * hasilInferensi54) + (inferensi55 * hasilInferensi55) + (inferensi56 * hasilInferensi56) + (inferensi57 * hasilInferensi57) + (inferensi58 * hasilInferensi58) + (inferensi59 * hasilInferensi59) + (inferensi60 * hasilInferensi60))
|
||||
val defuzzifikasi5 = ((inferensi61 * hasilInferensi61) + (inferensi62 * hasilInferensi62) + (inferensi63 * hasilInferensi63) + (inferensi64 * hasilInferensi64) + (inferensi65 * hasilInferensi65) + (inferensi66 * hasilInferensi66) + (inferensi67 * hasilInferensi67) + (inferensi68 * hasilInferensi68) + (inferensi69 * hasilInferensi69) + (inferensi70 * hasilInferensi70) + (inferensi71 * hasilInferensi71) + (inferensi72 * hasilInferensi72))
|
||||
|
||||
val defuzzifikasiA = inferensi1 + inferensi2 + inferensi3 + inferensi4 + inferensi5 + inferensi6 + inferensi7 + inferensi8 + inferensi9 + inferensi10 + inferensi11 + inferensi12 + inferensi13 + inferensi14 + inferensi15 + inferensi16 + inferensi17 + inferensi18 + inferensi19 + inferensi20
|
||||
val defuzzifikasiB = inferensi21 + inferensi22 + inferensi23 + inferensi24 + inferensi25 + inferensi26 + inferensi27 + inferensi28 + inferensi29 + inferensi30 + inferensi31 + inferensi32 + inferensi33 + inferensi34 + inferensi35 + inferensi36 + inferensi37 + inferensi38 + inferensi39 + inferensi40
|
||||
val defuzzifikasiC = inferensi41 + inferensi42 + inferensi43 + inferensi44 + inferensi45 + inferensi46 + inferensi47 + inferensi48 + inferensi49 + inferensi50 + inferensi51 + inferensi52 + inferensi53 + inferensi54 + inferensi55 + inferensi56 + inferensi57 + inferensi58 + inferensi59 + inferensi60
|
||||
val defuzzifikasiD = inferensi61 + inferensi62 + inferensi63 + inferensi64 + inferensi65 + inferensi66 + inferensi67 + inferensi68 + inferensi69 + inferensi70 + inferensi71 + inferensi72
|
||||
|
||||
val totalDefuzzifikasi1 = defuzzifikasi1 + defuzzifikasi2 + defuzzifikasi3 + defuzzifikasi4 + defuzzifikasi5
|
||||
val totalDefuzzifikasi2 = defuzzifikasiA + defuzzifikasiB + defuzzifikasiC + defuzzifikasiD
|
||||
|
||||
val defuzzifikasi = totalDefuzzifikasi1 / totalDefuzzifikasi2
|
||||
|
||||
val resultDefuzzifikasi = if (defuzzifikasi >= 40) {
|
||||
good
|
||||
} else if (defuzzifikasi <= 20){
|
||||
bad
|
||||
} else {
|
||||
medium
|
||||
}
|
||||
|
||||
// Log.d("Fuzzy Dutch", "Hasil Inferensi Aturan 1: α = $inferensi1, Z1 = $hasilInferensi1")
|
||||
// Log.d("Fuzzy Dutch", "Hasil Inferensi Aturan 13: α = $inferensi13, Z13 = $hasilInferensi13")
|
||||
// Log.d("Fuzzy Dutch", "Hasil Inferensi Aturan 25: α = $inferensi25, Z25 = $hasilInferensi25")
|
||||
// Log.d("Fuzzy Dutch", "Hasil Inferensi Aturan 32: α = $inferensi32, Z32 = $hasilInferensi32")
|
||||
// Log.d("Fuzzy Dutch", "Hasil Inferensi Aturan 44: α = $inferensi44, Z44 = $hasilInferensi44")
|
||||
// Log.d("Fuzzy Dutch", "Hasil Inferensi Aturan 58: α = $inferensi58, Z58 = $hasilInferensi58")
|
||||
// Log.d("Fuzzy Dutch", "Hasil Inferensi Aturan 63: α = $inferensi63, Z63 = $hasilInferensi63")
|
||||
// Log.d("Fuzzy Dutch", "Hasil Inferensi Aturan 70: α = $inferensi70, Z70 = $hasilInferensi70")
|
||||
//
|
||||
// Log.d("Fuzzy Dutch", "Defuzzyfikasi: Jumlah α * Z = $totalDefuzzifikasi1, Jumlah α = $totalDefuzzifikasi2, Grade = $resultDefuzzifikasi")
|
||||
|
||||
return resultDefuzzifikasi
|
||||
}
|
||||
|
||||
fun checkParameter(suhu: Double, ph: Double, ammonia: Double, kh: Double, gh: Double): StatusParameter {
|
||||
val suhuBaik = fungsiKeanggotaanSuhuBaik(suhu)
|
||||
val suhuBuruk = fungsiKeanggotaanSuhuBuruk(suhu)
|
||||
|
||||
val phBaik = fungsiKeanggotaanPhBaik(ph)
|
||||
val phSedang = fungsiKeanggotaanPhSedang(ph)
|
||||
val phBuruk = fungsiKeanggotaanPhBuruk(ph)
|
||||
|
||||
val ammoniaBaik = fungsiKeanggotaanAmmoniaBaik(ammonia)
|
||||
val ammoniaBuruk = fungsiKeanggotaanAmmoniaBuruk(ammonia)
|
||||
|
||||
val khBaik = fungsiKeanggotaanKhBaik(kh)
|
||||
val khSedang = fungsiKeanggotaanKhSedang(kh)
|
||||
val khBuruk = fungsiKeanggotaanKhBuruk(kh)
|
||||
|
||||
val ghBaik = fungsiKeanggotaanGhBaik(gh)
|
||||
val ghBuruk = fungsiKeanggotaanGhBuruk(gh)
|
||||
|
||||
val _temperature = if (suhuBaik >= suhuBuruk) {
|
||||
good
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _ph = if (phBaik >= phSedang && phBaik >= phBuruk) {
|
||||
good
|
||||
} else if (phSedang >= phBaik && phSedang >= phBuruk) {
|
||||
medium
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _ammonia = if (ammoniaBaik >= ammoniaBuruk) {
|
||||
good
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _kh = if (khBaik >= khSedang && khBaik >= khBuruk) {
|
||||
good
|
||||
} else if (khSedang >= khBaik && khSedang >= khBuruk) {
|
||||
medium
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _gh = if (ghBaik >= ghBuruk) {
|
||||
good
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
return StatusParameter(_temperature, _ph, _ammonia, _kh, _gh)
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
|
||||
// Fungsi-fungsi keanggotaan
|
||||
private fun fungsiKeanggotaanSuhuBaik(suhu: Double): Double {
|
||||
return when {
|
||||
suhu in 25.0..28.0 -> 1.0
|
||||
suhu > 23 && suhu < 25 -> (suhu - 23) / (25 - 23)
|
||||
suhu > 28 && suhu < 31 -> (31 - suhu) / (31 - 28)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanSuhuBuruk(suhu: Double): Double {
|
||||
return when {
|
||||
suhu <= 23 || suhu >= 31 -> 1.0
|
||||
suhu > 23 && suhu < 25 -> (25 - suhu) / (25 - 23)
|
||||
suhu > 28 && suhu < 31 -> (suhu - 28) / (31 - 28)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhBaik(ph: Double): Double {
|
||||
return when {
|
||||
ph in 6.3..6.6 -> 1.0
|
||||
ph > 6 && ph < 6.3 -> (ph - 6) / (6.3 - 6)
|
||||
ph > 6.6 && ph < 6.8 -> (6.8 - ph) / (6.8 - 6.6)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhSedang(ph: Double): Double {
|
||||
return when {
|
||||
ph > 6.6 && ph <= 6.8 -> (ph - 6.6) / (6.8 - 6.6)
|
||||
ph >= 6.8 && ph < 7 -> (7 - ph) / (7 - 6.8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhBuruk(ph: Double): Double {
|
||||
return when {
|
||||
ph <= 6 || ph >= 7 -> 1.0
|
||||
ph > 6 && ph < 6.3 -> (6.3 - ph) / (6.3 - 6)
|
||||
ph > 6.8 && ph < 7 -> (ph - 6.8) / (7 - 6.8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanAmmoniaBaik(ammonia: Double): Double {
|
||||
return when {
|
||||
ammonia <= 0.1 -> 1.0
|
||||
ammonia > 0.1 && ammonia < 0.5 -> (0.5 - ammonia) / (0.5 - 0.1)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanAmmoniaBuruk(ammonia: Double): Double {
|
||||
return when {
|
||||
ammonia >= 0.5 -> 1.0
|
||||
ammonia > 0.1 && ammonia < 0.5 -> (ammonia - 0.1) / (0.5 - 0.1)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanKhBaik(kh: Double): Double {
|
||||
return when {
|
||||
kh <= 1 -> 1.0
|
||||
kh > 1 && kh < 2 -> (2 - kh) / (2 - 1)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanKhSedang(kh: Double): Double {
|
||||
return when {
|
||||
kh in 2.0..4.0 -> 1.0
|
||||
kh > 1 && kh < 2 -> (kh - 1) / (2 - 1)
|
||||
kh > 4 && kh < 6 -> (6 - kh) / (6 - 4)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanKhBuruk(kh: Double): Double {
|
||||
return when {
|
||||
kh >= 6 -> 1.0
|
||||
kh > 4 && kh < 6 -> (kh - 4) / (6 - 4)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanGhBaik(gh: Double): Double {
|
||||
return when {
|
||||
gh <= 8 -> 1.0
|
||||
gh > 8 && gh < 12 -> (12 - gh) / (12 - 8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanGhBuruk(gh: Double): Double {
|
||||
return when {
|
||||
gh >= 12 -> 1.0
|
||||
gh > 8 && gh < 12 -> (gh - 8) / (12 - 8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
// ==============--------------------=================
|
||||
|
||||
private fun fungsiKeanggotaanStatusBaik(inverensi: Double): Double {
|
||||
return when (inverensi) {
|
||||
1.0 -> 40.0
|
||||
in 0.1..0.9 -> (inverensi * 10) + 30
|
||||
else -> 30.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanStatusSedang(inverensi: Double): Double {
|
||||
return when (inverensi) {
|
||||
1.0 -> 30.0
|
||||
in 0.1..0.9 -> (inverensi * 10) + 20
|
||||
else -> 20.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanStatusBuruk(inverensi: Double): Double {
|
||||
return when (inverensi) {
|
||||
1.0 -> 20.0
|
||||
in 0.1..0.9 -> 30 - (inverensi * 10)
|
||||
else -> 30.0
|
||||
}
|
||||
}
|
||||
|
||||
// private fun fungsiKeanggotaanStatusBaik(inverensi: Double): Double {
|
||||
// return when (inverensi) {
|
||||
// 1.0 -> 70.0
|
||||
// in 0.1..0.9 -> (inverensi * 20) + 50
|
||||
// else -> 50.0
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private fun fungsiKeanggotaanStatusSedang(inverensi: Double): Double {
|
||||
// return when (inverensi) {
|
||||
// 1.0 -> 50.0
|
||||
// in 0.1..0.9 -> (((inverensi * 20) + 30) + (70 - (inverensi * 20))) / 2
|
||||
// else -> 70.0
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private fun fungsiKeanggotaanStatusBuruk(inverensi: Double): Double {
|
||||
// return when (inverensi) {
|
||||
// 1.0 -> 30.0
|
||||
// in 0.1..0.9 -> 50 - (inverensi * 20)
|
||||
// else -> 50.0
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,670 @@
|
|||
package com.capstone.aquacare.fuzzy
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.StatusParameter
|
||||
|
||||
class FuzzyIdentification(private val context: Context, private val style: String) {
|
||||
|
||||
private val good = context.getString(R.string.good)
|
||||
private val medium = context.getString(R.string.medium)
|
||||
private val bad = context.getString(R.string.bad)
|
||||
|
||||
fun calculateWaterQuality(temperature: Double, ph: Double, ammonia: Double, kh: Double, gh: Double): String {
|
||||
|
||||
val dinginTemperature = fungsiKeanggotaanSuhuDingin(temperature)
|
||||
val normalTemperature = fungsiKeanggotaanSuhuNormal(temperature)
|
||||
val panasTemperature = fungsiKeanggotaanSuhuPanas(temperature)
|
||||
|
||||
val asamPh = fungsiKeanggotaanPhAsam(ph)
|
||||
val sedikitAsamPh = fungsiKeanggotaanPhSedikitAsam(ph)
|
||||
val netralPh = fungsiKeanggotaanPhNetral(ph)
|
||||
val basaPh = fungsiKeanggotaanPhBasa(ph)
|
||||
|
||||
val rendahAmmonia = fungsiKeanggotaanAmmoniaRendah(ammonia)
|
||||
val tinggiAmmonia = fungsiKeanggotaanAmmoniaTinggi(ammonia)
|
||||
|
||||
val rendahKh = if (style == "Natural Style") {
|
||||
fungsiKeanggotaanNaturalKhRendah(kh)
|
||||
} else {
|
||||
fungsiKeanggotaanDutchKhRendah(kh)
|
||||
}
|
||||
val sedangKh = if (style == "Natural Style") {
|
||||
fungsiKeanggotaanNaturalKhSedang(kh)
|
||||
} else {
|
||||
fungsiKeanggotaanDutchKhSedang(kh)
|
||||
}
|
||||
val tinggiKh = if (style == "Natural Style") {
|
||||
fungsiKeanggotaanNaturalKhTinggi(kh)
|
||||
} else {
|
||||
fungsiKeanggotaanDutchKhTinggi(kh)
|
||||
}
|
||||
|
||||
val rendahGh = fungsiKeanggotaanGhRendah(gh)
|
||||
val tinggiGh = fungsiKeanggotaanGhTinggi(gh)
|
||||
|
||||
val inferensi1 = minOf(normalTemperature, sedikitAsamPh, rendahAmmonia, rendahKh, rendahGh)
|
||||
val inferensi2 = minOf(normalTemperature, netralPh, rendahAmmonia, rendahKh, rendahGh)
|
||||
val inferensi3 = minOf(normalTemperature, asamPh, rendahAmmonia, rendahKh, rendahGh)
|
||||
val inferensi4 = minOf(normalTemperature, sedikitAsamPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi5 = minOf(normalTemperature, sedikitAsamPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi6 = minOf(normalTemperature, sedikitAsamPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi7 = minOf(normalTemperature, sedikitAsamPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
|
||||
val inferensi8 = minOf(normalTemperature, netralPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi9 = minOf(normalTemperature, netralPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi10 = minOf(normalTemperature, netralPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi11 = minOf(normalTemperature, netralPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi12 = minOf(normalTemperature, netralPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi13 = minOf(normalTemperature, netralPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi14 = minOf(normalTemperature, netralPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi15 = minOf(normalTemperature, netralPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi16 = minOf(normalTemperature, netralPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi17 = minOf(normalTemperature, netralPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi18 = minOf(normalTemperature, netralPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
val inferensi19 = minOf(normalTemperature, asamPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi20 = minOf(normalTemperature, asamPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi21 = minOf(normalTemperature, asamPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi22 = minOf(normalTemperature, asamPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi23 = minOf(normalTemperature, asamPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi24 = minOf(normalTemperature, asamPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi25 = minOf(normalTemperature, asamPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi26 = minOf(normalTemperature, asamPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi27 = minOf(normalTemperature, asamPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi28 = minOf(normalTemperature, asamPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi29 = minOf(normalTemperature, asamPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
val inferensi30 = minOf(normalTemperature, sedikitAsamPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi31 = minOf(normalTemperature, sedikitAsamPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi32 = minOf(normalTemperature, sedikitAsamPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi33 = minOf(normalTemperature, sedikitAsamPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi34 = minOf(normalTemperature, sedikitAsamPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi35 = minOf(normalTemperature, sedikitAsamPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi36 = minOf(normalTemperature, sedikitAsamPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
val inferensi37 = minOf(panasTemperature, netralPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi38 = minOf(panasTemperature, netralPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi39 = minOf(panasTemperature, netralPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi40 = minOf(panasTemperature, netralPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi41 = minOf(panasTemperature, netralPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi42 = minOf(panasTemperature, netralPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi43 = minOf(panasTemperature, netralPh, rendahAmmonia, rendahKh, rendahGh)
|
||||
val inferensi44 = minOf(panasTemperature, netralPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi45 = minOf(panasTemperature, netralPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi46 = minOf(panasTemperature, netralPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi47 = minOf(panasTemperature, netralPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi48 = minOf(panasTemperature, netralPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
val inferensi49 = minOf(panasTemperature, asamPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi50 = minOf(panasTemperature, asamPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi51 = minOf(panasTemperature, asamPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi52 = minOf(panasTemperature, asamPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi53 = minOf(panasTemperature, asamPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi54 = minOf(panasTemperature, asamPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi55 = minOf(panasTemperature, asamPh, rendahAmmonia, rendahKh, rendahGh)
|
||||
val inferensi56 = minOf(panasTemperature, asamPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi57 = minOf(panasTemperature, asamPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi58 = minOf(panasTemperature, asamPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi59 = minOf(panasTemperature, asamPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi60 = minOf(panasTemperature, asamPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
val inferensi61 = minOf(panasTemperature, sedikitAsamPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi62 = minOf(panasTemperature, sedikitAsamPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi63 = minOf(panasTemperature, sedikitAsamPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi64 = minOf(panasTemperature, sedikitAsamPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi65 = minOf(panasTemperature, sedikitAsamPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi66 = minOf(panasTemperature, sedikitAsamPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi67 = minOf(panasTemperature, sedikitAsamPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi68 = minOf(panasTemperature, sedikitAsamPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi69 = minOf(panasTemperature, sedikitAsamPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi70 = minOf(panasTemperature, sedikitAsamPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi71 = minOf(panasTemperature, sedikitAsamPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi72 = minOf(panasTemperature, sedikitAsamPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
|
||||
val inferensi73 = minOf(dinginTemperature, netralPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi74 = minOf(dinginTemperature, netralPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi75 = minOf(dinginTemperature, netralPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi76 = minOf(dinginTemperature, netralPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi77 = minOf(dinginTemperature, netralPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi78 = minOf(dinginTemperature, netralPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi79 = minOf(dinginTemperature, netralPh, rendahAmmonia, rendahKh, rendahGh)
|
||||
val inferensi80 = minOf(dinginTemperature, netralPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi81 = minOf(dinginTemperature, netralPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi82 = minOf(dinginTemperature, netralPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi83 = minOf(dinginTemperature, netralPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi84 = minOf(dinginTemperature, netralPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
val inferensi85 = minOf(dinginTemperature, asamPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi86 = minOf(dinginTemperature, asamPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi87 = minOf(dinginTemperature, asamPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi88 = minOf(dinginTemperature, asamPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi89 = minOf(dinginTemperature, asamPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi90 = minOf(dinginTemperature, asamPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi91 = minOf(dinginTemperature, asamPh, rendahAmmonia, rendahKh, rendahGh)
|
||||
val inferensi92 = minOf(dinginTemperature, asamPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi93 = minOf(dinginTemperature, asamPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi94 = minOf(dinginTemperature, asamPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi95 = minOf(dinginTemperature, asamPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi96 = minOf(dinginTemperature, asamPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
val inferensi97 = minOf(dinginTemperature, sedikitAsamPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi98 = minOf(dinginTemperature, sedikitAsamPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi99 = minOf(dinginTemperature, sedikitAsamPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi100 = minOf(dinginTemperature, sedikitAsamPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi101 = minOf(dinginTemperature, sedikitAsamPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi102 = minOf(dinginTemperature, sedikitAsamPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi103 = minOf(dinginTemperature, sedikitAsamPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi104 = minOf(dinginTemperature, sedikitAsamPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi105 = minOf(dinginTemperature, sedikitAsamPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi106 = minOf(dinginTemperature, sedikitAsamPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi107 = minOf(dinginTemperature, sedikitAsamPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi108 = minOf(dinginTemperature, sedikitAsamPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
|
||||
val inferensi109 = minOf(normalTemperature, basaPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi110 = minOf(normalTemperature, basaPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi111 = minOf(normalTemperature, basaPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi112 = minOf(normalTemperature, basaPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi113 = minOf(normalTemperature, basaPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi114 = minOf(normalTemperature, basaPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi115 = minOf(normalTemperature, basaPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi116 = minOf(normalTemperature, basaPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi117 = minOf(normalTemperature, basaPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi118 = minOf(normalTemperature, basaPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi119 = minOf(normalTemperature, basaPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
val inferensi120 = minOf(panasTemperature, basaPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi121 = minOf(panasTemperature, basaPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi122 = minOf(panasTemperature, basaPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi123 = minOf(panasTemperature, basaPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi124 = minOf(panasTemperature, basaPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi125 = minOf(panasTemperature, basaPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi126 = minOf(panasTemperature, basaPh, rendahAmmonia, rendahKh, rendahGh)
|
||||
val inferensi127 = minOf(panasTemperature, basaPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi128 = minOf(panasTemperature, basaPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi129 = minOf(panasTemperature, basaPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi130 = minOf(panasTemperature, basaPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi131 = minOf(panasTemperature, basaPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
val inferensi132 = minOf(dinginTemperature, basaPh, tinggiAmmonia, rendahKh, rendahGh)
|
||||
val inferensi133 = minOf(dinginTemperature, basaPh, tinggiAmmonia, sedangKh, rendahGh)
|
||||
val inferensi134 = minOf(dinginTemperature, basaPh, tinggiAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi135 = minOf(dinginTemperature, basaPh, tinggiAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi136 = minOf(dinginTemperature, basaPh, tinggiAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi137 = minOf(dinginTemperature, basaPh, tinggiAmmonia, tinggiKh, tinggiGh)
|
||||
val inferensi138 = minOf(dinginTemperature, basaPh, rendahAmmonia, rendahKh, rendahGh)
|
||||
val inferensi139 = minOf(dinginTemperature, basaPh, rendahAmmonia, sedangKh, rendahGh)
|
||||
val inferensi140 = minOf(dinginTemperature, basaPh, rendahAmmonia, tinggiKh, rendahGh)
|
||||
val inferensi141 = minOf(dinginTemperature, basaPh, rendahAmmonia, rendahKh, tinggiGh)
|
||||
val inferensi142 = minOf(dinginTemperature, basaPh, rendahAmmonia, sedangKh, tinggiGh)
|
||||
val inferensi143 = minOf(dinginTemperature, basaPh, rendahAmmonia, tinggiKh, tinggiGh)
|
||||
|
||||
|
||||
val hasilInferensi1 = fungsiKeanggotaanStatusBaik(inferensi1)
|
||||
val hasilInferensi2 = fungsiKeanggotaanStatusBaik(inferensi2)
|
||||
val hasilInferensi3 = fungsiKeanggotaanStatusSedang(inferensi3)
|
||||
val hasilInferensi4 = fungsiKeanggotaanStatusBuruk(inferensi4)
|
||||
val hasilInferensi5 = fungsiKeanggotaanStatusSedang(inferensi5)
|
||||
val hasilInferensi6 = fungsiKeanggotaanStatusBuruk(inferensi6)
|
||||
val hasilInferensi7 = fungsiKeanggotaanStatusSedang(inferensi7)
|
||||
|
||||
val hasilInferensi8 = fungsiKeanggotaanStatusBuruk(inferensi8)
|
||||
val hasilInferensi9 = fungsiKeanggotaanStatusBuruk(inferensi9)
|
||||
val hasilInferensi10 = fungsiKeanggotaanStatusBuruk(inferensi10)
|
||||
val hasilInferensi11 = fungsiKeanggotaanStatusBuruk(inferensi11)
|
||||
val hasilInferensi12 = fungsiKeanggotaanStatusBuruk(inferensi12)
|
||||
val hasilInferensi13 = fungsiKeanggotaanStatusBuruk(inferensi13)
|
||||
val hasilInferensi14 = fungsiKeanggotaanStatusSedang(inferensi14)
|
||||
val hasilInferensi15 = fungsiKeanggotaanStatusBuruk(inferensi15)
|
||||
val hasilInferensi16 = fungsiKeanggotaanStatusSedang(inferensi16)
|
||||
val hasilInferensi17 = fungsiKeanggotaanStatusBuruk(inferensi17)
|
||||
val hasilInferensi18 = fungsiKeanggotaanStatusBuruk(inferensi18)
|
||||
|
||||
val hasilInferensi19 = fungsiKeanggotaanStatusBuruk(inferensi19)
|
||||
val hasilInferensi20 = fungsiKeanggotaanStatusBuruk(inferensi20)
|
||||
val hasilInferensi21 = fungsiKeanggotaanStatusBuruk(inferensi21)
|
||||
val hasilInferensi22 = fungsiKeanggotaanStatusBuruk(inferensi22)
|
||||
val hasilInferensi23 = fungsiKeanggotaanStatusBuruk(inferensi23)
|
||||
val hasilInferensi24 = fungsiKeanggotaanStatusBuruk(inferensi24)
|
||||
val hasilInferensi25 = fungsiKeanggotaanStatusSedang(inferensi25)
|
||||
val hasilInferensi26 = fungsiKeanggotaanStatusBuruk(inferensi26)
|
||||
val hasilInferensi27 = fungsiKeanggotaanStatusSedang(inferensi27)
|
||||
val hasilInferensi28 = fungsiKeanggotaanStatusSedang(inferensi28)
|
||||
val hasilInferensi29 = fungsiKeanggotaanStatusBuruk(inferensi29)
|
||||
|
||||
val hasilInferensi30 = fungsiKeanggotaanStatusBuruk(inferensi30)
|
||||
val hasilInferensi31 = fungsiKeanggotaanStatusBuruk(inferensi31)
|
||||
val hasilInferensi32 = fungsiKeanggotaanStatusBuruk(inferensi32)
|
||||
val hasilInferensi33 = fungsiKeanggotaanStatusBuruk(inferensi33)
|
||||
val hasilInferensi34 = fungsiKeanggotaanStatusBuruk(inferensi34)
|
||||
val hasilInferensi35 = fungsiKeanggotaanStatusSedang(inferensi35)
|
||||
val hasilInferensi36 = fungsiKeanggotaanStatusBuruk(inferensi36)
|
||||
|
||||
val hasilInferensi37 = fungsiKeanggotaanStatusBuruk(inferensi37)
|
||||
val hasilInferensi38 = fungsiKeanggotaanStatusBuruk(inferensi38)
|
||||
val hasilInferensi39 = fungsiKeanggotaanStatusBuruk(inferensi39)
|
||||
val hasilInferensi40 = fungsiKeanggotaanStatusBuruk(inferensi40)
|
||||
val hasilInferensi41 = fungsiKeanggotaanStatusBuruk(inferensi41)
|
||||
val hasilInferensi42 = fungsiKeanggotaanStatusBuruk(inferensi42)
|
||||
val hasilInferensi43 = fungsiKeanggotaanStatusSedang(inferensi43)
|
||||
val hasilInferensi44 = fungsiKeanggotaanStatusSedang(inferensi44)
|
||||
val hasilInferensi45 = fungsiKeanggotaanStatusBuruk(inferensi45)
|
||||
val hasilInferensi46 = fungsiKeanggotaanStatusSedang(inferensi46)
|
||||
val hasilInferensi47 = fungsiKeanggotaanStatusBuruk(inferensi47)
|
||||
val hasilInferensi48 = fungsiKeanggotaanStatusBuruk(inferensi48)
|
||||
|
||||
val hasilInferensi49 = fungsiKeanggotaanStatusBuruk(inferensi49)
|
||||
val hasilInferensi50 = fungsiKeanggotaanStatusBuruk(inferensi50)
|
||||
val hasilInferensi51 = fungsiKeanggotaanStatusBuruk(inferensi51)
|
||||
val hasilInferensi52 = fungsiKeanggotaanStatusBuruk(inferensi52)
|
||||
val hasilInferensi53 = fungsiKeanggotaanStatusBuruk(inferensi53)
|
||||
val hasilInferensi54 = fungsiKeanggotaanStatusBuruk(inferensi54)
|
||||
val hasilInferensi55 = fungsiKeanggotaanStatusSedang(inferensi55)
|
||||
val hasilInferensi56 = fungsiKeanggotaanStatusBuruk(inferensi56)
|
||||
val hasilInferensi57 = fungsiKeanggotaanStatusBuruk(inferensi57)
|
||||
val hasilInferensi58 = fungsiKeanggotaanStatusBuruk(inferensi58)
|
||||
val hasilInferensi59 = fungsiKeanggotaanStatusBuruk(inferensi59)
|
||||
val hasilInferensi60 = fungsiKeanggotaanStatusBuruk(inferensi60)
|
||||
|
||||
val hasilInferensi61 = fungsiKeanggotaanStatusBuruk(inferensi61)
|
||||
val hasilInferensi62 = fungsiKeanggotaanStatusBuruk(inferensi62)
|
||||
val hasilInferensi63 = fungsiKeanggotaanStatusBuruk(inferensi63)
|
||||
val hasilInferensi64 = fungsiKeanggotaanStatusBuruk(inferensi64)
|
||||
val hasilInferensi65 = fungsiKeanggotaanStatusBuruk(inferensi65)
|
||||
val hasilInferensi66 = fungsiKeanggotaanStatusBuruk(inferensi66)
|
||||
val hasilInferensi67 = fungsiKeanggotaanStatusSedang(inferensi67)
|
||||
val hasilInferensi68 = fungsiKeanggotaanStatusBuruk(inferensi68)
|
||||
val hasilInferensi69 = fungsiKeanggotaanStatusSedang(inferensi69)
|
||||
val hasilInferensi70 = fungsiKeanggotaanStatusSedang(inferensi70)
|
||||
val hasilInferensi71 = fungsiKeanggotaanStatusBuruk(inferensi71)
|
||||
val hasilInferensi72 = fungsiKeanggotaanStatusBuruk(inferensi72)
|
||||
|
||||
val hasilInferensi73 = fungsiKeanggotaanStatusBuruk(inferensi73)
|
||||
val hasilInferensi74 = fungsiKeanggotaanStatusBuruk(inferensi74)
|
||||
val hasilInferensi75 = fungsiKeanggotaanStatusBuruk(inferensi75)
|
||||
val hasilInferensi76 = fungsiKeanggotaanStatusBuruk(inferensi76)
|
||||
val hasilInferensi77 = fungsiKeanggotaanStatusBuruk(inferensi77)
|
||||
val hasilInferensi78 = fungsiKeanggotaanStatusBuruk(inferensi78)
|
||||
val hasilInferensi79 = fungsiKeanggotaanStatusSedang(inferensi79)
|
||||
val hasilInferensi80 = fungsiKeanggotaanStatusSedang(inferensi80)
|
||||
val hasilInferensi81 = fungsiKeanggotaanStatusBuruk(inferensi81)
|
||||
val hasilInferensi82 = fungsiKeanggotaanStatusSedang(inferensi82)
|
||||
val hasilInferensi83 = fungsiKeanggotaanStatusBuruk(inferensi83)
|
||||
val hasilInferensi84 = fungsiKeanggotaanStatusBuruk(inferensi84)
|
||||
|
||||
val hasilInferensi85 = fungsiKeanggotaanStatusBuruk(inferensi85)
|
||||
val hasilInferensi86 = fungsiKeanggotaanStatusBuruk(inferensi86)
|
||||
val hasilInferensi87 = fungsiKeanggotaanStatusBuruk(inferensi87)
|
||||
val hasilInferensi88 = fungsiKeanggotaanStatusBuruk(inferensi88)
|
||||
val hasilInferensi89 = fungsiKeanggotaanStatusBuruk(inferensi89)
|
||||
val hasilInferensi90 = fungsiKeanggotaanStatusBuruk(inferensi90)
|
||||
val hasilInferensi91 = fungsiKeanggotaanStatusSedang(inferensi91)
|
||||
val hasilInferensi92 = fungsiKeanggotaanStatusBuruk(inferensi92)
|
||||
val hasilInferensi93 = fungsiKeanggotaanStatusBuruk(inferensi93)
|
||||
val hasilInferensi94 = fungsiKeanggotaanStatusBuruk(inferensi94)
|
||||
val hasilInferensi95 = fungsiKeanggotaanStatusBuruk(inferensi95)
|
||||
val hasilInferensi96 = fungsiKeanggotaanStatusBuruk(inferensi96)
|
||||
|
||||
val hasilInferensi97 = fungsiKeanggotaanStatusBuruk(inferensi97)
|
||||
val hasilInferensi98 = fungsiKeanggotaanStatusBuruk(inferensi98)
|
||||
val hasilInferensi99 = fungsiKeanggotaanStatusBuruk(inferensi99)
|
||||
val hasilInferensi100 = fungsiKeanggotaanStatusBuruk(inferensi100)
|
||||
val hasilInferensi101 = fungsiKeanggotaanStatusBuruk(inferensi101)
|
||||
val hasilInferensi102 = fungsiKeanggotaanStatusBuruk(inferensi102)
|
||||
val hasilInferensi103 = fungsiKeanggotaanStatusSedang(inferensi103)
|
||||
val hasilInferensi104 = fungsiKeanggotaanStatusBuruk(inferensi104)
|
||||
val hasilInferensi105 = fungsiKeanggotaanStatusSedang(inferensi105)
|
||||
val hasilInferensi106 = fungsiKeanggotaanStatusSedang(inferensi106)
|
||||
val hasilInferensi107 = fungsiKeanggotaanStatusBuruk(inferensi107)
|
||||
val hasilInferensi108 = fungsiKeanggotaanStatusBuruk(inferensi108)
|
||||
|
||||
val hasilInferensi109 = fungsiKeanggotaanStatusBuruk(inferensi19)
|
||||
val hasilInferensi110 = fungsiKeanggotaanStatusBuruk(inferensi20)
|
||||
val hasilInferensi111 = fungsiKeanggotaanStatusBuruk(inferensi21)
|
||||
val hasilInferensi112 = fungsiKeanggotaanStatusBuruk(inferensi22)
|
||||
val hasilInferensi113 = fungsiKeanggotaanStatusBuruk(inferensi23)
|
||||
val hasilInferensi114 = fungsiKeanggotaanStatusBuruk(inferensi24)
|
||||
val hasilInferensi115 = fungsiKeanggotaanStatusSedang(inferensi25)
|
||||
val hasilInferensi116 = fungsiKeanggotaanStatusBuruk(inferensi26)
|
||||
val hasilInferensi117 = fungsiKeanggotaanStatusSedang(inferensi27)
|
||||
val hasilInferensi118 = fungsiKeanggotaanStatusSedang(inferensi28)
|
||||
val hasilInferensi119 = fungsiKeanggotaanStatusBuruk(inferensi29)
|
||||
|
||||
val hasilInferensi120 = fungsiKeanggotaanStatusBuruk(inferensi49)
|
||||
val hasilInferensi121 = fungsiKeanggotaanStatusBuruk(inferensi50)
|
||||
val hasilInferensi122 = fungsiKeanggotaanStatusBuruk(inferensi51)
|
||||
val hasilInferensi123 = fungsiKeanggotaanStatusBuruk(inferensi52)
|
||||
val hasilInferensi124 = fungsiKeanggotaanStatusBuruk(inferensi53)
|
||||
val hasilInferensi125 = fungsiKeanggotaanStatusBuruk(inferensi54)
|
||||
val hasilInferensi126 = fungsiKeanggotaanStatusSedang(inferensi55)
|
||||
val hasilInferensi127 = fungsiKeanggotaanStatusBuruk(inferensi56)
|
||||
val hasilInferensi128 = fungsiKeanggotaanStatusBuruk(inferensi57)
|
||||
val hasilInferensi129 = fungsiKeanggotaanStatusBuruk(inferensi58)
|
||||
val hasilInferensi130 = fungsiKeanggotaanStatusBuruk(inferensi59)
|
||||
val hasilInferensi131 = fungsiKeanggotaanStatusBuruk(inferensi60)
|
||||
|
||||
val hasilInferensi132 = fungsiKeanggotaanStatusBuruk(inferensi85)
|
||||
val hasilInferensi133 = fungsiKeanggotaanStatusBuruk(inferensi86)
|
||||
val hasilInferensi134 = fungsiKeanggotaanStatusBuruk(inferensi87)
|
||||
val hasilInferensi135 = fungsiKeanggotaanStatusBuruk(inferensi88)
|
||||
val hasilInferensi136 = fungsiKeanggotaanStatusBuruk(inferensi89)
|
||||
val hasilInferensi137 = fungsiKeanggotaanStatusBuruk(inferensi90)
|
||||
val hasilInferensi138 = fungsiKeanggotaanStatusSedang(inferensi91)
|
||||
val hasilInferensi139 = fungsiKeanggotaanStatusBuruk(inferensi92)
|
||||
val hasilInferensi140 = fungsiKeanggotaanStatusBuruk(inferensi93)
|
||||
val hasilInferensi141 = fungsiKeanggotaanStatusBuruk(inferensi94)
|
||||
val hasilInferensi142 = fungsiKeanggotaanStatusBuruk(inferensi95)
|
||||
val hasilInferensi143 = fungsiKeanggotaanStatusBuruk(inferensi96)
|
||||
|
||||
// val defuzzifikasi1 = ((inferensi1 * hasilInferensi1) + (inferensi2 * hasilInferensi2) + (inferensi3 * hasilInferensi3) + (inferensi4 * hasilInferensi4) + (inferensi5 * hasilInferensi5) + (inferensi6 * hasilInferensi6) + (inferensi7 * hasilInferensi7) + (inferensi8 * hasilInferensi8) + (inferensi9 * hasilInferensi9) + (inferensi10 * hasilInferensi10) + (inferensi11 * hasilInferensi11) + (inferensi12 * hasilInferensi12) + (inferensi13 * hasilInferensi13) + (inferensi14 * hasilInferensi14) + (inferensi15 * hasilInferensi15))
|
||||
// val defuzzifikasi2 = ((inferensi16 * hasilInferensi16) + (inferensi17 * hasilInferensi17) + (inferensi18 * hasilInferensi18) + (inferensi19 * hasilInferensi19) + (inferensi20 * hasilInferensi20) + (inferensi21 * hasilInferensi21) + (inferensi22 * hasilInferensi22) + (inferensi23 * hasilInferensi23) + (inferensi24 * hasilInferensi24) + (inferensi25 * hasilInferensi25) + (inferensi26 * hasilInferensi26) + (inferensi27 * hasilInferensi27) + (inferensi28 * hasilInferensi28) + (inferensi29 * hasilInferensi29) + (inferensi30 * hasilInferensi30))
|
||||
// val defuzzifikasi3 = ((inferensi31 * hasilInferensi31) + (inferensi32 * hasilInferensi32) + (inferensi33 * hasilInferensi33) + (inferensi34 * hasilInferensi34) + (inferensi35 * hasilInferensi35) + (inferensi36 * hasilInferensi36) + (inferensi37 * hasilInferensi37) + (inferensi38 * hasilInferensi38) + (inferensi39 * hasilInferensi39) + (inferensi40 * hasilInferensi40) + (inferensi41 * hasilInferensi41) + (inferensi42 * hasilInferensi42) + (inferensi43 * hasilInferensi43) + (inferensi44 * hasilInferensi44) + (inferensi45 * hasilInferensi45))
|
||||
// val defuzzifikasi4 = ((inferensi46 * hasilInferensi46) + (inferensi47 * hasilInferensi47) + (inferensi48 * hasilInferensi48) + (inferensi49 * hasilInferensi49) + (inferensi50 * hasilInferensi50) + (inferensi51 * hasilInferensi51) + (inferensi52 * hasilInferensi52) + (inferensi53 * hasilInferensi53) + (inferensi54 * hasilInferensi54) + (inferensi55 * hasilInferensi55) + (inferensi56 * hasilInferensi56) + (inferensi57 * hasilInferensi57) + (inferensi58 * hasilInferensi58) + (inferensi59 * hasilInferensi59) + (inferensi60 * hasilInferensi60))
|
||||
// val defuzzifikasi5 = ((inferensi61 * hasilInferensi61) + (inferensi62 * hasilInferensi62) + (inferensi63 * hasilInferensi63) + (inferensi64 * hasilInferensi64) + (inferensi65 * hasilInferensi65) + (inferensi66 * hasilInferensi66) + (inferensi67 * hasilInferensi67) + (inferensi68 * hasilInferensi68) + (inferensi69 * hasilInferensi69) + (inferensi70 * hasilInferensi70) + (inferensi71 * hasilInferensi71) + (inferensi72 * hasilInferensi72))
|
||||
|
||||
// val defuzzifikasiA = inferensi1 + inferensi2 + inferensi3 + inferensi4 + inferensi5 + inferensi6 + inferensi7 + inferensi8 + inferensi9 + inferensi10 + inferensi11 + inferensi12 + inferensi13 + inferensi14 + inferensi15 + inferensi16 + inferensi17 + inferensi18 + inferensi19 + inferensi20
|
||||
// val defuzzifikasiB = inferensi21 + inferensi22 + inferensi23 + inferensi24 + inferensi25 + inferensi26 + inferensi27 + inferensi28 + inferensi29 + inferensi30 + inferensi31 + inferensi32 + inferensi33 + inferensi34 + inferensi35 + inferensi36 + inferensi37 + inferensi38 + inferensi39 + inferensi40
|
||||
// val defuzzifikasiC = inferensi41 + inferensi42 + inferensi43 + inferensi44 + inferensi45 + inferensi46 + inferensi47 + inferensi48 + inferensi49 + inferensi50 + inferensi51 + inferensi52 + inferensi53 + inferensi54 + inferensi55 + inferensi56 + inferensi57 + inferensi58 + inferensi59 + inferensi60
|
||||
// val defuzzifikasiD = inferensi61 + inferensi62 + inferensi63 + inferensi64 + inferensi65 + inferensi66 + inferensi67 + inferensi68 + inferensi69 + inferensi70 + inferensi71 + inferensi72
|
||||
|
||||
val totalA = listOf(
|
||||
inferensi1 * hasilInferensi1, inferensi2 * hasilInferensi2, inferensi3 * hasilInferensi3, inferensi4 * hasilInferensi4, inferensi5 * hasilInferensi5, inferensi6 * hasilInferensi6, inferensi7 * hasilInferensi7, inferensi8 * hasilInferensi8,
|
||||
inferensi9 * hasilInferensi9, inferensi10 * hasilInferensi10, inferensi11 * hasilInferensi11, inferensi12 * hasilInferensi12, inferensi13 * hasilInferensi13, inferensi14 * hasilInferensi14, inferensi15 * hasilInferensi15, inferensi16 * hasilInferensi16,
|
||||
inferensi17 * hasilInferensi17, inferensi18 * hasilInferensi18, inferensi19 * hasilInferensi19, inferensi20 * hasilInferensi20, inferensi21 * hasilInferensi21, inferensi22 * hasilInferensi22, inferensi23 * hasilInferensi23, inferensi24 * hasilInferensi24,
|
||||
inferensi25 * hasilInferensi25, inferensi26 * hasilInferensi26, inferensi27 * hasilInferensi27, inferensi28 * hasilInferensi28, inferensi29 * hasilInferensi29, inferensi30 * hasilInferensi30, inferensi31 * hasilInferensi31, inferensi32 * hasilInferensi32,
|
||||
inferensi33 * hasilInferensi33, inferensi34 * hasilInferensi34, inferensi35 * hasilInferensi35, inferensi36 * hasilInferensi36, inferensi37 * hasilInferensi37, inferensi38 * hasilInferensi38, inferensi39 * hasilInferensi39, inferensi40 * hasilInferensi40,
|
||||
inferensi41 * hasilInferensi41, inferensi42 * hasilInferensi42, inferensi43 * hasilInferensi43, inferensi44 * hasilInferensi44, inferensi45 * hasilInferensi45, inferensi46 * hasilInferensi46, inferensi47 * hasilInferensi47, inferensi48 * hasilInferensi48,
|
||||
inferensi49 * hasilInferensi49, inferensi50 * hasilInferensi50, inferensi51 * hasilInferensi51, inferensi52 * hasilInferensi52, inferensi53 * hasilInferensi53, inferensi54 * hasilInferensi54, inferensi55 * hasilInferensi55, inferensi56 * hasilInferensi56,
|
||||
inferensi57 * hasilInferensi57, inferensi58 * hasilInferensi58, inferensi59 * hasilInferensi59, inferensi60 * hasilInferensi60, inferensi61 * hasilInferensi61, inferensi62 * hasilInferensi62, inferensi63 * hasilInferensi63, inferensi64 * hasilInferensi64,
|
||||
inferensi65 * hasilInferensi65, inferensi66 * hasilInferensi66, inferensi67 * hasilInferensi67, inferensi68 * hasilInferensi68, inferensi69 * hasilInferensi69, inferensi70 * hasilInferensi70, inferensi71 * hasilInferensi71, inferensi72 * hasilInferensi72,
|
||||
inferensi73 * hasilInferensi73, inferensi74 * hasilInferensi74, inferensi75 * hasilInferensi75, inferensi76 * hasilInferensi76, inferensi77 * hasilInferensi77, inferensi78 * hasilInferensi78, inferensi79 * hasilInferensi79, inferensi80 * hasilInferensi80,
|
||||
inferensi81 * hasilInferensi81, inferensi82 * hasilInferensi82, inferensi83 * hasilInferensi83, inferensi84 * hasilInferensi84, inferensi85 * hasilInferensi85, inferensi86 * hasilInferensi86, inferensi87 * hasilInferensi87, inferensi88 * hasilInferensi88,
|
||||
inferensi89 * hasilInferensi89, inferensi90 * hasilInferensi90, inferensi91 * hasilInferensi91, inferensi92 * hasilInferensi92, inferensi93 * hasilInferensi93, inferensi94 * hasilInferensi94, inferensi95 * hasilInferensi95, inferensi96 * hasilInferensi96,
|
||||
inferensi97 * hasilInferensi97, inferensi98 * hasilInferensi98, inferensi99 * hasilInferensi99, inferensi100 * hasilInferensi100, inferensi101 * hasilInferensi101, inferensi102 * hasilInferensi102, inferensi103 * hasilInferensi103, inferensi104 * hasilInferensi104,
|
||||
inferensi105 * hasilInferensi105, inferensi106 * hasilInferensi106, inferensi107 * hasilInferensi107, inferensi108 * hasilInferensi108, inferensi109 * hasilInferensi109, inferensi110 * hasilInferensi110, inferensi111 * hasilInferensi111, inferensi112 * hasilInferensi112,
|
||||
inferensi113 * hasilInferensi113, inferensi114 * hasilInferensi114, inferensi115 * hasilInferensi115, inferensi116 * hasilInferensi116, inferensi117 * hasilInferensi117, inferensi118 * hasilInferensi118, inferensi119 * hasilInferensi119, inferensi120 * hasilInferensi120,
|
||||
inferensi121 * hasilInferensi121, inferensi122 * hasilInferensi122, inferensi123 * hasilInferensi123, inferensi124 * hasilInferensi124, inferensi125 * hasilInferensi125, inferensi126 * hasilInferensi126, inferensi127 * hasilInferensi127, inferensi128 * hasilInferensi128,
|
||||
inferensi129 * hasilInferensi129, inferensi130 * hasilInferensi130, inferensi131 * hasilInferensi131, inferensi132 * hasilInferensi132, inferensi133 * hasilInferensi133, inferensi134 * hasilInferensi134, inferensi135 * hasilInferensi135, inferensi136 * hasilInferensi136,
|
||||
inferensi137 * hasilInferensi137, inferensi138 * hasilInferensi138, inferensi139 * hasilInferensi139, inferensi140 * hasilInferensi140, inferensi141 * hasilInferensi141, inferensi142 * hasilInferensi142, inferensi143 * hasilInferensi143
|
||||
).sumOf { it }
|
||||
|
||||
val totalB = listOf(
|
||||
inferensi1, inferensi2, inferensi3, inferensi4, inferensi5, inferensi6, inferensi7, inferensi8, inferensi9, inferensi10, inferensi11, inferensi12, inferensi13, inferensi14, inferensi15, inferensi16, inferensi17, inferensi18, inferensi19, inferensi20,
|
||||
inferensi21, inferensi22, inferensi23, inferensi24, inferensi25, inferensi26, inferensi27, inferensi28, inferensi29, inferensi30, inferensi31, inferensi32, inferensi33, inferensi34, inferensi35, inferensi36, inferensi37, inferensi38, inferensi39, inferensi40,
|
||||
inferensi41, inferensi42, inferensi43, inferensi44, inferensi45, inferensi46, inferensi47, inferensi48, inferensi49, inferensi50, inferensi51, inferensi52, inferensi53, inferensi54, inferensi55, inferensi56, inferensi57, inferensi58, inferensi59, inferensi60,
|
||||
inferensi61, inferensi62, inferensi63, inferensi64, inferensi65, inferensi66, inferensi67, inferensi68, inferensi69, inferensi70, inferensi71, inferensi72, inferensi73, inferensi74, inferensi75, inferensi76, inferensi77, inferensi78, inferensi79, inferensi80,
|
||||
inferensi81, inferensi82, inferensi83, inferensi84, inferensi85, inferensi86, inferensi87, inferensi88, inferensi89, inferensi90, inferensi91, inferensi92, inferensi93, inferensi94, inferensi95, inferensi96, inferensi97, inferensi98, inferensi99, inferensi100,
|
||||
inferensi101, inferensi102, inferensi103, inferensi104, inferensi105, inferensi106, inferensi107, inferensi108, inferensi109, inferensi110, inferensi111, inferensi112, inferensi113, inferensi114, inferensi115, inferensi116, inferensi117, inferensi118,
|
||||
inferensi119, inferensi120, inferensi121, inferensi122, inferensi123, inferensi124, inferensi125, inferensi126, inferensi127, inferensi128, inferensi129, inferensi130, inferensi131, inferensi132, inferensi133, inferensi134, inferensi135, inferensi136,
|
||||
inferensi137, inferensi138, inferensi139, inferensi140, inferensi141, inferensi142, inferensi143
|
||||
).sumOf { it }
|
||||
|
||||
// val totalDefuzzifikasi1 = defuzzifikasi1 + defuzzifikasi2 + defuzzifikasi3 + defuzzifikasi4 + defuzzifikasi5
|
||||
// val totalDefuzzifikasi2 = defuzzifikasiA + defuzzifikasiB + defuzzifikasiC + defuzzifikasiD
|
||||
|
||||
// val defuzzifikasi = totalDefuzzifikasi1 / totalDefuzzifikasi2
|
||||
val defuzzifikasi = totalA / totalB
|
||||
|
||||
val resultDefuzzifikasi = if (defuzzifikasi >= 70) {
|
||||
good
|
||||
} else if (defuzzifikasi <= 30){
|
||||
bad
|
||||
} else {
|
||||
medium
|
||||
}
|
||||
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 3: α = $inferensi3, Z3 = $hasilInferensi3")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 13: α = $inferensi13, Z13 = $hasilInferensi13")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 25: α = $inferensi25, Z25 = $hasilInferensi25")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 32: α = $inferensi32, Z32 = $hasilInferensi32")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 44: α = $inferensi44, Z44 = $hasilInferensi44")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 58: α = $inferensi58, Z58 = $hasilInferensi58")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 63: α = $inferensi63, Z63 = $hasilInferensi63")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 70: α = $inferensi70, Z70 = $hasilInferensi70")
|
||||
//
|
||||
Log.d("Fuzzy Natural", "Defuzzyfikasi: Jumlah α * Z = $totalA, Jumlah α = $totalB, Grade = $resultDefuzzifikasi")
|
||||
|
||||
return resultDefuzzifikasi
|
||||
}
|
||||
|
||||
fun checkParameter(suhu: Double, ph: Double, ammonia: Double, kh: Double, gh: Double): StatusParameter {
|
||||
val dinginTemperature = fungsiKeanggotaanSuhuDingin(suhu)
|
||||
val normalTemperature = fungsiKeanggotaanSuhuNormal(suhu)
|
||||
val panasTemperature = fungsiKeanggotaanSuhuPanas(suhu)
|
||||
|
||||
val asamPh = fungsiKeanggotaanPhAsam(ph)
|
||||
val sedikitAsamPh = fungsiKeanggotaanPhSedikitAsam(ph)
|
||||
val netralPh = fungsiKeanggotaanPhNetral(ph)
|
||||
val basaPh = fungsiKeanggotaanPhBasa(ph)
|
||||
|
||||
val rendahAmmonia = fungsiKeanggotaanAmmoniaRendah(ammonia)
|
||||
val tinggiAmmonia = fungsiKeanggotaanAmmoniaTinggi(ammonia)
|
||||
|
||||
val rendahKh = if (style == "Natural Style") {
|
||||
fungsiKeanggotaanNaturalKhRendah(kh)
|
||||
} else {
|
||||
fungsiKeanggotaanDutchKhRendah(kh)
|
||||
}
|
||||
val sedangKh = if (style == "Natural Style") {
|
||||
fungsiKeanggotaanNaturalKhSedang(kh)
|
||||
} else {
|
||||
fungsiKeanggotaanDutchKhSedang(kh)
|
||||
}
|
||||
val tinggiKh = if (style == "Natural Style") {
|
||||
fungsiKeanggotaanNaturalKhTinggi(kh)
|
||||
} else {
|
||||
fungsiKeanggotaanDutchKhTinggi(kh)
|
||||
}
|
||||
|
||||
val rendahGh = fungsiKeanggotaanGhRendah(gh)
|
||||
val tinggiGh = fungsiKeanggotaanGhTinggi(gh)
|
||||
|
||||
val _temperature = if (normalTemperature >= dinginTemperature && normalTemperature >= panasTemperature) {
|
||||
good
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _ph = if (sedikitAsamPh >= netralPh && sedikitAsamPh >= asamPh && sedikitAsamPh >= basaPh) {
|
||||
good
|
||||
} else if (netralPh >= sedikitAsamPh && netralPh >= asamPh && netralPh >= basaPh) {
|
||||
medium
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _ammonia = if (rendahAmmonia >= tinggiAmmonia) {
|
||||
good
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _kh = if (rendahKh >= sedangKh && rendahKh >= tinggiKh) {
|
||||
good
|
||||
} else if (sedangKh >= rendahKh && sedangKh >= tinggiKh) {
|
||||
medium
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _gh = if (rendahGh >= tinggiGh) {
|
||||
good
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
return StatusParameter(_temperature, _ph, _ammonia, _kh, _gh)
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
|
||||
// Fungsi Keanggotaan
|
||||
private fun fungsiKeanggotaanSuhuDingin(suhu: Double): Double {
|
||||
return when {
|
||||
suhu <= 22 -> 1.0
|
||||
suhu > 22 && suhu < 25 -> (25 - suhu) / (25 - 22)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanSuhuNormal(suhu: Double): Double {
|
||||
return when {
|
||||
suhu in 25.0..28.0 -> 1.0
|
||||
suhu > 22 && suhu < 25 -> (suhu - 22) / (25 - 22)
|
||||
suhu > 28 && suhu < 31 -> (31 - suhu) / (31 - 28)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanSuhuPanas(suhu: Double): Double {
|
||||
return when {
|
||||
suhu >= 31 -> 1.0
|
||||
suhu > 28 && suhu < 31 -> (suhu - 28) / (31 - 28)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhAsam(ph: Double): Double {
|
||||
return when {
|
||||
ph <= 6 -> 1.0
|
||||
ph > 6 && ph < 6.3 -> (6.3 - ph) / (6.3 - 6)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhSedikitAsam(ph: Double): Double {
|
||||
return when {
|
||||
ph in 6.3..6.6 -> 1.0
|
||||
ph > 6 && ph < 6.3 -> (ph - 6) / (6.3 - 6)
|
||||
ph > 6.6 && ph < 7 -> (7 - ph) / (7 - 6.6)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhNetral(ph: Double): Double {
|
||||
return when {
|
||||
ph > 6.6 && ph <= 7 -> (ph - 6.6) / (7 - 6.6)
|
||||
ph >= 7 && ph < 7.4 -> (7.4 - ph) / (7.4 - 7)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhBasa(ph: Double): Double {
|
||||
return when {
|
||||
ph >= 7.4 -> 1.0
|
||||
ph > 7 && ph < 7.4 -> (ph - 7) / (7.4 - 7)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanAmmoniaRendah(ammonia: Double): Double {
|
||||
return when {
|
||||
ammonia <= 0.1 -> 1.0
|
||||
ammonia > 0.1 && ammonia < 0.5 -> (0.5 - ammonia) / (0.5 - 0.1)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanAmmoniaTinggi(ammonia: Double): Double {
|
||||
return when {
|
||||
ammonia >= 0.5 -> 1.0
|
||||
ammonia > 0.1 && ammonia < 0.5 -> (ammonia - 0.1) / (0.5 - 0.1)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanNaturalKhRendah(kh: Double): Double {
|
||||
return when {
|
||||
kh <= 5 -> 1.0
|
||||
kh > 5 && kh < 8 -> (8 - kh) / (8 - 5)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanNaturalKhSedang(kh: Double): Double {
|
||||
return when {
|
||||
kh in 8.0..10.0 -> 1.0
|
||||
kh > 5 && kh < 8 -> (kh - 5) / (8 - 5)
|
||||
kh > 10 && kh < 13 -> (13 - kh) / (13 - 10)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanNaturalKhTinggi(kh: Double): Double {
|
||||
return when {
|
||||
kh >= 13 -> 1.0
|
||||
kh > 10 && kh < 13 -> (kh - 10) / (13 - 10)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanDutchKhRendah(kh: Double): Double {
|
||||
return when {
|
||||
kh <= 2 -> 1.0
|
||||
kh > 2 && kh < 5 -> (5 - kh) / (5 - 2)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanDutchKhSedang(kh: Double): Double {
|
||||
return when {
|
||||
kh in 5.0..6.0 -> 1.0
|
||||
kh > 2 && kh < 5 -> (kh - 2) / (5 - 2)
|
||||
kh > 6 && kh < 9 -> (9 - kh) / (9 - 6)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanDutchKhTinggi(kh: Double): Double {
|
||||
return when {
|
||||
kh >= 9 -> 1.0
|
||||
kh > 6 && kh < 9 -> (kh - 6) / (9 - 6)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanGhRendah(gh: Double): Double {
|
||||
return when {
|
||||
gh <= 8 -> 1.0
|
||||
gh > 8 && gh < 12 -> (12 - gh) / (12 - 8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanGhTinggi(gh: Double): Double {
|
||||
return when {
|
||||
gh >= 12 -> 1.0
|
||||
gh > 8 && gh < 12 -> (gh - 8) / (12 - 8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
// ==============--------------------=================
|
||||
|
||||
private fun fungsiKeanggotaanStatusBaik(inverensi: Double): Double {
|
||||
return when (inverensi) {
|
||||
1.0 -> 70.0
|
||||
in 0.1..0.9 -> (inverensi * 20) + 50
|
||||
else -> 50.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanStatusSedang(inverensi: Double): Double {
|
||||
return when (inverensi) {
|
||||
in 0.1..1.0 -> (inverensi * 20) + 30
|
||||
else -> 70.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanStatusBuruk(inverensi: Double): Double {
|
||||
return when (inverensi) {
|
||||
1.0 -> 30.0
|
||||
in 0.1..0.9 -> 50 - (inverensi * 20)
|
||||
else -> 50.0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,416 @@
|
|||
package com.capstone.aquacare.fuzzy
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.StatusParameter
|
||||
|
||||
class FuzzyNaturalStyle(private val context: Context) {
|
||||
|
||||
private val good = context.getString(R.string.good)
|
||||
private val medium = context.getString(R.string.medium)
|
||||
private val bad = context.getString(R.string.bad)
|
||||
|
||||
fun calculateWaterQuality(temperature: Double, ph: Double, ammonia: Double, kh: Double, gh: Double): String {
|
||||
|
||||
val goodTemperature = fungsiKeanggotaanSuhuBaik(temperature)
|
||||
val badTemperature = fungsiKeanggotaanSuhuBuruk(temperature)
|
||||
|
||||
val goodPh = fungsiKeanggotaanPhBaik(ph)
|
||||
val mediumPh = fungsiKeanggotaanPhSedang(ph)
|
||||
val badPh = fungsiKeanggotaanPhBuruk(ph)
|
||||
|
||||
val goodAmmonia = fungsiKeanggotaanAmmoniaBaik(ammonia)
|
||||
val badAmmonia = fungsiKeanggotaanAmmoniaBuruk(ammonia)
|
||||
|
||||
val goodKh = fungsiKeanggotaanKhBaik(kh)
|
||||
val mediumKh = fungsiKeanggotaanKhSedang(kh)
|
||||
val badKh = fungsiKeanggotaanKhBuruk(kh)
|
||||
|
||||
val goodGh = fungsiKeanggotaanGhBaik(gh)
|
||||
val badGh = fungsiKeanggotaanGhBuruk(gh)
|
||||
|
||||
val inferensi1 = minOf(goodTemperature, goodPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi2 = minOf(goodTemperature, mediumPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi3 = minOf(goodTemperature, badPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi4 = minOf(goodTemperature, goodPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi5 = minOf(goodTemperature, goodPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi6 = minOf(goodTemperature, goodPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi7 = minOf(goodTemperature, goodPh, goodAmmonia, goodKh, badGh)
|
||||
|
||||
val inferensi8 = minOf(goodTemperature, mediumPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi9 = minOf(goodTemperature, mediumPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi10 = minOf(goodTemperature, mediumPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi11 = minOf(goodTemperature, mediumPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi12 = minOf(goodTemperature, mediumPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi13 = minOf(goodTemperature, mediumPh, badAmmonia, badKh, badGh)
|
||||
val inferensi14 = minOf(goodTemperature, mediumPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi15 = minOf(goodTemperature, mediumPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi16 = minOf(goodTemperature, mediumPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi17 = minOf(goodTemperature, mediumPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi18 = minOf(goodTemperature, mediumPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi19 = minOf(goodTemperature, badPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi20 = minOf(goodTemperature, badPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi21 = minOf(goodTemperature, badPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi22 = minOf(goodTemperature, badPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi23 = minOf(goodTemperature, badPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi24 = minOf(goodTemperature, badPh, badAmmonia, badKh, badGh)
|
||||
val inferensi25 = minOf(goodTemperature, badPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi26 = minOf(goodTemperature, badPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi27 = minOf(goodTemperature, badPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi28 = minOf(goodTemperature, badPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi29 = minOf(goodTemperature, badPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi30 = minOf(goodTemperature, goodPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi31 = minOf(goodTemperature, goodPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi32 = minOf(goodTemperature, goodPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi33 = minOf(goodTemperature, goodPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi34 = minOf(goodTemperature, goodPh, badAmmonia, badKh, badGh)
|
||||
val inferensi35 = minOf(goodTemperature, goodPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi36 = minOf(goodTemperature, goodPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi37 = minOf(badTemperature, mediumPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi38 = minOf(badTemperature, mediumPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi39 = minOf(badTemperature, mediumPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi40 = minOf(badTemperature, mediumPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi41 = minOf(badTemperature, mediumPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi42 = minOf(badTemperature, mediumPh, badAmmonia, badKh, badGh)
|
||||
val inferensi43 = minOf(badTemperature, mediumPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi44 = minOf(badTemperature, mediumPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi45 = minOf(badTemperature, mediumPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi46 = minOf(badTemperature, mediumPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi47 = minOf(badTemperature, mediumPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi48 = minOf(badTemperature, mediumPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi49 = minOf(badTemperature, badPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi50 = minOf(badTemperature, badPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi51 = minOf(badTemperature, badPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi52 = minOf(badTemperature, badPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi53 = minOf(badTemperature, badPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi54 = minOf(badTemperature, badPh, badAmmonia, badKh, badGh)
|
||||
val inferensi55 = minOf(badTemperature, badPh, goodAmmonia, goodKh, goodGh)
|
||||
val inferensi56 = minOf(badTemperature, badPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi57 = minOf(badTemperature, badPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi58 = minOf(badTemperature, badPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi59 = minOf(badTemperature, badPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi60 = minOf(badTemperature, badPh, goodAmmonia, badKh, badGh)
|
||||
|
||||
val inferensi61 = minOf(badTemperature, goodPh, badAmmonia, mediumKh, goodGh)
|
||||
val inferensi62 = minOf(badTemperature, goodPh, badAmmonia, badKh, goodGh)
|
||||
val inferensi63 = minOf(badTemperature, goodPh, badAmmonia, goodKh, goodGh)
|
||||
val inferensi64 = minOf(badTemperature, goodPh, badAmmonia, goodKh, badGh)
|
||||
val inferensi65 = minOf(badTemperature, goodPh, badAmmonia, mediumKh, badGh)
|
||||
val inferensi66 = minOf(badTemperature, goodPh, badAmmonia, badKh, badGh)
|
||||
val inferensi67 = minOf(badTemperature, goodPh, goodAmmonia, mediumKh, goodGh)
|
||||
val inferensi68 = minOf(badTemperature, goodPh, goodAmmonia, badKh, goodGh)
|
||||
val inferensi69 = minOf(badTemperature, goodPh, goodAmmonia, goodKh, badGh)
|
||||
val inferensi70 = minOf(badTemperature, goodPh, goodAmmonia, mediumKh, badGh)
|
||||
val inferensi71 = minOf(badTemperature, goodPh, goodAmmonia, badKh, badGh)
|
||||
val inferensi72 = minOf(badTemperature, goodPh, badAmmonia, goodKh, badGh)
|
||||
|
||||
val hasilInferensi1 = fungsiKeanggotaanStatusBaik(inferensi1)
|
||||
val hasilInferensi2 = fungsiKeanggotaanStatusBaik(inferensi2)
|
||||
val hasilInferensi3 = fungsiKeanggotaanStatusSedang(inferensi3)
|
||||
val hasilInferensi4 = fungsiKeanggotaanStatusBuruk(inferensi4)
|
||||
val hasilInferensi5 = fungsiKeanggotaanStatusSedang(inferensi5)
|
||||
val hasilInferensi6 = fungsiKeanggotaanStatusBuruk(inferensi6)
|
||||
val hasilInferensi7 = fungsiKeanggotaanStatusSedang(inferensi7)
|
||||
|
||||
val hasilInferensi8 = fungsiKeanggotaanStatusBuruk(inferensi8)
|
||||
val hasilInferensi9 = fungsiKeanggotaanStatusBuruk(inferensi9)
|
||||
val hasilInferensi10 = fungsiKeanggotaanStatusBuruk(inferensi10)
|
||||
val hasilInferensi11 = fungsiKeanggotaanStatusBuruk(inferensi11)
|
||||
val hasilInferensi12 = fungsiKeanggotaanStatusBuruk(inferensi12)
|
||||
val hasilInferensi13 = fungsiKeanggotaanStatusBuruk(inferensi13)
|
||||
val hasilInferensi14 = fungsiKeanggotaanStatusSedang(inferensi14)
|
||||
val hasilInferensi15 = fungsiKeanggotaanStatusBuruk(inferensi15)
|
||||
val hasilInferensi16 = fungsiKeanggotaanStatusSedang(inferensi16)
|
||||
val hasilInferensi17 = fungsiKeanggotaanStatusBuruk(inferensi17)
|
||||
val hasilInferensi18 = fungsiKeanggotaanStatusBuruk(inferensi18)
|
||||
|
||||
val hasilInferensi19 = fungsiKeanggotaanStatusBuruk(inferensi19)
|
||||
val hasilInferensi20 = fungsiKeanggotaanStatusBuruk(inferensi20)
|
||||
val hasilInferensi21 = fungsiKeanggotaanStatusBuruk(inferensi21)
|
||||
val hasilInferensi22 = fungsiKeanggotaanStatusBuruk(inferensi22)
|
||||
val hasilInferensi23 = fungsiKeanggotaanStatusBuruk(inferensi23)
|
||||
val hasilInferensi24 = fungsiKeanggotaanStatusBuruk(inferensi24)
|
||||
val hasilInferensi25 = fungsiKeanggotaanStatusSedang(inferensi25)
|
||||
val hasilInferensi26 = fungsiKeanggotaanStatusBuruk(inferensi26)
|
||||
val hasilInferensi27 = fungsiKeanggotaanStatusSedang(inferensi27)
|
||||
val hasilInferensi28 = fungsiKeanggotaanStatusSedang(inferensi28)
|
||||
val hasilInferensi29 = fungsiKeanggotaanStatusBuruk(inferensi29)
|
||||
|
||||
val hasilInferensi30 = fungsiKeanggotaanStatusBuruk(inferensi30)
|
||||
val hasilInferensi31 = fungsiKeanggotaanStatusBuruk(inferensi31)
|
||||
val hasilInferensi32 = fungsiKeanggotaanStatusBuruk(inferensi32)
|
||||
val hasilInferensi33 = fungsiKeanggotaanStatusBuruk(inferensi33)
|
||||
val hasilInferensi34 = fungsiKeanggotaanStatusBuruk(inferensi34)
|
||||
val hasilInferensi35 = fungsiKeanggotaanStatusSedang(inferensi35)
|
||||
val hasilInferensi36 = fungsiKeanggotaanStatusBuruk(inferensi36)
|
||||
|
||||
val hasilInferensi37 = fungsiKeanggotaanStatusBuruk(inferensi37)
|
||||
val hasilInferensi38 = fungsiKeanggotaanStatusBuruk(inferensi38)
|
||||
val hasilInferensi39 = fungsiKeanggotaanStatusBuruk(inferensi39)
|
||||
val hasilInferensi40 = fungsiKeanggotaanStatusBuruk(inferensi40)
|
||||
val hasilInferensi41 = fungsiKeanggotaanStatusBuruk(inferensi41)
|
||||
val hasilInferensi42 = fungsiKeanggotaanStatusBuruk(inferensi42)
|
||||
val hasilInferensi43 = fungsiKeanggotaanStatusSedang(inferensi43)
|
||||
val hasilInferensi44 = fungsiKeanggotaanStatusSedang(inferensi44)
|
||||
val hasilInferensi45 = fungsiKeanggotaanStatusBuruk(inferensi45)
|
||||
val hasilInferensi46 = fungsiKeanggotaanStatusSedang(inferensi46)
|
||||
val hasilInferensi47 = fungsiKeanggotaanStatusBuruk(inferensi47)
|
||||
val hasilInferensi48 = fungsiKeanggotaanStatusBuruk(inferensi48)
|
||||
|
||||
val hasilInferensi49 = fungsiKeanggotaanStatusBuruk(inferensi49)
|
||||
val hasilInferensi50 = fungsiKeanggotaanStatusBuruk(inferensi50)
|
||||
val hasilInferensi51 = fungsiKeanggotaanStatusBuruk(inferensi51)
|
||||
val hasilInferensi52 = fungsiKeanggotaanStatusBuruk(inferensi52)
|
||||
val hasilInferensi53 = fungsiKeanggotaanStatusBuruk(inferensi53)
|
||||
val hasilInferensi54 = fungsiKeanggotaanStatusBuruk(inferensi54)
|
||||
val hasilInferensi55 = fungsiKeanggotaanStatusSedang(inferensi55)
|
||||
val hasilInferensi56 = fungsiKeanggotaanStatusBuruk(inferensi56)
|
||||
val hasilInferensi57 = fungsiKeanggotaanStatusBuruk(inferensi57)
|
||||
val hasilInferensi58 = fungsiKeanggotaanStatusBuruk(inferensi58)
|
||||
val hasilInferensi59 = fungsiKeanggotaanStatusBuruk(inferensi59)
|
||||
val hasilInferensi60 = fungsiKeanggotaanStatusBuruk(inferensi60)
|
||||
|
||||
val hasilInferensi61 = fungsiKeanggotaanStatusBuruk(inferensi61)
|
||||
val hasilInferensi62 = fungsiKeanggotaanStatusBuruk(inferensi62)
|
||||
val hasilInferensi63 = fungsiKeanggotaanStatusBuruk(inferensi63)
|
||||
val hasilInferensi64 = fungsiKeanggotaanStatusBuruk(inferensi64)
|
||||
val hasilInferensi65 = fungsiKeanggotaanStatusBuruk(inferensi65)
|
||||
val hasilInferensi66 = fungsiKeanggotaanStatusBuruk(inferensi66)
|
||||
val hasilInferensi67 = fungsiKeanggotaanStatusSedang(inferensi67)
|
||||
val hasilInferensi68 = fungsiKeanggotaanStatusBuruk(inferensi68)
|
||||
val hasilInferensi69 = fungsiKeanggotaanStatusSedang(inferensi69)
|
||||
val hasilInferensi70 = fungsiKeanggotaanStatusSedang(inferensi70)
|
||||
val hasilInferensi71 = fungsiKeanggotaanStatusBuruk(inferensi71)
|
||||
val hasilInferensi72 = fungsiKeanggotaanStatusBuruk(inferensi72)
|
||||
|
||||
val defuzzifikasi1 = ((inferensi1 * hasilInferensi1) + (inferensi2 * hasilInferensi2) + (inferensi3 * hasilInferensi3) + (inferensi4 * hasilInferensi4) + (inferensi5 * hasilInferensi5) + (inferensi6 * hasilInferensi6) + (inferensi7 * hasilInferensi7) + (inferensi8 * hasilInferensi8) + (inferensi9 * hasilInferensi9) + (inferensi10 * hasilInferensi10) + (inferensi11 * hasilInferensi11) + (inferensi12 * hasilInferensi12) + (inferensi13 * hasilInferensi13) + (inferensi14 * hasilInferensi14) + (inferensi15 * hasilInferensi15))
|
||||
val defuzzifikasi2 = ((inferensi16 * hasilInferensi16) + (inferensi17 * hasilInferensi17) + (inferensi18 * hasilInferensi18) + (inferensi19 * hasilInferensi19) + (inferensi20 * hasilInferensi20) + (inferensi21 * hasilInferensi21) + (inferensi22 * hasilInferensi22) + (inferensi23 * hasilInferensi23) + (inferensi24 * hasilInferensi24) + (inferensi25 * hasilInferensi25) + (inferensi26 * hasilInferensi26) + (inferensi27 * hasilInferensi27) + (inferensi28 * hasilInferensi28) + (inferensi29 * hasilInferensi29) + (inferensi30 * hasilInferensi30))
|
||||
val defuzzifikasi3 = ((inferensi31 * hasilInferensi31) + (inferensi32 * hasilInferensi32) + (inferensi33 * hasilInferensi33) + (inferensi34 * hasilInferensi34) + (inferensi35 * hasilInferensi35) + (inferensi36 * hasilInferensi36) + (inferensi37 * hasilInferensi37) + (inferensi38 * hasilInferensi38) + (inferensi39 * hasilInferensi39) + (inferensi40 * hasilInferensi40) + (inferensi41 * hasilInferensi41) + (inferensi42 * hasilInferensi42) + (inferensi43 * hasilInferensi43) + (inferensi44 * hasilInferensi44) + (inferensi45 * hasilInferensi45))
|
||||
val defuzzifikasi4 = ((inferensi46 * hasilInferensi46) + (inferensi47 * hasilInferensi47) + (inferensi48 * hasilInferensi48) + (inferensi49 * hasilInferensi49) + (inferensi50 * hasilInferensi50) + (inferensi51 * hasilInferensi51) + (inferensi52 * hasilInferensi52) + (inferensi53 * hasilInferensi53) + (inferensi54 * hasilInferensi54) + (inferensi55 * hasilInferensi55) + (inferensi56 * hasilInferensi56) + (inferensi57 * hasilInferensi57) + (inferensi58 * hasilInferensi58) + (inferensi59 * hasilInferensi59) + (inferensi60 * hasilInferensi60))
|
||||
val defuzzifikasi5 = ((inferensi61 * hasilInferensi61) + (inferensi62 * hasilInferensi62) + (inferensi63 * hasilInferensi63) + (inferensi64 * hasilInferensi64) + (inferensi65 * hasilInferensi65) + (inferensi66 * hasilInferensi66) + (inferensi67 * hasilInferensi67) + (inferensi68 * hasilInferensi68) + (inferensi69 * hasilInferensi69) + (inferensi70 * hasilInferensi70) + (inferensi71 * hasilInferensi71) + (inferensi72 * hasilInferensi72))
|
||||
|
||||
val defuzzifikasiA = inferensi1 + inferensi2 + inferensi3 + inferensi4 + inferensi5 + inferensi6 + inferensi7 + inferensi8 + inferensi9 + inferensi10 + inferensi11 + inferensi12 + inferensi13 + inferensi14 + inferensi15 + inferensi16 + inferensi17 + inferensi18 + inferensi19 + inferensi20
|
||||
val defuzzifikasiB = inferensi21 + inferensi22 + inferensi23 + inferensi24 + inferensi25 + inferensi26 + inferensi27 + inferensi28 + inferensi29 + inferensi30 + inferensi31 + inferensi32 + inferensi33 + inferensi34 + inferensi35 + inferensi36 + inferensi37 + inferensi38 + inferensi39 + inferensi40
|
||||
val defuzzifikasiC = inferensi41 + inferensi42 + inferensi43 + inferensi44 + inferensi45 + inferensi46 + inferensi47 + inferensi48 + inferensi49 + inferensi50 + inferensi51 + inferensi52 + inferensi53 + inferensi54 + inferensi55 + inferensi56 + inferensi57 + inferensi58 + inferensi59 + inferensi60
|
||||
val defuzzifikasiD = inferensi61 + inferensi62 + inferensi63 + inferensi64 + inferensi65 + inferensi66 + inferensi67 + inferensi68 + inferensi69 + inferensi70 + inferensi71 + inferensi72
|
||||
|
||||
val totalDefuzzifikasi1 = defuzzifikasi1 + defuzzifikasi2 + defuzzifikasi3 + defuzzifikasi4 + defuzzifikasi5
|
||||
val totalDefuzzifikasi2 = defuzzifikasiA + defuzzifikasiB + defuzzifikasiC + defuzzifikasiD
|
||||
|
||||
val defuzzifikasi = totalDefuzzifikasi1 / totalDefuzzifikasi2
|
||||
|
||||
val resultDefuzzifikasi = if (defuzzifikasi >= 40) {
|
||||
good
|
||||
} else if (defuzzifikasi <= 20){
|
||||
bad
|
||||
} else {
|
||||
medium
|
||||
}
|
||||
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 3: α = $inferensi3, Z3 = $hasilInferensi3")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 13: α = $inferensi13, Z13 = $hasilInferensi13")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 25: α = $inferensi25, Z25 = $hasilInferensi25")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 32: α = $inferensi32, Z32 = $hasilInferensi32")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 44: α = $inferensi44, Z44 = $hasilInferensi44")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 58: α = $inferensi58, Z58 = $hasilInferensi58")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 63: α = $inferensi63, Z63 = $hasilInferensi63")
|
||||
// Log.d("Fuzzy Natural", "Hasil Inferensi Aturan 70: α = $inferensi70, Z70 = $hasilInferensi70")
|
||||
//
|
||||
// Log.d("Fuzzy Natural", "Defuzzyfikasi: Jumlah α * Z = $totalDefuzzifikasi1, Jumlah α = $totalDefuzzifikasi2, Grade = $resultDefuzzifikasi")
|
||||
|
||||
return resultDefuzzifikasi
|
||||
}
|
||||
|
||||
fun checkParameter(suhu: Double, ph: Double, ammonia: Double, kh: Double, gh: Double): StatusParameter {
|
||||
val suhuBaik = fungsiKeanggotaanSuhuBaik(suhu)
|
||||
val suhuBuruk = fungsiKeanggotaanSuhuBuruk(suhu)
|
||||
|
||||
val phBaik = fungsiKeanggotaanPhBaik(ph)
|
||||
val phSedang = fungsiKeanggotaanPhSedang(ph)
|
||||
val phBuruk = fungsiKeanggotaanPhBuruk(ph)
|
||||
|
||||
val ammoniaBaik = fungsiKeanggotaanAmmoniaBaik(ammonia)
|
||||
val ammoniaBuruk = fungsiKeanggotaanAmmoniaBuruk(ammonia)
|
||||
|
||||
val khBaik = fungsiKeanggotaanKhBaik(kh)
|
||||
val khSedang = fungsiKeanggotaanKhSedang(kh)
|
||||
val khBuruk = fungsiKeanggotaanKhBuruk(kh)
|
||||
|
||||
val ghBaik = fungsiKeanggotaanGhBaik(gh)
|
||||
val ghBuruk = fungsiKeanggotaanGhBuruk(gh)
|
||||
|
||||
val _temperature = if (suhuBaik >= suhuBuruk) {
|
||||
good
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _ph = if (phBaik >= phSedang && phBaik >= phBuruk) {
|
||||
good
|
||||
} else if (phSedang >= phBaik && phSedang >= phBuruk) {
|
||||
medium
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _ammonia = if (ammoniaBaik >= ammoniaBuruk) {
|
||||
good
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _kh = if (khBaik >= khSedang && khBaik >= khBuruk) {
|
||||
good
|
||||
} else if (khSedang >= khBaik && khSedang >= khBuruk) {
|
||||
medium
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
val _gh = if (ghBaik >= ghBuruk) {
|
||||
good
|
||||
} else {
|
||||
bad
|
||||
}
|
||||
|
||||
return StatusParameter(_temperature, _ph, _ammonia, _kh, _gh)
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
|
||||
// Fungsi-fungsi keanggotaan
|
||||
private fun fungsiKeanggotaanSuhuBaik(suhu: Double): Double {
|
||||
return when {
|
||||
suhu in 25.0..28.0 -> 1.0
|
||||
suhu > 23 && suhu < 25 -> (suhu - 23) / (25 - 23)
|
||||
suhu > 28 && suhu < 31 -> (31 - suhu) / (31 - 28)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanSuhuBuruk(suhu: Double): Double {
|
||||
return when {
|
||||
suhu <= 23 || suhu >= 31 -> 1.0
|
||||
suhu > 23 && suhu < 25 -> (25 - suhu) / (25 - 23)
|
||||
suhu > 28 && suhu < 31 -> (suhu - 28) / (31 - 28)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhBaik(ph: Double): Double {
|
||||
return when {
|
||||
ph in 6.3..6.6 -> 1.0
|
||||
ph > 6 && ph < 6.3 -> (ph - 6) / (6.3 - 6)
|
||||
ph > 6.6 && ph < 6.8 -> (6.8 - ph) / (6.8 - 6.6)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhSedang(ph: Double): Double {
|
||||
return when {
|
||||
ph > 6.6 && ph <= 6.8 -> (ph - 6.6) / (6.8 - 6.6)
|
||||
ph >= 6.8 && ph < 7 -> (7 - ph) / (7 - 6.8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanPhBuruk(ph: Double): Double {
|
||||
return when {
|
||||
ph <= 6 || ph >= 7 -> 1.0
|
||||
ph > 6 && ph < 6.3 -> (6.3 - ph) / (6.3 - 6)
|
||||
ph > 6.8 && ph < 7 -> (ph - 6.8) / (7 - 6.8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanAmmoniaBaik(ammonia: Double): Double {
|
||||
return when {
|
||||
ammonia <= 0.1 -> 1.0
|
||||
ammonia > 0.1 && ammonia < 0.5 -> (0.5 - ammonia) / (0.5 - 0.1)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanAmmoniaBuruk(ammonia: Double): Double {
|
||||
return when {
|
||||
ammonia >= 0.5 -> 1.0
|
||||
ammonia > 0.1 && ammonia < 0.5 -> (ammonia - 0.1) / (0.5 - 0.1)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanKhBaik(kh: Double): Double {
|
||||
return when {
|
||||
kh <= 6 -> 1.0
|
||||
kh > 6 && kh < 8 -> (8 - kh) / (8 - 6)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanKhSedang(kh: Double): Double {
|
||||
return when {
|
||||
kh in 8.0..10.0 -> 1.0
|
||||
kh > 6 && kh < 8 -> (kh - 6) / (8 - 6)
|
||||
kh > 10 && kh < 12 -> (12 - kh) / (12 - 10)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanKhBuruk(kh: Double): Double {
|
||||
return when {
|
||||
kh >= 12 -> 1.0
|
||||
kh > 10 && kh < 12 -> (kh - 10) / (12 - 10)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanGhBaik(gh: Double): Double {
|
||||
return when {
|
||||
gh <= 8 -> 1.0
|
||||
gh > 8 && gh < 12 -> (12 - gh) / (12 - 8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanGhBuruk(gh: Double): Double {
|
||||
return when {
|
||||
gh >= 12 -> 1.0
|
||||
gh > 8 && gh < 12 -> (gh - 8) / (12 - 8)
|
||||
else -> 0.0
|
||||
}
|
||||
}
|
||||
|
||||
// ==============--------------------=================
|
||||
|
||||
private fun fungsiKeanggotaanStatusBaik(inverensi: Double): Double {
|
||||
return when (inverensi) {
|
||||
1.0 -> 40.0
|
||||
in 0.1..0.9 -> (inverensi * 10) + 30
|
||||
else -> 30.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanStatusSedang(inverensi: Double): Double {
|
||||
return when (inverensi) {
|
||||
1.0 -> 30.0
|
||||
in 0.1..0.9 -> (inverensi * 10) + 20
|
||||
else -> 20.0
|
||||
}
|
||||
}
|
||||
|
||||
private fun fungsiKeanggotaanStatusBuruk(inverensi: Double): Double {
|
||||
return when (inverensi) {
|
||||
1.0 -> 20.0
|
||||
in 0.1..0.9 -> 30 - (inverensi * 10)
|
||||
else -> 30.0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.capstone.aquacare.ui
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import com.capstone.aquacare.databinding.ActivityMainBinding
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
private var _binding: ActivityMainBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
_binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
supportActionBar?.hide()
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.capstone.aquacare.ui
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.WindowInsets
|
||||
import android.view.WindowManager
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.ui.auth.AuthActivity
|
||||
|
||||
class SplashScreenActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_splash_screen)
|
||||
supportActionBar?.hide()
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.insetsController?.hide(WindowInsets.Type.statusBars())
|
||||
} else {
|
||||
window.setFlags(
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
)
|
||||
}
|
||||
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
val intent = Intent(this, AuthActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
finish()
|
||||
startActivity(intent)
|
||||
|
||||
}, 3000.toLong())
|
||||
}
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
package com.capstone.aquacare.ui.aquascape
|
||||
|
||||
import android.app.DatePickerDialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.AdapterView
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.AquascapeData
|
||||
import com.capstone.aquacare.databinding.FragmentAddAquascapeBinding
|
||||
import com.google.firebase.database.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
class AddAquascapeFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentAddAquascapeBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
private var selectedStyle: String? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentAddAquascapeBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val aquascapeStyle = listOf("Natural Style", "Dutch Style")
|
||||
val arrayAdapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, aquascapeStyle)
|
||||
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
binding.spinStyle.adapter = arrayAdapter
|
||||
|
||||
binding.spinStyle.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
selectedStyle = parent?.getItemAtPosition(position).toString()
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val myCalendar = Calendar.getInstance()
|
||||
val datePicker = DatePickerDialog.OnDateSetListener { _, year, month, dayOfMonth ->
|
||||
myCalendar.set(Calendar.YEAR, year)
|
||||
myCalendar.set(Calendar.MONTH, month)
|
||||
myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth)
|
||||
updateLable(myCalendar)
|
||||
}
|
||||
|
||||
binding.btnSelectDate.setOnClickListener {
|
||||
DatePickerDialog(requireContext(), datePicker, myCalendar.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)).show()
|
||||
}
|
||||
|
||||
binding.btnSave.setOnClickListener {
|
||||
if (checkForm()){
|
||||
addAquascape()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateLable(myCalendar: Calendar) {
|
||||
val myFormat = "dd-MM-yyyy"
|
||||
val sdf = SimpleDateFormat(myFormat, Locale.UK)
|
||||
binding.tvDateCreate.text = sdf.format(myCalendar.time)
|
||||
}
|
||||
|
||||
private fun checkForm(): Boolean {
|
||||
val email = binding.edtName.text.toString()
|
||||
val date = binding.tvDateCreate.text.toString()
|
||||
|
||||
if (TextUtils.isEmpty(email)) {
|
||||
binding.edtName.error = getString(R.string.please_enter_name)
|
||||
return false
|
||||
}
|
||||
|
||||
if (date == "Select Date" || date == "Pilih Tanggal") {
|
||||
Toast.makeText(activity, getString(R.string.please_enter_date), Toast.LENGTH_SHORT).show()
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun addAquascape() {
|
||||
val name = binding.edtName.text.toString()
|
||||
val style = selectedStyle.toString()
|
||||
val date = binding.tvDateCreate.text.toString()
|
||||
val status = ""
|
||||
val lastCheckDate = ""
|
||||
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val userId = sharedPreferences?.getString("userId", "")
|
||||
|
||||
if (userId.isNullOrEmpty()) {
|
||||
Toast.makeText(activity, "User ID not found", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
|
||||
val aquascapeReference = databaseReference.child(userId).child("aquascapes")
|
||||
val newAquascapeId = aquascapeReference.push().key
|
||||
|
||||
if (newAquascapeId != null) {
|
||||
val newAquascapeData = AquascapeData(newAquascapeId, name, style, date, status, lastCheckDate)
|
||||
aquascapeReference.child(newAquascapeId).setValue(newAquascapeData)
|
||||
.addOnSuccessListener {
|
||||
Toast.makeText(activity, getString(R.string.success_to_add_aquascape), Toast.LENGTH_SHORT).show()
|
||||
findNavController().navigate(R.id.action_addAquascapeFragment_to_homeFragment)
|
||||
}
|
||||
.addOnFailureListener { e ->
|
||||
Toast.makeText(activity, "Failed to add Aquascape: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(activity, "Failed to generate Aquascape ID", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
package com.capstone.aquacare.ui.aquascape
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.AdapterView
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.AquascapeData
|
||||
import com.capstone.aquacare.databinding.FragmentEditAquascapeBinding
|
||||
import com.google.firebase.database.*
|
||||
|
||||
class EditAquascapeFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentEditAquascapeBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
private var selectedStyle: String? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentEditAquascapeBinding.inflate(inflater,container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val aquascapeId = arguments?.getString("aquascapeId").toString()
|
||||
val aquascapeName = arguments?.getString("aquascapeName").toString()
|
||||
val style = arguments?.getString("style").toString()
|
||||
val createDate = arguments?.getString("createDate").toString()
|
||||
|
||||
binding.edtName.setText(aquascapeName)
|
||||
binding.edtDateCreate.setText(createDate)
|
||||
|
||||
val spinner = binding.spinStyle
|
||||
|
||||
val aquascapeStyle = listOf("Natural Style", "Dutch Style")
|
||||
val arrayAdapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, aquascapeStyle)
|
||||
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
spinner.adapter = arrayAdapter
|
||||
|
||||
|
||||
val index = aquascapeStyle.indexOf(style)
|
||||
if (index != -1) {
|
||||
spinner.setSelection(index)
|
||||
}
|
||||
|
||||
selectedStyle = style
|
||||
|
||||
binding.spinStyle.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
selectedStyle = parent?.getItemAtPosition(position).toString()
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
binding.btnSave.setOnClickListener {
|
||||
editAquascape(aquascapeId)
|
||||
}
|
||||
|
||||
binding.btnDelete.setOnClickListener {
|
||||
deleteAquascape(aquascapeId)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun editAquascape(aquascapeId : String) {
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val userId = sharedPreferences?.getString("userId", "").toString()
|
||||
|
||||
val name = binding.edtName.text.toString()
|
||||
val style = selectedStyle.toString()
|
||||
|
||||
val aquascapeReference = databaseReference.child(userId).child("aquascapes")
|
||||
|
||||
aquascapeReference.orderByChild("id").equalTo(aquascapeId).addListenerForSingleValueEvent(object : ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
if (dataSnapshot.exists()) {
|
||||
for (snapshot in dataSnapshot.children) {
|
||||
val aquascapeData = snapshot.getValue(AquascapeData::class.java)
|
||||
if (aquascapeData != null) {
|
||||
|
||||
val createDate = aquascapeData.createDate.toString()
|
||||
|
||||
val updateData = mapOf("name" to name, "style" to style, "createDate" to createDate)
|
||||
|
||||
aquascapeReference.child(aquascapeId).updateChildren(updateData)
|
||||
.addOnSuccessListener {
|
||||
|
||||
Toast.makeText(activity, getString(R.string.success_to_edit_aquascape), Toast.LENGTH_SHORT).show()
|
||||
val bundle = Bundle().apply {
|
||||
putString("aquascapeId", aquascapeId)
|
||||
}
|
||||
findNavController().navigate(R.id.action_editAquascapeFragment_to_historyFragment, bundle)
|
||||
}
|
||||
.addOnFailureListener { e ->
|
||||
Toast.makeText(activity, "Failed to Edit Aquascape: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
Log.d(TAG, "Aquascape ID: ${snapshot.key}, Name: ${aquascapeData.name}, Style: ${aquascapeData.style}, Date: ${aquascapeData.createDate}")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "No aquascape data available")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancelled(error: DatabaseError) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun deleteAquascape(aquascapeId : String) {
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val userId = sharedPreferences?.getString("userId", "").toString()
|
||||
|
||||
val aquascapeReference = databaseReference.child(userId).child("aquascapes")
|
||||
|
||||
aquascapeReference.child(aquascapeId).removeValue().addOnSuccessListener {
|
||||
findNavController().navigate(R.id.action_editAquascapeFragment_to_homeFragment)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "MainActivity"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.capstone.aquacare.ui.auth
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.databinding.ActivityAuthBinding
|
||||
|
||||
class AuthActivity : AppCompatActivity() {
|
||||
|
||||
private var _binding: ActivityAuthBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
_binding = ActivityAuthBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
supportActionBar?.hide()
|
||||
|
||||
val fragmentManager = supportFragmentManager
|
||||
val signInFragment = SignInFragment()
|
||||
val fragment = fragmentManager.findFragmentByTag(SignInFragment::class.java.simpleName)
|
||||
|
||||
if (fragment !is SignInFragment) {
|
||||
Log.d(TAG, "Fragment Name :" + SignInFragment::class.java.simpleName)
|
||||
fragmentManager
|
||||
.beginTransaction()
|
||||
.add(R.id.auth_frame_container, signInFragment, SignInFragment::class.java.simpleName)
|
||||
.commit()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AuthActivity"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,341 @@
|
|||
package com.capstone.aquacare.ui.auth
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import com.capstone.aquacare.ui.MainActivity
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.UserData
|
||||
import com.capstone.aquacare.databinding.FragmentSignInBinding
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignIn
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
|
||||
import com.google.android.gms.common.api.ApiException
|
||||
import com.google.firebase.auth.FirebaseAuth
|
||||
import com.google.firebase.auth.GoogleAuthProvider
|
||||
import com.google.firebase.database.*
|
||||
|
||||
class SignInFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentSignInBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var auth: FirebaseAuth
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
auth = FirebaseAuth.getInstance()
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
checkUserLoginStatus()
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentSignInBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.apply {
|
||||
btnLogin.setOnClickListener {
|
||||
if (checkForm()) {
|
||||
val email = binding.edtEmail.text.toString()
|
||||
val password = binding.edtPassword.text.toString()
|
||||
|
||||
// signInUser(email, password)
|
||||
signInAuth(email, password)
|
||||
}
|
||||
}
|
||||
|
||||
tvSignup.setOnClickListener{
|
||||
val signUpFragment = SignUpFragment()
|
||||
val fragmentManager = parentFragmentManager
|
||||
fragmentManager.beginTransaction().apply {
|
||||
replace(
|
||||
R.id.auth_frame_container,
|
||||
signUpFragment,
|
||||
SignUpFragment::class.java.simpleName
|
||||
)
|
||||
addToBackStack(null)
|
||||
commit()
|
||||
}
|
||||
}
|
||||
|
||||
btnLoginGoogle.setOnClickListener{
|
||||
signInGoogle()
|
||||
}
|
||||
|
||||
tvForgotPassword.setOnClickListener{
|
||||
val email = binding.edtEmail.text.toString()
|
||||
if (email.isEmpty()) {
|
||||
Toast.makeText(activity, getString(R.string.please_enter_email), Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
forgotPassword(email)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun checkForm(): Boolean {
|
||||
val email = binding.edtEmail.text.toString()
|
||||
val password = binding.edtPassword.text.toString()
|
||||
|
||||
if (TextUtils.isEmpty(email)) {
|
||||
binding.edtEmail.error = getString(R.string.please_enter_email)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(password)) {
|
||||
binding.edtPassword.error = getString(R.string.please_enter_password)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun signInAuth(email: String, password: String) {
|
||||
|
||||
auth.signInWithEmailAndPassword(email, password)
|
||||
.addOnCompleteListener(requireActivity()) { task ->
|
||||
if (task.isSuccessful) {
|
||||
// Sign in success, update UI with the signed-in user's information
|
||||
Log.d(TAG, "signInWithEmail:success")
|
||||
Toast.makeText(activity, "Login Success", Toast.LENGTH_SHORT).show()
|
||||
val user = auth.currentUser
|
||||
// val id = user?.uid.toString()
|
||||
val name = user?.displayName.toString()
|
||||
// val email = user?.email.toString()
|
||||
val photo = ""
|
||||
|
||||
val userType = "user"
|
||||
|
||||
val accountType = "Regular Account"
|
||||
|
||||
databaseReference.orderByChild("email").equalTo(email).addListenerForSingleValueEvent(object : ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
if (!dataSnapshot.exists()) {
|
||||
val id = databaseReference.push().key
|
||||
val userData = UserData(id, name, email, accountType, userType)
|
||||
databaseReference.child(id!!).setValue(userData)
|
||||
|
||||
saveLoginSession(id, name, email, photo, userType, accountType)
|
||||
|
||||
Toast.makeText(activity, getString(R.string.login_success), Toast.LENGTH_SHORT).show()
|
||||
startActivity(Intent(activity, MainActivity::class.java))
|
||||
requireActivity().finish()
|
||||
} else {
|
||||
for (userSnapshot in dataSnapshot.children) {
|
||||
val userData = userSnapshot.getValue(UserData::class.java)
|
||||
|
||||
val id = userData?.id.toString()
|
||||
val name = userData?.name.toString()
|
||||
val email = userData?.email.toString()
|
||||
val userType = userData?.userType.toString()
|
||||
|
||||
saveLoginSession(id, name, email, photo, userType, accountType)
|
||||
|
||||
Toast.makeText(activity, getString(R.string.login_success), Toast.LENGTH_SHORT).show()
|
||||
startActivity(Intent(activity, MainActivity::class.java))
|
||||
requireActivity().finish()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancelled(databaseError: DatabaseError) {
|
||||
Toast.makeText(activity, "Database Error: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// If sign in fails, display a message to the user.
|
||||
Log.w(TAG, "signInWithEmail:failure", task.exception)
|
||||
Toast.makeText(
|
||||
activity,
|
||||
"Authentication failed.",
|
||||
Toast.LENGTH_SHORT,
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// private fun signInUser(email: String, password: String) {
|
||||
// databaseReference.orderByChild("email").equalTo(email).addListenerForSingleValueEvent(object : ValueEventListener {
|
||||
// override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
// if (dataSnapshot.exists()) {
|
||||
// for (userSnapshot in dataSnapshot.children) {
|
||||
// val userData = userSnapshot.getValue(UserData::class.java)
|
||||
//
|
||||
// if (userData != null && userData.accountType == password){
|
||||
// val id = userData.id.toString()
|
||||
// val name = userData.name.toString()
|
||||
// val email = userData.email.toString()
|
||||
// val userType = userData.userType.toString()
|
||||
// val accountType = userData.accountType.toString()
|
||||
// val photo = ""
|
||||
//
|
||||
// saveLoginSession(id, name, email, photo, userType, accountType)
|
||||
//
|
||||
// Toast.makeText(activity, getString(R.string.login_success), Toast.LENGTH_SHORT).show()
|
||||
// startActivity(Intent(activity, MainActivity::class.java))
|
||||
// requireActivity().finish()
|
||||
// } else {
|
||||
// Toast.makeText(activity, getString(R.string.wrong_password), Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// Toast.makeText(activity, getString(R.string.account_not_found), Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onCancelled(databaseError: DatabaseError) {
|
||||
// Toast.makeText(activity, "Database Error: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
private fun signInGoogle() {
|
||||
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
|
||||
.requestIdToken(getString(R.string.defaultweb_client_id))
|
||||
.requestEmail()
|
||||
.build()
|
||||
|
||||
val googleSignInClient = GoogleSignIn.getClient(requireActivity(), gso)
|
||||
val signInIntent = googleSignInClient.signInIntent
|
||||
startActivityForResult(signInIntent, RC_SIGN_IN)
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
||||
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
|
||||
if (requestCode == RC_SIGN_IN) {
|
||||
val task = GoogleSignIn.getSignedInAccountFromIntent(data)
|
||||
try {
|
||||
// Google Sign In was successful, authenticate with Firebase
|
||||
val account = task.getResult(ApiException::class.java)!!
|
||||
Log.d(TAG, "firebaseAuthWithGoogle:" + account.id)
|
||||
firebaseAuthWithGoogle(account.idToken!!)
|
||||
} catch (e: ApiException) {
|
||||
// Google Sign In failed, update UI appropriately
|
||||
Log.w(TAG, "Google sign in failed", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun firebaseAuthWithGoogle(idToken: String) {
|
||||
val credential = GoogleAuthProvider.getCredential(idToken, null)
|
||||
auth.signInWithCredential(credential)
|
||||
.addOnCompleteListener(requireActivity()) { task ->
|
||||
if (task.isSuccessful) {
|
||||
// Sign in success, update UI with the signed-in user's information
|
||||
Log.d(TAG, "signInWithCredential:success")
|
||||
val user = auth.currentUser
|
||||
val name = user?.displayName.toString()
|
||||
val email = user?.email.toString()
|
||||
val photo = user?.photoUrl.toString()
|
||||
val userType = "user"
|
||||
|
||||
val accountType = "Google Account"
|
||||
|
||||
databaseReference.orderByChild("email").equalTo(email).addListenerForSingleValueEvent(object : ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
if (!dataSnapshot.exists()) {
|
||||
val id = databaseReference.push().key
|
||||
val userData = UserData(id, name, email, accountType, userType)
|
||||
databaseReference.child(id!!).setValue(userData)
|
||||
|
||||
saveLoginSession(id, name, email, photo, userType, accountType)
|
||||
|
||||
Toast.makeText(activity, getString(R.string.login_success), Toast.LENGTH_SHORT).show()
|
||||
startActivity(Intent(activity, MainActivity::class.java))
|
||||
requireActivity().finish()
|
||||
} else {
|
||||
for (userSnapshot in dataSnapshot.children) {
|
||||
val userData = userSnapshot.getValue(UserData::class.java)
|
||||
|
||||
val id = userData?.id.toString()
|
||||
val name = userData?.name.toString()
|
||||
val email = userData?.email.toString()
|
||||
val userType = userData?.userType.toString()
|
||||
|
||||
saveLoginSession(id, name, email, photo, userType, accountType)
|
||||
|
||||
Toast.makeText(activity, getString(R.string.login_success), Toast.LENGTH_SHORT).show()
|
||||
startActivity(Intent(activity, MainActivity::class.java))
|
||||
requireActivity().finish()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancelled(databaseError: DatabaseError) {
|
||||
Toast.makeText(activity, "Database Error: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
// If sign in fails, display a message to the user.
|
||||
Log.w(TAG, "signInWithCredential:failure", task.exception)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun forgotPassword(email: String) {
|
||||
auth.sendPasswordResetEmail(email).addOnCompleteListener { task ->
|
||||
if (task.isSuccessful) {
|
||||
Toast.makeText(activity, "Reset password email sent.", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
Toast.makeText(activity, "Error: ${task.exception?.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun saveLoginSession(userId: String, name: String, email: String, photo: String, userType: String, accountType: String) {
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val editor = sharedPreferences?.edit()
|
||||
editor?.putString("userId", userId)
|
||||
editor?.putString("name", name)
|
||||
editor?.putString("email", email)
|
||||
editor?.putString("photo", photo)
|
||||
editor?.putString("userType", userType)
|
||||
editor?.putString("accountType", accountType)
|
||||
editor?.apply()
|
||||
}
|
||||
|
||||
private fun checkUserLoginStatus() {
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val id = sharedPreferences?.getString("userId", "")
|
||||
if (id != "") {
|
||||
startActivity(Intent(activity, MainActivity::class.java))
|
||||
requireActivity().finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "AuthActivity"
|
||||
private const val RC_SIGN_IN = 9001
|
||||
}
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
package com.capstone.aquacare.ui.auth
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.util.Patterns
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.UserData
|
||||
import com.capstone.aquacare.databinding.FragmentSignUpBinding
|
||||
import com.google.firebase.auth.FirebaseAuth
|
||||
import com.google.firebase.database.*
|
||||
|
||||
class SignUpFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentSignUpBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var auth: FirebaseAuth
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
auth = FirebaseAuth.getInstance()
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentSignUpBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.btnSignup.setOnClickListener {
|
||||
if (checkForm()) {
|
||||
val name = binding.edtName.text.toString()
|
||||
val email = binding.edtEmail.text.toString()
|
||||
val password = binding.edtPassword.text.toString()
|
||||
|
||||
// signUpUser(name, email, password)
|
||||
signUpAuth(name, email, password)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkForm(): Boolean {
|
||||
val name = binding.edtName.text.toString()
|
||||
val email = binding.edtEmail.text.toString()
|
||||
val password = binding.edtPassword.text.toString()
|
||||
val confirmPassword = binding.edtConfirmPassword.text.toString()
|
||||
|
||||
if (TextUtils.isEmpty(name)) {
|
||||
binding.edtName.error = getString(R.string.please_enter_name)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(email)) {
|
||||
binding.edtEmail.error = getString(R.string.please_enter_email)
|
||||
return false
|
||||
}
|
||||
|
||||
if (!validEmail()) {
|
||||
binding.edtEmail.error = "Invalid Email"
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(password)) {
|
||||
binding.edtPassword.error = getString(R.string.please_enter_password)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(confirmPassword)) {
|
||||
binding.edtConfirmPassword.error = getString(R.string.please_enter_confirm_password)
|
||||
return false
|
||||
}
|
||||
|
||||
if (password != confirmPassword) {
|
||||
binding.edtConfirmPassword.error = getString(R.string.confirm_password_wrong)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun signUpAuth(name: String, email: String, password: String) {
|
||||
|
||||
auth.createUserWithEmailAndPassword(email, password)
|
||||
.addOnCompleteListener(requireActivity()) { task ->
|
||||
if (task.isSuccessful) {
|
||||
// Sign in success, update UI with the signed-in user's information
|
||||
Log.d(TAG, "createUserWithEmail:success")
|
||||
// val user = auth.currentUser
|
||||
val userType = "user"
|
||||
val accountType = "Regular Account"
|
||||
|
||||
databaseReference.orderByChild("email").equalTo(email).addListenerForSingleValueEvent(object : ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
if (!dataSnapshot.exists()) {
|
||||
val id = databaseReference.push().key
|
||||
val userData = UserData(id, name, email, accountType, userType)
|
||||
databaseReference.child(id!!).setValue(userData)
|
||||
|
||||
Toast.makeText(activity, getString(R.string.account_created), Toast.LENGTH_SHORT).show()
|
||||
val fragmentManager = parentFragmentManager
|
||||
fragmentManager.popBackStack()
|
||||
} else {
|
||||
// Toast.makeText(activity, getString(R.string.account_already_exists), Toast.LENGTH_SHORT).show()
|
||||
val fragmentManager = parentFragmentManager
|
||||
fragmentManager.popBackStack()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancelled(databaseError: DatabaseError) {
|
||||
Toast.makeText(activity, "Database Error: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
// If sign in fails, display a message to the user.
|
||||
Log.w(TAG, "createUserWithEmail:failure", task.exception)
|
||||
Toast.makeText(
|
||||
activity,
|
||||
"Authentication failed.",
|
||||
Toast.LENGTH_SHORT,
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private fun signUpUser(name: String, email: String, password: String) {
|
||||
// val userType = "user"
|
||||
// databaseReference.orderByChild("email").equalTo(email).addListenerForSingleValueEvent(object : ValueEventListener {
|
||||
// override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
// if (!dataSnapshot.exists()) {
|
||||
// val id = databaseReference.push().key
|
||||
// val userData = UserData(id, name, email, password, userType)
|
||||
// databaseReference.child(id!!).setValue(userData)
|
||||
//
|
||||
// Toast.makeText(activity, getString(R.string.account_created), Toast.LENGTH_SHORT).show()
|
||||
// val fragmentManager = parentFragmentManager
|
||||
// fragmentManager.popBackStack()
|
||||
// } else {
|
||||
// for (userSnapshot in dataSnapshot.children) {
|
||||
// val userData = userSnapshot.getValue(UserData::class.java)
|
||||
// val userId = userData?.id.toString()
|
||||
// val userName = userData?.name.toString()
|
||||
//
|
||||
// if (userData != null && userData.accountType == "Google Account") {
|
||||
// val newDataUser = mapOf("name" to userName, "password" to password)
|
||||
// databaseReference.child(userId).updateChildren(newDataUser)
|
||||
//
|
||||
// Toast.makeText(activity, getString(R.string.account_created), Toast.LENGTH_SHORT).show()
|
||||
// val fragmentManager = parentFragmentManager
|
||||
// fragmentManager.popBackStack()
|
||||
// } else {
|
||||
// Toast.makeText(activity, getString(R.string.account_already_exists), Toast.LENGTH_SHORT).show()
|
||||
// val fragmentManager = parentFragmentManager
|
||||
// fragmentManager.popBackStack()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onCancelled(databaseError: DatabaseError) {
|
||||
// Toast.makeText(activity, "Database Error: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
private fun validEmail(): Boolean {
|
||||
val email = binding.edtEmail.text.toString()
|
||||
if(!Patterns.EMAIL_ADDRESS.matcher(email).matches())
|
||||
{
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AuthActivity"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.capstone.aquacare.ui.home
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.capstone.aquacare.data.AquascapeData
|
||||
import com.capstone.aquacare.databinding.CardAquascapeBinding
|
||||
|
||||
class AquascapeAdapter (private val list: List<AquascapeData>) : RecyclerView.Adapter<AquascapeAdapter.ViewHolder>() {
|
||||
|
||||
private lateinit var onItemClickCallback: OnItemClickCallback
|
||||
|
||||
fun setOnItemClickCallBack(onItemClickCallback: OnItemClickCallback) {
|
||||
this.onItemClickCallback = onItemClickCallback
|
||||
}
|
||||
|
||||
interface OnItemClickCallback {
|
||||
fun onItemClicked(data: AquascapeData)
|
||||
}
|
||||
|
||||
class ViewHolder(var binding: CardAquascapeBinding) : RecyclerView.ViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = CardAquascapeBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return ViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = list.size
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val currentAquascape = list[position]
|
||||
|
||||
holder.binding.tvAquascapeName.text = currentAquascape.name
|
||||
holder.binding.tvStatusAquascape.text = currentAquascape.status
|
||||
holder.binding.tvDate.text = currentAquascape.lastCheckDate
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
onItemClickCallback.onItemClicked(list[holder.adapterPosition])
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.capstone.aquacare.ui.home
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.capstone.aquacare.data.ArticleData
|
||||
import com.capstone.aquacare.databinding.CardArticleBinding
|
||||
|
||||
class ArticleAdapter (private val list: List<ArticleData>) : RecyclerView.Adapter<ArticleAdapter.ViewHolder>() {
|
||||
|
||||
private lateinit var onItemClickCallback: OnItemClickCallback
|
||||
|
||||
fun setOnItemClickCallBack(onItemClickCallback: OnItemClickCallback) {
|
||||
this.onItemClickCallback = onItemClickCallback
|
||||
}
|
||||
|
||||
interface OnItemClickCallback {
|
||||
fun onItemClicked(data: ArticleData)
|
||||
}
|
||||
|
||||
class ViewHolder(var binding: CardArticleBinding) : RecyclerView.ViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = CardArticleBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return ViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = list.size
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val currentAquascapeInfo = list[position]
|
||||
holder.binding.tvTitle.text = currentAquascapeInfo.title
|
||||
if (!currentAquascapeInfo.image.isNullOrEmpty()) {
|
||||
Glide.with(holder.itemView.context)
|
||||
.load(currentAquascapeInfo.image)
|
||||
.into(holder.binding.ivImage)
|
||||
}
|
||||
|
||||
holder.binding.tvType.text = currentAquascapeInfo.type
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
onItemClickCallback.onItemClicked(list[holder.adapterPosition])
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package com.capstone.aquacare.ui.home
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.AquascapeData
|
||||
import com.capstone.aquacare.data.ArticleData
|
||||
import com.capstone.aquacare.databinding.FragmentHomeBinding
|
||||
import com.google.android.play.integrity.internal.l
|
||||
import com.google.firebase.database.*
|
||||
|
||||
class HomeFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentHomeBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
private lateinit var databaseInfoReference: DatabaseReference
|
||||
|
||||
val list = mutableListOf<AquascapeData>()
|
||||
val listInfo = mutableListOf<ArticleData>()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
databaseInfoReference = firebaseDatabase.reference.child("article")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val name = sharedPreferences?.getString("name", "")
|
||||
val userId = sharedPreferences?.getString("userId", "").toString()
|
||||
val hello = getString(R.string.hello)
|
||||
binding.tvName.text = "$hello, $name"
|
||||
|
||||
val rvAquascape = binding.rvListAquascape
|
||||
val rvAquascapeInfo = binding.rvAquascapeInfo
|
||||
|
||||
val layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, true)
|
||||
layoutManager.stackFromEnd = true
|
||||
|
||||
rvAquascape.layoutManager = layoutManager
|
||||
rvAquascape.setHasFixedSize(true)
|
||||
|
||||
val layoutManager2 = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, true)
|
||||
layoutManager2.stackFromEnd = true
|
||||
|
||||
rvAquascapeInfo.layoutManager = layoutManager2
|
||||
rvAquascapeInfo.setHasFixedSize(true)
|
||||
|
||||
binding.ivProfile.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_homeFragment_to_settingFragment)
|
||||
}
|
||||
|
||||
binding.tvAdd.setOnClickListener{
|
||||
findNavController().navigate(R.id.action_homeFragment_to_addAquascapeFragment)
|
||||
}
|
||||
|
||||
getAquascapeData(userId)
|
||||
getAquascapeInfoData()
|
||||
}
|
||||
|
||||
private fun getAquascapeData(userId: String) {
|
||||
binding.pbAquascape.visibility = View.VISIBLE
|
||||
binding.rvListAquascape.visibility = View.GONE
|
||||
|
||||
val aquascapeReference = databaseReference.child(userId).child("aquascapes")
|
||||
|
||||
aquascapeReference.addValueEventListener(object : ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
list.clear()
|
||||
for (snapshot in dataSnapshot.children) {
|
||||
val dataAquascape = snapshot.getValue(AquascapeData::class.java)
|
||||
if (dataAquascape != null) {
|
||||
list.add(dataAquascape)
|
||||
}
|
||||
}
|
||||
binding.pbAquascape.visibility = View.GONE
|
||||
binding.rvListAquascape.visibility = View.VISIBLE
|
||||
showAquascape()
|
||||
}
|
||||
|
||||
override fun onCancelled(databaseError: DatabaseError) {
|
||||
Toast.makeText(requireContext(), "Failed to retrieve aquascape data: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun getAquascapeInfoData() {
|
||||
binding.pbArticle.visibility = View.VISIBLE
|
||||
binding.rvAquascapeInfo.visibility = View.GONE
|
||||
|
||||
databaseInfoReference.addValueEventListener(object : ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
listInfo.clear()
|
||||
for (snapshot in dataSnapshot.children) {
|
||||
val dataAquascapeInfo = snapshot.getValue(ArticleData::class.java)
|
||||
if (dataAquascapeInfo != null) {
|
||||
listInfo.add(dataAquascapeInfo)
|
||||
}
|
||||
}
|
||||
|
||||
binding.rvAquascapeInfo.visibility = View.VISIBLE
|
||||
binding.pbArticle.visibility = View.GONE
|
||||
showArticle()
|
||||
}
|
||||
|
||||
override fun onCancelled(databaseError: DatabaseError) {
|
||||
Toast.makeText(requireContext(), "Failed to retrieve aquascape info data: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun showAquascape() {
|
||||
val adapter = AquascapeAdapter(list)
|
||||
binding.rvListAquascape.adapter = adapter
|
||||
Log.d("DataList", "Jumlah data dalam list aquascape: ${list.size}")
|
||||
|
||||
adapter.setOnItemClickCallBack(object : AquascapeAdapter.OnItemClickCallback{
|
||||
override fun onItemClicked(data: AquascapeData) {
|
||||
|
||||
val aquascapeId = data.id
|
||||
|
||||
val bundle = Bundle().apply {
|
||||
putString("aquascapeId", aquascapeId)
|
||||
}
|
||||
|
||||
findNavController().navigate(R.id.action_homeFragment_to_historyFragment, bundle)
|
||||
|
||||
// val identificationHistoryFragment = IdentificationHistoryFragment()
|
||||
// identificationHistoryFragment.arguments = bundle
|
||||
// val fragmentManager = parentFragmentManager
|
||||
// fragmentManager.beginTransaction().apply {
|
||||
// replace(
|
||||
// R.id.main_frame_container,
|
||||
// identificationHistoryFragment,
|
||||
// IdentificationHistoryFragment::class.java.simpleName
|
||||
// )
|
||||
// addToBackStack(null)
|
||||
// commit()
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun showArticle() {
|
||||
val adapter = ArticleAdapter(listInfo)
|
||||
binding.rvAquascapeInfo.adapter = adapter
|
||||
Log.d("DataList", "Jumlah data dalam list aquascape info: ${listInfo.size}")
|
||||
|
||||
adapter.setOnItemClickCallBack(object : ArticleAdapter.OnItemClickCallback{
|
||||
override fun onItemClicked(data: ArticleData) {
|
||||
|
||||
val infoId = data.id
|
||||
val title = data.title
|
||||
val image = data.image
|
||||
val body = data.body
|
||||
val link = data.link
|
||||
val edit = "false"
|
||||
|
||||
val bundle = Bundle().apply {
|
||||
putString("infoId", infoId)
|
||||
putString("title", title)
|
||||
putString("image", image)
|
||||
putString("body", body)
|
||||
putString("link", link)
|
||||
putString("edit", edit)
|
||||
}
|
||||
|
||||
findNavController().navigate(R.id.action_homeFragment_to_AquascapeInfoFragment, bundle)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,217 @@
|
|||
package com.capstone.aquacare.ui.identification
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.AquascapeData
|
||||
import com.capstone.aquacare.data.IdentificationData
|
||||
import com.capstone.aquacare.databinding.FragmentIdentificationBinding
|
||||
import com.capstone.aquacare.fuzzy.FuzzyDutchStyle
|
||||
import com.capstone.aquacare.fuzzy.FuzzyIdentification
|
||||
import com.capstone.aquacare.fuzzy.FuzzyNaturalStyle
|
||||
import com.google.firebase.database.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
class IdentificationFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentIdentificationBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
private var aquascapeId: String? = null
|
||||
private var aquascapeName: String? = null
|
||||
private var style: String? = null
|
||||
private var result: String? = null
|
||||
private var currentDate: String? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentIdentificationBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
aquascapeId = arguments?.getString("aquascapeId").toString()
|
||||
aquascapeName = arguments?.getString("aquascapeName").toString()
|
||||
style = arguments?.getString("style").toString()
|
||||
|
||||
binding.tvName.text = aquascapeName
|
||||
|
||||
binding.btnIdentified.setOnClickListener {
|
||||
if (checkForm()) {
|
||||
addIdentification(aquascapeId!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkForm(): Boolean {
|
||||
val temperature = binding.edtTemperature.text.toString()
|
||||
val ph = binding.edtPh.text.toString()
|
||||
val ammonia = binding.edtAmmonia.text.toString()
|
||||
val kh = binding.edtKh.text.toString()
|
||||
val gh = binding.edtGh.text.toString()
|
||||
|
||||
if (temperature.isEmpty()) {
|
||||
binding.edtTemperature.error = getString(R.string.enter_temperature)
|
||||
return false
|
||||
}
|
||||
|
||||
if (ph.isEmpty()) {
|
||||
binding.edtPh.error = getString(R.string.enter_ph)
|
||||
return false
|
||||
}
|
||||
|
||||
if (ammonia.isEmpty()) {
|
||||
binding.edtAmmonia.error = getString(R.string.enter_ammonia)
|
||||
return false
|
||||
}
|
||||
|
||||
if (kh.isEmpty()) {
|
||||
binding.edtKh.error = getString(R.string.enter_kh)
|
||||
return false
|
||||
}
|
||||
|
||||
if (gh.isEmpty()) {
|
||||
binding.edtGh.error = getString(R.string.enter_gh)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun addIdentification(aquascapeId: String) {
|
||||
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val userId = sharedPreferences?.getString("userId", "")
|
||||
|
||||
currentDate = getCurrentDate()
|
||||
val temperature = binding.edtTemperature.text.toString().toDoubleOrNull() ?: 0.0
|
||||
val ph = binding.edtPh.text.toString().toDoubleOrNull() ?: 0.0
|
||||
val ammonia = binding.edtAmmonia.text.toString().toDoubleOrNull() ?: 0.0
|
||||
val kh = binding.edtKh.text.toString().toDoubleOrNull() ?: 0.0
|
||||
val gh = binding.edtGh.text.toString().toDoubleOrNull() ?: 0.0
|
||||
|
||||
// val fuzzyDutchStyle = FuzzyDutchStyle(requireContext())
|
||||
// val fuzzyNaturalStyle = FuzzyNaturalStyle(requireContext())
|
||||
//
|
||||
// result = if (style == "Dutch Style") {
|
||||
// fuzzyDutchStyle.calculateWaterQuality(temperature, ph, ammonia, kh, gh)
|
||||
// } else {
|
||||
// fuzzyNaturalStyle.calculateWaterQuality(temperature, ph, ammonia, kh, gh)
|
||||
// }
|
||||
|
||||
val fuzzyIdentification = FuzzyIdentification(requireContext(), style.toString())
|
||||
|
||||
result = fuzzyIdentification.calculateWaterQuality(temperature, ph, ammonia, kh, gh)
|
||||
|
||||
if (aquascapeId.isEmpty()) {
|
||||
Toast.makeText(activity, "Aquascape ID not found", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
|
||||
if (userId.isNullOrEmpty()) {
|
||||
Toast.makeText(activity, "User ID not found", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
|
||||
val identificationReference = databaseReference.child(userId).child("aquascapes").child(aquascapeId).child("identification")
|
||||
val newIdentificationId = identificationReference.push().key
|
||||
|
||||
if (newIdentificationId != null) {
|
||||
val newIdentificationData = IdentificationData(newIdentificationId, result, currentDate,
|
||||
temperature.toString(), ph.toString(), ammonia.toString(), kh.toString(), gh.toString())
|
||||
identificationReference.child(newIdentificationId).setValue(newIdentificationData)
|
||||
.addOnSuccessListener {
|
||||
updateAquascapeData(userId, aquascapeId)
|
||||
|
||||
val bundle = Bundle().apply {
|
||||
putString("aquascapeId", aquascapeId)
|
||||
putString("style", style)
|
||||
putString("result", result)
|
||||
putString("date", currentDate)
|
||||
putString("temperature", temperature.toString())
|
||||
putString("ph", ph.toString())
|
||||
putString("ammonia", ammonia.toString())
|
||||
putString("kh", kh.toString())
|
||||
putString("gh", gh.toString())
|
||||
}
|
||||
findNavController().navigate(R.id.action_identificationFragment_to_resultFragment, bundle)
|
||||
|
||||
// Toast.makeText(activity, getString(R.string.successful_identification), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
.addOnFailureListener { e ->
|
||||
Toast.makeText(activity, "Failed to Identification Water Quality: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(activity, "Failed to generate Identification ID", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun updateAquascapeData(userId: String, aquascapeId: String) {
|
||||
val aquascapeReference = databaseReference.child(userId).child("aquascapes")
|
||||
aquascapeReference.orderByChild("id").equalTo(aquascapeId).addListenerForSingleValueEvent(object :
|
||||
ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
if (dataSnapshot.exists()) {
|
||||
for (snapshot in dataSnapshot.children) {
|
||||
val aquascapeData = snapshot.getValue(AquascapeData::class.java)
|
||||
if (aquascapeData != null) {
|
||||
|
||||
val updateData = mapOf("status" to result, "lastCheckDate" to currentDate)
|
||||
|
||||
aquascapeReference.child(aquascapeId).updateChildren(updateData)
|
||||
.addOnSuccessListener {
|
||||
Toast.makeText(activity, getString(R.string.successful_identification), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
.addOnFailureListener { e ->
|
||||
Toast.makeText(activity, "Failed to Identification Water Quality: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
Log.d(TAG, "Aquascape ID: ${snapshot.key}, Name: ${aquascapeData.name}, Style: ${aquascapeData.style}, Date: ${aquascapeData.createDate}")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "No aquascape data available")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancelled(error: DatabaseError) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun getCurrentDate(): String {
|
||||
val calendar = Calendar.getInstance()
|
||||
val dateFormat = SimpleDateFormat("dd-MM-yyyy")
|
||||
return dateFormat.format(calendar.time)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "MainActivity"
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.capstone.aquacare.ui.identification
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.IdentificationData
|
||||
import com.capstone.aquacare.databinding.CardIdentificationHistoryBinding
|
||||
|
||||
class IdentificationHistoryAdapter (private val list: List<IdentificationData>) : RecyclerView.Adapter<IdentificationHistoryAdapter.ViewHolder>() {
|
||||
|
||||
private lateinit var onItemClickCallback: OnItemClickCallback
|
||||
|
||||
fun setOnItemClickCallBack(onItemClickCallback: OnItemClickCallback) {
|
||||
this.onItemClickCallback = onItemClickCallback
|
||||
}
|
||||
|
||||
interface OnItemClickCallback {
|
||||
fun onItemClicked(data: IdentificationData)
|
||||
}
|
||||
|
||||
class ViewHolder(var binding: CardIdentificationHistoryBinding) : RecyclerView.ViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = CardIdentificationHistoryBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return ViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = list.size
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val currentIdentification = list[position]
|
||||
holder.binding.tvStatusAquascape.text = currentIdentification.result
|
||||
holder.binding.tvDate.text = currentIdentification.date
|
||||
|
||||
when (currentIdentification.result) {
|
||||
"Good", "Baik" -> {
|
||||
holder.binding.tvStatusAquascape.setBackgroundResource(R.drawable.bg_border_rounded_green)
|
||||
}
|
||||
"Medium", "Sedang" -> {
|
||||
holder.binding.tvStatusAquascape.setBackgroundResource(R.drawable.bg_border_rounded_blue)
|
||||
}
|
||||
else -> {
|
||||
holder.binding.tvStatusAquascape.setBackgroundResource(R.drawable.bg_border_rounded_red)
|
||||
}
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
onItemClickCallback.onItemClicked(list[holder.adapterPosition])
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
package com.capstone.aquacare.ui.identification
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.AquascapeData
|
||||
import com.capstone.aquacare.data.IdentificationData
|
||||
import com.capstone.aquacare.databinding.FragmentIdentificationHistoryBinding
|
||||
import com.google.firebase.database.*
|
||||
|
||||
class IdentificationHistoryFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentIdentificationHistoryBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
val list = mutableListOf<IdentificationData>()
|
||||
|
||||
private var aquascapeId: String? = null
|
||||
private var aquascapeName: String? = null
|
||||
private var style: String? = null
|
||||
private var createDate: String? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentIdentificationHistoryBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val userId = sharedPreferences?.getString("userId", "").toString()
|
||||
|
||||
aquascapeId = arguments?.getString("aquascapeId")
|
||||
|
||||
val rvIdentification = binding.rvListIdentification
|
||||
|
||||
val layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, true)
|
||||
layoutManager.stackFromEnd = true
|
||||
|
||||
rvIdentification.layoutManager = layoutManager
|
||||
rvIdentification.setHasFixedSize(true)
|
||||
|
||||
binding.btnAddIdentification.setOnClickListener {
|
||||
val bundle = Bundle().apply {
|
||||
putString("aquascapeId", aquascapeId)
|
||||
putString("aquascapeName", aquascapeName)
|
||||
putString("style", style)
|
||||
}
|
||||
findNavController().navigate(R.id.action_historyFragment_to_identificationFragment, bundle)
|
||||
}
|
||||
|
||||
binding.tvEdit.setOnClickListener {
|
||||
val bundleEdit = Bundle().apply {
|
||||
putString("aquascapeId", aquascapeId)
|
||||
putString("aquascapeName", aquascapeName)
|
||||
putString("style", style)
|
||||
putString("createDate", createDate)
|
||||
}
|
||||
findNavController().navigate(R.id.action_historyFragment_to_editAquascapeFragment, bundleEdit)
|
||||
}
|
||||
|
||||
getUpdateData(userId, aquascapeId!!)
|
||||
getIdentificationData(userId, aquascapeId!!)
|
||||
}
|
||||
|
||||
private fun getUpdateData(userId: String, aquascapeId : String) {
|
||||
val aquascapeReference = databaseReference.child(userId).child("aquascapes")
|
||||
|
||||
aquascapeReference.orderByChild("id").equalTo(aquascapeId).addListenerForSingleValueEvent(object : ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
if (dataSnapshot.exists()) {
|
||||
for (snapshot in dataSnapshot.children) {
|
||||
val aquascapeData = snapshot.getValue(AquascapeData::class.java)
|
||||
if (aquascapeData != null) {
|
||||
|
||||
aquascapeName = aquascapeData.name
|
||||
style = aquascapeData.style
|
||||
createDate = aquascapeData.createDate
|
||||
binding.tvName.text = aquascapeName
|
||||
|
||||
Log.d("Aquascape", "Aquascape ID: ${snapshot.key}, Name: ${aquascapeData.name}, Style: ${aquascapeData.style}, Date: ${aquascapeData.createDate}")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("Aquascape", "No aquascape data available")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancelled(error: DatabaseError) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun getIdentificationData(userId : String, aquascapeId : String) {
|
||||
binding.pbHistory.visibility = View.VISIBLE
|
||||
|
||||
if (aquascapeId.isEmpty()) {
|
||||
Toast.makeText(activity, "Aquascape ID not found", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
|
||||
if (userId.isEmpty()) {
|
||||
Toast.makeText(activity, "User ID not found", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
|
||||
val identificationReference = databaseReference.child(userId).child("aquascapes").child(aquascapeId).child("identification")
|
||||
|
||||
identificationReference.addValueEventListener(object : ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
list.clear()
|
||||
for (snapshot in dataSnapshot.children) {
|
||||
val dataIdentification = snapshot.getValue(IdentificationData::class.java)
|
||||
if (dataIdentification != null) {
|
||||
list.add(dataIdentification)
|
||||
}
|
||||
}
|
||||
binding.pbHistory.visibility = View.GONE
|
||||
showIdentification()
|
||||
}
|
||||
|
||||
override fun onCancelled(databaseError: DatabaseError) {
|
||||
Toast.makeText(requireContext(), "Failed to retrieve aquascape data: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun showIdentification() {
|
||||
val adapter = IdentificationHistoryAdapter(list)
|
||||
binding.rvListIdentification.adapter = adapter
|
||||
Log.d("DataList", "Jumlah data dalam list identification: ${list.size}")
|
||||
|
||||
adapter.setOnItemClickCallBack(object : IdentificationHistoryAdapter.OnItemClickCallback{
|
||||
override fun onItemClicked(data: IdentificationData) {
|
||||
val result = data.result
|
||||
val date = data.date
|
||||
val temperature = data.temperature
|
||||
val ph = data.ph
|
||||
val ammonia = data.ammonia
|
||||
val kh = data.kh
|
||||
val gh = data.gh
|
||||
|
||||
val bundle = Bundle().apply {
|
||||
putString("aquascapeId", aquascapeId.toString())
|
||||
putString("style", style.toString())
|
||||
putString("result", result)
|
||||
putString("date", date)
|
||||
putString("temperature", temperature)
|
||||
putString("ph", ph)
|
||||
putString("ammonia", ammonia)
|
||||
putString("kh", kh)
|
||||
putString("gh", gh)
|
||||
}
|
||||
findNavController().navigate(R.id.action_historyFragment_to_resultFragment, bundle)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
package com.capstone.aquacare.ui.identification
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.databinding.FragmentIdentificationResultBinding
|
||||
import com.capstone.aquacare.fuzzy.FuzzyDutchStyle
|
||||
import com.capstone.aquacare.fuzzy.FuzzyIdentification
|
||||
import com.capstone.aquacare.fuzzy.FuzzyNaturalStyle
|
||||
|
||||
class IdentificationResultFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentIdentificationResultBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private var aquascapeId: String? = null
|
||||
private var style: String? = null
|
||||
private var result: String? = null
|
||||
private var date: String? = null
|
||||
private var temperature: String? = null
|
||||
private var ph: String? = null
|
||||
private var ammonia: String? = null
|
||||
private var kh: String? = null
|
||||
private var gh: String? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
aquascapeId = arguments?.getString("aquascapeId")
|
||||
style = arguments?.getString("style")
|
||||
result = arguments?.getString("result")
|
||||
date = arguments?.getString("date")
|
||||
temperature = arguments?.getString("temperature")
|
||||
ph = arguments?.getString("ph")
|
||||
ammonia = arguments?.getString("ammonia")
|
||||
kh = arguments?.getString("kh")
|
||||
gh = arguments?.getString("gh")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentIdentificationResultBinding.inflate(inflater, container, false)
|
||||
setupOnBackPressed()
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.tvHasil.text = result
|
||||
binding.tvTemperature.text = temperature
|
||||
binding.tvPh.text = ph
|
||||
binding.tvAmmonia.text = ammonia
|
||||
binding.tvKh.text = kh
|
||||
binding.tvGh.text = gh
|
||||
binding.tvDate.text = date
|
||||
|
||||
checkParameter(style)
|
||||
}
|
||||
|
||||
private fun setupOnBackPressed() {
|
||||
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
val bundle = Bundle().apply {
|
||||
putString("aquascapeId", aquascapeId.toString())
|
||||
}
|
||||
findNavController().navigate(R.id.action_resultFragment_to_historyFragment, bundle)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun checkParameter(style: String?) {
|
||||
|
||||
if (temperature.isNullOrEmpty() || ph.isNullOrEmpty() || ammonia.isNullOrEmpty() || kh.isNullOrEmpty() || gh.isNullOrEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
val temperature = temperature?.toDouble()
|
||||
val ph = ph?.toDouble()
|
||||
val ammonia = ammonia?.toDouble()
|
||||
val kh = kh?.toDouble()
|
||||
val gh = gh?.toDouble()
|
||||
|
||||
// val fuzzyDutchStyle = FuzzyDutchStyle(requireContext())
|
||||
// val fuzzyNaturalStyle = FuzzyNaturalStyle(requireContext())
|
||||
val fuzzyIdentification = FuzzyIdentification(requireContext(), style.toString())
|
||||
|
||||
val checkResult = fuzzyIdentification.checkParameter(temperature!!, ph!!, ammonia!!, kh!!, gh!!)
|
||||
val temperatureD = checkResult.temperature
|
||||
val phD = checkResult.ph
|
||||
val ammoniaD = checkResult.ammonia
|
||||
val khD = checkResult.kh
|
||||
val ghD = checkResult.gh
|
||||
|
||||
binding.tvTemperature.text = "$temperatureD - $temperature"
|
||||
binding.tvPh.text = "$phD - $ph"
|
||||
binding.tvAmmonia.text = "$ammoniaD - $ammonia"
|
||||
binding.tvKh.text = "$khD - $kh"
|
||||
binding.tvGh.text = "$ghD - $gh"
|
||||
|
||||
tipsResult(temperatureD, phD, ammoniaD, khD, ghD)
|
||||
|
||||
// if (style == "Dutch Style") {
|
||||
// val checkResult = fuzzyDutchStyle.checkParameter(temperature!!, ph!!, ammonia!!, kh!!, gh!!)
|
||||
// val temperatureD = checkResult.temperature
|
||||
// val phD = checkResult.ph
|
||||
// val ammoniaD = checkResult.ammonia
|
||||
// val khD = checkResult.kh
|
||||
// val ghD = checkResult.gh
|
||||
//
|
||||
// binding.tvTemperature.text = "$temperatureD - $temperature"
|
||||
// binding.tvPh.text = "$phD - $ph"
|
||||
// binding.tvAmmonia.text = "$ammoniaD - $ammonia"
|
||||
// binding.tvKh.text = "$khD - $kh"
|
||||
// binding.tvGh.text = "$ghD - $gh"
|
||||
//
|
||||
// tipsResult(temperatureD, phD, ammoniaD, khD, ghD)
|
||||
//
|
||||
// } else {
|
||||
// val checkResult = fuzzyNaturalStyle.checkParameter(temperature!!, ph!!, ammonia!!, kh!!, gh!!)
|
||||
// val temperatureN = checkResult.temperature
|
||||
// val phN = checkResult.ph
|
||||
// val ammoniaN = checkResult.ammonia
|
||||
// val khN = checkResult.kh
|
||||
// val ghN = checkResult.gh
|
||||
//
|
||||
// binding.tvTemperature.text = "$temperatureN - $temperature"
|
||||
// binding.tvPh.text = "$phN - $ph"
|
||||
// binding.tvAmmonia.text = "$ammoniaN - $ammonia"
|
||||
// binding.tvKh.text = "$khN - $kh"
|
||||
// binding.tvGh.text = "$ghN - $gh"
|
||||
//
|
||||
// tipsResult(temperatureN, phN, ammoniaN, khN, ghN)
|
||||
// }
|
||||
}
|
||||
|
||||
private fun tipsResult(temperature: String?, ph: String?, ammonia: String?, kh: String?, gh: String?) {
|
||||
var tips = ""
|
||||
val good = getString(R.string.good)
|
||||
val medium = getString(R.string.medium)
|
||||
|
||||
tips += when (temperature) {
|
||||
good -> {
|
||||
" - Selalu jaga suhu air \n"
|
||||
}
|
||||
else -> " - Tambah kipas kecil untuk mendinginkan air \n"
|
||||
}
|
||||
|
||||
tips += when (ph) {
|
||||
good -> {
|
||||
" - Selalu jaga PH optimal air \n"
|
||||
}
|
||||
medium -> {
|
||||
" - Selalu jaga PH di batas optimal \n"
|
||||
}
|
||||
else -> " - Ganti sumber air untuk menyesuaikan PH atau injeksikan CO2 tambahan \n"
|
||||
}
|
||||
|
||||
tips += when (ammonia) {
|
||||
good -> {
|
||||
" - Selalu jaga kadar ammonia air \n"
|
||||
}
|
||||
else -> " - Segera lakukan pergantian air dan bersihkan kotoran penyebab ammonia \n"
|
||||
}
|
||||
|
||||
tips += when (kh) {
|
||||
good -> {
|
||||
" - Selalu jaga kadar KH air \n"
|
||||
}
|
||||
medium -> {
|
||||
" - Selalu jaga kadar KH di batas optimal \n"
|
||||
}
|
||||
else -> " - Ganti sumber air untuk mengurangi kadar KH \n"
|
||||
}
|
||||
|
||||
tips += when (gh) {
|
||||
good -> {
|
||||
" - Selalu jaga kadar GH air"
|
||||
}
|
||||
else -> " - Ganti sumber air untuk mengurangi kadar GH"
|
||||
}
|
||||
|
||||
binding.tvDetailTips.text = tips
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.capstone.aquacare.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.capstone.aquacare.databinding.FragmentAboutBinding
|
||||
|
||||
class AboutFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentAboutBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentAboutBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package com.capstone.aquacare.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.ArticleData
|
||||
import com.capstone.aquacare.databinding.FragmentAddArticleBinding
|
||||
import com.google.firebase.database.*
|
||||
|
||||
class AddArticleFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentAddArticleBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("article")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentAddArticleBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.btnSave.setOnClickListener {
|
||||
if (checkForm()) {
|
||||
addAquascapeInfo()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun checkForm(): Boolean {
|
||||
val title = binding.edtTitle.text.toString()
|
||||
val image = binding.edtImage.text.toString()
|
||||
val body = binding.edtBody.text.toString()
|
||||
val type = binding.edtType.text.toString()
|
||||
|
||||
if (TextUtils.isEmpty(title)) {
|
||||
binding.edtTitle.error = getString(R.string.please_fill)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(image)) {
|
||||
binding.edtImage.error = getString(R.string.please_fill)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(body)) {
|
||||
binding.edtBody.error = getString(R.string.please_fill)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
binding.edtType.error = getString(R.string.please_fill)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun addAquascapeInfo() {
|
||||
|
||||
val title = binding.edtTitle.text.toString()
|
||||
val image = binding.edtImage.text.toString()
|
||||
val type = binding.edtType.text.toString()
|
||||
val body = binding.edtBody.text.toString()
|
||||
val link = binding.edtLink.text.toString()
|
||||
|
||||
val infoId = databaseReference.push().key
|
||||
|
||||
if (infoId != null) {
|
||||
val infoData = ArticleData(infoId, title, image, type, body, link)
|
||||
databaseReference.child(infoId).setValue(infoData)
|
||||
.addOnSuccessListener {
|
||||
Toast.makeText(activity, getString(R.string.success_to_add_aquascape_info), Toast.LENGTH_SHORT).show()
|
||||
findNavController().navigate(R.id.action_addAquascapeInfoFragment_to_aquascapeInfoFragment)
|
||||
}
|
||||
.addOnFailureListener { e ->
|
||||
Toast.makeText(activity, "Failed to add Aquascape info: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(activity, "Failed to generate Aquascape Info ID", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.capstone.aquacare.ui.setting
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.capstone.aquacare.data.ArticleData
|
||||
import com.capstone.aquacare.databinding.CardArticleBinding
|
||||
|
||||
class ArticleAdapter (private val list: List<ArticleData>) : RecyclerView.Adapter<ArticleAdapter.ViewHolder>() {
|
||||
|
||||
private lateinit var onItemClickCallback: OnItemClickCallback
|
||||
|
||||
fun setOnItemClickCallBack(onItemClickCallback: OnItemClickCallback) {
|
||||
this.onItemClickCallback = onItemClickCallback
|
||||
}
|
||||
|
||||
interface OnItemClickCallback {
|
||||
fun onItemClicked(data: ArticleData)
|
||||
}
|
||||
|
||||
class ViewHolder(var binding: CardArticleBinding) : RecyclerView.ViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = CardArticleBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return ViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = list.size
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val currentAquascapeInfo = list[position]
|
||||
holder.binding.tvTitle.text = currentAquascapeInfo.title
|
||||
if (!currentAquascapeInfo.image.isNullOrEmpty()) {
|
||||
Glide.with(holder.itemView.context)
|
||||
.load(currentAquascapeInfo.image)
|
||||
.into(holder.binding.ivImage)
|
||||
}
|
||||
holder.binding.tvType.text = currentAquascapeInfo.type
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
onItemClickCallback.onItemClicked(list[holder.adapterPosition])
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package com.capstone.aquacare.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.bumptech.glide.Glide
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.databinding.FragmentArticleBinding
|
||||
|
||||
class ArticleFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentArticleBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentArticleBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val infoId = arguments?.getString("infoId").toString()
|
||||
val title = arguments?.getString("title").toString()
|
||||
val image = arguments?.getString("image").toString()
|
||||
val type = arguments?.getString("type").toString()
|
||||
val body = arguments?.getString("body").toString()
|
||||
val link = arguments?.getString("link").toString()
|
||||
val edit = arguments?.getString("edit").toString()
|
||||
|
||||
val webView = binding.webView
|
||||
|
||||
if (edit == "false") {
|
||||
binding.tvEdit.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (link.isNotEmpty()) {
|
||||
binding.tvTitle.visibility = View.GONE
|
||||
binding.ivImage.visibility = View.GONE
|
||||
binding.tvBody.visibility = View.GONE
|
||||
|
||||
webView.apply {
|
||||
webViewClient = WebViewClient()
|
||||
settings.javaScriptEnabled = true
|
||||
settings.setRenderPriority(WebSettings.RenderPriority.HIGH)
|
||||
settings.cacheMode = WebSettings.LOAD_NO_CACHE
|
||||
settings.domStorageEnabled = true
|
||||
settings.databaseEnabled = true
|
||||
setLayerType(WebView.LAYER_TYPE_HARDWARE, null) // atau WebView.LAYER_TYPE_SOFTWARE
|
||||
}
|
||||
|
||||
webView.loadUrl(link)
|
||||
} else {
|
||||
webView.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.tvTitle.text = title
|
||||
binding.tvBody.text = body
|
||||
if (image.isNotEmpty()) {
|
||||
Glide.with(requireActivity())
|
||||
.load(image)
|
||||
.into(binding.ivImage)
|
||||
} else {
|
||||
binding.ivImage.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.tvEdit.setOnClickListener {
|
||||
val bundle = Bundle().apply {
|
||||
putString("infoId", infoId)
|
||||
putString("title", title)
|
||||
putString("image", image)
|
||||
putString("type", type)
|
||||
putString("body", body)
|
||||
putString("link", link)
|
||||
}
|
||||
findNavController().navigate(R.id.action_AquascapeInfoFragment_to_editAquascapeInfoFragment, bundle)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
// Cleanup the WebView to prevent memory leaks
|
||||
val webView = binding.webView
|
||||
webView.apply {
|
||||
loadUrl("about:blank")
|
||||
stopLoading()
|
||||
settings.javaScriptEnabled = false
|
||||
clearHistory()
|
||||
removeAllViews()
|
||||
destroy()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
package com.capstone.aquacare.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.ArticleData
|
||||
import com.capstone.aquacare.databinding.FragmentEditArticleBinding
|
||||
import com.google.firebase.database.*
|
||||
|
||||
class EditArticleFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentEditArticleBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("article")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentEditArticleBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val infoId = arguments?.getString("infoId").toString()
|
||||
val title = arguments?.getString("title").toString()
|
||||
val image = arguments?.getString("image").toString()
|
||||
val type = arguments?.getString("type").toString()
|
||||
val body = arguments?.getString("body").toString()
|
||||
val link = arguments?.getString("link").toString()
|
||||
|
||||
binding.edtTitle.setText(title)
|
||||
binding.edtImage.setText(image)
|
||||
binding.edtType.setText(type)
|
||||
binding.edtBody.setText(body)
|
||||
binding.edtLink.setText(link)
|
||||
|
||||
binding.btnSave.setOnClickListener {
|
||||
if (checkForm()) {
|
||||
editAquascapeInfo(infoId)
|
||||
}
|
||||
}
|
||||
|
||||
binding.btnDelete.setOnClickListener {
|
||||
deleteAquascapeInfo(infoId)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkForm(): Boolean {
|
||||
val title = binding.edtTitle.text.toString()
|
||||
val image = binding.edtImage.text.toString()
|
||||
val body = binding.edtBody.text.toString()
|
||||
val type = binding.edtType.text.toString()
|
||||
|
||||
if (TextUtils.isEmpty(title)) {
|
||||
binding.edtTitle.error = getString(R.string.please_fill)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(image)) {
|
||||
binding.edtImage.error = getString(R.string.please_fill)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(body)) {
|
||||
binding.edtBody.error = getString(R.string.please_fill)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
binding.edtType.error = getString(R.string.please_fill)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun editAquascapeInfo(id: String) {
|
||||
|
||||
val title = binding.edtTitle.text.toString()
|
||||
val image = binding.edtImage.text.toString()
|
||||
val type = binding.edtType.text.toString()
|
||||
val body = binding.edtBody.text.toString()
|
||||
val link = binding.edtLink.text.toString()
|
||||
|
||||
databaseReference.orderByChild("id").equalTo(id).addListenerForSingleValueEvent(object :
|
||||
ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
if (dataSnapshot.exists()) {
|
||||
for (snapshot in dataSnapshot.children) {
|
||||
val infoData = snapshot.getValue(ArticleData::class.java)
|
||||
if (infoData != null) {
|
||||
|
||||
val updateData = mapOf("title" to title, "image" to image, "type" to type, "body" to body, "link" to link)
|
||||
|
||||
databaseReference.child(id).updateChildren(updateData)
|
||||
.addOnSuccessListener {
|
||||
|
||||
Toast.makeText(activity, getString(R.string.success_to_edit_aquascape_info), Toast.LENGTH_SHORT).show()
|
||||
findNavController().navigate(R.id.action_editAquascapeInfoFragment_to_aquascapeInfoFragment)
|
||||
}
|
||||
.addOnFailureListener { e ->
|
||||
Toast.makeText(activity, "Failed to Edit Aquascape Info: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "No Aquascape Info data available")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancelled(error: DatabaseError) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun deleteAquascapeInfo(id: String) {
|
||||
databaseReference.child(id).removeValue().addOnSuccessListener {
|
||||
findNavController().navigate(R.id.action_editAquascapeInfoFragment_to_aquascapeInfoFragment)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "MainActivity"
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,184 @@
|
|||
package com.capstone.aquacare.ui.setting
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.databinding.FragmentEditPasswordBinding
|
||||
import com.google.firebase.auth.EmailAuthProvider
|
||||
import com.google.firebase.auth.FirebaseAuth
|
||||
import com.google.firebase.database.*
|
||||
|
||||
class EditPasswordFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentEditPasswordBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var auth: FirebaseAuth
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
auth = FirebaseAuth.getInstance()
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentEditPasswordBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val email = sharedPreferences?.getString("email", "").toString()
|
||||
|
||||
binding.btnSave.setOnClickListener {
|
||||
// editPassword()
|
||||
val oldPassword = binding.edtOldPassword.text.toString()
|
||||
val newPassword = binding.edtNewPassword.text.toString()
|
||||
|
||||
if (checkForm()) {
|
||||
changePassword(oldPassword, newPassword)
|
||||
}
|
||||
}
|
||||
|
||||
binding.tvForgotPassword.setOnClickListener{
|
||||
forgotPassword(email)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkForm(): Boolean {
|
||||
val oldPassword = binding.edtOldPassword.text.toString()
|
||||
val newPassword = binding.edtNewPassword.text.toString()
|
||||
val confirmPassword = binding.edtConfirmPassword.text.toString()
|
||||
|
||||
if (TextUtils.isEmpty(oldPassword)) {
|
||||
binding.edtOldPassword.error = getString(R.string.please_enter_password)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(newPassword)) {
|
||||
binding.edtNewPassword.error = getString(R.string.please_enter_password)
|
||||
return false
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(confirmPassword)) {
|
||||
binding.edtConfirmPassword.error = getString(R.string.please_enter_confirm_password)
|
||||
return false
|
||||
}
|
||||
|
||||
if (newPassword != confirmPassword) {
|
||||
binding.edtConfirmPassword.error = getString(R.string.confirm_password_wrong)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun changePassword(oldPassword: String, newPassword: String) {
|
||||
val user = auth.currentUser
|
||||
if (user != null && user.email != null) {
|
||||
val credential = EmailAuthProvider.getCredential(user.email!!, oldPassword)
|
||||
|
||||
user.reauthenticate(credential)
|
||||
.addOnCompleteListener { task ->
|
||||
if (task.isSuccessful) {
|
||||
user.updatePassword(newPassword)
|
||||
.addOnCompleteListener { task2 ->
|
||||
if (task2.isSuccessful) {
|
||||
Toast.makeText(activity, getString(R.string.success_to_edit_password), Toast.LENGTH_SHORT).show()
|
||||
findNavController().navigate(R.id.action_editPasswordFragment_to_settingFragment)
|
||||
} else {
|
||||
Toast.makeText(activity, "Password change failed.", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(activity, "Re-authentication failed.", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(activity, "No user is logged in.", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
// private fun editPassword() {
|
||||
// val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
// val userId = sharedPreferences?.getString("userId", "").toString()
|
||||
//
|
||||
// val password = binding.edtNewPassword.text.toString()
|
||||
// val confirmPassword = binding.edtConfirmPassword.text.toString()
|
||||
//
|
||||
// if (password.isEmpty()) {
|
||||
// binding.edtNewPassword.error = getString(R.string.enter_new_password)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// if (password == confirmPassword) {
|
||||
// databaseReference.orderByChild("id").equalTo(userId).addListenerForSingleValueEvent(object :
|
||||
// ValueEventListener {
|
||||
// override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
// if (dataSnapshot.exists()) {
|
||||
// for (snapshot in dataSnapshot.children) {
|
||||
// val userData = snapshot.getValue(UserData::class.java)
|
||||
// if (userData != null) {
|
||||
//
|
||||
// val updateData = mapOf("password" to password)
|
||||
//
|
||||
// databaseReference.child(userId).updateChildren(updateData)
|
||||
// .addOnSuccessListener {
|
||||
//
|
||||
// Toast.makeText(activity, getString(R.string.success_to_edit_password), Toast.LENGTH_SHORT).show()
|
||||
// findNavController().navigate(R.id.action_editPasswordFragment_to_settingFragment)
|
||||
// }
|
||||
// .addOnFailureListener { e ->
|
||||
// Toast.makeText(activity, "Failed to Edit Password: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
//
|
||||
// Log.d(TAG, "User ID: ${snapshot.key}, Name: ${userData.name}, Style: ${userData.email}")
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// Log.d(TAG, "No user data available")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onCancelled(error: DatabaseError) {
|
||||
// TODO("Not yet implemented")
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
// binding.edtConfirmPassword.error = getString(R.string.please_enter_confirm_password)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
private fun forgotPassword(email: String) {
|
||||
auth.sendPasswordResetEmail(email).addOnCompleteListener { task ->
|
||||
if (task.isSuccessful) {
|
||||
Toast.makeText(activity, "Reset password email sent.", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
Toast.makeText(activity, "Error: ${task.exception?.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "MainActivity"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,178 @@
|
|||
package com.capstone.aquacare.ui.setting
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.UserData
|
||||
import com.capstone.aquacare.databinding.FragmentEditProfileBinding
|
||||
import com.capstone.aquacare.ui.auth.AuthActivity
|
||||
import com.google.android.play.integrity.internal.ac
|
||||
import com.google.firebase.auth.FirebaseAuth
|
||||
import com.google.firebase.auth.ktx.auth
|
||||
import com.google.firebase.database.*
|
||||
import com.google.firebase.ktx.Firebase
|
||||
|
||||
class EditProfileFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentEditProfileBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
private lateinit var auth: FirebaseAuth
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
auth = FirebaseAuth.getInstance()
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentEditProfileBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val name = sharedPreferences?.getString("name", "")
|
||||
val email = sharedPreferences?.getString("email", "")
|
||||
|
||||
binding.edtName.setText(name)
|
||||
binding.edtEmail.setText(email)
|
||||
|
||||
binding.btnSave.setOnClickListener {
|
||||
editUserProfile()
|
||||
}
|
||||
|
||||
binding.btnDelete.setOnClickListener {
|
||||
deleteUser()
|
||||
}
|
||||
}
|
||||
|
||||
private fun editUserProfile() {
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val userId = sharedPreferences?.getString("userId", "").toString()
|
||||
val userType = sharedPreferences?.getString("userType", "").toString()
|
||||
val photo = sharedPreferences?.getString("photo", "").toString()
|
||||
|
||||
val name = binding.edtName.text.toString()
|
||||
val email = binding.edtEmail.text.toString()
|
||||
|
||||
if (name.isEmpty()) {
|
||||
binding.edtName.error = getString(R.string.please_enter_name)
|
||||
return
|
||||
}
|
||||
|
||||
if (email.isEmpty()) {
|
||||
binding.edtEmail.error = getString(R.string.please_enter_email)
|
||||
return
|
||||
}
|
||||
|
||||
databaseReference.orderByChild("id").equalTo(userId).addListenerForSingleValueEvent(object :
|
||||
ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
if (dataSnapshot.exists()) {
|
||||
for (snapshot in dataSnapshot.children) {
|
||||
val userData = snapshot.getValue(UserData::class.java)
|
||||
if (userData != null) {
|
||||
|
||||
val updateData = mapOf("name" to name, "email" to email)
|
||||
|
||||
databaseReference.child(userId).updateChildren(updateData)
|
||||
.addOnSuccessListener {
|
||||
|
||||
saveLoginSession(userId, name, email, photo, userType)
|
||||
|
||||
Toast.makeText(activity, getString(R.string.success_to_edit_profile), Toast.LENGTH_SHORT).show()
|
||||
findNavController().navigate(R.id.action_editProfileFragment_to_settingFragment)
|
||||
}
|
||||
.addOnFailureListener { e ->
|
||||
Toast.makeText(activity, "Failed to Edit User Profile: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
Log.d(TAG, "User ID: ${snapshot.key}, Name: ${userData.name}, Style: ${userData.email}")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "No user data available")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancelled(error: DatabaseError) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun deleteUser() {
|
||||
val user = auth.currentUser
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val userId = sharedPreferences?.getString("userId", "").toString()
|
||||
|
||||
user?.let {
|
||||
it.delete()
|
||||
.addOnCompleteListener { task ->
|
||||
if (task.isSuccessful) {
|
||||
databaseReference.child(userId).removeValue().addOnSuccessListener {
|
||||
Firebase.auth.signOut()
|
||||
deleteLoginSession(requireContext())
|
||||
startActivity(
|
||||
Intent(
|
||||
activity, AuthActivity::class.java
|
||||
)
|
||||
)
|
||||
activity?.finish()
|
||||
Toast.makeText(activity, getString(R.string.success_to_delete_account), Toast.LENGTH_SHORT).show()
|
||||
}.addOnFailureListener {
|
||||
Toast.makeText(activity, "Failed to Delete User Account", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(activity, "Failed to Delete Account", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun saveLoginSession(userId: String, name: String, email: String, photo: String, userType: String) {
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val editor = sharedPreferences?.edit()
|
||||
editor?.putString("userId", userId)
|
||||
editor?.putString("name", name)
|
||||
editor?.putString("email", email)
|
||||
editor?.putString("photo", photo)
|
||||
editor?.putString("userType", userType)
|
||||
editor?.apply()
|
||||
}
|
||||
|
||||
private fun deleteLoginSession(context: Context) {
|
||||
val sharedPreferences = context.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val editor = sharedPreferences?.edit()
|
||||
editor?.putString("userId", "")
|
||||
editor?.putString("name", "")
|
||||
editor?.putString("email", "")
|
||||
editor?.putString("photo", "")
|
||||
editor?.apply()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "MainActivity"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package com.capstone.aquacare.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.ArticleData
|
||||
import com.capstone.aquacare.databinding.FragmentListArticleBinding
|
||||
import com.google.firebase.database.*
|
||||
|
||||
class ListArticleFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentListArticleBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
val listInfo = mutableListOf<ArticleData>()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("article")
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentListArticleBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val rvAquascapeInfo = binding.rvAquascapeInfo
|
||||
|
||||
val layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, true)
|
||||
layoutManager.stackFromEnd = true
|
||||
|
||||
rvAquascapeInfo.layoutManager = layoutManager
|
||||
rvAquascapeInfo.setHasFixedSize(true)
|
||||
|
||||
binding.tvAddAquascapeInfo.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_listAquascapeInfoFragment_to_addAquascapeInfoFragment)
|
||||
}
|
||||
|
||||
getAquascapeInfoData()
|
||||
}
|
||||
|
||||
private fun getAquascapeInfoData() {
|
||||
binding.rvAquascapeInfo.visibility = View.GONE
|
||||
|
||||
databaseReference.addValueEventListener(object : ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
listInfo.clear()
|
||||
for (snapshot in dataSnapshot.children) {
|
||||
val dataAquascapeInfo = snapshot.getValue(ArticleData::class.java)
|
||||
if (dataAquascapeInfo != null) {
|
||||
listInfo.add(dataAquascapeInfo)
|
||||
}
|
||||
}
|
||||
|
||||
binding.rvAquascapeInfo.visibility = View.VISIBLE
|
||||
|
||||
showAquascapeInfo()
|
||||
}
|
||||
|
||||
override fun onCancelled(databaseError: DatabaseError) {
|
||||
Toast.makeText(requireContext(), "Failed to retrieve aquascape info data: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun showAquascapeInfo() {
|
||||
val adapter = ArticleAdapter(listInfo)
|
||||
binding.rvAquascapeInfo.adapter = adapter
|
||||
Log.d("DataList", "Jumlah data dalam list aquascape info: ${listInfo.size}")
|
||||
|
||||
adapter.setOnItemClickCallBack(object : ArticleAdapter.OnItemClickCallback{
|
||||
override fun onItemClicked(data: ArticleData) {
|
||||
|
||||
val infoId = data.id
|
||||
val title = data.title
|
||||
val image = data.image
|
||||
val type = data.type
|
||||
val body = data.body
|
||||
val link = data.link
|
||||
val edit = "true"
|
||||
|
||||
val bundle = Bundle().apply {
|
||||
putString("infoId", infoId)
|
||||
putString("title", title)
|
||||
putString("image", image)
|
||||
putString("type", type)
|
||||
putString("body", body)
|
||||
putString("link", link)
|
||||
putString("edit", edit)
|
||||
}
|
||||
|
||||
findNavController().navigate(R.id.action_listAquascapeInfoFragment_to_AquascapeInfoFragment, bundle)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package com.capstone.aquacare.ui.setting
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.bumptech.glide.Glide
|
||||
import com.capstone.aquacare.R
|
||||
import com.capstone.aquacare.data.UserData
|
||||
import com.capstone.aquacare.databinding.FragmentSettingBinding
|
||||
import com.capstone.aquacare.ui.auth.AuthActivity
|
||||
import com.google.firebase.auth.FirebaseAuth
|
||||
import com.google.firebase.auth.ktx.auth
|
||||
import com.google.firebase.database.*
|
||||
import com.google.firebase.ktx.Firebase
|
||||
|
||||
class SettingFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentSettingBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var firebaseDatabase: FirebaseDatabase
|
||||
private lateinit var databaseReference: DatabaseReference
|
||||
|
||||
private lateinit var auth: FirebaseAuth
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
firebaseDatabase = FirebaseDatabase.getInstance()
|
||||
databaseReference = firebaseDatabase.reference.child("users")
|
||||
auth = FirebaseAuth.getInstance()
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentSettingBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val sharedPreferences = context?.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val userId = sharedPreferences?.getString("userId", "").toString()
|
||||
val userType = sharedPreferences?.getString("userType", "")
|
||||
val name = sharedPreferences?.getString("name", "")
|
||||
val email = sharedPreferences?.getString("email", "")
|
||||
val photo = sharedPreferences?.getString("photo", "")
|
||||
val accountType = sharedPreferences?.getString("accountType", "")
|
||||
|
||||
Log.d(TAG, "Photo URL : $photo")
|
||||
|
||||
binding.tvName.text = name
|
||||
binding.tvEmail.text = email
|
||||
|
||||
binding.btnLanguage.visibility = View.GONE
|
||||
|
||||
if (userType != "admin") {
|
||||
binding.viewInfo.visibility = View.GONE
|
||||
binding.btnAquascapeInfo.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (accountType == "Google Account") {
|
||||
binding.viewPassword.visibility = View.GONE
|
||||
binding.btnChangePassword.visibility = View.GONE
|
||||
Glide.with(requireActivity())
|
||||
.load(photo)
|
||||
.into(binding.ivProfile)
|
||||
} else {
|
||||
binding.ivProfile.setImageResource(R.drawable.bg_person_default)
|
||||
}
|
||||
|
||||
getUpdateData(userId)
|
||||
|
||||
binding.btnEditProfile.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_settingFragment_to_editProfileFragment)
|
||||
}
|
||||
|
||||
binding.btnChangePassword.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_settingFragment_to_editPasswordFragment)
|
||||
}
|
||||
|
||||
binding.btnAquascapeInfo.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_settingFragment_to_listAquascapeInfoFragment)
|
||||
}
|
||||
|
||||
binding.btnAboutApp.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_settingFragment_to_AboutFragment)
|
||||
}
|
||||
|
||||
binding.btnLogOut.setOnClickListener {
|
||||
Firebase.auth.signOut()
|
||||
deleteLoginSession(requireContext())
|
||||
startActivity(
|
||||
Intent(
|
||||
activity, AuthActivity::class.java
|
||||
)
|
||||
)
|
||||
activity?.finish()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun getUpdateData(userId: String) {
|
||||
databaseReference.orderByChild("id").equalTo(userId).addListenerForSingleValueEvent(object :
|
||||
ValueEventListener {
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
if (dataSnapshot.exists()) {
|
||||
for (userSnapshot in dataSnapshot.children) {
|
||||
val userData = userSnapshot.getValue(UserData::class.java)
|
||||
|
||||
if (userData != null){
|
||||
val name = userData.name
|
||||
val email = userData.email
|
||||
|
||||
binding.tvName.text = name
|
||||
binding.tvEmail.text = email
|
||||
|
||||
} else {
|
||||
Toast.makeText(activity, "Failed to get user data", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancelled(databaseError: DatabaseError) {
|
||||
Toast.makeText(activity, "Database Error: ${databaseError.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun deleteLoginSession(context: Context) {
|
||||
val sharedPreferences = context.getSharedPreferences("LoginSession", Context.MODE_PRIVATE)
|
||||
val editor = sharedPreferences?.edit()
|
||||
editor?.putString("userId", "")
|
||||
editor?.putString("name", "")
|
||||
editor?.putString("email", "")
|
||||
editor?.putString("photo", "")
|
||||
editor?.apply()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "MainActivity"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/white" />
|
||||
<corners android:radius="15dp"/>
|
||||
<stroke android:width="1dp"
|
||||
android:color="@color/gray_2"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/white" />
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/white" />
|
||||
<corners android:radius="5dp"/>
|
||||
<stroke android:color="@color/gray_2"
|
||||
android:width="1dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/blue_button" />
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,8 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/blue_setting" />
|
||||
<corners android:topLeftRadius="0dp"
|
||||
android:topRightRadius="0dp"
|
||||
android:bottomLeftRadius="20dp"
|
||||
android:bottomRightRadius="20dp"/>
|
||||
</shape>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/gray" />
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/green" />
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/red" />
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M9,11L7,11v2h2v-2zM13,11h-2v2h2v-2zM17,11h-2v2h2v-2zM19,4h-1L18,2h-2v2L8,4L8,2L6,2v2L5,4c-1.11,0 -1.99,0.9 -1.99,2L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.9,-2 -2,-2zM19,20L5,20L5,9h14v11z"/>
|
||||
</vector>
|
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,170 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 1.6 KiB |
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,7c2.76,0 5,2.24 5,5 0,0.65 -0.13,1.26 -0.36,1.83l2.92,2.92c1.51,-1.26 2.7,-2.89 3.43,-4.75 -1.73,-4.39 -6,-7.5 -11,-7.5 -1.4,0 -2.74,0.25 -3.98,0.7l2.16,2.16C10.74,7.13 11.35,7 12,7zM2,4.27l2.28,2.28 0.46,0.46C3.08,8.3 1.78,10.02 1,12c1.73,4.39 6,7.5 11,7.5 1.55,0 3.03,-0.3 4.38,-0.84l0.42,0.42L19.73,22 21,20.73 3.27,3 2,4.27zM7.53,9.8l1.55,1.55c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.66 1.34,3 3,3 0.22,0 0.44,-0.03 0.65,-0.08l1.55,1.55c-0.67,0.33 -1.41,0.53 -2.2,0.53 -2.76,0 -5,-2.24 -5,-5 0,-0.79 0.2,-1.53 0.53,-2.2zM11.84,9.02l3.15,3.15 0.02,-0.16c0,-1.66 -1.34,-3 -3,-3l-0.17,0.01z"/>
|
||||
</vector>
|
After Width: | Height: | Size: 185 KiB |
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.auth.AuthActivity"
|
||||
android:id="@+id/auth_frame_container"
|
||||
android:background="@color/white"/>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.MainActivity"
|
||||
android:background="@color/background">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/main_frame_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
app:navGraph="@navigation/main_navigation"
|
||||
app:defaultNavHost="true"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.SplashScreenActivity"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:text="@string/app_name"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="75dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
android:backgroundTint="@color/white"
|
||||
android:backgroundTintMode="screen"
|
||||
app:cardCornerRadius="5dp"
|
||||
>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_border_rounded_3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAquascapeName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="@string/aquascape_name"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatusAquascape"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/status"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvAquascapeName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/date"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvStatusAquascape" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="125dp"
|
||||
app:cardBackgroundColor="@color/white">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_image"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/img_aquascape_info"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginStart="90dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:text="@string/aquascape_info"
|
||||
android:textAlignment="textStart"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_image"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:text="@string/type"
|
||||
android:textAlignment="textStart"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_image" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
|
@ -0,0 +1,75 @@
|
|||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:layout_marginTop="5dp"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/bg_border_rounded_3">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatusAquascape"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:paddingVertical="2dp"
|
||||
android:text="@string/status"
|
||||
android:textAlignment="center"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/white"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:background="@drawable/bg_border_rounded_blue"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/line"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@color/gray_2"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="5dp"
|
||||
android:text="@string/date"
|
||||
android:textAlignment="viewStart"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.setting.AboutFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:text="@string/app_name"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:paddingHorizontal="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:text="@string/app_description"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView8" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,183 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.aquascape.AddAquascapeFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="75dp"
|
||||
android:text="@string/add_aquascape"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/bg_border_rounded"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_name"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/edt_name"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_jenis"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/style"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line1" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spin_style"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line1" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spin_style" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/created"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line2" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:paddingHorizontal="5dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date_create"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:text="@string/select_date"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_select_date"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@drawable/ic_date_range_24"
|
||||
android:background="@drawable/bg_border_rounded_2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:contentDescription="@string/select_date" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/blue_button"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,195 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.setting.AddArticleFragment"
|
||||
android:background="@color/background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="20dp"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/add_article"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/title"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/image_link"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_title" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
android:text="@string/type"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_image" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/body"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_type" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_body"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/article_link"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_body" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_link"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView6" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/blue_button"
|
||||
android:elevation="10dp"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_link" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.setting.ArticleFragment"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="20dp"
|
||||
android:background="@color/white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/edit"
|
||||
android:textColor="@color/blue_text"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:text="@string/title"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:textAlignment="center"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/img_aquascape_info"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title"
|
||||
android:contentDescription="Image Article" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_body"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
android:text="@string/body"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:justificationMode="inter_word"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_image" />
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="25dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
|
@ -0,0 +1,181 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.aquascape.EditAquascapeFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="75dp"
|
||||
android:text="@string/edit_aquascape"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/bg_border_rounded"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_name"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/edt_name"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_jenis"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/style"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line1" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spin_style"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line1" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spin_style" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date_create"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/created"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line2" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_date_create"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:paddingStart="5dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:editable="false"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line2" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/blue_button"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:elevation="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_delete"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/red"
|
||||
android:text="@string/delete_aquascape"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:elevation="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_save" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,225 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.setting.EditArticleFragment"
|
||||
android:background="@color/background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="20dp"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/edit_article"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/title"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/image_link"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_title" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
android:text="@string/type"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_image" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/imageView"-->
|
||||
<!-- android:layout_width="30dp"-->
|
||||
<!-- android:layout_height="30dp"-->
|
||||
<!-- android:layout_marginTop="5dp"-->
|
||||
<!-- android:layout_marginEnd="15dp"-->
|
||||
<!-- android:background="@drawable/bg_border_rounded_form"-->
|
||||
<!-- android:src="@drawable/ic_add_image"-->
|
||||
<!-- android:elevation="10dp"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/textView3" />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/body"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_type" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_body"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/article_link"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_body" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_link"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView6" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/blue_button"
|
||||
android:elevation="10dp"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edt_link" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_delete"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/red"
|
||||
android:elevation="10dp"
|
||||
android:text="@string/delete"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_save" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
|
@ -0,0 +1,269 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.setting.EditPasswordFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="75dp"
|
||||
android:text="@string/change_password"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:paddingHorizontal="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:background="@drawable/bg_border_rounded"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/old_password"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/oldPasswordContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
app:boxStrokeColor="@color/gray"
|
||||
app:boxBackgroundColor="@color/gray"
|
||||
app:boxCornerRadiusTopStart="5dp"
|
||||
app:boxCornerRadiusBottomEnd="5dp"
|
||||
app:boxCornerRadiusBottomStart="5dp"
|
||||
app:boxCornerRadiusTopEnd="5dp"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="@color/gray_3"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_password">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_old_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="textPassword"
|
||||
android:lines="0"
|
||||
android:textColor="@color/black"
|
||||
android:maxLength="16" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<!-- <EditText-->
|
||||
<!-- android:id="@+id/edt_old_password"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="15dp"-->
|
||||
<!-- android:background="@drawable/bg_border_rounded_form"-->
|
||||
<!-- android:fontFamily="@font/poppins_regular"-->
|
||||
<!-- android:paddingVertical="4dp"-->
|
||||
<!-- android:paddingStart="5dp"-->
|
||||
<!-- android:textColor="@color/black"-->
|
||||
<!-- android:textSize="14sp"-->
|
||||
<!-- android:inputType="textPassword"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_password" />-->
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/oldPasswordContainer" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_password2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/new_password"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line1" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/newPasswordContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
app:boxStrokeColor="@color/gray"
|
||||
app:boxBackgroundColor="@color/gray"
|
||||
app:boxCornerRadiusTopStart="5dp"
|
||||
app:boxCornerRadiusBottomEnd="5dp"
|
||||
app:boxCornerRadiusBottomStart="5dp"
|
||||
app:boxCornerRadiusTopEnd="5dp"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="@color/gray_3"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_password2">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_new_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="textPassword"
|
||||
android:lines="0"
|
||||
android:textColor="@color/black"
|
||||
android:maxLength="16" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<!-- <EditText-->
|
||||
<!-- android:id="@+id/edt_new_password"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="15dp"-->
|
||||
<!-- android:background="@drawable/bg_border_rounded_form"-->
|
||||
<!-- android:fontFamily="@font/poppins_regular"-->
|
||||
<!-- android:inputType="textPassword"-->
|
||||
<!-- android:paddingVertical="4dp"-->
|
||||
<!-- android:paddingStart="5dp"-->
|
||||
<!-- android:textColor="@color/black"-->
|
||||
<!-- android:textSize="14sp"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_password2" />-->
|
||||
|
||||
<View
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/newPasswordContainer" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_password3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/confirm_new_password"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line2" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/confirmPasswordContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
app:boxStrokeColor="@color/gray"
|
||||
app:boxBackgroundColor="@color/gray"
|
||||
app:boxCornerRadiusTopStart="5dp"
|
||||
app:boxCornerRadiusBottomEnd="5dp"
|
||||
app:boxCornerRadiusBottomStart="5dp"
|
||||
app:boxCornerRadiusTopEnd="5dp"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="@color/gray_3"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_password3">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_confirm_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="textPassword"
|
||||
android:lines="0"
|
||||
android:textColor="@color/black"
|
||||
android:maxLength="16" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<!-- <EditText-->
|
||||
<!-- android:id="@+id/edt_confirm_password"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="15dp"-->
|
||||
<!-- android:background="@drawable/bg_border_rounded_form"-->
|
||||
<!-- android:fontFamily="@font/poppins_regular"-->
|
||||
<!-- android:inputType="textPassword"-->
|
||||
<!-- android:paddingVertical="4dp"-->
|
||||
<!-- android:paddingStart="5dp"-->
|
||||
<!-- android:textColor="@color/black"-->
|
||||
<!-- android:textSize="14sp"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_password3" />-->
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/blue_button"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:elevation="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_forgot_password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/forgot_password"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_save" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.setting.EditProfileFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="75dp"
|
||||
android:text="@string/edit_profile"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/bg_border_rounded"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_name"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/edt_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_email"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/email"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_email"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:editable="false"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/blue_button"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:elevation="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_delete"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/red"
|
||||
android:text="@string/delete_account"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:elevation="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_save" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,166 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.home.HomeFragment"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/background">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_profile"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:src="@drawable/ic_profile_setting"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="8dp"
|
||||
android:text="@string/name"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textAlignment="center"
|
||||
android:fontFamily="@font/poppins_semi_bold"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- <androidx.core.widget.NestedScrollView-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:scrollbars="none">-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:background="@color/white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_aquascape"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/aquascape"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/add"
|
||||
android:textColor="@color/blue_text"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="normal"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_list_aquascape"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:background="@color/transparent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_aquascape" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_aquascape"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/rv_list_aquascape"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<!-- </androidx.core.widget.NestedScrollView>-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:padding="15dp"
|
||||
android:background="@color/white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/article"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_aquascape_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_article"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,262 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.identification.IdentificationFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/enter_parameter_values"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_name" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:padding="5dp"
|
||||
android:background="@drawable/bg_border_rounded"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView4">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_temperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/temperature"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="normal"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_temperature"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:inputType="numberDecimal"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/edt_temperature" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/ph"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_ph"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:inputType="numberDecimal"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line1" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/edt_ph" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ammonia"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/ammonia"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line2" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_ammonia"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:inputType="numberDecimal"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line2" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/edt_ammonia" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_kh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/kh"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line3" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_kh"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:inputType="numberDecimal"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line3" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/edt_kh" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/gh"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line4" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_gh"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/bg_border_rounded_form"
|
||||
android:textSize="14sp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:inputType="numberDecimal"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line4" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_identified"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/blue_button"
|
||||
android:text="@string/check"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:elevation="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.identification.IdentificationHistoryFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/edit"
|
||||
android:textColor="@color/blue_text"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/identification_history"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_name" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_list_identification"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_history"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_add_identification"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:padding="5dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:src="@drawable/ic_plus"
|
||||
android:background="@drawable/bg_border_rounded_3"
|
||||
android:elevation="10dp"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,276 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.identification.IdentificationResultFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="72dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/bg_border_rounded"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/identification_results"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/water_quality"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hasil"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:text="@string/result"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView5" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_hasil" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/parameter_details"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_temperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/temperature"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_temperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:text="@string/temperature"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_ph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="@string/ph"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail_temperature" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:text="@string/ph"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail_temperature" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_ammonia"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="@string/ammonia"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail_ph" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ammonia"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:text="@string/ammonia"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail_ph" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_kh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="@string/kh"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail_ammonia" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_kh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:text="@string/kh"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail_ammonia" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_gh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="@string/gh"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail_kh" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:text="@string/gh"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_detail_kh" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_detail_gh" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/tips"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_tips"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
android:text="@string/tips"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_tips" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/gray_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_detail_tips" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:text="@string/date"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line3" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.setting.ListArticleFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_aquascape_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/aquascape_info"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_add_aquascape_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/add"
|
||||
android:textColor="@color/blue_text"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_aquascape_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:padding="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,304 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.setting.SettingFragment"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_profile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/profile"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/iv_profile"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:src="@drawable/bg_person_default"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_profile" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_profile" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_email"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/email"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_name" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:paddingVertical="8dp"
|
||||
android:background="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_email">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_edit_profile"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:src="@drawable/ic_user_edit" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/edit_profile"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_more" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewPassword"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:background="@color/gray_2" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_change_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:src="@drawable/ic_password" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/change_password"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_more" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:background="@color/gray_2" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_aquascape_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:src="@drawable/ic_about" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/article"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_more" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:paddingVertical="8dp"
|
||||
android:background="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_language"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:src="@drawable/ic_language" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/language"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_more" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- <View-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="1dp"-->
|
||||
<!-- android:layout_marginTop="7dp"-->
|
||||
<!-- android:background="@color/gray_2" />-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_about_app"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:src="@drawable/ic_about" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/about_application"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_more" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_log_out"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/red"
|
||||
android:elevation="10dp"
|
||||
android:text="@string/log_out"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:cornerRadius="10dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout2" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,207 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.auth.SignInFragment"
|
||||
android:padding="10dp"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="75dp"
|
||||
android:alpha="1"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:alpha="1"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:text="@string/sign_in"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView7" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/emailContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="15dp"
|
||||
app:counterTextColor="@color/black"
|
||||
app:boxStrokeColor="@color/black"
|
||||
app:hintTextColor="@color/black"
|
||||
android:textColorHint="@color/black"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:boxCornerRadiusTopStart="20dp"
|
||||
app:boxCornerRadiusBottomEnd="20dp"
|
||||
app:boxCornerRadiusBottomStart="20dp"
|
||||
app:boxCornerRadiusTopEnd="20dp"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_login">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:lines="1"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/passwordContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:counterTextColor="@color/black"
|
||||
app:boxStrokeColor="@color/black"
|
||||
app:hintTextColor="@color/black"
|
||||
android:textColorHint="@color/black"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
android:alpha="1"
|
||||
app:boxCornerRadiusTopStart="20dp"
|
||||
app:boxCornerRadiusBottomEnd="20dp"
|
||||
app:boxCornerRadiusBottomStart="20dp"
|
||||
app:boxCornerRadiusTopEnd="20dp"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="@color/gray_3"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/emailContainer">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/password"
|
||||
android:inputType="textPassword"
|
||||
android:lines="0"
|
||||
android:textColor="@color/black"
|
||||
android:maxLength="16" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_forgot_password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:alpha="1"
|
||||
android:text="@string/forgot_password"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="@+id/passwordContainer"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintTop_toBottomOf="@+id/passwordContainer"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_login"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/blue_button"
|
||||
android:text="@string/login"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:cornerRadius="15dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_forgot_password" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_continue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:alpha="1"
|
||||
android:text="@string/sign_in_with"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_login"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_login_google"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:alpha="1"
|
||||
android:text="@string/google"
|
||||
android:textColor="@color/white"
|
||||
app:backgroundTint="@color/red_google"
|
||||
app:cornerRadius="15dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_continue"
|
||||
app:layout_constraintVertical_bias="0.035" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_no_acc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:alpha="1"
|
||||
android:text="@string/dont_have_account"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:fontFamily="@font/poppins_regular"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_signup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:alpha="1"
|
||||
android:text="@string/register"
|
||||
android:textColor="@color/blue_button"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/poppins_regular"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.auth.SignUpFragment"
|
||||
android:padding="10dp"
|
||||
android:background="@color/background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_register"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="1"
|
||||
android:text="@string/sign_up"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:layout_marginTop="150dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/nameContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="15dp"
|
||||
app:counterTextColor="@color/black"
|
||||
app:boxStrokeColor="@color/black"
|
||||
app:hintTextColor="@color/black"
|
||||
android:textColorHint="@color/black"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:boxCornerRadiusTopStart="20dp"
|
||||
app:boxCornerRadiusBottomEnd="20dp"
|
||||
app:boxCornerRadiusBottomStart="20dp"
|
||||
app:boxCornerRadiusTopEnd="20dp"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_register">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/name"
|
||||
android:inputType="textEmailAddress"
|
||||
android:lines="1"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/emailContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="5dp"
|
||||
app:counterTextColor="@color/black"
|
||||
app:boxStrokeColor="@color/black"
|
||||
app:hintTextColor="@color/black"
|
||||
android:textColorHint="@color/black"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:boxCornerRadiusTopStart="20dp"
|
||||
app:boxCornerRadiusBottomEnd="20dp"
|
||||
app:boxCornerRadiusBottomStart="20dp"
|
||||
app:boxCornerRadiusTopEnd="20dp"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/nameContainer">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:lines="1"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/passwordContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="5dp"
|
||||
app:counterTextColor="@color/black"
|
||||
app:boxStrokeColor="@color/black"
|
||||
app:hintTextColor="@color/black"
|
||||
android:textColorHint="@color/black"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
android:alpha="1"
|
||||
app:boxCornerRadiusTopStart="20dp"
|
||||
app:boxCornerRadiusBottomEnd="20dp"
|
||||
app:boxCornerRadiusBottomStart="20dp"
|
||||
app:boxCornerRadiusTopEnd="20dp"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="@color/gray_3"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/emailContainer">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/password"
|
||||
android:inputType="textPassword"
|
||||
android:lines="0"
|
||||
android:textColor="@color/black"
|
||||
android:maxLength="16"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/passwordConfirmContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="5dp"
|
||||
app:counterTextColor="@color/black"
|
||||
app:boxStrokeColor="@color/black"
|
||||
app:hintTextColor="@color/black"
|
||||
android:textColorHint="@color/black"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
android:alpha="1"
|
||||
app:boxCornerRadiusTopStart="20dp"
|
||||
app:boxCornerRadiusBottomEnd="20dp"
|
||||
app:boxCornerRadiusBottomStart="20dp"
|
||||
app:boxCornerRadiusTopEnd="20dp"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="@color/gray_3"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/passwordContainer">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_confirm_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/confirm_password"
|
||||
android:inputType="textPassword"
|
||||
android:lines="0"
|
||||
android:textColor="@color/black"
|
||||
android:maxLength="16"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_signup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:alpha="1"
|
||||
android:backgroundTint="@color/blue_button"
|
||||
android:text="@string/sign_up"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:cornerRadius="15dp"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/passwordConfirmContainer" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.8 KiB |