mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-05-02 19:08:56 +02:00
adding a couple things related to sorting change
This commit is contained in:
parent
2a77bce55f
commit
79a4f9494f
@ -13,6 +13,7 @@ import com.simplemobiletools.clock.extensions.config
|
|||||||
import com.simplemobiletools.clock.helpers.TABS_COUNT
|
import com.simplemobiletools.clock.helpers.TABS_COUNT
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
|
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
|
||||||
|
import com.simplemobiletools.commons.helpers.LICENSE_STETHO
|
||||||
import com.simplemobiletools.commons.models.FAQItem
|
import com.simplemobiletools.commons.models.FAQItem
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
|
|
||||||
@ -141,11 +142,12 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private fun launchAbout() {
|
private fun launchAbout() {
|
||||||
val faqItems = arrayListOf(
|
val faqItems = arrayListOf(
|
||||||
|
FAQItem(R.string.faq_1_title, R.string.faq_1_text),
|
||||||
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
|
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
|
||||||
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons),
|
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons),
|
||||||
FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons)
|
FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons)
|
||||||
)
|
)
|
||||||
|
|
||||||
startAboutActivity(R.string.app_name, LICENSE_KOTLIN, BuildConfig.VERSION_NAME, faqItems)
|
startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_STETHO, BuildConfig.VERSION_NAME, faqItems)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,9 @@ import android.view.ViewGroup
|
|||||||
import com.simplemobiletools.clock.R
|
import com.simplemobiletools.clock.R
|
||||||
import com.simplemobiletools.clock.activities.SimpleActivity
|
import com.simplemobiletools.clock.activities.SimpleActivity
|
||||||
import com.simplemobiletools.clock.extensions.formatStopwatchTime
|
import com.simplemobiletools.clock.extensions.formatStopwatchTime
|
||||||
|
import com.simplemobiletools.clock.helpers.SORT_BY_LAP
|
||||||
|
import com.simplemobiletools.clock.helpers.SORT_BY_LAP_TIME
|
||||||
|
import com.simplemobiletools.clock.helpers.SORT_BY_TOTAL_TIME
|
||||||
import com.simplemobiletools.clock.models.Lap
|
import com.simplemobiletools.clock.models.Lap
|
||||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
@ -31,7 +34,7 @@ class StopwatchAdapter(activity: SimpleActivity, var laps: ArrayList<Lap>, recyc
|
|||||||
|
|
||||||
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
||||||
val lap = laps[position]
|
val lap = laps[position]
|
||||||
val view = holder.bindView(lap, true) { itemView, layoutPosition ->
|
val view = holder.bindView(lap, false) { itemView, layoutPosition ->
|
||||||
setupView(itemView, lap)
|
setupView(itemView, lap)
|
||||||
}
|
}
|
||||||
bindViewHolder(holder, position, view)
|
bindViewHolder(holder, position, view)
|
||||||
@ -49,12 +52,21 @@ class StopwatchAdapter(activity: SimpleActivity, var laps: ArrayList<Lap>, recyc
|
|||||||
view.apply {
|
view.apply {
|
||||||
lap_order.text = lap.id.toString()
|
lap_order.text = lap.id.toString()
|
||||||
lap_order.setTextColor(textColor)
|
lap_order.setTextColor(textColor)
|
||||||
|
lap_order.setOnClickListener {
|
||||||
|
itemClick(SORT_BY_LAP)
|
||||||
|
}
|
||||||
|
|
||||||
lap_lap_time.text = lap.lapTime.formatStopwatchTime(false)
|
lap_lap_time.text = lap.lapTime.formatStopwatchTime(false)
|
||||||
lap_lap_time.setTextColor(textColor)
|
lap_lap_time.setTextColor(textColor)
|
||||||
|
lap_lap_time.setOnClickListener {
|
||||||
|
itemClick(SORT_BY_LAP_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
lap_total_time.text = lap.totalTime.formatStopwatchTime(false)
|
lap_total_time.text = lap.totalTime.formatStopwatchTime(false)
|
||||||
lap_total_time.setTextColor(textColor)
|
lap_total_time.setTextColor(textColor)
|
||||||
|
lap_total_time.setOnClickListener {
|
||||||
|
itemClick(SORT_BY_TOTAL_TIME)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,10 @@ import com.simplemobiletools.clock.activities.SimpleActivity
|
|||||||
import com.simplemobiletools.clock.adapters.StopwatchAdapter
|
import com.simplemobiletools.clock.adapters.StopwatchAdapter
|
||||||
import com.simplemobiletools.clock.extensions.config
|
import com.simplemobiletools.clock.extensions.config
|
||||||
import com.simplemobiletools.clock.extensions.formatStopwatchTime
|
import com.simplemobiletools.clock.extensions.formatStopwatchTime
|
||||||
|
import com.simplemobiletools.clock.helpers.SORT_BY_LAP
|
||||||
import com.simplemobiletools.clock.models.Lap
|
import com.simplemobiletools.clock.models.Lap
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
|
import com.simplemobiletools.commons.helpers.SORT_DESCENDING
|
||||||
import kotlinx.android.synthetic.main.fragment_stopwatch.view.*
|
import kotlinx.android.synthetic.main.fragment_stopwatch.view.*
|
||||||
|
|
||||||
class StopwatchFragment : Fragment() {
|
class StopwatchFragment : Fragment() {
|
||||||
@ -29,6 +31,7 @@ class StopwatchFragment : Fragment() {
|
|||||||
private var lapTicks = 0
|
private var lapTicks = 0
|
||||||
private var currentLap = 1
|
private var currentLap = 1
|
||||||
private var isRunning = false
|
private var isRunning = false
|
||||||
|
private var sorting = SORT_BY_LAP or SORT_DESCENDING
|
||||||
private var laps = ArrayList<Lap>()
|
private var laps = ArrayList<Lap>()
|
||||||
|
|
||||||
lateinit var view: ViewGroup
|
lateinit var view: ViewGroup
|
||||||
@ -54,7 +57,11 @@ class StopwatchFragment : Fragment() {
|
|||||||
(stopwatch_list.adapter as StopwatchAdapter).updateItems(laps)
|
(stopwatch_list.adapter as StopwatchAdapter).updateItems(laps)
|
||||||
}
|
}
|
||||||
|
|
||||||
val stopwatchAdapter = StopwatchAdapter(activity as SimpleActivity, ArrayList(), stopwatch_list) { }
|
val stopwatchAdapter = StopwatchAdapter(activity as SimpleActivity, ArrayList(), stopwatch_list) {
|
||||||
|
if (it is Int) {
|
||||||
|
changeSorting(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
stopwatch_list.adapter = stopwatchAdapter
|
stopwatch_list.adapter = stopwatchAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +139,10 @@ class StopwatchFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun changeSorting(clickedValue: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private val updateRunnable = object : Runnable {
|
private val updateRunnable = object : Runnable {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
|
@ -14,6 +14,10 @@ const val ALARM_ID = "alarm_id"
|
|||||||
const val DEFAULT_ALARM_MINUTES = 480
|
const val DEFAULT_ALARM_MINUTES = 480
|
||||||
const val DAY_MINUTES = 1440
|
const val DAY_MINUTES = 1440
|
||||||
|
|
||||||
|
const val SORT_BY_LAP = 1
|
||||||
|
const val SORT_BY_LAP_TIME = 2
|
||||||
|
const val SORT_BY_TOTAL_TIME = 4
|
||||||
|
|
||||||
fun getDefaultTimeZoneTitle(id: Int) = getAllTimeZones().firstOrNull { it.id == id }?.title ?: ""
|
fun getDefaultTimeZoneTitle(id: Int) = getAllTimeZones().firstOrNull { it.id == id }?.title ?: ""
|
||||||
|
|
||||||
fun getAllTimeZones() = arrayListOf(
|
fun getAllTimeZones() = arrayListOf(
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
<string name="show_seconds">Mostrar segundos</string>
|
<string name="show_seconds">Mostrar segundos</string>
|
||||||
<string name="display_other_time_zones">Mostrar outros fusos horários</string>
|
<string name="display_other_time_zones">Mostrar outros fusos horários</string>
|
||||||
|
|
||||||
|
<!-- FAQ -->
|
||||||
|
<string name="faq_1_title">How can I change lap sorting at the stopwatch tab?</string>
|
||||||
|
<string name="faq_1_text">Just click on any of the columns, that will make the laps be sorted by the given column. With additional clicks you can toggle between ascending and descending sorting.</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
|
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
<string name="show_seconds">Zobraziť sekundy</string>
|
<string name="show_seconds">Zobraziť sekundy</string>
|
||||||
<string name="display_other_time_zones">Povoliť zobrazenie dodatočných časových pásiem</string>
|
<string name="display_other_time_zones">Povoliť zobrazenie dodatočných časových pásiem</string>
|
||||||
|
|
||||||
|
<!-- FAQ -->
|
||||||
|
<string name="faq_1_title">Ako viem zmeniť poradie kôl na okne so stopkami?</string>
|
||||||
|
<string name="faq_1_text">Stačí, ak kliknete na niektorý stĺpec, to aktivuje triedenie podľa daného stĺpca. Ďalším kliknutím na daný stĺpec viete prepínať zostupné a vzostupné triedenie.</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
|
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
<string name="show_seconds">Show seconds</string>
|
<string name="show_seconds">Show seconds</string>
|
||||||
<string name="display_other_time_zones">Allow displaying other time zones</string>
|
<string name="display_other_time_zones">Allow displaying other time zones</string>
|
||||||
|
|
||||||
|
<!-- FAQ -->
|
||||||
|
<string name="faq_1_title">How can I change lap sorting at the stopwatch tab?</string>
|
||||||
|
<string name="faq_1_text">Just click on any of the columns, that will make the laps be sorted by the given column. With additional clicks you can toggle between ascending and descending sorting.</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
|
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
|
||||||
|
Loading…
x
Reference in New Issue
Block a user