Commit 7b88844e authored by Drahomír Karchňák's avatar Drahomír Karchňák

#633 Fixed delay when opening qr code reader for the first time on IOS. #641 Small fixes.

parent ff7ba373
......@@ -21,9 +21,6 @@ import com.badlogic.gdx.Gdx;
import cz.nic.tablexia.util.Log;
/**
* Created by drahomir on 10/5/16.
*/
public abstract class QRCodeScanner {
public enum CameraPermissionStatus {
Allowed(true, false),
......@@ -105,7 +102,7 @@ public abstract class QRCodeScanner {
} else {
Log.info(getClass(), "Scanning is not allowed, but permission change is not requested!");
}
return;
}
Log.info(getClass(), "Starting Camera Preview!");
......
......@@ -17,7 +17,8 @@
sourceSets.main.java.srcDirs = [ "src/" ]
sourceCompatibility = '1.7'
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
robovm {
......
......@@ -129,32 +129,29 @@ public class IOSQRCodeScanner extends QRCodeScanner {
@Override
protected void requestPermissionSettingChange() {
Log.info(getClass(), "Requesting permission change!");
//First request...
if(getCameraPermissionStatus() == CameraPermissionStatus.NotDetermined) {
Log.info(getClass(), "Requesting access for media type: " + AVMediaType.Video);
cameraDevice.requestAccessForMediaType(AVMediaType.Video, new VoidBooleanBlock() {
@Override
public void invoke(boolean result) {
public void invoke(final boolean result) {
if (result) {
cameraPermissionStatus = CameraPermissionStatus.Allowed;
Log.info(getClass(), "Starting camera preview again!");
startCameraPreview();
} else cameraPermissionStatus = CameraPermissionStatus.Denied;
//Camera has to be launched from main thread!
Gdx.app.postRunnable(() -> startCameraPreview());
}
else cameraPermissionStatus = CameraPermissionStatus.Denied;
}
});
}
else { //First permission request has been denied. Open our own dialog...
TablexiaComponentDialogFactory.getInstance().createPermissionDialog(
ApplicationTextManager.getInstance().getText(PERMISSION_MESSAGE_TEXT_KEY),
new Runnable() {
@Override
public void run() {
() -> {
//On success open settings url for this app
UIApplication.getSharedApplication().openURL(new NSURL(UIApplication.getOpenSettingsURLString()));
}
}
).show();
}
}
......@@ -209,7 +206,7 @@ public class IOSQRCodeScanner extends QRCodeScanner {
@Override
public void willAnimateRotation(UIInterfaceOrientation uiInterfaceOrientation, double v) {
//Unforunately this method is deprecated and there isnt binding in RoboVM for these replacements...
//Unfortunately this method is deprecated and there isn't binding in RoboVM for any of these replacements...
// - willTransitionToTraitCollection:withTransitionCoordinator:
// - viewWillTransitionToSize:withTransitionCoordinator:
super.willAnimateRotation(uiInterfaceOrientation, v);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment