コード例 #1
0
  @Override
  public void onColorChanged(int color) {
    picker.setOldCenterColor(picker.getColor());
    picker2.setOldCenterColor(picker2.getColor());
    refreshBackgroundColors();

    if (!requestPending) {
      requestPending = true;
      AsyncHttpClient client = new AsyncHttpClient();
      client.get(
          SettingsFragment.ip
              + "color?color&"
              + colorToString(Color.red(picker.getColor()) * getAlpha(picker.getColor()))
              + "&"
              + colorToString(Color.green(picker.getColor()) * getAlpha(picker.getColor()))
              + "&"
              + colorToString(Color.blue(picker.getColor()) * getAlpha(picker.getColor()))
              + "&"
              + colorToString(Color.red(picker2.getColor()) * getAlpha(picker2.getColor()))
              + "&"
              + colorToString(Color.green(picker2.getColor()) * getAlpha(picker2.getColor()))
              + "&"
              + colorToString(Color.blue(picker2.getColor()) * getAlpha(picker2.getColor()))
              + "",
          new AsyncHttpResponseHandler() {
            @Override
            public void onFinish() {
              requestPending = false;
            }
          });
    }
  }
コード例 #2
0
  public void onActivityCreated(Bundle savedInstanceState) {
    picker = (ColorPicker) findViewById(R.id.picker1);
    OpacityBar opacityBar = (OpacityBar) findViewById(R.id.opacitybar1);
    SaturationBar saturationBar = (SaturationBar) findViewById(R.id.saturationbar1);

    picker.addOpacityBar(opacityBar);
    picker.addSaturationBar(saturationBar);
    picker.setOldCenterColor(picker.getColor());
    picker.setOnColorChangedListener(this);

    picker2 = (ColorPicker) findViewById(R.id.picker2);
    OpacityBar opacityBar2 = (OpacityBar) findViewById(R.id.opacitybar2);
    SaturationBar saturationBar2 = (SaturationBar) findViewById(R.id.saturationbar2);

    picker2.addOpacityBar(opacityBar2);
    picker2.addSaturationBar(saturationBar2);
    picker2.setOldCenterColor(picker2.getColor());
    picker2.setOnColorChangedListener(this);

    super.onActivityCreated(savedInstanceState);
  }
コード例 #3
0
  @Override
  protected void onRestoreInstanceState(Parcelable state) {
    Bundle savedState = (Bundle) state;

    Parcelable superState = savedState.getParcelable(STATE_PARENT);
    super.onRestoreInstanceState(superState);

    mAngle = savedState.getFloat(STATE_ANGLE);
    setOldCenterColor(savedState.getInt(STATE_OLD_COLOR));
    int currentColor = calculateColor(mAngle);
    mPointerColor.setColor(currentColor);
    setNewCenterColor(currentColor);
  }