[DEV] android is back

Update header licence of the java files
Update font search
Corection of the dimention system ==> might be tested again
This commit is contained in:
Edouard DUPIN 2013-07-13 22:18:35 +02:00
parent d92b24b89d
commit 3b23c15a91
16 changed files with 166 additions and 282 deletions

2
build

@ -1 +1 @@
Subproject commit 3cfc489b02d62600898973b1a4a29543fc8a691a Subproject commit 8478e412ae1d3a80c463f5f4bec7f9b846be33ef

2
external/etk vendored

@ -1 +1 @@
Subproject commit c7ece69d4e1018107b4d6c0b5f99764e06df0827 Subproject commit 61bd6002d03ac065c40ac581661495fe9e237706

View File

@ -1,34 +0,0 @@
/**
*******************************************************************************
* @file __PROJECT_NAME__.java
* @brief Java __PROJECT_NAME__ code.
* @author Edouard DUPIN, Kevin BILLONNEAU
* @date 11/07/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
package __PROJECT_ORG_TYPE__.__PROJECT_VENDOR__.__PROJECT_PACKAGE__;
import org.ewol.EwolActivity;
public class __PROJECT_NAME__ extends EwolActivity {
public void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initApkPath("__PROJECT_ORG_TYPE__", "__PROJECT_VENDOR__", "__PROJECT_PACKAGE__");
}
}

View File

@ -1,25 +1,9 @@
/** /**
*******************************************************************************
* @file Ewol.java
* @brief Java interface to the CPP code.
* @author Edouard DUPIN, Kevin BILLONNEAU * @author Edouard DUPIN, Kevin BILLONNEAU
* @date 20/04/2012
* @par Project
* ewol
* *
* @par Copyright * @copyright 2011, Edouard DUPIN, all right reserved
* Copyright 2011 Edouard DUPIN, all right reserved
* *
* This software is distributed in the hope that it will be useful, but WITHOUT * @license BSD v3 (see license file)
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/ */
package org.ewol; package org.ewol;

View File

@ -1,25 +1,9 @@
/** /**
*******************************************************************************
* @file EwolActivity.java
* @brief Java EwolActivity code.
* @author Edouard DUPIN, Kevin BILLONNEAU * @author Edouard DUPIN, Kevin BILLONNEAU
* @date 20/04/2012
* @par Project
* ewol
* *
* @par Copyright * @copyright 2011, Edouard DUPIN, all right reserved
* Copyright 2011 Edouard DUPIN, all right reserved
* *
* This software is distributed in the hope that it will be useful, but WITHOUT * @license BSD v3 (see license file)
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/ */
@ -105,9 +89,6 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
//packageManager.checkPermission("android.permission.READ_SMS", myPackage) == PERMISSION_GRANTED; //packageManager.checkPermission("android.permission.READ_SMS", myPackage) == PERMISSION_GRANTED;
//Ewol.paramSetArchiveDir(3, getExternalCacheDir().toString()); //Ewol.paramSetArchiveDir(3, getExternalCacheDir().toString());
// return apk file path (or null on error)
//initApkPath("__PROJECT_ORG_TYPE__", "__PROJECT_VENDOR__", "__PROJECT_PACKAGE__");
DisplayMetrics metrics = new DisplayMetrics(); DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics); getWindowManager().getDefaultDisplay().getMetrics(metrics);
EWOL.displayPropertyMetrics(metrics.xdpi, metrics.ydpi); EWOL.displayPropertyMetrics(metrics.xdpi, metrics.ydpi);

View File

@ -1,25 +1,9 @@
/** /**
*******************************************************************************
* @file EwolAudioTask.java
* @brief Java Audio interface code.
* @author Edouard DUPIN, Kevin BILLONNEAU * @author Edouard DUPIN, Kevin BILLONNEAU
* @date 29/06/2012
* @par Project
* ewol
* *
* @par Copyright * @copyright 2011, Edouard DUPIN, all right reserved
* Copyright 2011 Edouard DUPIN, all right reserved
* *
* This software is distributed in the hope that it will be useful, but WITHOUT * @license BSD v3 (see license file)
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/ */
package org.ewol; package org.ewol;

