summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2946efe)
keep initial and current colors separately. these are two different things
initial is the current profile color, current is the currently selected
color in the color selector, also used by the color selector icon
return hueDegrees;
}
public void setHue(int hueDegrees) {
return hueDegrees;
}
public void setHue(int hueDegrees) {
+ if (hueDegrees == -1) hueDegrees = Colors.DEFAULT_HUE_DEG;
+
if (hueDegrees != Colors.DEFAULT_HUE_DEG) {
// round to 15 degrees
int rem = hueDegrees % 15;
if (hueDegrees != Colors.DEFAULT_HUE_DEG) {
// round to 15 degrees
int rem = hueDegrees % 15;
import androidx.annotation.NonNull;
public class HueRingDialog extends Dialog {
import androidx.annotation.NonNull;
public class HueRingDialog extends Dialog {
+ private final int currentHue;
private int initialHue;
private HueRing hueRing;
private HueSelectedListener listener;
private int initialHue;
private HueRing hueRing;
private HueSelectedListener listener;
- public HueRingDialog(@NonNull Context context, int initialHue) {
+ public HueRingDialog(@NonNull Context context, int initialHue, int currentHue) {
super(context);
this.initialHue = initialHue;
super(context);
this.initialHue = initialHue;
+ this.currentHue = currentHue;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.hue_dialog);
hueRing = findViewById(R.id.ring);
hueRing.setInitialHue(initialHue);
setContentView(R.layout.hue_dialog);
hueRing = findViewById(R.id.ring);
hueRing.setInitialHue(initialHue);
- hueRing.setHue(initialHue);
+ hueRing.setHue(currentHue);
findViewById(R.id.btn_ok).setOnClickListener(v -> {
if (listener != null) listener.onHueSelected(hueRing.getHueDegrees());
findViewById(R.id.btn_ok).setOnClickListener(v -> {
if (listener != null) listener.onHueSelected(hueRing.getHueDegrees());
huePickerView.setTag(profileThemeId);
huePickerView.setOnClickListener(v -> {
HueRingDialog d = new HueRingDialog(
huePickerView.setTag(profileThemeId);
huePickerView.setOnClickListener(v -> {
HueRingDialog d = new HueRingDialog(
- Objects.requireNonNull(ProfileDetailFragment.this.getContext()), hue);
+ Objects.requireNonNull(ProfileDetailFragment.this.getContext()),
+ profileThemeId, (Integer) v.getTag());
d.show();
d.setColorSelectedListener(this);
});
d.show();
d.setColorSelectedListener(this);
});