mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 11:21:29 +00:00
Properly check if file manager intent can be handled
This commit is contained in:
parent
94d72d768f
commit
dbd8818707
1 changed files with 2 additions and 3 deletions
|
@ -1,6 +1,5 @@
|
|||
package com.nutomic.syncthingandroid.views;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.databinding.DataBindingUtil;
|
||||
|
@ -54,9 +53,9 @@ public class FoldersAdapter extends ArrayAdapter<Folder> {
|
|||
binding.openFolder.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(Uri.fromFile(new File(folder.path)), "resource/folder");
|
||||
try {
|
||||
if (intent.resolveActivity(getContext().getPackageManager()) != null) {
|
||||
getContext().startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
} else {
|
||||
Toast.makeText(getContext(), R.string.toast_no_file_manager, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue