From bdfa64ee2d5eda60a8dac7709bdd0b6e50496b12 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 13 Aug 2024 10:34:49 +0200 Subject: [PATCH] Simplify extension Signed-off-by: alperozturk --- .../java/com/nextcloud/utils/extensions/ViewExtensions.kt | 6 ++++++ .../com/owncloud/android/ui/adapter/OCFileListAdapter.java | 1 + 2 files changed, 7 insertions(+) diff --git a/app/src/main/java/com/nextcloud/utils/extensions/ViewExtensions.kt b/app/src/main/java/com/nextcloud/utils/extensions/ViewExtensions.kt index 941c531235..a8db91c6ce 100644 --- a/app/src/main/java/com/nextcloud/utils/extensions/ViewExtensions.kt +++ b/app/src/main/java/com/nextcloud/utils/extensions/ViewExtensions.kt @@ -8,11 +8,17 @@ package com.nextcloud.utils.extensions import android.content.Context +import android.graphics.Color import android.graphics.Outline import android.util.TypedValue import android.view.View import android.view.ViewOutlineProvider +fun View.disableIf(condition: Boolean) { + isEnabled = condition + setBackgroundColor(if (condition) Color.TRANSPARENT else Color.GRAY) +} + fun View.setVisibleIf(condition: Boolean) { visibility = if (condition) View.VISIBLE else View.GONE } diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index cc4ccae549..25e4ca119f 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -654,6 +654,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter