Commit efd5a8d3 authored by Nico Mack's avatar Nico Mack

Added enableFading method to FadingCorona.

parent 4fddaa08
...@@ -29,6 +29,7 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList ...@@ -29,6 +29,7 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList
private long fadeOutTime; private long fadeOutTime;
private long displayTime; private long displayTime;
private boolean fadeWithHandle; private boolean fadeWithHandle;
private boolean fadingEnabled;
protected float opacity; protected float opacity;
protected Timeline fadeInTimeline; protected Timeline fadeInTimeline;
...@@ -57,6 +58,7 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList ...@@ -57,6 +58,7 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList
this.fadeOutTime = builder.fadeOutTime; this.fadeOutTime = builder.fadeOutTime;
this.displayTime = builder.displayTime; this.displayTime = builder.displayTime;
this.fadeWithHandle = builder.fadeWithHandle; this.fadeWithHandle = builder.fadeWithHandle;
this.fadingEnabled = true;
this.opacity = 0.0f; this.opacity = 0.0f;
if (displayTime > 0) { if (displayTime > 0) {
displayTimer = new Timer((int) displayTime, this); displayTimer = new Timer((int) displayTime, this);
...@@ -81,6 +83,7 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList ...@@ -81,6 +83,7 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList
this.displayTime = original.displayTime; this.displayTime = original.displayTime;
this.fadeWithHandle = original.fadeWithHandle; this.fadeWithHandle = original.fadeWithHandle;
this.opacity = original.opacity; this.opacity = original.opacity;
this.fadingEnabled = original.fadingEnabled;
if (displayTime > 0) { if (displayTime > 0) {
displayTimer = new Timer((int) displayTime, this); displayTimer = new Timer((int) displayTime, this);
displayTimer.setRepeats(false); displayTimer.setRepeats(false);
...@@ -107,7 +110,27 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList ...@@ -107,7 +110,27 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
public void enableFading(boolean enableIt) {
fadingEnabled = enableIt;
if (!fadingEnabled) {
if (displayTimer != null)
displayTimer.stop();
} else {
if (displayTimer != null)
displayTimer.start();
}
}
// ---------------------------------------------------------------------------
public void fadeIn() { public void fadeIn() {
if (!fadingEnabled) {
this.setOpacity(1.0f);
return;
}
if ((fadeOutTimeline != null) && (!fadeOutTimeline.isDone())) if ((fadeOutTimeline != null) && (!fadeOutTimeline.isDone()))
fadeOutTimeline.cancel(); fadeOutTimeline.cancel();
...@@ -127,6 +150,12 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList ...@@ -127,6 +150,12 @@ public class FadingCorona extends Corona implements TimelineCallback, ActionList
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
public void fadeOut() { public void fadeOut() {
if (!fadingEnabled) {
this.setOpacity(0.0f);
return;
}
if ((fadeOutTime > 0) && (this.opacity > 0)) { if ((fadeOutTime > 0) && (this.opacity > 0)) {
if ((fadeInTimeline != null) && (!fadeInTimeline.isDone())) if ((fadeInTimeline != null) && (!fadeInTimeline.isDone()))
fadeInTimeline.cancel(); fadeInTimeline.cancel();
......
...@@ -35,7 +35,6 @@ import java.util.List; ...@@ -35,7 +35,6 @@ import java.util.List;
public abstract class SelectableCorona extends FadingCorona { public abstract class SelectableCorona extends FadingCorona {
protected boolean isSelected; protected boolean isSelected;
protected int index; protected int index;
protected boolean isLatching;
protected List<SelectionListener> listeners; protected List<SelectionListener> listeners;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -51,7 +50,6 @@ public abstract class SelectableCorona extends FadingCorona { ...@@ -51,7 +50,6 @@ public abstract class SelectableCorona extends FadingCorona {
public SelectableCorona(BaseSelectableCoronaBuilder<?> builder) { public SelectableCorona(BaseSelectableCoronaBuilder<?> builder) {
super(builder); super(builder);
index = builder.index; index = builder.index;
isLatching = builder.isLatching;
listeners = new ArrayList<>(); listeners = new ArrayList<>();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment