use TextClock at the clock tab, always show seconds

This commit is contained in:
tibbi 2022-04-21 13:58:23 +02:00
parent b59c89a587
commit 4e644dbfd5
7 changed files with 5 additions and 52 deletions

View file

@ -63,7 +63,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:d5e1100f27'
implementation 'com.github.SimpleMobileTools:Simple-Commons:75f44f03fd'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.shawnlin:number-picker:2.4.6'

View file

@ -4,7 +4,6 @@ import android.content.Intent
import android.os.Bundle
import com.simplemobiletools.clock.R
import com.simplemobiletools.clock.extensions.config
import com.simplemobiletools.clock.extensions.updateWidgets
import com.simplemobiletools.clock.helpers.DEFAULT_MAX_ALARM_REMINDER_SECS
import com.simplemobiletools.clock.helpers.DEFAULT_MAX_TIMER_REMINDER_SECS
import com.simplemobiletools.commons.extensions.*
@ -27,7 +26,6 @@ class SettingsActivity : SimpleActivity() {
setupUseEnglish()
setupPreventPhoneFromSleeping()
setupSundayFirst()
setupShowSeconds()
setupAlarmMaxReminder()
setupUseSameSnooze()
setupSnoozeTime()
@ -40,7 +38,6 @@ class SettingsActivity : SimpleActivity() {
arrayOf(
settings_color_customization_label,
settings_general_settings_label,
settings_clock_tab_label,
settings_alarm_tab_label,
settings_stopwatch_tab_label,
settings_timer_tab_label,
@ -51,7 +48,6 @@ class SettingsActivity : SimpleActivity() {
arrayOf(
settings_color_customization_holder,
settings_general_settings_holder,
settings_clock_tab_holder,
settings_alarm_tab_holder,
settings_stopwatch_tab_holder,
settings_timer_tab_holder,
@ -111,14 +107,6 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupShowSeconds() {
settings_show_seconds.isChecked = config.showSeconds
settings_show_seconds_holder.setOnClickListener {
settings_show_seconds.toggle()
config.showSeconds = settings_show_seconds.isChecked
}
}
private fun setupAlarmMaxReminder() {
updateAlarmMaxReminderText()
settings_alarm_max_reminder_holder.setOnClickListener {

View file

@ -70,6 +70,7 @@ class ClockFragment : Fragment() {
private fun setupViews() {
view.apply {
requireContext().updateTextColors(clock_fragment)
clock_time.setTextColor(requireContext().getProperTextColor())
clock_fab.setOnClickListener {
fabClicked()
}
@ -82,7 +83,6 @@ class ClockFragment : Fragment() {
val hours = (passedSeconds / 3600) % 24
val minutes = (passedSeconds / 60) % 60
val seconds = passedSeconds % 60
view.clock_time.text = requireContext().getFormattedTime(passedSeconds, requireContext().config.showSeconds, true)
if (!DateFormat.is24HourFormat(requireContext())) {
view.clock_time.textSize = resources.getDimension(R.dimen.clock_text_size_smaller) / resources.displayMetrics.density

View file

@ -16,10 +16,6 @@ class Config(context: Context) : BaseConfig(context) {
fun newInstance(context: Context) = Config(context)
}
var showSeconds: Boolean
get() = prefs.getBoolean(SHOW_SECONDS, true)
set(showSeconds) = prefs.edit().putBoolean(SHOW_SECONDS, showSeconds).apply()
var selectedTimeZones: Set<String>
get() = prefs.getStringSet(SELECTED_TIME_ZONES, HashSet())!!
set(selectedTimeZones) = prefs.edit().putStringSet(SELECTED_TIME_ZONES, selectedTimeZones).apply()

View file

@ -7,7 +7,6 @@ import java.util.TimeZone
import kotlin.math.pow
// shared preferences
const val SHOW_SECONDS = "show_seconds"
const val SELECTED_TIME_ZONES = "selected_time_zones"
const val EDITED_TIME_ZONE_TITLES = "edited_time_zone_titles"
const val TIMER_SECONDS = "timer_seconds"

View file

@ -139,38 +139,6 @@
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/settings_clock_tab_label"
style="@style/SettingsSectionLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/clock_tab" />
<LinearLayout
android:id="@+id/settings_clock_tab_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/medium_margin"
android:background="@drawable/section_holder_stroke"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/settings_show_seconds_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_all_corners">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_show_seconds"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_seconds" />
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/settings_alarm_tab_label"
style="@style/SettingsSectionLabelStyle"

View file

@ -11,11 +11,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.simplemobiletools.commons.views.MyTextView
<TextClock
android:id="@+id/clock_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin"
android:format12Hour="h:mm:ss a"
android:format24Hour="k:mm:ss"
android:gravity="center_horizontal"
android:textSize="@dimen/clock_text_size"
tools:text="00:00:00" />