Our widget may not exist yet so we have to diverge from the normal 
        way of doing initialization. See `update_widget`
14890
def init_widget(self):
        
        if not self.widget:
            return
        super(AndroidSnackbar, self).init_widget()

        d = self.declaration

        #: Bind events
        self.widget.onClick.connect(self.on_click)

        #: Use the custom callback to listen to events
        callback = BridgedSnackbarCallback()
        callback.setListener(self.widget.getId())
        self.widget.onDismissed.connect(self.on_dismissed)
        self.widget.onShown.connect(self.on_shown)
        self.widget.addCallback(callback)


        #: if d.text: #: Set during creation
        #: self.set_duration(d.duration) #: Set during creation
        if d.action_text:
            self.set_action_text(d.action_text)
        if d.action_text_color:
            self.set_action_text_color(d.action_text_color)
        if d.show:
            self.set_show(d.show)
694273
public void updateButtonVisibilty(CmsInlineEntityWidget inlineWidget) {

        int minOccurrence = 0;
        int maxOccurrence = 0;
        if (isChoiceHandler()) {
            minOccurrence = 0;
            maxOccurrence = getEntityType().getChoiceMaxOccurrence();
        } else {
            minOccurrence = getEntityType().getAttributeMinOccurrence(m_attributeName);
            maxOccurrence = getEntityType().getAttributeMaxOccurrence(m_attributeName);
        }
        CmsEntityAttribute attribute = m_entity.getAttribute(m_attributeName);
        boolean mayHaveMore = (maxOccurrence > minOccurrence)
            && ((((attribute == null) && (!getAttributeType().isSimpleType() || (inlineWidget != null)))
                || ((attribute != null) && (attribute.getValueCount() < maxOccurrence))));
        boolean needsRemove = false;
        boolean needsSort = false;
        if ((isChoiceHandler() || !getEntityType().isChoice()) && m_entity.hasAttribute(m_attributeName)) {
            int valueCount = m_entity.getAttribute(m_attributeName).getValueCount();
            needsRemove = (maxOccurrence > minOccurrence) && (valueCount > minOccurrence);
            needsSort = !isSingleValueHandler() && (valueCount > 1);
        }
        if (inlineWidget != null) {
            boolean mayEdit = (attribute != null) && (attribute.getValueCount() > inlineWidget.getAttributeIndex());
            inlineWidget.updateButtonVisibility(mayEdit, mayHaveMore, needsRemove, needsSort);
        } else {
            for (CmsAttributeValueView value : m_attributeValueViews) {
                value.updateButtonVisibility(mayHaveMore, needsRemove, needsSort);
            }
        }
    }
476537
def init_widget(self):
        
        super(AndroidChronometer, self).init_widget()
        w = self.widget
        w.setOnChronometerTickListener(w.getId())
        w.onChronometerTick.connect(self.on_chronometer_tick)
297922
def create_button(self, widget):
        
        btn = QtGui.QToolButton(self)
        btn.setIconSize(QtCore.QSize(self._iconw, self._iconh))
        self.update_button(btn, widget)
        return btn
784849
def init_widget(self):
        
        super(AndroidRatingBar, self).init_widget()
        d = self.declaration
        self.set_rating(d.rating)
        w = self.widget
        w.setOnRatingBarChangeListener(w.getId())
        w.onRatingChanged.connect(self.on_rating_changed)
194927
def _call_widget_constructed(widget):
        """"""
        if Widget._widget_construction_callback is not None and callable(Widget._widget_construction_callback):
            Widget._widget_construction_callback(widget)
452893
def init_widget(self):
        
        w = self.window
        d = self.declaration
        self.set_background_color(d.background_color)
        self.set_touchable(d.touchable)
        self.set_outside_touchable(d.outside_touchable)

        # Listen for events
        w.setOnDismissListener(w.getId())
        w.onDismiss.connect(self.on_dismiss)
        super(AndroidPopupWindow, self).init_widget()
1137732
def refreshWidgets(self):
        
        if hasattr(self, '_widgets'):
            for w in self._widgets:
                w.refresh(isauto=0)
        else:
            raise RuntimeError("No widgets found")
459539
def delete_widget(self, index):
        
        widgets = self.widgets()
        if len(widgets) == 0:
            raise ValueError("This customization has no widgets")
        widgets.pop(index)
        self._save_customization(widgets)
46934
def init_widget(self):
        
        w = self.widget
        # Selection listener
        w.setAdapter(self.adapter)
        w.setOnItemSelectedListener(w.getId())
        w.onItemSelected.connect(self.on_item_selected)
        w.onNothingSelected.connect(self.on_nothing_selected)
        super(AndroidSpinner, self).init_widget()
449258
def init_widget(self):
        
        #: Add a ActivityLifecycleListener to update the application state
        activity = self.widget
        activity.addActivityLifecycleListener(activity.getId())
        activity.onActivityLifecycleChanged.connect(
            self.on_activity_lifecycle_changed)

        #: Add BackPressedListener to trigger the event
        activity.addBackPressedListener(activity.getId())
        activity.onBackPressed.connect(self.on_back_pressed)

        #: Add ConfigurationChangedListener to trigger the event
        activity.addConfigurationChangedListener(activity.getId())
        activity.onConfigurationChanged.connect(self.on_configuration_changed)
284497
def _set_main_widget(self, widget, redraw):
        
        self.set_body(widget)
        self.reload_footer()
        if redraw:
            logger.debug("redraw main widget")
            self.refresh()
224183
def init_widget(self):
        
        super(AndroidTextureView, self).__init__(self)
        w = self.widget
        w.setSurfaceTextureListener(w.getId())
        w.onSurfaceTextureAvailable.connect(self.on_surface_texture_available)
        w.onSurfaceTextureDestroyed.connect(self.on_surface_texture_destroyed)
        w.onSurfaceTextureChanged.connect(self.on_surface_texture_changed)
        w.onSurfaceTextureUpdated.connect(self.on_surface_texture_updated)
714173
def create_widget(self):
        
        d = self.declaration
        self.widget = RelativeLayout(self.get_context(), None, d.style)
437294
def add(self, *widgets):
        '''
        
        '''
        for w in widgets:
            if is_widget(w):
                if w not in self.widgets:
                    self.widgets.add(w)
                    w.add_internal(self)
            elif is_container(w):
                if w not in self.containers:
                    self.containers.add(w)
                    w.add_internal(self)
            else:
                # If it isn't an iterable, we'll get an error here.
                # Desired effect.
                self.add(*w)
1024922
def add(self, widget, *args, **kwargs):
        
        ins_widget = widget(*args, **kwargs)
        self.__iadd__(ins_widget)
        return ins_widget
656488
def init_widget(self):
        
        super(UiKitEditText, self).init_widget()

        #: Init font properties etc...
        self.init_text()

        d = self.declaration
        if d.placeholder:
            self.set_placeholder(d.placeholder)
        if d.input_type != 'text':
            self.set_input_type(d.input_type)
        if d.style:
            self.set_style(d.style)

        #: A really ugly way to add the target
        #: would be nice if we could just pass the block pointer here :)
        self.get_app().bridge.addTarget(
            self.widget,
            forControlEvents=UITextField.UIControlEventEditingChanged,
            andCallback=self.widget.getId(),
            usingMethod="onValueChanged",
            withValues=["text"]#,"selected"]
        )

        self.widget.onValueChanged.connect(self.on_value_changed)