mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Swapped single action overflow menu for the toolbar refresh button.
This commit is contained in:
1 parent
1b76bf45dc
commit
7510453f39
8 files changed
+44
-51
No files matched your search
@@ -7,8 +7,6 @@ import android.content.pm.PackageManager
|
|||||||
import android.net.Uri
|
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.MenuItem
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.ImageButton
|
import android.widget.ImageButton
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
@@ -61,8 +59,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun setupComponents() {
|
private fun setupComponents() {
|
||||||
viewModel = ViewModelProvider(this).get(MainViewModel::class.java)
|
viewModel = ViewModelProvider(this).get(MainViewModel::class.java)
|
||||||
timerLayout = findViewById(R.id.timer_layout)
|
timerLayout = findViewById(R.id.toolbar_layout_timer)
|
||||||
timeToAos = findViewById(R.id.time_to_aos)
|
timeToAos = findViewById(R.id.toolbar_time_to_aos)
|
||||||
|
|
||||||
val toolbar: Toolbar = findViewById(R.id.toolbar)
|
val toolbar: Toolbar = findViewById(R.id.toolbar)
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
@@ -121,8 +119,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
drawerBtnTle.setOnClickListener { viewModel.updateTwoLineElementFile() }
|
drawerBtnTle.setOnClickListener { viewModel.updateTwoLineElementFile() }
|
||||||
drawerBtnTrans.setOnClickListener { viewModel.updateTransmittersDatabase() }
|
drawerBtnTrans.setOnClickListener { viewModel.updateTransmittersDatabase() }
|
||||||
drawerBtnGithub.setOnClickListener {
|
drawerBtnGithub.setOnClickListener {
|
||||||
val intentGitHub = Intent(Intent.ACTION_VIEW, Uri.parse(githubUrl))
|
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(githubUrl)))
|
||||||
startActivity(intentGitHub)
|
|
||||||
}
|
}
|
||||||
drawerBtnExit.setOnClickListener { finish() }
|
drawerBtnExit.setOnClickListener { finish() }
|
||||||
}
|
}
|
||||||
@@ -179,16 +176,4 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val navController = findNavController(R.id.nav_host)
|
val navController = findNavController(R.id.nav_host)
|
||||||
return navController.navigateUp(appBarConfig) || super.onSupportNavigateUp()
|
return navController.navigateUp(appBarConfig) || super.onSupportNavigateUp()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
|
||||||
menuInflater.inflate(R.menu.main_menu, menu)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
||||||
when (item.itemId) {
|
|
||||||
R.id.menu_refresh -> Toast.makeText(this, "Refresh", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,6 @@
|
|||||||
<gradient
|
<gradient
|
||||||
android:angle="270"
|
android:angle="270"
|
||||||
android:endColor="#181818"
|
android:endColor="#181818"
|
||||||
android:startColor="@color/surfaceDark"
|
android:startColor="@color/backgroundDark"
|
||||||
android:type="linear" />
|
android:type="linear" />
|
||||||
</shape>
|
</shape>
|
||||||
@@ -16,18 +16,25 @@
|
|||||||
android:layout_height="?attr/actionBarSize">
|
android:layout_height="?attr/actionBarSize">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/timer_layout"
|
android:id="@+id/toolbar_layout_timer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/time_to_aos"
|
android:id="@+id/toolbar_time_to_aos"
|
||||||
style="@style/ToolbarText"
|
style="@style/ToolbarText"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:text="@string/next_aos_pattern"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/toolbar_btn_refresh"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/toolbar_btn_refresh"
|
||||||
|
style="@style/ToolbarButton"
|
||||||
|
android:contentDescription="@string/placeholder"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -17,5 +17,6 @@
|
|||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:navGraph="@navigation/nav_graph" />
|
app:navGraph="@navigation/nav_graph"
|
||||||
|
tools:ignore="FragmentTagUsage" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
<item
|
|
||||||
android:id="@+id/menu_refresh"
|
|
||||||
android:icon="@drawable/ic_refresh"
|
|
||||||
android:title="@string/menu_refresh"
|
|
||||||
app:showAsAction="always" />
|
|
||||||
</menu>
|
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="brandLight">#FFE082</color>
|
<color name="themeAccent">#FFE082</color>
|
||||||
<color name="textOnLight">#101010</color>
|
<color name="darkOnLight">#101010</color>
|
||||||
<color name="surfaceDark">#080808</color>
|
<color name="lightOnDark">#C0C0C0</color>
|
||||||
<color name="textOnDark">#C0C0C0</color>
|
<color name="toolbarButton">#191919</color>
|
||||||
<color name="colorError">#800000</color>
|
<color name="backgroundDark">#080808</color>
|
||||||
|
<color name="error">#800000</color>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<dimen name="drawer_header_height">288dp</dimen>
|
<dimen name="drawer_header_height">292dp</dimen>
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
<dimen name="fab_margin">16dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="AppTheme" parent="Theme.MaterialComponents">
|
<style name="AppTheme" parent="Theme.MaterialComponents">
|
||||||
<item name="colorPrimary">@color/brandLight</item>
|
<item name="colorPrimary">@color/themeAccent</item>
|
||||||
<item name="colorSecondary">@color/brandLight</item>
|
<item name="colorSecondary">@color/themeAccent</item>
|
||||||
<item name="colorSurface">@color/surfaceDark</item>
|
<item name="colorSurface">@color/backgroundDark</item>
|
||||||
<item name="colorError">@color/colorError</item>
|
<item name="colorError">@color/error</item>
|
||||||
|
|
||||||
<item name="colorOnPrimary">@color/textOnLight</item>
|
<item name="colorOnPrimary">@color/darkOnLight</item>
|
||||||
<item name="colorOnSecondary">@color/textOnLight</item>
|
<item name="colorOnSecondary">@color/darkOnLight</item>
|
||||||
<item name="colorOnSurface">@color/textOnDark</item>
|
<item name="colorOnSurface">@color/lightOnDark</item>
|
||||||
<item name="colorOnError">@color/textOnDark</item>
|
<item name="colorOnError">@color/lightOnDark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.NoActionBar">
|
<style name="AppTheme.NoActionBar">
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<style name="DrawerHeader">
|
<style name="DrawerHeader">
|
||||||
<item name="android:layout_width">wrap_content</item>
|
<item name="android:layout_width">wrap_content</item>
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:textColor">@color/textOnDark</item>
|
<item name="android:textColor">@color/lightOnDark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="DrawerHeader.Title">
|
<style name="DrawerHeader.Title">
|
||||||
@@ -42,16 +42,24 @@
|
|||||||
<style name="DrawerHeader.Button">
|
<style name="DrawerHeader.Button">
|
||||||
<item name="android:layout_width">48dp</item>
|
<item name="android:layout_width">48dp</item>
|
||||||
<item name="android:layout_height">48dp</item>
|
<item name="android:layout_height">48dp</item>
|
||||||
<item name="android:backgroundTint">@color/brandLight</item>
|
<item name="android:backgroundTint">@color/themeAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ToolbarText">
|
<style name="ToolbarText">
|
||||||
<item name="android:layout_width">wrap_content</item>
|
<item name="android:layout_width">wrap_content</item>
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:gravity">center</item>
|
<item name="android:gravity">center</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:text">@string/next_aos_pattern</item>
|
||||||
<item name="android:textSize">30sp</item>
|
<item name="android:textSize">30sp</item>
|
||||||
<item name="android:textColor">@color/brandLight</item>
|
<item name="android:textStyle">bold</item>
|
||||||
|
<item name="android:textColor">@color/themeAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="ToolbarButton">
|
||||||
|
<item name="android:layout_width">48dp</item>
|
||||||
|
<item name="android:layout_height">48dp</item>
|
||||||
|
<item name="android:src">@drawable/ic_refresh</item>
|
||||||
|
<item name="android:backgroundTint">@color/toolbarButton</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Reference in new issue
Block a user