Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

110419 1236 pm fixing customt uiid in toast bar #2758

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Durank
----------------------------------
1-Fixed possible leaking of memory when setExpires method is used
2-Fixed defaultUIID is the setDefaultUIID method is used
3-Fixed bug in transition animation when the text in toast bar is same or the class is instanced multiple times. 
*See video issue here: https://drive.google.com/open?id=1yGHuzzuM3xB4nDacnOZvpeYxoaguyC0B
DurankGts committed Apr 11, 2019
commit 2ae74bd6257f71df257136073a94d3c22f86352c
29 changes: 16 additions & 13 deletions CodenameOne/src/com/codename1/components/ToastBar.java
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@
import com.codename1.io.NetworkManager;
import com.codename1.ui.Button;
import com.codename1.ui.Component;
import static com.codename1.ui.Component.CENTER;
import static com.codename1.ui.ComponentSelector.$;
import com.codename1.ui.Container;
import com.codename1.ui.Dialog;
@@ -37,7 +38,6 @@
import com.codename1.ui.Label;
import com.codename1.ui.Slider;
import com.codename1.ui.TextArea;
import com.codename1.ui.animations.CommonTransitions;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.events.ActionListener;
import com.codename1.ui.geom.Dimension;
@@ -284,6 +284,7 @@ public void setExpires(int millis) {
public void run() {
Display.getInstance().callSerially(new Runnable() {
public void run() {
timer.cancel();
timer = null;
Status.this.clear();
}
@@ -583,10 +584,10 @@ public void actionPerformed(ActionEvent evt) {
if (!oldText.equals(l.getText())) {


if (s.getUiid() != null) {
c.setUIID(s.getUiid());
} else if (defaultUIID != null) {
if (defaultUIID != null) {
c.setUIID(defaultUIID);
} else if (s.getUiid() != null) {
c.setUIID(s.getUiid());
}

if (c.isVisible()) {
@@ -606,11 +607,12 @@ public void actionPerformed(ActionEvent evt) {
} else {
newLabel.setUIID(c.label.getUIID());
}
if (s.getUiid() != null) {
c.setUIID(s.getUiid());
} else if (defaultUIID != null) {

if (defaultUIID != null) {
c.setUIID(defaultUIID);
}
} else if (s.getUiid() != null) {
c.setUIID(s.getUiid());
}
newLabel.setWidth(c.label.getWidth());

newLabel.setText(l.getText());
@@ -622,7 +624,8 @@ public void actionPerformed(ActionEvent evt) {
// are stuck in blocking mode between them and the label just got discarded see:
// https://stackoverflow.com/questions/46172993/codename-one-toastbar-nullpointerexception
if(c.label.getParent() != null) {
c.label.getParent().replaceAndWait(c.label, newLabel, CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, true, 300));
//c.label.getParent().replaceAndWait(c.label, newLabel, CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, true, 300));
c.label.getParent().replaceAndWait(c.label, newLabel, null);
c.label = newLabel;

if (oldTextAreaSize.getHeight() != newTexAreaSize.getHeight()) {
@@ -638,11 +641,11 @@ public void actionPerformed(ActionEvent evt) {
} else if (defaultMessageUIID != null) {
c.label.setUIID(defaultMessageUIID);
}
if (s.getUiid() != null) {
c.setUIID(s.getUiid());
} else if (defaultUIID != null) {
if (defaultUIID != null) {
c.setUIID(defaultUIID);
}
} else if (s.getUiid() != null) {
c.setUIID(s.getUiid());
}
c.label.setText(l.getText());
//c.label.setColumns(l.getText().length()+1);
//c.label.setRows(l.getText().length()+1);