Skip to content

Commit

Permalink
Remove duplicate OSM attribution
Browse files Browse the repository at this point in the history
  • Loading branch information
bubelov committed Oct 30, 2024
1 parent ac6a6c2 commit c8b9a78
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 57 deletions.
2 changes: 1 addition & 1 deletion app/src/androidMain/kotlin/app/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import element_comment.ElementCommentQueries
import element_comment.ElementCommentRepo

val appModule = module {
single { Database(get<Context>().getDatabasePath("btcmap-2024-10-24.db").absolutePath).conn }
single { Database(get<Context>().getDatabasePath("btcmap-2024-10-30.db").absolutePath).conn }

single { ApiImpl() }.bind(Api::class)

Expand Down
1 change: 0 additions & 1 deletion app/src/androidMain/kotlin/conf/Conf.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ data class Conf(
val viewportSouthLat: Double,
val viewportWestLon: Double,
val showAtms: Boolean,
val showOsmAttribution: Boolean,
val showSyncSummary: Boolean,
val showAllNewElements: Boolean,
)
Expand Down
15 changes: 5 additions & 10 deletions app/src/androidMain/kotlin/conf/ConfQueries.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ConfQueries(private val conn: SQLiteConnection) {
viewport_south_lat REAL NOT NULL,
viewport_west_lon REAL NOT NULL,
show_atms INTEGER NOT NULL,
show_osm_attribution INTEGER NOT NULL,
show_sync_summary INTEGER NOT NULL,
show_all_new_elements INTEGER NOT NULL
);
Expand All @@ -38,11 +37,10 @@ class ConfQueries(private val conn: SQLiteConnection) {
viewport_south_lat,
viewport_west_lon,
show_atms,
show_osm_attribution,
show_sync_summary,
show_all_new_elements
)
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9);
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8);
"""
).use {
it.bindText(1, conf.lastSyncDate?.toString() ?: "")
Expand All @@ -51,9 +49,8 @@ class ConfQueries(private val conn: SQLiteConnection) {
it.bindDouble(4, conf.viewportSouthLat)
it.bindDouble(5, conf.viewportWestLon)
it.bindLong(6, if (conf.showAtms) 1 else 0)
it.bindLong(7, if (conf.showOsmAttribution) 1 else 0)
it.bindLong(8, if (conf.showSyncSummary) 1 else 0)
it.bindLong(9, if (conf.showAllNewElements) 1 else 0)
it.bindLong(7, if (conf.showSyncSummary) 1 else 0)
it.bindLong(8, if (conf.showAllNewElements) 1 else 0)
it.step()
}
}
Expand All @@ -69,7 +66,6 @@ class ConfQueries(private val conn: SQLiteConnection) {
viewport_south_lat,
viewport_west_lon,
show_atms,
show_osm_attribution,
show_sync_summary,
show_all_new_elements
FROM conf
Expand All @@ -83,9 +79,8 @@ class ConfQueries(private val conn: SQLiteConnection) {
viewportSouthLat = it.getDouble(3),
viewportWestLon = it.getDouble(4),
showAtms = it.getBoolean(5),
showOsmAttribution = it.getBoolean(6),
showSyncSummary = it.getBoolean(7),
showAllNewElements = it.getBoolean(8),
showSyncSummary = it.getBoolean(6),
showAllNewElements = it.getBoolean(7),
)
} else {
null
Expand Down
1 change: 0 additions & 1 deletion app/src/androidMain/kotlin/conf/ConfRepo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class ConfRepo(
viewportSouthLat = 12.116667 - 0.04,
viewportWestLon = -68.933333 - 0.04 + 0.03,
showAtms = false,
showOsmAttribution = true,
showSyncSummary = false,
showAllNewElements = false,
)
Expand Down
8 changes: 0 additions & 8 deletions app/src/androidMain/kotlin/map/MapFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import org.maplibre.android.maps.MapLibreMap.OnMoveListener
import org.osmdroid.config.Configuration
import org.osmdroid.util.BoundingBox
import org.osmdroid.util.GeoPoint
import org.osmdroid.util.TileSystemWebMercator
import search.SearchAdapter
import search.SearchModel
import search.SearchResultModel
Expand Down Expand Up @@ -137,7 +136,6 @@ class MapFragment : Fragment() {
bottomSheetBehavior.expandedOffset = insets.top

val navBarsInsets = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars())
binding.osmAttribution.translationY = -navBarsInsets.bottom.toFloat()
binding.fab.translationY = -navBarsInsets.bottom.toFloat()

WindowInsetsCompat.CONSUMED
Expand Down Expand Up @@ -273,12 +271,6 @@ class MapFragment : Fragment() {
}
}

viewLifecycleOwner.lifecycleScope.launch {
model.conf.conf.map { it.showOsmAttribution }.collectLatest {
binding.osmAttribution.isVisible = it
}
}

viewLifecycleOwner.lifecycleScope.launch {
model.visibleElements.collectLatest { newElements ->
binding.map.getMapAsync { map ->
Expand Down
5 changes: 0 additions & 5 deletions app/src/androidMain/kotlin/settings/SettingsFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ class SettingsFragment : Fragment() {
conf.update { it.copy(showAtms = isChecked) }
}

binding.showOsmAttribution.isChecked = conf.conf.value.showOsmAttribution
binding.showOsmAttribution.setOnCheckedChangeListener { _, isChecked ->
conf.update { it.copy(showOsmAttribution = isChecked) }
}

binding.showSyncSummary.isChecked = conf.conf.value.showSyncSummary
binding.showSyncSummary.setOnCheckedChangeListener { _, isChecked ->
conf.update { it.copy(showSyncSummary = isChecked) }
Expand Down
11 changes: 0 additions & 11 deletions app/src/androidMain/res/layout/fragment_map.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@
android:hint="@string/search_here"
app:menu="@menu/map" />

<TextView
android:id="@+id/osmAttribution"
style="?attr/textAppearanceListItemSecondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|bottom"
android:layout_margin="24dp"
android:text="@string/osm_copyright"
android:textColor="?colorOnSurface"
android:textSize="12sp" />

<FrameLayout
android:id="@+id/elementDetails"
android:layout_width="match_parent"
Expand Down
20 changes: 0 additions & 20 deletions app/src/androidMain/res/layout/fragment_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,6 @@

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">

<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/showOsmAttribution"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_osm_attribution"
android:textSize="16sp" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down

0 comments on commit c8b9a78

Please sign in to comment.