Skip to content

Commit 0985563

Browse files
committed
Merge possible nested if's to take advantage of Short-circuit evaluation
1 parent 819ed50 commit 0985563

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

codeview/src/main/java/com/amrdeveloper/codeview/CodeView.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,9 @@ public void beforeTextChanged(CharSequence charSequence, int start, int before,
812812
public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
813813
if (!modified) return;
814814

815-
if(highlightWhileTextChanging) {
816-
if (mSyntaxPatternMap.size() > 0) {
817-
convertTabs(getEditableText(), start, count);
818-
mUpdateHandler.postDelayed(mUpdateRunnable, mUpdateDelayTime);
819-
}
815+
if(highlightWhileTextChanging && mSyntaxPatternMap.size() > 0) {
816+
convertTabs(getEditableText(), start, count);
817+
mUpdateHandler.postDelayed(mUpdateRunnable, mUpdateDelayTime);
820818
}
821819

822820
if (mRemoveErrorsWhenTextChanged) removeAllErrorLines();
@@ -852,9 +850,7 @@ else if (indentationEnds.contains(pairValue))
852850

853851
@Override
854852
public void afterTextChanged(Editable editable) {
855-
if(!highlightWhileTextChanging) {
856-
if (!modified) return;
857-
853+
if(!highlightWhileTextChanging && modified) {
858854
cancelHighlighterRender();
859855

860856
if (mSyntaxPatternMap.size() > 0) {

0 commit comments

Comments
 (0)