diff --git a/app/src/main/java/com/git/amarradi/leafpad/adapter/CategoryAdapter.java b/app/src/main/java/com/git/amarradi/leafpad/adapter/CategoryAdapter.java index e4d216cd..f3f1db87 100644 --- a/app/src/main/java/com/git/amarradi/leafpad/adapter/CategoryAdapter.java +++ b/app/src/main/java/com/git/amarradi/leafpad/adapter/CategoryAdapter.java @@ -1,4 +1,4 @@ -package com.git.amarradi.leafpad.adapter; +private static final int STROKE_WIDTH = ColorUtilsHelper.dpToPx(card.getContext(), 2);package com.git.amarradi.leafpad.adapter; import android.view.LayoutInflater; import android.view.View; @@ -54,7 +54,7 @@ public void setCategories(List categories) { public void setSelectedCategoryIds(List ids) { selectedCategoryIds.clear(); - if (ids != null) { + if (null != ids) { selectedCategoryIds.addAll(ids); } notifyDataSetChanged(); @@ -110,7 +110,7 @@ public void onBindViewHolder(@NonNull CategoryViewHolder holder, int position) { holder.editButton.setOnClickListener(v -> { - if (listener != null) { + if (null != listener) { listener.onEditCategory(category); } }); @@ -129,13 +129,13 @@ private void applyCategoryColors( ImageButton btnDelete, CategoryEntity category ) { - if (category == null) return; + if (null == category) return; int baseColor = ColorUtilsHelper.parseCategoryColor(category.colorHex); int bgColor = ColorUtilsHelper.getCategoryBackgroundColor(baseColor); - card.setStrokeWidth(ColorUtilsHelper.dpToPx(card.getContext(), 2)); + card.setStrokeWidth(STROKE_WIDTH); card.setStrokeColor(baseColor); card.setCardBackgroundColor(bgColor);