コード例 #1
1
 // //////////////////////////////////////////////////////////////////////
 // ACTIONS
 // //////////////////////////////////////////////////////////////////////
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   switch (requestCode) {
     case PublicIntent.REQUESTCODE_FILEPICKER:
       if (data != null && IntentIntegrator.ACTION_PICK_FILE.equals(data.getAction())) {
         ActionManager.actionPickFile(
             getFragmentManager().findFragmentByTag(TAG), IntentIntegrator.REQUESTCODE_FILEPICKER);
       } else if (data != null && data.getData() != null) {
         String tmpPath = ActionManager.getPath(getActivity(), data.getData());
         if (tmpPath != null) {
           tmpFile = new File(tmpPath);
         } else {
           // Error case : Unable to find the file path associated
           // to user pick.
           // Sample : Picasa image case
           ActionManager.actionDisplayError(
               this, new AlfrescoAppException(getString(R.string.error_unknown_filepath), true));
         }
       } else if (data != null
           && data.getExtras() != null
           && data.getExtras().containsKey(Intent.EXTRA_STREAM)) {
         List<File> files = new ArrayList<File>();
         List<Uri> uris = data.getExtras().getParcelableArrayList(Intent.EXTRA_STREAM);
         for (Uri uri : uris) {
           files.add(new File(ActionManager.getPath(getActivity(), uri)));
         }
         createFiles(files);
       }
       break;
     default:
       break;
   }
 }
コード例 #2
0
 // //////////////////////////////////////////////////////////////////////
 // ACTION BAR ITEM
 // //////////////////////////////////////////////////////////////////////
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == PublicIntent.REQUESTCODE_FILEPICKER
       && data != null
       && data.getData() != null) {
     String tmpPath = ActionManager.getPath(getActivity(), data.getData());
     if (tmpPath != null) {
       tmpFile = new File(tmpPath);
     } else {
       // Error case : Unable to find the file path associated to user
       // pick.
       // Sample : Picasa image case
       ActionManager.actionDisplayError(
           ChildrenBrowserFragment.this,
           new AlfrescoAppException(getString(R.string.error_unknown_filepath), true));
     }
   }
 }
コード例 #3
0
 @Override
 public void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   CloudNetwork network = (CloudNetwork) l.getItemAtPosition(position);
   Account currentAccount = SessionUtils.getAccount(getActivity());
   if (currentAccount != null
       && !currentAccount.getRepositoryId().equals(network.getIdentifier())) {
     ActionManager.reloadAccount(getActivity(), currentAccount, network.getIdentifier());
   }
 }