mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-06 12:37:26 +00:00
Added drawer header GitHub link intent. Removed unnecessary drawer items.
This commit is contained in:
1 parent
7bf8b48483
commit
fb432cffca
2 files changed
+14
-6
No files matched your search
@@ -1,10 +1,12 @@
|
|||||||
package com.rtbishop.lookingsat
|
package com.rtbishop.lookingsat
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.location.Location
|
import android.location.Location
|
||||||
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.CountDownTimer
|
import android.os.CountDownTimer
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
@@ -35,6 +37,7 @@ import java.util.concurrent.TimeUnit
|
|||||||
const val LOCATION_REQ = 101
|
const val LOCATION_REQ = 101
|
||||||
const val LOCATION_PERM = Manifest.permission.ACCESS_FINE_LOCATION
|
const val LOCATION_PERM = Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
const val GRANTED = PackageManager.PERMISSION_GRANTED
|
const val GRANTED = PackageManager.PERMISSION_GRANTED
|
||||||
|
const val GITHUB_URL = "https://github.com/rt-bishop/LookingSat"
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
@@ -46,6 +49,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
private lateinit var preferences: SharedPreferences
|
private lateinit var preferences: SharedPreferences
|
||||||
private lateinit var drawerLat: TextView
|
private lateinit var drawerLat: TextView
|
||||||
private lateinit var drawerLon: TextView
|
private lateinit var drawerLon: TextView
|
||||||
|
private lateinit var drawerSubTitle: TextView
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@@ -78,6 +82,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val header = navView.getHeaderView(0)
|
val header = navView.getHeaderView(0)
|
||||||
drawerLat = header.findViewById(R.id.drawer_lat_value)
|
drawerLat = header.findViewById(R.id.drawer_lat_value)
|
||||||
drawerLon = header.findViewById(R.id.drawer_lon_value)
|
drawerLon = header.findViewById(R.id.drawer_lon_value)
|
||||||
|
drawerSubTitle = header.findViewById(R.id.drawer_subtitle)
|
||||||
val navController = findNavController(R.id.nav_host)
|
val navController = findNavController(R.id.nav_host)
|
||||||
|
|
||||||
appBarConfig = AppBarConfiguration(setOf(R.id.nav_sky), drawerLayout)
|
appBarConfig = AppBarConfiguration(setOf(R.id.nav_sky), drawerLayout)
|
||||||
@@ -100,6 +105,10 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawerSubTitle.setOnClickListener {
|
||||||
|
openGitHub()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupTimer() {
|
private fun setupTimer() {
|
||||||
@@ -144,6 +153,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun openGitHub() {
|
||||||
|
val intentGitHub = Intent(Intent.ACTION_VIEW, Uri.parse(GITHUB_URL))
|
||||||
|
startActivity(intentGitHub)
|
||||||
|
}
|
||||||
|
|
||||||
private fun checkPermissions() {
|
private fun checkPermissions() {
|
||||||
if (ContextCompat.checkSelfPermission(this, LOCATION_PERM) != GRANTED) {
|
if (ContextCompat.checkSelfPermission(this, LOCATION_PERM) != GRANTED) {
|
||||||
if (ActivityCompat.shouldShowRequestPermissionRationale(this, LOCATION_PERM)) {
|
if (ActivityCompat.shouldShowRequestPermissionRationale(this, LOCATION_PERM)) {
|
||||||
|
|||||||
@@ -7,9 +7,6 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/nav_sky"
|
android:id="@+id/nav_sky"
|
||||||
android:title="@string/menu_sky" />
|
android:title="@string/menu_sky" />
|
||||||
<item
|
|
||||||
android:id="@+id/nav_radar"
|
|
||||||
android:title="@string/menu_radar" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_map"
|
android:id="@+id/nav_map"
|
||||||
android:title="@string/menu_map" />
|
android:title="@string/menu_map" />
|
||||||
@@ -21,9 +18,6 @@
|
|||||||
|
|
||||||
<item android:title="@string/menu_about">
|
<item android:title="@string/menu_about">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
|
||||||
android:id="@+id/nav_github"
|
|
||||||
android:title="@string/menu_github" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_credits"
|
android:id="@+id/nav_credits"
|
||||||
android:title="@string/menu_credits" />
|
android:title="@string/menu_credits" />
|
||||||
|
|||||||
Reference in new issue
Block a user