Simplify extension

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-08-13 10:34:49 +02:00
parent b2a8481124
commit bdfa64ee2d
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF
2 changed files with 7 additions and 0 deletions

View file

@ -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
}

View file

@ -654,6 +654,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
holder.getOverflowMenu().setImageResource(R.drawable.ic_dots_vertical);
}
// TODO make folder color gray and disable click event
ViewExtensionsKt.setVisibleIf(holder.getOverflowMenu(),file.getRemoteId() != null);
ViewExtensionsKt.setVisibleIf(holder.getShared(),file.getRemoteId() != null);
}