Commit 12f9c601 authored by Geoffrey Métais's avatar Geoffrey Métais

Fix context menu in directory browser

parent 09c43e0d
......@@ -371,7 +371,8 @@ public class DirectoryAdapter extends BaseAdapter {
else
holder.icon.setImageResource(R.drawable.ic_menu_folder);
holder.more.setVisibility(Util.canWrite(mCurrentDir+"/"+selectedNode.name) ? View.VISIBLE : View.INVISIBLE);
holder.more.setVisibility(selectedNode.isFile() ||
Util.canWrite(mCurrentDir+"/"+selectedNode.name) ? View.VISIBLE : View.INVISIBLE);
holder.more.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
......
......@@ -310,8 +310,9 @@ public class Util {
public static boolean canWrite(String path){
if (path == null)
return false;
if (LibVlcUtil.isLolliPopOrLater() &&
!path.startsWith("file://" + Environment.getExternalStorageDirectory().getPath()))
if (path.startsWith(Environment.getExternalStorageDirectory().getPath()))
return true;
if (LibVlcUtil.isLolliPopOrLater())
return false;
File file = new File(path);
return (file.exists() && file.canWrite());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment