Beispiel #1
0
 @Override
 public void setSelected(boolean selected) {
   super.setSelected(selected);
   int state = selected ? Selected : Normal;
   states.setState(state);
   updateText(state);
   updateImage(state);
 }
Beispiel #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);
 }
Beispiel #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());
   }
 }
Beispiel #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);
            }
          }
        });
  }
Beispiel #5
0
 public void setShowsTouchWhenHighlighted(boolean showsTouchWhenHighlighted) {
   states.showsTouchWhenHighlighted = showsTouchWhenHighlighted;
 }
Beispiel #6
0
 public void setAdjustsImageWhenHighlighted(boolean adjustsImageWhenHighlighted) {
   states.adjustsImageWhenHighlighted = adjustsImageWhenHighlighted;
 }
Beispiel #7
0
 public void setAdjustsImageWhenDisabled(boolean adjustsImageWhenDisabled) {
   states.adjustsImageWhenDisabled = adjustsImageWhenDisabled;
 }
Beispiel #8
0
 public UIColor titleColorForState(int UIControlState) {
   return states.getTitlecolor(UIControlState);
 }
Beispiel #9
0
 public UIImage backgroundImageForState(int UIControlState) {
   return states.getBack(UIControlState);
 }
Beispiel #10
0
 public void setBackgroundImage(UIImage img, int UIControlState) {
   states.setBack(UIControlState, img);
   updateImage(UIControlState);
 }
Beispiel #11
0
 public UIImage imageForState(int UIControlState) {
   return states.getFore(UIControlState);
 }
Beispiel #12
0
 public void setImage(UIImage img, int UIControlState) {
   states.setFore(UIControlState, img);
   updateImage(UIControlState);
 }
Beispiel #13
0
 public UIColor titleShadowColorForState(int UIControlState) {
   return states.getShadowColor(UIControlState);
 }
Beispiel #14
0
 public void setTitleShadowColor(UIColor shadowcolor, int UIControlState) {
   states.setShadowColor(UIControlState, shadowcolor);
   updateText(UIControlState);
 }
Beispiel #15
0
 public void setTitle(String title, int UIControlState) {
   initText();
   states.setTitle(UIControlState, title);
   updateText(UIControlState);
 }
Beispiel #16
0
 public String titleForState(int UIControlState) {
   return states.getTitle(UIControlState);
 }
Beispiel #17
0
 public void setTitleColor(UIColor titleColor, int UIControlState) {
   states.setTitlecolor(UIControlState, titleColor);
   updateText(UIControlState);
 }