mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Add notification button and dialog on Radar Fragment
This commit is contained in:
1 parent
5f4c63ee49
commit
5c5f08afc0
4 files changed
+53
No files matched your search
@@ -19,11 +19,13 @@ package com.rtbishop.look4sat.presentation.radarScreen
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.SimpleItemAnimator
|
import androidx.recyclerview.widget.SimpleItemAnimator
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.rtbishop.look4sat.R
|
import com.rtbishop.look4sat.R
|
||||||
import com.rtbishop.look4sat.databinding.FragmentRadarBinding
|
import com.rtbishop.look4sat.databinding.FragmentRadarBinding
|
||||||
import com.rtbishop.look4sat.framework.PreferencesSource
|
import com.rtbishop.look4sat.framework.PreferencesSource
|
||||||
@@ -105,6 +107,30 @@ class RadarFragment : Fragment(R.layout.fragment_radar) {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.addNotificationButtton.setOnClickListener {
|
||||||
|
this.context?.let { context ->
|
||||||
|
|
||||||
|
val choicesList = arrayOf(
|
||||||
|
getString(R.string.notification_on_start_pass),
|
||||||
|
getString(R.string.notification_5_min_before),
|
||||||
|
getString(R.string.notification_10_min_before),
|
||||||
|
getString(R.string.notification_15_min_before),
|
||||||
|
)
|
||||||
|
|
||||||
|
MaterialAlertDialogBuilder(context)
|
||||||
|
.setTitle(getString(R.string.notification_title))
|
||||||
|
.setSingleChoiceItems(choicesList, -1) { dialog, which ->
|
||||||
|
// TODO in this place should set a notification by NotificationBuilder
|
||||||
|
Toast.makeText(context, "Reminder was saved", Toast.LENGTH_SHORT).show()
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
.setNegativeButton(getString(R.string.btn_cancel)) { _, _ ->
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setPassText(satPass: SatPass, satPos: SatPos, binding: FragmentRadarBinding) {
|
private fun setPassText(satPass: SatPass, satPos: SatPos, binding: FragmentRadarBinding) {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/themeLight"
|
||||||
|
android:pathData="M21,19V20H3V19L5,17V11C5,7.9 7.03,5.17 10,4.29C10,4.19 10,4.1 10,4A2,2 0 0,1 12,2A2,2 0 0,1 14,4C14,4.1 14,4.19 14,4.29C16.97,5.17 19,7.9 19,11V17L21,19M14,21A2,2 0 0,1 12,23A2,2 0 0,1 10,21" />
|
||||||
|
</vector>
|
||||||
@@ -75,6 +75,18 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="@+id/radar_frame"
|
app:layout_constraintBottom_toBottomOf="@+id/radar_frame"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/radar_frame" />
|
app:layout_constraintEnd_toEndOf="@+id/radar_frame" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/add_notification_buttton"
|
||||||
|
android:layout_width="64dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:backgroundTint="@color/greyDark"
|
||||||
|
android:contentDescription="@string/placeholder"
|
||||||
|
android:elevation="4dp"
|
||||||
|
android:src="@drawable/ic_notification"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/radar_bar"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/radar_recycler"
|
android:id="@+id/radar_recycler"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
@@ -14,6 +14,12 @@
|
|||||||
<string name="menu_prefs">Settings</string>
|
<string name="menu_prefs">Settings</string>
|
||||||
<string name="menu_about">Info</string>
|
<string name="menu_about">Info</string>
|
||||||
|
|
||||||
|
<string name="notification_title">Set notification to incoming pass</string>
|
||||||
|
<string name="notification_on_start_pass">on start pass</string>
|
||||||
|
<string name="notification_5_min_before">5 minutes before pass</string>
|
||||||
|
<string name="notification_10_min_before">10 minutes before pass</string>
|
||||||
|
<string name="notification_15_min_before">15 minutes before pass</string>
|
||||||
|
|
||||||
<string name="sources_title">Manage TLE sources</string>
|
<string name="sources_title">Manage TLE sources</string>
|
||||||
<string name="sources_hint">Source URL</string>
|
<string name="sources_hint">Source URL</string>
|
||||||
<string name="sources_https">Protocol HTTPS only</string>
|
<string name="sources_https">Protocol HTTPS only</string>
|
||||||
|
|||||||
Reference in new issue
Block a user