gt:             View v = super.getDropDownView(position, convertView, parent);
context: /* ownCloud Android client application
   *   Copyright (C) 2012-2013 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,
   *   as published by the Free Software Foundation.
   *
   *   This program is distributed in the hope that it will be useful,
   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *   GNU General Public License for more details.
   *
   *   You should have received a copy of the GNU General Public License
   *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
   *
   */
  
  package com.elenoondrive.android.ui.activity;
  
  import java.io.File;
  
  import android.accounts.Account;
  import android.content.Intent;
  import android.graphics.Typeface;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.os.Environment;
  import android.support.v4.app.DialogFragment;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.TextView;
  
  import com.actionbarsherlock.app.ActionBar;
  import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
  import com.actionbarsherlock.view.MenuItem;
  import com.elenoondrive.android.R;
  import com.elenoondrive.android.ui.dialog.ConfirmationDialogFragment;
  import com.elenoondrive.android.ui.dialog.IndeterminateProgressDialog;
  import com.elenoondrive.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener;
  import com.elenoondrive.android.ui.fragment.LocalFileListFragment;
  import com.elenoondrive.android.utils.DisplayUtils;
  import com.elenoondrive.android.utils.FileStorageUtils;
  import com.owncloud.android.lib.common.utils.Log_OC;
  
  
  /**
   * Displays local files and let the user choose what of them wants to upload
   * to the current ownCloud account
   * 
   * @author David A. Velasco
   * 
   */
  
  public class UploadFilesActivity extends FileActivity implements
      LocalFileListFragment.ContainerActivity, OnNavigationListener, OnClickListener, ConfirmationDialogFragmentListener {
      
      private ArrayAdapter<String> mDirectories;
      private File mCurrentDir = null;
      private LocalFileListFragment mFileListFragment;
      private Button mCancelBtn;
      private Button mUploadBtn;
      private Account mAccountOnCreation;
      private DialogFragment mCurrentDialog;
      
      public static final String EXTRA_CHOSEN_FILES = UploadFilesActivity.class.getCanonicalName() + ".EXTRA_CHOSEN_FILES";
  
      public static final int RESULT_OK_AND_MOVE = RESULT_FIRST_USER; 
      
      private static final String KEY_DIRECTORY_PATH = UploadFilesActivity.class.getCanonicalName() + ".KEY_DIRECTORY_PATH";
      private static final String TAG = "UploadFilesActivity";
      private static final String WAIT_DIALOG_TAG = "WAIT";
      private static final String QUERY_TO_MOVE_DIALOG_TAG = "QUERY_TO_MOVE";
      
      
      @Override
      public void onCreate(Bundle savedInstanceState) {
          Log_OC.d(TAG, "onCreate() start");
          super.onCreate(savedInstanceState);
  
          if(savedInstanceState != null) {
              mCurrentDir = new File(savedInstanceState.getString(UploadFilesActivity.KEY_DIRECTORY_PATH));
          } else {
              mCurrentDir = Environment.getExternalStorageDirectory();
          }
          
          mAccountOnCreation = getAccount();
                  
          /// USER INTERFACE
              
          // Drop-down navigation 
          mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item);
          File currDir = mCurrentDir;
          while(currDir != null && currDir.getParentFile() != null) {
              mDirectories.add(currDir.getName());
              currDir = currDir.getParentFile();
          }
          mDirectories.add(File.separator);
  
          // Inflate and set the layout view
          setContentView(R.layout.upload_files_layout);
          mFileListFragment = (LocalFileListFragment) getSupportFragmentManager().findFragmentById(R.id.local_files_list);
          
          
          // Set input controllers
          mCancelBtn = (Button) findViewById(R.id.upload_files_btn_cancel);
          Typeface facemCancelBtn=Typeface.createFromAsset(getAssets(),"DroidNaskhRegularSystemUI.ttf");
          mCancelBtn.setTypeface(facemCancelBtn);       
          mCancelBtn.setOnClickListener(this);
          
          mUploadBtn = (Button) findViewById(R.id.upload_files_btn_upload);
          Typeface facemUploadBtn=Typeface.createFromAsset(getAssets(),"DroidNaskhRegularSystemUI.ttf");
          mUploadBtn.setTypeface(facemUploadBtn);
          mUploadBtn.setOnClickListener(this);
          
              
          // Action bar setup
          ActionBar actionBar = getSupportActionBar();
          actionBar.setIcon(DisplayUtils.getSeasonalIconId());
          actionBar.setHomeButtonEnabled(true);   // mandatory since Android ICS, according to the official documentation
          actionBar.setDisplayHomeAsUpEnabled(mCurrentDir != null && mCurrentDir.getName() != null);
          actionBar.setDisplayShowTitleEnabled(false);
          actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
          actionBar.setListNavigationCallbacks(mDirectories, this);
          
          // wait dialog
          if (mCurrentDialog != null) {
              mCurrentDialog.dismiss();
              mCurrentDialog = null;
          }
              
          Log_OC.d(TAG, "onCreate() end");
      }
  
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          boolean retval = true;
          switch (item.getItemId()) {
              case android.R.id.home: {
                  if(mCurrentDir != null && mCurrentDir.getParentFile() != null){
                      onBackPressed(); 
                  }
                  break;
              }
              default:
                  retval = super.onOptionsItemSelected(item);
          }
          return retval;
      }
  
      
      @Override
      public boolean onNavigationItemSelected(int itemPosition, long itemId) {
          int i = itemPosition;
          while (i-- != 0) {
              onBackPressed();
          }
          // the next operation triggers a new call to this method, but it's necessary to 
          // ensure that the name exposed in the action bar is the current directory when the 
          // user selected it in the navigation list
          if (itemPosition != 0)
              getSupportActionBar().setSelectedNavigationItem(0);
          return true;
      }
  
      
      @Override
      public void onBackPressed() {
          if (mDirectories.getCount() <= 1) {
              finish();
              return;
          }
          popDirname();
          mFileListFragment.onNavigateUp();
          mCurrentDir = mFileListFragment.getCurrentDirectory();
          
          if(mCurrentDir.getParentFile() == null){
              ActionBar actionBar = getSupportActionBar(); 
              actionBar.setDisplayHomeAsUpEnabled(false);
          } 
      }
  
      
      @Override
      protected void onSaveInstanceState(Bundle outState) {
          // responsibility of restore is preferred in onCreate() before than in onRestoreInstanceState when there are Fragments involved
          Log_OC.d(TAG, "onSaveInstanceState() start");
          super.onSaveInstanceState(outState);
          outState.putString(UploadFilesActivity.KEY_DIRECTORY_PATH, mCurrentDir.getAbsolutePath());
          Log_OC.d(TAG, "onSaveInstanceState() end");
      }
  
      
      /**
       * Pushes a directory to the drop down list
       * @param directory to push
       * @throws IllegalArgumentException If the {@link File#isDirectory()} returns false.
       */
      public void pushDirname(File directory) {
          if(!directory.isDirectory()){
              throw new IllegalArgumentException("Only directories may be pushed!");
          }
          mDirectories.insert(directory.getName(), 0);
          mCurrentDir = directory;
      }
  
      /**
       * Pops a directory name from the drop down list
       * @return True, unless the stack is empty
       */
      public boolean popDirname() {
          mDirectories.remove(mDirectories.getItem(0));
          return !mDirectories.isEmpty();
      }
  
      
      // Custom array adapter to override text colors
      private class CustomArrayAdapter<T> extends ArrayAdapter<T> {
      
          public CustomArrayAdapter(UploadFilesActivity ctx, int view) {
              super(ctx, view);
          }
      
          public View getView(int position, View convertView, ViewGroup parent) {
              View v = super.getView(position, convertView, parent);
      
              ((TextView) v).setTextColor(getResources().getColorStateList(
                      android.R.color.white));
              return v;
          }
      
          public View getDropDownView(int position, View convertView,
                  ViewGroup parent) {
  