kopia lustrzana https://github.com/olgamiller/SSTVEncoder2
Added smpte_color_bars.png as default image, removed loading image from Uri stored in Settings,
because of SecurityException in loadImage for Build.VERSION.SDK_INT >= Build.VERSION_CODES.Mpull/3/head Version2.0
rodzic
39c229434e
commit
9e5738f807
3
NOTICE
3
NOTICE
|
@ -9,3 +9,6 @@ android.googlesource.com
|
||||||
|
|
||||||
ic_launcher.png were created using GIMP:
|
ic_launcher.png were created using GIMP:
|
||||||
http://www.gimp.org/
|
http://www.gimp.org/
|
||||||
|
|
||||||
|
SMPTE Color Bars image (CC BY-SA 3.0) was taken from Wikipedia:
|
||||||
|
http://en.wikipedia.org/wiki/SMPTE_color_bars#mediaviewer/File:SMPTE_Color_Bars.svg
|
||||||
|
|
|
@ -100,7 +100,8 @@ public class MainActivity extends AppCompatActivity {
|
||||||
Uri uri = getImageUriFromIntent(intent);
|
Uri uri = getImageUriFromIntent(intent);
|
||||||
boolean verbose = true;
|
boolean verbose = true;
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
uri = mSettings.getImageUri();
|
// SecurityException in loadImage for Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||||
|
// uri = mSettings.getImageUri();
|
||||||
verbose = false;
|
verbose = false;
|
||||||
}
|
}
|
||||||
loadImage(uri, verbose);
|
loadImage(uri, verbose);
|
||||||
|
@ -137,8 +138,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stream == null || !loadImage(stream, resolver, uri)) {
|
if (stream == null || !loadImage(stream, resolver, uri)) {
|
||||||
mCropView.setNoBitmap();
|
setDefaultBitmap();
|
||||||
mSettings.setImageUri(null);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -159,6 +159,15 @@ public class MainActivity extends AppCompatActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setDefaultBitmap() {
|
||||||
|
try {
|
||||||
|
mCropView.setBitmap(getResources().openRawResource(R.raw.smpte_color_bars));
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
mCropView.setNoBitmap();
|
||||||
|
}
|
||||||
|
mSettings.setImageUri(null);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isIntentActionValid(String action) {
|
private boolean isIntentActionValid(String action) {
|
||||||
return Intent.ACTION_SEND.equals(action);
|
return Intent.ACTION_SEND.equals(action);
|
||||||
}
|
}
|
||||||
|
@ -209,10 +218,8 @@ public class MainActivity extends AppCompatActivity {
|
||||||
case REQUEST_LOAD_IMAGE_PERMISSION:
|
case REQUEST_LOAD_IMAGE_PERMISSION:
|
||||||
if (permissionGranted(grantResults))
|
if (permissionGranted(grantResults))
|
||||||
loadImage(mSettings.getImageUri(), false);
|
loadImage(mSettings.getImageUri(), false);
|
||||||
else {
|
else
|
||||||
mCropView.setNoBitmap();
|
setDefaultBitmap();
|
||||||
mSettings.setImageUri(null);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case REQUEST_IMAGE_CAPTURE_PERMISSION:
|
case REQUEST_IMAGE_CAPTURE_PERMISSION:
|
||||||
if (permissionGranted(grantResults))
|
if (permissionGranted(grantResults))
|
||||||
|
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 2.6 KiB |
Ładowanie…
Reference in New Issue