mirror of
https://github.com/astromaddie/lambda1-vr.git
synced 2026-10-21 13:00:14 +02:00
few minor fixes
- permissions bug - updated gradle configuration - fix missing mouse cursor
This commit is contained in:
1 parent
3819a63344
commit
482bd03fd1
10 files changed
+170
-109
No files matched your search
@@ -58,7 +58,8 @@ import static android.system.Os.setenv;
|
||||
|
||||
private static final String TAG = "Lambda1VR";
|
||||
|
||||
private int permissionCount = 0;
|
||||
private boolean permissionsGranted = false;
|
||||
|
||||
private static final int READ_EXTERNAL_STORAGE_PERMISSION_ID = 1;
|
||||
private static final int WRITE_EXTERNAL_STORAGE_PERMISSION_ID = 2;
|
||||
|
||||
@@ -82,17 +83,6 @@ import static android.system.Os.setenv;
|
||||
setContentView( mView );
|
||||
mView.getHolder().addCallback( this );
|
||||
|
||||
// Force the screen to stay on, rather than letting it dim and shut off
|
||||
// while the user is watching a movie.
|
||||
getWindow().addFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON );
|
||||
|
||||
// Force screen brightness to stay at maximum
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.screenBrightness = 1.0f;
|
||||
getWindow().setAttributes( params );
|
||||
|
||||
|
||||
|
||||
checkPermissionsAndInitialize();
|
||||
}
|
||||
|
||||
@@ -105,15 +95,8 @@ import static android.system.Os.setenv;
|
||||
GLES3JNIActivity.this,
|
||||
new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
WRITE_EXTERNAL_STORAGE_PERMISSION_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
permissionCount++;
|
||||
}
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
!= PackageManager.PERMISSION_GRANTED)
|
||||
{
|
||||
} else if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
!= PackageManager.PERMISSION_GRANTED){
|
||||
ActivityCompat.requestPermissions(
|
||||
GLES3JNIActivity.this,
|
||||
new String[] {Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||
@@ -121,10 +104,10 @@ import static android.system.Os.setenv;
|
||||
}
|
||||
else
|
||||
{
|
||||
permissionCount++;
|
||||
permissionsGranted = true;
|
||||
}
|
||||
|
||||
if (permissionCount == 2) {
|
||||
if (permissionsGranted) {
|
||||
// Permissions have already been granted.
|
||||
create();
|
||||
}
|
||||
@@ -134,21 +117,13 @@ import static android.system.Os.setenv;
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] results) {
|
||||
if (requestCode == READ_EXTERNAL_STORAGE_PERMISSION_ID) {
|
||||
if (results.length > 0 && results[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
permissionCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (results.length > 0 && results[0] != PackageManager.PERMISSION_GRANTED) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (requestCode == WRITE_EXTERNAL_STORAGE_PERMISSION_ID) {
|
||||
if (results.length > 0 && results[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
permissionCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (results.length > 0 && results[0] != PackageManager.PERMISSION_GRANTED) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user