mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +08:00
fix listpopupwindow's missing init
This commit is contained in:
parent
bdeaaeff9f
commit
b88673806d
@ -9,6 +9,7 @@ DropDownListView::DropDownListView(Context*context,bool hijackfocus):ListView(co
|
||||
|
||||
DropDownListView::~DropDownListView(){
|
||||
delete mScrollHelper;
|
||||
removeCallbacks(mResolveHoverRunnable);
|
||||
}
|
||||
|
||||
bool DropDownListView::shouldShowSelector(){
|
||||
@ -18,7 +19,7 @@ bool DropDownListView::shouldShowSelector(){
|
||||
bool DropDownListView::onTouchEvent(MotionEvent& ev){
|
||||
if(mResolveHoverRunnable){
|
||||
removeCallbacks(mResolveHoverRunnable);
|
||||
mResolveHoverRunnable=nullptr;
|
||||
mResolveHoverRunnable = nullptr;
|
||||
}
|
||||
return ListView::onTouchEvent(ev);
|
||||
}
|
||||
@ -29,7 +30,7 @@ bool DropDownListView::onHoverEvent(MotionEvent& ev){
|
||||
// This may be transitioning to TOUCH_DOWN. Postpone drawable state
|
||||
// updates until either the next frame or the next touch event.
|
||||
mResolveHoverRunnable = [this](){
|
||||
mResolveHoverRunnable=nullptr;
|
||||
mResolveHoverRunnable = nullptr;
|
||||
drawableStateChanged();
|
||||
};
|
||||
post(mResolveHoverRunnable);
|
||||
@ -39,7 +40,7 @@ bool DropDownListView::onHoverEvent(MotionEvent& ev){
|
||||
bool handled = ListView::onHoverEvent(ev);
|
||||
|
||||
if (action == MotionEvent::ACTION_HOVER_ENTER || action == MotionEvent::ACTION_HOVER_MOVE) {
|
||||
int position = pointToPosition((int) ev.getX(), (int) ev.getY());
|
||||
const int position = pointToPosition((int) ev.getX(), (int) ev.getY());
|
||||
if (position != INVALID_POSITION && position != mSelectedPosition) {
|
||||
View* hoveredItem = getChildAt(position - getFirstVisiblePosition());
|
||||
if (hoveredItem->isEnabled()) {
|
||||
|
@ -34,6 +34,7 @@ ListPopupWindow::~ListPopupWindow(){
|
||||
}
|
||||
|
||||
void ListPopupWindow::initPopupWindow(){
|
||||
mObserver = nullptr;
|
||||
mOverlapAnchor = 0xFF;
|
||||
mDropDownAlwaysVisible = false;
|
||||
mForceIgnoreOutsideTouch= false;
|
||||
@ -330,7 +331,7 @@ void ListPopupWindow::dismiss() {
|
||||
removePromptView();
|
||||
mPopup->setContentView(nullptr);
|
||||
mDropDownList->setAdapter(nullptr);
|
||||
delete mDropDownList;
|
||||
//delete mDropDownList;
|
||||
mDropDownList = nullptr;
|
||||
mHandler->removeCallbacks(mResizePopupRunnable);
|
||||
}
|
||||
@ -660,7 +661,7 @@ int ListPopupWindow::buildDropDown() {
|
||||
|
||||
// If we don't have an explicit vertical offset, determine one from
|
||||
// the window background so that content will line up.
|
||||
if (mDropDownVerticalOffset!=0){//!mDropDownVerticalOffsetSet) {
|
||||
if (mDropDownVerticalOffset!=0){
|
||||
mDropDownVerticalOffset = -mTempRect.top;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user