show full path at breadcrumbs if set so

This commit is contained in:
tibbi 2016-10-11 22:47:51 +02:00
parent 899255fc68
commit 483b433dda
4 changed files with 9 additions and 7 deletions

View File

@ -73,7 +73,7 @@ public class MainActivity extends SimpleActivity implements ItemsFragment.ItemIn
private void initRootFileManager() { private void initRootFileManager() {
final String path = Environment.getExternalStorageDirectory().toString(); final String path = Environment.getExternalStorageDirectory().toString();
openPath(path); openPath(path);
mBreadcrumbs.setInitialBreadcrumb(path); mBreadcrumbs.setInitialBreadcrumb(path, mConfig.getShowFullPath());
mRootFoldersCnt = mBreadcrumbs.getChildCount(); mRootFoldersCnt = mBreadcrumbs.getChildCount();
} }
@ -143,7 +143,7 @@ public class MainActivity extends SimpleActivity implements ItemsFragment.ItemIn
public void breadcrumbClicked(int id) { public void breadcrumbClicked(int id) {
final FileDirItem item = (FileDirItem) mBreadcrumbs.getChildAt(id).getTag(); final FileDirItem item = (FileDirItem) mBreadcrumbs.getChildAt(id).getTag();
final String path = item.getPath(); final String path = item.getPath();
mBreadcrumbs.setInitialBreadcrumb(path); mBreadcrumbs.setInitialBreadcrumb(path, mConfig.getShowFullPath());
openPath(path); openPath(path);
} }
} }

View File

@ -549,7 +549,8 @@ public class ItemsFragment extends android.support.v4.app.Fragment
@Override @Override
public void onClick(final View view) { public void onClick(final View view) {
final boolean showHiddenItems = Config.newInstance(getContext()).getShowHidden(); final boolean showHiddenItems = Config.newInstance(getContext()).getShowHidden();
SelectFolderDialog dialog = SelectFolderDialog.Companion.newInstance(mCopyDestinationPath, showHiddenItems); final boolean showFullPath = Config.newInstance(getContext()).getShowFullPath();
SelectFolderDialog dialog = SelectFolderDialog.Companion.newInstance(mCopyDestinationPath, showHiddenItems, showFullPath);
dialog.setTargetFragment(ItemsFragment.this, SELECT_FOLDER_REQUEST); dialog.setTargetFragment(ItemsFragment.this, SELECT_FOLDER_REQUEST);
dialog.show(getFragmentManager(), "selectFolder"); dialog.show(getFragmentManager(), "selectFolder");
} }

View File

@ -25,11 +25,13 @@ class SelectFolderDialog : DialogFragment(), Breadcrumbs.BreadcrumbsListener {
lateinit var mPath: String lateinit var mPath: String
var mFirstUpdate: Boolean = true var mFirstUpdate: Boolean = true
var mShowHidden: Boolean = false var mShowHidden: Boolean = false
var mShowFullPath: Boolean = false
fun newInstance(path: String, showHidden: Boolean): SelectFolderDialog { fun newInstance(path: String, showHidden: Boolean, showFullPath: Boolean): SelectFolderDialog {
mPath = path mPath = path
mFirstUpdate = true mFirstUpdate = true
mShowHidden = showHidden mShowHidden = showHidden
mShowFullPath = showFullPath
return SelectFolderDialog() return SelectFolderDialog()
} }
} }
@ -61,7 +63,7 @@ class SelectFolderDialog : DialogFragment(), Breadcrumbs.BreadcrumbsListener {
val adapter = ItemsAdapter(context, items) val adapter = ItemsAdapter(context, items)
dialog.directory_picker_list.adapter = adapter dialog.directory_picker_list.adapter = adapter
dialog.directory_picker_breadcrumbs.setInitialBreadcrumb(mPath) dialog.directory_picker_breadcrumbs.setInitialBreadcrumb(mPath, mShowFullPath)
dialog.directory_picker_list.setOnItemClickListener { adapterView, view, position, id -> dialog.directory_picker_list.setOnItemClickListener { adapterView, view, position, id ->
val item = items[position] val item = items[position]
if (item.isDirectory) { if (item.isDirectory) {

View File

@ -96,8 +96,7 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : LinearLayout(context,
setMeasuredDimension(parentWidth, calculatedHeight) setMeasuredDimension(parentWidth, calculatedHeight)
} }
fun setInitialBreadcrumb(fullPath: String) { fun setInitialBreadcrumb(fullPath: String, showFullPath: Boolean) {
val showFullPath = false//Config.newInstance(context).showFullPath
val basePath = Environment.getExternalStorageDirectory().toString() val basePath = Environment.getExternalStorageDirectory().toString()
var tempPath = fullPath var tempPath = fullPath
var currPath = basePath var currPath = basePath