View File

@ -1,25 +1,9 @@
/** /**
*******************************************************************************
* @file EwolCallback.java
* @brief CPP callback.
* @author Edouard DUPIN, Kevin BILLONNEAU * @author Edouard DUPIN, Kevin BILLONNEAU
* @date 20/04/2012
* @par Project
* ewol
* *
* @par Copyright * @copyright 2011, Edouard DUPIN, all right reserved
* Copyright 2011 Edouard DUPIN, all right reserved
* *
* This software is distributed in the hope that it will be useful, but WITHOUT * @license BSD v3 (see license file)
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/ */
package org.ewol; package org.ewol;

View File

@ -1,31 +1,13 @@
/** /**
*******************************************************************************
* @file EwolConstants.java
* @brief Java Contants interface.
* @author Edouard DUPIN, Kevin BILLONNEAU * @author Edouard DUPIN, Kevin BILLONNEAU
* @date 29/06/2012
* @par Project
* ewol
* *
* @par Copyright * @copyright 2011, Edouard DUPIN, all right reserved
* Copyright 2011 Edouard DUPIN, all right reserved
* *
* This software is distributed in the hope that it will be useful, but WITHOUT * @license BSD v3 (see license file)
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/ */
package org.ewol; package org.ewol;
public interface EwolConstants { public interface EwolConstants {
public static final int NATIVE_AUDIO_BUFFER_SIZE = 512; public static final int NATIVE_AUDIO_BUFFER_SIZE = 512;
public static final int EWOL_SYSTEM_KEY_VOLUME_UP = 1; public static final int EWOL_SYSTEM_KEY_VOLUME_UP = 1;

View File

@ -1,25 +1,9 @@
/** /**
*******************************************************************************
* @file EwolRendererGL.java
* @brief Java openGl interface code.
* @author Edouard DUPIN, Kevin BILLONNEAU * @author Edouard DUPIN, Kevin BILLONNEAU
* @date 20/04/2012
* @par Project
* ewol
* *
* @par Copyright * @copyright 2011, Edouard DUPIN, all right reserved
* Copyright 2011 Edouard DUPIN, all right reserved
* *
* This software is distributed in the hope that it will be useful, but WITHOUT * @license BSD v3 (see license file)
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/ */
package org.ewol; package org.ewol;

View File

@ -1,25 +1,9 @@
/** /**
*******************************************************************************
* @file EwolSurfaceViewGL.java
* @brief Java interface of the java Surface viewer code.
* @author Edouard DUPIN, Kevin BILLONNEAU * @author Edouard DUPIN, Kevin BILLONNEAU
* @date 20/04/2012
* @par Project
* ewol
* *
* @par Copyright * @copyright 2011, Edouard DUPIN, all right reserved
* Copyright 2011 Edouard DUPIN, all right reserved
* *
* This software is distributed in the hope that it will be useful, but WITHOUT * @license BSD v3 (see license file)
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/ */
package org.ewol; package org.ewol;

View File

@ -14,32 +14,38 @@
// TODO : Set this in a super class acced in a statin fuction... // TODO : Set this in a super class acced in a statin fuction...
// ratio in milimeter : // ratio in milimeter :
static bool isInit = false;
static vec2 ratio(9999999,888888); static vec2 ratio(9999999,888888);
static vec2 invRatio(1,1); static vec2 invRatio(1,1);
static ewol::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel); static ewol::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel);
static const float inchToMillimeter = 25.4f; static const float inchToMillimeter = 1.0f/25.4f;
static const float footToMillimeter = 304.8f; static const float footToMillimeter = 1.0f/304.8f;
static const float meterToMillimeter = 1000.0f; static const float meterToMillimeter = 1.0f/1000.0f;
static const float centimeterToMillimeter = 10.0f; static const float centimeterToMillimeter = 1.0f/10.0f;
static const float kilometerToMillimeter = 1000000.0f; static const float kilometerToMillimeter = 1.0f/1000000.0f;
static const float millimeterToInch = 1.0f/25.4f; static const float millimeterToInch = 25.4f;
static const float millimeterToFoot = 1.0f/304.8f; static const float millimeterToFoot = 304.8f;
static const float millimeterToMeter = 1.0f/1000.0f; static const float millimeterToMeter =1000.0f;
static const float millimeterToCentimeter = 1.0f/10.0f; static const float millimeterToCentimeter = 10.0f;
static const float millimeterToKilometer = 1.0f/1000000.0f; static const float millimeterToKilometer = 1000000.0f;
void ewol::dimension::Init(void) void ewol::dimension::Init(void)
{ {
if (true==isInit) {
return;
}
ewol::Dimension conversion(vec2(72,72), ewol::Dimension::Inch); ewol::Dimension conversion(vec2(72,72), ewol::Dimension::Inch);
ratio = conversion.GetMillimeter(); ratio = conversion.GetMillimeter();
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
windowsSize.Set(vec2(200,200), ewol::Dimension::Pixel); windowsSize.Set(vec2(200,200), ewol::Dimension::Pixel);
isInit = true;
} }
void ewol::dimension::UnInit(void) void ewol::dimension::UnInit(void)
{ {
isInit = false;
ratio.setValue(9999999,888888); ratio.setValue(9999999,888888);
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
windowsSize.Set(vec2(9999999,88888), ewol::Dimension::Pixel); windowsSize.Set(vec2(9999999,88888), ewol::Dimension::Pixel);
@ -47,7 +53,10 @@ void ewol::dimension::UnInit(void)
void ewol::dimension::SetPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type) void ewol::dimension::SetPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type)
{ {
ewol::dimension::Init();
EWOL_INFO("Set a new screen ratio for the screen : ratio=" << _ratio << " type=" << _type);
ewol::Dimension conversion(_ratio, _type); ewol::Dimension conversion(_ratio, _type);
EWOL_INFO(" ==> " << conversion);
ratio = conversion.GetMillimeter(); ratio = conversion.GetMillimeter();
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio); EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio);

