mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Added drawer header Latitude and Longitude textViews update logic
This commit is contained in:
1 parent
f2e3d99a85
commit
7bf8b48483
2 files changed
+13
-1
No files matched your search
@@ -44,6 +44,8 @@ class MainActivity : AppCompatActivity() {
|
||||
private lateinit var timeToAos: TextView
|
||||
private lateinit var fusedLocationClient: FusedLocationProviderClient
|
||||
private lateinit var preferences: SharedPreferences
|
||||
private lateinit var drawerLat: TextView
|
||||
private lateinit var drawerLon: TextView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@@ -51,6 +53,12 @@ class MainActivity : AppCompatActivity() {
|
||||
setupComponents()
|
||||
setupNavigation()
|
||||
setupTimer()
|
||||
updateDrawerText()
|
||||
}
|
||||
|
||||
private fun updateDrawerText() {
|
||||
drawerLat.text = preferences.getString("LATITUDE", "-180.0000")?.substring(0, 9)
|
||||
drawerLon.text = preferences.getString("LONGITUDE", "-60.0000")?.substring(0, 9)
|
||||
}
|
||||
|
||||
private fun setupComponents() {
|
||||
@@ -67,6 +75,9 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
|
||||
val navView: NavigationView = findViewById(R.id.nav_view)
|
||||
val header = navView.getHeaderView(0)
|
||||
drawerLat = header.findViewById(R.id.drawer_lat_value)
|
||||
drawerLon = header.findViewById(R.id.drawer_lon_value)
|
||||
val navController = findNavController(R.id.nav_host)
|
||||
|
||||
appBarConfig = AppBarConfiguration(setOf(R.id.nav_sky), drawerLayout)
|
||||
@@ -129,6 +140,7 @@ class MainActivity : AppCompatActivity() {
|
||||
putString("HEIGHT", currentHeight.toString())
|
||||
apply()
|
||||
}
|
||||
updateDrawerText()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
android:id="@+id/drawer_lon_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/longitude_def"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
|
||||
Reference in new issue
Block a user