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.graphics.Point;
import android.os.Environment;
import android.util.AttributeSet;
import android.view.Display;
import android.view.LayoutInflater;
@ -99,16 +100,21 @@ 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, "home/");
removeAllViewsInLayout();
final String[] dirs = fullPath.split("/");
String currPath = "";
final String[] dirs = tempPath.split("/");
String currPath = basePath;
for (int i = 0; i < dirs.length; i++) {
final String dir = dirs[i];
currPath += dir + "/";
if (i > 0) {
currPath += dir + "/";
}
if (dir.isEmpty())
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);
}
}

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 TextView source = (TextView) copyView.findViewById(R.id.source);
source.setText(mPath);
source.setText(mPath + "/");
final TextView destination = (TextView) copyView.findViewById(R.id.destination);
destination.setOnClickListener(destinationPicker);
@ -526,7 +526,10 @@ public class ItemsFragment extends android.support.v4.app.Fragment
alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
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"?>
<LinearLayout android:id="@+id/dialog_holder"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin">
<LinearLayout
android:id="@+id/dialog_holder"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin">
<TextView
android:id="@+id/source_label"

View file

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

View file

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

View file

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

View file

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