View File

@ -297,41 +297,53 @@ static int32_t nextP2(int32_t value)
} }
val *=2; val *=2;
} }
EWOL_CRITICAL("impossible CASE...."); EWOL_CRITICAL("impossible CASE.... request P2 of " << value);
return val; return val;
} }
bool ewol::resource::Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size) bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size)
{ {
etk::UString TmpFilename = filename; EWOL_ERROR("11111111111111 " << _filename << " " << _size);
if (false == filename.EndWith(".svg") ) { if (_size.x()==0) {
size = ivec2(-1,-1); _size.setX(-1);
EWOL_ERROR("Error Request the image size.x() =0 ???");
} }
if (_size.y()==0) {
_size.setY(-1);
EWOL_ERROR("Error Request the image size.y() =0 ???");
}
EWOL_ERROR("222222222222222222 " << _size);
etk::UString TmpFilename = _filename;
if (false == _filename.EndWith(".svg") ) {
_size = ivec2(-1,-1);
}
EWOL_ERROR("3333333333333333 " << _size);
#ifdef __TARGET_OS__MacOs #ifdef __TARGET_OS__MacOs
EWOL_WARNING("TODO : Remove this strange hack"); EWOL_WARNING("TODO : Remove this strange hack");
size = ivec2(64,64); _size = ivec2(64,64);
#endif #endif
if (size.x()>0 && size.y()>0) { if (_size.x()>0 && _size.y()>0) {
ivec2 size2(nextP2(size.x()), nextP2(size.y())); EWOL_ERROR("44444444444444 " << _size);
ivec2 size2(nextP2(_size.x()), nextP2(_size.y()));
TmpFilename += ":"; TmpFilename += ":";
TmpFilename += size2.x(); TmpFilename += size2.x();
TmpFilename += "x"; TmpFilename += "x";
TmpFilename += size2.y(); TmpFilename += size2.y();
} }
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" basic size=" << size); EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" basic size=" << _size);
object = static_cast<ewol::TextureFile*>(LocalKeep(TmpFilename)); _object = static_cast<ewol::TextureFile*>(LocalKeep(TmpFilename));
if (NULL != object) { if (NULL != _object) {
return true; return true;
} }
EWOL_INFO(" ==> create new one..."); EWOL_INFO(" ==> create new one...");
// need to crate a new one ... // need to crate a new one ...
object = new ewol::TextureFile(TmpFilename, filename, size); _object = new ewol::TextureFile(TmpFilename, _filename, _size);
if (NULL == object) { if (NULL == _object) {
EWOL_ERROR("allocation error of a resource : " << filename); EWOL_ERROR("allocation error of a resource : " << _filename);
return false; return false;
} }
LocalAdd(object); LocalAdd(_object);
return true; return true;
} }

