kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
cleaning up map fragment and cache download
rodzic
a537335f8c
commit
93664a9bb9
|
@ -7,7 +7,6 @@ import android.graphics.Canvas
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.opengl.Visibility
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
|
@ -65,7 +64,6 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener, OnSeek
|
||||||
private lateinit var cacheSouth: EditText
|
private lateinit var cacheSouth: EditText
|
||||||
private lateinit var cacheEast: EditText
|
private lateinit var cacheEast: EditText
|
||||||
private lateinit var cacheWest: EditText
|
private lateinit var cacheWest: EditText
|
||||||
private lateinit var cacheOutput: EditText
|
|
||||||
|
|
||||||
private lateinit var cacheEstimate: TextView
|
private lateinit var cacheEstimate: TextView
|
||||||
|
|
||||||
|
@ -230,7 +228,6 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener, OnSeek
|
||||||
cacheSouth.setText(boundingBox.latSouth.toString() + "")
|
cacheSouth.setText(boundingBox.latSouth.toString() + "")
|
||||||
cacheWest = view.findViewById(R.id.cache_west)
|
cacheWest = view.findViewById(R.id.cache_west)
|
||||||
cacheWest.setText(boundingBox.lonWest.toString() + "")
|
cacheWest.setText(boundingBox.lonWest.toString() + "")
|
||||||
cacheOutput = view.findViewById(R.id.cache_output)
|
|
||||||
cacheEstimate = view.findViewById(R.id.cache_estimate)
|
cacheEstimate = view.findViewById(R.id.cache_estimate)
|
||||||
|
|
||||||
//change listeners for both validation and to trigger the download estimation
|
//change listeners for both validation and to trigger the download estimation
|
||||||
|
@ -248,7 +245,6 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener, OnSeek
|
||||||
cacheWest.text = null
|
cacheWest.text = null
|
||||||
zoomMin.progress = 0
|
zoomMin.progress = 0
|
||||||
zoomMax.progress = 0
|
zoomMax.progress = 0
|
||||||
cacheOutput.text = null;
|
|
||||||
}
|
}
|
||||||
builder.setView(view)
|
builder.setView(view)
|
||||||
builder.setCancelable(true)
|
builder.setCancelable(true)
|
||||||
|
@ -262,7 +258,7 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener, OnSeek
|
||||||
*/
|
*/
|
||||||
private fun updateEstimate(startJob: Boolean) {
|
private fun updateEstimate(startJob: Boolean) {
|
||||||
try {
|
try {
|
||||||
if (cacheWest.text != null && cacheNorth.text != null && cacheSouth.text != null && cacheOutput.text != null && ::zoomMax.isInitialized && ::zoomMin.isInitialized) {
|
if (cacheWest.text != null && cacheNorth.text != null && cacheSouth.text != null && ::zoomMax.isInitialized && ::zoomMin.isInitialized) {
|
||||||
val n: Double = cacheNorth.text.toString().toDouble()
|
val n: Double = cacheNorth.text.toString().toDouble()
|
||||||
val s: Double = cacheSouth.text.toString().toDouble()
|
val s: Double = cacheSouth.text.toString().toDouble()
|
||||||
val e: Double = cacheEast.text.toString().toDouble()
|
val e: Double = cacheEast.text.toString().toDouble()
|
||||||
|
@ -305,6 +301,15 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener, OnSeek
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//this triggers the download
|
//this triggers the download
|
||||||
|
downloadRegion(bb, zoommin, zoommax)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
ex.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun downloadRegion(bb: BoundingBox, zoommin: Int, zoommax: Int) {
|
||||||
cacheManager.downloadAreaAsync(
|
cacheManager.downloadAreaAsync(
|
||||||
activity,
|
activity,
|
||||||
bb,
|
bb,
|
||||||
|
@ -344,11 +349,6 @@ class MapFragment : ScreenFragment("Map"), Logging, View.OnClickListener, OnSeek
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
ex.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun chooseMapStyle() {
|
private fun chooseMapStyle() {
|
||||||
/// Prepare dialog and its items
|
/// Prepare dialog and its items
|
||||||
|
|
|
@ -104,38 +104,12 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/cache_archival_section"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Archive File name:"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/cache_output"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="archive.sqlite"
|
|
||||||
android:lines="1"
|
|
||||||
android:text="archive.sqlite"
|
|
||||||
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/executeJob"
|
android:id="@+id/executeJob"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Start Download" />
|
android:text="Start Download" />
|
||||||
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
Ładowanie…
Reference in New Issue