mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 10:32:39 +08:00
Merge pull request #305 from zilongshanren/fix-android-related-issues-1.3
fix Android compile and running issues
This commit is contained in:
@@ -33,6 +33,7 @@ THE SOFTWARE.
|
||||
#include "base/ccTypes.h"
|
||||
#include "platform/android/jni/JniHelper.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "base/ccUTF8.h"
|
||||
|
||||
static const std::string helperClassName = "org/cocos2dx/lib/Cocos2dxHelper";
|
||||
|
||||
@@ -113,9 +114,7 @@ public:
|
||||
* and data.
|
||||
* use this approach to decrease the jni call number
|
||||
*/
|
||||
int count = strlen(text);
|
||||
jbyteArray strArray = methodInfo.env->NewByteArray(count);
|
||||
methodInfo.env->SetByteArrayRegion(strArray, 0, count, reinterpret_cast<const jbyte*>(text));
|
||||
auto jstrText = cocos2d::StringUtils::newStringUTFJNI(methodInfo.env, text);
|
||||
jstring jstrFont = methodInfo.env->NewStringUTF(fullPathOrFontName.c_str());
|
||||
bool ret = true;
|
||||
if(!methodInfo.env->CallStaticBooleanMethod(methodInfo.classID, methodInfo.methodID, jstrText,
|
||||
@@ -132,7 +131,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
methodInfo.env->DeleteLocalRef(strArray);
|
||||
methodInfo.env->DeleteLocalRef(jstrText);
|
||||
methodInfo.env->DeleteLocalRef(jstrFont);
|
||||
methodInfo.env->DeleteLocalRef(methodInfo.classID);
|
||||
|
||||
|
||||
@@ -142,11 +142,14 @@ public final class Cocos2dxBitmap {
|
||||
return paint.getTypeface();
|
||||
}
|
||||
|
||||
public static boolean createTextBitmapShadowStroke(byte[] bytes, final String fontName, int fontSize,
|
||||
int fontTintR, int fontTintG, int fontTintB, int fontTintA,
|
||||
int alignment, int width, int height,
|
||||
boolean stroke, int strokeR, int strokeG, int strokeB, int strokeA,
|
||||
float strokeSize, boolean enableWrap, int overflow, boolean enableBold) {
|
||||
public static boolean createTextBitmapShadowStroke(final String string, final String fontName, int fontSize,
|
||||
int fontTintR, int fontTintG, int fontTintB, int fontTintA,
|
||||
int alignment, int width, int height,
|
||||
boolean stroke, int strokeR, int strokeG, int strokeB, int strokeA, float strokeSize,
|
||||
boolean enableWrap,
|
||||
int overflow,
|
||||
boolean enableBold) {
|
||||
|
||||
|
||||
Layout.Alignment hAlignment = Layout.Alignment.ALIGN_NORMAL;
|
||||
int horizontalAlignment = alignment & 0x0F;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Cocos2dxVideoHelper {
|
||||
|
||||
private FrameLayout mLayout = null;
|
||||
private Cocos2dxActivity mActivity = null;
|
||||
private SparseArray<Cocos2dxVideoView> sVideoViews = null;
|
||||
private static SparseArray<Cocos2dxVideoView> sVideoViews = null;
|
||||
static VideoHandler mVideoHandler = null;
|
||||
private static Handler sHandler = null;
|
||||
|
||||
@@ -392,7 +392,7 @@ public class Cocos2dxVideoHelper {
|
||||
Callable<Float> callable = new Callable<Float>() {
|
||||
@Override
|
||||
public Float call() throws Exception {
|
||||
Cocos2dxVideoView video = mVideoViews.get(index);
|
||||
Cocos2dxVideoView video = sVideoViews.get(index);
|
||||
float currentPosition = -1;
|
||||
if (video != null) {
|
||||
currentPosition = video.getCurrentPosition() / 1000.0f;
|
||||
@@ -414,7 +414,7 @@ public class Cocos2dxVideoHelper {
|
||||
Callable<Float> callable = new Callable<Float>() {
|
||||
@Override
|
||||
public Float call() throws Exception {
|
||||
Cocos2dxVideoView video = mVideoViews.get(index);
|
||||
Cocos2dxVideoView video = sVideoViews.get(index);
|
||||
float duration = -1;
|
||||
if (video != null) {
|
||||
duration = video.getDuration() / 1000.0f;
|
||||
@@ -436,7 +436,7 @@ public class Cocos2dxVideoHelper {
|
||||
Callable<Boolean> callable = new Callable<Boolean>() {
|
||||
@Override
|
||||
public Boolean call() throws Exception {
|
||||
Cocos2dxVideoView video = mVideoViews.get(index);
|
||||
Cocos2dxVideoView video = sVideoViews.get(index);
|
||||
return video != null && video.isPlaying();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user