Skip to content

Commit

Permalink
Reorganize quickactions
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Jan 27, 2024
1 parent 026aa36 commit 06c0b62
Show file tree
Hide file tree
Showing 56 changed files with 131 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.kylecorry.andromeda.preferences.BooleanPreference
import com.kylecorry.sol.science.astronomy.SunTimesMode
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.shared.preferences.PreferencesSubsystem
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.Tools
import java.time.LocalDate
import java.time.LocalTime

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.astronomy.quickactions

import com.kylecorry.trail_sense.astronomy.infrastructure.AstronomyPreferences
import com.kylecorry.trail_sense.astronomy.ui.AstronomyFragment
import com.kylecorry.trail_sense.databinding.ActivityAstronomyBinding
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.shared.quickactions.IQuickActionBinder
import com.kylecorry.trail_sense.shared.quickactions.QuickActionFactory

class AstronomyQuickActionBinder(
private val fragment: AstronomyFragment,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.astronomy.quickactions

import android.widget.ImageButton
import androidx.fragment.app.Fragment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.astronomy.quickactions

import android.widget.ImageButton
import androidx.fragment.app.Fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import com.kylecorry.trail_sense.astronomy.ui.items.SolarEclipseListItemProducer
import com.kylecorry.trail_sense.astronomy.ui.items.SunListItemProducer
import com.kylecorry.trail_sense.databinding.ActivityAstronomyBinding
import com.kylecorry.trail_sense.main.MainActivity
import com.kylecorry.trail_sense.quickactions.AstronomyQuickActionBinder
import com.kylecorry.trail_sense.astronomy.quickactions.AstronomyQuickActionBinder
import com.kylecorry.trail_sense.shared.ErrorBannerReason
import com.kylecorry.trail_sense.shared.FormatService
import com.kylecorry.trail_sense.shared.UserPreferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.kylecorry.trail_sense.shared.colors.AppColor
import com.kylecorry.trail_sense.shared.preferences.PreferencesSubsystem
import com.kylecorry.trail_sense.shared.sensors.SensorService
import com.kylecorry.trail_sense.tools.maps.domain.sort.MapSortMethod
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.Tools
import java.time.Duration

class NavigationPreferences(private val context: Context) : ICompassStylePreferences,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.navigation.paths.quickactions

import android.widget.ImageButton
import androidx.navigation.fragment.findNavController
Expand All @@ -9,6 +9,7 @@ import com.kylecorry.andromeda.fragments.AndromedaFragment
import com.kylecorry.andromeda.fragments.inBackground
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.navigation.paths.infrastructure.subsystem.BacktrackSubsystem
import com.kylecorry.trail_sense.shared.quickactions.TopicQuickAction
import com.kylecorry.trail_sense.shared.FeatureState
import com.kylecorry.trail_sense.shared.navigateWithAnimation
import com.kylecorry.trail_sense.shared.permissions.RequestRemoveBatteryRestrictionCommand
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.navigation.paths.quickactions

import android.widget.ImageButton
import androidx.fragment.app.Fragment
Expand All @@ -7,6 +7,7 @@ import com.kylecorry.andromeda.core.topics.generic.ITopic
import com.kylecorry.andromeda.core.topics.generic.replay
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.navigation.paths.infrastructure.subsystem.BacktrackSubsystem
import com.kylecorry.trail_sense.shared.quickactions.TopicQuickAction
import com.kylecorry.trail_sense.shared.FeatureState
import com.kylecorry.trail_sense.shared.navigateWithAnimation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.navigation.quickactions

import com.kylecorry.trail_sense.databinding.ActivityNavigatorBinding
import com.kylecorry.trail_sense.navigation.infrastructure.NavigationPreferences
import com.kylecorry.trail_sense.navigation.ui.NavigatorFragment
import com.kylecorry.trail_sense.shared.quickactions.IQuickActionBinder
import com.kylecorry.trail_sense.shared.quickactions.QuickActionFactory

class NavigationQuickActionBinder(
private val fragment: NavigatorFragment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import com.kylecorry.trail_sense.navigation.ui.layers.compass.BeaconCompassLayer
import com.kylecorry.trail_sense.navigation.ui.layers.compass.ICompassView
import com.kylecorry.trail_sense.navigation.ui.layers.compass.MarkerCompassLayer
import com.kylecorry.trail_sense.navigation.ui.layers.compass.NavigationCompassLayer
import com.kylecorry.trail_sense.quickactions.NavigationQuickActionBinder
import com.kylecorry.trail_sense.navigation.quickactions.NavigationQuickActionBinder
import com.kylecorry.trail_sense.shared.CustomUiUtils
import com.kylecorry.trail_sense.shared.CustomUiUtils.getPrimaryMarkerColor
import com.kylecorry.trail_sense.shared.FormatService
Expand All @@ -82,7 +82,7 @@ import com.kylecorry.trail_sense.tools.maps.infrastructure.layers.MyAccuracyLaye
import com.kylecorry.trail_sense.tools.maps.infrastructure.layers.MyLocationLayerManager
import com.kylecorry.trail_sense.tools.maps.infrastructure.layers.PathLayerManager
import com.kylecorry.trail_sense.tools.maps.infrastructure.layers.TideLayerManager
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.Tools
import java.time.Duration
import java.time.Instant

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.astronomy.infrastructure.receivers.SunsetAlarmReceiver
import com.kylecorry.trail_sense.shared.UserPreferences
import com.kylecorry.trail_sense.shared.preferences.PreferencesSubsystem
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.Tools

class AstronomySettingsFragment : AndromedaPreferenceFragment() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.kylecorry.trail_sense.shared.UserPreferences
import com.kylecorry.trail_sense.shared.permissions.alertNoActivityRecognitionPermission
import com.kylecorry.trail_sense.shared.permissions.requestActivityRecognition
import com.kylecorry.trail_sense.shared.sensors.SensorService
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.Tools

class NavigationSettingsFragment : AndromedaPreferenceFragment() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import com.kylecorry.trail_sense.shared.UserPreferences
import com.kylecorry.trail_sense.shared.io.ActivityUriPicker
import com.kylecorry.trail_sense.shared.navigateWithAnimation
import com.kylecorry.trail_sense.shared.requireMainActivity
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.ui.sort.AlphabeticalToolSort
import com.kylecorry.trail_sense.tools.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.sort.AlphabeticalToolSort
import kotlinx.coroutines.launch

class SettingsFragment : AndromedaPreferenceFragment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.kylecorry.trail_sense.shared.io.IOFactory
import com.kylecorry.trail_sense.shared.permissions.RequestRemoveBatteryRestrictionCommand
import com.kylecorry.trail_sense.shared.preferences.setupNotificationSetting
import com.kylecorry.trail_sense.shared.requireMainActivity
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.Tools
import com.kylecorry.trail_sense.weather.infrastructure.WeatherCsvConverter
import com.kylecorry.trail_sense.weather.infrastructure.WeatherPreferences
import com.kylecorry.trail_sense.weather.infrastructure.WeatherUpdateScheduler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import com.kylecorry.trail_sense.shared.extensions.putLongArray
import com.kylecorry.trail_sense.shared.preferences.PreferencesSubsystem
import com.kylecorry.trail_sense.shared.sharing.MapSite
import com.kylecorry.trail_sense.tools.flashlight.infrastructure.FlashlightSubsystem
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.ui.sort.ToolSortType
import com.kylecorry.trail_sense.tools.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.sort.ToolSortType
import com.kylecorry.trail_sense.weather.infrastructure.WeatherPreferences
import java.time.Duration

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.kylecorry.trail_sense.shared.quickactions

interface IQuickActionBinder {

fun bind()

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.shared.quickactions

import android.widget.ImageButton
import com.kylecorry.andromeda.fragments.AndromedaFragment
import com.kylecorry.trail_sense.shared.QuickActionButton
import com.kylecorry.trail_sense.shared.views.QuickActionNone
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.Tools

class QuickActionFactory {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.shared.quickactions

import android.widget.ImageButton
import androidx.core.view.isVisible
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.tools.battery.quickactions

import android.widget.ImageButton
import androidx.fragment.app.Fragment
Expand All @@ -8,7 +8,7 @@ import com.kylecorry.trail_sense.shared.LowPowerMode
import com.kylecorry.trail_sense.shared.QuickActionButton
import com.kylecorry.trail_sense.shared.UserPreferences

class LowPowerQuickAction(button: ImageButton, fragment: Fragment): QuickActionButton(button, fragment) {
class QuickActionLowPowerMode(button: ImageButton, fragment: Fragment): QuickActionButton(button, fragment) {

private val lowerPowerMode by lazy { LowPowerMode(context) }
private val prefs by lazy { UserPreferences(context) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.tools.flashlight.quickactions

import android.widget.ImageButton
import androidx.fragment.app.Fragment
import com.kylecorry.andromeda.core.topics.generic.ITopic
import com.kylecorry.andromeda.core.topics.generic.map
import com.kylecorry.andromeda.core.topics.generic.replay
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.shared.quickactions.TopicQuickAction
import com.kylecorry.trail_sense.shared.FeatureState
import com.kylecorry.trail_sense.tools.flashlight.domain.FlashlightMode
import com.kylecorry.trail_sense.tools.flashlight.infrastructure.FlashlightSubsystem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.tools.flashlight.quickactions

import android.widget.ImageButton
import androidx.fragment.app.Fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.kylecorry.andromeda.sense.Sensors
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.tools.guide.domain.UserGuide
import com.kylecorry.trail_sense.tools.guide.domain.UserGuideCategory
import com.kylecorry.trail_sense.tools.ui.Tools
import com.kylecorry.trail_sense.tools.ui.sort.CategoricalToolSort
import com.kylecorry.trail_sense.tools.tools.ui.Tools
import com.kylecorry.trail_sense.tools.tools.ui.sort.CategoricalToolSort

object Guides {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.tools.lightning.quickactions

import android.widget.ImageButton
import androidx.fragment.app.Fragment
Expand All @@ -8,7 +8,7 @@ import com.kylecorry.trail_sense.shared.CustomUiUtils
import com.kylecorry.trail_sense.shared.QuickActionButton
import com.kylecorry.trail_sense.shared.navigateWithAnimation

class QuickActionThunder(btn: ImageButton, fragment: Fragment) :
class QuickActionLightingStrikeDistance(btn: ImageButton, fragment: Fragment) :
QuickActionButton(btn, fragment) {

override fun onCreate() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.tools.maps.quickactions

import android.widget.ImageButton
import androidx.fragment.app.Fragment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.tools.pedometer.quickactions

import android.widget.ImageButton
import androidx.navigation.fragment.findNavController
import com.kylecorry.andromeda.core.topics.generic.ITopic
import com.kylecorry.andromeda.core.topics.generic.replay
import com.kylecorry.andromeda.fragments.AndromedaFragment
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.shared.quickactions.TopicQuickAction
import com.kylecorry.trail_sense.shared.FeatureState
import com.kylecorry.trail_sense.shared.extensions.getOrNull
import com.kylecorry.trail_sense.shared.navigateWithAnimation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.tools.ruler.quickactions

import android.view.ViewGroup
import android.widget.ImageButton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.quickactions
package com.kylecorry.trail_sense.tools.tools.quickactions

import android.widget.ImageButton
import androidx.core.view.isVisible
Expand All @@ -8,6 +8,8 @@ import com.kylecorry.andromeda.core.system.Resources
import com.kylecorry.andromeda.fragments.AndromedaFragment
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.databinding.FragmentToolsBinding
import com.kylecorry.trail_sense.shared.quickactions.IQuickActionBinder
import com.kylecorry.trail_sense.shared.quickactions.QuickActionFactory
import com.kylecorry.trail_sense.shared.CustomUiUtils
import com.kylecorry.trail_sense.shared.UserPreferences

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.tools.ui
package com.kylecorry.trail_sense.tools.tools.ui

import com.kylecorry.trail_sense.shared.UserPreferences

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kylecorry.trail_sense.tools.ui
package com.kylecorry.trail_sense.tools.tools.ui

import android.content.Context
import android.hardware.Sensor
Expand All @@ -8,23 +8,23 @@ import androidx.annotation.IdRes
import com.kylecorry.andromeda.fragments.AndromedaFragment
import com.kylecorry.andromeda.sense.Sensors
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.quickactions.LowPowerQuickAction
import com.kylecorry.trail_sense.quickactions.QuickActionBacktrack
import com.kylecorry.trail_sense.quickactions.QuickActionClimate
import com.kylecorry.trail_sense.quickactions.QuickActionClouds
import com.kylecorry.trail_sense.quickactions.QuickActionFlashlight
import com.kylecorry.trail_sense.quickactions.QuickActionNightMode
import com.kylecorry.trail_sense.quickactions.QuickActionPaths
import com.kylecorry.trail_sense.quickactions.QuickActionPedometer
import com.kylecorry.trail_sense.quickactions.QuickActionPhotoMaps
import com.kylecorry.trail_sense.quickactions.QuickActionRuler
import com.kylecorry.trail_sense.quickactions.QuickActionScreenFlashlight
import com.kylecorry.trail_sense.quickactions.QuickActionSunsetAlert
import com.kylecorry.trail_sense.quickactions.QuickActionTemperatureEstimation
import com.kylecorry.trail_sense.quickactions.QuickActionThunder
import com.kylecorry.trail_sense.quickactions.QuickActionWeatherMonitor
import com.kylecorry.trail_sense.quickactions.QuickActionWhistle
import com.kylecorry.trail_sense.quickactions.QuickActionWhiteNoise
import com.kylecorry.trail_sense.tools.battery.quickactions.QuickActionLowPowerMode
import com.kylecorry.trail_sense.navigation.paths.quickactions.QuickActionBacktrack
import com.kylecorry.trail_sense.weather.quickactions.QuickActionClimate
import com.kylecorry.trail_sense.weather.quickactions.QuickActionClouds
import com.kylecorry.trail_sense.tools.flashlight.quickactions.QuickActionFlashlight
import com.kylecorry.trail_sense.astronomy.quickactions.QuickActionNightMode
import com.kylecorry.trail_sense.navigation.paths.quickactions.QuickActionPaths
import com.kylecorry.trail_sense.tools.pedometer.quickactions.QuickActionPedometer
import com.kylecorry.trail_sense.tools.maps.quickactions.QuickActionPhotoMaps
import com.kylecorry.trail_sense.tools.ruler.quickactions.QuickActionRuler
import com.kylecorry.trail_sense.tools.flashlight.quickactions.QuickActionScreenFlashlight
import com.kylecorry.trail_sense.astronomy.quickactions.QuickActionSunsetAlert
import com.kylecorry.trail_sense.weather.quickactions.QuickActionTemperatureEstimation
import com.kylecorry.trail_sense.tools.lightning.quickactions.QuickActionLightingStrikeDistance
import com.kylecorry.trail_sense.weather.quickactions.QuickActionWeatherMonitor
import com.kylecorry.trail_sense.tools.whistle.quickactions.QuickActionWhistle
import com.kylecorry.trail_sense.tools.whitenoise.quickactions.QuickActionWhiteNoise
import com.kylecorry.trail_sense.shared.QuickActionButton
import com.kylecorry.trail_sense.shared.UserPreferences
import com.kylecorry.trail_sense.shared.database.Identifiable
Expand Down Expand Up @@ -284,7 +284,7 @@ object Tools {
ToolQuickAction(
QUICK_ACTION_LOW_POWER_MODE,
context.getString(R.string.pref_low_power_mode_title)
) { button, fragment -> LowPowerQuickAction(button, fragment) }
) { button, fragment -> QuickActionLowPowerMode(button, fragment) }
)
),
if (hasCompass) Tool(
Expand Down Expand Up @@ -376,7 +376,7 @@ object Tools {
ToolQuickAction(
QUICK_ACTION_THUNDER,
context.getString(R.string.tool_lightning_title),
) { button, fragment -> QuickActionThunder(button, fragment) }
) { button, fragment -> QuickActionLightingStrikeDistance(button, fragment) }
)
),
if (prefs.isAugmentedRealityEnabled && hasCompass) Tool(
Expand Down
Loading

0 comments on commit 06c0b62

Please sign in to comment.