mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-29 21:27:40 +00:00
Fix NPE on plugin in onActivityResult
This commit is contained in:
parent
125dd14b18
commit
7f0c849fb0
@ -19,14 +19,11 @@ import androidx.core.content.FileProvider;
|
|||||||
public class PhotoActivity extends AppCompatActivity {
|
public class PhotoActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private Uri photoURI;
|
private Uri photoURI;
|
||||||
private PhotoPlugin plugin;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
BackgroundService.RunWithPlugin(this, getIntent().getStringExtra("deviceId"), PhotoPlugin.class, plugin -> this.plugin = plugin);
|
|
||||||
|
|
||||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
|
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
|
||||||
File photoFile = null;
|
File photoFile = null;
|
||||||
@ -61,12 +58,13 @@ public class PhotoActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
BackgroundService.RunWithPlugin(this, getIntent().getStringExtra("deviceId"), PhotoPlugin.class, plugin -> {
|
||||||
if (resultCode == -1) {
|
if (resultCode == -1) {
|
||||||
plugin.sendPhoto(photoURI);
|
plugin.sendPhoto(photoURI);
|
||||||
} else {
|
} else {
|
||||||
plugin.sendCancel();
|
plugin.sendCancel();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user