adding custom intake option. and changing all intake values

This commit is contained in:
z3r0c00l-2k 2020-01-20 11:02:50 +05:30
parent 8b7a043258
commit 0561d14b67
3 changed files with 409 additions and 266 deletions

View file

@ -4,11 +4,15 @@ import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.text.TextUtils
import android.util.TypedValue import android.util.TypedValue
import android.view.LayoutInflater
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.daimajia.androidanimations.library.Techniques import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo import com.daimajia.androidanimations.library.YoYo
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.TextInputLayout
import io.github.z3r0c00l_2k.aquadroid.fragments.BottomSheetFragment import io.github.z3r0c00l_2k.aquadroid.fragments.BottomSheetFragment
import io.github.z3r0c00l_2k.aquadroid.helpers.AlarmHelper import io.github.z3r0c00l_2k.aquadroid.helpers.AlarmHelper
import io.github.z3r0c00l_2k.aquadroid.helpers.SqliteHelper import io.github.z3r0c00l_2k.aquadroid.helpers.SqliteHelper
@ -25,7 +29,6 @@ class MainActivity : AppCompatActivity() {
private lateinit var dateNow: String private lateinit var dateNow: String
private var notificStatus: Boolean = false private var notificStatus: Boolean = false
private var selectedOption: Int? = null private var selectedOption: Int? = null
private var selectedOptionName: String? = null
private var snackbar: Snackbar? = null private var snackbar: Snackbar? = null
private var doubleBackToExitPressedOnce = false private var doubleBackToExitPressedOnce = false
@ -55,13 +58,20 @@ class MainActivity : AppCompatActivity() {
super.onStart() super.onStart()
val outValue = TypedValue() val outValue = TypedValue()
applicationContext.theme.resolveAttribute(android.R.attr.selectableItemBackground, outValue, true) applicationContext.theme.resolveAttribute(
android.R.attr.selectableItemBackground,
outValue,
true
)
notificStatus = sharedPref.getBoolean(AppUtils.NOTIFICATION_STATUS_KEY, true) notificStatus = sharedPref.getBoolean(AppUtils.NOTIFICATION_STATUS_KEY, true)
val alarm = AlarmHelper() val alarm = AlarmHelper()
if (!alarm.checkAlarm(this) && notificStatus) { if (!alarm.checkAlarm(this) && notificStatus) {
btnNotific.setImageDrawable(getDrawable(R.drawable.ic_bell)) btnNotific.setImageDrawable(getDrawable(R.drawable.ic_bell))
alarm.setAlarm(this, sharedPref.getInt(AppUtils.NOTIFICATION_FREQUENCY_KEY, 30).toLong()) alarm.setAlarm(
this,
sharedPref.getInt(AppUtils.NOTIFICATION_FREQUENCY_KEY, 30).toLong()
)
} }
if (notificStatus) { if (notificStatus) {
@ -82,26 +92,27 @@ class MainActivity : AppCompatActivity() {
} }
fabAdd.setOnClickListener { fabAdd.setOnClickListener {
if (selectedOption != null && selectedOptionName != null) { if (selectedOption != null) {
if ((inTook * 100 / totalIntake) <= 140) { if ((inTook * 100 / totalIntake) <= 140) {
if (sqliteHelper.addIntook(dateNow, selectedOption!!) > 0) { if (sqliteHelper.addIntook(dateNow, selectedOption!!) > 0) {
inTook += selectedOption!! inTook += selectedOption!!
setWaterLevel(inTook, totalIntake) setWaterLevel(inTook, totalIntake)
Snackbar.make(it, "Your water intake was saved...!!", Snackbar.LENGTH_SHORT).show() Snackbar.make(it, "Your water intake was saved...!!", Snackbar.LENGTH_SHORT)
.show()
} }
} else { } else {
Snackbar.make(it, "You already achieved the goal", Snackbar.LENGTH_SHORT).show() Snackbar.make(it, "You already achieved the goal", Snackbar.LENGTH_SHORT).show()
} }
selectedOption = null selectedOption = null
selectedOptionName = null tvCustom.text = "Custom"
opAqua.background = getDrawable(outValue.resourceId) op50ml.background = getDrawable(outValue.resourceId)
opCoffee.background = getDrawable(outValue.resourceId) op100ml.background = getDrawable(outValue.resourceId)
opTea.background = getDrawable(outValue.resourceId) op150ml.background = getDrawable(outValue.resourceId)
opSoftDrink.background = getDrawable(outValue.resourceId) op200ml.background = getDrawable(outValue.resourceId)
opJuice.background = getDrawable(outValue.resourceId) op250ml.background = getDrawable(outValue.resourceId)
opMilk.background = getDrawable(outValue.resourceId) opCustom.background = getDrawable(outValue.resourceId)
} else { } else {
YoYo.with(Techniques.Shake) YoYo.with(Techniques.Shake)
.duration(700) .duration(700)
@ -116,7 +127,10 @@ class MainActivity : AppCompatActivity() {
if (notificStatus) { if (notificStatus) {
btnNotific.setImageDrawable(getDrawable(R.drawable.ic_bell)) btnNotific.setImageDrawable(getDrawable(R.drawable.ic_bell))
Snackbar.make(it, "Notification Enabled..", Snackbar.LENGTH_SHORT).show() Snackbar.make(it, "Notification Enabled..", Snackbar.LENGTH_SHORT).show()
alarm.setAlarm(this, sharedPref.getInt(AppUtils.NOTIFICATION_FREQUENCY_KEY, 30).toLong()) alarm.setAlarm(
this,
sharedPref.getInt(AppUtils.NOTIFICATION_FREQUENCY_KEY, 30).toLong()
)
} else { } else {
btnNotific.setImageDrawable(getDrawable(R.drawable.ic_bell_disabled)) btnNotific.setImageDrawable(getDrawable(R.drawable.ic_bell_disabled))
Snackbar.make(it, "Notification Disabled..", Snackbar.LENGTH_SHORT).show() Snackbar.make(it, "Notification Disabled..", Snackbar.LENGTH_SHORT).show()
@ -129,93 +143,109 @@ class MainActivity : AppCompatActivity() {
} }
opAqua.setOnClickListener { op50ml.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
selectedOption = 200
selectedOptionName = "Aqua"
opAqua.background = getDrawable(R.drawable.option_select_bg)
opCoffee.background = getDrawable(outValue.resourceId)
opTea.background = getDrawable(outValue.resourceId)
opSoftDrink.background = getDrawable(outValue.resourceId)
opJuice.background = getDrawable(outValue.resourceId)
opMilk.background = getDrawable(outValue.resourceId)
}
opCoffee.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
selectedOption = 150
selectedOptionName = "Coffee"
opAqua.background = getDrawable(outValue.resourceId)
opCoffee.background = getDrawable(R.drawable.option_select_bg)
opTea.background = getDrawable(outValue.resourceId)
opSoftDrink.background = getDrawable(outValue.resourceId)
opJuice.background = getDrawable(outValue.resourceId)
opMilk.background = getDrawable(outValue.resourceId)
}
opTea.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
selectedOption = 150
selectedOptionName = "Tea"
opAqua.background = getDrawable(outValue.resourceId)
opCoffee.background = getDrawable(outValue.resourceId)
opTea.background = getDrawable(R.drawable.option_select_bg)
opSoftDrink.background = getDrawable(outValue.resourceId)
opJuice.background = getDrawable(outValue.resourceId)
opMilk.background = getDrawable(outValue.resourceId)
}
opSoftDrink.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
selectedOption = 200
selectedOptionName = "Soft Drink"
opAqua.background = getDrawable(outValue.resourceId)
opCoffee.background = getDrawable(outValue.resourceId)
opTea.background = getDrawable(outValue.resourceId)
opSoftDrink.background = getDrawable(R.drawable.option_select_bg)
opJuice.background = getDrawable(outValue.resourceId)
opMilk.background = getDrawable(outValue.resourceId)
}
opJuice.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
selectedOption = 200
selectedOptionName = "Juice"
opAqua.background = getDrawable(outValue.resourceId)
opCoffee.background = getDrawable(outValue.resourceId)
opTea.background = getDrawable(outValue.resourceId)
opSoftDrink.background = getDrawable(outValue.resourceId)
opJuice.background = getDrawable(R.drawable.option_select_bg)
opMilk.background = getDrawable(outValue.resourceId)
}
opMilk.setOnClickListener {
if (snackbar != null) { if (snackbar != null) {
snackbar?.dismiss() snackbar?.dismiss()
} }
selectedOption = 50 selectedOption = 50
selectedOptionName = "Milk" op50ml.background = getDrawable(R.drawable.option_select_bg)
opAqua.background = getDrawable(outValue.resourceId) op100ml.background = getDrawable(outValue.resourceId)
opCoffee.background = getDrawable(outValue.resourceId) op150ml.background = getDrawable(outValue.resourceId)
opTea.background = getDrawable(outValue.resourceId) op200ml.background = getDrawable(outValue.resourceId)
opSoftDrink.background = getDrawable(outValue.resourceId) op250ml.background = getDrawable(outValue.resourceId)
opJuice.background = getDrawable(outValue.resourceId) opCustom.background = getDrawable(outValue.resourceId)
opMilk.background = getDrawable(R.drawable.option_select_bg)
}
op100ml.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
selectedOption = 100
op50ml.background = getDrawable(outValue.resourceId)
op100ml.background = getDrawable(R.drawable.option_select_bg)
op150ml.background = getDrawable(outValue.resourceId)
op200ml.background = getDrawable(outValue.resourceId)
op250ml.background = getDrawable(outValue.resourceId)
opCustom.background = getDrawable(outValue.resourceId)
}
op150ml.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
selectedOption = 150
op50ml.background = getDrawable(outValue.resourceId)
op100ml.background = getDrawable(outValue.resourceId)
op150ml.background = getDrawable(R.drawable.option_select_bg)
op200ml.background = getDrawable(outValue.resourceId)
op250ml.background = getDrawable(outValue.resourceId)
opCustom.background = getDrawable(outValue.resourceId)
}
op200ml.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
selectedOption = 200
op50ml.background = getDrawable(outValue.resourceId)
op100ml.background = getDrawable(outValue.resourceId)
op150ml.background = getDrawable(outValue.resourceId)
op200ml.background = getDrawable(R.drawable.option_select_bg)
op250ml.background = getDrawable(outValue.resourceId)
opCustom.background = getDrawable(outValue.resourceId)
}
op250ml.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
selectedOption = 250
op50ml.background = getDrawable(outValue.resourceId)
op100ml.background = getDrawable(outValue.resourceId)
op150ml.background = getDrawable(outValue.resourceId)
op200ml.background = getDrawable(outValue.resourceId)
op250ml.background = getDrawable(R.drawable.option_select_bg)
opCustom.background = getDrawable(outValue.resourceId)
}
opCustom.setOnClickListener {
if (snackbar != null) {
snackbar?.dismiss()
}
val li = LayoutInflater.from(this)
val promptsView = li.inflate(R.layout.custom_input_dialog, null)
val alertDialogBuilder = AlertDialog.Builder(this)
alertDialogBuilder.setView(promptsView)
val userInput = promptsView
.findViewById(R.id.etCustomInput) as TextInputLayout
alertDialogBuilder.setPositiveButton("OK") { dialog, id ->
val inputText = userInput.editText!!.text.toString()
if (!TextUtils.isEmpty(inputText)) {
tvCustom.text = "${inputText} ml"
selectedOption = inputText.toInt()
}
}.setNegativeButton("Cancel") { dialog, id ->
dialog.cancel()
}
val alertDialog = alertDialogBuilder.create()
alertDialog.show()
op50ml.background = getDrawable(outValue.resourceId)
op100ml.background = getDrawable(outValue.resourceId)
op150ml.background = getDrawable(outValue.resourceId)
op200ml.background = getDrawable(outValue.resourceId)
op250ml.background = getDrawable(outValue.resourceId)
opCustom.background = getDrawable(R.drawable.option_select_bg)
} }
@ -235,7 +265,8 @@ class MainActivity : AppCompatActivity() {
.playOn(intakeProgress) .playOn(intakeProgress)
intakeProgress.currentProgress = progress intakeProgress.currentProgress = progress
if ((inTook * 100 / totalIntake) > 140) { if ((inTook * 100 / totalIntake) > 140) {
Snackbar.make(main_activity_parent, "You achieved the goal", Snackbar.LENGTH_SHORT).show() Snackbar.make(main_activity_parent, "You achieved the goal", Snackbar.LENGTH_SHORT)
.show()
} }
} }

