V1.0.0(1) 无Ad版本

This commit is contained in:
litingting 2024-04-16 18:29:10 +08:00
commit 5f0d8a058b
85 changed files with 2654 additions and 0 deletions

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
*.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
.idea/
app/release/

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

BIN
app/DrinkWater.jks Normal file

Binary file not shown.

3
app/SignInfo Normal file
View File

@ -0,0 +1,3 @@
签名文件:DrinkWater.jks
别名:DrinkWaterkey0
密码:DrinkWater

56
app/build.gradle.kts Normal file
View File

@ -0,0 +1,56 @@
import java.util.Date
import java.text.SimpleDateFormat
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id ("kotlin-kapt")
}
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android {
namespace = "com.drink.water.test"
compileSdk = 34
defaultConfig {
applicationId = "com.drink.water.test"
minSdk = 23
targetSdk = 34
versionCode = 1
versionName = "1.0.0"
setProperty("archivesBaseName", "DrinkWater_V" + versionName + "(${versionCode})_$timestamp")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures{
viewBinding = true
}
}
dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
implementation ("androidx.room:room-ktx:2.6.1")
implementation ("androidx.room:room-runtime:2.6.1")
kapt ("androidx.room:room-compiler:2.6.1")
}

35
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,35 @@
# 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
-keep class com.drink.water.test.roombean.** {*;}
-dontwarn com.drink.water.test.roombean.**
-keep class com.drink.water.test.room.** {*;}
-dontwarn com.drink.water.test.room.**
#room
-keepclassmembers class com.drink.water.test.utls.ConstStr{
public static final java.lang.String room_name;
public static final int room_version;
}
-keepclassmembers class *{
@androidx.room.Query <methods>;
}

View File

@ -0,0 +1,24 @@
package com.drink.water.test
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.drink.water.test", appContext.packageName)
}
}

View File

@ -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"/>
<application
android:name=".DrinkWater"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/logo"
android:label="@string/app_name"
android:roundIcon="@mipmap/logo"
android:supportsRtl="true"
android:theme="@style/Theme.DrinkWater"
tools:targetApi="31">
<activity
android:name=".GenderActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".LauncherActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Binary file not shown.

View File

@ -0,0 +1,20 @@
package com.drink.water.test
import android.app.Application
import android.content.Context
import android.graphics.Typeface
class DrinkWater :Application() {
companion object{
public lateinit var appContext: Context
lateinit var textFont: Typeface
}
override fun onCreate() {
super.onCreate()
appContext = this
textFont = Typeface.createFromAsset(assets, "font_medium.ttf")
}
}

View File

@ -0,0 +1,56 @@
package com.drink.water.test
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.drink.water.test.databinding.ActivityGenderBinding
import com.drink.water.test.utls.SharePreference
class GenderActivity : AppCompatActivity() {
private lateinit var binding: ActivityGenderBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityGenderBinding.inflate(layoutInflater)
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
setContentView(binding.root)
onUI()
onGender()
binding.imageViewBack.setOnClickListener {
finish()
}
binding.tvSave.setOnClickListener {
SharePreference.run {
saveGender(binding.tvGirls.isSelected)
saveWeight(binding.etWeight.text.toString().toInt())
}
startActivity(Intent(this, MainActivity::class.java))
finish()
}
}
private fun onUI() {
val gender = SharePreference.getGender()
val weight = SharePreference.getWeight()
binding.tvGirls.isSelected = gender
binding.tvBoys.isSelected = !gender
binding.etWeight.setText(weight.toString())
}
private fun onGender() {
binding.imGirls.setOnClickListener {
binding.tvBoys.isSelected = false
binding.tvGirls.isSelected = true
}
binding.imBoy.setOnClickListener {
binding.tvBoys.isSelected = true
binding.tvGirls.isSelected = false
}
}
}

View File

@ -0,0 +1,50 @@
package com.drink.water.test
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.CountDownTimer
import android.view.View
import android.widget.TextView
import com.drink.water.test.utls.SharePreference
class LauncherActivity : AppCompatActivity() {
private lateinit var tvHi: TextView
private lateinit var countDownTimer: CountDownTimer
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
setContentView(R.layout.activity_launcher)
tvHi = findViewById(R.id.tv_hi)
onUI()
goCount()
}
fun onUI() {
tvHi.typeface = DrinkWater.textFont
countDownTimer = object : CountDownTimer(2000, 1000) {
override fun onTick(millisUntilFinished: Long) {
}
override fun onFinish() {
val isFirst = SharePreference.getIsFirst()
if(isFirst){
SharePreference.saveIsFirst()
startActivity(Intent(this@LauncherActivity,GenderActivity::class.java))
}else{
startActivity(Intent(this@LauncherActivity,MainActivity::class.java))
}
finish()
}
}
}
fun goCount() {
countDownTimer.start()
}
}

View File

@ -0,0 +1,146 @@
package com.drink.water.test
import android.annotation.SuppressLint
import android.graphics.drawable.Drawable
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.ImageView
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.ViewPager
import androidx.viewpager.widget.ViewPager.OnPageChangeListener
import com.drink.water.test.databinding.TabCustomViewBinding
import com.drink.water.test.fragments.HomeFragment
import com.drink.water.test.fragments.RecordFragment
import com.drink.water.test.fragments.SettingsFragment
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener
class MainActivity : AppCompatActivity() {
private lateinit var tabLayout: TabLayout
private lateinit var viewPager: ViewPager
private lateinit var strings: MutableList<String>
private lateinit var mutableListOf: MutableList<Fragment>
private lateinit var tabsIcons :MutableList<Drawable?>
@SuppressLint("MissingInflatedId")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
setContentView(R.layout.activity_main)
tabLayout = findViewById(R.id.tab_layout)
viewPager = findViewById(R.id.view_pager)
strings = mutableListOf(
getString(R.string.tab_name_home),
getString(R.string.tab_name_records),
getString(R.string.tab_name_set)
)
mutableListOf = mutableListOf<Fragment>(
HomeFragment.newInstance(),
RecordFragment.newInstance(),
SettingsFragment.newInstance()
)
tabsIcons = mutableListOf(ContextCompat.getDrawable(this@MainActivity,R.drawable.selector_tab_home),
ContextCompat.getDrawable(this@MainActivity,R.drawable.selector_tab_record),
ContextCompat.getDrawable(this@MainActivity,R.drawable.selector_tab_settings))
onUI()
onViewPager()
}
private fun onUI() {
mutableListOf.forEachIndexed { i, v ->
val newTab = tabLayout.newTab()
newTab.customView = TabCustomViewBinding.inflate(layoutInflater).root.apply {
findViewById<ImageView>(R.id.image_view_tab).let {
it.setImageDrawable(tabsIcons[i])
}
}
tabLayout.addTab(newTab)
}
tabLayout.addOnTabSelectedListener(object :OnTabSelectedListener{
override fun onTabSelected(tab: TabLayout.Tab?) {
if (tab != null) {
viewPager.currentItem = tab.position
when(tab.position){
0->{
val homeFragment = mutableListOf[0] as HomeFragment
homeFragment.updatePersonal()
}
1->{
val recordFragment = mutableListOf[1] as RecordFragment
recordFragment.updateRecordList()
}
2->{
val settingsFragment = mutableListOf[2] as SettingsFragment
settingsFragment.updateInfo()
}
}
}
}
override fun onTabUnselected(tab: TabLayout.Tab?) {
}
override fun onTabReselected(tab: TabLayout.Tab?) {
}
})
}
private fun onViewPager() {
viewPager.run {
addOnPageChangeListener(object : OnPageChangeListener {
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) {
}
override fun onPageSelected(position: Int) {
tabLayout.getTabAt(position)?.select()
}
override fun onPageScrollStateChanged(state: Int) {
}
})
adapter = object : FragmentStatePagerAdapter(supportFragmentManager) {
override fun getCount(): Int {
return mutableListOf.size
}
override fun getItem(position: Int): Fragment {
return mutableListOf[position]
}
}
}
}
}

