def __init__(self):
     self.layout = Ui.LinearLayout(
         background="#ff314859",
         orientation=Ui.VERTICAL,
     )
     Ui.TextView(
         self.layout,
         layout_width=Ui.FILL_PARENT,
         layout_height="0px",
         textSize="16dp",
         text="FullScreenWrapper2 Demo",
         textColor="#ffffffff",
         layout_weight=20,
         gravity=Ui.CENTER,
     )
     self.txt_colorbox = Ui.TextView(
         self.layout,
         layout_width=Ui.FILL_PARENT,
         layout_height="0px",
         background="#ff000000",
         layout_weight="60",
         gravity=Ui.CENTER,
     )
     self.buttonBox = Ui.LinearLayout(
         self.layout,
         layout_width=Ui.FILL_PARENT,
         layout_height="0px",
         orientation=Ui.HORIZONTAL,
         layout_weight="20",
     )
     Ui.Button(
         self.buttonBox,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.FILL_PARENT,
         background="#ff66a3d2",
         text="Random Color",
         layout_weight=1,
         textSize="14dp",
         gravity=Ui.CENTER,
         # HERE: click callback, auto registered
         command=self.change_color,
     )
     Ui.Button(
         self.buttonBox,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.FILL_PARENT,
         background="#ff25567b",
         layout_weight=1,
         text="Exit",
         textSize="14dp",
         gravity=Ui.CENTER,
         # HERE: call quit() on ui element will quit the current layout
         command=self.layout.quit,
     )
    def __init__(self):
        Ui.DroidUi.__init__(self)

        self.layout = Ui.LinearLayout(
            self,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            background="#ff314859",
            orientation=Ui.VERTICAL,
        )
        Ui.TextView(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.WRAP_CONTENT,
            text="Wrapper Demo",
            textSize="20dp",
            gravity=Ui.CENTER,
            textColor=color_yellow,
        )
        self.lst_list = Ui.ListView(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            layout_height="300dp",
        )
        self.buttonBox = Ui.LinearLayout(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.WRAP_CONTENT,
            orientation=Ui.HORIZONTAL,
        )
        self._button(
            self.buttonBox,
            text="Add",
            background=color_light,
            command=self.on_but_add_click,
        )
        self._button(
            self.buttonBox,
            text="Lookup",
            background=color_deep,
            command=self.on_but_lookup,
        )
        self._button(
            self.buttonBox,
            text="Exit",
            background=color_light,
            command=self.layout.quit,
        )
 def _datetimeLayout(self, master, name, text, command):
     layout = Ui.LinearLayout(
         master,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.WRAP_CONTENT,
         orientation=Ui.HORIZONTAL,
         layout_weight=11,
     )
     Ui.TextView(
         layout,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.FILL_PARENT,
         text=text,
         textColor=color_yellow,
         textSize="14dp",
         layout_weight=1,
         gravity=Ui.CENTER,
         textStyle=1,
     )
     setattr(
         self, name,
         Ui.TextView(
             layout,
             layout_width=Ui.FILL_PARENT,
             layout_height=Ui.FILL_PARENT,
             textColor=color_white,
             textSize="14dp",
             layout_weight=1,
             gravity=Ui.joinattr(Ui.LEFT, Ui.CENTER_VERTICAL),
         ))
     Ui.Button(
         layout,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.FILL_PARENT,
         textColor=color_white,
         textSize="14dp",
         layout_weight=1,
         background=color_light,
         text="Change",
         gravity=Ui.CENTER,
         command=command,
     )
     Ui.LinearLayout(
         master,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.WRAP_CONTENT,
         layout_weight=1,
     )
 def _buttonLayout(self, master):
     return Ui.LinearLayout(
         master,
         layout_width=Ui.FILL_PARENT,
         layout_height=Ui.WRAP_CONTENT,
         orientation=Ui.HORIZONTAL,
         layout_weight=15,
     )
Ejemplo n.º 5
0
 def image(self, master, name):
     layout = Ui.LinearLayout(
         master,
         orientation=Ui.HORIZONTAL,
     )
     Ui.ImageView(layout, src='@android:drawable/' + name)
     Ui.TextView(layout, text=name)
     return layout
Ejemplo n.º 6
0
 def __init__(self):
     Ui.DroidUi.__init__(self)
     self.layout = Ui.LinearLayout(
         Ui.ScrollView(self),
         background='@android:drawable/screen_background_dark_transparent',
     )
     for name in NAMES:
         self.image(self.layout, name)
Ejemplo n.º 7
0
 def _boxLayout(self, master):
     return Ui.LinearLayout(
         master,
         layout_width=Ui.FILL_PARENT,
         layout_height="0px",
         orientation=Ui.HORIZONTAL,
         layout_weight=27,
     )
Ejemplo n.º 8
0
 def __init__(self):
     Ui.DroidUi.__init__(self)
     self.layout = Ui.LinearLayout(Ui.ScrollView(self), )
     for name in sorted(HTMLColor):
         color = HTMLColor[name]
         Ui.TextView(
             self.layout,
             layout_width=Ui.MATCH_PARENT,
             gravity=Ui.CENTER,
             text='%s: %s' % (name, color),
             textColor='#%06x' % (0xffffff - int(color[1:], 16), ),
             background=color,
         )
