Bläddra i källkod

Migrate ChooseRichDocumentsTemplateDialogFragment to User

Signed-off-by: Chris Narkiewicz <hello@ezaquarii.com>
Chris Narkiewicz 5 år sedan
förälder
incheckning
6f34899327

+ 5 - 7
src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java

@@ -158,15 +158,13 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
         fileName.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP);
 
         try {
-            Account account = currentAccount.getCurrentAccount();
-            OwnCloudAccount ocAccount = new OwnCloudAccount(account, activity);
-            client = OwnCloudClientManagerFactory.getDefaultSingleton().getClientFor(ocAccount, getContext());
-
-            new FetchTemplateTask(this, client).execute(type);
-        } catch (Exception e) {
-            Log_OC.e(TAG, "Loading stream url not possible: " + e);
+            client = clientFactory.create(currentAccount.getUser());
+        } catch (ClientFactory.CreationException e) {
+            throw new RuntimeException(e); // we'll NPE without the client
         }
 
+        new FetchTemplateTask(this, client).execute(type);
+
         listView.setHasFixedSize(true);
         listView.setLayoutManager(new GridLayoutManager(activity, 2));
         adapter = new RichDocumentsTemplateAdapter(type, this, getContext(), currentAccount, clientFactory);