From afb63961d1f92a21b913bdf73685fcf3450b37aa Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 23 Aug 2024 10:26:33 +0200 Subject: [PATCH] Remove code format Signed-off-by: alperozturk --- .../android/ui/activity/DrawerActivity.java | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java index 4721ba721b..42991b8059 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java @@ -539,7 +539,7 @@ public abstract class DrawerActivity extends ToolbarActivity } else if (itemId == R.id.nav_logout) { mCheckedMenuItem = -1; MenuItem isNewMenuItemChecked = menuItem.setChecked(false); - Log_OC.d(TAG, "onNavigationItemClicked nav_logout setChecked " + isNewMenuItemChecked); + Log_OC.d(TAG,"onNavigationItemClicked nav_logout setChecked " + isNewMenuItemChecked); final Optional optionalUser = getUser(); if (optionalUser.isPresent()) { UserInfoActivity.openAccountRemovalDialog(optionalUser.get(), getSupportFragmentManager()); @@ -1164,7 +1164,7 @@ public abstract class DrawerActivity extends ToolbarActivity public void avatarGenerated(Drawable avatarDrawable, Object callContext) { if (callContext instanceof MenuItem menuItem) { MenuItem newIcon = menuItem.setIcon(avatarDrawable); - Log_OC.d(TAG, "avatarGenerated new icon: " + newIcon); + Log_OC.d(TAG,"avatarGenerated new icon: " + newIcon); } else if (callContext instanceof ImageView imageView) { imageView.setImageDrawable(avatarDrawable); } else if (callContext instanceof MaterialButton materialButton) { @@ -1240,20 +1240,26 @@ public abstract class DrawerActivity extends ToolbarActivity } Thread t = new Thread(() -> { - if ((getCapabilities() == null || getCapabilities().getAccountName() != null && getCapabilities().getAccountName().isEmpty()) && getStorageManager() != null) { + // fetch capabilities as early as possible + if ((getCapabilities() == null || getCapabilities().getAccountName() != null && getCapabilities().getAccountName().isEmpty()) + && getStorageManager() != null) { GetCapabilitiesOperation getCapabilities = new GetCapabilitiesOperation(getStorageManager()); getCapabilities.execute(getBaseContext()); } - if (getStorageManager() != null && CapabilityUtils.getCapability(user, this).getExternalLinks().isTrue()) { - int count = arbitraryDataProvider.getIntegerValue(FilesSyncHelper.GLOBAL, FileActivity.APP_OPENED_COUNT); + if (getStorageManager() != null && CapabilityUtils.getCapability(user, this) + .getExternalLinks().isTrue()) { + + int count = arbitraryDataProvider.getIntegerValue(FilesSyncHelper.GLOBAL, + FileActivity.APP_OPENED_COUNT); if (count > 10 || count == -1 || force) { if (force) { Log_OC.d("ExternalLinks", "force update"); } - arbitraryDataProvider.storeOrUpdateKeyValue(FilesSyncHelper.GLOBAL, FileActivity.APP_OPENED_COUNT, "0"); + arbitraryDataProvider.storeOrUpdateKeyValue(FilesSyncHelper.GLOBAL, + FileActivity.APP_OPENED_COUNT, "0"); Log_OC.d("ExternalLinks", "update via api"); RemoteOperation getExternalLinksOperation = new ExternalLinksOperation(); @@ -1261,19 +1267,21 @@ public abstract class DrawerActivity extends ToolbarActivity if (result.isSuccess() && result.getData() != null) { externalLinksProvider.deleteAllExternalLinks(); - ArrayList externalLinks = (ArrayList) result.getData(); + + ArrayList externalLinks = (ArrayList) (Object) result.getData(); + for (ExternalLink link : externalLinks) { externalLinksProvider.storeExternalLink(link); } } } else { - arbitraryDataProvider.storeOrUpdateKeyValue(FilesSyncHelper.GLOBAL, FileActivity.APP_OPENED_COUNT, String.valueOf(count + 1)); + arbitraryDataProvider.storeOrUpdateKeyValue(FilesSyncHelper.GLOBAL, + FileActivity.APP_OPENED_COUNT, String.valueOf(count + 1)); } } else { externalLinksProvider.deleteAllExternalLinks(); Log_OC.d("ExternalLinks", "links disabled"); } - runOnUiThread(this::updateExternalLinksInDrawer); }); t.start(); @@ -1281,9 +1289,7 @@ public abstract class DrawerActivity extends ToolbarActivity protected void handleDeepLink(@NonNull Uri uri) { String path = uri.getLastPathSegment(); - if (path == null) { - return; - } + if (path == null) return; DeepLinkConstants deepLinkType = DeepLinkConstants.Companion.fromPath(path); if (deepLinkType == null) {