Skip to content

Commit

Permalink
fix: Overlapping of CustomBlocksDialog list
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward-NewGate-KOC committed Dec 10, 2024
1 parent 348e836 commit a5e360d
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.CompoundButton;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
Expand Down Expand Up @@ -289,6 +288,7 @@ public void bind(@NonNull BlockBean block, int position) {
}

private void addCustomBlockView(ViewGroup container, Context context, BlockBean block) {
container.removeAllViews();
container.addView(createBlock(context, block));
}

Expand All @@ -297,11 +297,13 @@ private void setupCheckBox(@NonNull BlockBean block, int position) {
binding.checkBox.setEnabled(canImport);

if (canImport) {
binding.checkBox.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
if (onCheckedChangeListener != null) {
onCheckedChangeListener.accept(position, isChecked);
}
binding.checkBox.setChecked(Boolean.TRUE.equals(selectedBlocks.getOrDefault(position, false)));
binding.checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
onCheckedChangeListener.accept(position, isChecked);
});
} else {
binding.checkBox.setOnCheckedChangeListener(null);
binding.checkBox.setChecked(false);
}
}

Expand Down

0 comments on commit a5e360d

Please sign in to comment.