Compare commits
1 Commits
master
...
420b2f0b66
| Author | SHA1 | Date | |
|---|---|---|---|
| 420b2f0b66 |
19
README.md
19
README.md
@@ -13,24 +13,7 @@ Dedicated to my daughter Luna.
|
||||
|
||||

|
||||
|
||||
## Contributions
|
||||
|
||||
### Why isn't this hosted on GitHub?
|
||||
|
||||
I'm using a private git server just because I'm worried for the vast majority of open source code being hosted in a server property of Microsoft and being used to train theirs AI.
|
||||
I didn't find a better option, BTW the Gitea project is working on implementing federation, so soon it will be possible to contribute using any other gitea server, selfhosted or not.
|
||||
|
||||
### How to contribute
|
||||
|
||||
The project is open to contribution, but with some limits:
|
||||
|
||||
- I'm sorry I can't accept AI-generated contributions. Reviewing a contribution requires time and effort from my side, while generating code with AI requires very little time and produces non reliable code that must be reviewed in detail. This is effectively shifting the work on my side, and in a forced way. If you feel you need a feature but you're not able to implement it by yourself, I prefer you to create an issue in the repository so I can implement it when I can, in a more mantainable way.
|
||||
- I prefer to make project-wide changes (i.e. updating Android target, app name and icon, release number...) by myself.
|
||||
|
||||
To contribute, you'll have to create an account on this git instance. Unfortunately, I had to disable registration to avoid huge waves of fake accounts created by bots.
|
||||
You can request an account writing to daniele.verducci@ichibi.eu
|
||||
|
||||
### Thanks for the valuable contributions to:
|
||||
## Thanks for the valuable contributions to:
|
||||
|
||||
- Chepycou (French translation)
|
||||
- Daniel Neubauer (German translation)
|
||||
|
||||
@@ -12,8 +12,8 @@ android {
|
||||
applicationId = "it.danieleverducci.lunatracker"
|
||||
minSdk = 21
|
||||
targetSdk = 34
|
||||
versionCode = 7
|
||||
versionName = "0.9"
|
||||
versionCode = 6
|
||||
versionName = "0.8"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -60,4 +60,4 @@ dependencies {
|
||||
androidTestImplementation(libs.androidx.ui.test.junit4)
|
||||
debugImplementation(libs.androidx.ui.tooling)
|
||||
debugImplementation(libs.androidx.ui.test.manifest)
|
||||
}
|
||||
}
|
||||
@@ -128,6 +128,10 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getAllEvents(): ArrayList<LunaEvent> {
|
||||
return logbook?.logs ?: arrayListOf()
|
||||
}
|
||||
|
||||
private fun setListAdapter(items: ArrayList<LunaEvent>) {
|
||||
val adapter = LunaEventRecyclerAdapter(this, items)
|
||||
adapter.onItemClickListener = object: LunaEventRecyclerAdapter.OnItemClickListener {
|
||||
@@ -275,7 +279,7 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
||||
val pos = spinner.selectedItemPosition
|
||||
logEvent(LunaEvent(LunaEvent.TYPE_PUKE, pos + 1))
|
||||
logEvent(LunaEvent(LunaEvent.TYPE_PUKE, pos))
|
||||
}
|
||||
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i -> dialogInterface.dismiss() }
|
||||
val alertDialog = d.create()
|
||||
@@ -283,6 +287,9 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
fun askNotes(lunaEvent: LunaEvent) {
|
||||
val allEvents = getAllEvents()
|
||||
val useQuantity = (lunaEvent.type != LunaEvent.TYPE_NOTE && lunaEvent.type != LunaEvent.TYPE_CUSTOM)
|
||||
|
||||
val d = AlertDialog.Builder(this)
|
||||
val dialogView = layoutInflater.inflate(R.layout.dialog_notes, null)
|
||||
d.setTitle(lunaEvent.getTypeDescription(this))
|
||||
@@ -290,11 +297,64 @@ class MainActivity : AppCompatActivity() {
|
||||
d.setView(dialogView)
|
||||
val notesET = dialogView.findViewById<EditText>(R.id.notes_edittext)
|
||||
val qtyET = dialogView.findViewById<EditText>(R.id.notes_qty_edittext)
|
||||
if (lunaEvent.type == LunaEvent.TYPE_NOTE || lunaEvent.type == LunaEvent.TYPE_CUSTOM)
|
||||
|
||||
val nextTextView = dialogView.findViewById<TextView>(R.id.notes_template_next)
|
||||
val clearTextView = dialogView.findViewById<TextView>(R.id.notes_clear)
|
||||
val prevTextView = dialogView.findViewById<TextView>(R.id.notes_template_prev)
|
||||
|
||||
fun updateContent(current: LunaEvent) {
|
||||
val prevEvent = getPreviousSameEvent(current, allEvents)
|
||||
val nextEvent = getNextSameEvent(current, allEvents)
|
||||
|
||||
notesET.setText(current.notes)
|
||||
if (useQuantity) {
|
||||
qtyET.setText(current.quantity.toString())
|
||||
}
|
||||
|
||||
if (nextEvent != null) {
|
||||
nextTextView.visibility = View.VISIBLE
|
||||
nextTextView.setOnClickListener {
|
||||
notesET.setText(nextEvent.notes)
|
||||
if (useQuantity) {
|
||||
qtyET.setText(nextEvent.quantity.toString())
|
||||
}
|
||||
updateContent(nextEvent)
|
||||
}
|
||||
} else {
|
||||
nextTextView.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (prevEvent != null) {
|
||||
prevTextView.visibility = View.VISIBLE
|
||||
prevTextView.setOnClickListener {
|
||||
notesET.setText(prevEvent.notes)
|
||||
if (useQuantity) {
|
||||
qtyET.setText(prevEvent.quantity.toString())
|
||||
}
|
||||
updateContent(prevEvent)
|
||||
}
|
||||
} else {
|
||||
prevTextView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
clearTextView.setOnClickListener {
|
||||
notesET.setText("")
|
||||
if (useQuantity) {
|
||||
qtyET.setText("")
|
||||
}
|
||||
updateContent(lunaEvent)
|
||||
}
|
||||
|
||||
if (!useQuantity) {
|
||||
qtyET.visibility = View.GONE
|
||||
}
|
||||
|
||||
updateContent(lunaEvent)
|
||||
|
||||
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
||||
val qtyStr = qtyET.text.toString()
|
||||
if (qtyStr.isNotEmpty()) {
|
||||
if (qtyStr.isNotEmpty() && useQuantity) {
|
||||
val qty = qtyStr.toIntOrNull()
|
||||
if (qty == null) {
|
||||
Toast.makeText(this, R.string.toast_integer_error, Toast.LENGTH_SHORT).show()
|
||||
|
||||
@@ -67,7 +67,7 @@ class NumericUtils (val context: Context) {
|
||||
LunaEvent.TYPE_TEMPERATURE ->
|
||||
(item.quantity / 10.0f).toString()
|
||||
LunaEvent.TYPE_PUKE ->
|
||||
context.resources.getStringArray(R.array.AmountLabels)[item.quantity - 1]
|
||||
context.resources.getStringArray(R.array.AmountLabels)[item.quantity]
|
||||
else ->
|
||||
item.quantity
|
||||
})
|
||||
|
||||
@@ -24,4 +24,30 @@
|
||||
android:hint="@string/log_notes_dialog_note_hint"
|
||||
android:background="@drawable/textview_background"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/notes_template_prev"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16dp"
|
||||
android:text="⬅️"/>
|
||||
<TextView
|
||||
android:id="@+id/notes_clear"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:textSize="16dp"
|
||||
android:text="🚫"/>
|
||||
<TextView
|
||||
android:id="@+id/notes_template_next"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16dp"
|
||||
android:text="➡️"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user