Skip to content

Commit d187fbc

Browse files
committed
修复4.2以下第一次进入变形
1 parent 24b4646 commit d187fbc

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/src/main/java/org/evilbinary/tv/widget/BorderEffect.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,14 @@ private VisibleScope checkVisibleScope(View oldFocus, View newFocus) {
317317
@Override
318318
public void onFocusChanged(View target, View oldFocus, View newFocus) {
319319
try {
320-
Log.d(TAG, "onFocusChanged");
320+
//Log.d(TAG, "onFocusChanged:"+oldFocus+"="+newFocus);
321321

322322
if (newFocus == null && attacheViews.indexOf(newFocus) >= 0) {
323323
return;
324324
}
325+
if(oldFocus==newFocus)
326+
return;
327+
325328
lastFocus = newFocus;
326329
oldLastFocus = oldFocus;
327330
mTarget = target;
@@ -338,7 +341,6 @@ public void onFocusChanged(View target, View oldFocus, View newFocus) {
338341
if (isScrolling || newFocus == null || newFocus.getWidth() <= 0 || newFocus.getHeight() <= 0)
339342
return;
340343

341-
342344
mAnimatorList.clear();
343345

344346
for (FocusListener f : this.mFocusListener) {

lib/src/main/java/org/evilbinary/tv/widget/TvZorderRelativeLayout.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.evilbinary.tv.widget;
22

33
import android.content.Context;
4-
import android.os.Build;
54
import android.util.AttributeSet;
65
import android.view.KeyEvent;
76
import android.view.View;
@@ -31,14 +30,12 @@ public void setCurrentPosition(int pos) {
3130

3231
@Override
3332
public boolean dispatchKeyEvent(KeyEvent event) {
34-
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
3533
View focused = findFocus();
3634
int pos = indexOfChild(focused);
3735
if (pos >= 0 && pos < getChildCount()) {
3836
setCurrentPosition(pos);
3937
postInvalidate();
4038
}
41-
}
4239

4340
return super.dispatchKeyEvent(event);
4441
}
@@ -49,7 +46,7 @@ protected int getChildDrawingOrder(int childCount, int i) {
4946
int pos = indexOfChild(v);
5047
if (pos >= 0 && pos < childCount)
5148
setCurrentPosition(pos);
52-
49+
5350
if (i == childCount - 1) {//这是最后一个需要刷新的item
5451
return position;
5552
}

0 commit comments

Comments
 (0)