Make some usability improvements to the internal file browser. Don't cd when changing the preferred base directory (touching star). Don't put star on root & .. directories.
This commit is contained in:
parent
a21b3cedf5
commit
72ce4f8468
@ -161,7 +161,7 @@ public class SimpleFileBrowser extends SherlockListActivity {
|
|||||||
final File file = path.get(position);
|
final File file = path.get(position);
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
if (file.canRead())
|
if (file.canRead())
|
||||||
getDir(path.get(position));
|
getDir(file);
|
||||||
else {
|
else {
|
||||||
new AlertDialog.Builder(this).setIcon(R.drawable.or_launcher)
|
new AlertDialog.Builder(this).setIcon(R.drawable.or_launcher)
|
||||||
.setTitle("[" + file.getName() + "] folder can't be read!")
|
.setTitle("[" + file.getName() + "] folder can't be read!")
|
||||||
@ -244,13 +244,10 @@ public class SimpleFileBrowser extends SherlockListActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the "base directory" thing.
|
// Set the "favorite directory" thing.
|
||||||
{
|
{
|
||||||
ImageView v = (ImageView) (convertView.findViewById(R.id.filebrowser_list_item_homeicon));
|
ImageView v = (ImageView) (convertView.findViewById(R.id.filebrowser_list_item_homeicon));
|
||||||
if ( !file.isDirectory() ) {
|
if ( file.isDirectory() && hasUp && position > 1 ) {
|
||||||
v.setVisibility(View.INVISIBLE);
|
|
||||||
v.setClickable(false);
|
|
||||||
} else {
|
|
||||||
v.setVisibility(View.VISIBLE);
|
v.setVisibility(View.VISIBLE);
|
||||||
if ( baseDirName.equals( file.getAbsolutePath() ) ) {
|
if ( baseDirName.equals( file.getAbsolutePath() ) ) {
|
||||||
v.setSelected(true);
|
v.setSelected(true);
|
||||||
@ -259,6 +256,9 @@ public class SimpleFileBrowser extends SherlockListActivity {
|
|||||||
v.setClickable(true);
|
v.setClickable(true);
|
||||||
v.setOnClickListener( new ChangeBaseDirectory(file.getAbsolutePath()));
|
v.setOnClickListener( new ChangeBaseDirectory(file.getAbsolutePath()));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
v.setVisibility(View.INVISIBLE);
|
||||||
|
v.setClickable(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return convertView;
|
return convertView;
|
||||||
@ -279,7 +279,7 @@ public class SimpleFileBrowser extends SherlockListActivity {
|
|||||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(SimpleFileBrowser.this);
|
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(SimpleFileBrowser.this);
|
||||||
baseDirName = dirname;
|
baseDirName = dirname;
|
||||||
pref.edit().putString(baseDirPrefKey, dirname).apply();
|
pref.edit().putString(baseDirPrefKey, dirname).apply();
|
||||||
SimpleFileBrowser.this.getDir(new File(dirname));
|
((BaseAdapter)SimpleFileBrowser.this.getListAdapter()).notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user