Class: RokuSigninKeyboard

Inherits:
Keyboard show all
Defined in:
lib/keyboard/roku/roku_signin_keyboard.rb

Direct Known Subclasses

RokuResetPinKeyboard

Constant Summary

Constants inherited from Keyboard

Keyboard::DEBUG

Instance Method Summary collapse

Methods inherited from Keyboard

#displayed?, #reset, #type?

Constructor Details

#initialize(*args) ⇒ RokuSigninKeyboard

Returns a new instance of RokuSigninKeyboard.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/keyboard/roku/roku_signin_keyboard.rb', line 6

def initialize(*args)
  super(*args)
  # see Keyboard for explanation of layouts
  letters = [
      [:SHIFT_LOCK, :SHIFT, 'a', 'b', 'c', 'd', 'e', 'f', 'g', '1', '2', '3', :BLANK, :BLANK],
      [:LETTERS, :LETTERS, 'h', 'i', 'j', 'k', 'l', 'm', 'n', '4', '5', '6', :SPACE, :SPACE],
      [:SYMBOLS, :SYMBOLS, 'o', 'p', 'q', 'r', 's', 't', 'u', '7', '8', '9', :CURSOR_L, :CURSOR_R],
      [:SPECIAL, :SPECIAL, 'v', 'w', 'x', 'y', 'z', '-', '_', '@', '.', '0', :BACKSPACE, :BACKSPACE]
  ]
  symbols = [
      [:SHIFT_LOCK, :SHIFT, '!', '?', '*', '#', '$', '%', '^', '́', '̂', '̃', :BLANK, :BLANK],
      [:LETTERS, :LETTERS, '&', ',', ':', ';', '`', "'", '"', '̈', '̄', '̗', :SPACE, :SPACE],
      [:SYMBOLS, :SYMBOLS, '(', ')', '{', '}', '[', ']', '~', '=', '+', '×', :CURSOR_L, :CURSOR_R],
      [:SPECIAL, :SPECIAL, '¡', '¿', '<', '>', '|', '\\', '/', '÷', '±', '', :BACKSPACE, :BACKSPACE]
  ]
  # todo: add SHIFTed symbols?
  special = [] #TODO: get them here - http://www.addressmunger.com/special_ascii_characters/
  @layouts << KeyboardLayout.new(letters, [0, 2], nav_to_key: :LETTERS, name: 'default letters')
  @layouts << KeyboardLayout.new(symbols, [2, 1], nav_to_key: :SYMBOLS, name: 'default symbols')
  @key_delay = 1.5.sec
  @shift_persists = true
  @wrap_cols = true
  # Do not traverse from LETTERS to SHIFT or SHIFT_LOCK, since the app remembers (inconsistently) the last path.
  # Do not traverse from SPACE or BACKSPACE to CURSOR_L or CURSOR_R, since the app remembers the last path.
  @deny_traversals = [
      [:LETTERS, :SHIFT_LOCK], [:LETTERS, :SHIFT], [:SPACE, :CURSOR_L], [:SPACE, :CURSOR_R], [:BACKSPACE, :CURSOR_L],
      [:BACKSPACE, :CURSOR_R]
  ]
end