Skip to content

Commit

Permalink
Less text in GPX list view
Browse files Browse the repository at this point in the history
  • Loading branch information
bailuk committed Feb 10, 2025
1 parent 6eae8af commit d0eb3f9
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ch.bailu.aat.R
import ch.bailu.aat.preferences.system.AndroidSolidDataDirectoryDefault
import ch.bailu.aat_lib.description.AverageSpeedDescription
import ch.bailu.aat_lib.description.ContentDescription
import ch.bailu.aat_lib.description.DateDescription
import ch.bailu.aat_lib.description.DateDescriptionCompact
import ch.bailu.aat_lib.description.DistanceDescription
import ch.bailu.aat_lib.description.MaximumSpeedDescription
import ch.bailu.aat_lib.description.NameDescription
Expand All @@ -19,7 +19,7 @@ import ch.bailu.foc_android.FocAndroidFactory
class TrackListActivity : AbsGpxListActivity() {
override val gpxListItemData: Array<ContentDescription>
get() = arrayOf(
DateDescription(),
DateDescriptionCompact(),
DistanceDescription(appContext.storage),
AverageSpeedDescription(appContext.storage),
TimeDescription(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ open class LabelTextView(
context,
labelText,
theme
) {
}
)

init {
orientation = VERTICAL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class GpxListEntryView(
private var file = FocAndroid.NULL
private fun addViewWeight(v: View) {
v.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1f)
v.setBackgroundColor(Color.RED)
addView(v)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import ch.bailu.aat_lib.preferences.SolidFile

class SolidDirectoryDialog(private val acontext: Activity, sdirectory: SolidFile) :
SolidStringDialog(acontext, sdirectory) {
private val saf: SolidSAF

init {
saf = SolidSAF(sdirectory)
}
private val saf: SolidSAF = SolidSAF(sdirectory)

override fun buildExtraSelection(context: Context, sel: ArrayList<String>) {
super.buildExtraSelection(context, sel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ open class DateDescription : LongDescription() {
}

override fun getValue(): String {
return f().LOCAL_DATE_TIME.format(cache)
return f().localDateTime.format(cache)
}

override fun onContentUpdated(iid: Int, info: GpxInformation) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ch.bailu.aat_lib.description

import ch.bailu.aat_lib.description.FF.Companion.f
import ch.bailu.aat_lib.gpx.information.GpxInformation
import ch.bailu.aat_lib.resources.Res

class DateDescriptionCompact : LongDescription() {
override fun getLabel(): String {
return Res.str().d_startdate()
}

override fun getValue(): String {
return f().localDateTimeCompact.format(cache)
}

override fun onContentUpdated(iid: Int, info: GpxInformation) {
setCache(info.getStartTime())
}
}
10 changes: 8 additions & 2 deletions aat-lib/src/main/java/ch/bailu/aat_lib/description/FF.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ import java.text.DecimalFormat

class FF private constructor() {
@JvmField
val LOCAL_DATE_TIME = DateFormat.getDateTimeInstance(
val localDateTime: DateFormat = DateFormat.getDateTimeInstance(
DateFormat.LONG, DateFormat.LONG
)
val localDateTimeCompact: DateFormat = DateFormat.getDateTimeInstance(
DateFormat.LONG, DateFormat.SHORT
)

@JvmField
val LOCAL_DATE = DateFormat.getDateInstance()
val localDate: DateFormat = DateFormat.getDateInstance()


@JvmField
val N = DecimalFormat("0")
@JvmField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SolidDate(storage: StorageInterface, key: String, private val label: Strin


override fun getValueAsString(): String {
return f().LOCAL_DATE.format(getValue())
return f().localDate.format(getValue())
}


Expand Down

0 comments on commit d0eb3f9

Please sign in to comment.