Merged the latest code
This commit is contained in:
commit
ec8b00042b
|
@ -50,7 +50,7 @@ android {
|
||||||
// TODO: update Gradle version
|
// TODO: update Gradle version
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
shrinkResources true
|
shrinkResources false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
archivesBaseName = 'app'
|
archivesBaseName = 'app'
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,44 +75,26 @@ public final class FocusOverlayView extends Drawable implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGlobalFocusChanged(final View oldFocus, final View newFocus) {
|
public void onGlobalFocusChanged(final View oldFocus, final View newFocus) {
|
||||||
int l = focusRect.left;
|
if (newFocus != null) {
|
||||||
int r = focusRect.right;
|
|
||||||
int t = focusRect.top;
|
|
||||||
int b = focusRect.bottom;
|
|
||||||
|
|
||||||
if (newFocus != null && newFocus.getWidth() > 0 && newFocus.getHeight() > 0) {
|
|
||||||
newFocus.getGlobalVisibleRect(focusRect);
|
|
||||||
|
|
||||||
focused = new WeakReference<>(newFocus);
|
focused = new WeakReference<>(newFocus);
|
||||||
} else {
|
} else {
|
||||||
focusRect.setEmpty();
|
|
||||||
|
|
||||||
focused = null;
|
focused = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l != focusRect.left || r != focusRect.right
|
updateRect();
|
||||||
|| t != focusRect.top || b != focusRect.bottom) {
|
|
||||||
invalidateSelf();
|
|
||||||
}
|
|
||||||
|
|
||||||
focused = new WeakReference<>(newFocus);
|
|
||||||
|
|
||||||
animator.sendEmptyMessageDelayed(0, 1000);
|
animator.sendEmptyMessageDelayed(0, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRect() {
|
private void updateRect() {
|
||||||
if (focused == null) {
|
View focusedView = focused == null ? null : this.focused.get();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
View focusedView = this.focused.get();
|
|
||||||
|
|
||||||
int l = focusRect.left;
|
int l = focusRect.left;
|
||||||
int r = focusRect.right;
|
int r = focusRect.right;
|
||||||
int t = focusRect.top;
|
int t = focusRect.top;
|
||||||
int b = focusRect.bottom;
|
int b = focusRect.bottom;
|
||||||
|
|
||||||
if (focusedView != null) {
|
if (focusedView != null && isShown(focusedView)) {
|
||||||
focusedView.getGlobalVisibleRect(focusRect);
|
focusedView.getGlobalVisibleRect(focusRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +108,10 @@ public final class FocusOverlayView extends Drawable implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isShown(@NonNull final View view) {
|
||||||
|
return view.getWidth() != 0 && view.getHeight() != 0 && view.isShown();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDraw() {
|
public void onDraw() {
|
||||||
updateRect();
|
updateRect();
|
||||||
|
@ -236,6 +222,7 @@ public final class FocusOverlayView extends Drawable implements
|
||||||
observer.addOnGlobalFocusChangeListener(overlay);
|
observer.addOnGlobalFocusChangeListener(overlay);
|
||||||
observer.addOnGlobalLayoutListener(overlay);
|
observer.addOnGlobalLayoutListener(overlay);
|
||||||
observer.addOnTouchModeChangeListener(overlay);
|
observer.addOnTouchModeChangeListener(overlay);
|
||||||
|
observer.addOnDrawListener(overlay);
|
||||||
|
|
||||||
overlay.setCurrentFocus(decor.getFocusedChild());
|
overlay.setCurrentFocus(decor.getFocusedChild());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue