Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ public void actionPerformed(ActionEvent evt) {
break;

case Accepted:
removeAll();
revalidateLater();
break;

case Canceled:
removeAll();
revalidateLater();
Expand Down
14 changes: 12 additions & 2 deletions CodenameOne/src/com/codename1/facebook/FBObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,24 @@ private void init(Hashtable props) {
* {@inheritDoc}
*/
public boolean equals(Object obj) {
return id.equals(((FBObject) obj).id);
if (this == obj) {
return true;
}
if (!(obj instanceof FBObject)) {
return false;
}
FBObject other = (FBObject) obj;
if (id == null) {
return other.id == null;
}
return id.equals(other.id);
}

/**
* {@inheritDoc}
*/
public int hashCode() {
return id.hashCode();
return id != null ? id.hashCode() : 0;
}


Expand Down
7 changes: 4 additions & 3 deletions CodenameOne/src/com/codename1/io/JSONParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -683,15 +683,16 @@ public Map<String, Object> parseJSON(Reader i) throws IOException {
*/
public Hashtable<String, Object> parse(Reader i) throws IOException {
modern = false;
state = new Hashtable();
parseStack = new Vector();
Hashtable<String, Object> legacyState = new Hashtable<String, Object>();
state = legacyState;
parseStack = new Vector<Object>();
currentKey = null;
if (!strict) {
String cleaned = JSONSanitizer.sanitize(Util.readToString(i));
i = new CharArrayReader(cleaned.toCharArray());
}
parse(i, this);
return (Hashtable<String, Object>) state;
return legacyState;
}

private boolean isStackHash() {
Expand Down
29 changes: 16 additions & 13 deletions CodenameOne/src/com/codename1/payment/Purchase.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public abstract class Purchase {
private static final String RECEIPTS_REFRESH_TIME_KEY = "CN1SubscriptionsDataRefreshTime.dat";
private static final String PENDING_PURCHASE_KEY = "PendingPurchases.dat";
private static final Object synchronizationLock = new Object();
private static final Object receiptsLock = new Object();
private static ReceiptStore receiptStore;
private static List<Receipt> receipts;
private static Date receiptsRefreshTime;
Expand Down Expand Up @@ -131,7 +132,7 @@ public final void setReceiptStore(ReceiptStore store) {
* @return List of receipts for purchases this app.
*/
public final List<Receipt> getReceipts() {
synchronized (RECEIPTS_KEY) {
synchronized (receiptsLock) {
if (receipts == null) {
if (Storage.getInstance().exists(RECEIPTS_KEY)) {
Receipt.registerExternalizable();
Expand All @@ -157,7 +158,7 @@ public final List<Receipt> getReceipts() {
* @param data
*/
private void setReceipts(List<Receipt> data) {
synchronized (RECEIPTS_KEY) {
synchronized (receiptsLock) {
receipts = new ArrayList<Receipt>();
receipts.addAll(data);
Storage.getInstance().writeObject(RECEIPTS_KEY, receipts);
Expand Down Expand Up @@ -187,7 +188,7 @@ public final Receipt[] getReceipts(String... skus) {
* @return
*/
private Date getReceiptsRefreshTime() {
synchronized (RECEIPTS_KEY) {
synchronized (receiptsLock) {
if (receiptsRefreshTime == null) {
if (Storage.getInstance().exists(RECEIPTS_REFRESH_TIME_KEY)) {
receiptsRefreshTime = (Date) Storage.getInstance().readObject(RECEIPTS_REFRESH_TIME_KEY);
Expand All @@ -205,7 +206,7 @@ private Date getReceiptsRefreshTime() {
* @param time
*/
private void setReceiptsRefreshTime(Date time) {
synchronized (RECEIPTS_KEY) {
synchronized (receiptsLock) {
receiptsRefreshTime = time;
Storage.getInstance().writeObject(RECEIPTS_REFRESH_TIME_KEY, receiptsRefreshTime);
}
Expand Down Expand Up @@ -569,15 +570,16 @@ public void onSucess(Boolean value) {

public void run() {

while (!complete[0]) {
synchronized (complete) {
try {
complete.wait();
} catch (Exception ex) {

while (!complete[0]) {
synchronized (complete) {
try {
complete.wait();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
return;
}
}
}
}
}

});
Expand Down Expand Up @@ -777,8 +779,9 @@ public void run() {
synchronized (complete) {
try {
complete.wait();
} catch (Exception ex) {

} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
return;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/processing/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public long getAsLong(final String path) throws IllegalArgumentException {
if (s == null) {
return 0;
}
return new Double(Double.parseDouble(s)).longValue();
return (long) Double.parseDouble(s);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/properties/UiBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public Object convert(Object source) {
return null;
}
if (source instanceof Boolean) {
return ((Boolean) source).booleanValue();
return source;
}
if (source instanceof String) {
String s = ((String) source).toLowerCase();
Expand Down
5 changes: 1 addition & 4 deletions CodenameOne/src/com/codename1/push/PushBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public String build() {
switch (type) {
case 0:
case 1:
case 5:
sb.append(body);
break;
case 2:
Expand All @@ -171,11 +172,7 @@ public String build() {
case 4:
sb.append(title).append(";").append(body);
break;
case 5:
sb.append(body);
break;
case 6:

case 100:
sb.append(badge);
break;
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/ui/BrowserComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ public JSType getJSType() {
* @return
*/
public int getInt() {
return new Double(Double.parseDouble(value)).intValue();
return (int) Double.parseDouble(value);
}

/**
Expand Down
5 changes: 0 additions & 5 deletions CodenameOne/src/com/codename1/ui/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -2602,11 +2602,6 @@ public void run() {

switch (elevation) {
case 1:
//drawShadow(g, img, relativeX, relativeY, 0, 1, 1, 0, 0, 0.14f);
//drawShadow(g, img, relativeX, relativeY, 0, 2, 1, -1, 0, 0.12f);
drawShadow(g, img, relativeX, relativeY, 0, 1, 3, 0, 0, 0.2f);
break;

case 2:
//drawShadow(g, img, relativeX, relativeY, 0, 1, 1, 0, 0, 0.14f);
//drawShadow(g, img, relativeX, relativeY, 0, 2, 1, -1, 0, 0.12f);
Expand Down
10 changes: 3 additions & 7 deletions CodenameOne/src/com/codename1/ui/Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -2951,17 +2951,13 @@ public Component getComponentAt(int x, int y) {

} else {
// No children found here
if (top == null) {
if (cmp.respondsToPointerEvents() || !(cmp instanceof Container)) {
top = cmp;
}
if (top == null && cmp.respondsToPointerEvents()) {
top = cmp;
}
}
} else {
if (top == null) {
if (cmp.respondsToPointerEvents() || !(cmp instanceof Container)) {
top = cmp;
}
top = cmp;
}
}
if (!overlaps) {
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/ui/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -2579,7 +2579,7 @@ public int convertToPixels(float value, byte unitType, boolean horizontal) {
case Style.UNIT_TYPE_VMIN:
return Math.round(value / 100f * Math.min(CN.getDisplayWidth(), CN.getDisplayHeight()));
case Style.UNIT_TYPE_VMAX:
return Math.round(value / 100f * Math.min(CN.getDisplayWidth(), CN.getDisplayHeight()));
return Math.round(value / 100f * Math.max(CN.getDisplayWidth(), CN.getDisplayHeight()));
case Style.UNIT_TYPE_DIPS:
return Display.getInstance().convertToPixels(value);
case Style.UNIT_TYPE_SCREEN_PERCENTAGE:
Expand Down
24 changes: 18 additions & 6 deletions CodenameOne/src/com/codename1/ui/Font.java
Original file line number Diff line number Diff line change
Expand Up @@ -595,14 +595,26 @@ public Object getNativeFont() {
* {@inheritDoc}
*/
public boolean equals(Object o) {
if (ttf && o != null) {
return ((Font) o).font != null && ((Font) o).ttf && ((Font) o).font.equals(font);
if (this == o) {
return true;
}
if (o != null && o.getClass() == getClass()) {
Font f = (Font) o;
return !f.ttf && f.getFace() == getFace() && f.getSize() == getSize() && f.getStyle() == getStyle();
if (!(o instanceof Font)) {
return false;
}
return false;
Font f = (Font) o;
if (ttf || f.ttf) {
if (!ttf || !f.ttf) {
return false;
}
if (font == null) {
return f.font == null;
}
return font.equals(f.font);
}
if (f.getClass() != getClass()) {
return false;
}
return f.getFace() == getFace() && f.getSize() == getSize() && f.getStyle() == getStyle();
}

/**
Expand Down
9 changes: 2 additions & 7 deletions CodenameOne/src/com/codename1/ui/List.java
Original file line number Diff line number Diff line change
Expand Up @@ -1961,13 +1961,8 @@ private void pointerReleasedImpl(int x, int y, boolean isHover, boolean longPres
} else {
boolean vertical = getOrientation() == VERTICAL;
float speed = getDragSpeed(vertical);
if (vertical) {
fixedDraggedMotion = Motion.createFrictionMotion(-fixedDraggedAnimationPosition,
Integer.MAX_VALUE, speed, 0.0007f);
} else {
fixedDraggedMotion = Motion.createFrictionMotion(-fixedDraggedAnimationPosition,
Integer.MAX_VALUE, speed, 0.0007f);
}
fixedDraggedMotion = Motion.createFrictionMotion(-fixedDraggedAnimationPosition,
Integer.MAX_VALUE, speed, 0.0007f);
fixedDraggedPosition = fixedDraggedAnimationPosition;
Form p = getComponentForm();
if (p != null) {
Expand Down
28 changes: 16 additions & 12 deletions CodenameOne/src/com/codename1/ui/SideMenuBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -1159,12 +1159,14 @@ public void run() {
Display.getInstance().invokeAndBlock(new Runnable() {

public void run() {
while (Display.getInstance().getCurrent() != parent) {
try {
Thread.sleep(40);
} catch (Exception ex) {
}
}
while (Display.getInstance().getCurrent() != parent) {
try {
Thread.sleep(40);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
return;
}
}
}
});

Expand Down Expand Up @@ -1819,12 +1821,14 @@ public void actionPerformed(ActionEvent evt) {
}

synchronized (LOCK) {
while (Display.getInstance().getCurrent() != parent) {
try {
LOCK.wait(40);
} catch (Exception ex) {
}
}
while (Display.getInstance().getCurrent() != parent) {
try {
LOCK.wait(40);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
return;
}
}
}
Display.getInstance().callSerially(this);
}
Expand Down
Loading
Loading