示例#1
0
 @Override
 public void setSelected(boolean selected) {
   super.setSelected(selected);
   int state = selected ? Selected : Normal;
   states.setState(state);
   updateText(state);
   updateImage(state);
 }
示例#2
0
 @Override
 public void setHighlighted(boolean highlighted) {
   super.setHighlighted(highlighted);
   int state = highlighted ? Highlighted : isSelected() ? Selected : Normal;
   states.setState(state);
   updateText(state);
   updateImage(state);
 }
示例#3
0
 void updateText(int state) {
   if (!states.isInState(state)) return;
   if (title != null) {
     title.setText(states.getTitle());
     if (states.getTitlecolor() != null) title.setTextColor(states.getTitlecolor());
     if (states.getShadowColor() != null) title.setShadowColor(states.getShadowColor());
   }
 }
示例#4
0
  void updateImage(int state) {
    if (!states.isInState(state)) return;
    UIRunner.runSynced(
        new UIRunner() {

          @Override
          public void exec() {
            UIImage foreimg = states.getFore();
            if (foreimg == null && fore != null) {
              fore.removeFromSuperview();
              fore = null;
            } else if (foreimg != null) {
              initForeground();
              fore.setImage(foreimg);
            }

            if (updatableBackImage) {
              UIImage backimg = states.getBack();
              if (backimg != null) xm_model().setBackgroundDrawable(backimg.getModel());
              else xm_model().setBackgroundDrawable(null);
            }
          }
        });
  }
示例#5
0
 public void setShowsTouchWhenHighlighted(boolean showsTouchWhenHighlighted) {
   states.showsTouchWhenHighlighted = showsTouchWhenHighlighted;
 }
示例#6
0
 public void setAdjustsImageWhenHighlighted(boolean adjustsImageWhenHighlighted) {
   states.adjustsImageWhenHighlighted = adjustsImageWhenHighlighted;
 }
示例#7
0
 public void setAdjustsImageWhenDisabled(boolean adjustsImageWhenDisabled) {
   states.adjustsImageWhenDisabled = adjustsImageWhenDisabled;
 }
示例#8
0
 public UIColor titleColorForState(int UIControlState) {
   return states.getTitlecolor(UIControlState);
 }
示例#9
0
 public UIImage backgroundImageForState(int UIControlState) {
   return states.getBack(UIControlState);
 }
示例#10
0
 public void setBackgroundImage(UIImage img, int UIControlState) {
   states.setBack(UIControlState, img);
   updateImage(UIControlState);
 }
示例#11
0
 public UIImage imageForState(int UIControlState) {
   return states.getFore(UIControlState);
 }
示例#12
0
 public void setImage(UIImage img, int UIControlState) {
   states.setFore(UIControlState, img);
   updateImage(UIControlState);
 }
示例#13
0
 public UIColor titleShadowColorForState(int UIControlState) {
   return states.getShadowColor(UIControlState);
 }
示例#14
0
 public void setTitleShadowColor(UIColor shadowcolor, int UIControlState) {
   states.setShadowColor(UIControlState, shadowcolor);
   updateText(UIControlState);
 }
示例#15
0
 public void setTitle(String title, int UIControlState) {
   initText();
   states.setTitle(UIControlState, title);
   updateText(UIControlState);
 }
示例#16
0
 public String titleForState(int UIControlState) {
   return states.getTitle(UIControlState);
 }
示例#17
0
 public void setTitleColor(UIColor titleColor, int UIControlState) {
   states.setTitlecolor(UIControlState, titleColor);
   updateText(UIControlState);
 }