View File

@ -20,7 +20,7 @@
ewol::TextureFile::TextureFile(etk::UString _genName, const etk::UString& _tmpfileName, const ivec2& _size) : ewol::TextureFile::TextureFile(etk::UString _genName, const etk::UString& _tmpfileName, const ivec2& _size) :
Texture(_genName) Texture(_genName)
{ {
if (true == egami::Load(m_data, _tmpfileName, _size)) { if (false == egami::Load(m_data, _tmpfileName, _size)) {
EWOL_ERROR("ERROR when loading the image : " << _tmpfileName); EWOL_ERROR("ERROR when loading the image : " << _tmpfileName);
} }
ivec2 tmp = m_data.GetSize(); ivec2 tmp = m_data.GetSize();

View File

@ -51,7 +51,7 @@ static int32_t nextP2(int32_t value)
} }
val *=2; val *=2;
} }
EWOL_CRITICAL("impossible CASE...."); EWOL_CRITICAL("impossible CASE.... request power 2 of "<< value);
return val; return val;
} }
@ -122,25 +122,26 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
m_name = fontName.Extract(0, (tmpPos - tmpData)); m_name = fontName.Extract(0, (tmpPos - tmpData));
m_size = tmpSize; m_size = tmpSize;
etk::UString fontBaseFolder("DATA:fonts"); etk::Vector<etk::UString> folderList;
if (true==GetFontInSystem()) { if (true==GetFontInSystem()) {
#if defined(__TARGET_OS__Android) #if defined(__TARGET_OS__Android)
fontBaseFolder = "/system/font"; folderList.PushBack("/system/fonts");
#elif defined(__TARGET_OS__Linux) #elif defined(__TARGET_OS__Linux)
fontBaseFolder = "/usr/share/fonts/truetype"; folderList.PushBack("/usr/share/fonts/truetype");
#endif #endif
} }
etk::FSNode myFolder(fontBaseFolder); folderList.PushBack("DATA:fonts");
for (int32_t folderID=0; folderID<folderList.Size() ; folderID++) {
etk::FSNode myFolder(folderList[folderID]);
// find the real Font name : // find the real Font name :
etk::Vector<etk::UString> output; etk::Vector<etk::UString> output;
myFolder.FolderGetRecursiveFiles(output); myFolder.FolderGetRecursiveFiles(output);
etk::Vector<etk::UString> split = m_name.Split(';'); etk::Vector<etk::UString> split = m_name.Split(';');
EWOL_INFO("try to find font named : '" << split << "' in : '" << myFolder <<"'"); EWOL_INFO("try to find font named : '" << split << "' in : '" << myFolder <<"'");
//EWOL_CRITICAL("parse string : " << split); //EWOL_CRITICAL("parse string : " << split);
bool hasFindAFont = false;
for (int32_t jjj=0; jjj<split.Size(); jjj++) { for (int32_t jjj=0; jjj<split.Size(); jjj++) {
EWOL_INFO(" try with : '" << split[jjj] << "'"); EWOL_INFO(" try with : '" << split[jjj] << "'");
bool hasFindAFont = false;
for (int32_t iii=0; iii<output.Size(); iii++) { for (int32_t iii=0; iii<output.Size(); iii++) {
//EWOL_DEBUG(" file : " << output[iii]); //EWOL_DEBUG(" file : " << output[iii]);
if( true == output[iii].EndWith(split[jjj]+"-"+"bold"+".ttf", false) if( true == output[iii].EndWith(split[jjj]+"-"+"bold"+".ttf", false)
@ -191,7 +192,13 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
EWOL_ERROR("Find NO font in the LIST ... " << split); EWOL_ERROR("Find NO font in the LIST ... " << split);
} }
} }
if (hasFindAFont==true) {
EWOL_INFO(" Find this font : '" << folderList[folderID] << "'");
break;
} else if (folderID==folderList.Size()-1) {
EWOL_ERROR("Find NO font in the LIST ... " << folderList);
}
}
// try to find the reference mode : // try to find the reference mode :
ewol::font::mode_te refMode = ewol::font::Regular; ewol::font::mode_te refMode = ewol::font::Regular;
for(int32_t iii=3; iii>=0; iii--) { for(int32_t iii=3; iii>=0; iii--) {

View File

@ -54,16 +54,19 @@ widget::Image::Image(const etk::UString& _file, const ewol::Dimension& _border)
void widget::Image::SetFile(const etk::UString& _file) void widget::Image::SetFile(const etk::UString& _file)
{ {
EWOL_DEBUG("Set Image : " << _file);
// copy data : // copy data :
m_fileName = _file; m_fileName = _file;
// Force redraw all : // Force redraw all :
MarkToRedraw(); MarkToRedraw();
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
EWOL_DEBUG("Set sources : " << m_fileName << " size=" << vec2(64,64));
m_compositing.SetSource(m_fileName, vec2(64,64)); m_compositing.SetSource(m_fileName, vec2(64,64));
} }
void widget::Image::SetBorder(const ewol::Dimension& _border) void widget::Image::SetBorder(const ewol::Dimension& _border)
{ {
EWOL_DEBUG("Set border=" << _border);
// copy data : // copy data :
m_border = _border; m_border = _border;
// Force redraw all : // Force redraw all :
@ -85,20 +88,24 @@ void widget::Image::SetKeepRatio(bool _keep)
void widget::Image::SetImageSize(const ewol::Dimension& _size) void widget::Image::SetImageSize(const ewol::Dimension& _size)
{ {
EWOL_DEBUG("Set Image size : " << _size);
m_imageSize = _size; m_imageSize = _size;
MarkToRedraw(); MarkToRedraw();
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
EWOL_DEBUG("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel()); m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
} }
void widget::Image::Set(const etk::UString& _file, const ewol::Dimension& _border) void widget::Image::Set(const etk::UString& _file, const ewol::Dimension& _border)
{ {
EWOL_DEBUG("Set Image : " << _file << " border=" << _border);
// copy data : // copy data :
m_border = _border; m_border = _border;
m_fileName = _file; m_fileName = _file;
// Force redraw all : // Force redraw all :
MarkToRedraw(); MarkToRedraw();
ewol::RequestUpdateSize(); ewol::RequestUpdateSize();
EWOL_DEBUG("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel()); m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
} }

View File

@ -195,8 +195,8 @@ def Create(target):
java_tmp_src = java_tmp_dir + "org/ewol/EwolConstants" java_tmp_src = java_tmp_dir + "org/ewol/EwolConstants"
lutinMultiprocess.RunCommand("javac " + java_tmp_src + ".java") lutinMultiprocess.RunCommand("javac " + java_tmp_src + ".java")
lutinMultiprocess.RunCommand("cd " + java_tmp_dir + " && javah org.ewol.EwolConstants") lutinMultiprocess.RunCommand("cd " + java_tmp_dir + " && javah org.ewol.EwolConstants")
lutinMultiprocess.RunCommand("mv " + java_tmp_dir + "org_ewol_EwolConstants.h " + cpp_tmp_dir) lutinTools.CopyFile(java_tmp_dir + "org_ewol_EwolConstants.h", cpp_tmp_dir + "org_ewol_EwolConstants.h", True)
lutinMultiprocess.RunCommand("rm " + java_tmp_src + ".class") lutinTools.RemoveFile(java_tmp_src + ".class")
myModule.AddSrcFile("ewol/renderer/os/gui.Android.cpp") myModule.AddSrcFile("ewol/renderer/os/gui.Android.cpp")