Merge branch 'remove_ActionBarSherlock' into navigationDrawer_update
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / dialog / CreateFolderDialogFragment.java
index 29b3be2..73ae8bd 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -17,7 +20,6 @@
 
 package com.owncloud.android.ui.dialog;
 
-import com.actionbarsherlock.app.SherlockDialogFragment;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.resources.files.FileUtils;
@@ -27,6 +29,7 @@ import android.app.AlertDialog;
 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;
@@ -37,12 +40,10 @@ import android.widget.Toast;
 /**
  *  Dialog to input the name for a new folder to create.  
  * 
- *  Triggers the folder creation when name is confirmed. 
- *  
- *  @author David A. Velasco
+ *  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";
     
@@ -51,7 +52,7 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
     /**
      * Public factory method to create new CreateFolderDialogFragment instances.
      * 
-     * @param file            File to remove.
+     * @param parentFolder    Folder to create
      * @return                Dialog ready to show.
      */
     public static CreateFolderDialogFragment newInstance(OCFile parentFolder) {
@@ -71,7 +72,7 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
         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 
@@ -80,7 +81,7 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
         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)
@@ -100,7 +101,7 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
             
             if (newFolderName.length() <= 0) {
                 Toast.makeText(
-                        getSherlockActivity(), 
+                        getActivity(),
                         R.string.filename_empty, 
                         Toast.LENGTH_LONG).show();
                 return;
@@ -108,7 +109,7 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
             
             if (!FileUtils.isValidName(newFolderName)) {
                 Toast.makeText(
-                        getSherlockActivity(), 
+                        getActivity(),
                         R.string.filename_forbidden_characters, 
                         Toast.LENGTH_LONG).show();
                 return;
@@ -116,7 +117,7 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
             
             String path = mParentFolder.getRemotePath();
             path += newFolderName + OCFile.PATH_SEPARATOR;
-            ((ComponentsGetter)getSherlockActivity()).
+            ((ComponentsGetter)getActivity()).
                 getFileOperationsHelper().createFolder(path, false);
         }
     }