Exemplo n.º 1
0
    def onCreate(self):
        # Building the UI
        vlayout = LinearLayout(self.activity)
        vlayout.setOrientation(LinearLayout.VERTICAL)

        # Top clock
        top_vlayout = LinearLayout(self.activity)

        self.top_clock = TextView(self.activity)
        self.top_clock.setTextSize(50)

        self.top_delay = TextView(self.activity)
        self.top_delay.setTextSize(15)

        top_vlayout.setOnClickListener(ButtonClick(self.top_player_touched))
        top_vlayout.addView(self.top_clock)
        top_vlayout.addView(self.top_delay)
        vlayout.addView(top_vlayout)

        # Button row
        button_layout = LinearLayout(self.activity)
        button_layout.setOrientation(LinearLayout.HORIZONTAL)
        vlayout.addView(button_layout)

        self.pause_button = Button(self.activity)
        self.pause_button.setText('Pause')
        self.pause_button.setOnClickListener(
            ButtonClick(self.pause_or_resume_clicked))
        button_layout.addView(self.pause_button)

        self.restart_button = Button(self.activity)
        self.restart_button.setText('Restart')
        self.restart_button.setOnClickListener(
            ButtonClick(self.restart_clicked))
        button_layout.addView(self.restart_button)

        # Bottom clock
        bot_vlayout = LinearLayout(self.activity)

        self.bot_clock = TextView(self.activity)
        self.bot_clock.setTextSize(50)

        self.bot_delay = TextView(self.activity)
        self.bot_delay.setTextSize(15)

        bot_vlayout.setOnClickListener(ButtonClick(self.bottom_player_touched))
        bot_vlayout.addView(self.bot_clock)
        bot_vlayout.addView(self.bot_delay)
        vlayout.addView(bot_vlayout)

        self.activity.setContentView(vlayout)

        # Clock should be create after setContentView
        self.clock = CounterupTimer(self)
        self.clock.set_timers((0, 0), None)
Exemplo n.º 2
0
    def create_sale_view(self):
        self.vlayout.removeAllViews()

        self.sale_person = EditText(self._activity)
        self.sale_person.setHint('Client')
        self.vlayout.addView(self.sale_person)

        horizontalProducts = LinearLayout(self._activity)
        horizontalProducts.setOrientation(LinearLayout.HORIZONTAL)

        productsText = TextView(self._activity)
        productsText.setText('See products || quantity || value: ')
        horizontalProducts.addView(productsText)

        productSpinner = Spinner(self._activity)
        RawProducts = list(self.db.fetch_products())
        products = [(product['name'] + ' || ' + str(product['quantity']) +
                     ' || ' + str(product['value']))
                    for product in RawProducts]
        ProductsAdapter = ArrayAdapter(self._activity, 0x01090008, products)
        ProductsAdapter.setDropDownViewResource(0x01090009)
        productSpinner.setAdapter(ProductsAdapter)
        horizontalProducts.addView(productSpinner)

        self.sale_description = EditText(self._activity)
        self.sale_description.setHint('product:quantity')
        self.vlayout.addView(self.sale_description)

        self.sale_value = EditText(self._activity)
        self.sale_value.setInputType(0x00000002 | 0x00002000)
        self.sale_value.setHint('Value')
        self.vlayout.addView(self.sale_value)

        hlayout = LinearLayout(self._activity)

        text = TextView(self._activity)
        text.setText('Paid')
        text.setTextSize(22)
        hlayout.addView(text)
        self.sale_paid = CheckBox(self._activity)
        hlayout.addView(self.sale_paid)
        self.vlayout.addView(hlayout)

        generate_price_button = Button(self._activity)
        generate_price_button.setOnClickListener(
            ButtonClick(self.generate_price))
        generate_price_button.setText('Generate price')
        self.vlayout.addView(generate_price_button)

        create_button = Button(self._activity)
        create_button.setText('Sale')
        self.vlayout.addView(create_button)

        self.add_error_text()
        self.add_return_button('main', flayout=False)