View File

@ -0,0 +1,156 @@
package com.drink.water.test.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import com.drink.water.test.R
import com.drink.water.test.databinding.FragmentHomeBinding
import com.drink.water.test.room.RoomBase
import com.drink.water.test.roombean.WaterRecord
import com.drink.water.test.utls.SharePreference
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.util.Calendar
class HomeFragment : Fragment() {
private lateinit var binding: FragmentHomeBinding
private var selectDrink: Int = 100
private var todayDrink: Int = 0
private var todayTimeKey :Long = 0L
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// arguments?.let {
// param1 = it.getString(ARG_PARAM1)
// param2 = it.getString(ARG_PARAM2)
// }
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentHomeBinding.inflate(layoutInflater)
val instance = Calendar.getInstance()
val year = instance.get(Calendar.YEAR)
val month = instance.get(Calendar.MONTH)+1
val day = instance.get(Calendar.DAY_OF_MONTH)
instance.set(Calendar.HOUR_OF_DAY, 0)
instance.set(Calendar.MINUTE, 0)
instance.set(Calendar.SECOND, 0)
instance.set(Calendar.MILLISECOND, 0)
todayTimeKey = instance.timeInMillis
onUI()
onClick()
return binding.root
}
private fun updateToday() {
todayDrink = SharePreference.getTodayDrink()
binding.textViewDrunk.text = String.format(getString(R.string.text_ml), todayDrink)
}
private fun onUI() {
updateToday()
updatePersonal()
}
fun updatePersonal(){
val gender = SharePreference.getGender()
val weight = SharePreference.getWeight()
binding.textViewToday.text = String.format(getString(R.string.text_ml), weight * 40)
if (gender) {
binding.imageViewHeader.setImageDrawable(
ContextCompat.getDrawable(
requireContext(),
R.mipmap.girls
)
)
} else {
binding.imageViewHeader.setImageDrawable(
ContextCompat.getDrawable(
requireContext(),
R.mipmap.boys
)
)
}
}
private fun onClick() {
binding.radioGroup.setOnCheckedChangeListener { group, checkedId ->
when (checkedId) {
R.id.rb_1 -> {
selectDrink = 100
}
R.id.rb_2 -> {
selectDrink = 200
}
R.id.rb_3 -> {
selectDrink = 300
}
R.id.rb_4 -> {
selectDrink = 400
}
R.id.rb_5 -> {
selectDrink = 500
}
}
}
binding.textTodayAdd.setOnClickListener {
todayDrink += selectDrink
SharePreference.saveTodayDrink(todayDrink)
addDrinkRecord(selectDrink)
updateToday()
}
}
private fun addDrinkRecord(drink: Int) {
CoroutineScope(Dispatchers.IO).launch {
RoomBase.database.getRoomDao().addRecord(
WaterRecord(
timeKey = todayTimeKey,
time = System.currentTimeMillis(),
capacity = drink
)
)
}
}
companion object {
@JvmStatic
fun newInstance() =
HomeFragment().apply {
// arguments = Bundle().apply {
// putString(ARG_PARAM1, param1)
// putString(ARG_PARAM2, param2)
// }
}
}
}

View File

@ -0,0 +1,160 @@
package com.drink.water.test.fragments
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.RadioButton
import androidx.core.view.forEachIndexed
import androidx.recyclerview.widget.LinearLayoutManager
import com.drink.water.test.R
import com.drink.water.test.databinding.FragmentRecordBinding
import com.drink.water.test.room.RoomBase
import com.drink.water.test.utls.RecordAdapter
import com.drink.water.test.utls.Utils
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.Calendar
class RecordFragment : Fragment() {
private lateinit var binding: FragmentRecordBinding
private var timeKey: MutableList<Long> = mutableListOf()
private lateinit var adapter: RecordAdapter
private var curSelectTimkey = 0L
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentRecordBinding.inflate(layoutInflater)
onUI()
curSelectTimkey = timeKey[0]
onList()
updateRecordList()
onClick()
return binding.root
}
private fun onUI() {
var strList = mutableListOf<String>()
val instance = Calendar.getInstance()
val year = instance.get(Calendar.YEAR)
val month = instance.get(Calendar.MONTH) + 1
val day = instance.get(Calendar.DAY_OF_MONTH)
val month1 = Utils.getMonth(month, day)
timeKey.add(getTimeKey(instance))
strList.add(month1)
val beforeDate1 = Utils.beforeDate(-1)
val beforeDate2 = Utils.beforeDate(-2)
val beforeDate3 = Utils.beforeDate(-3)
val beforeDate4 = Utils.beforeDate(-4)
instance.timeInMillis = beforeDate1
timeKey.add(getTimeKey(instance))
strList.add(getStr(instance))
instance.timeInMillis = beforeDate2
timeKey.add(getTimeKey(instance))
strList.add(getStr(instance))
instance.timeInMillis = beforeDate3
timeKey.add(getTimeKey(instance))
strList.add(getStr(instance))
instance.timeInMillis = beforeDate4
timeKey.add(getTimeKey(instance))
strList.add(getStr(instance))
binding.radioGroup.forEachIndexed { index, view ->
view as RadioButton
view.text = strList[index]
}
}
private fun onClick(){
binding.radioGroup.setOnCheckedChangeListener { group, checkedId ->
when(checkedId){
R.id.rb1-> curSelectTimkey = timeKey[0]
R.id.rb2-> curSelectTimkey = timeKey[1]
R.id.rb3-> curSelectTimkey = timeKey[2]
R.id.rb4-> curSelectTimkey = timeKey[3]
R.id.rb5-> curSelectTimkey = timeKey[4]
}
updateRecordList()
}
}
private fun onList() {
adapter = RecordAdapter(requireContext())
binding.recyclerViewRecord.adapter = adapter
binding.recyclerViewRecord.layoutManager = LinearLayoutManager(requireContext())
}
fun updateRecordList(){
CoroutineScope(Dispatchers.IO).launch{
val waterRecord = RoomBase.database.getRoomDao().getWaterRecord(curSelectTimkey)
withContext(Dispatchers.Main){
adapter.updateRecord(waterRecord)
}
}
}
private fun getStr(calendar: Calendar): String {
val month = calendar.get(Calendar.MONTH) + 1
val day = calendar.get(Calendar.DAY_OF_MONTH)
return Utils.getMonth(month, day)
}
private fun getTimeKey(calendar: Calendar): Long {
calendar.set(Calendar.HOUR_OF_DAY, 0)
calendar.set(Calendar.MINUTE, 0)
calendar.set(Calendar.SECOND, 0)
calendar.set(Calendar.MILLISECOND, 0)
return calendar.timeInMillis
}
companion object {
@JvmStatic
fun newInstance() =
RecordFragment().apply {
arguments = Bundle().apply {
}
}
}
}

