mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Added a function to clear the database #79
This commit is contained in:
1 parent
a7427f3632
commit
e9dc166e1e
8 files changed
+44
-6
No files matched your search
@@ -69,4 +69,9 @@ class LocalSource(
|
||||
override suspend fun updateTransmitters(transmitters: List<Transmitter>) {
|
||||
transmittersDao.updateTransmitters(transmitters.toFramework())
|
||||
}
|
||||
|
||||
override suspend fun clearData() {
|
||||
entriesDao.deleteEntries()
|
||||
transmittersDao.deleteTransmitters()
|
||||
}
|
||||
}
|
||||
+1
@@ -116,6 +116,7 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
||||
binding.prefsData.updateBtnWeb.setOnClickListener {
|
||||
findNavController().navigateSafe(R.id.action_prefs_to_sources)
|
||||
}
|
||||
binding.prefsData.updateBtnClear.setOnClickListener { viewModel.clearData() }
|
||||
getNavResult<List<String>>(R.id.nav_settings, "sources") { sources ->
|
||||
viewModel.updateDataFromWeb(sources)
|
||||
}
|
||||
|
||||
+4
@@ -25,6 +25,10 @@ class SettingsViewModel @Inject constructor(
|
||||
repository.updateDataFromWeb(sources)
|
||||
}
|
||||
|
||||
fun clearData() {
|
||||
repository.clearData()
|
||||
}
|
||||
|
||||
fun getUseUTC(): Boolean = settings.getUseUTC()
|
||||
|
||||
fun setUseUTC(value: Boolean) = settings.setUseUTC(value)
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
style="@style/AppButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:drawableStart="@drawable/ic_update_web"
|
||||
android:text="@string/update_web"
|
||||
android:text="Web"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/update_btn_file"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
@@ -51,13 +51,27 @@
|
||||
style="@style/AppButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:drawableStart="@drawable/ic_update_file"
|
||||
android:text="@string/update_file"
|
||||
android:text="File"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/update_btn_web"
|
||||
app:layout_constraintEnd_toStartOf="@+id/update_btn_clear"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/update_btn_web" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/update_btn_clear"
|
||||
style="@style/AppButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:drawableStart="@drawable/ic_update_file"
|
||||
android:text="Clear"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/update_btn_web"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/update_btn_web" />
|
||||
app:layout_constraintStart_toEndOf="@+id/update_btn_file" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
<item name="android:windowBackground">@color/surfaceBg</item>
|
||||
</style>
|
||||
|
||||
<style name="AppButton">
|
||||
<style name="AppButton" parent="Widget.Material3.Button">
|
||||
<item name="android:backgroundTint">@color/surfaceButton</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
<item name="cornerRadius">@dimen/card_corner_high</item>
|
||||
<item name="rippleColor">@color/themeLight</item>
|
||||
<item name="android:maxLines">1</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:textColor">@color/themeLight</item>
|
||||
|
||||
Reference in new issue
Block a user