Exemplo n.º 3
0
    def onCreate(self):
        def create_button_row():
            return [
                Button(self._activity),
                Button(self._activity),
                Button(self._activity),
            ]

        self.buttons = [
            create_button_row(),
            create_button_row(),
            create_button_row(),
        ]

        vlayout = LinearLayout(self._activity)
        vlayout.setOrientation(LinearLayout.VERTICAL)

        self.top_label = TextView(self._activity)
        self.top_label.setTextSize(50)
        vlayout.addView(self.top_label)

        for row in self.buttons:
            hlayout = LinearLayout(self._activity)
            hlayout.setOrientation(LinearLayout.HORIZONTAL)
            hlayout.setGravity(Gravity.CENTER)
            for button in row:
                button.setTextSize(50)
                hlayout.addView(button)

            vlayout.addView(hlayout)

        for i in range(3):
            for j in range(3):
                self.buttons[i][j].setOnClickListener(
                    ButtonClick(self.play, i, j))

        self.restart_button = Button(self._activity)
        self.restart_button.setText('Restart')
        self.restart_button.setOnClickListener(ButtonClick(self.restart_game))
        vlayout.addView(self.restart_button)

        footer = TextView(self._activity)
        footer.setText('Powered by Python')
        footer.setGravity(Gravity.CENTER)
        vlayout.addView(footer)

        self.updateUI()

        self._activity.setContentView(vlayout)
Exemplo n.º 4
0
    def main_view(self):
        self.vlayout.removeAllViews()
        self.flayout.removeAllViews()

        create_sale = Button(self._activity)
        create_sale.setText('Create sale')
        create_sale.setOnClickListener(ButtonClick(self.create_sale_view))
        self.vlayout.addView(create_sale)

        create_product = Button(self._activity)
        create_product.setText('Create product')
        create_product.setOnClickListener(ButtonClick(
            self.create_product_view))
        self.vlayout.addView(create_product)

        sales_view = Button(self._activity)
        sales_view.setText('View sales')
        sales_view.setOnClickListener(ButtonClick(self.sales_view))
        self.vlayout.addView(sales_view)

        products_view = Button(self._activity)
        products_view.setText('View products')
        products_view.setOnClickListener(ButtonClick(self.products_view))
        self.vlayout.addView(products_view)

        clients_view = Button(self._activity)
        clients_view.setText('View clients')
        clients_view.setOnClickListener(ButtonClick(self.clients_view))
        self.vlayout.addView(clients_view)

        hlayout = LinearLayout(self._activity)
        hlayout.setOrientation(LinearLayout.HORIZONTAL)
        relative_bottom = RelativeLayout(self._activity)
        relative_right = RelativeLayout(self._activity)

        received, to_receive = self.get_balance()
        received_view = TextView(self._activity)
        received_view.setText('Received %.2f' % (float(received)))
        received_view.setTextSize(18)
        to_receive_view = TextView(self._activity)
        to_receive_view.setText('To receive %.2f' % (float(to_receive)))
        to_receive_view.setTextSize(18)

        relative_right.addView(to_receive_view, _create_layout_params('right'))
        hlayout.addView(received_view)
        hlayout.addView(relative_right)
        relative_bottom.addView(hlayout, _create_layout_params('bottom'))
        self.vlayout.addView(relative_bottom)
Exemplo n.º 5
0
    def onCreate(self):
        sentence_lines = iter(sentence_text.splitlines())
        all_sentence_pairs = list(zip(sentence_lines, sentence_lines))
        self.sentence_pairs = []
        while len(self.sentence_pairs) < 10 and all_sentence_pairs:
            # noinspection PyUnresolvedReferences
            i = self.random.nextInt(len(all_sentence_pairs))
            sentence_pair = all_sentence_pairs.pop(i)
            if len(sentence_pair[0]) <= 9:
                self.sentence_pairs.append(sentence_pair)

        self.players = [
            Player(self._activity, is_inverted, self.on_solved)
            for is_inverted in (True, False)
        ]
        self.player_progress = {player: 0 for player in self.players}
        vlayout = LinearLayout(self._activity)
        vlayout.setOrientation(LinearLayout.VERTICAL)

        for i, player in enumerate(self.players):
            if i:
                self.winner_label = TextView(self._activity)
                self.winner_label.setTextSize(50)
                # noinspection PyUnresolvedReferences
                self.winner_label.setLayoutParams(
                    LinearLayout.LayoutParams(
                        LinearLayout.LayoutParams.MATCH_PARENT,
                        LinearLayout.LayoutParams.MATCH_PARENT, 1))
                vlayout.addView(self.winner_label)
            player.opponent = self.players[(i + 1) % 2]
            player.on_create(vlayout)
            self.set_sentence(player)

        self._activity.setContentView(vlayout)