View File

@ -0,0 +1,87 @@
package com.drink.water.test.fragments
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import com.drink.water.test.GenderActivity
import com.drink.water.test.R
import com.drink.water.test.databinding.FragmentSettingsBinding
import com.drink.water.test.utls.SharePreference
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"
/**
* A simple [Fragment] subclass.
* Use the [SettingsFragment.newInstance] factory method to
* create an instance of this fragment.
*/
class SettingsFragment : Fragment() {
private lateinit var binging: FragmentSettingsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binging = FragmentSettingsBinding.inflate(layoutInflater)
onUI()
return binging.root
}
private fun onUI() {
updateInfo()
binging.cardViewSet.setOnClickListener {
startActivity(Intent(requireContext(), GenderActivity::class.java))
}
}
fun updateInfo(){
val gender = SharePreference.getGender()
val weight = SharePreference.getWeight()
binging.textViewWeight.text = "${getString(R.string.text_weight)}:$weight kg"
if (gender) {
binging.textViewGender.text = "${getString(R.string.text_gender)}:girl"
binging.imageViewHeader.setImageDrawable(
ContextCompat.getDrawable(
requireContext(),
R.mipmap.girls
)
)
} else {
binging.textViewGender.text = "${getString(R.string.text_gender)}:boy"
binging.imageViewHeader.setImageDrawable(
ContextCompat.getDrawable(
requireContext(),
R.mipmap.boys
)
)
}
}
companion object {
@JvmStatic
fun newInstance() =
SettingsFragment().apply {
arguments = Bundle().apply {
}
}
}
}

View File

@ -0,0 +1,21 @@
package com.drink.water.test.room
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.drink.water.test.DrinkWater
import com.drink.water.test.roombean.WaterRecord
import com.drink.water.test.utls.ConstStr
@Database(entities = [WaterRecord::class], version = ConstStr.room_version, exportSchema = false)
abstract class RoomBase : RoomDatabase() {
companion object {
val database =
Room.databaseBuilder(DrinkWater.appContext, RoomBase::class.java, ConstStr.room_name)
.build()
}
abstract fun getRoomDao(): RoomDao
}

View File

@ -0,0 +1,35 @@
package com.drink.water.test.room
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.drink.water.test.roombean.WaterRecord
@Dao
interface RoomDao {
@Insert
fun addRecord(record: WaterRecord)
@Query("select * from water_record where timeKey= :timeKey")
fun getWaterRecord(timeKey:Long):List<WaterRecord>
// @Query("select * from water_record where isHome= :home ")
// fun getHomeFile(home: Boolean = true):List<WaterRecord>
//
// @Query("select * from water_record where isRecent= :recent")
// fun getRecentFile(recent: Boolean = true):List<WaterRecord>
// @Update
// fun updatePdfFile(file: PdfFile)
}

View File

@ -0,0 +1,15 @@
package com.drink.water.test.roombean
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.drink.water.test.utls.ConstStr
@Entity(tableName = ConstStr.room_table_name)
class WaterRecord(
@PrimaryKey(autoGenerate = true)
var id: Int = 0,
var timeKey:Long,
var time: Long, var capacity: Int
) {
}

View File

@ -0,0 +1,19 @@
package com.drink.water.test.utls
object ConstStr {
const val room_name = "room_name"
const val room_version = 1
const val room_table_name="water_record"
const val sharedPreferencesName:String = "shared_preference_name"
const val KEY_IS_GIRLS = "is_girls"
const val KEY_WEIGHT = "weight"
const val KEY_DRINK = "today_drink"
const val KEY_FIRST = "open_first"
}

View File

