-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Move EventEditorActivity#handleShadowRemove to EventEditorA…
…ctivity#handleRemoveHint
- Loading branch information
1 parent
5481bf7
commit cd8bb31
Showing
2 changed files
with
53 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
app/src/main/java/com/block/web/builder/ui/utils/BlockHintHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.block.web.builder.ui.utils; | ||
|
||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import com.block.web.builder.R; | ||
import com.block.web.builder.ui.view.blocks.BlockHint; | ||
import com.block.web.builder.utils.Utils; | ||
|
||
public final class BlockHintHandler { | ||
|
||
public static void handleRemoveHint(ViewGroup targetView, BlockHint blockHint) { | ||
|
||
ViewGroup blockHintParent = ((ViewGroup) blockHint.getParent()); | ||
|
||
if (targetView.getTag() != null) { | ||
if (targetView.getTag() instanceof String) { | ||
if (((String) targetView.getTag()).equals("blockDroppingArea")) { | ||
if (blockHint.getParent() != null) { | ||
if (blockHintParent.getChildCount() > 1) { | ||
if (blockHintParent.getChildAt(0).getTag() != null) { | ||
if (blockHintParent.getChildAt(0).getTag() instanceof String) { | ||
if (blockHintParent.getChildAt(0).getTag().equals("shadow")) { | ||
if (blockHintParent.getId() != R.id.relativeBlockListEditorArea) { | ||
if (blockHintParent.getChildAt(1).getLayoutParams() != null) { | ||
Utils.setMargins(blockHintParent.getChildAt(1), 0, 0, 0, 0); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} else if (targetView.getTag() instanceof String[]) { | ||
for (String str : (String[]) targetView.getTag()) { | ||
if (str.equals("boolean")) { | ||
if (targetView.getChildCount() == 2) { | ||
targetView.getChildAt(1).setVisibility(View.VISIBLE); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
if (blockHint.getParent() != null) { | ||
blockHintParent.removeView(blockHint); | ||
} | ||
} | ||
} |