Source code for enamlnative.android.android_progress_bar
"""
Copyright (c) 2017-2022, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 26, 2017
"""
from atom.api import Bool, Typed
from enamlnative.widgets.progress_bar import ProxyProgressBar
from .android_view import AndroidView, View
from .bridge import JavaMethod
class ProgressBar(View):
__nativeclass__ = "android.widget.ProgressBar"
__signature__ = [
"android.content.Context",
"android.util.AttributeSet",
"android.R",
]
setIndeterminate = JavaMethod(bool)
setMax = JavaMethod(int)
setMin = JavaMethod(int)
setProgress = JavaMethod(int) # , 'boolean')
setSecondaryProgress = JavaMethod(int)
STYLE_HORIZONTAL = "@attr/progressBarStyleHorizontal"
STYLE_INVERSE = "@attr/progressBarStyleInverse"
STYLE_LARGE = "@attr/progressBarStyleLarge"
STYLE_SMALL = "@attr/progressBarStyleSmall"
STYLE_NORMAL = "@attr/progressBarStyle"
STYLES = {
"normal": STYLE_NORMAL,
"small": STYLE_SMALL,
"large": STYLE_LARGE,
}
[docs]class AndroidProgressBar(AndroidView, ProxyProgressBar):
"""An Android implementation of an Enaml ProxyProgressBar.
For an indeterminate ProgressBar use the ActivityIndicator.
"""
#: A reference to the widget created by the proxy.
widget = Typed(ProgressBar)
#: Set to True to make the progress bar an activity indicator
indeterminate = Bool()
# -------------------------------------------------------------------------
# Initialization API
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# ProxyProgressBar API
# -------------------------------------------------------------------------
def set_progress(self, progress):
self.widget.setProgress(progress)
def set_indeterminate(self, indeterminate):
self.widget.setIndeterminate(indeterminate)
def set_secondary_progress(self, progress):
self.widget.setSecondaryProgress(progress)
def set_max(self, value):
self.widget.setMax(value)
def set_min(self, value):
self.widget.setMin(value)
[docs] def set_size(self, size):
"""Size cannot be changed dynamically."""
pass