Skip to content

Commit

Permalink
Refactor menus
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenMcGirr committed Jan 11, 2024
1 parent 5591ab2 commit 35ac418
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.enaboapps.switchify.service.menu.MenuManager
import com.enaboapps.switchify.service.menu.MenuView

class GesturesMenu(accessibilityService: SwitchifyAccessibilityService) {
private var items: List<MenuItem> = listOf(
private val items: List<MenuItem> = listOf(
MenuItem("Tap", {
GestureManager.getInstance().performTap()
}),
Expand All @@ -25,15 +25,6 @@ class GesturesMenu(accessibilityService: SwitchifyAccessibilityService) {
})
)

val menuView = MenuView(accessibilityService, items.toMutableList())
val menuView = MenuView(accessibilityService, items)

// This function is called when the menu is opened
fun open() {
menuView.open()
}

// This function is called when the menu is closed
fun close() {
menuView.close()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.enaboapps.switchify.service.menu.MenuManager
import com.enaboapps.switchify.service.menu.MenuView

class MainMenu(accessibilityService: SwitchifyAccessibilityService) {
private var items: List<MenuItem> = listOf(
private val items: List<MenuItem> = listOf(
MenuItem("Tap", {
GestureManager.getInstance().performTap()
}),
Expand All @@ -22,15 +22,6 @@ class MainMenu(accessibilityService: SwitchifyAccessibilityService) {
})
)

val menuView = MenuView(accessibilityService, items.toMutableList())
val menuView = MenuView(accessibilityService, items)

// This function is called when the menu is opened
fun open() {
menuView.open()
}

// This function is called when the menu is closed
fun close() {
menuView.close()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.enaboapps.switchify.service.menu.MenuManager
import com.enaboapps.switchify.service.menu.MenuView

class SwipeMenu(accessibilityService: SwitchifyAccessibilityService) {
private var items: List<MenuItem> = listOf(
private val items: List<MenuItem> = listOf(
MenuItem("Swipe Up", {
GestureManager.getInstance().performSwipe(GestureManager.SwipeDirection.UP)
}),
Expand All @@ -28,15 +28,6 @@ class SwipeMenu(accessibilityService: SwitchifyAccessibilityService) {
})
)

val menuView = MenuView(accessibilityService, items.toMutableList())

// This function is called when the menu is opened
fun open() {
menuView.open()
}

// This function is called when the menu is closed
fun close() {
menuView.close()
}
val menuView = MenuView(accessibilityService, items)

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.enaboapps.switchify.service.menu.MenuView

class SystemControlMenu(accessibilityService: AccessibilityService) {

private var items: List<MenuItem> = listOf(
private val items: List<MenuItem> = listOf(
MenuItem("Back", {
// Perform the back action
accessibilityService.performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK)
Expand Down Expand Up @@ -36,16 +36,6 @@ class SystemControlMenu(accessibilityService: AccessibilityService) {
})
)

val menuView = MenuView(accessibilityService, items.toMutableList())

// This function is called when the menu is opened
fun open() {
menuView.open()
}

// This function is called when the menu is closed
fun close() {
menuView.close()
}
val menuView = MenuView(accessibilityService, items)

}

0 comments on commit 35ac418

Please sign in to comment.