misc fixed related to copying files

This commit is contained in:
tibbi
2016-08-02 20:40:18 +02:00
parent ccb1a74422
commit 19092179de
7 changed files with 43 additions and 31 deletions

View File

@ -2,6 +2,7 @@ package com.simplemobiletools.filemanager;
import android.content.Context; import android.content.Context;
import android.graphics.Point; import android.graphics.Point;
import android.os.Environment;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.Display; import android.view.Display;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -99,16 +100,21 @@ public class Breadcrumbs extends LinearLayout implements View.OnClickListener {
} }
public void setInitialBreadcrumb(String fullPath) { public void setInitialBreadcrumb(String fullPath) {
final String basePath = Environment.getExternalStorageDirectory().toString();
final String tempPath = fullPath.replace(basePath, "home/");
removeAllViewsInLayout(); removeAllViewsInLayout();
final String[] dirs = fullPath.split("/"); final String[] dirs = tempPath.split("/");
String currPath = ""; String currPath = basePath;
for (int i = 0; i < dirs.length; i++) { for (int i = 0; i < dirs.length; i++) {
final String dir = dirs[i]; final String dir = dirs[i];
currPath += dir + "/"; if (i > 0) {
currPath += dir + "/";
}
if (dir.isEmpty()) if (dir.isEmpty())
continue; continue;
final FileDirItem item = new FileDirItem(currPath, dir, true, 0, 0); final FileDirItem item = new FileDirItem(i > 0 ? currPath : basePath, dir, true, 0, 0);
addBreadcrumb(item, i > 1); addBreadcrumb(item, i > 1);
} }
} }

View File

@ -385,7 +385,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment
final View copyView = getActivity().getLayoutInflater().inflate(R.layout.copy_item, null); final View copyView = getActivity().getLayoutInflater().inflate(R.layout.copy_item, null);
final TextView source = (TextView) copyView.findViewById(R.id.source); final TextView source = (TextView) copyView.findViewById(R.id.source);
source.setText(mPath); source.setText(mPath + "/");
final TextView destination = (TextView) copyView.findViewById(R.id.destination); final TextView destination = (TextView) copyView.findViewById(R.id.destination);
destination.setOnClickListener(destinationPicker); destination.setOnClickListener(destinationPicker);
@ -526,7 +526,10 @@ public class ItemsFragment extends android.support.v4.app.Fragment
alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override @Override
public void onDismiss(DialogInterface dialog) { public void onDismiss(DialogInterface dialog) {
mCopyDestinationPath = ((TextView) destinationView).getText().toString().trim(); final String destText = ((TextView) destinationView).getText().toString().trim();
if (!destText.equals(getString(R.string.select_destination))) {
mCopyDestinationPath = destText;
}
} }
}); });

View File

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/dialog_holder" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dialog_holder"
android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_margin" android:orientation="vertical"
android:paddingRight="@dimen/activity_margin" android:paddingLeft="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"> android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin">
<TextView <TextView
android:id="@+id/source_label" android:id="@+id/source_label"

View File

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/dialog_holder" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dialog_holder"
android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_margin" android:orientation="vertical"
android:paddingRight="@dimen/activity_margin" android:paddingLeft="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"> android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin">
<EditText <EditText
android:id="@+id/item_name" android:id="@+id/item_name"
@ -35,5 +36,4 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/file"/> android:text="@string/file"/>
</RadioGroup> </RadioGroup>
</LinearLayout> </LinearLayout>

View File

@ -16,7 +16,6 @@
android:id="@+id/directory_picker_list" android:id="@+id/directory_picker_list"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"/>
android:layout_below="@+id/directory_picker_breadcrumbs"/>
</LinearLayout> </LinearLayout>

View File

@ -17,6 +17,7 @@
android:choiceMode="multipleChoiceModal" android:choiceMode="multipleChoiceModal"
android:clipToPadding="false" android:clipToPadding="false"
android:paddingLeft="@dimen/activity_margin"/> android:paddingLeft="@dimen/activity_margin"/>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
@ -26,4 +27,5 @@
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="@dimen/activity_margin" android:layout_margin="@dimen/activity_margin"
android:src="@mipmap/plus"/> android:src="@mipmap/plus"/>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/dialog_holder" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dialog_holder"
android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:layout_height="match_parent"
android:padding="@dimen/activity_margin"> android:orientation="vertical"
android:padding="@dimen/activity_margin">
<EditText <EditText
android:id="@+id/item_name" android:id="@+id/item_name"