Skip to content
13 changes: 6 additions & 7 deletions CodenameOne/src/com/codename1/charts/ChartComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -869,15 +869,14 @@ private void zoomTransition(double minX, double maxX, double minY, double maxY,
} else {
Shape currentViewPort = screenToChartShape(new Rectangle(getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()));
float[] currentRect = currentViewPort.getBounds2D();
float[] newRect = new float[]{(float) minX, (float) (maxX - minX), (float) minY, (float) (maxY - minY)};

float currentAspect = currentRect[2] / currentRect[3];
float newAspect = 1.0f;
Rectangle newViewPort = new Rectangle((int) newRect[0], (int) newRect[1], (int) newRect[2], (int) newRect[3]);
if (newAspect != currentAspect) {
newViewPort.setHeight((int) (((double) newViewPort.getWidth()) / currentAspect));
newRect = newViewPort.getBounds2D();
newAspect = newRect[2] / newRect[3];
Rectangle newViewPort = new Rectangle((int) minX, (int) (maxX - minX), (int) minY, (int) (maxY - minY));
if (newViewPort.getHeight() != 0) {
float newAspect = (float) newViewPort.getWidth() / (float) newViewPort.getHeight();
if (newAspect != currentAspect) {
newViewPort.setHeight((int) (((double) newViewPort.getWidth()) / currentAspect));
}
}

ZoomTransition zt = new ZoomTransition(currentViewPort.getBounds(), newViewPort, duration);
Expand Down
2 changes: 0 additions & 2 deletions CodenameOne/src/com/codename1/io/gzip/Adler32.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public void update(byte[] buf, int index, int len) {
int len2 = len % NMAX;
while (len1-- > 0) {
int k = NMAX;
len -= k;
while (k-- > 0) {
s1 += buf[index++] & 0xff;
s2 += s1;
Expand All @@ -102,7 +101,6 @@ public void update(byte[] buf, int index, int len) {
}

int k = len2;
len -= k;
while (k-- > 0) {
s1 += buf[index++] & 0xff;
s2 += s1;
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/io/gzip/Deflate.java
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ int deflate_slow(int flush) {
}

if (match_available != 0) {
bflush = _tr_tally(0, window[strstart - 1] & 0xff);
_tr_tally(0, window[strstart - 1] & 0xff);
match_available = 0;
}
flush_block_only(flush == Z_FINISH);
Expand Down
2 changes: 0 additions & 2 deletions CodenameOne/src/com/codename1/io/gzip/InfCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,6 @@ int proc(int r) {
s.write = q;
r = s.inflate_flush(r);
q = s.write;
m = q < s.read ? s.read - q - 1 : s.end - q;

if (s.read != s.write) {
s.bitb = b;
s.bitk = k;
Expand Down
4 changes: 0 additions & 4 deletions CodenameOne/src/com/codename1/io/gzip/Inflate.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,6 @@ int inflate(int f) {
case DICT4:

if (z.avail_in == 0) return r;
r = f;

z.avail_in--;
z.total_in++;
this.need = ((long) (z.next_in[z.next_in_index++] & 0xff) << 24) & 0xff000000L;
Expand Down Expand Up @@ -718,15 +716,13 @@ private int readBytes(int r, int f) throws Return {
if (tmp_string == null) {
tmp_string = new java.io.ByteArrayOutputStream();
}
int b = 0;
while (this.need > 0) {
if (z.avail_in == 0) {
throw new Return(r);
}
r = f;
z.avail_in--;
z.total_in++;
b = z.next_in[z.next_in_index];
tmp_string.write(z.next_in, z.next_in_index, 1);
z.adler.update(z.next_in, z.next_in_index, 1);
z.next_in_index++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public void readHeader() throws IOException {
inflater.setInput(empty, 0, 0, false);
inflater.setOutput(empty, 0, 0);

int err = inflater.inflate(JZlib.Z_NO_FLUSH);
inflater.inflate(JZlib.Z_NO_FLUSH);
if (!inflater.istate.inParsingHeader()) {
return;
}
Expand All @@ -233,7 +233,7 @@ public void readHeader() throws IOException {
if (i <= 0)
throw new IOException("no input");
inflater.setInput(b1);
err = inflater.inflate(JZlib.Z_NO_FLUSH);
int err = inflater.inflate(JZlib.Z_NO_FLUSH);
if (err != 0/*Z_OK*/)
throw new IOException(inflater.msg);
}
Expand Down
9 changes: 5 additions & 4 deletions CodenameOne/src/com/codename1/io/gzip/Tree.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,14 @@ private static int bi_reverse(
int len // its bit length
) {
int res = 0;
do {
for (int i = 0; i < len; i++) {
res |= code & 1;
code >>>= 1;
res <<= 1;
if (i + 1 < len) {
res <<= 1;
}
}
while (--len > 0);
return res >>> 1;
return res;
}

// Compute the optimal bit lengths for a tree and update the total bit length
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/l10n/SimpleDateFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public String format(Date source) {
@Override
String format(Date source, StringBuffer toAppendTo) {
StringBuilder sb = new StringBuilder();
String out = format(source, sb);
format(source, sb);
toAppendTo.append(sb);
return toAppendTo.toString();

Expand Down
2 changes: 0 additions & 2 deletions CodenameOne/src/com/codename1/location/GeofenceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ private synchronized void updateExpiryTimes(Geofence... geofences) {
private synchronized void purgeExpired() {
long now = System.currentTimeMillis();
Map<String, Long> times = getExpiryTimes(false);
List<String> expired = new ArrayList<String>();
Map<String, Geofence> fences = getFences(false);
List<String> activeKeys = getActiveKeys(false);
Map<String, Geofence> activeFences = getActiveFences(false);
Expand Down Expand Up @@ -532,7 +531,6 @@ public synchronized void update(int timeout, boolean forceRefresh) {
List<String> activeKeys = getActiveKeys(false);
for (String id : activeIds) {
Geofence g = getFences(false).get(id);
Geofence cg = getActiveFences(false).get(id);
if (!forceRefresh && g != null) {
if (!isWithinRadius(g.getLoc(), here, getBubbleRadius() + g.getRadius())) {
LocationManager.getLocationManager().removeGeoFencing(id);
Expand Down
4 changes: 2 additions & 2 deletions CodenameOne/src/com/codename1/maps/MapComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,9 @@ public void run() {
y = y - getAbsoluteY();
Tile t = screenTile();
Coord southWest = t.position(x - 20, t.dimension().getHeight() - y - 20);
Coord c = Mercator.inverseMercator(southWest.getLatitude(), southWest.getLongitude());
Mercator.inverseMercator(southWest.getLatitude(), southWest.getLongitude());
Coord northEast = t.position(x + 20, t.dimension().getHeight() - y + 20);
c = Mercator.inverseMercator(northEast.getLatitude(), northEast.getLongitude());
Mercator.inverseMercator(northEast.getLatitude(), northEast.getLongitude());

BoundingBox bbox = new BoundingBox(southWest, northEast);
Enumeration e = _layers.elements();
Expand Down
1 change: 0 additions & 1 deletion CodenameOne/src/com/codename1/payment/Purchase.java
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ public void onSucess(Receipt[] value) {
private Date getExpiryDate(Receipt[] receipts, String... skus) {
Date expiryDate = new Date(0L);
List<String> lSkus = Arrays.asList(skus);
long now = System.currentTimeMillis();

for (Receipt r : receipts) {
if (!lSkus.contains(r.getSku())) {
Expand Down
4 changes: 1 addition & 3 deletions CodenameOne/src/com/codename1/share/FacebookShare.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public void actionPerformed(ActionEvent evt) {

public void actionPerformed(ActionEvent evt) {
NetworkEvent ne = (NetworkEvent) evt;
int code = ne.getResponseCode();
FaceBookAccess.getInstance().removeResponseCodeListener(this);
progress.dispose();
Dialog.show("Failed to Share", "for some reason sharing has failed, try again later.", "Ok", null);
Expand Down Expand Up @@ -133,8 +132,7 @@ public void actionPerformed(ActionEvent evt) {

public void actionPerformed(ActionEvent evt) {
NetworkEvent ne = (NetworkEvent) evt;
int code = ne.getResponseCode();
FaceBookAccess.getInstance().removeResponseCodeListener(this);
FaceBookAccess.getInstance().removeResponseCodeListener(this);
progress.dispose();
Dialog.show("Failed to Share", "for some reason sharing has failed, try again later.", "Ok", null);
finish();
Expand Down
1 change: 0 additions & 1 deletion CodenameOne/src/com/codename1/testing/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ public static boolean screenshotTest(String screenshotName) {
int[] rgba = mute.getRGBCached();
Image orig = Image.createImage(Storage.getInstance().createInputStream(screenshotName));
int[] origRgba = orig.getRGBCached();
orig = null;
for (int iter = 0; iter < rgba.length; iter++) {
if (rgba[iter] != origRgba[iter]) {
log("screenshots do not match at offset " + iter + " saving additional image under " + screenshotName + ".fail");
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/ui/ComboBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ public int getBaseline(int width, int height) {
Component selected;
if (getRenderingPrototype() != null) {
selected = getRenderer().getListCellRendererComponent(this, getRenderingPrototype(), 0, true);
}
if (getModel().getSize() > 0) {
} else if (getModel().getSize() > 0) {
selected = getRenderer().getListCellRendererComponent(this, getModel().getItemAt(0), 0, true);
} else {
selected = getRenderer().getListCellRendererComponent(this, "XXXXXXXXXXX", 0, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ protected void paintBackground(Graphics g) {
int w = f.charWidth('M');
Style s = cmp == null ? getStyle() : cmp.getStyle();

int paddingTop = s.getPaddingTop();
int paddingLeft = s.getPaddingLeftNoRTL();
int paddingRight = s.getPaddingRightNoRTL();
int paddingBottom = s.getPaddingBottom();
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 @@ -2332,8 +2332,6 @@ private void drawShadow(Graphics g, Image img, int relativeX, int relativeY, int
int spreadRadiusPixels = dp2px(spreadRadius);
int offsetXPixels = dp2px(offsetX);
int offsetYPixels = dp2px(offsetY);
int imageWidth = img.getWidth();
int imageHeight = img.getHeight();
for (int i = 0; i < len; i++) {
int pixel = mask[i];
int alphaMask = (pixel & 0xff000000);
Expand Down Expand Up @@ -2598,8 +2596,6 @@ public void run() {
int relativeY = 0;


long startTime = System.currentTimeMillis();

switch (elevation) {
case 1:
case 2:
Expand Down Expand Up @@ -6992,7 +6988,6 @@ protected void laidOut() {
if (ci.isEditingText()) {
return;
}
Form f = getComponentForm();
int ivk = getInvisibleAreaUnderVKB();

if (isScrollableY() && getScrollY() > 0 && getScrollY() + getHeight() >
Expand Down
3 changes: 0 additions & 3 deletions CodenameOne/src/com/codename1/ui/ComponentImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ public boolean requiresDrawImage() {
*/
@Override
protected void drawImage(Graphics g, Object nativeGraphics, int x, int y) {
int tx = g.getTranslateX();
int ty = g.getTranslateY();

int oldX = cmp.getX();
int oldY = cmp.getY();
int oldW = cmp.getWidth();
Expand Down
1 change: 0 additions & 1 deletion CodenameOne/src/com/codename1/ui/Form.java
Original file line number Diff line number Diff line change
Expand Up @@ -3656,7 +3656,6 @@ private boolean fireReleaseListeners(int x, int y) {
public void pointerReleased(int x, int y) {
try {
Component origPressedCmp = pressedCmp;
boolean inOrigPressedCmpBounds = pressedCmpAbsBounds.contains(x, y);
rippleMotion = null;
setPressedCmp(null);
boolean isScrollWheeling = Display.impl.isScrollWheeling();
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/ui/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,7 @@ public Image modifyAlphaWithTranslucency(byte alpha) {
int size = w * h;
int[] arr = getRGB();
int alphaInt = (((int) alpha) << 24) & 0xff000000;
float alphaRatio = (alpha & 0xff);
alphaRatio = (alpha & 0xff) / 255.0f;
float alphaRatio = (alpha & 0xff) / 255.0f;
for (int iter = 0; iter < size; iter++) {
int currentAlpha = (arr[iter] >> 24) & 0xff;
if (currentAlpha != 0) {
Expand Down
3 changes: 3 additions & 0 deletions CodenameOne/src/com/codename1/ui/IndexedImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ public Image scaled(int width, int height) {
}
Dimension d = new Dimension(width, height);
Image i = getCachedImage(d);
if (i != null) {
return i;
}
// currently we only support byte data...
i = new IndexedImage(width, height, palette, scaleArray(imageDataByte, width, height));
cacheImage(d, i);
Expand Down
1 change: 0 additions & 1 deletion CodenameOne/src/com/codename1/ui/LinearGradientPaint.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ private void paint(Graphics g, double x, double y, double w, double h, boolean p
double ph = Math.max(w, h) * 2;


double pEndX = (endX - x) * pw / w;
//System.out.println("px="+px+", "+py+", "+pw+", "+ph+" theta="+theta);

g.getTransform(t);
Expand Down
14 changes: 6 additions & 8 deletions CodenameOne/src/com/codename1/ui/SwipeableContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,12 @@ public void actionPerformed(ActionEvent evt) {
bottomLeftW = bottomL.getWidth();
}

Component bottomR;
int bottomRightW = 0;
int bottomRightX = topWrapper.getWidth();
if (bottomRightWrapper.getComponentCount() > 0) {
bottomR = bottomRightWrapper.getComponentAt(0);
bottomRightW = bottomR.getWidth();
bottomRightX = bottomR.getX();
}
Component bottomR;
int bottomRightW = 0;
if (bottomRightWrapper.getComponentCount() > 0) {
bottomR = bottomRightWrapper.getComponentAt(0);
bottomRightW = bottomR.getWidth();
}

switch (type) {
case PRESS: {
Expand Down
9 changes: 6 additions & 3 deletions CodenameOne/src/com/codename1/ui/Tabs.java
Original file line number Diff line number Diff line change
Expand Up @@ -1127,13 +1127,16 @@ private void initTabsFocus() {
}

private void initTabFocus(Component tab, Component content) {
Component focus = null;
if (content.isFocusable()) {
focus = content;
tab.setFocusable(true);
return;
}

if (content instanceof Container) {
focus = ((Container) content).findFirstFocusable();
Component focus = ((Container) content).findFirstFocusable();
if (focus != null) {
tab.setFocusable(true);
}
}

}
Expand Down
3 changes: 0 additions & 3 deletions CodenameOne/src/com/codename1/ui/TextArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,6 @@ public void keyReleased(int keyCode) {
onClick();
return;
}
Display d = Display.getInstance();
if (action == 0 && isTypedKey(keyCode)) {
//registerAsInputDevice();
Display.getInstance().editString(this, getMaxSize(), getConstraint(), getText(), keyCode);
Expand Down Expand Up @@ -1929,7 +1928,6 @@ public void setEndsWith3Points(boolean endsWith3Points) {
* primarily by implementation APIs.
*/
public void registerAsInputDevice() {
final TextArea cmp = this;
Form f = this.getComponentForm();

if (f != null && Display.impl.getEditingText() != this) {
Expand Down Expand Up @@ -1964,7 +1962,6 @@ public void registerAsInputDevice() {
*/
public void startEditing() {
if (!Display.getInstance().isTextEditing(this)) {
final TextArea cmp = this;
//registerAsInputDevice();
Display.getInstance().editString(this, maxSize, constraint, text);
}
Expand Down
3 changes: 1 addition & 2 deletions CodenameOne/src/com/codename1/ui/TextSelection.java
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,7 @@ private boolean isVerticallyCoveredByBounds(Component cmp, Rectangle bounds) {
private boolean shouldCoverToEndOfLine(Span span, Rectangle bounds) {
int spy = span.getBounds().getY();
int sph = span.getBounds().getHeight();
boolean shouldCoverToEndOfLine = spy + 2 * sph / 3 > bounds.getY() && spy + sph <= bounds.getY() + bounds.getHeight();
return shouldCoverToEndOfLine;
return spy + 2 * sph / 3 > bounds.getY() && spy + sph <= bounds.getY() + bounds.getHeight();
}

private void updateSnappedSelectedBounds() {
Expand Down
1 change: 0 additions & 1 deletion CodenameOne/src/com/codename1/ui/UIFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,6 @@ private static Element buildXMLFromJSONNotation(Object o) throws IOException {
return buildXMLFromJSONNotation(m.get("root"));
} else {
Object children = null;
String key = null;
if (isBorderLayout(m)) {
setBorderLayoutBehaviour(m);
el = new Element("border");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ public void initTransition() {
buffer = Image.createImage(Math.min(d.getDisplayWidth(), getDialogParent(dlg).getWidth()),
Math.min(d.getDisplayHeight(), dlg.getContentPane().getParent().getHeight() +
getDialogTitleHeight(dlg)), 0);
Graphics g = buffer.getGraphics();
Style stl = dlg.getDialogComponent().getStyle();
byte bgt = stl.getBgTransparency();
stl.setBgTransparency(0xff);
Expand Down
10 changes: 3 additions & 7 deletions CodenameOne/src/com/codename1/ui/animations/FlipTransition.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,9 @@ public boolean animate() {

}

private void makePerspectiveTransform(Transform t) {
int x = getSource().getAbsoluteX();
int y = getSource().getAbsoluteY();
int w = getSource().getWidth();
int h = getSource().getHeight();
float displayH = Display.getInstance().getDisplayHeight();
float displayW = Display.getInstance().getDisplayWidth();
private void makePerspectiveTransform(Transform t) {
float displayH = Display.getInstance().getDisplayHeight();
float displayW = Display.getInstance().getDisplayWidth();
//double midX = (float)x+(float)w/2.0;
//double midY = (float)y+(float)h/2.0;
double fovy = 0.25;
Expand Down
1 change: 0 additions & 1 deletion CodenameOne/src/com/codename1/ui/html/HTMLElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,6 @@ boolean isFirstChild() {
}
HTMLElement parent = (HTMLElement) getParent();
if (parent != null) {
Vector v = parent.getChildren();
for (Element e : parent) {
HTMLElement elem = (HTMLElement) e;
if (elem == this) {
Expand Down
Loading
Loading