Exemplo n.º 1
0
 def _open_settings(self, try_connect):
     if try_connect:
         app = App.get_running_app()
         app.bind(on_resume=self._settings_callback)
         activity.startActivityForResult(
             Intent(Settings.ACTION_WIRELESS_SETTINGS), 0)
     else:
         self._callback(False)
 def _open_settings(self, try_connect):
     if try_connect:
         app = App.get_running_app()
         app.bind(on_resume=self._settings_callback)
         activity.startActivityForResult(
             Intent(Settings.ACTION_WIRELESS_SETTINGS), 0)
     else:
         self._callback(False)
Exemplo n.º 3
0
 def _take_picture(self, on_complete, filename=None):
     assert(on_complete is not None)
     self.on_complete = on_complete
     self.filename = filename
     android.activity.unbind(on_activity_result=self._on_activity_result)
     android.activity.bind(on_activity_result=self._on_activity_result)
     intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
     uri = Uri.parse('file://' + filename)
     parcelable = cast('android.os.Parcelable', uri)
     intent.putExtra(MediaStore.EXTRA_OUTPUT, parcelable)
     activity.startActivityForResult(intent, 0x123)
Exemplo n.º 4
0
 def _take_picture(self, on_complete, filename=None):
     assert(on_complete is not None)
     self.on_complete = on_complete
     self.filename = filename
     android.activity.unbind(on_activity_result=self._on_activity_result)
     android.activity.bind(on_activity_result=self._on_activity_result)
     intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
     uri = Uri.parse('file://' + filename)
     parcelable = cast('android.os.Parcelable', uri)
     intent.putExtra(MediaStore.EXTRA_OUTPUT, parcelable)
     activity.startActivityForResult(intent, 0x123)
Exemplo n.º 5
0
 def _take_video(self, on_complete, filename=None):
     assert(on_complete is not None)
     self.on_complete = on_complete
     self.filename = filename
     android.activity.unbind(on_activity_result=self._on_activity_result)
     android.activity.bind(on_activity_result=self._on_activity_result)
     intent = Intent(MediaStore.ACTION_VIDEO_CAPTURE)
     uri = Uri.parse('file://' + filename)
     parcelable = cast('android.os.Parcelable', uri)
     intent.putExtra(MediaStore.EXTRA_OUTPUT, parcelable)
     intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1) #0 = low quality, suitable for MMS messages, 1 = high quality
     #intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, X) #Optional, allows limiting record time to X seconds.
     activity.startActivityForResult(intent, 0x123)
Exemplo n.º 6
0
    def _take_video(self, on_complete, filename=None):
        assert(on_complete is not None)
        self.on_complete = on_complete
        self.filename = filename
        android.activity.unbind(on_activity_result=self._on_activity_result)
        android.activity.bind(on_activity_result=self._on_activity_result)
        intent = Intent(MediaStore.ACTION_VIDEO_CAPTURE)
        uri = Uri.parse('file://' + filename)
        parcelable = cast('android.os.Parcelable', uri)
        intent.putExtra(MediaStore.EXTRA_OUTPUT, parcelable)

        # 0 = low quality, suitable for MMS messages,
        # 1 = high quality
        intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1)
        activity.startActivityForResult(intent, 0x123)
Exemplo n.º 7
0
 def _take_picture(self, on_complete, filename=None):
     assert (on_complete is not None)
     self.on_complete = on_complete
     self.filename = filename
     android.activity.unbind(on_activity_result=self._on_activity_result)
     android.activity.bind(on_activity_result=self._on_activity_result)
     intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
     folder = File("/storage/emulated/0/", "rayyuan")
     if not folder.exists():
         folder.mkdirs()
     filename2 = str(int(datetime.now().timestamp())) + "AA.png"
     # f = File("/storage/emulated/0/rayyuan",
     #          filename2)
     # f.createNewFile()
     # mImageUri = Uri.fromFile(f)
     uri = Uri.parse(f"content://storage/emulated/0/rayyuan/{filename2}")
     # # imageUri = Uri.fromfile(f)
     # print(type(mImageUri))
     print(uri)
     parcelable = cast('android.os.Parcelable', uri)
     # intent.putExtra(MediaStore.EXTRA_OUTPUT, parcelable
     #                 )
     activity.startActivityForResult(intent, 0x123)