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
2 changes: 2 additions & 0 deletions .github/workflows/scripts-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ name: Test Android build scripts
- 'scripts/android/lib/**/*.java'
- 'scripts/android/tests/**/*.java'
- 'scripts/device-runner-app/**/*.java'
- 'scripts/hellocodenameone/**'
- 'scripts/android/screenshots/**'
- '!scripts/android/screenshots/**/*.md'
- 'scripts/templates/**'
Expand All @@ -39,6 +40,7 @@ name: Test Android build scripts
- 'scripts/android/lib/**/*.java'
- 'scripts/android/tests/**/*.java'
- 'scripts/device-runner-app/**/*.java'
- 'scripts/hellocodenameone/**'
- 'scripts/android/screenshots/**'
- '!scripts/android/screenshots/**/*.md'
- 'scripts/templates/**'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scripts-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'scripts/build-ios-port.sh'
- 'scripts/build-ios-app.sh'
- 'scripts/run-ios-ui-tests.sh'
- 'scripts/device-runner-app/**/*.java'
- 'scripts/hellocodenameone/**'
- 'scripts/ios/tests/**'
- 'scripts/ios/screenshots/**'
- 'scripts/templates/**'
Expand All @@ -30,7 +30,7 @@ on:
- 'scripts/build-ios-port.sh'
- 'scripts/build-ios-app.sh'
- 'scripts/run-ios-ui-tests.sh'
- 'scripts/device-runner-app/**/*.java'
- 'scripts/hellocodenameone/**'
- 'scripts/ios/tests/**'
- 'scripts/ios/screenshots/**'
- 'scripts/templates/**'
Expand Down
17 changes: 17 additions & 0 deletions CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java
Original file line number Diff line number Diff line change
Expand Up @@ -8724,6 +8724,23 @@ public void announceForAccessibility(Component cmp, String text) {
// should override this method.
}

/**
* Returns the stack trace from the exception on the given
* thread. This API isn't supported on all platforms and may
* return a blank string when unavailable.
*
* @param parentThread the thread in which the exception was thrown
* @param t the exception
* @return a stack trace string that might be blank
*/
public String getStackTrace(Thread parentThread, Throwable t) {
System.out.println("CN1SS:ERR:Invoking getStackTrace in CodenameOneImplementation");
if (parentThread instanceof CodenameOneThread && ((CodenameOneThread) parentThread).hasStackFrame()) {
return ((CodenameOneThread) parentThread).getStack(t);
}
return "";
}

class RPush implements Runnable {
public void run() {
final long pushId = Preferences.get("push_id", (long) -1);
Expand Down
14 changes: 14 additions & 0 deletions CodenameOne/src/com/codename1/ui/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,20 @@ void mainEDTLoop() {
INSTANCE.edt = null;
}

/**
* Returns the stack trace from the exception on the given
* thread. This API isn't supported on all platforms and may
* return a blank string when unavailable.
*
* @param parentThread the thread in which the exception was thrown
* @param t the exception
* @return a stack trace string that might be blank
*/
public String getStackTrace(Thread parentThread, Throwable t) {
System.out.println("CN1SS:ERR:Invoking getStackTrace in Display");
return impl.getStackTrace(parentThread, t);
}

/**
* Implementation of the event dispatch loop content
*/
Expand Down
3 changes: 3 additions & 0 deletions CodenameOne/src/com/codename1/ui/Graphics.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ public void fillRect(int x, int y, int width, int height) {
impl.fillRect(nativeGraphics, xTranslate + x, yTranslate + y, width, height);
}

/**
* @deprecated this method should have been internals
*/
public void drawShadow(Image img, int x, int y, int offsetX, int offsetY, int blurRadius, int spreadRadius, int color, float opacity) {
impl.drawShadow(nativeGraphics, img.getImage(), xTranslate + x, yTranslate + y, offsetX, offsetY, blurRadius, spreadRadius, color, opacity);
}
Expand Down
20 changes: 9 additions & 11 deletions Ports/Android/src/com/codename1/impl/android/AndroidGraphics.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009 Pader-Sync Ltd. & Co. KG. All Rights Reserved.
* Copyright 2009 Pader-Sync Ltd. & Co. KG. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -144,18 +144,18 @@ public void drawImage(Object img, int x, int y) {
}

public void drawShadow(Object image, int x, int y, int offsetX, int offsetY, int blurRadius, int spreadRadius, int color, float opacity) {
if (image == null) return;
if (image == null || canvas == null) {
return;
}
Bitmap bmp = (Bitmap)image;
float bmpW = bmp.getWidth();
float bmpH = bmp.getHeight();
if (bmpW == 0 || bmpH == 0) return;


if (bmpW == 0 || bmpH == 0) {
return;
}

Bitmap scaledBmp = Bitmap.createScaledBitmap(bmp, bmp.getWidth() + 2 * spreadRadius, bmp.getHeight() + 2 * spreadRadius, false);

Paint alphaPaint = new Paint();

alphaPaint.setMaskFilter(new BlurMaskFilter(blurRadius, BlurMaskFilter.Blur.NORMAL));
int[] offsetXY = new int[2];
Bitmap bmAlpha = scaledBmp.extractAlpha(alphaPaint, offsetXY);
Expand All @@ -164,13 +164,11 @@ public void drawShadow(Object image, int x, int y, int offsetX, int offsetY, int
applyTransform();
Paint shadowPaint = new Paint();
int alpha = (int)Math.floor(opacity * 255);
shadowPaint.setColor((0xff000000 | color));
shadowPaint.setAlpha((int)Math.floor(opacity * 255));

shadowPaint.setColor(0xff000000 | color);
shadowPaint.setAlpha(alpha);
canvas.drawBitmap(bmAlpha, x + offsetXY[0] - spreadRadius + offsetX, y + offsetXY[1] - spreadRadius + offsetY, shadowPaint);
bmAlpha.recycle();


unapplyTransform();
canvas.restore();
}
Expand Down
Loading
Loading