@ -0,0 +1,42 @@
package com.drink.water.test.utls
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.drink.water.test.databinding.ItemRecordBinding
import com.drink.water.test.roombean.WaterRecord
class RecordAdapter(var con: Context) : RecyclerView.Adapter<RecordAdapter.RecordVh>() {
private var data: List<WaterRecord> = emptyList()
fun updateRecord(list: List<WaterRecord>) {
data = list
notifyDataSetChanged()
}
inner class RecordVh(var binding: ItemRecordBinding) : RecyclerView.ViewHolder(binding.root) {
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecordVh {
return RecordVh(ItemRecordBinding.inflate(LayoutInflater.from(con), parent, false))
}
override fun getItemCount(): Int {
return data.size
}
override fun onBindViewHolder(holder: RecordVh, position: Int) {
data[position].let {
holder.binding.tvDrinkTime.text = Utils.formatTime(it.time)
holder.binding.tvDrinkCount.text = "${it.capacity}ml"
}
}
}

View File

@ -0,0 +1,53 @@
package com.drink.water.test.utls
import android.content.Context
import android.content.SharedPreferences
import com.drink.water.test.DrinkWater
object SharePreference {
private fun getShared(): SharedPreferences {
return DrinkWater.appContext.getSharedPreferences(ConstStr.sharedPreferencesName, Context.MODE_PRIVATE)
}
fun saveGender(isGirls: Boolean) {
getEditor().putBoolean(ConstStr.KEY_IS_GIRLS, isGirls).apply()
}
fun getGender( ): Boolean {
return getShared()
.getBoolean(ConstStr.KEY_IS_GIRLS,true)
}
private fun getEditor(): SharedPreferences.Editor {
return DrinkWater.appContext.getSharedPreferences(ConstStr.sharedPreferencesName, Context.MODE_PRIVATE).edit()
}
fun saveWeight(weight: Int) {
getEditor().putInt(ConstStr.KEY_WEIGHT, weight).apply()
}
fun getWeight( ): Int {
return getShared()
.getInt(ConstStr.KEY_WEIGHT,60)
}
fun saveIsFirst() {
getEditor().putBoolean(ConstStr.KEY_FIRST, false).apply()
}
fun getIsFirst( ): Boolean {
return getShared().getBoolean(ConstStr.KEY_FIRST,true)
}
fun saveTodayDrink(drink: Int) {
getEditor().putInt(ConstStr.KEY_DRINK, drink).apply()
}
fun getTodayDrink( ): Int {
return getShared()
.getInt(ConstStr.KEY_DRINK,0)
}
}

View File

@ -0,0 +1,41 @@
package com.drink.water.test.utls
import android.annotation.SuppressLint
import java.text.SimpleDateFormat
object Utils {
fun beforeDate(days: Int): Long {
val nowTime = System.currentTimeMillis()
val changeTimes = days * 24L * 60 * 60 * 1000
return nowTime + changeTimes
}
@SuppressLint("SimpleDateFormat")
fun formatTime(timestamp: Long): String? {
var dayFormat = SimpleDateFormat("HH:mm")
return dayFormat.format(timestamp)
}
fun getMonth(mon: Int, day: Int): String {
return when (mon) {
1 -> "Jan$day"
2 -> "Feb$day"
3 -> "Mar$day"
4 -> "Apr$day"
5 -> "May$day"
6 -> "Jun$day"
7 -> "Jul$day"
8 -> "Aug$day"
9 -> "Sep$day"
10 -> "Oct$day"
11 -> "Nov$day"
12 -> "Dec$day"
else -> {
"Jan$day"
}
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/color_text_view" android:state_checked="false"/>
<item android:color="@color/white" android:state_checked="true"/>
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/color_text_view" android:state_selected="false"/>
<item android:color="@color/color_FEBEBE" android:state_selected="true"/>
</selector>

View File

@ -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>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="4dp"/>
<solid android:color="@color/color_F1F1F1"/>
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="4dp"/>
<solid android:color="@color/color_FEBEBE"/>
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="4dp"/>
<solid android:color="@color/color_D2EFF3"/>
</shape>

View File

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M512,0C229.3,0 0.1,229.1 0.1,512c0,174.1 87,327.9 219.8,420.3 26,-90.7 92.1,-158.8 181.9,-189.6 2.4,-0.8 4.9,-1.6 7.3,-2.4 1.7,-0.5 3.4,-1.1 5.1,-1.6a316.7,316.7 0,0 1,14.1 -3.8,338.1 338.1,0 0,1 11.5,-2.7c1.5,-0.3 3,-0.6 4.5,-0.9a340.2,340.2 0,0 1,14 -2.5,337.4 337.4,0 0,1 9.6,-1.3c1.4,-0.2 2.9,-0.4 4.3,-0.5a355.5,355.5 0,0 1,14 -1.4L538,725.6c4.7,0.4 9.4,0.8 14,1.4 1.4,0.2 2.8,0.4 4.3,0.5a361.6,361.6 0,0 1,14.4 2.1c3.2,0.5 6.4,1.1 9.6,1.8 1.3,0.3 2.7,0.5 4,0.8a327.6,327.6 0,0 1,26.1 6.6c1.3,0.4 2.6,0.8 3.9,1.2 3,0.9 5.9,1.9 8.8,2.9 89.5,30.9 155.3,98.8 181.3,189.3 132.7,-92.5 219.6,-246.2 219.6,-420.2 -0,-282.8 -229.2,-511.9 -511.9,-511.9zM512,725.5c-133.1,0 -241,-107.9 -241,-241 0,-1.3 0.1,-2.5 0.1,-3.8 -1.3,-152.4 141.5,-244.1 241.2,-237.3h0.1c102.2,-7 249.9,89.3 241.3,248.2 -0.3,0.2 -0.5,0.3 -0.8,0.4 -4,129.6 -110.3,233.4 -240.8,233.4z"
android:fillColor="#D6E079"/>
<path
android:pathData="M512.3,357.5c-24.3,103.4 -170.6,178.4 -240.9,134.2a243.6,243.6 0,0 1,-0.3 -11c-0,1.3 -0.1,2.5 -0.1,3.8 0,133.1 107.9,241 241,241 130.6,0 236.8,-103.8 240.8,-233.4 -70.7,43.3 -216.2,-31.5 -240.6,-134.6z"
android:fillColor="#FCE9EA"/>
<path
android:pathData="M566.1,728.8zM552.1,726.9c1.4,0.2 2.8,0.4 4.3,0.5 -1.4,-0.2 -2.8,-0.4 -4.3,-0.5zM439.9,732.2c1.5,-0.3 3,-0.6 4.5,-0.9 -1.5,0.3 -3,0.6 -4.5,0.9zM610.4,738.8c1.3,0.4 2.6,0.8 3.9,1.2 -1.3,-0.4 -2.6,-0.8 -3.9,-1.2zM453.5,729.6zM425.4,735.6zM468,727.5c1.4,-0.2 2.9,-0.4 4.3,-0.5 -1.5,0.2 -2.9,0.4 -4.3,0.5zM580.3,731.4c1.3,0.3 2.7,0.5 4,0.8 -1.3,-0.3 -2.7,-0.5 -4,-0.8zM512,823.8c-1,0 -2,-0.1 -3,-0.1l3,2.1 3,-2.1c-1,0 -2,0.1 -3,0.1z"
android:fillColor="#A0D9F6"/>
<path
android:pathData="M623.1,742.9c0.8,0.3 1.6,0.6 2.4,0.9a119.2,119.2 0,0 1,-10.5 22.1c17.3,26.2 13,141.6 -12.9,123.4l-45.1,-31.7 -45,-31.8 -45.1,31.8 -45,31.7c-25.9,18.2 -30.2,-97.2 -12.9,-123.4a119.7,119.7 0,0 1,-10.4 -22c1.1,-0.4 2.2,-0.8 3.3,-1.2 -89.8,30.8 -155.9,98.9 -181.9,189.6 82.8,57.6 183.5,91.5 292.1,91.5 108.7,0 209.4,-33.9 292.3,-91.6 -26,-90.4 -91.8,-158.4 -181.3,-189.3zM409.2,740.3c1.7,-0.5 3.4,-1.1 5.1,-1.6 -1.7,0.5 -3.4,1.1 -5.1,1.6z"
android:fillColor="#A0D9F6"/>
<path
android:pathData="M409,765.8c3.4,-5.2 7.7,-6.9 12.9,-3.3l45,31.7 42.1,29.6c1,0 2,0.1 3,0.1 1,0 2,-0 3,-0.1l42,-29.6 45.1,-31.7c5.2,-3.6 9.5,-1.9 12.9,3.3a119.1,119.1 0,0 0,10.5 -22.1c-0.8,-0.3 -1.6,-0.6 -2.4,-0.9 -2.9,-1 -5.9,-2 -8.8,-2.9 -1.3,-0.4 -2.6,-0.8 -3.9,-1.2a329.4,329.4 0,0 0,-26.1 -6.6c-1.3,-0.3 -2.7,-0.5 -4,-0.8 -3.2,-0.6 -6.3,-1.2 -9.6,-1.8a349.6,349.6 0,0 0,-14.4 -2.1c-1.4,-0.2 -2.8,-0.4 -4.3,-0.5a356.2,356.2 0,0 0,-14 -1.4H486.3a356.3,356.3 0,0 0,-14 1.4c-1.4,0.2 -2.9,0.4 -4.3,0.5a353.1,353.1 0,0 0,-14.4 2.1,354.2 354.2,0 0,0 -9.1,1.7c-1.5,0.3 -3,0.6 -4.5,0.9 -3.9,0.8 -7.7,1.7 -11.5,2.7 -1,0.2 -2,0.5 -3,0.8a323.4,323.4 0,0 0,-11.1 3.1c-1.7,0.5 -3.4,1.1 -5.1,1.6a340.2,340.2 0,0 0,-7.3 2.4c-1.1,0.4 -2.2,0.8 -3.3,1.2a119,119 0,0 0,10.4 22z"
android:fillColor="#FEFEFE"/>
<path
android:pathData="M602.2,762.5l-45.1,31.7 -42,29.6 -3,2.1 45,31.8 45.1,31.7c25.9,18.2 30.2,-97.2 12.9,-123.4 -3.4,-5.2 -7.7,-6.9 -12.9,-3.3zM466.9,794.2l-45,-31.7c-5.2,-3.6 -9.5,-1.9 -12.9,3.3 -17.3,26.2 -13,141.6 12.9,123.4l45,-31.7 45.1,-31.8 -3,-2.1 -42.1,-29.6z"
android:fillColor="#FA9689"/>
<path
android:pathData="M512.3,357.5V243.4c-99.7,-6.8 -242.5,84.9 -241.2,237.3 0,3.6 0.1,7.3 0.3,11 70.3,44.3 216.6,-30.7 240.9,-134.2z"
android:fillColor="#FECF77"/>
<path
android:pathData="M512.3,357.5c24.4,103.1 169.9,177.9 240.6,134.6 0.3,-0.2 0.5,-0.3 0.8,-0.4 8.6,-159 -139.1,-255.2 -241.3,-248.2h-0.1v114.1z"
android:fillColor="#F7B970"/>
</vector>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp"/>
<solid android:color="@color/color_9287FF"/>
</shape>

View File

@ -0,0 +1,33 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M512.2,0.1C229.3,0.1 0.2,229.3 0.2,512.1c0,174.1 86.9,327.9 219.8,420.4v-0l-0,-0 0.1,-0.3a292.5,292.5 0,0 1,10.9 -31.3l0.2,-0.5c1.2,-2.8 2.4,-5.5 3.6,-8.2a274.4,274.4 0,0 1,5.1 -10.5c0.6,-1.2 1.3,-2.5 1.9,-3.7a266.2,266.2 0,0 1,3.7 -6.9c0.7,-1.3 1.5,-2.5 2.2,-3.8a280.3,280.3 0,0 1,6.6 -10.7c1.1,-1.8 2.3,-3.5 3.4,-5.2 1.1,-1.6 2.3,-3.2 3.4,-4.8a284.9,284.9 0,0 1,7.3 -9.8c0.8,-1.1 1.6,-2.1 2.5,-3.2l0.3,-341.4h0.1c-0.1,-2.4 -0.2,-4.9 -0.2,-7.3 0,-0.4 0,-0.9 0,-1.3 -2.8,-153.8 140.9,-246.5 241.1,-239.7 102.1,-6.9 249.8,89.4 241.3,248.4l-0.2,0.1 0.3,341.5c0.6,0.8 1.3,1.6 1.9,2.4 1.4,1.8 2.7,3.5 4.1,5.3 1.1,1.5 2.2,3 3.3,4.5 1.3,1.8 2.6,3.6 3.8,5.5 1.1,1.6 2.2,3.3 3.3,5a278,278 0,0 1,5.6 9c1.2,2 2.3,3.9 3.4,5.9 1,1.8 1.9,3.6 2.9,5.3 1,1.9 2,3.9 3,5.8a290.1,290.1 0,0 1,5.6 11.8c0.7,1.6 1.4,3.2 2.1,4.8 1.4,3.2 2.7,6.5 3.9,9.8 0.2,0.6 0.5,1.2 0.7,1.8 1.5,4 2.9,8.1 4.2,12.2 0.3,1 0.6,2.1 1,3.1 0.6,2.1 1.3,4.1 1.9,6.3a0.6,0.6 0,0 1,-0.1 0.1v0c132.8,-92.5 219.7,-246.3 219.7,-420.4C1024.1,229.3 794.9,0.1 512.2,0.1z"
android:fillColor="#F4B3B3"/>
<path
android:pathData="M276.2,827.1a277.5,277.5 0,0 1,8.1 -9.1c0.2,-0.2 0.5,-0.5 0.7,-0.7a278.1,278.1 0,0 1,8.1 -8.2c0.8,-0.8 1.7,-1.6 2.5,-2.4a265,265 0,0 1,9.5 -8.7c0.4,-0.3 0.8,-0.7 1.2,-1.1v0.1c23.6,-20.2 50.7,-36.6 80.8,-48.7a313.4,313.4 0,0 1,24.2 -8.6c0.7,-0.2 1.4,-0.4 2.1,-0.7a326.5,326.5 0,0 1,26.9 -6.8c1,-0.2 2,-0.4 3,-0.6a344.4,344.4 0,0 1,14.6 -2.6c3.4,-0.5 6.9,-1 10.3,-1.4 1.3,-0.2 2.5,-0.3 3.8,-0.5a361.5,361.5 0,0 1,14.1 -1.4H512.3v-0.1l-0.2,0c-130.7,0 -237,-104 -240.8,-233.7h-0.1l-0.3,341.4c0.7,-0.9 1.5,-1.8 2.2,-2.7 1,-1.2 2,-2.4 3,-3.6z"
android:fillColor="#FECF77"/>
<path
android:pathData="M512.2,725.7l0.2,-0c130.5,-0.1 236.6,-103.9 240.7,-233.4 -64,39.3 -230.5,-18.2 -280.2,-105.6 -46.4,81.4 -125.1,153.4 -201.4,105.3 -0.2,-2.9 -0.1,-5.8 -0.2,-8.6 0,0.4 -0,0.9 -0,1.3 0,2.5 0.1,4.9 0.2,7.3 3.9,129.7 110.2,233.7 240.8,233.7z"
android:fillColor="#FCE9EA"/>
<path
android:pathData="M472.8,386.7c49.7,87.4 216.2,144.9 280.2,105.6 -4,129.5 -110.2,233.3 -240.7,233.4v0.1h25.7c4.8,0.4 9.5,0.8 14.1,1.3 1.3,0.2 2.6,0.3 4,0.5 3.4,0.4 6.8,0.9 10.1,1.4a335.6,335.6 0,0 1,14.4 2.5c1.2,0.2 2.4,0.5 3.6,0.7a326.4,326.4 0,0 1,26.3 6.7c1.2,0.3 2.3,0.7 3.4,1.1a313.3,313.3 0,0 1,13.3 4.5c2.9,1.1 5.9,2.2 8.8,3.3 30,11.9 57.1,28.1 80.7,48v-0.1c0.5,0.5 1.1,0.9 1.6,1.4 1.6,1.4 3.1,2.7 4.7,4.1 1.5,1.3 2.9,2.7 4.4,4.1 1.5,1.4 3.1,2.9 4.6,4.4 1.4,1.4 2.8,2.9 4.2,4.3a272.4,272.4 0,0 1,7.7 8.3c1.3,1.4 2.6,2.9 3.9,4.3 1.4,1.7 2.9,3.4 4.3,5.1 0.5,0.6 1,1.2 1.5,1.8l-0.3,-341.5 0.2,-0.1c8.5,-158.9 -139.2,-255.3 -241.3,-248.4h0.1c8.3,29.6 -8.3,88.4 -39.5,143z"
android:fillColor="#FCBA6F"/>
<path
android:pathData="M784.9,882.4zM790.5,894.3c0.7,1.6 1.4,3.2 2.1,4.8 -0.7,-1.6 -1.4,-3.2 -2.1,-4.8zM770,856.4zM265.2,841zM762.8,845.9c1.3,1.8 2.6,3.6 3.8,5.5 -1.2,-1.8 -2.5,-3.6 -3.8,-5.5zM779,871.3c1,1.8 1.9,3.6 2.9,5.3 -0.9,-1.8 -1.9,-3.6 -2.9,-5.3zM796.6,908.9c0.2,0.6 0.5,1.2 0.7,1.8 -0.2,-0.6 -0.5,-1.2 -0.7,-1.8zM716.7,795.9c-23.6,-19.9 -50.7,-36.1 -80.7,-48l0.7,0.3v134h-251.3V749c0.5,-0.2 1.1,-0.4 1.7,-0.7 -30.1,12.1 -57.2,28.5 -80.8,48.7v183.8a512.1,512.1 0,0 1,-86.3 -48.4v0c82.8,57.7 183.5,91.5 292.2,91.5 81.5,0 158.4,-19.1 226.8,-52.9a509.4,509.4 0,0 1,-22.3 10.3v-185.5zM257.8,851.2c1.1,-1.6 2.3,-3.2 3.4,-4.8 -1.1,1.6 -2.3,3.2 -3.4,4.8zM739.2,971a511.4,511.4 0,0 0,65.2 -38.6v-0a512.3,512.3 0,0 1,-65.2 38.6zM801.6,923c0.3,1 0.6,2.1 1,3.1 -0.3,-1 -0.6,-2.1 -1,-3.1zM755.5,836.1zM220.1,932.2zM236.3,889zM247.8,867.2zM231.2,900.4zM241.9,877.9c1.2,-2.3 2.4,-4.6 3.7,-6.9 -1.3,2.3 -2.5,4.6 -3.7,6.9zM285,817.3c-0.2,0.2 -0.5,0.5 -0.7,0.7 0.2,-0.2 0.5,-0.5 0.7,-0.7zM293,809.1c0.8,-0.8 1.7,-1.6 2.5,-2.4 -0.8,0.8 -1.7,1.6 -2.5,2.4zM397.8,744.3zM276.2,827.1c-1,1.2 -2,2.4 -3,3.6 1,-1.2 2,-2.4 3,-3.6zM440.4,732.3c1,-0.2 2,-0.4 3,-0.6 -1,0.2 -2,0.4 -3,0.6zM468.3,727.6c1.3,-0.2 2.5,-0.3 3.8,-0.5 -1.3,0.1 -2.5,0.3 -3.8,0.5zM411.3,739.8c0.7,-0.2 1.4,-0.4 2.1,-0.7 -0.7,0.2 -1.4,0.4 -2.1,0.7zM454,729.7zM305.1,798zM727.4,805.4c1.5,1.4 3.1,2.9 4.6,4.4 -1.5,-1.5 -3.1,-2.9 -4.6,-4.4zM610.5,739c1.2,0.3 2.3,0.7 3.4,1.1 -1.1,-0.4 -2.3,-0.7 -3.4,-1.1zM623.2,743.1zM723,801.3zM552.2,727.1c1.3,0.2 2.6,0.3 4,0.5 -1.3,-0.2 -2.6,-0.3 -4,-0.5zM580.6,731.6c1.2,0.2 2.4,0.5 3.6,0.7 -1.2,-0.2 -2.4,-0.5 -3.6,-0.7zM743.9,822.3zM566.2,729.1zM752.1,831.8c-1.4,-1.7 -2.8,-3.5 -4.3,-5.1 1.4,1.7 2.8,3.4 4.3,5.1z"
android:fillColor="#A0D9F6"/>
<path
android:pathData="M623.2,743.1a321.8,321.8 0,0 0,-9.3 -3c-1.1,-0.4 -2.3,-0.7 -3.4,-1.1a330.4,330.4 0,0 0,-26.3 -6.7c-1.2,-0.3 -2.4,-0.5 -3.6,-0.7a322.9,322.9 0,0 0,-14.4 -2.5,372.4 372.4,0 0,0 -10.1,-1.4c-1.3,-0.2 -2.6,-0.3 -4,-0.5a368.5,368.5 0,0 0,-14.1 -1.3L486.3,725.8a361.5,361.5 0,0 0,-14.1 1.4c-1.3,0.1 -2.5,0.3 -3.8,0.5a355.8,355.8 0,0 0,-14.4 2.1c-3.6,0.6 -7.1,1.2 -10.6,2 -1,0.2 -2,0.4 -3,0.6a326.5,326.5 0,0 0,-26.9 6.8c-0.7,0.2 -1.4,0.4 -2.1,0.7a322.3,322.3 0,0 0,-13.5 4.5c-3.6,1.3 -7.2,2.6 -10.7,4 -0.6,0.2 -1.1,0.4 -1.7,0.7v133.2h251.3v-134l-0.7,-0.3a322.3,322.3 0,0 0,-12.8 -4.7zM512.1,849.1a15.2,15.2 0,1 1,-0 -30.5,15.2 15.2,0 0,1 0,30.5zM512.1,793.9a15.2,15.2 0,1 1,0 -30.5,15.2 15.2,0 0,1 0,30.5zM306.3,797v-0.1c-0.4,0.3 -0.8,0.7 -1.2,1.1a272,272 0,0 0,-9.5 8.7c-0.8,0.8 -1.7,1.6 -2.5,2.4a278.1,278.1 0,0 0,-8.1 8.2c-0.2,0.2 -0.5,0.5 -0.7,0.7a277.5,277.5 0,0 0,-8.1 9.1c-1,1.2 -2,2.4 -3,3.6 -0.7,0.9 -1.5,1.8 -2.2,2.7 -0.8,1 -1.7,2.1 -2.5,3.2a284.9,284.9 0,0 0,-7.3 9.8c-1.1,1.6 -2.3,3.2 -3.4,4.8 -1.2,1.7 -2.3,3.5 -3.4,5.2a278.2,278.2 0,0 0,-6.6 10.7c-0.7,1.3 -1.5,2.5 -2.2,3.8 -1.3,2.3 -2.5,4.6 -3.7,6.9 -0.6,1.2 -1.3,2.5 -1.9,3.7a280.2,280.2 0,0 0,-3.6 7.4c-0.5,1.1 -1,2.1 -1.5,3.2a287,287 0,0 0,-3.6 8.2l-0.2,0.5a291.6,291.6 0,0 0,-10.9 31.3c-0,0.1 -0.1,0.2 -0.1,0.3l0,0a511.8,511.8 0,0 0,86.3 48.4v-183.8zM804.5,932.3c-0.6,-2.1 -1.3,-4.2 -1.9,-6.3 -0.3,-1 -0.6,-2.1 -1,-3.1a289.3,289.3 0,0 0,-4.2 -12.2c-0.2,-0.6 -0.5,-1.2 -0.7,-1.8a296.8,296.8 0,0 0,-3.9 -9.8c-0.7,-1.6 -1.4,-3.2 -2.1,-4.8a265.4,265.4 0,0 0,-8.6 -17.6c-1,-1.8 -1.9,-3.6 -2.9,-5.3 -1.1,-2 -2.3,-3.9 -3.4,-5.9a278,278 0,0 0,-5.6 -9c-1.1,-1.7 -2.2,-3.4 -3.3,-5 -1.2,-1.8 -2.5,-3.6 -3.8,-5.5a254.4,254.4 0,0 0,-7.3 -9.8,275.9 275.9,0 0,0 -1.9,-2.4c-0.5,-0.6 -1,-1.2 -1.5,-1.8 -1.4,-1.7 -2.8,-3.5 -4.3,-5.1 -1.3,-1.5 -2.6,-2.9 -3.9,-4.3a267.5,267.5 0,0 0,-7.7 -8.3c-1.4,-1.4 -2.8,-2.9 -4.2,-4.3 -1.5,-1.5 -3.1,-2.9 -4.6,-4.4 -1.5,-1.4 -2.9,-2.7 -4.4,-4.1a292.3,292.3 0,0 0,-4.7 -4.1c-0.5,-0.5 -1,-0.9 -1.6,-1.4L716.7,981.4a509.4,509.4 0,0 0,22.5 -10.4,512.5 512.5,0 0,0 65.2,-38.6l0.1,-0.1z"
android:fillColor="#FEFEFE"/>
<path
android:pathData="M512.1,778.7m-15.2,0a15.2,15.2 0,1 0,30.5 0,15.2 15.2,0 1,0 -30.5,0Z"
android:fillColor="#A0D9F6"/>
<path
android:pathData="M512.1,833.9m-15.2,0a15.2,15.2 0,1 0,30.5 0,15.2 15.2,0 1,0 -30.5,0Z"
android:fillColor="#A0D9F6"/>
<path
android:pathData="M271.4,492c76.4,48 155,-24 201.4,-105.3 31.2,-54.6 47.8,-113.5 39.5,-143h-0.1c-100.2,-6.8 -243.9,86 -241.1,239.7 0,2.9 0,5.7 0.2,8.6z"
android:fillColor="#FECF77"/>
</vector>

View File

@ -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>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/add_water_true"/>
<item android:state_checked="false" android:drawable="@drawable/add_water_false"/>
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/tab_home_1"/>
<item android:state_selected="false" android:drawable="@mipmap/tab_home_0"/>
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/tab_record_1"/>
<item android:state_selected="false" android:drawable="@mipmap/tab_record_0"/>
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/tab_settings_1"/>
<item android:state_selected="false" android:drawable="@mipmap/tab_settings_0"/>
</selector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/color_FF03DAC5"/>
<corners android:radius="9dp"/>
</shape>

View File

@ -0,0 +1,162 @@
<?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=".GenderActivity">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:id="@+id/image_view_back"
android:src="@mipmap/arrow_circle_left"
app:layout_constraintBottom_toBottomOf="@id/tv_gender_title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_gender_title" />
<TextView
android:id="@+id/tv_gender_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="15dp"
android:text="@string/tab_name_set"
android:textColor="@color/color_text_view"
android:textSize="18sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="@string/text_gender"
android:textColor="@color/color_text_view"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@id/relayout_gender"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/relayout_gender" />
<RelativeLayout
android:id="@+id/relayout_gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="50dp"
android:orientation="horizontal"
app:layout_constraintLeft_toRightOf="@id/tv_gender"
app:layout_constraintTop_toBottomOf="@id/tv_gender_title">
<ImageView
android:id="@+id/im_girls"
android:layout_width="87dp"
android:layout_height="87dp"
android:src="@mipmap/girls" />
<TextView
android:id="@+id/tv_girls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/im_girls"
android:layout_alignStart="@id/im_girls"
android:layout_alignEnd="@id/im_girls"
android:layout_marginTop="14dp"
android:gravity="center"
android:text="@string/text_female"
android:textColor="@color/selector_color_gender"
android:textSize="16sp" />
<ImageView
android:id="@+id/im_boy"
android:layout_width="87dp"
android:layout_height="87dp"
android:layout_marginStart="60dp"
android:layout_toEndOf="@id/im_girls"
android:src="@mipmap/boys" />
<TextView
android:id="@+id/tv_boys"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/im_boy"
android:layout_alignStart="@id/im_boy"
android:layout_alignEnd="@id/im_boy"
android:layout_marginTop="14dp"
android:gravity="center"
android:text="@string/text_male"
android:textColor="@color/selector_color_gender"
android:textSize="16sp" />
</RelativeLayout>
<TextView
android:id="@+id/tv_weight"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginStart="16dp"
android:layout_marginTop="50dp"
android:gravity="center"
android:text="@string/text_weight_settings"
android:textColor="@color/color_text_view"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/relayout_gender" />
<androidx.cardview.widget.CardView
android:id="@+id/linearlayout_number"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_marginEnd="16dp"
app:cardCornerRadius="8dp"
app:layout_constraintLeft_toRightOf="@id/tv_weight"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_weight">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/et_weight"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toStartOf="@id/tv_kg"
android:background="@null"
android:paddingStart="15dp"
android:inputType="number"
android:maxLines="1" />
<TextView
android:id="@+id/tv_kg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="5dp"
android:text="@string/text_kg"
android:textColor="@color/color_C1C1C1"
android:textSize="16sp" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_save"
android:layout_width="117dp"
android:layout_height="40dp"
android:layout_marginTop="60dp"
android:background="@drawable/btn_bg_add_water"
android:gravity="center"
android:text="@string/text_save_info"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/linearlayout_number" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,45 @@
<?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=".LauncherActivity">
<ImageView
android:id="@+id/im_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="160dp"
android:src="@mipmap/logo"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_hi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:gravity="center"
android:lineSpacingExtra="5dp"
android:text="@string/text_hi"
android:textColor="@color/color_text_view"
android:textSize="20sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/im_logo" />
<ProgressBar
android:id="@+id/pb_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="150dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_hi" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,34 @@
<?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"
android:orientation="vertical"
tools:context=".MainActivity">
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/card_view" />
<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginStart="29dp"
android:layout_marginEnd="29dp"
android:layout_marginBottom="27dp"
app:cardCornerRadius="25dp">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="50dp"
app:tabIndicatorHeight="0dp"
android:scrollbars="none" />
</androidx.cardview.widget.CardView>
</RelativeLayout>

View File

@ -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=".fragments.HomeFragment">
<ImageView
android:id="@+id/image_view_header"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginStart="29dp"
android:layout_marginTop="50dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="@id/image_view_header"
app:layout_constraintLeft_toRightOf="@id/image_view_header"
app:layout_constraintTop_toTopOf="@id/image_view_header">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_hello"
android:textColor="@color/color_text_view"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/text_welcome_back"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/linear_circle"
android:layout_width="211dp"
android:layout_height="211dp"
android:layout_marginTop="39dp"
android:background="@mipmap/home_bg"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_view_header">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:text="@string/text_today_goal"
android:textColor="@color/color_text_view"
android:textSize="12sp" />
<TextView
android:id="@+id/text_view_today"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/text_ml"
android:textColor="@color/color_FEBEBE"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="37dp"
android:text="@string/text_haven_drunk"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
<TextView
android:id="@+id/text_view_drunk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="1500ml"
android:textColor="@color/color_9287FF"
android:textSize="30sp" />
</LinearLayout>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="157dp"
android:layout_marginStart="16dp"
android:layout_marginTop="60dp"
android:layout_marginEnd="16dp"
app:cardCornerRadius="8dp"
app:layout_constraintTop_toBottomOf="@id/linear_circle">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="17dp"
android:paddingStart="10dp"
android:paddingTop="6dp"
android:paddingEnd="10dp">
<TextView
android:id="@+id/text_View_add_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_add_water"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/text_View_add_title"
android:layout_marginTop="24dp"
android:orientation="horizontal">
<RadioButton
android:layout_width="50dp"
android:layout_height="24dp"
android:layout_weight="1"
android:id="@+id/rb_1"
android:checked="true"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:text="100ml"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
<RadioButton
android:layout_width="50dp"
android:layout_height="24dp"
android:layout_marginStart="15dp"
android:id="@+id/rb_2"
android:layout_weight="1"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:text="200ml"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
<RadioButton
android:layout_width="50dp"
android:layout_height="24dp"
android:id="@+id/rb_3"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:text="300ml"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
<RadioButton
android:layout_width="50dp"
android:layout_height="24dp"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:id="@+id/rb_4"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:text="400ml"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
<RadioButton
android:layout_width="50dp"
android:layout_height="24dp"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:id="@+id/rb_5"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:text="500ml"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
</RadioGroup>
<TextView
android:id="@+id/text_today_add"
android:layout_width="117dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/btn_bg_add_water"
android:gravity="center"
android:text="@string/text_add"
android:textColor="@color/white"
android:textSize="14sp" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,172 @@
<?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=".fragments.RecordFragment">
<TextView
android:id="@+id/text_view_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp"
android:text="@string/text_water_record"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:textColor="@color/color_text_view"
android:textSize="18sp" />
<TextView
android:id="@+id/text_view_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_below="@id/text_view_title"
android:layout_marginTop="16dp"
android:text="@string/text_days_7"
android:textColor="@color/color_text_view"
android:textSize="15sp" />
<androidx.cardview.widget.CardView
android:id="@+id/card_view_day"
android:layout_width="match_parent"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_height="wrap_content"
android:layout_below="@id/text_view_day"
android:layout_marginTop="8dp"
app:cardCornerRadius="8dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginBottom="5dp"
android:paddingStart="10dp"
android:paddingTop="5dp"
android:paddingEnd="10dp">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/radio_group"
android:orientation="horizontal">
<RadioButton
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight="1"
android:id="@+id/rb1"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:checked="true"
android:text="1"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
<RadioButton
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:id="@+id/rb2"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:text="2"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
<RadioButton
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:id="@+id/rb3"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:text="3"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
<RadioButton
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:id="@+id/rb4"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:text="4"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
<RadioButton
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:id="@+id/rb5"
android:background="@drawable/selector_add_water"
android:button="@null"
android:gravity="center"
android:text="5"
android:textColor="@color/selector_color_add_water"
android:textSize="10sp" />
<!-- <RadioButton-->
<!-- android:layout_width="30dp"-->
<!-- android:layout_height="30dp"-->
<!-- android:layout_marginStart="15dp"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@drawable/selector_add_water"-->
<!-- android:button="@null"-->
<!-- android:gravity="center"-->
<!-- android:text="6"-->
<!-- android:textColor="@color/selector_color_add_water"-->
<!-- android:textSize="10sp" />-->
<!-- <RadioButton-->
<!-- android:layout_width="30dp"-->
<!-- android:layout_height="30dp"-->
<!-- android:layout_marginStart="15dp"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@drawable/selector_add_water"-->
<!-- android:button="@null"-->
<!-- android:gravity="center"-->
<!-- android:text="7"-->
<!-- android:textColor="@color/selector_color_add_water"-->
<!-- android:textSize="10sp" />-->
</RadioGroup>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/text_view_past"
android:layout_width="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_height="wrap_content"
android:layout_below="@id/card_view_day"
android:layout_marginTop="19dp"
android:text="@string/text_past_record"
android:textColor="@color/color_text_view"
android:textSize="15sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_record"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/text_view_past"
android:layout_marginTop="8dp" />
</RelativeLayout>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".fragments.SettingsFragment">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="@string/text_personal"
android:textColor="@color/color_text_view"
android:textSize="18sp" />
<ImageView
android:id="@+id/image_view_header"
android:layout_width="112dp"
android:layout_height="112dp"
android:layout_below="@id/tv_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="33dp" />
<TextView
android:id="@+id/text_view_gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image_view_header"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
<TextView
android:id="@+id/text_view_weight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/text_view_gender"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
<androidx.cardview.widget.CardView
android:id="@+id/card_view_set"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@id/text_view_weight"
android:layout_marginStart="16dp"
android:layout_marginTop="17dp"
android:layout_marginEnd="16dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:text="@string/tab_name_set"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@mipmap/arrow_right" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>

View File

@ -0,0 +1,64 @@
<?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="40dp"
android:layout_marginStart="16dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="2dp"
android:gravity="center_vertical"
android:layout_marginEnd="16dp"
app:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_drink_time"
android:layout_marginStart="6dp"
android:layout_gravity="center_vertical"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_drink_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_record"
android:padding="4dp"
android:layout_gravity="center_vertical"
android:text="@string/text_drink_consumption"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_drink_consumption"
android:layout_marginStart="15dp"
android:layout_gravity="center_vertical"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_drink_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_record"
android:padding="4dp"
android:layout_gravity="center_vertical"
android:text="@string/text_drink_time"
android:textColor="@color/color_text_view"
android:textSize="14sp" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_view_tab"
android:layout_width="23dp"
android:src="@mipmap/ic_launcher"
android:layout_height="23dp" />
</LinearLayout>

View File

@ -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>

View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.DrinkWater" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">@color/white</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FEBEBE</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="color_text_view">#333333</color>
<color name="color_FF03DAC5">#FF03DAC5</color>
<color name="color_FEBEBE">#FEBEBE</color>
<color name="color_9287FF">#9287FF </color>
<color name="color_C1C1C1">#C1C1C1</color>
<color name="color_F1F1F1">#F1F1F1</color>
<color name="color_D2EFF3">#D2EFF3</color>
</resources>

View File

@ -0,0 +1,32 @@
<resources>
<string name="app_name">DrinkWater</string>
<string name="text_hi">Lets start \nour daily hydration journey together</string>
<string name="text_gender">Gender</string>
<string name="text_weight">Weight</string>
<string name="text_personal_info">Basic Information</string>
<string name="text_female">Female</string>
<string name="text_male">Male</string>
<string name="text_kg">kg</string>
<string name="text_hello">Hello!</string>
<string name="text_sex_selection">Sex selection:</string>
<string name="text_weight_settings">Weight setting</string>
<string name="text_today_goal">Today\'s goal</string>
<string name="text_ml">%sml</string>
<string name="text_haven_drunk">Have drunk water</string>
<string name="text_add_water">Added water</string>
<string name="text_add">Add</string>
<string name="text_welcome_back">Welcome back</string>
<string name="text_save_info">Save</string>
<string name="text_water_record">Water record</string>
<string name="text_drink_time">Drinking time</string>
<string name="text_drink_consumption">Water:</string>
<string name="text_past_record">Past water records</string>
<string name="text_days_7">Water records for 5 days</string>
<string name="text_personal">Personal information</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="tab_name_home">Home</string>
<string name="tab_name_records">Records</string>
<string name="tab_name_set">Settings</string>
</resources>

View File

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.DrinkWater" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">@color/white</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

@ -0,0 +1,17 @@
package com.drink.water.test
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

BIN
app/testDrinkWater.jks Normal file

Binary file not shown.

5
build.gradle.kts Normal file
View File

@ -0,0 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.3" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}

23
gradle.properties Normal file
View File

@ -0,0 +1,23 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Mon Mar 18 14:40:10 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Normal file
View File

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

18
settings.gradle.kts Normal file
View File

@ -0,0 +1,18 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "DrinkWater"
include(":app")