Ejemplo n.º 1
0
 def take_picture(self):
     intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
     self.last_fn = self.get_filename()
     self.uri = Uri.parse('file://' + self.last_fn)
     self.uri = cast('android.os.Parcelable', self.uri)
     intent.putExtra(MediaStore.EXTRA_OUTPUT, self.uri)
     Activity.startActivityForResult(intent, 0x123)
Ejemplo n.º 2
0
 def onCreate(self):
     Activity.onCreate(self)
     self.setContentView(R.layout.SystemLauncher)
     view = self.findViewById(R.id.installed_applications)
     self.packages = packages = self.getAvailablePackages()
     view.setValue(packages)
     pass
Ejemplo n.º 3
0
 def turn_on(self):
     if not self.bluetooth_adapter.isEnabled():
         turn_on = Intent(Permissions.ACTION_REQUEST_ENABLE)
         Activity.startActivityForResult(turn_on, 0)
         Logger.info('[ Android ] Bluetooth turned on')
     else:
         Logger.info('[ Android ] Bluetooth already turned on')
Ejemplo n.º 4
0
 def onCreate(self):
     Activity.onCreate(self)
     self.setContentView(R.layout.datosIntradia)
     anIntent = self.getIntent()
     self.extras = anIntent.getExtras()
     lstwdg = self.findViewById(R.id.intradiatable)
     lstwdg.setValue(self.extras['datosMnemo'])
Ejemplo n.º 5
0
 def onCreate(self):
     Activity.onCreate(self)
     self.setContentView(R.layout.DatosEod)
     anIntent = self.getIntent()
     self.extras = anIntent.getExtras()
     lstwdg = self.findViewById(R.id.eodtable)
     lstwdg.tree.bind('<<TreeviewSelect>>', self.onTreeSel)
     lstwdg.setValue(self.extras['datosEOD'])
Ejemplo n.º 6
0
 def _open_settings(self, try_connect):
     if try_connect:
         app = self.app.get_running_app()
         app.bind(on_resume=self._settings_callback)
         Activity.startActivityForResult(
             Intent(Permissions.ACTION_WIRELESS_SETTINGS), 0)
     else:
         self._callback(False)
Ejemplo n.º 7
0
    def onCreate(self):
        Activity.onCreate(self)
        self.dummy = None
        self.bilboard = tk.StringVar()
        self.datosEOD = None
        self.datosIntradia = None
        self.datosIndices = None
        self.dateProcess = None
        thManager = threadManager(guiOwner=self.frame, numWorkers=3)
        self.thManager = thManager

        self.setContentView(R.layout.MainActivity)
Ejemplo n.º 8
0
    def connection_available():
        cm = Activity.getSystemService(Context.CONNECTIVITY_SERVICE)
        if cm is None:
            return False

        info = cm.getActiveNetworkInfo()
        if info is not None:
            connected = info.isConnectedOrConnecting()
            Logger.debug('Connected or connecting: {}'.format(connected))
        return connected
Ejemplo n.º 9
0
    def check_native_requirements(self):
        """
        checks whether the required packages are available on the android version

        """
        if not Android:
            return
        pm = Activity.getPackageManager()
        self.stt_mods = pm.queryIntentActivities(
            Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0)
        if self.stt_mods.size() == 0:
            Logger.warning("Android Speech to Text packages not found")
Ejemplo n.º 10
0
    def send(**kwargs):
        intent = Intent(Intent.ACTION_SEND)
        intent.setType('text/plain')

        recipient = kwargs.get('recipient')
        subject = kwargs.get('subject')
        text = kwargs.get('text')
        create_chooser = kwargs.get('create_chooser')

        if recipient:
            intent.putExtra(Intent.EXTRA_EMAIL, [recipient])
        if subject:
            android_subject = cast('java.lang.CharSequence', String(subject))
            intent.putExtra(Intent.EXTRA_SUBJECT, android_subject)
        if text:
            android_text = cast('java.lang.CharSequence', String(text))
            intent.putExtra(Intent.EXTRA_TEXT, android_text)

        if create_chooser:
            chooser_title = cast('java.lang.CharSequence',
                                 String('Send message with:'))
            Activity.startActivity(Intent.createChooser(intent, chooser_title))
        else:
            Activity.startActivity(intent)
Ejemplo n.º 11
0
 def onCreate(self):
     Activity.onCreate(self)
     self.setContentView(R.layout.basicWidets)
     pass
Ejemplo n.º 12
0
 def _get_notification_service(self):
     if not hasattr(self, '_ns'):
         self._ns = Activity.getSystemService(Context.NOTIFICATION_SERVICE)
     return self._ns
Ejemplo n.º 13
0
from jnius import autoclass
from Android import Activity, SDK_VERSION

AndroidString = autoclass('java.lang.String')
Context = autoclass('android.content.Context')
NotificationBuilder = autoclass('android.app.Notification$Builder')
Drawable = autoclass("{}.R$drawable".format(Activity.getPackageName()))


class AndroidNotification(object):
    def _get_notification_service(self):
        if not hasattr(self, '_ns'):
            self._ns = Activity.getSystemService(Context.NOTIFICATION_SERVICE)
        return self._ns

    def _notify(self, **kwargs):
        icon = getattr(Drawable, kwargs.get('icon_android', 'icon'))
        noti = NotificationBuilder(Activity)
        noti.setContentTitle(AndroidString(
            kwargs.get('title').encode('utf-8')))
        noti.setContentText(
            AndroidString(kwargs.get('message').encode('utf-8')))
        noti.setTicker(AndroidString(str('New Message Alert').encode('utf-8')))
        noti.setSmallIcon(icon)
        noti.setAutoCancel(True)

        if SDK_VERSION >= 16:
            noti = noti.build()
        else:
            noti = noti.getNotification()
Ejemplo n.º 14
0
 def onCreateOptionsMenu(self, menuframe):
     Activity.onCreateOptionsMenu(self, menuframe)
     inflater = self.getMenuInflater()
     inflater.inflate(R.menu.file, menuframe)
     return True
Ejemplo n.º 15
0
 def onCreate(self):
     Activity.onCreate(self)
     self.frame.config(width=500, height=700)
     self.frame.pack_propagate(0)
     self.setContentView(R.layout.BasicViewsShowcase)
     pass
Ejemplo n.º 16
0
 def __init__(self):
     args = [Phone.CONTENT_URI, None, None, None, None]
     self.contacts = Activity.getContentResolver().query(*args)
     self.contacts_list = {}
     self.generate_list()
Ejemplo n.º 17
0
 def onCreate(self):
     Activity.onCreate(self)
     self.setContentView(R.layout.fragment_layout)
     pass
Ejemplo n.º 18
0
 def intent(action):
     _intent = Intent(action)
     Activity.startActivityForResult(_intent, 0)