Exemplo n.º 6
0
    def __init__(self, product, context, callback=None):
        self.product = product
        self.context = context
        self.callback = callback

        self.layout = LinearLayout(self.context)
        self.text_view = TextView(self.context)
        self.text_view.setTextSize(20)
        self.text_view.setText('%s | %d | R$%.2f' %
                               (self.product['name'], self.product['quantity'],
                                self.product['value']))
        self.layout.addView(self.text_view)

        hbuttons = LinearLayout(self.context)
        hbuttons.setOrientation(LinearLayout.HORIZONTAL)

        self.add_button = Button(self.context)
        self.add_button.setOnClickListener(ButtonClick(self.add))
        self.add_button.getBackground().setColorFilter(
            0xff8bc34a, PorterDuff.Mode.MULTIPLY)
        self.add_button.setText('+')
        hbuttons.addView(self.add_button)

        self.remove_button = Button(self.context)
        self.remove_button.setOnClickListener(ButtonClick(self.remove))
        self.remove_button.getBackground().setColorFilter(
            0xffff0000, PorterDuff.Mode.MULTIPLY)
        self.remove_button.setText('-')
        hbuttons.addView(self.remove_button)

        relative = RelativeLayout(self.context)
        relative.addView(hbuttons, _create_layout_params('right'))

        self.layout.addView(relative)
Exemplo n.º 7
0
    def onCreate(self):
        vlayout = LinearLayout(self._activity)
        vlayout.setOrientation(LinearLayout.VERTICAL)

        self.entry = EditText(self._activity)
        self.entry.setInputType(0x00000002 | 0x00002000 | 0x00001000)
        # set input class and flags
        # see https://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType
        self.entry.setGravity(Gravity.CENTER)
        vlayout.addView(self.entry)

        hlayout = LinearLayout(self._activity)
        hlayout.setOrientation(LinearLayout.HORIZONTAL)
        hlayout.setGravity(Gravity.CENTER)

        self.convert_to_fahrenheit = Button(self._activity)
        self.convert_to_fahrenheit.setOnClickListener(ButtonClick(self.to_fahrenheit))
        self.convert_to_fahrenheit.setText('To Fahrenheit')
        hlayout.addView(self.convert_to_fahrenheit)

        self.convert_to_celsius = Button(self._activity)
        self.convert_to_celsius.setOnClickListener(ButtonClick(self.to_celsius))
        self.convert_to_celsius.setText('To Celsius')
        hlayout.addView(self.convert_to_celsius)

        vlayout.addView(hlayout)

        self.result = TextView(self._activity)
        self.result.setTextSize(26)
        self.result.setText('Convert units')
        self.result.setGravity(Gravity.CENTER)
        vlayout.addView(self.result)

        self._activity.setContentView(vlayout)
Exemplo n.º 8
0
    def onCreate(self):
        label = TextView(self._activity)
        label.setTextSize(50)
        label.setText('Hello World')

        vlayout = LinearLayout(self._activity)
        vlayout.setOrientation(LinearLayout.VERTICAL)
        vlayout.addView(label)

        self._activity.setContentView(vlayout)
Exemplo n.º 9
0
    def getView(self, position, convertView, parent):

        # If convertView is not None then reuse it.
        if convertView != None:
            return convertView

        view = TextView(parent.getContext())
        view.setText(self.items[position])
        view.setTextSize(view.getTextSize() * 1.25)
        return view
