mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +08:00
View::setFlags optimized
This commit is contained in:
parent
1a96226ebb
commit
1deea5ec77
@ -4289,8 +4289,7 @@ View& View::setFlags(int flags,int mask) {
|
|||||||
|
|
||||||
// If focusable is auto, update the FOCUSABLE bit.
|
// If focusable is auto, update the FOCUSABLE bit.
|
||||||
int focusableChangedByAuto = 0;
|
int focusableChangedByAuto = 0;
|
||||||
if (((mViewFlags & FOCUSABLE_AUTO) != 0)
|
if ((mViewFlags & FOCUSABLE_AUTO) && (changed & (FOCUSABLE_MASK | CLICKABLE))) {
|
||||||
&& (changed & (FOCUSABLE_MASK | CLICKABLE)) != 0) {
|
|
||||||
// Heuristic only takes into account whether view is clickable.
|
// Heuristic only takes into account whether view is clickable.
|
||||||
int newFocus=(mViewFlags & CLICKABLE)?FOCUSABLE:NOT_FOCUSABLE;
|
int newFocus=(mViewFlags & CLICKABLE)?FOCUSABLE:NOT_FOCUSABLE;
|
||||||
mViewFlags = (mViewFlags & ~FOCUSABLE) | newFocus;
|
mViewFlags = (mViewFlags & ~FOCUSABLE) | newFocus;
|
||||||
@ -4299,8 +4298,8 @@ View& View::setFlags(int flags,int mask) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the FOCUSABLE bit has changed */
|
/* Check if the FOCUSABLE bit has changed */
|
||||||
if (((changed & FOCUSABLE) != 0) && ((privateFlags & PFLAG_HAS_BOUNDS) != 0)) {
|
if ((changed & FOCUSABLE) && (privateFlags & PFLAG_HAS_BOUNDS)) {
|
||||||
if (((old & FOCUSABLE) == FOCUSABLE) && ((privateFlags & PFLAG_FOCUSED) != 0)) {
|
if (((old & FOCUSABLE) == FOCUSABLE) && (privateFlags & PFLAG_FOCUSED)) {
|
||||||
/* Give up focus if we are no longer focusable */
|
/* Give up focus if we are no longer focusable */
|
||||||
clearFocus();
|
clearFocus();
|
||||||
mParent->clearFocusedInCluster();
|
mParent->clearFocusedInCluster();
|
||||||
|
Loading…
Reference in New Issue
Block a user