mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Trying to update map style menu
This commit is contained in:
parent
42cba353fa
commit
e22c7f8c35
4 changed files with 109 additions and 6 deletions
|
|
@ -3,7 +3,6 @@ package com.geeksville.mesh.ui
|
|||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
|
|
@ -23,7 +22,6 @@ import com.geeksville.mesh.databinding.MapViewBinding
|
|||
import com.geeksville.mesh.model.UIViewModel
|
||||
import com.geeksville.mesh.model.map.CustomOverlayManager
|
||||
import com.geeksville.mesh.model.map.CustomTileSource
|
||||
import com.geeksville.mesh.model.map.NOAAWmsTileSource
|
||||
import com.geeksville.mesh.util.formatAgo
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
|
|
@ -49,7 +47,6 @@ import org.osmdroid.views.overlay.*
|
|||
import org.osmdroid.views.overlay.gridlines.LatLonGridlineOverlay2
|
||||
import java.io.File
|
||||
import kotlin.math.pow
|
||||
import android.util.DisplayMetrics
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
|
|
@ -184,7 +181,6 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener {
|
|||
alertDialog!!.show()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears active tile source cache
|
||||
*/
|
||||
|
|
@ -496,8 +492,6 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener {
|
|||
layer.loadingBackgroundColor = Color.TRANSPARENT
|
||||
layer.loadingLineColor = Color.TRANSPARENT
|
||||
map.overlayManager.add(layer)
|
||||
} else {
|
||||
map.overlays.clear()
|
||||
}
|
||||
map.invalidate()
|
||||
}
|
||||
|
|
|
|||
39
app/src/main/java/com/geeksville/mesh/ui/MapStyleAdapter.kt
Normal file
39
app/src/main/java/com/geeksville/mesh/ui/MapStyleAdapter.kt
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package com.geeksville.mesh.ui
|
||||
|
||||
import android.R
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.geeksville.mesh.databinding.AdapterMapStyleMenuBinding
|
||||
|
||||
|
||||
class MapStyleAdapter(itemView: AdapterMapStyleMenuBinding) {
|
||||
var list = mutableListOf<String>()
|
||||
|
||||
inner class MyView(view: View) : RecyclerView.ViewHolder(view) {
|
||||
var textView: TextView
|
||||
|
||||
init {
|
||||
textView = view.findViewById<View>(R.id.text1) as TextView
|
||||
}
|
||||
}
|
||||
|
||||
fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): MapStyleAdapter {
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
val mapStyleMenuBinding = AdapterMapStyleMenuBinding.inflate(inflater, parent, false)
|
||||
return MapStyleAdapter(mapStyleMenuBinding)
|
||||
}
|
||||
|
||||
fun onBindViewHolder(holder: MyView, position: Int) {
|
||||
holder.textView.text = list[position]
|
||||
}
|
||||
|
||||
fun getItemCount(): Int {
|
||||
return list.size
|
||||
}
|
||||
}
|
||||
46
app/src/main/res/layout/adapter_map_style_menu.xml
Normal file
46
app/src/main/res/layout/adapter_map_style_menu.xml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBaseline_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Map Type"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="@color/colourGrey" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mapTypeRecyclerView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="horizontal" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Map Layer"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="@color/colourGrey" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mapLayerRecyclerView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
24
app/src/main/res/layout/horizontal_item.xml
Normal file
24
app/src/main/res/layout/horizontal_item.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/cardview"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="1dp"
|
||||
card_view:cardBackgroundColor="#FF9800"
|
||||
card_view:cardCornerRadius="7dp"
|
||||
card_view:cardElevation="7dp"
|
||||
card_view:contentPadding="7dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
Loading…
Add table
Add a link
Reference in a new issue