View file

@ -1,269 +1,361 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
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" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_activity_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/main_activity_parent"
android:background="@drawable/ic_app_bg" android:background="@drawable/ic_app_bg"
tools:context=".MainActivity"> tools:context=".MainActivity">
<ImageView <ImageView
android:id="@+id/btnMenu"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:padding="8dp"
android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_settings"
android:id="@+id/btnMenu"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent" android:layout_marginEnd="8dp"
android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent"/> android:background="?attr/selectableItemBackground"
android:padding="8dp"
android:src="@drawable/ic_settings"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnNotific"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:padding="8dp" android:padding="8dp"
android:src="@drawable/ic_bell" android:src="@drawable/ic_bell"
android:id="@+id/btnNotific"
app:fabSize="mini" app:fabSize="mini"
android:layout_marginStart="8dp" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" android:layout_marginEnd="8dp" app:layout_constraintEnd_toStartOf="@+id/fabAdd"
app:layout_constraintEnd_toStartOf="@+id/fabAdd" android:layout_marginBottom="8dp" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/cardView" /> app:layout_constraintTop_toBottomOf="@+id/cardView" />
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnStats"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:padding="8dp" android:padding="8dp"
android:src="@drawable/ic_stats" android:src="@drawable/ic_stats"
app:fabSize="mini" app:fabSize="mini"
android:id="@+id/btnStats" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/fabAdd" app:layout_constraintStart_toEndOf="@+id/fabAdd"
android:layout_marginStart="8dp" android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/cardView" />
android:layout_marginBottom="8dp" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="8dp" app:layout_constraintTop_toBottomOf="@+id/cardView"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true" app:srcCompat="@drawable/ic_plus_solid"
android:id="@+id/fabAdd" android:id="@+id/fabAdd"
app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginStart="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cardView" android:layout_marginTop="8dp"/>
<TextView
android:text="Daily Drink Target"
android:textSize="20sp"
android:textColor="@color/colorWhite"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/textView5" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="24dp" android:layout_marginStart="8dp"
app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="16dp"/> android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:clickable="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cardView"
app:srcCompat="@drawable/ic_plus_solid" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:text="Daily Drink Target"
android:textColor="@color/colorWhite"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="24dp"
android:layout_marginTop="60dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="140dp"
app:layout_constraintBottom_toBottomOf="parent"
app:cardCornerRadius="8dp" app:cardCornerRadius="8dp"
app:cardElevation="8dp" app:cardElevation="8dp"
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="24dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="24dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHeight_max="300dp"
app:layout_constraintTop_toBottomOf="@+id/intakeProgress" app:layout_constraintStart_toStartOf="parent"
android:id="@+id/cardView" app:layout_constraintTop_toBottomOf="@+id/intakeProgress">
app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="140dp"
android:layout_marginTop="60dp">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<View style="@style/DividerHorizontal" app:layout_constraintStart_toStartOf="parent"
<View
style="@style/DividerHorizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/constraintLayout2" /> app:layout_constraintTop_toBottomOf="@id/constraintLayout2" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:orientation="horizontal"
android:layout_width="0dp"
android:layout_height="0dp" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/constraintLayout2" android:id="@+id/constraintLayout2"
app:layout_constraintBottom_toTopOf="@+id/constraintLayout3" android:layout_width="0dp"
app:layout_constraintEnd_toEndOf="parent"> android:layout_height="0dp"
<LinearLayout android:layout_width="0dp" android:gravity="center" android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/constraintLayout3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="@+id/op50ml"
android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:clickable="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:orientation="vertical" app:layout_constraintStart_toStartOf="parent" android:clickable="true"
app:layout_constraintTop_toTopOf="parent" android:id="@+id/opAqua" android:gravity="center"
app:layout_constraintEnd_toStartOf="@+id/opCoffee" android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/op100ml"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_water_glass" /> android:src="@drawable/ic_water_glass" />
<TextView <TextView
android:textColor="@color/colorBlack" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="50 ml"
android:text="200 ml"/> android:textColor="@color/colorBlack" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Aqua"/>
</LinearLayout> </LinearLayout>
<View style="@style/DividerVertical" app:layout_constraintStart_toEndOf="@id/opAqua"
<View
style="@style/DividerVertical"
app:layout_constraintStart_toEndOf="@id/op50ml"
app:layout_constraintTop_toBottomOf="parent" /> app:layout_constraintTop_toBottomOf="parent" />
<View style="@style/DividerVertical" app:layout_constraintStart_toEndOf="@id/opCoffee"
<View
style="@style/DividerVertical"
app:layout_constraintStart_toEndOf="@id/op100ml"
app:layout_constraintTop_toBottomOf="parent" /> app:layout_constraintTop_toBottomOf="parent" />
<LinearLayout android:layout_width="0dp" android:gravity="center"
<LinearLayout
android:id="@+id/op100ml"
android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:clickable="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:clickable="true"
android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/opAqua" app:layout_constraintEnd_toStartOf="@+id/op150ml"
android:id="@+id/opCoffee" app:layout_constraintEnd_toStartOf="@+id/opTea" app:layout_constraintStart_toEndOf="@+id/op50ml"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_coffee_cup" /> app:srcCompat="@drawable/ic_coffee_cup" />
<TextView <TextView
android:textColor="@color/colorBlack" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="100 ml"
android:text="150 ml"/> android:textColor="@color/colorBlack" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Coffee"/>
</LinearLayout> </LinearLayout>
<LinearLayout android:layout_width="0dp" android:gravity="center"
<LinearLayout
android:id="@+id/op150ml"
android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:orientation="vertical"
android:clickable="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
app:layout_constraintTop_toTopOf="parent" android:clickable="true"
app:layout_constraintStart_toEndOf="@+id/opCoffee" android:gravity="center"
app:layout_constraintEnd_toEndOf="parent" android:id="@+id/opTea" android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/op100ml"
app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_tea" /> app:srcCompat="@drawable/ic_tea" />
<TextView <TextView
android:textColor="@color/colorBlack" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="150 ml"
android:text="150 ml"/> android:textColor="@color/colorBlack" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Tea"/>
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:orientation="horizontal"
android:layout_width="0dp"
android:layout_height="0dp" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2"
android:id="@+id/constraintLayout3" android:id="@+id/constraintLayout3"
app:layout_constraintBottom_toBottomOf="parent"> android:layout_width="0dp"
<View style="@style/DividerVertical" app:layout_constraintStart_toEndOf="@id/opSoftDrink" android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="parent"/> android:orientation="horizontal"
<View style="@style/DividerVertical" app:layout_constraintStart_toEndOf="@id/opJuice" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="parent"/> app:layout_constraintEnd_toEndOf="parent"
<LinearLayout android:layout_width="0dp" android:gravity="center" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2">
<View
style="@style/DividerVertical"
app:layout_constraintStart_toEndOf="@id/op200ml"
app:layout_constraintTop_toBottomOf="parent" />
<View
style="@style/DividerVertical"
app:layout_constraintStart_toEndOf="@id/op250ml"
app:layout_constraintTop_toBottomOf="parent" />
<LinearLayout
android:id="@+id/op200ml"
android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:clickable="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:orientation="vertical" app:layout_constraintStart_toStartOf="parent" android:clickable="true"
app:layout_constraintTop_toTopOf="parent" android:id="@+id/opSoftDrink" android:gravity="center"
app:layout_constraintEnd_toStartOf="@+id/opJuice" android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/op250ml"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_cola" /> app:srcCompat="@drawable/ic_cola" />
<TextView <TextView
android:textColor="@color/colorBlack" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="200 ml"
android:text="200 ml"/> android:textColor="@color/colorBlack" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Soft Drink"/>
</LinearLayout> </LinearLayout>
<LinearLayout android:layout_width="0dp" android:gravity="center"
<LinearLayout
android:id="@+id/op250ml"
android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:orientation="vertical"
android:clickable="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
app:layout_constraintTop_toTopOf="parent" android:clickable="true"
app:layout_constraintStart_toEndOf="@+id/opSoftDrink" android:gravity="center"
android:id="@+id/opJuice" app:layout_constraintEnd_toStartOf="@+id/opMilk" android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/opCustom"
app:layout_constraintStart_toEndOf="@+id/op200ml"
app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_juice" /> app:srcCompat="@drawable/ic_juice" />
<TextView <TextView
android:textColor="@color/colorBlack" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="250 ml"
android:text="200 ml"/> android:textColor="@color/colorBlack" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Juice"/>
</LinearLayout> </LinearLayout>
<LinearLayout android:layout_width="0dp" android:gravity="center"
<LinearLayout
android:id="@+id/opCustom"
android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:clickable="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:clickable="true"
android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/opJuice" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toEndOf="parent" android:id="@+id/opMilk" app:layout_constraintStart_toEndOf="@+id/op250ml"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_milk" /> app:srcCompat="@drawable/ic_milk" />
<TextView <TextView
android:textColor="@color/colorBlack" android:id="@+id/tvCustom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Custom"
android:text="50 ml"/> android:textColor="@color/colorBlack" />
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Milk"/>
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<params.com.stepprogressview.StepProgressView <params.com.stepprogressview.StepProgressView
android:id="@+id/intakeProgress"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:progressBarHeight="10dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
app:markerColor="@color/colorSkyBlue" android:layout_marginStart="24dp"
app:markers="100" android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:maxWidth="5dp" android:maxWidth="5dp"
app:currentProgress="60" app:currentProgress="60"
app:totalProgress="130" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvIntook"
app:markerColor="@color/colorSkyBlue"
app:markers="100"
app:progressBackgroundColor="#43F69F"
app:progressBarHeight="10dp"
app:progressColor="@color/colorWhite"
app:textColor="@color/colorWhite"
app:textMargin="5dp" app:textMargin="5dp"
app:textSize="15sp" app:textSize="15sp"
app:textColor="@color/colorWhite" app:totalProgress="130" />
app:progressBackgroundColor="#43F69F"
app:progressColor="@color/colorWhite"
android:id="@+id/intakeProgress" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="24dp" app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="24dp" app:layout_constraintTop_toBottomOf="@+id/tvIntook"
android:layout_marginTop="16dp"/>
<TextView <TextView
android:id="@+id/tvIntook"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:text="2000" android:text="2000"
android:textColor="@color/colorWhite" android:textColor="@color/colorWhite"
android:textSize="35sp" android:textSize="35sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView5" />
<TextView
android:id="@+id/tvTotalIntake"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/tvIntook" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="4dp"
android:layout_marginStart="24dp" android:layout_marginTop="16dp" android:layout_marginBottom="4dp"
app:layout_constraintTop_toBottomOf="@+id/textView5"/>
<TextView
android:text="/3500 ml" android:text="/3500 ml"
android:textColor="@color/colorWhite" android:textColor="@color/colorWhite"
android:textSize="25sp" android:textSize="25sp"
android:layout_width="wrap_content" app:layout_constraintBottom_toBottomOf="@+id/tvIntook"
android:layout_height="wrap_content" app:layout_constraintStart_toEndOf="@+id/tvIntook" />
android:id="@+id/tvTotalIntake" app:layout_constraintStart_toEndOf="@+id/tvIntook"
android:layout_marginStart="4dp" android:layout_marginBottom="4dp"
app:layout_constraintBottom_toBottomOf="@+id/tvIntook"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/etCustomInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Custom Input"
android:inputType="numberSigned" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.cardview.widget.CardView>