mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +08:00
modify propertyvaluesholder
This commit is contained in:
parent
0511b34f72
commit
27a6f0b4ff
@ -35,12 +35,15 @@ void ObjectAnimator::setPropertyName(const std::string&propertyName){
|
||||
}
|
||||
|
||||
void ObjectAnimator::setProperty(const Property& property){
|
||||
if (mValuesMap.size()) {
|
||||
/*PropertyValuesHolder valuesHolder = mValues[0];
|
||||
String oldName = valuesHolder.getPropertyName();
|
||||
valuesHolder.setProperty(property);
|
||||
mValuesMap.remove(oldName);
|
||||
mValuesMap.put(mPropertyName, valuesHolder);*/
|
||||
if (mValues.size()) {
|
||||
PropertyValuesHolder* valuesHolder = mValues[0];
|
||||
std::string oldName = valuesHolder->getPropertyName();
|
||||
//valuesHolder->setProperty(property);
|
||||
auto it=mValuesMap.find(oldName);
|
||||
if(it!=mValuesMap.end()){
|
||||
mValuesMap.erase(it);
|
||||
}
|
||||
mValuesMap.insert(std::map<const std::string,PropertyValuesHolder*>::value_type(mPropertyName,valuesHolder));
|
||||
}
|
||||
if (mProperty != nullptr) {
|
||||
mPropertyName = property.getName();
|
||||
|
@ -14,6 +14,10 @@ PropertyValuesHolder::PropertyValuesHolder(const std::string&name){
|
||||
mProperty=nullptr;
|
||||
}
|
||||
|
||||
PropertyValuesHolder::~PropertyValuesHolder(){
|
||||
delete mProperty;
|
||||
}
|
||||
|
||||
void PropertyValuesHolder::setPropertyName(const std::string& propertyName){
|
||||
mPropertyName=propertyName;
|
||||
}
|
||||
@ -22,8 +26,12 @@ const std::string PropertyValuesHolder::getPropertyName()const{
|
||||
return mPropertyName;
|
||||
}
|
||||
|
||||
PropertyValuesHolder::~PropertyValuesHolder(){
|
||||
delete mProperty;
|
||||
void PropertyValuesHolder::setProperty(Property*p){
|
||||
mProperty =p;
|
||||
}
|
||||
|
||||
Property*PropertyValuesHolder::getProperty(){
|
||||
return mProperty;
|
||||
}
|
||||
|
||||
PropertyValuesHolder* PropertyValuesHolder::ofInt(const std::string&name,const std::vector<int>&values){
|
||||
|
@ -19,12 +19,14 @@ protected:
|
||||
Property*mProperty;
|
||||
public:
|
||||
PropertyValuesHolder();
|
||||
virtual ~PropertyValuesHolder();
|
||||
PropertyValuesHolder(Property*prop);
|
||||
PropertyValuesHolder(const std::string&name);
|
||||
void setPropertyName(const std::string& propertyName);
|
||||
const std::string getPropertyName()const;
|
||||
void setProperty(Property*p);
|
||||
Property*getProperty();
|
||||
virtual void setFraction(void*target,float fraction)=0;
|
||||
virtual ~PropertyValuesHolder();
|
||||
static PropertyValuesHolder*ofInt(const std::string&name,const std::vector<int>&);
|
||||
static PropertyValuesHolder*ofInt(Property*,const std::vector<int>&);
|
||||
static PropertyValuesHolder*ofFloat(const std::string&name,const std::vector<float>&);
|
||||
|
@ -180,8 +180,8 @@ void ProgressBar::setVisualProgress(int id, float progress){
|
||||
d = mCurrentDrawable;
|
||||
}
|
||||
}
|
||||
if (d != nullptr) d->setLevel((progress * MAX_LEVEL));
|
||||
invalidate(true);
|
||||
if (d) d->setLevel((progress * MAX_LEVEL));
|
||||
else invalidate(true);
|
||||
onVisualProgressChanged(id, progress);
|
||||
}
|
||||
|
||||
@ -208,7 +208,6 @@ void ProgressBar::doRefreshProgress(int id, int progress, bool fromUser,bool cal
|
||||
} else {
|
||||
setVisualProgress(id, scale);
|
||||
}
|
||||
|
||||
if (isPrimary && callBackToApp) {
|
||||
onProgressRefresh(scale, fromUser, progress);
|
||||
}
|
||||
@ -250,7 +249,7 @@ void ProgressBar::refreshProgress(int id, int progress, bool fromUser,bool anima
|
||||
}
|
||||
mRefreshIsPosted=false;
|
||||
};
|
||||
postDelayed(mRefreshProgressRunnable,10);
|
||||
post(mRefreshProgressRunnable);
|
||||
mRefreshIsPosted=true;
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ bool Window::dispatchKeyEvent(KeyEvent&event){
|
||||
View* focused =getFocusedChild();
|
||||
bool handled=false;
|
||||
const int action=event.getAction();
|
||||
if(focused && focus->dispatchKeyEvent(event))
|
||||
if(focused && focused->dispatchKeyEvent(event))
|
||||
return true;
|
||||
int groupNavigationDirection = 0;
|
||||
if (action == KeyEvent::ACTION_DOWN && event.getKeyCode() == KEY_TAB) {
|
||||
@ -230,20 +230,11 @@ bool Window::dispatchKeyEvent(KeyEvent&event){
|
||||
|
||||
bool Window::performFocusNavigation(KeyEvent& event){
|
||||
int direction = -1;
|
||||
//从下面代码可以看出,switch语句在此的主要作用是判断焦点的方向
|
||||
switch (event.getKeyCode()) {
|
||||
case KEY_DPAD_LEFT:
|
||||
direction = View::FOCUS_LEFT;
|
||||
break;
|
||||
case KEY_DPAD_RIGHT:
|
||||
direction = View::FOCUS_RIGHT;
|
||||
break;
|
||||
case KEY_DPAD_UP:
|
||||
direction = View::FOCUS_UP;
|
||||
break;
|
||||
case KEY_DPAD_DOWN:
|
||||
direction = View::FOCUS_DOWN;
|
||||
break;
|
||||
case KEY_DPAD_LEFT: direction = View::FOCUS_LEFT; break;
|
||||
case KEY_DPAD_RIGHT: direction = View::FOCUS_RIGHT; break;
|
||||
case KEY_DPAD_UP: direction = View::FOCUS_UP; break;
|
||||
case KEY_DPAD_DOWN: direction = View::FOCUS_DOWN; break;
|
||||
case KEY_TAB:
|
||||
if (event.hasNoModifiers()) {
|
||||
direction = View::FOCUS_FORWARD;
|
||||
@ -266,7 +257,7 @@ bool Window::performFocusNavigation(KeyEvent& event){
|
||||
mView->offsetDescendantRectToMyCoords(focused, mTempRect);
|
||||
mView->offsetRectIntoDescendantCoords(v, mTempRect);
|
||||
}
|
||||
LOGV("request focus at rect(%d,%d-%d,%d)",mTempRect.left,mTempRect.top,mTempRect.width,mTempRect.height);
|
||||
LOGV("request focus at rect(%d,%d-%d,%d)",mTempRect.left,mTempRect.top,mTempRect.width,mTempRect.height);
|
||||
if (v->requestFocus(direction, &mTempRect)) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user