Exemplo n.º 10
0
    def on_create(self, parent_layout):
        vlayout = LinearLayout(self.activity)
        vlayout.setOrientation(LinearLayout.VERTICAL)
        vlayout.setGravity(Gravity.BOTTOM)
        if self.is_inverted:
            vlayout.setRotation(180)
        parent_layout.addView(vlayout)

        self.top_layout = LinearLayout(self.activity)
        self.top_layout.setOrientation(LinearLayout.HORIZONTAL)
        self.top_label = TextView(self.activity)
        # noinspection PyUnresolvedReferences
        self.top_label.setLayoutParams(
            LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                                      LinearLayout.LayoutParams.MATCH_PARENT,
                                      1))
        self.top_label.setTextSize(50)
        self.top_layout.addView(self.top_label)
        self.next_button = Button(self.activity)
        # noinspection PyUnresolvedReferences
        self.next_button.setLayoutParams(
            LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                                      LinearLayout.LayoutParams.MATCH_PARENT,
                                      0))
        self.next_button.setText('Hint')
        self.next_button.setOnClickListener(ButtonClick(self.next))
        self.top_layout.addView(self.next_button)
        vlayout.addView(self.top_layout)

        self.solution_layout = LinearLayout(self.activity)
        self.solution_layout.setOrientation(LinearLayout.HORIZONTAL)
        self.solution_layout.setGravity(Gravity.LEFT)
        self.solution_label = TextView(self.activity)
        self.solution_label.setText('')
        self.solution_label.setTextSize(50)
        self.solution_layout.addView(self.solution_label)
        vlayout.addView(self.solution_layout)

        self.shelf_layout = LinearLayout(self.activity)
        self.shelf_layout.setOrientation(LinearLayout.HORIZONTAL)
        self.shelf_layout.setGravity(Gravity.CENTER)
        vlayout.addView(self.shelf_layout)
Exemplo n.º 11
0
    def details_sale_view(self, sale, back=None):
        self.vlayout.removeAllViews()

        person_text = TextView(self._activity)
        person_text.setText('Client: %s' % (sale['person']))
        person_text.setTextSize(22)
        self.vlayout.addView(person_text)

        value_text = TextView(self._activity)
        value_text.setText('\nValue: R$%.2f' % (sale['value']))
        value_text.setTextSize(22)
        self.vlayout.addView(value_text)

        discount_text = TextView(self._activity)
        total_price = self.db.get_price(sale['description'].replace(' ', '\n'))
        discount = total_price - sale['value']
        discount_p = discount * 100.0 / sale['value']
        discount_text.setText('\nDiscount: %.2f%% = R$%.2f' %
                              (discount_p, discount))
        discount_text.setTextSize(22)
        self.vlayout.addView(discount_text)

        description_text = TextView(self._activity)
        description_text.setText('\nDescription: %s' % (sale['description']))
        description_text.setTextSize(22)
        self.vlayout.addView(description_text)

        date_text = TextView(self._activity)
        date = sale['date'].replace(' ', '-')
        date_text.setText('\nDate: %s' % (date))
        date_text.setTextSize(22)
        self.vlayout.addView(date_text)

        if back:
            self.add_return_button('sales_client',
                                   value=sale['person'],
                                   flayout=False)
        else:
            self.add_return_button('sales_view', flayout=False)
Exemplo n.º 12
0
    def onCreate(self):
        self.label = TextView(self._activity)
        self.label.setTextSize(50)
        self.label.setText(self.message)

        vlayout = LinearLayout(self._activity)
        vlayout.setOrientation(LinearLayout.VERTICAL)
        vlayout.addView(self.label)

        self.switch_button = Button(self._activity)
        self.switch_button.setText(self.message_button)
        self.switch_button.setOnClickListener(ButtonClick(self.update))

        vlayout.addView(self.switch_button)

        self._activity.setContentView(vlayout)
Exemplo n.º 13
0
    def onCreate(self):
        self.vlayout = LinearLayout(self._activity)
        self.vlayout.setOrientation(LinearLayout.VERTICAL)

        self.entrytext = EditText(self._activity)
        self.entrytext.setHint('Write a url to request')
        self.vlayout.addView(self.entrytext)

        button_send = Button(self._activity)
        button_send.setText('Request GET')
        button_send.setOnClickListener(OnClick(self.send_request))
        self.vlayout.addView(button_send)

        self.result = TextView(self._activity)
        self.result.setText('Waiting a request')
        self.vlayout.addView(self.result)

        self._activity.setContentView(self.vlayout)
Exemplo n.º 14
0
    def __init__(self, client, context, callback=None):
        self.client = client
        self.callback = callback
        self.context = context
        self.layout = LinearLayout(self.context)

        self.text_view = TextView(self.context)
        self.text_view.setText(self.client)
        self.text_view.setTextSize(22)
        self.layout.addView(self.text_view)

        self.add_button = Button(self.context)
        self.add_button.setOnClickListener(ButtonClick(self.view_sales))
        self.add_button.getBackground().setColorFilter(
            0xff9e9e9e, PorterDuff.Mode.MULTIPLY)
        self.add_button.setText('+')
        relative = RelativeLayout(self.context)
        relative.addView(self.add_button, _create_layout_params('right'))
        self.layout.addView(relative)
