├── .gitignore
├── .idea
├── .gitignore
├── .name
├── compiler.xml
├── deploymentTargetDropDown.xml
├── gradle.xml
├── kotlinc.xml
├── migrations.xml
├── misc.xml
└── vcs.xml
├── app
├── .gitignore
├── build.gradle.kts
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-playstore.png
│ ├── java
│ └── org
│ │ └── akanework
│ │ └── riviere
│ │ ├── Riviere.kt
│ │ ├── logic
│ │ ├── Extensions.kt
│ │ └── utils
│ │ │ └── DecimalDigitsInputFilter.kt
│ │ └── ui
│ │ ├── MainActivity.kt
│ │ ├── adapters
│ │ ├── HomeChipAdapter.kt
│ │ └── HomePresetAdapter.kt
│ │ ├── data
│ │ └── HolderTypes.kt
│ │ └── fragments
│ │ ├── BaseFragment.kt
│ │ └── HomeFragment.kt
│ └── res
│ ├── drawable
│ ├── bg_chip_background.xml
│ ├── ic_add.xml
│ ├── ic_arrow_downward.xml
│ ├── ic_category.xml
│ ├── ic_category_filled.xml
│ ├── ic_launcher_background.xml
│ ├── ic_launcher_foreground.xml
│ ├── ic_local_cafe.xml
│ ├── ic_remove.xml
│ ├── ic_star.xml
│ ├── ic_star_alt.xml
│ ├── minus_to_plus.xml
│ └── plus_to_minus.xml
│ ├── font
│ └── plexsans.ttf
│ ├── layout
│ ├── activity_main.xml
│ ├── bottom_sheet.xml
│ ├── chip_card_add.xml
│ ├── chip_card_layout.xml
│ ├── chip_card_layout_alt.xml
│ ├── detail_item.xml
│ ├── fragment_home.xml
│ ├── fragment_home_upper.xml
│ ├── preset_card_add.xml
│ ├── preset_card_layout.xml
│ └── total_header.xml
│ ├── mipmap-anydpi-v26
│ ├── ic_launcher.xml
│ └── ic_launcher_round.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-mdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── values-night
│ ├── bools.xml
│ ├── colors.xml
│ └── colors_md.xml
│ ├── values-v23
│ └── themes.xml
│ ├── values-v27
│ └── themes.xml
│ ├── values-v29
│ └── themes.xml
│ ├── values-zh-rCN
│ └── strings.xml
│ ├── values
│ ├── attrs.xml
│ ├── bools.xml
│ ├── colors.xml
│ ├── colors_md.xml
│ ├── ic_launcher_background.xml
│ ├── strings.xml
│ ├── theme_overlays.xml
│ └── themes.xml
│ └── xml
│ ├── backup_rules.xml
│ └── data_extraction_rules.xml
├── build.gradle.kts
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle.kts
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | Rivière
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/deploymentTargetDropDown.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/migrations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /release
3 | /debug
4 |
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("com.android.application")
3 | id("org.jetbrains.kotlin.android")
4 | }
5 |
6 | android {
7 | namespace = "org.akanework.riviere"
8 | compileSdk = 34
9 |
10 | defaultConfig {
11 | applicationId = "org.akanework.riviere"
12 | minSdk = 21
13 | targetSdk = 34
14 | versionCode = 1
15 | versionName = "1.0"
16 | }
17 |
18 | buildTypes {
19 | release {
20 | isMinifyEnabled = true
21 | isShrinkResources = true
22 | proguardFiles(
23 | getDefaultProguardFile("proguard-android-optimize.txt"),
24 | "proguard-rules.pro"
25 | )
26 | }
27 | }
28 | compileOptions {
29 | sourceCompatibility = JavaVersion.VERSION_1_8
30 | targetCompatibility = JavaVersion.VERSION_1_8
31 | }
32 | kotlinOptions {
33 | jvmTarget = "1.8"
34 | }
35 | }
36 |
37 | dependencies {
38 |
39 | implementation("androidx.core:core-ktx:1.12.0")
40 | implementation("androidx.appcompat:appcompat:1.6.1")
41 | implementation("com.google.android.material:material:1.11.0")
42 | implementation("androidx.constraintlayout:constraintlayout:2.1.4")
43 | implementation("androidx.preference:preference-ktx:1.2.1")
44 |
45 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/org/akanework/riviere/Riviere.kt:
--------------------------------------------------------------------------------
1 | package org.akanework.riviere
2 |
3 | import android.app.Application
4 | import com.google.android.material.color.DynamicColors
5 |
6 | class Riviere : Application() {
7 | override fun onCreate() {
8 | super.onCreate()
9 | DynamicColors.applyToActivitiesIfAvailable(this)
10 | }
11 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/akanework/riviere/logic/Extensions.kt:
--------------------------------------------------------------------------------
1 | package org.akanework.riviere.logic
2 |
3 | import android.content.res.Resources.getSystem
4 |
5 | val Int.dp: Int get() = (this.toFloat().dp).toInt()
6 |
7 | val Int.px: Int get() = (this.toFloat().px).toInt()
8 |
9 | val Float.dp: Float get() = this / getSystem().displayMetrics.density
10 |
11 | val Float.px: Float get() = this * getSystem().displayMetrics.density
--------------------------------------------------------------------------------
/app/src/main/java/org/akanework/riviere/logic/utils/DecimalDigitsInputFilter.kt:
--------------------------------------------------------------------------------
1 | package org.akanework.riviere.logic.utils
2 |
3 | import android.text.InputFilter
4 | import android.text.Spanned
5 |
6 | /**
7 | * Input filter that limits the number of decimal digits that are allowed to be
8 | * entered.
9 | */
10 | class DecimalDigitsInputFilter(private val decimalDigits: Int) :
11 | InputFilter {
12 |
13 | override fun filter(
14 | source: CharSequence,
15 | start: Int,
16 | end: Int,
17 | dest: Spanned,
18 | dstart: Int,
19 | dend: Int
20 | ): String? {
21 | var dotPos = -1
22 | val len = dest.length
23 | for (i in 0 until len) {
24 | val c = dest[i]
25 | if (c == '.' || c == ',') {
26 | dotPos = i
27 | break
28 | }
29 | }
30 |
31 | if (dotPos >= 0) {
32 |
33 | // protects against many dots
34 | if (source == "." || source == ",") {
35 | return ""
36 | }
37 | // if the text is entered before the dot
38 | if (dend <= dotPos) {
39 | return null
40 | }
41 | if (len - dotPos > decimalDigits) {
42 | return ""
43 | }
44 | }
45 | return null
46 | }
47 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/akanework/riviere/ui/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package org.akanework.riviere.ui
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 | import android.os.Bundle
5 | import androidx.activity.enableEdgeToEdge
6 | import androidx.core.view.WindowCompat
7 | import org.akanework.riviere.R
8 |
9 | class MainActivity : AppCompatActivity() {
10 | override fun onCreate(savedInstanceState: Bundle?) {
11 | super.onCreate(savedInstanceState)
12 | WindowCompat.setDecorFitsSystemWindows(window, false)
13 | setContentView(R.layout.activity_main)
14 | }
15 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/akanework/riviere/ui/adapters/HomeChipAdapter.kt:
--------------------------------------------------------------------------------
1 | package org.akanework.riviere.ui.adapters
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import android.widget.ImageView
8 | import android.widget.TextView
9 | import androidx.core.content.ContextCompat
10 | import androidx.recyclerview.widget.RecyclerView
11 | import org.akanework.riviere.R
12 | import org.akanework.riviere.ui.data.HolderTypes
13 |
14 | class HomeChipAdapter (
15 | private val cardData: MutableList,
16 | private val context: Context
17 | ) : RecyclerView.Adapter () {
18 |
19 | // private val prefs = PreferenceManager.getDefaultSharedPreferences(context)
20 |
21 | inner class ViewHolder(view: View) :
22 | RecyclerView.ViewHolder(view) {
23 | val desc: TextView = view.findViewById(R.id.desc)
24 | val icon: ImageView = view.findViewById(R.id.icon)
25 | }
26 |
27 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
28 | return ViewHolder(
29 | LayoutInflater.from(parent.context)
30 | .inflate(
31 | when (viewType) {
32 | 0 -> R.layout.chip_card_layout
33 | 1 -> R.layout.chip_card_layout_alt
34 | 2 -> R.layout.chip_card_add
35 | else -> throw IllegalArgumentException()
36 | },
37 | parent,
38 | false
39 | )
40 | )
41 | }
42 |
43 | override fun getItemViewType(position: Int): Int =
44 | if (!cardData[position].isBlock && position == 0) {
45 | 0
46 | } else if (!cardData[position].isBlock) {
47 | 1
48 | } else {
49 | 2
50 | }
51 |
52 | override fun getItemCount(): Int = cardData.size
53 |
54 | override fun onBindViewHolder(holder: ViewHolder, position: Int) {
55 | if (holder.itemViewType != 2) {
56 | holder.desc.text = cardData[position].desc ?: "餐厅"
57 | holder.icon.setImageDrawable(
58 | ContextCompat.getDrawable(
59 | context,
60 | cardData[position].icon ?: R.drawable.ic_local_cafe
61 | )
62 | )
63 | }
64 | }
65 |
66 | /*
67 |
68 | fun updateList(prefs: SharedPreferences) {
69 | val dumpList = StoreUtils.dumpExpenseList(prefs).toMutableList()
70 | if (dumpList.isEmpty()) {
71 | val initializeHorizontalCard = HolderTypes.HorizontalCardData(
72 | context.getString(R.string.quick_start),
73 | context.getString(R.string.add_your_expense_type),
74 | context.getString(R.string.first_expense_type),
75 | R.drawable.ic_add,
76 | true
77 | )
78 | dumpList.add(initializeHorizontalCard)
79 | }
80 | val diffResult = DiffUtil.calculateDiff(DiffCallback(cardData, dumpList))
81 | cardData.clear()
82 | cardData.addAll(dumpList)
83 | diffResult.dispatchUpdatesTo(this)
84 | }
85 |
86 | private class DiffCallback(
87 | private val oldList: MutableList,
88 | private val newList: MutableList,
89 | ) : DiffUtil.Callback() {
90 | override fun getOldListSize() = oldList.size
91 |
92 | override fun getNewListSize() = newList.size
93 |
94 | override fun areItemsTheSame(
95 | oldItemPosition: Int,
96 | newItemPosition: Int,
97 | ) = oldList[oldItemPosition] == newList[newItemPosition]
98 |
99 | override fun areContentsTheSame(
100 | oldItemPosition: Int,
101 | newItemPosition: Int,
102 | ) = oldList[oldItemPosition] == newList[newItemPosition]
103 | }
104 |
105 | */
106 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/akanework/riviere/ui/adapters/HomePresetAdapter.kt:
--------------------------------------------------------------------------------
1 | package org.akanework.riviere.ui.adapters
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import android.widget.ImageView
8 | import android.widget.TextView
9 | import androidx.core.content.ContextCompat
10 | import androidx.recyclerview.widget.RecyclerView
11 | import org.akanework.riviere.R
12 | import org.akanework.riviere.ui.data.HolderTypes
13 |
14 | class HomePresetAdapter (
15 | private val cardData: MutableList,
16 | private val context: Context
17 | ) : RecyclerView.Adapter () {
18 |
19 | // private val prefs = PreferenceManager.getDefaultSharedPreferences(context)
20 |
21 | inner class ViewHolder(view: View) :
22 | RecyclerView.ViewHolder(view) {
23 | val desc: TextView = view.findViewById(R.id.desc)
24 | val icon: ImageView = view.findViewById(R.id.indicator)
25 | val value: TextView = view.findViewById(R.id.value)
26 | }
27 |
28 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
29 | return ViewHolder(
30 | LayoutInflater.from(parent.context)
31 | .inflate(
32 | when (viewType) {
33 | 0 -> R.layout.preset_card_layout
34 | 1 -> R.layout.preset_card_add
35 | 2 -> R.layout.preset_card_layout
36 | else -> throw IllegalArgumentException()
37 | },
38 | parent,
39 | false
40 | )
41 | )
42 | }
43 |
44 | override fun getItemViewType(position: Int): Int {
45 | return if (position == 0 && !cardData[position].isBlock) {
46 | 0
47 | } else if (position > 0 && !cardData[position].isBlock) {
48 | 2
49 | } else {
50 | 1
51 | }
52 | }
53 |
54 | override fun getItemCount(): Int = cardData.size
55 |
56 | override fun onBindViewHolder(holder: ViewHolder, position: Int) {
57 | holder.value.text = (cardData[position].defVal ?: "").toString()
58 | holder.desc.text = cardData[position].desc ?: ""
59 | holder.icon.setImageDrawable(ContextCompat.getDrawable(
60 | context,
61 | cardData[position].icon ?: R.drawable.ic_local_cafe
62 | ))
63 | }
64 |
65 | /*
66 |
67 | fun updateList(prefs: SharedPreferences) {
68 | val dumpList = StoreUtils.dumpExpenseList(prefs).toMutableList()
69 | if (dumpList.isEmpty()) {
70 | val initializeHorizontalCard = HolderTypes.HorizontalCardData(
71 | context.getString(R.string.quick_start),
72 | context.getString(R.string.add_your_expense_type),
73 | context.getString(R.string.first_expense_type),
74 | R.drawable.ic_add,
75 | true
76 | )
77 | dumpList.add(initializeHorizontalCard)
78 | }
79 | val diffResult = DiffUtil.calculateDiff(DiffCallback(cardData, dumpList))
80 | cardData.clear()
81 | cardData.addAll(dumpList)
82 | diffResult.dispatchUpdatesTo(this)
83 | }
84 |
85 | private class DiffCallback(
86 | private val oldList: MutableList,
87 | private val newList: MutableList,
88 | ) : DiffUtil.Callback() {
89 | override fun getOldListSize() = oldList.size
90 |
91 | override fun getNewListSize() = newList.size
92 |
93 | override fun areItemsTheSame(
94 | oldItemPosition: Int,
95 | newItemPosition: Int,
96 | ) = oldList[oldItemPosition] == newList[newItemPosition]
97 |
98 | override fun areContentsTheSame(
99 | oldItemPosition: Int,
100 | newItemPosition: Int,
101 | ) = oldList[oldItemPosition] == newList[newItemPosition]
102 | }
103 |
104 | */
105 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/akanework/riviere/ui/data/HolderTypes.kt:
--------------------------------------------------------------------------------
1 | package org.akanework.riviere.ui.data
2 |
3 | object HolderTypes {
4 | data class PresetType (
5 | val icon: Int? = null,
6 | val desc: String? = null,
7 | val defVal: Float? = null,
8 | val currencyType: Char? = null,
9 | val isBlock: Boolean = false
10 | )
11 |
12 | data class ChipType (
13 | val icon: Int? = null,
14 | val desc: String? = null,
15 | val isBlock: Boolean = false
16 | )
17 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/akanework/riviere/ui/fragments/BaseFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Akane Foundation
3 | *
4 | * Gramophone is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Gramophone is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | package org.akanework.riviere.ui.fragments
19 |
20 | import android.os.Bundle
21 | import androidx.fragment.app.Fragment
22 | import com.google.android.material.transition.MaterialSharedAxis
23 |
24 | abstract class BaseFragment : Fragment() {
25 |
26 | override fun onCreate(savedInstanceState: Bundle?) {
27 | super.onCreate(savedInstanceState)
28 | // Enable material transitions.
29 | enterTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ true)
30 | returnTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ false)
31 | exitTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ true)
32 | reenterTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ false)
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/akanework/riviere/ui/fragments/HomeFragment.kt:
--------------------------------------------------------------------------------
1 | package org.akanework.riviere.ui.fragments
2 |
3 | import android.animation.ValueAnimator
4 | import android.content.SharedPreferences
5 | import android.content.res.ColorStateList
6 | import android.graphics.drawable.AnimatedVectorDrawable
7 | import android.os.Bundle
8 | import android.text.InputFilter
9 | import android.util.DisplayMetrics
10 | import android.util.Log
11 | import android.view.LayoutInflater
12 | import android.view.View
13 | import android.view.ViewGroup
14 | import android.widget.EditText
15 | import android.widget.FrameLayout
16 | import android.widget.TextView
17 | import androidx.appcompat.content.res.AppCompatResources
18 | import androidx.core.content.ContextCompat
19 | import androidx.preference.PreferenceManager
20 | import androidx.recyclerview.widget.LinearLayoutManager
21 | import androidx.recyclerview.widget.RecyclerView
22 | import com.google.android.material.bottomsheet.BottomSheetBehavior
23 | import com.google.android.material.button.MaterialButton
24 | import com.google.android.material.card.MaterialCardView
25 | import com.google.android.material.color.MaterialColors
26 | import com.google.android.material.slider.Slider
27 | import org.akanework.riviere.R
28 | import org.akanework.riviere.logic.px
29 | import org.akanework.riviere.logic.utils.DecimalDigitsInputFilter
30 | import org.akanework.riviere.ui.adapters.HomeChipAdapter
31 | import org.akanework.riviere.ui.adapters.HomePresetAdapter
32 | import org.akanework.riviere.ui.data.HolderTypes
33 |
34 |
35 | class HomeFragment : BaseFragment() {
36 |
37 | companion object {
38 | const val ACTION_BUTTON_ANIMATION_DURATION: Long = 300
39 | }
40 |
41 | private lateinit var prefs: SharedPreferences
42 |
43 | private lateinit var formatSwitchButton: MaterialButton
44 | private lateinit var targetExpenseEditText: EditText
45 |
46 | private var colorPlusPrimaryContainer: Int = -1
47 | private var colorPlusOnPrimaryContainer: Int = -1
48 | private var colorMinusPrimaryContainer: Int = -1
49 | private var colorMinusOnPrimaryContainer: Int = -1
50 |
51 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
52 | super.onViewCreated(view, savedInstanceState)
53 | view.setBackgroundColor(
54 | MaterialColors.getColor(view, com.google.android.material.R.attr.colorSurfaceContainer)
55 | )
56 | }
57 |
58 | @Suppress("DEPRECATION")
59 | override fun onCreateView(
60 | inflater: LayoutInflater,
61 | container: ViewGroup?,
62 | savedInstanceState: Bundle?
63 | ): View? {
64 | Log.d("TAG", "HOMEFRAGMENT ONCREATE")
65 |
66 | prefs = PreferenceManager.getDefaultSharedPreferences(requireContext())
67 |
68 | val rootView = inflater.inflate(R.layout.fragment_home, container, false)
69 |
70 | // Upper part
71 | val presetRecyclerView: RecyclerView = rootView.findViewById(R.id.preset_recyclerview)
72 | val chipRecyclerView: RecyclerView = rootView.findViewById(R.id.chips_recyclerview)
73 | targetExpenseEditText = rootView.findViewById(R.id.target_expense)
74 |
75 | formatSwitchButton = rootView.findViewById(R.id.plus_minus_switch)
76 |
77 | // Bottom part
78 | val bottomSheet: FrameLayout = rootView.findViewById(R.id.bottom_sheet)
79 | val standardBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
80 | val bottomSheetHeaderCard: MaterialCardView = bottomSheet.findViewById(R.id.bottom_header)
81 | val expenseTitleTextView: TextView = bottomSheet.findViewById(R.id.expense_title)
82 | val currencyIcon: TextView = bottomSheet.findViewById(R.id.currency)
83 | val roundCounterTextView: TextView = bottomSheet.findViewById(R.id.round)
84 | val decimalCounterTextView: TextView = bottomSheet.findViewById(R.id.decimal)
85 | val incomeTitleTextView: TextView = bottomSheet.findViewById(R.id.income_title)
86 | val incomeTextView: TextView = bottomSheet.findViewById(R.id.income)
87 | val budgetTitleTextView: TextView = bottomSheet.findViewById(R.id.budget_title)
88 | val budgetTextView: TextView = bottomSheet.findViewById(R.id.budget)
89 | val budgetSlider: Slider = bottomSheet.findViewById(R.id.budget_slider)
90 |
91 | // Get colors
92 | val colorPositiveBottomHeaderPrimaryContainer =
93 | MaterialColors.harmonizeWithPrimary(
94 | requireContext(),
95 | ContextCompat.getColor(
96 | requireContext(),
97 | R.color.bottom_sheet_colorPrimaryContainer)
98 | )
99 | val colorPositiveBottomHeaderOnPrimaryContainer =
100 | MaterialColors.harmonizeWithPrimary(
101 | requireContext(),
102 | ContextCompat.getColor(
103 | requireContext(),
104 | R.color.bottom_sheet_colorOnPrimaryContainer)
105 | )
106 | val colorPositiveBottomHeaderPrimaryInverse =
107 | MaterialColors.harmonizeWithPrimary(
108 | requireContext(),
109 | ContextCompat.getColor(
110 | requireContext(),
111 | R.color.bottom_sheet_colorPrimaryInverse)
112 | )
113 | colorPlusPrimaryContainer =
114 | MaterialColors.getColor(
115 | requireContext(),
116 | com.google.android.material.R.attr.colorPrimary,
117 | -1
118 | )
119 | colorPlusOnPrimaryContainer =
120 | MaterialColors.getColor(
121 | requireContext(),
122 | com.google.android.material.R.attr.colorOnPrimary,
123 | -1
124 | )
125 | colorMinusPrimaryContainer =
126 | MaterialColors.getColor(
127 | requireContext(),
128 | com.google.android.material.R.attr.colorTertiary,
129 | -1
130 | )
131 | colorMinusOnPrimaryContainer =
132 | MaterialColors.getColor(
133 | requireContext(),
134 | com.google.android.material.R.attr.colorOnTertiary,
135 | -1
136 | )
137 |
138 | setUpSwitchButton()
139 | setupUpperPart()
140 |
141 | // Dispatch colors
142 | bottomSheetHeaderCard.setCardBackgroundColor(
143 | colorPositiveBottomHeaderPrimaryContainer
144 | )
145 | expenseTitleTextView.setTextColor(
146 | colorPositiveBottomHeaderOnPrimaryContainer
147 | )
148 | currencyIcon.setTextColor(
149 | colorPositiveBottomHeaderOnPrimaryContainer
150 | )
151 | roundCounterTextView.setTextColor(
152 | colorPositiveBottomHeaderOnPrimaryContainer
153 | )
154 | decimalCounterTextView.setTextColor(
155 | colorPositiveBottomHeaderOnPrimaryContainer
156 | )
157 | incomeTitleTextView.setTextColor(
158 | colorPositiveBottomHeaderOnPrimaryContainer
159 | )
160 | incomeTextView.setTextColor(
161 | colorPositiveBottomHeaderOnPrimaryContainer
162 | )
163 | budgetTitleTextView.setTextColor(
164 | colorPositiveBottomHeaderOnPrimaryContainer
165 | )
166 | budgetTextView.setTextColor(
167 | colorPositiveBottomHeaderOnPrimaryContainer
168 | )
169 | budgetSlider.trackActiveTintList =
170 | ColorStateList.valueOf(colorPositiveBottomHeaderOnPrimaryContainer)
171 | budgetSlider.trackInactiveTintList =
172 | ColorStateList.valueOf(colorPositiveBottomHeaderPrimaryInverse)
173 |
174 | val displayMetrics = DisplayMetrics()
175 |
176 | requireActivity().windowManager.defaultDisplay.getMetrics(displayMetrics)
177 |
178 | val halfScreenHeight = displayMetrics.heightPixels - 324.px
179 |
180 | standardBottomSheetBehavior.peekHeight = halfScreenHeight
181 |
182 | presetRecyclerView.adapter = HomePresetAdapter(
183 | mutableListOf(
184 | HolderTypes.PresetType(
185 | null,
186 | "星巴克",
187 | -50f,
188 | isBlock = false
189 | ),
190 | HolderTypes.PresetType(
191 | isBlock = true
192 | )
193 | ),
194 | requireContext()
195 | )
196 | presetRecyclerView.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
197 | chipRecyclerView.adapter = HomeChipAdapter(
198 | mutableListOf(
199 | HolderTypes.ChipType(
200 | R.drawable.ic_category_filled,
201 | "默认"
202 | ),
203 | HolderTypes.ChipType(
204 |
205 | ),
206 | HolderTypes.ChipType(
207 | isBlock = true
208 | )
209 | ),
210 | requireContext()
211 | )
212 | chipRecyclerView.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
213 |
214 | return rootView
215 | }
216 |
217 | private fun setUpSwitchButton() {
218 | val formatSwitchButtonIsPlus = prefs.getBoolean("switch_button_state", true)
219 | setButtonStatus(formatSwitchButtonIsPlus, false)
220 | formatSwitchButton.setOnClickListener {
221 | val status = prefs.getBoolean("switch_button_state", true)
222 | setButtonStatus(
223 | !status, true
224 | )
225 | prefs.edit()
226 | .putBoolean("switch_button_state", !status)
227 | .apply()
228 | }
229 | }
230 |
231 | private fun setButtonStatus(isPlus: Boolean, withAnimation: Boolean) {
232 | if (!withAnimation) {
233 | formatSwitchButton.iconTint =
234 | ColorStateList.valueOf(
235 | if (isPlus) colorPlusOnPrimaryContainer else colorMinusOnPrimaryContainer
236 | )
237 | formatSwitchButton.backgroundTintList =
238 | ColorStateList.valueOf(
239 | if (isPlus) colorPlusPrimaryContainer else colorMinusPrimaryContainer
240 | )
241 | formatSwitchButton.icon =
242 | AppCompatResources.getDrawable(
243 | requireContext(),
244 | if (isPlus) R.drawable.minus_to_plus else R.drawable.plus_to_minus
245 | )
246 | } else {
247 | val backgroundAnimator = ValueAnimator.ofArgb(
248 | if (isPlus) colorMinusPrimaryContainer else colorPlusPrimaryContainer,
249 | if (isPlus) colorPlusPrimaryContainer else colorMinusPrimaryContainer
250 | )
251 | val iconAnimator = ValueAnimator.ofArgb(
252 | if (isPlus) colorMinusOnPrimaryContainer else colorPlusOnPrimaryContainer,
253 | if (isPlus) colorPlusOnPrimaryContainer else colorMinusOnPrimaryContainer
254 | )
255 | backgroundAnimator.apply {
256 | addUpdateListener {
257 | val color = it.animatedValue as Int
258 | formatSwitchButton.backgroundTintList =
259 | ColorStateList.valueOf(color)
260 | }
261 | duration = ACTION_BUTTON_ANIMATION_DURATION
262 | }
263 | iconAnimator.apply {
264 | addUpdateListener {
265 | val color = it.animatedValue as Int
266 | formatSwitchButton.iconTint =
267 | ColorStateList.valueOf(color)
268 | }
269 | duration = ACTION_BUTTON_ANIMATION_DURATION
270 | }
271 | formatSwitchButton.icon =
272 | AppCompatResources.getDrawable(
273 | requireContext(),
274 | if (isPlus) R.drawable.minus_to_plus else R.drawable.plus_to_minus
275 | )
276 | backgroundAnimator.start()
277 | iconAnimator.start()
278 | (formatSwitchButton.icon as AnimatedVectorDrawable).start()
279 | }
280 | }
281 |
282 | private fun setupUpperPart() {
283 | targetExpenseEditText.setFilters(
284 | arrayOf(
285 | DecimalDigitsInputFilter(2)
286 | )
287 | )
288 | }
289 |
290 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_chip_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_downward.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_category.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_category_filled.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_local_cafe.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_remove.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_star.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_star_alt.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/minus_to_plus.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
11 |
15 |
19 |
20 |
21 |
22 |
23 |
24 |
31 |
32 |
33 |
34 |
35 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/plus_to_minus.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
11 |
15 |
19 |
20 |
21 |
22 |
23 |
24 |
31 |
32 |
33 |
34 |
35 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/font/plexsans.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/font/plexsans.ttf
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/bottom_sheet.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
23 |
33 |
34 |
37 |
38 |
50 |
51 |
63 |
64 |
76 |
77 |
89 |
90 |
101 |
102 |
113 |
114 |
125 |
126 |
137 |
138 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/chip_card_add.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
24 |
25 |
26 |
27 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/chip_card_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
21 |
22 |
32 |
33 |
41 |
42 |
43 |
44 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/chip_card_layout_alt.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
21 |
22 |
32 |
33 |
41 |
42 |
43 |
44 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/detail_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
13 |
14 |
21 |
22 |
28 |
29 |
30 |
31 |
36 |
37 |
45 |
46 |
53 |
54 |
55 |
56 |
57 |
58 |
63 |
64 |
72 |
73 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_home_upper.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
30 |
31 |
46 |
47 |
60 |
61 |
78 |
79 |
90 |
91 |
104 |
105 |
119 |
120 |
136 |
137 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/preset_card_add.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
17 |
18 |
23 |
24 |
29 |
30 |
33 |
34 |
42 |
43 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/preset_card_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
15 |
16 |
27 |
28 |
35 |
36 |
37 |
38 |
48 |
49 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/total_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
21 |
22 |
30 |
31 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/values-night/bools.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #ace2aa
5 | #19481f
6 | #39693c
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/colors_md.xml:
--------------------------------------------------------------------------------
1 |
2 | #9ED49D
3 | #053912
4 | #205026
5 | #BAF0B7
6 | #B9CCB4
7 | #243424
8 | #3A4B39
9 | #D5E8D0
10 | #A1CED5
11 | #00363C
12 | #1F4D53
13 | #BCEBF2
14 | #FFB4AB
15 | #690005
16 | #93000A
17 | #FFDAD6
18 | #101410
19 | #E0E4DB
20 | #101410
21 | #E0E4DB
22 | #424940
23 | #C2C9BD
24 | #8C9388
25 | #424940
26 | #000000
27 | #E0E4DB
28 | #2D322C
29 | #38693C
30 | #BAF0B7
31 | #002106
32 | #9ED49D
33 | #205026
34 | #D5E8D0
35 | #101F10
36 | #B9CCB4
37 | #3A4B39
38 | #BCEBF2
39 | #001F23
40 | #A1CED5
41 | #1F4D53
42 | #101410
43 | #363A34
44 | #0B0F0B
45 | #181D18
46 | #1C211B
47 | #272B26
48 | #313630
49 | #A2D8A1
50 | #001B04
51 | #6A9D6A
52 | #000000
53 | #BDD0B9
54 | #0A1A0B
55 | #839680
56 | #000000
57 | #A5D3DA
58 | #001A1D
59 | #6C989F
60 | #000000
61 | #FFBAB1
62 | #370001
63 | #FF5449
64 | #000000
65 | #101410
66 | #E0E4DB
67 | #101410
68 | #F8FCF3
69 | #424940
70 | #C6CDC1
71 | #9EA59A
72 | #7E857B
73 | #000000
74 | #E0E4DB
75 | #272B26
76 | #215227
77 | #BAF0B7
78 | #001603
79 | #9ED49D
80 | #0C3F17
81 | #D5E8D0
82 | #061407
83 | #B9CCB4
84 | #2A3A29
85 | #BCEBF2
86 | #001417
87 | #A1CED5
88 | #083C42
89 | #101410
90 | #363A34
91 | #0B0F0B
92 | #181D18
93 | #1C211B
94 | #272B26
95 | #313630
96 | #F0FFEB
97 | #000000
98 | #A2D8A1
99 | #000000
100 | #F0FFEB
101 | #000000
102 | #BDD0B9
103 | #000000
104 | #F1FDFF
105 | #000000
106 | #A5D3DA
107 | #000000
108 | #FFF9F9
109 | #000000
110 | #FFBAB1
111 | #000000
112 | #101410
113 | #E0E4DB
114 | #101410
115 | #FFFFFF
116 | #424940
117 | #F6FDF1
118 | #C6CDC1
119 | #C6CDC1
120 | #000000
121 | #E0E4DB
122 | #000000
123 | #00320D
124 | #BEF5BB
125 | #000000
126 | #A2D8A1
127 | #001B04
128 | #D9ECD4
129 | #000000
130 | #BDD0B9
131 | #0A1A0B
132 | #C1EFF6
133 | #000000
134 | #A5D3DA
135 | #001A1D
136 | #101410
137 | #363A34
138 | #0B0F0B
139 | #181D18
140 | #1C211B
141 | #272B26
142 | #313630
143 | #83D3E3
144 | #00363E
145 | #004E59
146 | #A1EFFF
147 | #FDB975
148 | #4A2800
149 | #693C00
150 | #FFDCBE
151 | #87D7E7
152 | #001A1E
153 | #4A9CAB
154 | #000000
155 | #FFBE7D
156 | #251200
157 | #C08446
158 | #000000
159 | #F2FCFF
160 | #000000
161 | #87D7E7
162 | #000000
163 | #FFFAF8
164 | #000000
165 | #FFBE7D
166 | #000000
167 |
168 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v23/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v27/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v29/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Rivière
3 | Plus and minus switch
4 | 快速记录
5 | 收入
6 | 预算
7 | 支出
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/bools.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #bef4bb
5 | #255429
6 | #9fd49d
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors_md.xml:
--------------------------------------------------------------------------------
1 |
2 | #38693C
3 | #FFFFFF
4 | #BAF0B7
5 | #002106
6 | #526350
7 | #FFFFFF
8 | #D5E8D0
9 | #101F10
10 | #39656B
11 | #FFFFFF
12 | #BCEBF2
13 | #001F23
14 | #BA1A1A
15 | #FFFFFF
16 | #FFDAD6
17 | #410002
18 | #F7FBF2
19 | #181D18
20 | #F7FBF2
21 | #181D18
22 | #DEE5D9
23 | #424940
24 | #72796F
25 | #C2C9BD
26 | #000000
27 | #2D322C
28 | #EEF2E9
29 | #9ED49D
30 | #BAF0B7
31 | #002106
32 | #9ED49D
33 | #205026
34 | #D5E8D0
35 | #101F10
36 | #B9CCB4
37 | #3A4B39
38 | #BCEBF2
39 | #001F23
40 | #A1CED5
41 | #1F4D53
42 | #D7DBD3
43 | #F7FBF2
44 | #FFFFFF
45 | #F1F5EC
46 | #EBEFE6
47 | #E6E9E1
48 | #E0E4DB
49 | #1C4C22
50 | #FFFFFF
51 | #4E8050
52 | #FFFFFF
53 | #374735
54 | #FFFFFF
55 | #687965
56 | #FFFFFF
57 | #1A494F
58 | #FFFFFF
59 | #4F7C82
60 | #FFFFFF
61 | #8C0009
62 | #FFFFFF
63 | #DA342E
64 | #FFFFFF
65 | #F7FBF2
66 | #181D18
67 | #F7FBF2
68 | #181D18
69 | #DEE5D9
70 | #3E453C
71 | #5A6158
72 | #767D73
73 | #000000
74 | #2D322C
75 | #EEF2E9
76 | #9ED49D
77 | #4E8050
78 | #FFFFFF
79 | #36663A
80 | #FFFFFF
81 | #687965
82 | #FFFFFF
83 | #4F604D
84 | #FFFFFF
85 | #4F7C82
86 | #FFFFFF
87 | #366369
88 | #FFFFFF
89 | #D7DBD3
90 | #F7FBF2
91 | #FFFFFF
92 | #F1F5EC
93 | #EBEFE6
94 | #E6E9E1
95 | #E0E4DB
96 | #002909
97 | #FFFFFF
98 | #1C4C22
99 | #FFFFFF
100 | #162616
101 | #FFFFFF
102 | #374735
103 | #FFFFFF
104 | #00272B
105 | #FFFFFF
106 | #1A494F
107 | #FFFFFF
108 | #4E0002
109 | #FFFFFF
110 | #8C0009
111 | #FFFFFF
112 | #F7FBF2
113 | #181D18
114 | #F7FBF2
115 | #000000
116 | #DEE5D9
117 | #1F261E
118 | #3E453C
119 | #3E453C
120 | #000000
121 | #2D322C
122 | #FFFFFF
123 | #C3FAC0
124 | #1C4C22
125 | #FFFFFF
126 | #00350E
127 | #FFFFFF
128 | #374735
129 | #FFFFFF
130 | #213120
131 | #FFFFFF
132 | #1A494F
133 | #FFFFFF
134 | #003238
135 | #FFFFFF
136 | #D7DBD3
137 | #F7FBF2
138 | #FFFFFF
139 | #F1F5EC
140 | #EBEFE6
141 | #E6E9E1
142 | #E0E4DB
143 | #006876
144 | #FFFFFF
145 | #A1EFFF
146 | #001F25
147 | #855318
148 | #FFFFFF
149 | #FFDCBE
150 | #2C1600
151 | #004A55
152 | #FFFFFF
153 | #267F8E
154 | #FFFFFF
155 | #643800
156 | #FFFFFF
157 | #9F682D
158 | #FFFFFF
159 | #00272D
160 | #FFFFFF
161 | #004A55
162 | #FFFFFF
163 | #361C00
164 | #FFFFFF
165 | #643800
166 | #FFFFFF
167 |
168 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #BAF0B7
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Rivière
3 | Plus and minus switch
4 | Quick record
5 | Income
6 | Budget
7 | Expense
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/theme_overlays.xml:
--------------------------------------------------------------------------------
1 |
2 |
58 |
114 |
115 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
61 |
62 |
65 |
66 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | plugins {
3 | id("com.android.application") version "8.2.1" apply false
4 | id("org.jetbrains.kotlin.android") version "1.9.10" apply false
5 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
20 | # Enables namespacing of each library's R class so that its R class includes only the
21 | # resources declared in the library itself and none from the library's dependencies,
22 | # thereby reducing the size of the R class for that library
23 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AkaneTan/Riviere/32dfe5cde01fee49949a45a17399026af09ef5e6/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Dec 24 14:23:36 CST 2023
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | gradlePluginPortal()
6 | }
7 | }
8 | dependencyResolutionManagement {
9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | }
15 |
16 | rootProject.name = "Rivière"
17 | include(":app")
18 |
--------------------------------------------------------------------------------