Ejemplo n.º 9
0
 def __init__(self):
     self.about = Ui.TextView(
         Ui.ScrollView(padding='20dp', background='#ff000000'),
         text=self.about_text,
     )
     self.game = Game()
     self.outer = Ui.LinearLayout(
         Ui.LinearLayout(background='#ff000000'),
         padding='30dp',
         background='#3500ffff',
         layout_height=Ui.FILL_PARENT,
     )
     self.inner = Ui.LinearLayout(self.outer, gravity=Ui.CENTER)
     Ui.TextView(
         self.inner,
         text='Android Sudoku',
         textSize='20dip',
         layout_marginBottom='25dip',
     )
     Ui.Button(self.inner, text='Continue', command=self.resume)
     Ui.Button(self.inner, text='New Game', command=self.play)
     Ui.Button(self.inner, text='About', command=self.about.mainloop)
     Ui.Button(self.inner, text='Exit', command=self.inner.quit)
Ejemplo n.º 10
0
    def __init__(self):
        Ui.DroidUi.__init__(self)
        self.layout = Ui.LinearLayout(
            self,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            background=color_bg,
            orientation=Ui.VERTICAL,
        )

        Ui.TextView(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            layout_height="0px",
            textSize="20dp",
            text="Gyro Test",
            textColor=color_white,
            layout_weight=19,
            gravity=Ui.CENTER,
        )

        box1 = self._boxLayout(self.layout)
        self._block(box1, color_bg)
        self.txt_top = self._block(box1, color_default)
        self._block(box1, color_bg)

        box2 = self._boxLayout(self.layout)
        self.txt_left = self._block(box2, color_default)
        self._block(box2, color_bg)
        self.txt_right = self._block(box2, color_default)

        box3 = self._boxLayout(self.layout)
        self._block(box3, color_bg)
        self.txt_bottom = self._block(box3, color_default)
        self._block(box3, color_bg)

        self.reg_event('sensors', self.gyro)

        # start sensing
        self.sensing = Ui.Sensing()
    def __init__(self):
        Ui.DroidUi.__init__(self)
        self.result = None
        self.curdatetime = datetime.today()

        self.layout = Ui.LinearLayout(
            self,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            background="#ff314859",
            orientation=Ui.VERTICAL,
        )

        Ui.TextView(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            textSize="20dp",
            text="Add Screen",
            textColor=color_white,
            gravity=Ui.CENTER,
            layout_weight=15,
        )

        self._datetimeLayout(self.layout, 'add_txt_date', 'Date',
                             self.on_but_datechange_click)
        self._datetimeLayout(self.layout, 'add_txt_time', 'Time',
                             self.on_but_timechange_click)

        valueLayout = Ui.LinearLayout(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.WRAP_CONTENT,
            orientation=Ui.HORIZONTAL,
            layout_weight=11,
        )
        Ui.TextView(
            valueLayout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            text='Value',
            textColor=color_yellow,
            textSize="14dp",
            layout_weight=1,
            gravity=Ui.CENTER,
            textStyle=1,
        )
        self.add_txt_value = Ui.EditText(
            valueLayout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            digits="0123456789",
            textSize="12dp",
            layout_weight=1,
            background=color_white,
            gravity=Ui.joinattr(Ui.LEFT, Ui.CENTER_VERTICAL),
        )
        Ui.Button(
            valueLayout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.FILL_PARENT,
            textColor=color_yellow,
            textSize="14dp",
            layout_weight=1,
            background=color_light,
            text="Save",
            gravity=Ui.CENTER,
            command=self.on_but_save_click,
        )

        Ui.TextView(
            self.layout,
            layout_width=Ui.FILL_PARENT,
            layout_height=Ui.WRAP_CONTENT,
            textSize="10dp",
            text="Type value or choose below",
            textColor=color_white,
            gravity=Ui.CENTER,
            layout_weight=5,
        )

        buttonBox1 = self._buttonLayout(self.layout)
        self._valueButton(buttonBox1, 40, color_light)
        self._valueButton(buttonBox1, 70, color_deep)
        self._valueButton(buttonBox1, 100, color_light)
        self._valueButton(buttonBox1, 120, color_deep)

        buttonBox2 = self._buttonLayout(self.layout)
        self._valueButton(buttonBox2, 150, color_deep)
        self._valueButton(buttonBox2, 180, color_light)
        self._valueButton(buttonBox2, 200, color_deep)
        self._valueButton(buttonBox2, 250, color_light)

        buttonBox3 = self._buttonLayout(self.layout)
        self._valueButton(buttonBox3, 300, color_light)
        self._valueButton(buttonBox3, 350, color_deep)
        self._valueButton(buttonBox3, 400, color_light)
        self._valueButton(buttonBox3, 450, color_deep)