Exemplo n.º 15
0
    def onCreate(self):
        self.vlayout = LinearLayout(self._activity)
        self.vlayout.setOrientation(LinearLayout.VERTICAL)

        self.textbox = EditText(self._activity)
        self.vlayout.addView(self.textbox)

        self.update_text_button = Button(self._activity)
        self.update_text_button.setText('update text')
        self.update_text_button.setOnClickListener(
            ButtonClick(self.update_text))
        self.vlayout.addView(self.update_text_button)

        self.text_result = TextView(self._activity)
        self.text_result.setText('test')
        self.vlayout.addView(self.text_result)

        self.change_view_button = Button(self._activity)
        self.change_view_button.setText('change view')
        self.change_view_button.setOnClickListener(
            ButtonClick(self.change_view))
        self.vlayout.addView(self.change_view_button)

        self._activity.setContentView(self.vlayout)
Exemplo n.º 16
0
    def getView(self, position, convertView, parent):

        context = parent.getContext()

        layout = LinearLayout(context)
        layout.setOrientation(LinearLayout.VERTICAL)

        imageView = ImageView(context)

        if self.cache.containsKey(position):
            entry = self.cache[position]
            name = entry.name
            bitmap = entry.bitmap
            imageView.setImageBitmap(bitmap)

            if len(self.positions) > self.cache_size:
                self.cache.remove(self.positions.remove())

        else:
            # Create a placeholder bitmap to put into the view.
            bitmap = SpriteRenderer.emptyBitmap(self.preview_size,
                                                self.preview_size, False)
            imageView.setImageBitmap(bitmap)

            # Schedule the rendering process.
            name = self.items[position]
            self.scheduleRender(WorkItem(position, imageView))

        textView = TextView(context)
        textView.setText(name)
        textView.setGravity(0x01)  # center_horizontal

        layout.addView(imageView)
        layout.addView(textView)

        return layout
Exemplo n.º 17
0
    def addForecasts(self, forecasts):

        self.forecastLayout.removeAllViews()
        self.scrollView.scrollTo(0, 0)

        if len(forecasts) == 0:
            return

        self.placeLabel.setText(forecasts[0].place)
        self.creditLabel.setText(forecasts[0].credit)

        firstDate = forecasts[0].from_
        calendar = Calendar.getInstance()
        calendar.setTime(firstDate)

        currentDay = calendar.get(Calendar.DAY_OF_MONTH)

        context = self.getContext()

        for forecast in forecasts:

            #             Date
            # Temperature Symbol Description
            #                    Wind

            # Get the day of the month.
            date = forecast.from_
            calendar.setTime(date)
            day = calendar.get(Calendar.DAY_OF_MONTH)

            # Add an item for the date for the first item and any item
            # following a day change.
            if date == firstDate or day != currentDay:
                dateView = TextView(context)
                dateView.setText(
                    calendar.getDisplayName(Calendar.DAY_OF_WEEK,
                        Calendar.LONG, Locale.getDefault()) + " " + \
                    str(day) + " " + \
                    calendar.getDisplayName(Calendar.MONTH,
                        Calendar.LONG, Locale.getDefault()) + " " + \
                    str(calendar.get(Calendar.YEAR)))

                dateView.setGravity(Gravity.CENTER)
                dateView.setTypeface(Typeface.create(None, Typeface.BOLD))
                dateView.setBackgroundColor(self.lightBackground)
                dateView.setTextColor(0xff000000)

                self.forecastLayout.addView(dateView, self.rowLayout())

            currentDay = day

            # Time
            timeString = String.format(
                "%02d:%02d:%02d - ",
                array([
                    calendar.get(Calendar.HOUR_OF_DAY),
                    calendar.get(Calendar.MINUTE),
                    calendar.get(Calendar.SECOND)
                ]))

            date = forecast.to_
            calendar.setTime(date)

            timeString += String.format(
                "%02d:%02d:%02d",
                array([
                    calendar.get(Calendar.HOUR_OF_DAY),
                    calendar.get(Calendar.MINUTE),
                    calendar.get(Calendar.SECOND)
                ]))

            timeView = TextView(context)
            timeView.setText(timeString)

            timeView.setGravity(Gravity.CENTER)
            timeView.setTypeface(Typeface.create(None, Typeface.BOLD))

            self.forecastLayout.addView(timeView, self.rowLayout())

            # Symbol, temperature, description and wind
            row = RelativeLayout(context)

            # Symbol
            lp = self.itemLayout()
            lp.addRule(RelativeLayout.CENTER_IN_PARENT)

            if forecast.symbol != -1:
                imageView = ImageView(context)
                imageView.setImageResource(forecast.symbol)
                row.addView(imageView, lp)
            else:
                spacer = Space(context)
                row.addView(spacer, lp)

            # Temperature
            tempView = TextView(context)
            tempView.setTextSize(tempView.getTextSize() * 2)

            if forecast.temperatureUnit == "celsius":
                tempView.setText(forecast.temperature + u"\u2103")
            else:
                tempView.setText(forecast.temperature + " " +
                                 forecast.temperatureUnit)

            lp = self.itemLayout()
            lp.addRule(RelativeLayout.CENTER_VERTICAL)
            lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT)
            row.addView(tempView, lp)

            # Description and wind speed
            descLayout = LinearLayout(context)
            descLayout.setOrientation(LinearLayout.VERTICAL)

            descView = TextView(context)
            descView.setText(forecast.description)
            descLayout.addView(descView, lp)

            windView = TextView(context)
            windView.setText(forecast.windSpeed)
            descLayout.addView(windView, lp)

            lp = self.itemLayout()
            lp.addRule(RelativeLayout.CENTER_VERTICAL)
            lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT)
            row.addView(descLayout, lp)

            self.forecastLayout.addView(row, self.rowLayout())
