do not replace the root folder with "home"
This commit is contained in:
parent
35ce30804a
commit
82045524c3
7 changed files with 11 additions and 17 deletions
|
@ -101,10 +101,9 @@ public class Breadcrumbs extends LinearLayout implements View.OnClickListener {
|
|||
|
||||
public void setInitialBreadcrumb(String fullPath) {
|
||||
final String basePath = Environment.getExternalStorageDirectory().toString();
|
||||
final String tempPath = fullPath.replace(basePath, getContext().getString(R.string.initial_breadcrumb) + "/");
|
||||
removeAllViewsInLayout();
|
||||
final String[] dirs = tempPath.split("/");
|
||||
String currPath = basePath;
|
||||
final String[] dirs = fullPath.split("/");
|
||||
String currPath = "/";
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
final String dir = dirs[i];
|
||||
if (i > 0) {
|
||||
|
|
|
@ -24,6 +24,7 @@ public class MainActivity extends SimpleActivity implements ItemsFragment.ItemIn
|
|||
@BindView(R.id.breadcrumbs) Breadcrumbs mBreadcrumbs;
|
||||
|
||||
private static final int STORAGE_PERMISSION = 1;
|
||||
private static int mRootFoldersCnt;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -52,6 +53,7 @@ public class MainActivity extends SimpleActivity implements ItemsFragment.ItemIn
|
|||
final String path = Environment.getExternalStorageDirectory().toString();
|
||||
openPath(path);
|
||||
mBreadcrumbs.setInitialBreadcrumb(path);
|
||||
mRootFoldersCnt = mBreadcrumbs.getChildCount();
|
||||
}
|
||||
|
||||
private void openPath(String path) {
|
||||
|
@ -87,10 +89,10 @@ public class MainActivity extends SimpleActivity implements ItemsFragment.ItemIn
|
|||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
final int cnt = getSupportFragmentManager().getBackStackEntryCount();
|
||||
if (cnt == 1)
|
||||
final int cnt = mBreadcrumbs.getChildCount() - mRootFoldersCnt;
|
||||
if (cnt <= 0) {
|
||||
finish();
|
||||
else {
|
||||
} else {
|
||||
mBreadcrumbs.removeBreadcrumb();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
@ -118,11 +120,9 @@ public class MainActivity extends SimpleActivity implements ItemsFragment.ItemIn
|
|||
|
||||
@Override
|
||||
public void breadcrumbClicked(int id) {
|
||||
final int children = mBreadcrumbs.getChildCount() - 1;
|
||||
final int removeCnt = children - id;
|
||||
for (int i = 0; i < removeCnt; i++) {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
mBreadcrumbs.removeBreadcrumb();
|
||||
}
|
||||
final FileDirItem item = (FileDirItem) mBreadcrumbs.getChildAt(id).getTag();
|
||||
final String path = item.getPath();
|
||||
openPath(path);
|
||||
mBreadcrumbs.setInitialBreadcrumb(path);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
<string name="please_select_destination">Bitte wähle ein Ziel</string>
|
||||
<string name="copy_failed">Konnte die Datei nicht kopieren</string>
|
||||
<string name="copying">Kopiere</string>
|
||||
<string name="initial_breadcrumb">home</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Abbrechen</string>
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
<string name="please_select_destination">Seleziona una destinazione</string>
|
||||
<string name="copy_failed">Impossibile copiare i file</string>
|
||||
<string name="copying">Copia in corso</string>
|
||||
<string name="initial_breadcrumb">home</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
<string name="please_select_destination">宛先を選択してください</string>
|
||||
<string name="copy_failed">ファイルをコピーできませんでした</string>
|
||||
<string name="copying">コピー中</string>
|
||||
<string name="initial_breadcrumb">ホーム</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
<string name="please_select_destination">Please select a destination</string>
|
||||
<string name="copy_failed">Kunde inte kopiera filen</string>
|
||||
<string name="copying">Kopierar</string>
|
||||
<string name="initial_breadcrumb">home</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
<string name="please_select_destination">Please select a destination</string>
|
||||
<string name="copy_failed">Could not copy the files</string>
|
||||
<string name="copying">Copying</string>
|
||||
<string name="initial_breadcrumb">home</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue