mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-06 06:08:24 +08:00
add View::notifyGlobalFocusCleared
This commit is contained in:
parent
0a1bb3a9c8
commit
b894f260bb
@ -5221,11 +5221,20 @@ void View::clearFocusInternal(View* focused, bool propagate, bool refocus){
|
||||
invalidate(true);
|
||||
refreshDrawableState();
|
||||
|
||||
//if (propagate && (!refocus || !rootViewRequestFocus())) notifyGlobalFocusCleared(this);
|
||||
|
||||
if (propagate && (!refocus || !rootViewRequestFocus())) notifyGlobalFocusCleared(this);
|
||||
}
|
||||
}
|
||||
|
||||
void View::notifyGlobalFocusCleared(View*oldFocus){
|
||||
if(oldFocus && mAttachInfo)
|
||||
mAttachInfo->mTreeObserver->dispatchOnGlobalFocusChange(oldFocus,nullptr);
|
||||
}
|
||||
|
||||
bool View::rootViewRequestFocus() {
|
||||
View* root = getRootView();
|
||||
return root && root->requestFocus();
|
||||
}
|
||||
|
||||
void View::handleFocusGainInternal(int direction,Rect*previouslyFocusedRect){
|
||||
if ((mPrivateFlags & PFLAG_FOCUSED) == 0) {
|
||||
mPrivateFlags |= PFLAG_FOCUSED;
|
||||
@ -6741,7 +6750,6 @@ bool View::isSoundEffectsEnabled()const{
|
||||
}
|
||||
|
||||
void View::playSoundEffect(int soundConstant){
|
||||
LOGD_IF(mAttachInfo&&mAttachInfo->mPlaySoundEffect,"%p:%d fun=%p soundConstant=%d enabled=%d",this,mID,mAttachInfo->mPlaySoundEffect,soundConstant,isSoundEffectsEnabled());
|
||||
if(mAttachInfo==nullptr||mAttachInfo->mPlaySoundEffect==nullptr||isSoundEffectsEnabled()==false)
|
||||
return ;
|
||||
mAttachInfo->mPlaySoundEffect(soundConstant);
|
||||
|
@ -988,6 +988,8 @@ public:
|
||||
bool isFocusable()const;
|
||||
void setFocusable(bool);
|
||||
int getFocusable()const;
|
||||
void notifyGlobalFocusCleared(View* oldFocus);
|
||||
bool rootViewRequestFocus();
|
||||
virtual void unFocus(View*);
|
||||
virtual bool hasFocus()const;
|
||||
virtual bool restoreFocusInCluster(int direction);
|
||||
|
@ -1556,15 +1556,15 @@ void ViewGroup::removeAllViewsInLayout() {
|
||||
|
||||
if (bclearChildFocus) {
|
||||
clearChildFocus(focused);
|
||||
/*if (!rootViewRequestFocus()) {
|
||||
if (!rootViewRequestFocus()) {
|
||||
notifyGlobalFocusCleared(focused);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
mChildren.clear();
|
||||
}
|
||||
|
||||
bool ViewGroup::removeViewInternal(View* view){
|
||||
int index = indexOfChild(view);
|
||||
const int index = indexOfChild(view);
|
||||
if (index >= 0) {
|
||||
removeViewInternal(index, view);
|
||||
return true;
|
||||
@ -1604,7 +1604,7 @@ void ViewGroup::removeViewInternal(int index, View* view){
|
||||
|
||||
if (_clearChildFocus) {
|
||||
clearChildFocus(view);
|
||||
//if (!rootViewRequestFocus())notifyGlobalFocusCleared(this);
|
||||
if (!rootViewRequestFocus()) notifyGlobalFocusCleared(this);
|
||||
}
|
||||
dispatchViewRemoved(view);
|
||||
|
||||
@ -1670,7 +1670,7 @@ void ViewGroup::removeViewsInternal(int start, int count){
|
||||
}
|
||||
if (_clearChildFocus) {
|
||||
clearChildFocus(focused);
|
||||
//if (!rootViewRequestFocus()) notifyGlobalFocusCleared(focused);
|
||||
if (!rootViewRequestFocus()) notifyGlobalFocusCleared(focused);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3304,8 +3304,8 @@ void AbsListView::PositionScroller::start(int position) {
|
||||
return;
|
||||
}
|
||||
|
||||
int firstPos = mLV->mFirstPosition;
|
||||
int lastPos = firstPos + childCount - 1;
|
||||
const int firstPos = mLV->mFirstPosition;
|
||||
const int lastPos = firstPos + childCount - 1;
|
||||
|
||||
int viewTravelCount;
|
||||
int clampedPosition = std::max(0, std::min(mLV->getCount() - 1, position));
|
||||
|
Loading…
Reference in New Issue
Block a user