Exemplo n.º 18
0
    def __init__(self, context):

        RelativeLayout.__init__(self, context)

        # This getColor call deprecated in API level 23.
        self.lightBackground = context.getResources().getColor(
            android.R.color.background_light)
        self.darkText = 0xff000000

        # Header
        header = LinearLayout(context)
        header.setOrientation(LinearLayout.VERTICAL)
        header.setId(1)

        self.placeLabel = TextView(context)
        self.placeLabel.setTextSize(self.placeLabel.getTextSize() * 1.5)
        self.placeLabel.setGravity(Gravity.CENTER)

        headerLine = View(context)
        headerLine.setBackgroundColor(self.lightBackground)
        headerLineParams = LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, 1)  # 1 pixel in height

        header.addView(self.placeLabel)
        header.addView(headerLine, headerLineParams)

        # Middle - containing the forecast layout
        self.scrollView = ScrollView(context)
        self.scrollView.setId(2)

        # Footer
        footer = LinearLayout(context)
        footer.setOrientation(LinearLayout.VERTICAL)
        footer.setId(3)

        footerLine = View(context)
        footerLine.setBackgroundColor(self.lightBackground)
        footerLineParams = LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, 1)  # 1 pixel in height

        self.creditLabel = TextView(context)

        footer.addView(footerLine, footerLineParams)
        footer.addView(self.creditLabel)

        # The forecast layout
        self.forecastLayout = LinearLayout(context)
        self.forecastLayout.setOrientation(LinearLayout.VERTICAL)
        self.scrollView.addView(self.forecastLayout)

        # Layout parameters
        headerParams = RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT)
        headerParams.addRule(RelativeLayout.ALIGN_PARENT_TOP)
        headerParams.addRule(RelativeLayout.CENTER_HORIZONTAL)

        scrollParams = RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT)
        scrollParams.addRule(RelativeLayout.CENTER_HORIZONTAL)
        scrollParams.addRule(RelativeLayout.BELOW, 1)
        scrollParams.addRule(RelativeLayout.ABOVE, 3)

        footerParams = RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT)
        footerParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM)

        self.addView(header, headerParams)
        self.addView(self.scrollView, scrollParams)
        self.addView(footer, footerParams)
Exemplo n.º 19
0
 def add_error_text(self):
     self.error_text = TextView(self._activity)
     self.vlayout.addView(self.error_text)