mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Minor fixes for TLE import dialog
This commit is contained in:
1 parent
a5c08c2614
commit
28b32b4d3c
4 files changed
+20
-23
No files matched your search
@@ -21,8 +21,6 @@ package com.rtbishop.look4sat.ui
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.pm.PackageManager
|
||||
@@ -30,6 +28,7 @@ import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
@@ -88,7 +87,6 @@ class MainActivity : AppCompatActivity() {
|
||||
@SuppressLint("SourceLockedOrientationActivity")
|
||||
private fun setupComponents() {
|
||||
val navController = findNavController(R.id.nav_host)
|
||||
val navView = mainBinding.navView
|
||||
val toolbar = mainBinding.includeAppBar.toolbar
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
@@ -98,7 +96,7 @@ class MainActivity : AppCompatActivity() {
|
||||
)
|
||||
|
||||
setupActionBarWithNavController(navController, appBarConfig)
|
||||
navView.setupWithNavController(navController)
|
||||
mainBinding.navView.setupWithNavController(navController)
|
||||
|
||||
navController.addOnDestinationChangedListener { _, destination, _ ->
|
||||
when (destination.id) {
|
||||
@@ -184,24 +182,23 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun showTleUrlDialog() {
|
||||
var tleUrl = ""
|
||||
val dialogBinding = DialogTleUrlBinding.inflate(layoutInflater).apply {
|
||||
dialogTleInput.addTextChangedListener {
|
||||
tleUrl = it.toString()
|
||||
val dialogBinding = DialogTleUrlBinding.inflate(layoutInflater)
|
||||
val dialog = AlertDialog.Builder(this).setView(dialogBinding.root).create()
|
||||
dialogBinding.apply {
|
||||
var tleUrl = String()
|
||||
dialogTleInput.apply {
|
||||
hint = viewModel.getTleUrl()
|
||||
addTextChangedListener { tleUrl = it.toString() }
|
||||
}
|
||||
dialogTleNeg.setOnClickListener {
|
||||
|
||||
dialog.dismiss()
|
||||
}
|
||||
dialogTlePos.setOnClickListener {
|
||||
|
||||
viewModel.updateEntriesFromWeb(tleUrl)
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
AlertDialog.Builder(this).apply {
|
||||
setView(dialogBinding.root)
|
||||
create()
|
||||
show()
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun View.lockButton() {
|
||||
@@ -240,7 +237,7 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
if (requestCode == pickFileReqCode && resultCode == Activity.RESULT_OK) {
|
||||
if (requestCode == pickFileReqCode && resultCode == RESULT_OK) {
|
||||
data?.data?.also { uri ->
|
||||
viewModel.updateEntriesFromFile(uri)
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ class SharedViewModel @Inject constructor(
|
||||
fun getRefreshRate() = prefsManager.getRefreshRate()
|
||||
fun getHoursAhead() = prefsManager.getHoursAhead()
|
||||
fun getMinElevation() = prefsManager.getMinElevation()
|
||||
fun getTleUrl() = prefsManager.getTleUrl()
|
||||
fun setPositionFromPref() = _gsp.postValue(Result.Success(prefsManager.getPosition()))
|
||||
suspend fun getAllEntries() = repository.getAllEntries()
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="TextView"
|
||||
android:text="@string/pref_tle_url_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
android:id="@+id/dialogTleInput"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:hint="https://server/with/tle.txt"
|
||||
android:hint="@string/placeholder"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textWebEditText"
|
||||
app:layout_constraintEnd_toEndOf="@+id/dialogTlePos"
|
||||
@@ -41,7 +40,6 @@
|
||||
android:id="@+id/dialogTlePos"
|
||||
style="@style/SatEntryDialogText"
|
||||
android:layout_width="36dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:gravity="end"
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
<string name="update_loc">Update location</string>
|
||||
<string name="update_loc_success">Location was updated</string>
|
||||
<string name="update_loc_failure">Check your Location settings</string>
|
||||
<string name="update_tle_file" translatable="false">Update TLE from file</string>
|
||||
<string name="update_tle_file" translatable="false">Import TLE from file</string>
|
||||
<string name="update_tle_file_success" translatable="false">TLE was updated</string>
|
||||
<string name="update_tle">Update TLE from URL</string>
|
||||
<string name="update_tle">Import TLE from WEB</string>
|
||||
<string name="update_tle_success">TLE was updated</string>
|
||||
<string name="update_trans">Update transceivers</string>
|
||||
<string name="update_trans_success">Transceivers database was updated</string>
|
||||
@@ -73,6 +73,7 @@
|
||||
<string name="pref_refresh_rate_input_error">Set the value between 250ms and 10000ms</string>
|
||||
<string name="pref_compass_key" translatable="false">compass</string>
|
||||
<string name="pref_compass_title" translatable="false">Use sensors to rotate PolarView</string>
|
||||
<string name="pref_tle_url_title" translatable="false">Please, enter the HTTPS URL:</string>
|
||||
|
||||
<string name="no_mode">Mode: Null</string>
|
||||
<string name="no_uplink">Uplink: Null</string>
|
||||
|
||||
Reference in new issue
Block a user