More cleanup / refactoring: Name Fragments consistantly way
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / ui / fragment / FileList.java
diff --git a/src/eu/alefzero/owncloud/ui/fragment/FileList.java b/src/eu/alefzero/owncloud/ui/fragment/FileList.java
deleted file mode 100644 (file)
index 785b6ba..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/* ownCloud Android client application\r
- *   Copyright (C) 2011  Bartek Przybylski\r
- *\r
- *   This program is free software: you can redistribute it and/or modify\r
- *   it under the terms of the GNU General Public License as published by\r
- *   the Free Software Foundation, either version 3 of the License, or\r
- *   (at your option) any later version.\r
- *\r
- *   This program is distributed in the hope that it will be useful,\r
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- *   GNU General Public License for more details.\r
- *\r
- *   You should have received a copy of the GNU General Public License\r
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
- *\r
- */\r
-package eu.alefzero.owncloud.ui.fragment;\r
-\r
-import java.util.Stack;\r
-import java.util.Vector;\r
-\r
-import android.accounts.Account;\r
-import android.content.Intent;\r
-import android.os.Bundle;\r
-import android.view.View;\r
-import android.widget.AdapterView;\r
-import eu.alefzero.owncloud.R;\r
-import eu.alefzero.owncloud.authenticator.AuthUtils;\r
-import eu.alefzero.owncloud.datamodel.OCFile;\r
-import eu.alefzero.owncloud.ui.FragmentListView;\r
-import eu.alefzero.owncloud.ui.activity.FileDetailActivity;\r
-import eu.alefzero.owncloud.ui.activity.FileDisplayActivity;\r
-import eu.alefzero.owncloud.ui.adapter.FileListListAdapter;\r
-\r
-/**\r
- * A Fragment that lists all files and folders in a given path.\r
- * @author Bartek Przybylski\r
- *\r
- */\r
-public class FileList extends FragmentListView {\r
-  private Account mAccount;\r
-  private Stack<String> mDirNames;\r
-  private Vector<OCFile> mFiles;\r
-\r
-  public FileList() {\r
-    mDirNames = new Stack<String>();\r
-  }\r
-  \r
-  @Override\r
-  public void onCreate(Bundle savedInstanceState) {\r
-    super.onCreate(savedInstanceState);\r
-\r
-    mAccount = AuthUtils.getCurrentOwnCloudAccount(getActivity());\r
-    populateFileList();\r
-    // TODO: Remove this testing stuff\r
-    //addContact(mAccount, "Bartek Przybylski", "czlowiek");\r
-  }\r
-  \r
-  @Override\r
-  public void onItemClick(AdapterView<?> l, View v, int position, long id) {\r
-    if (mFiles.size() <= position) {\r
-      throw new IndexOutOfBoundsException("Incorrect item selected");\r
-    }\r
-    OCFile file = mFiles.get(position);\r
-    String id_ = String.valueOf(file.getFileId());\r
-    if (file.getMimetype().equals("DIR")) {\r
-        String dirname = file.getFileName();\r
-\r
-        mDirNames.push(dirname);\r
-        ((FileDisplayActivity)getActivity()).pushPath(dirname);\r
-        \r
-        populateFileList();\r
-        return;\r
-    }\r
-    Intent i = new Intent(getActivity(), FileDetailActivity.class);\r
-    i.putExtra("FILE_NAME", file.getFileName());\r
-    i.putExtra("FULL_PATH", file.getPath());\r
-    i.putExtra("FILE_ID", id_);\r
-    i.putExtra("ACCOUNT", mAccount);\r
-    FileDetail fd = (FileDetail) getFragmentManager().findFragmentById(R.id.fileDetail);\r
-    if (fd != null) {\r
-      fd.setStuff(i);\r
-    } else {\r
-      startActivity(i);\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Call this, when the user presses the up button\r
-   */\r
-  public void onNavigateUp() {\r
-    mDirNames.pop();\r
-    populateFileList();\r
-  }\r
-\r
-  /**\r
-   * Lists the directory\r
-   */\r
-  private void populateFileList() {\r
-    String s = "/";\r
-    for (String a : mDirNames)\r
-      s+= a+"/";\r
-\r
-    OCFile file = new OCFile(getActivity().getContentResolver(), mAccount, s);\r
-    mFiles = file.getDirectoryContent();\r
-    setListAdapter(new FileListListAdapter(file, getActivity()));\r
-  }\r
-  \r
-  //TODO: Delete this testing stuff.\r
-  /*private  void addContact(Account account, String name, String username) {\r
-    Log.i("ASD", "Adding contact: " + name);\r
-    ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();\r
-    \r
-    //Create our RawContact\r
-    ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(RawContacts.CONTENT_URI);\r
-    builder.withValue(RawContacts.ACCOUNT_NAME, account.name);\r
-    builder.withValue(RawContacts.ACCOUNT_TYPE, account.type);\r
-    builder.withValue(RawContacts.SYNC1, username);\r
-    operationList.add(builder.build());\r
-    \r
-    //Create a Data record of common type 'StructuredName' for our RawContact\r
-    builder = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI);\r
-    builder.withValueBackReference(ContactsContract.CommonDataKinds.StructuredName.RAW_CONTACT_ID, 0);\r
-    builder.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE);\r
-    builder.withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, name);\r
-    operationList.add(builder.build());\r
-    \r
-    //Create a Data record of custom type "vnd.android.cursor.item/vnd.fm.last.android.profile" to display a link to the Last.fm profile\r
-    builder = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI);\r
-    builder.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0);\r
-    builder.withValue(ContactsContract.Data.MIMETYPE, "vnd.android.cursor.item/vnd.owncloud.contact.profile");\r
-    builder.withValue(ContactsContract.Data.DATA1, username);\r
-    builder.withValue(ContactsContract.Data.DATA2, "Last.fm Profile");\r
-    builder.withValue(ContactsContract.Data.DATA3, "View profile");\r
-    operationList.add(builder.build());\r
-    \r
-    try {\r
-     getActivity().getContentResolver().applyBatch(ContactsContract.AUTHORITY, operationList);\r
-    } catch (Exception e) {\r
-     Log.e("ASD", "Something went wrong during creation! " + e);\r
-     e.printStackTrace();\r
-    }\r
-   }*/\r
-  \r
-}\r