|
|
|
@ -55,8 +55,8 @@ import android.os.HandlerThread;
|
|
|
|
|
import android.os.Looper;
|
|
|
|
|
import android.os.Message;
|
|
|
|
|
import android.os.SystemClock;
|
|
|
|
|
import android.support.v13.app.FragmentCompat;
|
|
|
|
|
import android.support.v4.app.ActivityCompat;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.util.Size;
|
|
|
|
|
import android.util.SparseIntArray;
|
|
|
|
@ -119,7 +119,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
* </ul>
|
|
|
|
|
*/
|
|
|
|
|
public class Camera2RawFragment extends Fragment
|
|
|
|
|
implements View.OnClickListener, FragmentCompat.OnRequestPermissionsResultCallback {
|
|
|
|
|
implements View.OnClickListener {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Conversion from screen rotation to JPEG orientation.
|
|
|
|
@ -609,7 +609,7 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
@Override
|
|
|
|
|
public void onViewCreated(final View view, Bundle savedInstanceState) {
|
|
|
|
|
view.findViewById(R.id.picture).setOnClickListener(this);
|
|
|
|
|
view.findViewById(R.id.info).setOnClickListener(this);
|
|
|
|
|
// view.findViewById(R.id.info).setOnClickListener(this);
|
|
|
|
|
mTextureView = (AutoFitTextureView) view.findViewById(R.id.texture);
|
|
|
|
|
|
|
|
|
|
// Setup a new OrientationEventListener. This is used to handle rotation events like a
|
|
|
|
@ -804,9 +804,9 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
*/
|
|
|
|
|
private void requestCameraPermissions() {
|
|
|
|
|
if (shouldShowRationale()) {
|
|
|
|
|
PermissionConfirmationDialog.newInstance().show(getChildFragmentManager(), "dialog");
|
|
|
|
|
// PermissionConfirmationDialog.newInstance().show(getChildFragmentManager(), "dialog");
|
|
|
|
|
} else {
|
|
|
|
|
FragmentCompat.requestPermissions(this, CAMERA_PERMISSIONS, REQUEST_CAMERA_PERMISSIONS);
|
|
|
|
|
// FragmentCompat.requestPermissions(this, CAMERA_PERMISSIONS, REQUEST_CAMERA_PERMISSIONS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -832,9 +832,9 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
*/
|
|
|
|
|
private boolean shouldShowRationale() {
|
|
|
|
|
for (String permission : CAMERA_PERMISSIONS) {
|
|
|
|
|
if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
// if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -1829,8 +1829,8 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
FragmentCompat.requestPermissions(parent, CAMERA_PERMISSIONS,
|
|
|
|
|
REQUEST_CAMERA_PERMISSIONS);
|
|
|
|
|
// FragmentCompat.requestPermissions(parent, CAMERA_PERMISSIONS,
|
|
|
|
|
// REQUEST_CAMERA_PERMISSIONS);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.setNegativeButton(android.R.string.cancel,
|
|
|
|
|