package com.owncloud.android.ui.dialog;
-import com.actionbarsherlock.app.SherlockDialogFragment;
-import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.resources.files.FileUtils;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
+import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager.LayoutParams;
*
* Triggers the folder creation when name is confirmed.
*/
-public class CreateFolderDialogFragment
-extends SherlockDialogFragment implements DialogInterface.OnClickListener {
+public class CreateFolderDialogFragment
+ extends DialogFragment implements DialogInterface.OnClickListener {
private static final String ARG_PARENT_FOLDER = "PARENT_FOLDER";
/**
* Public factory method to create new CreateFolderDialogFragment instances.
- *
+ *
* @param parentFolder Folder to create
* @return Dialog ready to show.
*/
mParentFolder = getArguments().getParcelable(ARG_PARENT_FOLDER);
// Inflate the layout for the dialog
- LayoutInflater inflater = getSherlockActivity().getLayoutInflater();
+ LayoutInflater inflater = getActivity().getLayoutInflater();
View v = inflater.inflate(R.layout.edit_box_dialog, null);
// Setup layout
inputText.requestFocus();
// Build the dialog
- AlertDialog.Builder builder = new AlertDialog.Builder(getSherlockActivity());
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(v)
.setPositiveButton(R.string.common_ok, this)
.setNegativeButton(R.string.common_cancel, this)
if (newFolderName.length() <= 0) {
Toast.makeText(
- getSherlockActivity(),
+ getActivity(),
R.string.filename_empty,
Toast.LENGTH_LONG).show();
return;
}
-
- boolean serverWithForbiddenChars = ((ComponentsGetter)getSherlockActivity()).
+ boolean serverWithForbiddenChars = ((ComponentsGetter)getActivity()).
getFileOperationsHelper().isVersionWithForbiddenCharacters();
if (!FileUtils.isValidName(newFolderName, serverWithForbiddenChars)) {
} else {
messageId = R.string.filename_forbidden_characters;
}
- Toast.makeText(getSherlockActivity(), messageId, Toast.LENGTH_LONG).show();
+ Toast.makeText(getActivity(), messageId, Toast.LENGTH_LONG).show();
+
return;
}
String path = mParentFolder.getRemotePath();
path += newFolderName + OCFile.PATH_SEPARATOR;
- ((ComponentsGetter)getSherlockActivity()).
+ ((ComponentsGetter)getActivity()).
getFileOperationsHelper().createFolder(path, false);
}
}