reactivating the stripe now sets the colorwheel's current color
increased thickness of saturation and value bars
This commit is contained in:
@@ -85,7 +85,6 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
private double per = 100.0;
|
private double per = 100.0;
|
||||||
private double allowance = rate;
|
private double allowance = rate;
|
||||||
private long last_check = System.currentTimeMillis();
|
private long last_check = System.currentTimeMillis();
|
||||||
private boolean isDisabled = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -112,11 +111,8 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
colorPicker.setOnColorChangedListener(new ColorPicker.OnColorChangedListener() {
|
colorPicker.setOnColorChangedListener(new ColorPicker.OnColorChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onColorChanged(int i) {
|
public void onColorChanged(int i) {
|
||||||
if (mCurrentStripe != null && mCurrentHelper != null && isRateAcceptable() && !isDisabled) {
|
if (mCurrentStripe != null && mCurrentHelper != null && isRateAcceptable() && aSwitch.isChecked()) {
|
||||||
float[] hsv = new float[3];
|
setStripeFromColor(i);
|
||||||
Color.colorToHSV(i, hsv);
|
|
||||||
mCurrentStripe.setColor(new HSV(hsv[0], hsv[1], hsv[2]));
|
|
||||||
mCurrentHelper.setColor(mCurrentStripe);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -193,10 +189,9 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
nHSV.setValue(0.0);
|
nHSV.setValue(0.0);
|
||||||
mCurrentStripe.setColor(nHSV);
|
mCurrentStripe.setColor(nHSV);
|
||||||
mCurrentHelper.setColor(mCurrentStripe);
|
mCurrentHelper.setColor(mCurrentStripe);
|
||||||
colorPicker.setColor(Color.HSVToColor(new float[]{(float) nHSV.getHue(), (float) nHSV.getSaturation(), (float) nHSV.getValue()}));
|
//colorPicker.setColor(Color.HSVToColor(new float[]{(float) nHSV.getHue(), (float) nHSV.getSaturation(), (float) nHSV.getValue()}));
|
||||||
isDisabled = true;
|
|
||||||
} else {
|
} else {
|
||||||
isDisabled = false;
|
setStripeFromColor(colorPicker.getColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -363,10 +358,8 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
colorPicker.setColor(color);
|
colorPicker.setColor(color);
|
||||||
if (cColor.getValue() == 0.0) {
|
if (cColor.getValue() == 0.0) {
|
||||||
aSwitch.setChecked(false);
|
aSwitch.setChecked(false);
|
||||||
isDisabled = true;
|
|
||||||
} else {
|
} else {
|
||||||
aSwitch.setChecked(true);
|
aSwitch.setChecked(true);
|
||||||
isDisabled = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -401,6 +394,13 @@ public class ColorActivity extends AppCompatActivity implements NavigationView.O
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setStripeFromColor(int color) {
|
||||||
|
float[] hsv = new float[3];
|
||||||
|
Color.colorToHSV(color, hsv);
|
||||||
|
mCurrentStripe.setColor(new HSV(hsv[0], hsv[1], hsv[2]));
|
||||||
|
mCurrentHelper.setColor(mCurrentStripe);
|
||||||
|
}
|
||||||
|
|
||||||
protected class refreshDaemonsListener extends BroadcastReceiver {
|
protected class refreshDaemonsListener extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -63,13 +63,15 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:layout_marginTop="15dp"/>
|
android:layout_marginTop="15dp"
|
||||||
|
app:bar_thickness="15dp"/>
|
||||||
|
|
||||||
<com.larswerkman.holocolorpicker.ValueBar
|
<com.larswerkman.holocolorpicker.ValueBar
|
||||||
android:id="@+id/valuebar"
|
android:id="@+id/valuebar"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"/>
|
android:layout_margin="10dp"
|
||||||
|
app:bar_thickness="15dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user