Skip to content

Commit

Permalink
Add all tools to the tool tab
Browse files Browse the repository at this point in the history
Ex. navigation, astronomy, weather, settings
  • Loading branch information
kylecorry31 committed Nov 11, 2023
1 parent 4f186b5 commit 16070a8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
36 changes: 36 additions & 0 deletions app/src/main/java/com/kylecorry/trail_sense/tools/ui/Tools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ object Tools {
val hasLightMeter = Sensors.hasSensor(context, Sensor.TYPE_LIGHT)
val hasPedometer = Sensors.hasSensor(context, Sensor.TYPE_STEP_COUNTER)
val hasCompass = SensorService(context).hasCompass()
val hasBarometer = Sensors.hasBarometer(context)
val prefs = UserPreferences(context)
val signaling = ToolGroup(
context.getString(R.string.tool_category_signaling), listOf(
Expand Down Expand Up @@ -61,6 +62,16 @@ object Tools {

val location = ToolGroup(
context.getString(R.string.location), listOfNotNull(
Tool(
context.getString(R.string.navigation),
R.drawable.ic_compass_icon,
R.id.action_navigation
),
Tool(
context.getString(R.string.beacons),
R.drawable.ic_location,
R.id.action_tools_to_beacons
),
Tool(
context.getString(R.string.photo_maps),
R.drawable.maps,
Expand Down Expand Up @@ -104,6 +115,11 @@ object Tools {
R.drawable.ic_tool_clock,
R.id.action_action_experimental_tools_to_toolClockFragment
),
Tool(
context.getString(R.string.astronomy),
R.drawable.ic_astronomy,
R.id.action_astronomy
),
Tool(
context.getString(R.string.water_boil_timer),
R.drawable.ic_tool_boil,
Expand Down Expand Up @@ -142,6 +158,11 @@ object Tools {

val weather = ToolGroup(
context.getString(R.string.weather), listOfNotNull(
if (hasBarometer) Tool(
context.getString(R.string.weather),
R.drawable.cloud,
R.id.action_weather
) else null,
Tool(
context.getString(R.string.tool_climate),
R.drawable.ic_temperature_range,
Expand Down Expand Up @@ -207,6 +228,21 @@ object Tools {
R.drawable.ic_qr_code,
R.id.action_tools_to_qr
),
Tool(
context.getString(R.string.sensors),
R.drawable.ic_sensors,
R.id.sensorDetailsFragment
),
Tool(
context.getString(R.string.diagnostics),
R.drawable.ic_alert,
R.id.action_tools_to_diagnostics
),
Tool(
context.getString(R.string.settings),
R.drawable.ic_settings,
R.id.action_settings
),
Tool(
context.getString(R.string.tool_user_guide_title),
R.drawable.ic_user_guide,
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
android:id="@+id/action_experimental_tools"
android:name="com.kylecorry.trail_sense.tools.ui.ToolsFragment"
android:label="ToolsFragment">
<action
android:id="@+id/action_tools_to_beacons"
app:destination="@id/beacon_list"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right" />
<action
android:id="@+id/action_toolsFragment_to_toolConvertFragment"
app:destination="@id/toolConvertFragment"
Expand Down Expand Up @@ -210,6 +217,13 @@
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right" />
<action
android:id="@+id/action_tools_to_diagnostics"
app:destination="@id/diagnosticsFragment"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right" />
<action
android:id="@+id/action_action_experimental_tools_to_fragmentToolWhiteNoise"
app:destination="@id/fragmentToolWhiteNoise"
Expand Down

0 comments on commit 16070a8

Please sign in to comment.