mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-09 23:57:39 +08:00
make colorstatelist shareable ,no free is needed,more easy to use
This commit is contained in:
parent
9aa34cbf2a
commit
97b3ec262a
@ -447,14 +447,14 @@ ColorStateList* Assets::getColorStateList(const std::string&fullresid) {
|
||||
if( its!=mStateColors.end())
|
||||
return its->second;
|
||||
else if(itc != mColors.end()){
|
||||
ColorStateList* cls = ColorStateList::valueOf(itc->second);
|
||||
ColorStateList* cls = new ColorStateList(itc->second);
|
||||
mStateColors.insert(std::pair<const std::string,ColorStateList*>(fullresid,cls));
|
||||
return cls;
|
||||
}else if( (itc == mColors.end()) && (name.empty()==false) ) {
|
||||
size_t slashpos = fullresid.find("/");
|
||||
if( (fullresid[0]=='#') || (slashpos==std::string::npos) ) {/*digital colors*/
|
||||
const int color = Color::parseColor(fullresid);
|
||||
ColorStateList* cls = ColorStateList::valueOf(color);
|
||||
ColorStateList* cls = new ColorStateList(color);
|
||||
mStateColors.insert(std::pair<const std::string,ColorStateList*>(fullresid,cls));
|
||||
return cls;
|
||||
}
|
||||
@ -464,7 +464,7 @@ ColorStateList* Assets::getColorStateList(const std::string&fullresid) {
|
||||
realName = mTheme.getString(realName);
|
||||
itc = mColors.find(realName);
|
||||
if(itc != mColors.end()){
|
||||
ColorStateList* cls = ColorStateList::valueOf(itc->second);
|
||||
ColorStateList* cls = new ColorStateList(itc->second);
|
||||
mStateColors.insert(std::pair<const std::string,ColorStateList*>(fullresid,cls));
|
||||
return cls;
|
||||
}
|
||||
|
@ -208,22 +208,11 @@ int BitmapDrawable::getOpacity(){
|
||||
}
|
||||
|
||||
void BitmapDrawable::setTintList(const ColorStateList*tint){
|
||||
if( tint == nullptr ){
|
||||
delete mBitmapState->mTint;
|
||||
mBitmapState->mTint = nullptr;
|
||||
delete mTintFilter;
|
||||
mTintFilter = nullptr;
|
||||
}else{
|
||||
if(mBitmapState->mTint) *mBitmapState->mTint = *tint;
|
||||
else mBitmapState->mTint = new ColorStateList(*tint);
|
||||
mTintFilter = updateTintFilter(mTintFilter, tint, mBitmapState->mTintMode);
|
||||
}LOGD("%p tint=%p",this,tint);
|
||||
invalidateSelf();
|
||||
/*if (*mBitmapState->mTint != *tint) {
|
||||
*mBitmapState->mTint = new ColorStateList(*tint);//must deep copy
|
||||
if( mBitmapState->mTint!=tint ){
|
||||
mBitmapState->mTint = tint;
|
||||
mTintFilter = updateTintFilter(mTintFilter, tint, mBitmapState->mTintMode);
|
||||
invalidateSelf();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapDrawable::setTintMode(int tintMode) {
|
||||
|
@ -22,7 +22,7 @@ private:
|
||||
bool mAutoMirrored;
|
||||
int mChangingConfigurations;
|
||||
std::vector<int>mThemeAttrs;
|
||||
ColorStateList* mTint;
|
||||
const ColorStateList* mTint;
|
||||
int mTintMode;
|
||||
int mTileModeX;
|
||||
int mTileModeY;
|
||||
|
@ -100,19 +100,11 @@ int ColorDrawable::getChangingConfigurations()const{
|
||||
}
|
||||
|
||||
void ColorDrawable::setTintList(const ColorStateList* tint){
|
||||
if( tint ==nullptr){
|
||||
delete mColorState->mTint;
|
||||
mColorState->mTint = nullptr;
|
||||
delete mTintFilter;
|
||||
}else{
|
||||
if(mColorState->mTint) *mColorState->mTint = *tint;
|
||||
else mColorState->mTint =new ColorStateList(*tint);
|
||||
if( mColorState->mTint!=tint ){
|
||||
mColorState->mTint = tint;
|
||||
mTintFilter = updateTintFilter(mTintFilter, tint, mColorState->mTintMode);
|
||||
invalidateSelf();
|
||||
}
|
||||
invalidateSelf();
|
||||
/*mColorState->mTint = tint;
|
||||
mTintFilter = updateTintFilter(mTintFilter, tint, mColorState->mTintMode);
|
||||
invalidateSelf();*/
|
||||
}
|
||||
|
||||
void ColorDrawable::setTintMode(int tintMode) {
|
||||
|
@ -9,7 +9,7 @@ private:
|
||||
public:
|
||||
uint32_t mBaseColor;// base color, independent of setAlpha()
|
||||
uint32_t mUseColor; // basecolor modulated by setAlpha()
|
||||
ColorStateList*mTint;
|
||||
const ColorStateList*mTint;
|
||||
int mTintMode;
|
||||
ColorState();
|
||||
ColorState(const ColorState& state);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <drawables/colorstatelist.h>
|
||||
#include <color.h>
|
||||
#include <core/color.h>
|
||||
#include <core/app.h>
|
||||
#include <drawables/stateset.h>
|
||||
#include <attributeset.h>
|
||||
#include <expat.h>
|
||||
@ -33,6 +34,10 @@ ColorStateList::ColorStateList(const std::vector<std::vector<int>>&states,const
|
||||
onColorsChanged();
|
||||
}
|
||||
|
||||
ColorStateList::~ColorStateList(){
|
||||
LOGV("%p====",this);
|
||||
}
|
||||
|
||||
void ColorStateList::dump()const{
|
||||
std::ostringstream oss;
|
||||
for(int i=0;i<mColors.size();i++){
|
||||
@ -147,7 +152,9 @@ int ColorStateList::getColorForState(const std::vector<int>&stateSet, int defaul
|
||||
}
|
||||
|
||||
ColorStateList*ColorStateList::valueOf(int color){
|
||||
return new ColorStateList(color);
|
||||
char buf[32];
|
||||
sprintf(buf,"#%06x",color);
|
||||
return App::getInstance().getColorStateList(buf);
|
||||
}
|
||||
|
||||
const std::vector<int>& ColorStateList::getColors()const{
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
ColorStateList(int color);
|
||||
ColorStateList(const ColorStateList&other);
|
||||
ColorStateList(const std::vector<std::vector<int>>&states,const std::vector<int>&colors);
|
||||
~ColorStateList();
|
||||
int addStateColor(const std::vector<int>&stateSet,int color);
|
||||
int getDefaultColor()const override;
|
||||
bool isOpaque()const;
|
||||
|
@ -109,8 +109,7 @@ void Drawable::setColorFilter(int color,PorterDuffMode mode) {
|
||||
}
|
||||
|
||||
void Drawable::setTint(int color) {
|
||||
ColorStateList cls(color);
|
||||
setTintList(&cls);
|
||||
setTintList(ColorStateList::valueOf(color));
|
||||
}
|
||||
|
||||
PorterDuffColorFilter *Drawable::updateTintFilter(PorterDuffColorFilter* tintFilter,const ColorStateList* tint,int tintMode) {
|
||||
|
@ -414,24 +414,11 @@ void DrawableContainer::setColorFilter(ColorFilter*colorFilter){
|
||||
}
|
||||
|
||||
void DrawableContainer::setTintList(const ColorStateList*tint){
|
||||
if( tint == nullptr ){
|
||||
delete mDrawableContainerState->mTintList;
|
||||
mDrawableContainerState->mTintList = nullptr;
|
||||
}else{
|
||||
if(mDrawableContainerState->mTintList)
|
||||
*mDrawableContainerState->mTintList = *tint;
|
||||
else
|
||||
mDrawableContainerState->mTintList = new ColorStateList(*tint);
|
||||
}
|
||||
if(mCurrDrawable)
|
||||
mCurrDrawable->setTintList(tint);
|
||||
/*if (mDrawableContainerState->mTintList != tint) {
|
||||
if( mDrawableContainerState->mTintList!=tint ){
|
||||
mDrawableContainerState->mTintList = tint;
|
||||
|
||||
if (mCurrDrawable) {
|
||||
if(mCurrDrawable)
|
||||
mCurrDrawable->setTintList(tint);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
void DrawableContainer::setTintMode(int tintMode){
|
||||
|
@ -36,7 +36,7 @@ protected:
|
||||
bool mAutoMirrored;
|
||||
int mTintMode;
|
||||
ColorFilter*mColorFilter;
|
||||
ColorStateList*mTintList;
|
||||
const ColorStateList*mTintList;
|
||||
std::vector<Drawable* >mDrawables;
|
||||
std::map<int,std::shared_ptr<ConstantState> >mDrawableFutures;
|
||||
DrawableContainerState(const DrawableContainerState*orig,DrawableContainer*own);
|
||||
|
@ -45,10 +45,10 @@ GradientDrawable::GradientState::GradientState(const GradientState& orig) {
|
||||
mGradient = orig.mGradient;
|
||||
mAngle = orig.mAngle;
|
||||
mOrientation = orig.mOrientation;
|
||||
mSolidColors = orig.mSolidColors ? new ColorStateList(*orig.mSolidColors):nullptr;
|
||||
mSolidColors = orig.mSolidColors;
|
||||
mGradientColors = orig.mGradientColors;
|
||||
mPositions = orig.mPositions;
|
||||
mStrokeColors = orig.mStrokeColors?new ColorStateList(*orig.mStrokeColors):nullptr;
|
||||
mStrokeColors = orig.mStrokeColors;
|
||||
mStrokeWidth = orig.mStrokeWidth;
|
||||
mStrokeDashWidth = orig.mStrokeDashWidth;
|
||||
mStrokeDashGap = orig.mStrokeDashGap;
|
||||
@ -88,9 +88,9 @@ GradientDrawable::GradientState::GradientState(const GradientState& orig) {
|
||||
}
|
||||
|
||||
GradientDrawable::GradientState::~GradientState(){
|
||||
delete mTint;
|
||||
delete mStrokeColors;
|
||||
delete mSolidColors;
|
||||
//delete mTint;
|
||||
//delete mStrokeColors;
|
||||
//delete mSolidColors;
|
||||
}
|
||||
|
||||
void GradientDrawable::GradientState::setDensity(int targetDensity) {
|
||||
@ -158,12 +158,8 @@ void GradientDrawable::GradientState::setShape( int shape) {
|
||||
|
||||
void GradientDrawable::GradientState::setSolidColors(const ColorStateList*colors) {
|
||||
mGradientColors.clear();
|
||||
if(colors==nullptr){
|
||||
delete mSolidColors;
|
||||
mSolidColors = nullptr;
|
||||
}else{
|
||||
if(mSolidColors)*mSolidColors=*colors;
|
||||
else mSolidColors = new ColorStateList(*colors);
|
||||
if(mSolidColors!=colors){
|
||||
mSolidColors = colors;
|
||||
}
|
||||
computeOpacity();
|
||||
}
|
||||
@ -205,12 +201,8 @@ void GradientDrawable::GradientState::computeOpacity() {
|
||||
|
||||
void GradientDrawable::GradientState::setStroke(int width,const ColorStateList*colors, float dashWidth,float dashGap) {
|
||||
mStrokeWidth = width;
|
||||
if(colors==nullptr){
|
||||
delete mStrokeColors;
|
||||
mStrokeColors = nullptr;
|
||||
}else{
|
||||
if(mStrokeColors)*mStrokeColors=*colors;
|
||||
else mStrokeColors = new ColorStateList(*colors);
|
||||
if(mStrokeColors!=colors){
|
||||
mStrokeColors = colors;
|
||||
}
|
||||
mStrokeDashWidth = dashWidth;
|
||||
mStrokeDashGap = dashGap;
|
||||
@ -340,8 +332,7 @@ void GradientDrawable::setStroke(int width, const ColorStateList*colorStateList)
|
||||
}
|
||||
|
||||
void GradientDrawable::setStroke(int width,int color, float dashWidth, float dashGap) {
|
||||
ColorStateList cls(color);
|
||||
mGradientState->setStroke(width, &cls, dashWidth, dashGap);
|
||||
mGradientState->setStroke(width, ColorStateList::valueOf(color), dashWidth, dashGap);
|
||||
setStrokeInternal(width, color, dashWidth, dashGap);
|
||||
}
|
||||
|
||||
@ -547,8 +538,7 @@ void GradientDrawable::buildPathIfDirty() {
|
||||
|
||||
void GradientDrawable::setColor(int argb) {
|
||||
Color c(argb);
|
||||
ColorStateList cls(argb);
|
||||
mGradientState->setSolidColors(&cls);
|
||||
mGradientState->setSolidColors(ColorStateList::valueOf(argb));
|
||||
mFillPaint = SolidPattern::create_rgba(c.red(),c.green(),c.blue(),c.alpha());
|
||||
invalidateSelf();
|
||||
}
|
||||
@ -567,7 +557,7 @@ void GradientDrawable::setColor(const ColorStateList* colorStateList) {
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
ColorStateList* GradientDrawable::getColor() {
|
||||
const ColorStateList* GradientDrawable::getColor() {
|
||||
return mGradientState->mSolidColors;
|
||||
}
|
||||
|
||||
@ -575,7 +565,7 @@ bool GradientDrawable::onStateChange(const std::vector<int>& stateSet) {
|
||||
bool bInvalidateSelf = false;
|
||||
|
||||
GradientState& s = *mGradientState;
|
||||
ColorStateList* solidColors = s.mSolidColors;
|
||||
const ColorStateList* solidColors = s.mSolidColors;
|
||||
double r,g,b,a;
|
||||
if (solidColors != nullptr) {
|
||||
RefPtr<Cairo::SolidPattern>pat = std::dynamic_pointer_cast<Cairo::SolidPattern>(mFillPaint);
|
||||
@ -590,7 +580,7 @@ bool GradientDrawable::onStateChange(const std::vector<int>& stateSet) {
|
||||
}
|
||||
|
||||
if (mStrokePaint != nullptr) {
|
||||
ColorStateList* strokeColors = s.mStrokeColors;
|
||||
const ColorStateList* strokeColors = s.mStrokeColors;
|
||||
if (strokeColors ) {
|
||||
RefPtr<Cairo::SolidPattern>pat = std::dynamic_pointer_cast<Cairo::SolidPattern>(mStrokePaint);
|
||||
pat->get_rgba(r,g,b,a);
|
||||
|
@ -48,8 +48,8 @@ private:
|
||||
int mGradient;// = LINEAR_GRADIENT
|
||||
int mAngle;
|
||||
Orientation mOrientation;
|
||||
ColorStateList* mSolidColors;
|
||||
ColorStateList* mStrokeColors;
|
||||
const ColorStateList* mSolidColors;
|
||||
const ColorStateList* mStrokeColors;
|
||||
std::vector<int>mGradientColors;
|
||||
std::vector<float>mPositions;
|
||||
int mStrokeWidth;
|
||||
@ -74,7 +74,7 @@ private:
|
||||
bool mUseLevelForShape;
|
||||
bool mOpaqueOverBounds;
|
||||
bool mOpaqueOverShape;
|
||||
ColorStateList*mTint;
|
||||
const ColorStateList*mTint;
|
||||
int mTintMode;
|
||||
int mDensity;
|
||||
std::vector<int>mAttrSize;
|
||||
@ -176,7 +176,7 @@ public:
|
||||
const std::vector<int>&getColors()const;
|
||||
void setColor(int argb);
|
||||
void setColor(const ColorStateList* colorStateList);
|
||||
ColorStateList* getColor();
|
||||
const ColorStateList* getColor();
|
||||
bool isStateful()const override;
|
||||
bool hasFocusStateSpecified()const override;
|
||||
int getChangingConfigurations()const override;
|
||||
|
@ -113,21 +113,11 @@ int NinePatchDrawable::getAlpha()const{
|
||||
}
|
||||
|
||||
void NinePatchDrawable::setTintList(const ColorStateList* tint){
|
||||
if( tint == nullptr ){
|
||||
delete mNinePatchState->mTint;
|
||||
delete mTintFilter;
|
||||
mNinePatchState->mTint = nullptr;
|
||||
}else{
|
||||
if(mNinePatchState->mTint)
|
||||
*mNinePatchState->mTint = *tint;
|
||||
else
|
||||
mNinePatchState->mTint = new ColorStateList(*tint);
|
||||
if( mNinePatchState->mTint!=tint ){
|
||||
mNinePatchState->mTint = tint;
|
||||
mTintFilter = updateTintFilter(mTintFilter, tint, mNinePatchState->mTintMode);
|
||||
invalidateSelf();
|
||||
}
|
||||
invalidateSelf();
|
||||
/*mNinePatchState->mTint = tint;
|
||||
mTintFilter = updateTintFilter(mTintFilter, tint, mNinePatchState->mTintMode);
|
||||
invalidateSelf();*/
|
||||
}
|
||||
|
||||
void NinePatchDrawable::setTintMode(int tintMode) {
|
||||
|
@ -16,8 +16,8 @@ private:
|
||||
Insets mOpticalInsets;
|
||||
int mTintMode;
|
||||
int mChangingConfigurations;
|
||||
ColorStateList*mTint;
|
||||
Cairo::RefPtr<NinePatch>mNinePatch;
|
||||
const ColorStateList*mTint;
|
||||
Cairo::RefPtr<NinePatch>mNinePatch;
|
||||
NinePatchState();
|
||||
NinePatchState(const NinePatchState&state);
|
||||
NinePatchState(Cairo::RefPtr<Cairo::ImageSurface>bitmap,const Rect*padding=nullptr);
|
||||
|
@ -134,19 +134,11 @@ int ShapeDrawable::getOpacity(){
|
||||
}
|
||||
|
||||
void ShapeDrawable::setTintList(const ColorStateList*tint){
|
||||
if( tint ==nullptr){
|
||||
delete mShapeState->mTint;
|
||||
mShapeState->mTint = nullptr;
|
||||
delete mTintFilter;
|
||||
}else{
|
||||
if(mShapeState->mTint)*mShapeState->mTint=*tint;
|
||||
else mShapeState->mTint = new ColorStateList(*tint);
|
||||
if( mShapeState->mTint!=tint ){
|
||||
mShapeState->mTint =tint;
|
||||
mTintFilter = updateTintFilter(mTintFilter,tint,mShapeState->mTintMode);
|
||||
invalidateSelf();
|
||||
}
|
||||
invalidateSelf();
|
||||
/*mShapeState->mTint = tint;
|
||||
mTintFilter = updateTintFilter(mTintFilter,tint,mShapeState->mTintMode);
|
||||
invalidateSelf();*/
|
||||
}
|
||||
|
||||
void ShapeDrawable::setTintMode(int tintMode){
|
||||
|
@ -10,7 +10,7 @@ private:
|
||||
class ShapeState:public std::enable_shared_from_this<ShapeState>,public ConstantState{
|
||||
public:
|
||||
Shape*mShape;
|
||||
ColorStateList* mTint;
|
||||
const ColorStateList* mTint;
|
||||
int mTintMode;
|
||||
Rect mPadding;
|
||||
int mChangingConfigurations;
|
||||
|
@ -1075,14 +1075,14 @@ void View::clearAnimation() {
|
||||
if (mCurrentAnimation ) {
|
||||
mCurrentAnimation->detach();
|
||||
}
|
||||
delete mCurrentAnimation;
|
||||
//delete mCurrentAnimation;
|
||||
mCurrentAnimation = nullptr;
|
||||
invalidateParentIfNeeded();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void View::setAnimation(Animation* animation) {
|
||||
delete mCurrentAnimation;
|
||||
//delete mCurrentAnimation;
|
||||
mCurrentAnimation = animation;
|
||||
if (animation) {
|
||||
// If the screen is off assume the animation start time is now instead of
|
||||
@ -1536,7 +1536,8 @@ void View::onDetachedFromWindowInternal() {
|
||||
destroyDrawingCache();
|
||||
|
||||
cleanupDraw();
|
||||
delete mCurrentAnimation;
|
||||
if(mCurrentAnimation)mCurrentAnimation->detach();
|
||||
//delete mCurrentAnimation;
|
||||
mCurrentAnimation = nullptr;
|
||||
|
||||
if ((mViewFlags & TOOLTIP) == TOOLTIP) {
|
||||
@ -3972,20 +3973,15 @@ View& View::setBackgroundTintList(const ColorStateList* tint){
|
||||
if (mBackgroundTint == nullptr) {
|
||||
mBackgroundTint = new TintInfo();
|
||||
}
|
||||
if(tint==nullptr){
|
||||
delete mBackgroundTint->mTintList;
|
||||
mBackgroundTint->mTintList=nullptr;
|
||||
}else{
|
||||
if(mBackgroundTint->mTintList)*mBackgroundTint->mTintList = *tint;
|
||||
else mBackgroundTint->mTintList=new ColorStateList(*tint);
|
||||
if(mBackgroundTint->mTintList!=tint){
|
||||
mBackgroundTint->mTintList = tint;
|
||||
mBackgroundTint->mHasTintList = (tint!=nullptr);
|
||||
applyBackgroundTint();
|
||||
}
|
||||
mBackgroundTint->mHasTintList = (tint!=nullptr);
|
||||
|
||||
applyBackgroundTint();
|
||||
return *this;
|
||||
}
|
||||
|
||||
ColorStateList* View::getBackgroundTintList()const{
|
||||
const ColorStateList* View::getBackgroundTintList()const{
|
||||
return mBackgroundTint != nullptr ? mBackgroundTint->mTintList : nullptr;
|
||||
}
|
||||
|
||||
@ -4085,17 +4081,11 @@ View& View::setForegroundTintList(const ColorStateList* tint){
|
||||
if (mForegroundInfo->mTintInfo == nullptr) {
|
||||
mForegroundInfo->mTintInfo = new TintInfo();
|
||||
}
|
||||
if(tint == nullptr){
|
||||
delete mForegroundInfo->mTintInfo->mTintList;
|
||||
mForegroundInfo->mTintInfo->mTintList=nullptr;
|
||||
}else{
|
||||
if(mForegroundInfo->mTintInfo->mTintList)
|
||||
*mForegroundInfo->mTintInfo->mTintList = *tint;
|
||||
else
|
||||
mForegroundInfo->mTintInfo->mTintList=new ColorStateList(*tint);
|
||||
if(mForegroundInfo->mTintInfo->mTintList!=tint){
|
||||
mForegroundInfo->mTintInfo->mTintList = tint;
|
||||
mForegroundInfo->mTintInfo->mHasTintList = (tint!=nullptr);
|
||||
applyForegroundTint();
|
||||
}
|
||||
mForegroundInfo->mTintInfo->mHasTintList = (tint!=nullptr);
|
||||
applyForegroundTint();
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -4113,7 +4103,7 @@ View& View::setForegroundTintMode(int tintMode){
|
||||
return *this;
|
||||
}
|
||||
|
||||
ColorStateList* View::getForegroundTintList(){
|
||||
const ColorStateList* View::getForegroundTintList(){
|
||||
return mForegroundInfo != nullptr && mForegroundInfo->mTintInfo != nullptr
|
||||
? mForegroundInfo->mTintInfo->mTintList : nullptr;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ protected:
|
||||
|
||||
class TintInfo{
|
||||
public:
|
||||
ColorStateList*mTintList;
|
||||
const ColorStateList*mTintList;
|
||||
int mBlendMode;
|
||||
int mTintMode;
|
||||
bool mHasTintMode;
|
||||
@ -878,7 +878,7 @@ public:
|
||||
View& setForegroundGravity(int gravity);
|
||||
View& setForegroundTintList(const ColorStateList* tint);
|
||||
View& setForegroundTintMode(int tintMode);
|
||||
ColorStateList* getForegroundTintList();
|
||||
const ColorStateList* getForegroundTintList();
|
||||
virtual void onResolveDrawables(int layoutDirection);
|
||||
|
||||
virtual void jumpDrawablesToCurrentState();
|
||||
@ -888,7 +888,7 @@ public:
|
||||
View& setBackgroundResource(const std::string&resid);
|
||||
View& setBackgroundTintList(const ColorStateList* tint);
|
||||
View& setBackgroundTintMode(int tintMode);
|
||||
ColorStateList* getBackgroundTintList()const;
|
||||
const ColorStateList* getBackgroundTintList()const;
|
||||
virtual int getSolidColor()const;
|
||||
|
||||
bool isTemporarilyDetached()const;
|
||||
|
@ -1983,7 +1983,7 @@ void AbsListView::onDetachedFromWindow() {
|
||||
void AbsListView::onWindowFocusChanged(bool hasWindowFocus) {
|
||||
AdapterView::onWindowFocusChanged(hasWindowFocus);
|
||||
|
||||
int touchMode = isInTouchMode() ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
|
||||
const int touchMode = isInTouchMode() ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
|
||||
|
||||
if (!hasWindowFocus) {
|
||||
setChildrenDrawingCacheEnabled(false);
|
||||
@ -2333,6 +2333,7 @@ void AbsListView::onSecondaryPointerUp(MotionEvent& ev) {
|
||||
}
|
||||
|
||||
void AbsListView::onTouchModeChanged(bool isInTouchMode) {
|
||||
LOGV("%p:%d mTouchMode=%d isInTouchMode=%d",this,mID,mTouchMode,isInTouchMode);
|
||||
if (isInTouchMode) {
|
||||
// Get rid of the selection when we enter touch mode
|
||||
hideSelector();
|
||||
|
@ -84,20 +84,14 @@ void AnalogClock::setDial(Icon icon) {
|
||||
}
|
||||
|
||||
void AnalogClock::setDialTintList(const ColorStateList* tint) {
|
||||
if(tint==nullptr){
|
||||
delete mDialTintInfo->mTintList;
|
||||
mDialTintInfo->mTintList = nullptr;
|
||||
}else{
|
||||
if(mDialTintInfo->mTintList)
|
||||
*mDialTintInfo->mTintList=*tint;
|
||||
else
|
||||
mDialTintInfo->mTintList = new ColorStateList(*tint);
|
||||
if(mDialTintInfo->mTintList!=tint){
|
||||
mDialTintInfo->mTintList = tint;
|
||||
mDialTintInfo->mHasTintList = (tint!=nullptr);
|
||||
mDial = apply(mDialTintInfo,mDial);
|
||||
}
|
||||
mDialTintInfo->mHasTintList = (tint!=nullptr);
|
||||
mDial = apply(mDialTintInfo,mDial);
|
||||
}
|
||||
|
||||
ColorStateList* AnalogClock::getDialTintList()const {
|
||||
const ColorStateList* AnalogClock::getDialTintList()const {
|
||||
return mDialTintInfo->mTintList;
|
||||
}
|
||||
|
||||
@ -112,18 +106,14 @@ void AnalogClock::setHourHand(Icon icon) {
|
||||
}
|
||||
|
||||
void AnalogClock::setHourHandTintList(const ColorStateList* tint) {
|
||||
if(tint==nullptr){
|
||||
delete mHourHandTintInfo->mTintList;
|
||||
mHourHandTintInfo->mTintList=nullptr;
|
||||
}else{
|
||||
if(mHourHandTintInfo->mTintList)*mHourHandTintInfo->mTintList=*tint;
|
||||
else mHourHandTintInfo->mTintList = new ColorStateList(*tint);
|
||||
if(mHourHandTintInfo->mTintList!=tint){
|
||||
mHourHandTintInfo->mTintList = tint;
|
||||
mHourHandTintInfo->mHasTintList = (tint!=nullptr);
|
||||
mHourHand = apply(mHourHandTintInfo,mHourHand);
|
||||
}
|
||||
mHourHandTintInfo->mHasTintList = (tint!=nullptr);
|
||||
mHourHand = apply(mHourHandTintInfo,mHourHand);
|
||||
}
|
||||
|
||||
ColorStateList* AnalogClock::getHourHandTintList()const{
|
||||
const ColorStateList* AnalogClock::getHourHandTintList()const{
|
||||
return mHourHandTintInfo->mTintList;
|
||||
}
|
||||
|
||||
@ -148,18 +138,14 @@ void AnalogClock::setSecondHand(Icon icon) {
|
||||
}
|
||||
|
||||
void AnalogClock::setMinuteHandTintList(const ColorStateList* tint) {
|
||||
if(tint==nullptr){
|
||||
delete mMinuteHandTintInfo->mTintList;
|
||||
mMinuteHandTintInfo->mTintList = nullptr;
|
||||
}else{
|
||||
if(mMinuteHandTintInfo->mTintList) *mMinuteHandTintInfo->mTintList=*tint;
|
||||
else mMinuteHandTintInfo->mTintList = new ColorStateList(*tint);
|
||||
if(mMinuteHandTintInfo->mTintList!=tint){
|
||||
mMinuteHandTintInfo->mTintList = tint;
|
||||
mMinuteHandTintInfo->mHasTintList = (tint!=nullptr);
|
||||
mMinuteHand = apply(mMinuteHandTintInfo,mMinuteHand);
|
||||
}
|
||||
mMinuteHandTintInfo->mHasTintList = (tint!=nullptr);
|
||||
mMinuteHand = apply(mMinuteHandTintInfo,mMinuteHand);
|
||||
}
|
||||
|
||||
ColorStateList* AnalogClock::getMinuteHandTintList()const{
|
||||
const ColorStateList* AnalogClock::getMinuteHandTintList()const{
|
||||
return mMinuteHandTintInfo->mTintList;
|
||||
}
|
||||
|
||||
|
@ -42,15 +42,15 @@ public:
|
||||
~AnalogClock();
|
||||
void setDial(Icon icon);
|
||||
void setDialTintList(const ColorStateList*);
|
||||
ColorStateList*getDialTintList()const;
|
||||
const ColorStateList*getDialTintList()const;
|
||||
|
||||
void setHourHand(Icon icon);
|
||||
void setHourHandTintList(const ColorStateList*);
|
||||
ColorStateList* getHourHandTintList()const;
|
||||
const ColorStateList* getHourHandTintList()const;
|
||||
|
||||
void setMinuteHand(Icon icon);
|
||||
void setMinuteHandTintList(const ColorStateList*);
|
||||
ColorStateList* getMinuteHandTintList()const;
|
||||
const ColorStateList* getMinuteHandTintList()const;
|
||||
|
||||
void setSecondHand(Icon icon);
|
||||
void setSecondHandTintList(const ColorStateList*);
|
||||
|
@ -18,8 +18,8 @@ CheckedTextView::CheckedTextView(Context* context,const AttributeSet& a):TextVie
|
||||
}
|
||||
|
||||
if (a.hasAttribute("checkMarkTint")) {
|
||||
//mCheckMarkTintList = a.getColorStateList("checkMarkTint");
|
||||
//mHasCheckMarkTint = true;
|
||||
mCheckMarkTintList = a.getColorStateList("checkMarkTint");
|
||||
mHasCheckMarkTint = (mCheckMarkTintList!=nullptr);
|
||||
}
|
||||
|
||||
mCheckMarkGravity = a.getGravity("checkMarkGravity", Gravity::END);
|
||||
@ -96,19 +96,14 @@ void CheckedTextView::setCheckMarkDrawableInternal(Drawable* d,const std::string
|
||||
}
|
||||
|
||||
void CheckedTextView::setCheckMarkTintList(const ColorStateList*tint){
|
||||
if(tint==nullptr){
|
||||
delete mCheckMarkTintList;
|
||||
mCheckMarkTintList = nullptr;
|
||||
}else{
|
||||
if(mCheckMarkTintList)*mCheckMarkTintList=*tint;
|
||||
else mCheckMarkTintList = new ColorStateList(*tint);
|
||||
if(mCheckMarkTintList!=tint){
|
||||
mCheckMarkTintList = tint;
|
||||
mHasCheckMarkTint = (tint!=nullptr);
|
||||
applyCheckMarkTint();
|
||||
}
|
||||
mHasCheckMarkTint = (tint!=nullptr);
|
||||
|
||||
applyCheckMarkTint();
|
||||
}
|
||||
|
||||
ColorStateList* CheckedTextView::getCheckMarkTintList()const{
|
||||
const ColorStateList* CheckedTextView::getCheckMarkTintList()const{
|
||||
return mCheckMarkTintList;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ private:
|
||||
|
||||
std::string mCheckMarkResource;
|
||||
Drawable* mCheckMarkDrawable;
|
||||
ColorStateList* mCheckMarkTintList = nullptr;
|
||||
const ColorStateList* mCheckMarkTintList;
|
||||
//BlendMode mCheckMarkBlendMode = null;
|
||||
bool mHasCheckMarkTint = false;
|
||||
bool mHasCheckMarkTintMode = false;
|
||||
@ -43,7 +43,7 @@ public:
|
||||
void setCheckMarkDrawable(const std::string&resId);
|
||||
void setCheckMarkDrawable(Drawable* d);
|
||||
void setCheckMarkTintList(const ColorStateList*tint);
|
||||
ColorStateList* getCheckMarkTintList()const;
|
||||
const ColorStateList* getCheckMarkTintList()const;
|
||||
View& setVisibility(int visibility)override;
|
||||
void jumpDrawablesToCurrentState()override;
|
||||
void onRtlPropertiesChanged(int layoutDirection)override;
|
||||
|
@ -127,14 +127,10 @@ void CompoundButton::jumpDrawablesToCurrentState(){
|
||||
}
|
||||
|
||||
void CompoundButton::setButtonTintList(const ColorStateList* tint) {
|
||||
if(tint==nullptr){
|
||||
delete mButtonTintList;
|
||||
mButtonTintList = nullptr;
|
||||
}else{
|
||||
if(mButtonTintList) *mButtonTintList=*tint;
|
||||
else mButtonTintList = new ColorStateList(*tint);
|
||||
if(mButtonTintList!=tint){
|
||||
mButtonTintList = tint;
|
||||
applyButtonTint();
|
||||
}
|
||||
applyButtonTint();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,7 +138,7 @@ void CompoundButton::setButtonTintList(const ColorStateList* tint) {
|
||||
* @attr ref android.R.styleable#CompoundButton_buttonTint
|
||||
* @see #setButtonTintList(const ColorStateList)
|
||||
*/
|
||||
ColorStateList* CompoundButton::getButtonTintList() const{
|
||||
const ColorStateList* CompoundButton::getButtonTintList() const{
|
||||
return mButtonTintList;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ private:
|
||||
bool mCheckedFromResource;
|
||||
int mButtonTintMode;
|
||||
Drawable* mButtonDrawable;
|
||||
ColorStateList*mButtonTintList;
|
||||
const ColorStateList*mButtonTintList;
|
||||
OnCheckedChangeListener mOnCheckedChangeListener;
|
||||
OnCheckedChangeListener mOnCheckedChangeWidgetListener;
|
||||
void initCompoundButton();
|
||||
@ -34,7 +34,7 @@ public:
|
||||
Drawable* getButtonDrawable()const;
|
||||
void jumpDrawablesToCurrentState()override;
|
||||
void setButtonTintList(const ColorStateList* tint);
|
||||
ColorStateList* getButtonTintList()const;
|
||||
const ColorStateList* getButtonTintList()const;
|
||||
void setButtonTintMode(PorterDuffMode tintMode);
|
||||
PorterDuffMode getButtonTintMode()const;
|
||||
int getCompoundPaddingLeft()override;
|
||||
|
@ -25,9 +25,9 @@ DayPickerPagerAdapter::DayPickerPagerAdapter(Context* context,const std::string&
|
||||
}
|
||||
|
||||
DayPickerPagerAdapter::~DayPickerPagerAdapter(){
|
||||
delete mCalendarTextColor;
|
||||
delete mDaySelectorColor;
|
||||
delete mDayHighlightColor;
|
||||
//delete mCalendarTextColor;
|
||||
//delete mDaySelectorColor;
|
||||
//delete mDayHighlightColor;
|
||||
}
|
||||
|
||||
void DayPickerPagerAdapter::setRange(Calendar& min,Calendar& max) {
|
||||
@ -96,25 +96,17 @@ void DayPickerPagerAdapter::setOnDaySelectedListener(OnDaySelectedListener liste
|
||||
}
|
||||
|
||||
void DayPickerPagerAdapter::setCalendarTextColor(const ColorStateList* calendarTextColor) {
|
||||
if(calendarTextColor==nullptr){
|
||||
delete mCalendarTextColor;
|
||||
mCalendarTextColor = nullptr;
|
||||
}else{
|
||||
if(mCalendarTextColor) *mCalendarTextColor=*calendarTextColor;
|
||||
else mCalendarTextColor = new ColorStateList(*calendarTextColor);
|
||||
if(mCalendarTextColor!=calendarTextColor){
|
||||
mCalendarTextColor = calendarTextColor;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
void DayPickerPagerAdapter::setDaySelectorColor(const ColorStateList* selectorColor) {
|
||||
if(selectorColor==nullptr){
|
||||
delete mDaySelectorColor;
|
||||
mDaySelectorColor = nullptr;
|
||||
}else{
|
||||
if(mDaySelectorColor) *mDaySelectorColor=*selectorColor;
|
||||
else mDaySelectorColor = new ColorStateList(*selectorColor);
|
||||
if(mDaySelectorColor!=selectorColor){
|
||||
mDaySelectorColor = selectorColor;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
void DayPickerPagerAdapter::setMonthTextAppearance(const std::string& resId) {
|
||||
|
@ -30,9 +30,9 @@ private:
|
||||
std::string mDayOfWeekTextAppearance;
|
||||
std::string mDayTextAppearance;
|
||||
|
||||
ColorStateList* mCalendarTextColor;
|
||||
ColorStateList* mDaySelectorColor;
|
||||
ColorStateList* mDayHighlightColor;
|
||||
const ColorStateList* mCalendarTextColor;
|
||||
const ColorStateList* mDaySelectorColor;
|
||||
const ColorStateList* mDayHighlightColor;
|
||||
|
||||
SimpleMonthView::OnDayClickListener mOnDayClickListener;
|
||||
OnDaySelectedListener mOnDaySelectedListener;
|
||||
|
@ -546,18 +546,14 @@ void ImageView::setImageResource(const std::string& resId) {
|
||||
}
|
||||
|
||||
void ImageView::setImageTintList(const ColorStateList*tint){
|
||||
if(tint==nullptr){
|
||||
delete mDrawableTintList;
|
||||
mDrawableTintList = nullptr;
|
||||
}else{
|
||||
if(mDrawableTintList) *mDrawableTintList=*tint;
|
||||
else mDrawableTintList = new ColorStateList(*tint);
|
||||
if(mDrawableTintList!=tint){
|
||||
mDrawableTintList = tint;
|
||||
mHasDrawableTint = (tint!=nullptr);
|
||||
applyImageTint();
|
||||
}
|
||||
mHasDrawableTint = (tint!=nullptr);
|
||||
applyImageTint();
|
||||
}
|
||||
|
||||
ColorStateList* ImageView::getImageTintList(){
|
||||
const ColorStateList* ImageView::getImageTintList(){
|
||||
return mDrawableTintList;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ protected:
|
||||
std::vector<int>mState;
|
||||
Drawable*mDrawable;
|
||||
ColorFilter*mColorFilter;
|
||||
ColorStateList*mDrawableTintList;
|
||||
const ColorStateList*mDrawableTintList;
|
||||
int mDrawableTintMode;
|
||||
BitmapDrawable*mRecycleableBitmapDrawable;
|
||||
Matrix mMatrix;
|
||||
@ -90,7 +90,7 @@ public:
|
||||
void setImageDrawable(Drawable* drawable);
|
||||
void setImageBitmap(Cairo::RefPtr<Cairo::ImageSurface>bitmap);
|
||||
void setImageTintList(const ColorStateList*tint);
|
||||
ColorStateList* getImageTintList();
|
||||
const ColorStateList* getImageTintList();
|
||||
void setImageTintMode(int mode);
|
||||
int getImageTintMode()const;
|
||||
void setColorFilter(int color,int mode);
|
||||
|
@ -1501,6 +1501,34 @@ static int constrain(int amount, int low, int high) {//get the
|
||||
return amount < low ? low : (amount > high ? high : amount);
|
||||
}
|
||||
|
||||
int ListView::lookForSelectablePosition(int position, bool lookDown) {
|
||||
Adapter* adapter = mAdapter;
|
||||
if (adapter == nullptr || isInTouchMode()) {
|
||||
return INVALID_POSITION;
|
||||
}
|
||||
|
||||
const int count = adapter->getCount();
|
||||
if (!mAreAllItemsSelectable) {
|
||||
if (lookDown) {
|
||||
position = std::max(0, position);
|
||||
while (position < count && !adapter->isEnabled(position)) {
|
||||
position++;
|
||||
}
|
||||
} else {
|
||||
position = std::min(position, count - 1);
|
||||
while (position >= 0 && !adapter->isEnabled(position)) {
|
||||
position--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (position < 0 || position >= count) {
|
||||
return INVALID_POSITION;
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
int ListView::lookForSelectablePositionAfter(int current, int position, bool lookDown) {
|
||||
if (mAdapter == nullptr || isInTouchMode()) {
|
||||
return INVALID_POSITION;
|
||||
|
@ -171,6 +171,7 @@ public:
|
||||
Drawable* getOverscrollFooter()const;
|
||||
int measureHeightOfChildren(int widthMeasureSpec, int startPosition, int endPosition,
|
||||
int maxHeight, int disallowPartialChildPosition);
|
||||
int lookForSelectablePosition(int position, bool lookDown)override;
|
||||
void addHeaderView(View* v,void* data, bool isSelectable);
|
||||
void addHeaderView(View* v);
|
||||
int getHeaderViewsCount()const;
|
||||
|
@ -91,7 +91,7 @@ NumberPicker::NumberPicker(Context* context,const AttributeSet& atts)
|
||||
setTextColor(atts.getColor("textColor"));
|
||||
setTextColor(mTextColor,atts.getColor("textColor2",mTextColor));
|
||||
setSelectedTextColor(atts.getColor("selectedTextColor"));
|
||||
ColorStateList*colors = mSelectedText->getTextColors();
|
||||
const ColorStateList*colors = mSelectedText->getTextColors();
|
||||
if(colors->isStateful())
|
||||
setSelectedTextColor(colors->getColorForState(StateSet::get(StateSet::VIEW_STATE_ENABLED),mSelectedTextColor));
|
||||
updateInputTextView();
|
||||
|
@ -13,17 +13,17 @@ public:
|
||||
bool mHasIndeterminateTint;
|
||||
bool mHasIndeterminateTintMode;
|
||||
|
||||
ColorStateList* mProgressTintList;
|
||||
const ColorStateList* mProgressTintList;
|
||||
PorterDuffMode mProgressTintMode;
|
||||
bool mHasProgressTint;
|
||||
bool mHasProgressTintMode;
|
||||
|
||||
ColorStateList* mProgressBackgroundTintList;
|
||||
const ColorStateList* mProgressBackgroundTintList;
|
||||
PorterDuffMode mProgressBackgroundTintMode;
|
||||
bool mHasProgressBackgroundTint;
|
||||
bool mHasProgressBackgroundTintMode;
|
||||
|
||||
ColorStateList* mSecondaryProgressTintList;
|
||||
const ColorStateList* mSecondaryProgressTintList;
|
||||
PorterDuffMode mSecondaryProgressTintMode;
|
||||
bool mHasSecondaryProgressTint;
|
||||
bool mHasSecondaryProgressTintMode;
|
||||
@ -33,11 +33,6 @@ public:
|
||||
mProgressBackgroundTintList = nullptr;
|
||||
mSecondaryProgressTintList = nullptr;
|
||||
}
|
||||
~ProgressTintInfo(){
|
||||
delete mProgressTintList;
|
||||
delete mProgressBackgroundTintList;
|
||||
delete mSecondaryProgressTintList;
|
||||
}
|
||||
};
|
||||
|
||||
DECLARE_WIDGET(ProgressBar)
|
||||
@ -844,21 +839,17 @@ void ProgressBar::setProgressTintList(const ColorStateList*tint){
|
||||
if (mProgressTintInfo == nullptr) {
|
||||
mProgressTintInfo = new ProgressTintInfo();
|
||||
}
|
||||
if(tint ==nullptr){
|
||||
delete mProgressTintInfo->mProgressTintList;
|
||||
mProgressTintInfo->mProgressTintList = nullptr;
|
||||
}else{
|
||||
if(mProgressTintInfo->mProgressTintList) *mProgressTintInfo->mProgressTintList=*tint;
|
||||
else mProgressTintInfo->mProgressTintList = new ColorStateList(*tint);
|
||||
if(mProgressTintInfo->mProgressTintList!=tint){
|
||||
mProgressTintInfo->mProgressTintList = tint;
|
||||
mProgressTintInfo->mHasProgressTint = (tint!=nullptr);
|
||||
}
|
||||
mProgressTintInfo->mHasProgressTint = (tint!=nullptr);
|
||||
|
||||
if (mProgressDrawable ) {
|
||||
applyPrimaryProgressTint();
|
||||
}
|
||||
}
|
||||
|
||||
ColorStateList* ProgressBar::getProgressTintList()const{
|
||||
const ColorStateList* ProgressBar::getProgressTintList()const{
|
||||
return mProgressTintInfo ? mProgressTintInfo->mProgressTintList : nullptr;
|
||||
}
|
||||
|
||||
@ -882,23 +873,17 @@ void ProgressBar::setProgressBackgroundTintList(const ColorStateList* tint) {
|
||||
if (mProgressTintInfo == nullptr) {
|
||||
mProgressTintInfo = new ProgressTintInfo();
|
||||
}
|
||||
if(tint == nullptr){
|
||||
delete mProgressTintInfo->mProgressBackgroundTintList;
|
||||
mProgressTintInfo->mProgressBackgroundTintList = nullptr;
|
||||
}else{
|
||||
if(mProgressTintInfo->mProgressBackgroundTintList)
|
||||
*mProgressTintInfo->mProgressBackgroundTintList=*tint;
|
||||
else
|
||||
mProgressTintInfo->mProgressBackgroundTintList = new ColorStateList(*tint);
|
||||
if(mProgressTintInfo->mProgressBackgroundTintList!=tint ){
|
||||
mProgressTintInfo->mProgressBackgroundTintList = tint;
|
||||
mProgressTintInfo->mHasProgressBackgroundTint = (tint!=nullptr);
|
||||
}
|
||||
mProgressTintInfo->mHasProgressBackgroundTint = (tint!=nullptr);
|
||||
|
||||
if (mProgressDrawable != nullptr) {
|
||||
applyProgressBackgroundTint();
|
||||
}
|
||||
}
|
||||
|
||||
ColorStateList*ProgressBar::getProgressBackgroundTintList()const{
|
||||
const ColorStateList*ProgressBar::getProgressBackgroundTintList()const{
|
||||
return mProgressTintInfo ? mProgressTintInfo->mProgressBackgroundTintList : nullptr;
|
||||
}
|
||||
|
||||
@ -922,23 +907,17 @@ void ProgressBar::setSecondaryProgressTintList(const ColorStateList* tint) {
|
||||
if (mProgressTintInfo == nullptr) {
|
||||
mProgressTintInfo = new ProgressTintInfo();
|
||||
}
|
||||
if(tint == nullptr){
|
||||
delete mProgressTintInfo->mSecondaryProgressTintList;
|
||||
mProgressTintInfo->mSecondaryProgressTintList=nullptr;
|
||||
}else{
|
||||
if(mProgressTintInfo->mSecondaryProgressTintList)
|
||||
*mProgressTintInfo->mSecondaryProgressTintList=*tint;
|
||||
else
|
||||
mProgressTintInfo->mSecondaryProgressTintList = new ColorStateList(*tint);
|
||||
if( mProgressTintInfo->mSecondaryProgressTintList!=tint ){
|
||||
mProgressTintInfo->mSecondaryProgressTintList = tint;
|
||||
mProgressTintInfo->mHasSecondaryProgressTint = (tint!=nullptr);
|
||||
}
|
||||
mProgressTintInfo->mHasSecondaryProgressTint = (tint!=nullptr);
|
||||
|
||||
if (mProgressDrawable != nullptr) {
|
||||
applySecondaryProgressTint();
|
||||
}
|
||||
}
|
||||
|
||||
ColorStateList* ProgressBar::getSecondaryProgressTintList()const{
|
||||
const ColorStateList* ProgressBar::getSecondaryProgressTintList()const{
|
||||
return mProgressTintInfo ? mProgressTintInfo->mSecondaryProgressTintList : nullptr;
|
||||
}
|
||||
|
||||
|
@ -126,15 +126,15 @@ public:
|
||||
Drawable*getIndeterminateDrawable()const;
|
||||
|
||||
void setProgressTintList(const ColorStateList*tint);
|
||||
ColorStateList*getProgressTintList()const;
|
||||
const ColorStateList*getProgressTintList()const;
|
||||
void setProgressTintMode(int);
|
||||
int getProgressTintMode()const;
|
||||
void setProgressBackgroundTintList(const ColorStateList*tint);
|
||||
ColorStateList*getProgressBackgroundTintList()const;
|
||||
const ColorStateList*getProgressBackgroundTintList()const;
|
||||
void setProgressBackgroundTintMode(int);
|
||||
int getProgressBackgroundTintMode()const;
|
||||
void setSecondaryProgressTintList(const ColorStateList*tintt);
|
||||
ColorStateList*getSecondaryProgressTintList()const;
|
||||
const ColorStateList*getSecondaryProgressTintList()const;
|
||||
void setSecondaryProgressTintMode(int tintMode);
|
||||
int getSecondaryProgressTintMode()const;
|
||||
Drawable* getTintTarget(int layerId, bool shouldFallback);
|
||||
|
@ -47,7 +47,7 @@ Switch::Switch(Context* context,const AttributeSet& a)
|
||||
|
||||
ColorStateList* trackTintList = context->getColorStateList("trackTint");
|
||||
if (trackTintList) {
|
||||
mTrackTintList = new ColorStateList(*trackTintList);
|
||||
mTrackTintList = trackTintList;
|
||||
mHasTrackTint = true;
|
||||
}
|
||||
/*BlendMode trackTintMode = Drawable.parseBlendMode(a.getInt(com.android.internal.R.styleable.Switch_trackTintMode, -1), null);
|
||||
@ -234,18 +234,14 @@ Drawable* Switch::getTrackDrawable() {
|
||||
}
|
||||
|
||||
void Switch::setTrackTintList(const ColorStateList* tint){
|
||||
if(tint ==nullptr){
|
||||
delete mTrackTintList;
|
||||
mTrackTintList = nullptr;
|
||||
}else{
|
||||
if(mTrackTintList) *mTrackTintList=*tint;
|
||||
else mTrackTintList = new ColorStateList(*tint);
|
||||
if(mTrackTintList!=tint){
|
||||
mTrackTintList = tint;
|
||||
mHasTrackTint = (tint!=nullptr);
|
||||
applyTrackTint();
|
||||
}
|
||||
mHasTrackTint = (tint!=nullptr);
|
||||
applyTrackTint();
|
||||
}
|
||||
|
||||
ColorStateList* Switch::getTrackTintList() {
|
||||
const ColorStateList* Switch::getTrackTintList() {
|
||||
return mTrackTintList;
|
||||
}
|
||||
|
||||
@ -297,19 +293,14 @@ Drawable* Switch::getThumbDrawable(){
|
||||
}
|
||||
|
||||
void Switch::setThumbTintList(const ColorStateList* tint){
|
||||
if(tint==nullptr){
|
||||
delete mThumbTintList;
|
||||
mThumbTintList = nullptr;
|
||||
}else{
|
||||
if(mThumbTintList) *mThumbTintList = *tint;
|
||||
else mThumbTintList = new ColorStateList(*tint);
|
||||
if(mThumbTintList!=tint){
|
||||
mThumbTintList = tint;
|
||||
mHasThumbTint = (tint!=nullptr);
|
||||
applyThumbTint();
|
||||
}
|
||||
mHasThumbTint = true;
|
||||
|
||||
applyThumbTint();
|
||||
}
|
||||
|
||||
ColorStateList* Switch::getThumbTintList()const{
|
||||
const ColorStateList* Switch::getThumbTintList()const{
|
||||
return mThumbTintList;
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,13 @@ private:
|
||||
static constexpr int SERIF = 2;
|
||||
static constexpr int MONOSPACE = 3;
|
||||
Drawable* mThumbDrawable;
|
||||
ColorStateList* mThumbTintList;
|
||||
const ColorStateList* mThumbTintList;
|
||||
//BlendMode mThumbBlendMode = null;
|
||||
bool mHasThumbTint = false;
|
||||
bool mHasThumbTintMode = false;
|
||||
|
||||
Drawable* mTrackDrawable;
|
||||
ColorStateList* mTrackTintList;
|
||||
const ColorStateList* mTrackTintList;
|
||||
//BlendMode* mTrackBlendMode = null;
|
||||
bool mHasTrackTint = false;
|
||||
bool mHasTrackTintMode = false;
|
||||
@ -75,7 +75,7 @@ private:
|
||||
/** Bottom bound for drawing the switch track and thumb. */
|
||||
int mSwitchBottom;
|
||||
|
||||
ColorStateList* mTextColors;
|
||||
const ColorStateList* mTextColors;
|
||||
Layout* mOnLayout;
|
||||
Layout* mOffLayout;
|
||||
//TransformationMethod2 mSwitchTransformationMethod;
|
||||
@ -119,14 +119,14 @@ public:
|
||||
void setTrackResource(const std::string& resId);
|
||||
Drawable* getTrackDrawable();
|
||||
void setTrackTintList(const ColorStateList* tint);
|
||||
ColorStateList* getTrackTintList();
|
||||
const ColorStateList* getTrackTintList();
|
||||
void setTrackTintMode(PorterDuffMode tintMode);
|
||||
PorterDuffMode getTrackTintMode()const;
|
||||
void setThumbDrawable(Drawable* thumb);
|
||||
void setThumbResource(const std::string& resId);
|
||||
Drawable* getThumbDrawable();
|
||||
void setThumbTintList(const ColorStateList* tint);
|
||||
ColorStateList* getThumbTintList()const;
|
||||
const ColorStateList* getThumbTintList()const;
|
||||
void setThumbTintMode(PorterDuffMode tintMode);
|
||||
PorterDuffMode getThumbTintMode()const;
|
||||
void setSplitTrack(bool splitTrack);
|
||||
|
@ -317,17 +317,13 @@ void TabLayout::setInlineLabel(bool v){
|
||||
}
|
||||
|
||||
void TabLayout::setTabTextColors(const ColorStateList* textColor) {
|
||||
if (textColor==nullptr){
|
||||
delete mTabTextColors;
|
||||
mTabTextColors = nullptr;
|
||||
}else{
|
||||
if(mTabTextColors) *mTabTextColors=*textColor;
|
||||
else mTabTextColors = new ColorStateList(*textColor);
|
||||
if (mTabTextColors!=textColor){
|
||||
mTabTextColors = textColor;
|
||||
updateAllTabs();
|
||||
}
|
||||
updateAllTabs();
|
||||
}
|
||||
|
||||
ColorStateList* TabLayout::getTabTextColors()const{
|
||||
const ColorStateList* TabLayout::getTabTextColors()const{
|
||||
return mTabTextColors;
|
||||
}
|
||||
|
||||
@ -1121,7 +1117,7 @@ void TabLayout::TabView::update() {
|
||||
}
|
||||
//mTextView->setTextAppearance(mTabTextAppearance);
|
||||
if (mParent->mTabTextColors) {
|
||||
mTextView->setTextColor(new ColorStateList(*mParent->mTabTextColors));
|
||||
mTextView->setTextColor(mParent->mTabTextColors);
|
||||
}
|
||||
updateTextAndIcon(mTextView, mIconView);
|
||||
} else {
|
||||
|
@ -196,9 +196,9 @@ protected:
|
||||
int mTabPaddingEnd;
|
||||
int mTabPaddingBottom;
|
||||
int mTabTextAppearance;
|
||||
ColorStateList* mTabTextColors;
|
||||
ColorStateList* mTabIconTint;
|
||||
ColorStateList* mTabRippleColorStateList;
|
||||
const ColorStateList* mTabTextColors;
|
||||
const ColorStateList* mTabIconTint;
|
||||
const ColorStateList* mTabRippleColorStateList;
|
||||
Drawable* mTabSelectedIndicator;
|
||||
float mTabTextSize;
|
||||
float mTabTextMultiLineSize;
|
||||
@ -271,7 +271,7 @@ public:
|
||||
bool isInlineLabel()const;
|
||||
void setInlineLabel(bool);
|
||||
void setTabTextColors(const ColorStateList* textColor);
|
||||
ColorStateList* getTabTextColors()const;
|
||||
const ColorStateList* getTabTextColors()const;
|
||||
void setTabTextColors(int normalColor, int selectedColor);
|
||||
void setupWithViewPager(ViewPager* viewPager);
|
||||
void setupWithViewPager(ViewPager* viewPager, bool autoRefresh);
|
||||
|
@ -472,9 +472,9 @@ void TextView::initView(){
|
||||
}
|
||||
|
||||
TextView::~TextView() {
|
||||
delete mTextColor;
|
||||
delete mHintTextColor;
|
||||
delete mLinkTextColor;
|
||||
//delete mTextColor;
|
||||
//delete mHintTextColor;
|
||||
//delete mLinkTextColor;
|
||||
delete mLayout;
|
||||
delete mHintLayout;
|
||||
delete mDrawables;
|
||||
@ -1633,22 +1633,17 @@ void TextView::setEllipsize(int where){
|
||||
}
|
||||
|
||||
void TextView::setTextColor(int color){
|
||||
ColorStateList cls(color);
|
||||
setTextColor(&cls);
|
||||
setTextColor(ColorStateList::valueOf(color));
|
||||
}
|
||||
|
||||
void TextView::setTextColor(const ColorStateList* colors){
|
||||
if(colors==nullptr){
|
||||
delete mTextColor;
|
||||
mTextColor = nullptr;
|
||||
}else{
|
||||
if(mTextColor) *mTextColor =*colors;
|
||||
else mTextColor = new ColorStateList(*colors);
|
||||
if(mTextColor!=colors){
|
||||
mTextColor = colors;
|
||||
updateTextColors();
|
||||
}
|
||||
updateTextColors();
|
||||
}
|
||||
|
||||
ColorStateList* TextView::getTextColors()const{
|
||||
const ColorStateList* TextView::getTextColors()const{
|
||||
return mTextColor;
|
||||
}
|
||||
|
||||
@ -1676,22 +1671,17 @@ int TextView::getHighlightColor()const{
|
||||
}
|
||||
|
||||
void TextView::setHintTextColor(int color){
|
||||
ColorStateList cls(color);
|
||||
setHintTextColor(&cls);
|
||||
setHintTextColor(ColorStateList::valueOf(color));
|
||||
}
|
||||
|
||||
void TextView::setHintTextColor(const ColorStateList* colors){
|
||||
if(colors==nullptr){
|
||||
delete mHintTextColor;
|
||||
mHintTextColor = nullptr;
|
||||
}else{
|
||||
if(mHintTextColor) *mHintTextColor=*colors;
|
||||
else mHintTextColor = new ColorStateList(*colors);
|
||||
if(mHintTextColor!=colors){
|
||||
mHintTextColor = colors;
|
||||
updateTextColors();
|
||||
}
|
||||
updateTextColors();
|
||||
}
|
||||
|
||||
ColorStateList* TextView::getHintTextColors()const{
|
||||
const ColorStateList* TextView::getHintTextColors()const{
|
||||
return mHintTextColor;
|
||||
}
|
||||
|
||||
@ -1706,17 +1696,13 @@ void TextView::setLinkTextColor(int color){
|
||||
}
|
||||
|
||||
void TextView::setLinkTextColor(const ColorStateList* colors){
|
||||
if(colors==nullptr){
|
||||
delete mLinkTextColor;
|
||||
mLinkTextColor=nullptr;
|
||||
}else{
|
||||
if(mLinkTextColor) *mLinkTextColor=*colors;
|
||||
else mLinkTextColor = new ColorStateList(*colors);
|
||||
if(mLinkTextColor!=colors){
|
||||
mLinkTextColor = colors;
|
||||
updateTextColors();
|
||||
}
|
||||
updateTextColors();
|
||||
}
|
||||
|
||||
ColorStateList* TextView::getLinkTextColors()const{
|
||||
const ColorStateList* TextView::getLinkTextColors()const{
|
||||
return mLinkTextColor;
|
||||
}
|
||||
|
||||
@ -1724,7 +1710,7 @@ void TextView::applyCompoundDrawableTint(){
|
||||
if (mDrawables == nullptr) return;
|
||||
if ( (mDrawables->mTintList==nullptr)&&(mDrawables->mHasTintMode==false) )return ;
|
||||
|
||||
ColorStateList* tintList = mDrawables->mTintList;
|
||||
const ColorStateList* tintList = mDrawables->mTintList;
|
||||
const int tintMode = mDrawables->mTintMode;
|
||||
const bool hasTint = (mDrawables->mTintList!=nullptr);
|
||||
const bool hasTintMode = mDrawables->mHasTintMode;
|
||||
@ -1859,17 +1845,13 @@ void TextView::setCompoundDrawableTintList(const ColorStateList* tint){
|
||||
if (mDrawables == nullptr) {
|
||||
mDrawables = new Drawables(getContext());
|
||||
}
|
||||
if(tint==nullptr){
|
||||
delete mDrawables->mTintList;
|
||||
mDrawables->mTintList = nullptr;
|
||||
}else{
|
||||
if(mDrawables->mTintList) *mDrawables->mTintList=*tint;
|
||||
else mDrawables->mTintList = new ColorStateList(*tint);
|
||||
if(mDrawables->mTintList!=tint){
|
||||
mDrawables->mTintList = tint;
|
||||
applyCompoundDrawableTint();
|
||||
}
|
||||
applyCompoundDrawableTint();
|
||||
}
|
||||
|
||||
ColorStateList* TextView::getCompoundDrawableTintList(){
|
||||
const ColorStateList* TextView::getCompoundDrawableTintList(){
|
||||
return mDrawables ? mDrawables->mTintList : nullptr;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
bool mIsRtlCompatibilityMode;
|
||||
bool mOverride;
|
||||
bool mHasTint, mHasTintMode;
|
||||
ColorStateList* mTintList;
|
||||
const ColorStateList* mTintList;
|
||||
int mTintMode;
|
||||
int mDrawableSizeTop, mDrawableSizeBottom, mDrawableSizeLeft, mDrawableSizeRight;
|
||||
int mDrawableSizeStart, mDrawableSizeEnd, mDrawableSizeError, mDrawableSizeTemp;
|
||||
@ -101,9 +101,9 @@ private:
|
||||
int mFontWeightAdjustment;
|
||||
Typeface* mOriginalTypeface;
|
||||
|
||||
ColorStateList *mTextColor;
|
||||
ColorStateList *mHintTextColor;
|
||||
ColorStateList *mLinkTextColor;
|
||||
const ColorStateList *mTextColor;
|
||||
const ColorStateList *mHintTextColor;
|
||||
const ColorStateList *mLinkTextColor;
|
||||
int mCurTextColor;
|
||||
int mCurHintTextColor;
|
||||
int mHighlightColor;
|
||||
@ -227,17 +227,17 @@ public:
|
||||
int getEllipsize() const;
|
||||
void setEllipsize(int ellipsize);
|
||||
|
||||
ColorStateList* getTextColors()const;
|
||||
const ColorStateList* getTextColors()const;
|
||||
int getCurrentTextColor()const;
|
||||
void setHighlightColor(int color);
|
||||
int getHighlightColor()const;
|
||||
void setHintTextColor(int color);
|
||||
void setHintTextColor(const ColorStateList* colors);
|
||||
ColorStateList* getHintTextColors()const;
|
||||
const ColorStateList* getHintTextColors()const;
|
||||
int getCurrentHintTextColor()const;
|
||||
void setLinkTextColor(int color);
|
||||
void setLinkTextColor(const ColorStateList* colors);
|
||||
ColorStateList* getLinkTextColors()const;
|
||||
const ColorStateList* getLinkTextColors()const;
|
||||
void setMinWidth(int minPixels);
|
||||
int getMinWidth()const;
|
||||
void setMaxWidth(int maxPixels);
|
||||
@ -274,7 +274,7 @@ public:
|
||||
int getCompoundDrawablePadding()const;
|
||||
std::vector<Drawable*>getCompoundDrawables();
|
||||
void setCompoundDrawableTintList(const ColorStateList* tint);
|
||||
ColorStateList* getCompoundDrawableTintList();
|
||||
const ColorStateList* getCompoundDrawableTintList();
|
||||
void drawableHotspotChanged(float x,float y)override;
|
||||
void setCompoundDrawableTintMode(int tintMode);
|
||||
int getCompoundDrawableTintMode();
|
||||
|
@ -6,6 +6,8 @@ namespace cdroid{
|
||||
DECLARE_WIDGET(ViewAnimator)
|
||||
|
||||
ViewAnimator::ViewAnimator(int w,int h):FrameLayout(w,h){
|
||||
mInAnimation = nullptr;
|
||||
mOutAnimation= nullptr;
|
||||
}
|
||||
|
||||
ViewAnimator::ViewAnimator(Context* context,const AttributeSet& attrs)
|
||||
@ -155,7 +157,7 @@ Animation* ViewAnimator::getOutAnimation(){
|
||||
return mOutAnimation;
|
||||
}
|
||||
void ViewAnimator::setOutAnimation(Animation* outAnimation){
|
||||
mOutAnimation=outAnimation;
|
||||
mOutAnimation = outAnimation;
|
||||
}
|
||||
|
||||
bool ViewAnimator::getAnimateFirstView() const{
|
||||
|
Loading…
Reference in New Issue
Block a user