Skip to content

Commit

Permalink
fix some permission code
Browse files Browse the repository at this point in the history
  • Loading branch information
huzongyao committed Nov 16, 2019
1 parent e80d2f0 commit 4e1269b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package nostalgia.framework.base;

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
Expand All @@ -24,6 +23,7 @@
import android.widget.FrameLayout;
import android.widget.Toast;

import com.blankj.utilcode.constant.PermissionConstants;
import com.blankj.utilcode.util.PermissionUtils;

import java.io.File;
Expand Down Expand Up @@ -710,7 +710,7 @@ private void onGameBackToPast() {
}

private void saveScreenshotWithPermission() {
PermissionUtils.permission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
PermissionUtils.permission(PermissionConstants.STORAGE)
.callback(new PermissionUtils.SimpleCallback() {
@Override
public void onGranted() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ public void onDrawFrame(GL10 gl) {

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
Matrix.orthoM(projMatrix, 0, -width / 2, +width / 2,
-height / 2, +height / 2, -2f, 2f);
Matrix.orthoM(projMatrix, 0, -width / 2f, +width / 2f,
-height / 2f, +height / 2f, -2f, 2f);
screenWidth = width;
screenHeight = height;
GLES20.glViewport(0, 0, width, height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ public void onSurfaceChanged(GL10 unused, int width, int height) {
ViewPort vp = ViewUtils.loadOrComputeViewPort(context, emulator, width, height,
paddingLeft, paddingTop, false);
viewPort = vp;
Matrix.orthoM(projMatrix, 0, -vp.width / 2, +vp.width / 2, -vp.height / 2,
+vp.height / 2, -2f, 2f);
Matrix.orthoM(projMatrix, 0, -vp.width / 2f, +vp.width / 2f, -vp.height / 2f,
+vp.height / 2f, -2f, 2f);
int nvpy = (height - vp.y - vp.height);
GLES20.glViewport(vp.x, nvpy, vp.width, vp.height);
initQuadCoordinates(emulator, vp.width, vp.height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,9 @@ public static SlotInfo getSlot(String baseDir, String md5, int idx) {
bitmap.getConfig());
Canvas c = new Canvas(newScreenshot);
float[] matrix = new float[]{

0.299f, 0.587f, 0.114f, 0, 0,

0.299f, 0.587f, 0.114f, 0, 0,

0.299f, 0.587f, 0.114f, 0, 0,

0, 0, 0, 0.5f, 0
};
Paint paint = new Paint();
Expand Down

0 comments on commit 4e1269b

Please sign in to comment.