mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into iss2433-lua-bindings-generator
This commit is contained in:
commit
c8b75a1080
|
@ -1 +1 @@
|
|||
b00ee6aa7325a6bf73212ea843692e7a905e53e4
|
||||
0e98d65a0bf618a8eea7c4b3b2f3048308f46324
|
|
@ -65,18 +65,14 @@ label_nodes/CCFont.cpp \
|
|||
label_nodes/CCFontAtlas.cpp \
|
||||
label_nodes/CCFontAtlasCache.cpp \
|
||||
label_nodes/CCFontAtlasFactory.cpp \
|
||||
label_nodes/CCFontCache.cpp \
|
||||
label_nodes/CCFontDefinition.cpp \
|
||||
label_nodes/CCFontFNT.cpp \
|
||||
label_nodes/CCFontFreeType.cpp \
|
||||
label_nodes/CCFontRenderFreeType.cpp \
|
||||
label_nodes/CCLabel.cpp \
|
||||
label_nodes/CCLabelAtlas.cpp \
|
||||
label_nodes/CCLabelBMFont.cpp \
|
||||
label_nodes/CCLabelTTF.cpp \
|
||||
label_nodes/CCLabelTextFormatter.cpp \
|
||||
label_nodes/CCStringBMFont.cpp \
|
||||
label_nodes/CCStringTTF.cpp \
|
||||
label_nodes/CCTextImage.cpp \
|
||||
layers_scenes_transitions_nodes/CCLayer.cpp \
|
||||
layers_scenes_transitions_nodes/CCScene.cpp \
|
||||
|
|
|
@ -99,8 +99,7 @@ THE SOFTWARE.
|
|||
#include "label_nodes/CCLabelAtlas.h"
|
||||
#include "label_nodes/CCLabelTTF.h"
|
||||
#include "label_nodes/CCLabelBMFont.h"
|
||||
#include "label_nodes/CCStringBMFont.h"
|
||||
#include "label_nodes/CCStringTTF.h"
|
||||
#include "label_nodes/CCLabel.h"
|
||||
|
||||
// layers_scenes_transitions_nodes
|
||||
#include "layers_scenes_transitions_nodes/CCLayer.h"
|
||||
|
|
|
@ -25,8 +25,88 @@
|
|||
#include "CCFont.h"
|
||||
#include "support/ccUTF8.h"
|
||||
|
||||
#include "CCFontFNT.h"
|
||||
#include "CCFontFreeType.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
const char * Font::_glyphASCII = "\"!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ ";
|
||||
|
||||
const char * Font::_glyphNEHE = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ";
|
||||
|
||||
|
||||
Font::Font() : _usedGlyphs(GlyphCollection::ASCII), _customGlyphs(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
const char * Font::getGlyphCollection(GlyphCollection glyphs)
|
||||
{
|
||||
switch (glyphs)
|
||||
{
|
||||
case GlyphCollection::NEHE:
|
||||
return _glyphNEHE;
|
||||
break;
|
||||
|
||||
case GlyphCollection::ASCII:
|
||||
return _glyphASCII;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Font::setCurrentGlyphCollection(GlyphCollection glyphs, const char *customGlyphs)
|
||||
{
|
||||
if (_customGlyphs)
|
||||
delete [] _customGlyphs;
|
||||
|
||||
switch (glyphs)
|
||||
{
|
||||
case GlyphCollection::NEHE:
|
||||
_customGlyphs = 0;
|
||||
break;
|
||||
|
||||
case GlyphCollection::ASCII:
|
||||
_customGlyphs = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
int lenght = strlen(customGlyphs);
|
||||
_customGlyphs = new char [lenght + 2];
|
||||
memcpy(_customGlyphs, customGlyphs, lenght);
|
||||
|
||||
_customGlyphs[lenght] = 0;
|
||||
_customGlyphs[lenght+1] = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const char * Font::getCurrentGlyphCollection()
|
||||
{
|
||||
if (_customGlyphs)
|
||||
{
|
||||
return _customGlyphs;
|
||||
}
|
||||
else
|
||||
{
|
||||
return getGlyphCollection(_usedGlyphs);
|
||||
}
|
||||
}
|
||||
|
||||
Font* Font::createWithTTF(const char* fntName, int fontSize, GlyphCollection glyphs, const char *customGlyphs)
|
||||
{
|
||||
return FontFreeType::create(fntName, fontSize, glyphs, customGlyphs);
|
||||
}
|
||||
|
||||
Font* Font::createWithFNT(const char* fntFilePath)
|
||||
{
|
||||
return FontFNT::create(fntFilePath);
|
||||
}
|
||||
|
||||
unsigned short int * Font::getUTF16Text(const char *pText, int &outNumLetters)
|
||||
{
|
||||
unsigned short* utf16String = cc_utf8_to_utf16(pText);
|
||||
|
|
|
@ -26,31 +26,54 @@
|
|||
#define _CCFont_h_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "CCLabel.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
// fwd
|
||||
class GlyphDef;
|
||||
class FontAtlas;
|
||||
|
||||
|
||||
class CC_DLL Font : public Object
|
||||
{
|
||||
public:
|
||||
|
||||
// create the font
|
||||
static Font* createWithTTF(const char* fntName, int fontSize, GlyphCollection glyphs, const char *customGlyphs);
|
||||
static Font* createWithFNT(const char* fntFilePath);
|
||||
|
||||
virtual ~Font() {}
|
||||
|
||||
virtual FontAtlas *createFontAtlas() = 0;
|
||||
|
||||
virtual Size * getAdvancesForTextUTF16(unsigned short *pText, int &outNumLetters) = 0;
|
||||
virtual const char * getCurrentGlyphCollection();
|
||||
|
||||
virtual bool createFontObject(const std::string &fontName, int fontSize) { return false; }
|
||||
virtual int getLetterPadding() { return 0; }
|
||||
virtual unsigned char * getGlyphBitmap(unsigned short theChar, int &outWidth, int &outHeight) { return 0; }
|
||||
virtual int getFontMaxHeight() { return 0; }
|
||||
virtual GlyphDef * getGlyphDefintionsForText(const char *pText, int &outNumGlyphs, bool UTF16text = false) { return 0; }
|
||||
virtual int getFontMaxHeight() { return 0; }
|
||||
virtual Rect getRectForChar(unsigned short theChar);
|
||||
|
||||
virtual unsigned short int * getUTF16Text(const char *pText, int &outNumLetters);
|
||||
virtual int getUTF16TextLenght(unsigned short int *pText);
|
||||
virtual unsigned short int * getUTF16Text(const char *pText, int &outNumLetters);
|
||||
virtual unsigned short int * trimUTF16Text(unsigned short int *pText, int newBegin, int newEnd);
|
||||
|
||||
protected:
|
||||
|
||||
Font();
|
||||
virtual ~Font() {}
|
||||
void setCurrentGlyphCollection(GlyphCollection glyphs, const char *customGlyphs = 0);
|
||||
const char * getGlyphCollection(GlyphCollection glyphs);
|
||||
|
||||
private:
|
||||
|
||||
GlyphCollection _usedGlyphs;
|
||||
char * _customGlyphs;
|
||||
static const char * _glyphASCII;
|
||||
static const char * _glyphNEHE;
|
||||
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -27,11 +27,8 @@ void FontAtlas::relaseTextures()
|
|||
{
|
||||
for( auto &item: _atlasTextures)
|
||||
{
|
||||
if ( item.second )
|
||||
item.second->release();
|
||||
item.second->release();
|
||||
}
|
||||
|
||||
_atlasTextures.clear();
|
||||
}
|
||||
|
||||
void FontAtlas::addLetterDefinition(const FontLetterDefinition &letterDefinition)
|
||||
|
@ -39,7 +36,7 @@ void FontAtlas::addLetterDefinition(const FontLetterDefinition &letterDefinition
|
|||
_fontLetterDefinitions[letterDefinition.letteCharUTF16] = letterDefinition;
|
||||
}
|
||||
|
||||
bool FontAtlas::getLetterDefinitionForChar(unsigned short letteCharUTF16, FontLetterDefinition &outDefinition) const
|
||||
bool FontAtlas::getLetterDefinitionForChar(unsigned short letteCharUTF16, FontLetterDefinition &outDefinition)
|
||||
{
|
||||
auto outIterator = _fontLetterDefinitions.find(letteCharUTF16);
|
||||
|
||||
|
@ -60,12 +57,12 @@ void FontAtlas::addTexture(Texture2D &texture, int slot)
|
|||
_atlasTextures[slot] = &texture;
|
||||
}
|
||||
|
||||
Texture2D & FontAtlas::getTexture(int slot)
|
||||
Texture2D & FontAtlas::getTexture(int slot)
|
||||
{
|
||||
return *(_atlasTextures[slot]);
|
||||
}
|
||||
|
||||
float FontAtlas::getCommonLineHeight() const
|
||||
float FontAtlas::getCommonLineHeight()
|
||||
{
|
||||
return _commonLineHeight;
|
||||
}
|
||||
|
@ -75,21 +72,9 @@ void FontAtlas::setCommonLineHeight(float newHeight)
|
|||
_commonLineHeight = newHeight;
|
||||
}
|
||||
|
||||
unsigned short int * FontAtlas::getUTF16Text(const char *pText, int &outNumLetters) const
|
||||
{
|
||||
unsigned short* utf16String = cc_utf8_to_utf16(pText);
|
||||
|
||||
if(!utf16String)
|
||||
return 0;
|
||||
|
||||
outNumLetters = cc_wcslen(utf16String);
|
||||
return utf16String;
|
||||
}
|
||||
|
||||
Font & FontAtlas::getFont() const
|
||||
Font & FontAtlas::getFont()
|
||||
{
|
||||
return _font;
|
||||
}
|
||||
|
||||
|
||||
NS_CC_END
|
|
@ -24,11 +24,13 @@
|
|||
#ifndef _CCFontAtlas_h_
|
||||
#define _CCFontAtlas_h_
|
||||
|
||||
|
||||
#include <map>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
//fwd
|
||||
class Font;
|
||||
|
||||
struct FontLetterDefinition
|
||||
{
|
||||
unsigned short letteCharUTF16;
|
||||
|
@ -47,20 +49,20 @@ struct FontLetterDefinition
|
|||
|
||||
class CC_DLL FontAtlas : public Object
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
FontAtlas(Font &theFont);
|
||||
virtual ~FontAtlas();
|
||||
|
||||
void addLetterDefinition(const FontLetterDefinition &letterDefinition);
|
||||
bool getLetterDefinitionForChar(unsigned short letteCharUTF16, FontLetterDefinition &outDefinition) const;
|
||||
void addTexture(Texture2D &texture, int slot);
|
||||
Texture2D & getTexture(int slot);
|
||||
bool getLetterDefinitionForChar(unsigned short letteCharUTF16, FontLetterDefinition &outDefinition);
|
||||
|
||||
void addTexture(Texture2D &texture, int slot);
|
||||
float getCommonLineHeight();
|
||||
void setCommonLineHeight(float newHeight);
|
||||
float getCommonLineHeight() const;
|
||||
unsigned short int * getUTF16Text(const char *pText, int &outNumLetters) const;
|
||||
Font & getFont() const;
|
||||
|
||||
Texture2D & getTexture(int slot);
|
||||
Font & getFont();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -30,24 +30,16 @@ NS_CC_BEGIN
|
|||
|
||||
std::map<std::string, FontAtlas *> FontAtlasCache::_atlasMap;
|
||||
|
||||
|
||||
FontAtlas * FontAtlasCache::getFontAtlasTTF(const char *fontFileName, int size, GlyphCollection glyphs, const char *customGlyphs)
|
||||
{
|
||||
std::string atlasName = generateFontName(fontFileName, size, glyphs);
|
||||
FontAtlas *tempAtlas = _atlasMap[atlasName];
|
||||
FontAtlas *tempAtlas = _atlasMap[atlasName];
|
||||
|
||||
if ( !tempAtlas )
|
||||
{
|
||||
tempAtlas = FontAtlasFactory::createAtlasFromTTF(fontFileName, size, glyphs, customGlyphs);
|
||||
|
||||
if (tempAtlas)
|
||||
{
|
||||
_atlasMap[atlasName] = tempAtlas;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -65,15 +57,8 @@ FontAtlas * FontAtlasCache::getFontAtlasFNT(const char *fontFileName)
|
|||
if ( !tempAtlas )
|
||||
{
|
||||
tempAtlas = FontAtlasFactory::createAtlasFromFNT(fontFileName);
|
||||
|
||||
if (tempAtlas)
|
||||
{
|
||||
_atlasMap[atlasName] = tempAtlas;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -89,7 +74,6 @@ std::string FontAtlasCache::generateFontName(const char *fontFileName, int size,
|
|||
|
||||
switch (theGlyphs)
|
||||
{
|
||||
|
||||
case GlyphCollection::DYNAMIC:
|
||||
tempName.append("_DYNAMIC_");
|
||||
break;
|
||||
|
@ -110,9 +94,9 @@ std::string FontAtlasCache::generateFontName(const char *fontFileName, int size,
|
|||
break;
|
||||
}
|
||||
|
||||
// std::to_string is not supported on android, using std::stringstream instead.
|
||||
std::stringstream ss;
|
||||
ss << size;
|
||||
// std::to_string is not supported on android, using std::stringstream instead.
|
||||
return tempName.append(ss.str());
|
||||
}
|
||||
|
||||
|
@ -120,7 +104,7 @@ bool FontAtlasCache::releaseFontAtlas(FontAtlas *atlas)
|
|||
{
|
||||
if (atlas)
|
||||
{
|
||||
for( auto &item: _atlasMap)
|
||||
for( auto &item: _atlasMap )
|
||||
{
|
||||
if ( item.second == atlas )
|
||||
{
|
||||
|
|
|
@ -40,7 +40,8 @@ public:
|
|||
|
||||
static FontAtlas * getFontAtlasTTF(const char *fontFileName, int size, GlyphCollection glyphs, const char *customGlyphs = 0);
|
||||
static FontAtlas * getFontAtlasFNT(const char *fontFileName);
|
||||
static bool releaseFontAtlas(FontAtlas *atlas);
|
||||
|
||||
static bool releaseFontAtlas(FontAtlas *atlas);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -14,154 +14,29 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
||||
const char *FontAtlasFactory::glyphASCII = "\"!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ ";
|
||||
|
||||
const char *FontAtlasFactory::glyphNEHE = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ";
|
||||
|
||||
|
||||
|
||||
FontAtlas * FontAtlasFactory::createAtlasFromTTF(const char* fntFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs)
|
||||
{
|
||||
FontDefinitionTTF *def = 0;
|
||||
if ( (glyphs == GlyphCollection::NEHE) || (glyphs == GlyphCollection::ASCII) )
|
||||
if( glyphs == GlyphCollection::DYNAMIC )
|
||||
{
|
||||
def = FontDefinitionTTF::create(fntFilePath, fontSize, getGlyphCollection(glyphs));
|
||||
}
|
||||
else
|
||||
{
|
||||
if( glyphs == GlyphCollection::DYNAMIC )
|
||||
{
|
||||
log("ERROR: GlyphCollection::DYNAMIC is not supported yet!");
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !customGlyphs )
|
||||
{
|
||||
log("ERROR: GlyphCollection::CUSTOM used but no input glyphs provided!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
def = FontDefinitionTTF::create(fntFilePath, fontSize, customGlyphs);
|
||||
}
|
||||
}
|
||||
|
||||
if(!def)
|
||||
log("ERROR: GlyphCollection::DYNAMIC is not supported yet!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// create the font atlas from the font definition
|
||||
FontAtlas *tempAtlas = def->createFontAtlas();
|
||||
|
||||
// release the font definition, we don't need it anymore
|
||||
def->release();
|
||||
|
||||
// return the atlas
|
||||
return tempAtlas;
|
||||
Font *font = Font::createWithTTF(fntFilePath, fontSize, glyphs, customGlyphs);
|
||||
if (font)
|
||||
return font->createFontAtlas();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FontAtlas * FontAtlasFactory::createAtlasFromFNT(const char* fntFilePath)
|
||||
{
|
||||
CCBMFontConfiguration *newConf = FNTConfigLoadFile(fntFilePath);
|
||||
Font *pFont = Font::createWithFNT(fntFilePath);
|
||||
|
||||
if (newConf)
|
||||
return createFontAtlasFromFNTConfig(newConf);
|
||||
if(pFont)
|
||||
return pFont->createFontAtlas();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * FontAtlasFactory::getGlyphCollection(GlyphCollection glyphs)
|
||||
{
|
||||
switch (glyphs)
|
||||
{
|
||||
case GlyphCollection::NEHE:
|
||||
return glyphNEHE;
|
||||
break;
|
||||
|
||||
case GlyphCollection::ASCII:
|
||||
return glyphASCII;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FontAtlas * FontAtlasFactory::createFontAtlasFromFNTConfig(CCBMFontConfiguration *theConfig)
|
||||
{
|
||||
if (!theConfig)
|
||||
return 0;
|
||||
|
||||
FontFNT *tempFont = new FontFNT(theConfig);
|
||||
if (!tempFont)
|
||||
return 0;
|
||||
|
||||
FontAtlas *tempAtlas = new FontAtlas(*tempFont);
|
||||
if (!tempAtlas)
|
||||
return 0;
|
||||
|
||||
// check that everything is fine with the BMFontCofniguration
|
||||
if (!theConfig->_fontDefDictionary)
|
||||
return 0;
|
||||
|
||||
|
||||
int numGlyphs = theConfig->_characterSet->size();
|
||||
if (!numGlyphs)
|
||||
return 0;
|
||||
|
||||
if (theConfig->_commonHeight == 0)
|
||||
return 0;
|
||||
|
||||
// commone height
|
||||
tempAtlas->setCommonLineHeight(theConfig->_commonHeight);
|
||||
|
||||
|
||||
ccBMFontDef fontDef;
|
||||
tFontDefHashElement *current_element, *tmp;
|
||||
|
||||
// Purge uniform hash
|
||||
HASH_ITER(hh, theConfig->_fontDefDictionary, current_element, tmp)
|
||||
{
|
||||
|
||||
FontLetterDefinition tempDefinition;
|
||||
|
||||
fontDef = current_element->fontDef;
|
||||
Rect tempRect;
|
||||
|
||||
tempRect = fontDef.rect;
|
||||
tempRect = CC_RECT_PIXELS_TO_POINTS(tempRect);
|
||||
|
||||
tempDefinition.letteCharUTF16 = fontDef.charID;
|
||||
|
||||
tempDefinition.offsetX = fontDef.xOffset;
|
||||
tempDefinition.offsetY = fontDef.yOffset;
|
||||
|
||||
tempDefinition.U = tempRect.origin.x;
|
||||
tempDefinition.V = tempRect.origin.y;
|
||||
|
||||
tempDefinition.width = tempRect.size.width;
|
||||
tempDefinition.height = tempRect.size.height;
|
||||
|
||||
//carloX: only one texture supported FOR NOW
|
||||
tempDefinition.textureID = 0;
|
||||
|
||||
tempDefinition.anchorX = 0.5f;
|
||||
tempDefinition.anchorY = 0.5f;
|
||||
|
||||
// add the new definition
|
||||
tempAtlas->addLetterDefinition(tempDefinition);
|
||||
}
|
||||
|
||||
// add the texture (only one texture for now)
|
||||
|
||||
Texture2D *tempTexture = TextureCache::getInstance()->addImage(theConfig->getAtlasName());
|
||||
if (!tempTexture)
|
||||
return 0;
|
||||
|
||||
// add the texture
|
||||
tempAtlas->addTexture(*tempTexture, 0);
|
||||
return tempAtlas;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "cocos2d.h"
|
||||
#include "CCFontAtlas.h"
|
||||
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL FontAtlasFactory
|
||||
|
@ -39,15 +40,6 @@ public:
|
|||
static FontAtlas * createAtlasFromFNT(const char* fntFilePath);
|
||||
|
||||
private:
|
||||
|
||||
static const char * getGlyphCollection(GlyphCollection glyphs);
|
||||
|
||||
// carloX: this needs to be moved somewhere else, but it's good enough for now
|
||||
static FontAtlas * createFontAtlasFromFNTConfig(CCBMFontConfiguration *theConfig);
|
||||
|
||||
static const char *glyphASCII;
|
||||
static const char *glyphNEHE;
|
||||
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -27,19 +27,27 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
const int FontDefinitionTTF::_DEFAUL_ATALS_TEXTURE_SIZE = 1024;
|
||||
|
||||
FontDefinitionTTF::FontDefinitionTTF():_textImages(0), _commonLineHeight(0)
|
||||
{
|
||||
}
|
||||
|
||||
FontDefinitionTTF* FontDefinitionTTF::create(const char *fontName, int fontSize, const char *letters, int textureSize )
|
||||
FontDefinitionTTF* FontDefinitionTTF::create(Font *font, int textureSize)
|
||||
{
|
||||
if (textureSize == 0)
|
||||
textureSize = _DEFAUL_ATALS_TEXTURE_SIZE;
|
||||
|
||||
FontDefinitionTTF *ret = new FontDefinitionTTF;
|
||||
|
||||
if(!ret)
|
||||
return 0;
|
||||
|
||||
if ( ret->initDefinition( fontName, fontSize, letters, textureSize ) )
|
||||
const char *pGlyph = font->getCurrentGlyphCollection();
|
||||
if (!pGlyph)
|
||||
return nullptr;
|
||||
|
||||
if ( ret->initDefinition(font, pGlyph, textureSize ) )
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
@ -102,17 +110,15 @@ bool FontDefinitionTTF::prepareLetterDefinitions(TextFontPagesDef *pageDefs)
|
|||
|
||||
if (tempDef.validDefinition)
|
||||
{
|
||||
tempDef.letteCharUTF16 = currentGlyph.getUTF8Letter();
|
||||
tempDef.width = letterWidth + currentGlyph.getPadding();
|
||||
tempDef.height = (letterHeight - 1);
|
||||
tempDef.U = (posXUV - 1);
|
||||
tempDef.V = posYUV;
|
||||
|
||||
tempDef.offsetX = currentGlyph.getRect().origin.x;
|
||||
tempDef.offsetY = currentGlyph.getRect().origin.y;
|
||||
|
||||
tempDef.textureID = cPages;
|
||||
tempDef.commonLineHeight = currentGlyph.getCommonHeight();
|
||||
tempDef.letteCharUTF16 = currentGlyph.getUTF8Letter();
|
||||
tempDef.width = letterWidth + currentGlyph.getPadding();
|
||||
tempDef.height = (letterHeight - 1);
|
||||
tempDef.U = (posXUV - 1);
|
||||
tempDef.V = posYUV;
|
||||
tempDef.offsetX = currentGlyph.getRect().origin.x;
|
||||
tempDef.offsetY = currentGlyph.getRect().origin.y;
|
||||
tempDef.textureID = cPages;
|
||||
tempDef.commonLineHeight = currentGlyph.getCommonHeight();
|
||||
|
||||
// take from pixels to points
|
||||
tempDef.width = tempDef.width / CC_CONTENT_SCALE_FACTOR();
|
||||
|
@ -125,15 +131,15 @@ bool FontDefinitionTTF::prepareLetterDefinitions(TextFontPagesDef *pageDefs)
|
|||
}
|
||||
else
|
||||
{
|
||||
tempDef.letteCharUTF16 = currentGlyph.getUTF8Letter();
|
||||
tempDef.commonLineHeight = 0;
|
||||
tempDef.width = 0;
|
||||
tempDef.height = 0;
|
||||
tempDef.U = 0;
|
||||
tempDef.V = 0;
|
||||
tempDef.offsetX = 0;
|
||||
tempDef.offsetY = 0;
|
||||
tempDef.textureID = 0;
|
||||
tempDef.letteCharUTF16 = currentGlyph.getUTF8Letter();
|
||||
tempDef.commonLineHeight = 0;
|
||||
tempDef.width = 0;
|
||||
tempDef.height = 0;
|
||||
tempDef.U = 0;
|
||||
tempDef.V = 0;
|
||||
tempDef.offsetX = 0;
|
||||
tempDef.offsetY = 0;
|
||||
tempDef.textureID = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,14 +162,14 @@ bool FontDefinitionTTF::prepareLetterDefinitions(TextFontPagesDef *pageDefs)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FontDefinitionTTF::initDefinition(const char *fontName, int fontSize, const char *letters, int textureSize)
|
||||
bool FontDefinitionTTF::initDefinition(cocos2d::Font *font, const char *letters, int textureSize)
|
||||
{
|
||||
// preare texture/image stuff
|
||||
_textImages = new TextImage();
|
||||
if (!_textImages)
|
||||
return false;
|
||||
|
||||
if (!_textImages->initWithString(letters, textureSize, textureSize, fontName, fontSize, true))
|
||||
if (!_textImages->initWithString(letters, textureSize, textureSize, font, true))
|
||||
{
|
||||
delete _textImages;
|
||||
_textImages = 0;
|
||||
|
@ -182,50 +188,32 @@ void FontDefinitionTTF::addLetterDefinition(FontLetterDefinition &defToAdd)
|
|||
}
|
||||
}
|
||||
|
||||
FontLetterDefinition & FontDefinitionTTF::getLetterDefinition(unsigned short int theLetter)
|
||||
{
|
||||
return _fontLettersDefinitionUTF16[theLetter];
|
||||
}
|
||||
|
||||
Texture2D * FontDefinitionTTF::getTexture(int index)
|
||||
{
|
||||
TextFontPagesDef *pPages = _textImages->getPages();
|
||||
|
||||
if (!pPages)
|
||||
return nullptr;
|
||||
|
||||
return pPages->getPageAt(index)->getPageTexture();
|
||||
}
|
||||
|
||||
int FontDefinitionTTF::getNumTextures()
|
||||
{
|
||||
TextFontPagesDef *pPages = _textImages->getPages();
|
||||
if (pPages)
|
||||
{
|
||||
return pPages->getNumPages();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
FontAtlas * FontDefinitionTTF::createFontAtlas()
|
||||
{
|
||||
FontAtlas *retAtlas = new FontAtlas( *_textImages->getFont() );
|
||||
int numTextures = 0;
|
||||
TextFontPagesDef *pPages = _textImages->getPages();
|
||||
|
||||
if (pPages)
|
||||
numTextures = pPages->getNumPages();
|
||||
else
|
||||
return nullptr;
|
||||
|
||||
if (!numTextures)
|
||||
return nullptr;
|
||||
|
||||
FontAtlas *retAtlas = new FontAtlas(*_textImages->getFont());
|
||||
|
||||
if (!retAtlas)
|
||||
return 0;
|
||||
|
||||
// add all the textures
|
||||
int numTextures = getNumTextures();
|
||||
if (!numTextures)
|
||||
return 0;
|
||||
|
||||
for (int c = 0; c<numTextures; ++c)
|
||||
retAtlas->addTexture(*getTexture(c), c);
|
||||
for (int c = 0; c < numTextures; ++c)
|
||||
{
|
||||
TextFontPagesDef *pPages = _textImages->getPages();
|
||||
retAtlas->addTexture(*(pPages->getPageAt(c)->getPageTexture()), c);
|
||||
}
|
||||
|
||||
// set the common line height
|
||||
retAtlas->setCommonLineHeight(getCommonLineHeight() * 0.8);
|
||||
|
||||
retAtlas->setCommonLineHeight(_commonLineHeight * 0.8);
|
||||
|
||||
for( auto &item: _fontLettersDefinitionUTF16 )
|
||||
{
|
||||
|
|
|
@ -31,20 +31,13 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
#define DEFAULT_ATLAS_TEXTURE_SIZE 1024
|
||||
|
||||
/**
|
||||
*/
|
||||
class CC_DLL FontDefinitionTTF : public Object
|
||||
{
|
||||
public:
|
||||
|
||||
static FontDefinitionTTF* create(const char *fontName, int fontSize, const char *letters, int textureSize = DEFAULT_ATLAS_TEXTURE_SIZE);
|
||||
FontLetterDefinition & getLetterDefinition(unsigned short int theLetter);
|
||||
Texture2D * getTexture(int index);
|
||||
int getNumTextures();
|
||||
Font * getFont() { return _textImages->getFont(); }
|
||||
float getCommonLineHeight() { return _commonLineHeight; }
|
||||
|
||||
static FontDefinitionTTF* create(Font *font, int textureSize = 0);
|
||||
FontAtlas * createFontAtlas();
|
||||
|
||||
private:
|
||||
|
@ -52,13 +45,14 @@ private:
|
|||
FontDefinitionTTF();
|
||||
~FontDefinitionTTF();
|
||||
|
||||
bool initDefinition(const char *fontName, int fontSize, const char *letters, int textureSize);
|
||||
bool initDefinition(Font *font, const char *letters, int textureSize);
|
||||
bool prepareLetterDefinitions(TextFontPagesDef *pageDefs);
|
||||
void addLetterDefinition(FontLetterDefinition &defToAdd);
|
||||
|
||||
TextImage * _textImages;
|
||||
std::map<unsigned short, FontLetterDefinition> _fontLettersDefinitionUTF16;
|
||||
float _commonLineHeight;
|
||||
static const int _DEFAUL_ATALS_TEXTURE_SIZE;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -7,10 +7,34 @@
|
|||
//
|
||||
|
||||
#include "CCFontFNT.h"
|
||||
|
||||
#include "CCFontAtlas.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
FontFNT * FontFNT::create(const char* fntFilePath)
|
||||
{
|
||||
CCBMFontConfiguration *newConf = FNTConfigLoadFile(fntFilePath);
|
||||
if (!newConf)
|
||||
return nullptr;
|
||||
|
||||
// add the texture
|
||||
Texture2D *tempTexture = TextureCache::getInstance()->addImage(newConf->getAtlasName());
|
||||
if ( !tempTexture )
|
||||
{
|
||||
delete newConf;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FontFNT *tempFont = new FontFNT(newConf);
|
||||
|
||||
if (!tempFont)
|
||||
{
|
||||
delete newConf;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return tempFont;
|
||||
}
|
||||
|
||||
FontFNT::~FontFNT()
|
||||
{
|
||||
|
@ -100,4 +124,75 @@ Rect FontFNT::getRectForChar(unsigned short theChar)
|
|||
return getRectForCharInternal(theChar);
|
||||
}
|
||||
|
||||
FontAtlas * FontFNT::createFontAtlas()
|
||||
{
|
||||
FontAtlas *tempAtlas = new FontAtlas(*this);
|
||||
if (!tempAtlas)
|
||||
return nullptr;
|
||||
|
||||
// check that everything is fine with the BMFontCofniguration
|
||||
if (!_configuration->_fontDefDictionary)
|
||||
return nullptr;
|
||||
|
||||
int numGlyphs = _configuration->_characterSet->size();
|
||||
if (!numGlyphs)
|
||||
return nullptr;
|
||||
|
||||
if (_configuration->_commonHeight == 0)
|
||||
return nullptr;
|
||||
|
||||
// commone height
|
||||
tempAtlas->setCommonLineHeight(_configuration->_commonHeight);
|
||||
|
||||
|
||||
ccBMFontDef fontDef;
|
||||
tFontDefHashElement *current_element, *tmp;
|
||||
|
||||
// Purge uniform hash
|
||||
HASH_ITER(hh, _configuration->_fontDefDictionary, current_element, tmp)
|
||||
{
|
||||
|
||||
FontLetterDefinition tempDefinition;
|
||||
|
||||
fontDef = current_element->fontDef;
|
||||
Rect tempRect;
|
||||
|
||||
tempRect = fontDef.rect;
|
||||
tempRect = CC_RECT_PIXELS_TO_POINTS(tempRect);
|
||||
|
||||
tempDefinition.letteCharUTF16 = fontDef.charID;
|
||||
|
||||
tempDefinition.offsetX = fontDef.xOffset;
|
||||
tempDefinition.offsetY = fontDef.yOffset;
|
||||
|
||||
tempDefinition.U = tempRect.origin.x;
|
||||
tempDefinition.V = tempRect.origin.y;
|
||||
|
||||
tempDefinition.width = tempRect.size.width;
|
||||
tempDefinition.height = tempRect.size.height;
|
||||
|
||||
//carloX: only one texture supported FOR NOW
|
||||
tempDefinition.textureID = 0;
|
||||
|
||||
tempDefinition.anchorX = 0.5f;
|
||||
tempDefinition.anchorY = 0.5f;
|
||||
|
||||
// add the new definition
|
||||
tempAtlas->addLetterDefinition(tempDefinition);
|
||||
}
|
||||
|
||||
// add the texture (only one texture for now)
|
||||
|
||||
Texture2D *tempTexture = TextureCache::getInstance()->addImage(_configuration->getAtlasName());
|
||||
if (!tempTexture)
|
||||
return 0;
|
||||
|
||||
// add the texture
|
||||
tempAtlas->addTexture(*tempTexture, 0);
|
||||
|
||||
// done
|
||||
return tempAtlas;
|
||||
}
|
||||
|
||||
|
||||
NS_CC_END
|
|
@ -35,10 +35,16 @@ class FontFNT : public Font
|
|||
|
||||
public:
|
||||
|
||||
static FontFNT * create(const char* fntFilePath);
|
||||
|
||||
virtual Size* getAdvancesForTextUTF16(unsigned short *pText, int &outNumLetters) override;
|
||||
virtual Rect getRectForChar(unsigned short theChar) override;
|
||||
virtual FontAtlas *createFontAtlas() override;
|
||||
|
||||
protected:
|
||||
|
||||
FontFNT(CCBMFontConfiguration *theContfig) : _configuration(theContfig) {}
|
||||
virtual ~FontFNT();
|
||||
virtual Size* getAdvancesForTextUTF16(unsigned short *pText, int &outNumLetters);
|
||||
virtual Rect getRectForChar(unsigned short theChar);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -23,10 +23,12 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cocos2d.h"
|
||||
|
||||
#include "support/ccUTF8.h"
|
||||
#include "CCFontFreeType.h"
|
||||
#include "CCTextImage.h"
|
||||
#include "CCFont.h"
|
||||
#include "CCFontDefinition.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -34,7 +36,29 @@ NS_CC_BEGIN
|
|||
FT_Library FontFreeType::_FTlibrary;
|
||||
bool FontFreeType::_FTInitialized = false;
|
||||
|
||||
|
||||
FontFreeType * FontFreeType::create(const std::string &fontName, int fontSize, GlyphCollection glyphs, const char *customGlyphs)
|
||||
{
|
||||
if( glyphs == GlyphCollection::DYNAMIC )
|
||||
{
|
||||
log("ERROR: GlyphCollection::DYNAMIC is not supported yet!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FontFreeType *tempFont = new FontFreeType();
|
||||
|
||||
if (!tempFont)
|
||||
return nullptr;
|
||||
|
||||
tempFont->setCurrentGlyphCollection(glyphs, customGlyphs);
|
||||
|
||||
if( !tempFont->createFontObject(fontName, fontSize))
|
||||
{
|
||||
delete tempFont;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return tempFont;
|
||||
}
|
||||
|
||||
bool FontFreeType::initFreeType()
|
||||
{
|
||||
|
@ -111,6 +135,21 @@ FontFreeType::~FontFreeType()
|
|||
// TO DO
|
||||
}
|
||||
|
||||
FontAtlas * FontFreeType::createFontAtlas()
|
||||
{
|
||||
FontDefinitionTTF *def = 0;
|
||||
def = FontDefinitionTTF::create(this);
|
||||
|
||||
if(!def)
|
||||
return nullptr;
|
||||
|
||||
FontAtlas *atlas = def->createFontAtlas();
|
||||
|
||||
// release the font definition, we don't need it anymore
|
||||
def->release();
|
||||
return atlas;
|
||||
}
|
||||
|
||||
bool FontFreeType::getBBOXFotChar(unsigned short theChar, Rect &outRect)
|
||||
{
|
||||
if (!_fontRef)
|
||||
|
@ -276,7 +315,7 @@ int FontFreeType::getHorizontalKerningForChars(unsigned short firstChar, unsign
|
|||
if (!_fontRef)
|
||||
return 0;
|
||||
|
||||
bool hasKerning = FT_HAS_KERNING( _fontRef );
|
||||
bool hasKerning = FT_HAS_KERNING( _fontRef ) != 0;
|
||||
|
||||
if (!hasKerning)
|
||||
return 0;
|
||||
|
|
|
@ -25,9 +25,11 @@
|
|||
#ifndef _FontFreetype_h_
|
||||
#define _FontFreetype_h_
|
||||
|
||||
#include "CCFont.h"
|
||||
#include <string>
|
||||
#include <ft2build.h>
|
||||
|
||||
#include "CCFont.h"
|
||||
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
@ -36,19 +38,24 @@ class CC_DLL FontFreeType : public Font
|
|||
{
|
||||
public:
|
||||
|
||||
static FontFreeType * create(const std::string &fontName, int fontSize, GlyphCollection glyphs, const char *customGlyphs);
|
||||
|
||||
virtual FontAtlas * createFontAtlas() override;
|
||||
virtual Size * getAdvancesForTextUTF16(unsigned short *pText, int &outNumLetters) override;
|
||||
virtual GlyphDef * getGlyphDefintionsForText(const char *pText, int &outNumGlyphs, bool UTF16text = false) override;
|
||||
unsigned char * getGlyphBitmap(unsigned short theChar, int &outWidth, int &outHeight) override;
|
||||
virtual int getFontMaxHeight() override;
|
||||
virtual int getLetterPadding() override;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
FontFreeType();
|
||||
virtual ~FontFreeType();
|
||||
|
||||
virtual Size * getAdvancesForTextUTF16(unsigned short *pText, int &outNumLetters);
|
||||
|
||||
virtual bool createFontObject(const std::string &fontName, int fontSize);
|
||||
virtual GlyphDef * getGlyphDefintionsForText(const char *pText, int &outNumGlyphs, bool UTF16text = false);
|
||||
unsigned char * getGlyphBitmap(unsigned short theChar, int &outWidth, int &outHeight);
|
||||
virtual int getFontMaxHeight();
|
||||
virtual int getLetterPadding();
|
||||
bool createFontObject(const std::string &fontName, int fontSize);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
bool initFreeType();
|
||||
void shutdownFreeType();
|
||||
FT_Library getFTLibrary();
|
||||
|
@ -60,10 +67,8 @@ private:
|
|||
|
||||
static FT_Library _FTlibrary;
|
||||
static bool _FTInitialized;
|
||||
|
||||
FT_Face _fontRef;
|
||||
const int _letterPadding;
|
||||
|
||||
std::string _fontName;
|
||||
|
||||
};
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _FontRender_h_
|
||||
#define _FontRender_h_
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
// FWD
|
||||
class Font;
|
||||
class TextPageDef;
|
||||
|
||||
class CC_DLL FontRender
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
FontRender(Font *pFont) { _font = pFont; }
|
||||
virtual ~FontRender() {}
|
||||
virtual unsigned char * preparePageGlyphData(TextPageDef *thePage) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
Font * _font;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
||||
#endif
|
|
@ -1,138 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "CCTextImage.h"
|
||||
#include "CCFontRenderFreeType.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
//#define _DEBUG_FONTS_
|
||||
#ifdef _DEBUG_FONTS_
|
||||
#include "CCImage.h"
|
||||
#endif
|
||||
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
bool FontRenderFreeType::renderCharAt(unsigned short int charToRender, int posX, int posY, unsigned char *destMemory, int destSize)
|
||||
{
|
||||
if (!_font)
|
||||
return false;
|
||||
|
||||
unsigned char *sourceBitmap = 0;
|
||||
int sourceWidth = 0;
|
||||
int sourceHeight = 0;
|
||||
|
||||
// get the glyph's bitmap
|
||||
sourceBitmap = _font->getGlyphBitmap(charToRender, sourceWidth, sourceHeight);
|
||||
|
||||
if(!sourceBitmap)
|
||||
return false;
|
||||
|
||||
int iX = posX;
|
||||
int iY = posY;
|
||||
|
||||
for (int y = 0; y < sourceHeight; ++y)
|
||||
{
|
||||
int bitmap_y = y * sourceWidth;
|
||||
|
||||
for (int x = 0; x < sourceWidth; ++x)
|
||||
{
|
||||
unsigned char cTemp = sourceBitmap[bitmap_y + x];
|
||||
|
||||
// the final pixel
|
||||
int iTemp = cTemp << 24 | cTemp << 16 | cTemp << 8 | cTemp;
|
||||
*(int*) &destMemory[(iX + ( iY * destSize ) ) * 4] = iTemp;
|
||||
|
||||
iX += 1;
|
||||
}
|
||||
|
||||
iX = posX;
|
||||
iY += 1;
|
||||
}
|
||||
|
||||
//everything good
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned char * FontRenderFreeType::preparePageGlyphData(TextPageDef *thePage)
|
||||
{
|
||||
if (!thePage)
|
||||
return 0;
|
||||
|
||||
if (!_font)
|
||||
return 0;
|
||||
|
||||
if (thePage->getNumLines() == 0)
|
||||
return NULL;
|
||||
|
||||
int pageWidth = thePage->getWidth();
|
||||
int pageHeight = thePage->getHeight();
|
||||
|
||||
// prepare memory and clean to 0
|
||||
int sizeInBytes = (pageWidth * pageHeight * 4);
|
||||
unsigned char* data = new unsigned char[sizeInBytes];
|
||||
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
memset(data, 0, sizeInBytes);
|
||||
|
||||
int numLines = thePage->getNumLines();
|
||||
|
||||
for (int c = 0; c<numLines; ++c)
|
||||
{
|
||||
TextLineDef *pCurrentLine = thePage->getLineAt(c);
|
||||
|
||||
float origX = _font->getLetterPadding();
|
||||
float origY = pCurrentLine->getY();
|
||||
|
||||
int numGlyphToRender = pCurrentLine->getNumGlyph();
|
||||
|
||||
for (int cglyph = 0; cglyph < numGlyphToRender; ++cglyph)
|
||||
{
|
||||
GlyphDef currGlyph = pCurrentLine->getGlyphAt(cglyph);
|
||||
renderCharAt(currGlyph.getUTF8Letter(), origX, origY, data, pageWidth);
|
||||
origX += (currGlyph.getRect().size.width + _font->getLetterPadding());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG_FONTS_
|
||||
static int counter = 0;
|
||||
char outFilename[512];
|
||||
sprintf(outFilename,"carlottone%d", counter);
|
||||
++counter;
|
||||
Image *pImage = new Image;
|
||||
pImage->initWithRawData(data, (pageWidth * pageWidth * 4), 1024, 1024, 8, false);
|
||||
pImage->saveToFile(outFilename);
|
||||
#endif
|
||||
|
||||
// we are done here
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
NS_CC_END
|
|
@ -1,48 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _FontRenderFreeType_h_
|
||||
#define _FontRenderFreeType_h_
|
||||
|
||||
#include "CCFontRender.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL FontRenderFreeType : public FontRender
|
||||
{
|
||||
public:
|
||||
|
||||
FontRenderFreeType(Font *pFont): FontRender(pFont) {}
|
||||
virtual ~FontRenderFreeType() {}
|
||||
virtual unsigned char * preparePageGlyphData(TextPageDef *thePage);
|
||||
|
||||
private:
|
||||
|
||||
bool renderCharAt(unsigned short int charToRender, int posX, int posY, unsigned char *destMemory, int destSize);
|
||||
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif
|
|
@ -23,66 +23,747 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCLabel.h"
|
||||
#include "CCStringBMFont.h"
|
||||
#include "CCStringTTF.h"
|
||||
#include "CCFontDefinition.h"
|
||||
#include "CCFontCache.h"
|
||||
#include "CCFontAtlasCache.h"
|
||||
#include "CCLabelTextFormatter.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
Label* Label::createWithTTF( const char* label, const char* fntFilePath, int fontSize, GlyphCollection glyphs, int lineSize, const char *customGlyphs )
|
||||
Label* Label::createWithTTF( const char* label, const char* fontFilePath, int fontSize, int lineSize, TextHAlignment alignment, GlyphCollection glyphs, const char *customGlyphs )
|
||||
{
|
||||
FontAtlas *tempAtlas = FontAtlasCache::getFontAtlasTTF(fntFilePath, fontSize, glyphs, customGlyphs);
|
||||
FontAtlas *tempAtlas = FontAtlasCache::getFontAtlasTTF(fontFilePath, fontSize, glyphs, customGlyphs);
|
||||
|
||||
if (!tempAtlas)
|
||||
return nullptr;
|
||||
|
||||
|
||||
// create the actual label
|
||||
StringTTF* templabel = StringTTF::create(tempAtlas, TextHAlignment::CENTER, lineSize);
|
||||
Label* templabel = Label::createWithAtlas(tempAtlas, alignment, lineSize);
|
||||
|
||||
if (templabel)
|
||||
{
|
||||
templabel->setText(label, lineSize, TextHAlignment::CENTER, false);
|
||||
templabel->setText(label, lineSize, alignment, false);
|
||||
return templabel;
|
||||
}
|
||||
|
||||
|
||||
return nullptr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Label* Label::createWithBMFont( const char* label, const char* bmfontFilePath, int lineSize)
|
||||
Label* Label::createWithBMFont( const char* label, const char* bmfontFilePath, TextHAlignment alignment, int lineSize)
|
||||
{
|
||||
|
||||
FontAtlas *tempAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath);
|
||||
|
||||
|
||||
if (!tempAtlas)
|
||||
return 0;
|
||||
|
||||
StringTTF* templabel = StringTTF::create(tempAtlas, TextHAlignment::CENTER, lineSize);
|
||||
Label* templabel = Label::createWithAtlas(tempAtlas, alignment, lineSize);
|
||||
|
||||
if (templabel)
|
||||
{
|
||||
templabel->setText(label, lineSize, TextHAlignment::CENTER, false);
|
||||
templabel->setText(label, lineSize, alignment, false);
|
||||
return templabel;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Label* Label::createWithAtlas(FontAtlas *pAtlas, TextHAlignment alignment, int lineSize)
|
||||
{
|
||||
Label *ret = new Label(pAtlas, alignment);
|
||||
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
if( ret->init() )
|
||||
{
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Label::Label(FontAtlas *pAtlas, TextHAlignment alignment): _currentUTF8String(0),
|
||||
_originalUTF8String(0),
|
||||
_fontAtlas(pAtlas),
|
||||
_alignment(alignment),
|
||||
_lineBreakWithoutSpaces(false),
|
||||
_advances(0),
|
||||
_displayedColor(Color3B::WHITE),
|
||||
_realColor(Color3B::WHITE),
|
||||
_cascadeColorEnabled(true),
|
||||
_cascadeOpacityEnabled(true),
|
||||
_displayedOpacity(255),
|
||||
_realOpacity(255),
|
||||
_isOpacityModifyRGB(false)
|
||||
{
|
||||
}
|
||||
|
||||
Label::~Label()
|
||||
{
|
||||
if (_currentUTF8String)
|
||||
delete [] _currentUTF8String;
|
||||
|
||||
if (_advances)
|
||||
delete [] _advances;
|
||||
|
||||
if (_fontAtlas)
|
||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||
}
|
||||
|
||||
bool Label::init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Label::setString(const char *stringToRender)
|
||||
{
|
||||
setText(stringToRender, _width, TextHAlignment::CENTER, false);
|
||||
}
|
||||
|
||||
bool Label::setText(const char *stringToRender, float lineWidth, TextHAlignment alignment, bool lineBreakWithoutSpaces)
|
||||
{
|
||||
if (!_fontAtlas)
|
||||
return false;
|
||||
|
||||
// carloX
|
||||
// reset the string
|
||||
resetCurrentString();
|
||||
|
||||
|
||||
_width = lineWidth;
|
||||
_alignment = alignment;
|
||||
_lineBreakWithoutSpaces = lineBreakWithoutSpaces;
|
||||
|
||||
// release all the sprites
|
||||
moveAllSpritesToCache();
|
||||
|
||||
// store locally common line height
|
||||
_commonLineHeight = _fontAtlas->getCommonLineHeight();
|
||||
if (_commonLineHeight <= 0)
|
||||
return false;
|
||||
|
||||
int numLetter = 0;
|
||||
unsigned short* utf16String = cc_utf8_to_utf16(stringToRender);
|
||||
if(!utf16String)
|
||||
return false;
|
||||
|
||||
numLetter = cc_wcslen(utf16String);
|
||||
SpriteBatchNode::initWithTexture(&_fontAtlas->getTexture(0), numLetter);
|
||||
_cascadeColorEnabled = true;
|
||||
|
||||
//
|
||||
setCurrentString(utf16String);
|
||||
setOriginalString(utf16String);
|
||||
|
||||
// align text
|
||||
alignText();
|
||||
|
||||
// done here
|
||||
return true;
|
||||
}
|
||||
|
||||
void Label::setAlignment(TextHAlignment alignment)
|
||||
{
|
||||
// store the new alignment
|
||||
if (alignment != _alignment)
|
||||
{
|
||||
// store
|
||||
_alignment = alignment;
|
||||
|
||||
// reset the string
|
||||
resetCurrentString();
|
||||
|
||||
// need to align text again
|
||||
alignText();
|
||||
}
|
||||
}
|
||||
|
||||
void Label::setWidth(float width)
|
||||
{
|
||||
if (width != _width)
|
||||
{
|
||||
// store
|
||||
_width = width;
|
||||
|
||||
|
||||
// reset the string
|
||||
resetCurrentString();
|
||||
|
||||
// need to align text again
|
||||
alignText();
|
||||
}
|
||||
}
|
||||
|
||||
void Label::setLineBreakWithoutSpace(bool breakWithoutSpace)
|
||||
{
|
||||
if (breakWithoutSpace != _lineBreakWithoutSpaces)
|
||||
{
|
||||
// store
|
||||
_lineBreakWithoutSpaces = breakWithoutSpace;
|
||||
|
||||
// need to align text again
|
||||
alignText();
|
||||
}
|
||||
}
|
||||
|
||||
void Label::setScale(float scale)
|
||||
{
|
||||
Node::setScale(scale);
|
||||
alignText();
|
||||
}
|
||||
|
||||
void Label::setScaleX(float scaleX)
|
||||
{
|
||||
Node::setScaleX(scaleX);
|
||||
alignText();
|
||||
}
|
||||
|
||||
void Label::setScaleY(float scaleY)
|
||||
{
|
||||
Node::setScaleY(scaleY);
|
||||
alignText();
|
||||
}
|
||||
|
||||
void Label::alignText()
|
||||
{
|
||||
hideAllLetters();
|
||||
LabelTextFormatter::createStringSprites(this);
|
||||
|
||||
if( LabelTextFormatter::multilineText(this) )
|
||||
{
|
||||
hideAllLetters();
|
||||
LabelTextFormatter::createStringSprites(this);
|
||||
}
|
||||
|
||||
LabelTextFormatter::alignText(this);
|
||||
}
|
||||
|
||||
void Label::hideAllLetters()
|
||||
{
|
||||
Object* Obj = NULL;
|
||||
CCARRAY_FOREACH(&_spriteArray, Obj)
|
||||
{
|
||||
((Sprite *)Obj)->setVisible(false);
|
||||
}
|
||||
|
||||
CCARRAY_FOREACH(&_spriteArrayCache, Obj)
|
||||
{
|
||||
((Sprite *)Obj)->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool Label::computeAdvancesForString(unsigned short int *stringToRender)
|
||||
{
|
||||
if (_advances)
|
||||
{
|
||||
delete [] _advances;
|
||||
_advances = 0;
|
||||
}
|
||||
|
||||
Font &theFont = _fontAtlas->getFont();
|
||||
|
||||
int letterCount = 0;
|
||||
_advances = theFont.getAdvancesForTextUTF16(stringToRender, letterCount);
|
||||
|
||||
if(!_advances)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Label::setOriginalString(unsigned short *stringToSet)
|
||||
{
|
||||
if (_originalUTF8String)
|
||||
{
|
||||
delete [] _originalUTF8String;
|
||||
_originalUTF8String = 0;
|
||||
}
|
||||
|
||||
int newStringLenght = cc_wcslen(stringToSet);
|
||||
_originalUTF8String = new unsigned short int [newStringLenght + 1];
|
||||
memset(_originalUTF8String, 0, (newStringLenght + 1) * 2);
|
||||
memcpy(_originalUTF8String, stringToSet, (newStringLenght * 2));
|
||||
_originalUTF8String[newStringLenght] = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Label::setCurrentString(unsigned short *stringToSet)
|
||||
{
|
||||
// set the new string
|
||||
if (_currentUTF8String)
|
||||
{
|
||||
delete [] _currentUTF8String;
|
||||
_currentUTF8String = 0;
|
||||
}
|
||||
//
|
||||
_currentUTF8String = stringToSet;
|
||||
// compute the advances
|
||||
return computeAdvancesForString(stringToSet);
|
||||
}
|
||||
|
||||
void Label::resetCurrentString()
|
||||
{
|
||||
if ((!_currentUTF8String) && (!_originalUTF8String))
|
||||
return;
|
||||
|
||||
// set the new string
|
||||
if (_currentUTF8String)
|
||||
{
|
||||
delete [] _currentUTF8String;
|
||||
_currentUTF8String = 0;
|
||||
}
|
||||
|
||||
int stringLenght = cc_wcslen(_originalUTF8String);
|
||||
_currentUTF8String = new unsigned short int [stringLenght + 1];
|
||||
memcpy(_currentUTF8String, _originalUTF8String, stringLenght * 2);
|
||||
_currentUTF8String[stringLenght] = 0;
|
||||
|
||||
}
|
||||
|
||||
Sprite * Label::createNewSpriteFromLetterDefinition(FontLetterDefinition &theDefinition, Texture2D *theTexture)
|
||||
{
|
||||
Rect uvRect;
|
||||
uvRect.size.height = theDefinition.height;
|
||||
uvRect.size.width = theDefinition.width;
|
||||
uvRect.origin.x = theDefinition.U;
|
||||
uvRect.origin.y = theDefinition.V;
|
||||
|
||||
SpriteFrame *pFrame = SpriteFrame::createWithTexture(theTexture, uvRect);
|
||||
Sprite *tempSprite = getSprite();
|
||||
|
||||
if (!tempSprite)
|
||||
return 0;
|
||||
|
||||
tempSprite->initWithSpriteFrame(pFrame);
|
||||
tempSprite->setAnchorPoint(Point(theDefinition.anchorX, theDefinition.anchorY));
|
||||
tempSprite->setBatchNode(this);
|
||||
|
||||
// Apply label properties
|
||||
tempSprite->setOpacityModifyRGB(_isOpacityModifyRGB);
|
||||
|
||||
// Color MUST be set before opacity, since opacity might change color if OpacityModifyRGB is on
|
||||
tempSprite->updateDisplayedColor(_displayedColor);
|
||||
tempSprite->updateDisplayedOpacity(_displayedOpacity);
|
||||
|
||||
|
||||
return tempSprite;
|
||||
}
|
||||
|
||||
Sprite * Label::updateSpriteWithLetterDefinition(Sprite *spriteToUpdate, FontLetterDefinition &theDefinition, Texture2D *theTexture)
|
||||
{
|
||||
if (!spriteToUpdate)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Rect uvRect;
|
||||
uvRect.size.height = theDefinition.height;
|
||||
uvRect.size.width = theDefinition.width;
|
||||
uvRect.origin.x = theDefinition.U;
|
||||
uvRect.origin.y = theDefinition.V;
|
||||
|
||||
SpriteFrame *frame = SpriteFrame::createWithTexture(theTexture, uvRect);
|
||||
if (frame)
|
||||
{
|
||||
spriteToUpdate->setTexture(theTexture);
|
||||
spriteToUpdate->setDisplayFrame(frame);
|
||||
spriteToUpdate->setAnchorPoint(Point(theDefinition.anchorX, theDefinition.anchorY));
|
||||
spriteToUpdate->setBatchNode(this);
|
||||
}
|
||||
|
||||
return spriteToUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
Sprite * Label::getSpriteForLetter(unsigned short int newLetter)
|
||||
{
|
||||
if (!_fontAtlas)
|
||||
return 0;
|
||||
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(newLetter, tempDefinition);
|
||||
if (validDefinition)
|
||||
{
|
||||
Sprite *newSprite = createNewSpriteFromLetterDefinition(tempDefinition, &_fontAtlas->getTexture(tempDefinition.textureID) );
|
||||
this->addChild(newSprite);
|
||||
return newSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Label::Label()
|
||||
Sprite * Label::updateSpriteForLetter(Sprite *spriteToUpdate, unsigned short int newLetter)
|
||||
{
|
||||
if (!spriteToUpdate || !_fontAtlas)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(newLetter, tempDefinition);
|
||||
if (validDefinition)
|
||||
{
|
||||
Sprite *pNewSprite = updateSpriteWithLetterDefinition(spriteToUpdate, tempDefinition, &_fontAtlas->getTexture(tempDefinition.textureID) );
|
||||
return pNewSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label::~Label()
|
||||
void Label::moveAllSpritesToCache()
|
||||
{
|
||||
Object* pObj = NULL;
|
||||
CCARRAY_FOREACH(&_spriteArray, pObj)
|
||||
{
|
||||
((Sprite *)pObj)->removeFromParent();
|
||||
_spriteArrayCache.addObject(pObj);
|
||||
}
|
||||
|
||||
_spriteArray.removeAllObjects();
|
||||
}
|
||||
|
||||
Sprite * Label::getSprite()
|
||||
{
|
||||
if (_spriteArrayCache.count())
|
||||
{
|
||||
Sprite *retSprite = (Sprite *) _spriteArrayCache.lastObject();
|
||||
_spriteArrayCache.removeLastObject();
|
||||
return retSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
Sprite *retSprite = new Sprite;
|
||||
return retSprite;
|
||||
}
|
||||
}
|
||||
|
||||
///// PROTOCOL STUFF
|
||||
|
||||
Sprite * Label::getSpriteChild(int ID)
|
||||
{
|
||||
Object* pObj = NULL;
|
||||
CCARRAY_FOREACH(&_spriteArray, pObj)
|
||||
{
|
||||
Sprite *pSprite = (Sprite *)pObj;
|
||||
if ( pSprite->getTag() == ID)
|
||||
{
|
||||
return pSprite;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Array * Label::getChildrenLetters()
|
||||
{
|
||||
return &_spriteArray;
|
||||
}
|
||||
|
||||
Sprite * Label::getSpriteForChar(unsigned short int theChar, int spriteIndexHint)
|
||||
{
|
||||
// ret sprite
|
||||
Sprite *retSprite = 0;
|
||||
|
||||
// look for already existing sprites
|
||||
retSprite = getSpriteChild(spriteIndexHint);
|
||||
|
||||
if (!retSprite)
|
||||
{
|
||||
retSprite = getSpriteForLetter(theChar);
|
||||
if (!retSprite)
|
||||
return 0;
|
||||
|
||||
if (retSprite)
|
||||
retSprite->setTag(spriteIndexHint);
|
||||
|
||||
_spriteArray.addObject(retSprite);
|
||||
}
|
||||
|
||||
// the sprite is now visible
|
||||
retSprite->setVisible(true);
|
||||
|
||||
// set the right texture letter to the sprite
|
||||
updateSpriteForLetter(retSprite, theChar);
|
||||
|
||||
// we are done here
|
||||
return retSprite;
|
||||
}
|
||||
|
||||
float Label::getLetterPosXLeft( Sprite* sp )
|
||||
{
|
||||
float scaleX = _scaleX;
|
||||
return sp->getPosition().x * scaleX - (sp->getContentSize().width * scaleX * sp->getAnchorPoint().x);
|
||||
}
|
||||
|
||||
float Label::getLetterPosXRight( Sprite* sp )
|
||||
{
|
||||
float scaleX = _scaleX;
|
||||
return sp->getPosition().x * scaleX + (sp->getContentSize().width * scaleX * sp->getAnchorPoint().x);
|
||||
}
|
||||
|
||||
int Label::getCommonLineHeight()
|
||||
{
|
||||
return _commonLineHeight;
|
||||
}
|
||||
|
||||
int Label::getKerningForCharsPair(unsigned short first, unsigned short second)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Label::getXOffsetForChar(unsigned short c)
|
||||
{
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(c, tempDefinition);
|
||||
if (!validDefinition)
|
||||
return -1;
|
||||
|
||||
return (tempDefinition.offsetX);
|
||||
}
|
||||
|
||||
int Label::getYOffsetForChar(unsigned short c)
|
||||
{
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(c, tempDefinition);
|
||||
if (!validDefinition)
|
||||
return -1;
|
||||
|
||||
return (tempDefinition.offsetY);
|
||||
}
|
||||
|
||||
int Label::getAdvanceForChar(unsigned short c, int hintPositionInString)
|
||||
{
|
||||
if (_advances)
|
||||
{
|
||||
// not that advance contains the X offset already
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(c, tempDefinition);
|
||||
if (!validDefinition)
|
||||
return -1;
|
||||
|
||||
return (_advances[hintPositionInString].width);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Rect Label::getRectForChar(unsigned short c)
|
||||
{
|
||||
return _fontAtlas->getFont().getRectForChar(c);
|
||||
}
|
||||
|
||||
// string related stuff
|
||||
int Label::getStringNumLines()
|
||||
{
|
||||
int quantityOfLines = 1;
|
||||
|
||||
unsigned int stringLen = _currentUTF8String ? cc_wcslen(_currentUTF8String) : 0;
|
||||
if (stringLen == 0)
|
||||
return (-1);
|
||||
|
||||
// count number of lines
|
||||
for (unsigned int i = 0; i < stringLen - 1; ++i)
|
||||
{
|
||||
unsigned short c = _currentUTF8String[i];
|
||||
if (c == '\n')
|
||||
{
|
||||
quantityOfLines++;
|
||||
}
|
||||
}
|
||||
|
||||
return quantityOfLines;
|
||||
}
|
||||
|
||||
int Label::getStringLenght()
|
||||
{
|
||||
return _currentUTF8String ? cc_wcslen(_currentUTF8String) : 0;
|
||||
}
|
||||
|
||||
unsigned short Label::getCharAtStringPosition(int position)
|
||||
{
|
||||
return _currentUTF8String[position];
|
||||
}
|
||||
|
||||
unsigned short * Label::getUTF8String()
|
||||
{
|
||||
return _currentUTF8String;
|
||||
}
|
||||
|
||||
void Label::assignNewUTF8String(unsigned short *newString)
|
||||
{
|
||||
setCurrentString(newString);
|
||||
}
|
||||
|
||||
TextHAlignment Label::getTextAlignment()
|
||||
{
|
||||
return _alignment;
|
||||
}
|
||||
|
||||
// label related stuff
|
||||
float Label::getMaxLineWidth()
|
||||
{
|
||||
return _width;
|
||||
}
|
||||
|
||||
bool Label::breakLineWithoutSpace()
|
||||
{
|
||||
return _lineBreakWithoutSpaces;
|
||||
}
|
||||
|
||||
Size Label::getLabelContentSize()
|
||||
{
|
||||
return getContentSize();
|
||||
}
|
||||
|
||||
void Label::setLabelContentSize(const Size &newSize)
|
||||
{
|
||||
setContentSize(newSize);
|
||||
}
|
||||
|
||||
|
||||
// TESTING STUFF THAT NEEDS TO GO ////////////////////////////////////////////////////////////////
|
||||
Label* Label::createWithBMFontOLD( const char* label, const char* bmfontFilePath, int lineSize)
|
||||
// RGBA protocol
|
||||
|
||||
|
||||
bool Label::isOpacityModifyRGB() const
|
||||
{
|
||||
return StringBMFont::create(label, bmfontFilePath, lineSize);
|
||||
return _isOpacityModifyRGB;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Label::setOpacityModifyRGB(bool isOpacityModifyRGB)
|
||||
{
|
||||
_isOpacityModifyRGB = isOpacityModifyRGB;
|
||||
if (_children && _children->count() != 0)
|
||||
{
|
||||
Object* child;
|
||||
CCARRAY_FOREACH(_children, child)
|
||||
{
|
||||
Node* pNode = static_cast<Node*>( child );
|
||||
if (pNode)
|
||||
{
|
||||
RGBAProtocol *pRGBAProtocol = dynamic_cast<RGBAProtocol*>(pNode);
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setOpacityModifyRGB(_isOpacityModifyRGB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char Label::getOpacity() const
|
||||
{
|
||||
return _realOpacity;
|
||||
}
|
||||
|
||||
unsigned char Label::getDisplayedOpacity() const
|
||||
{
|
||||
return _displayedOpacity;
|
||||
}
|
||||
|
||||
void Label::setOpacity(GLubyte opacity)
|
||||
{
|
||||
_displayedOpacity = _realOpacity = opacity;
|
||||
|
||||
if( _cascadeOpacityEnabled ) {
|
||||
GLubyte parentOpacity = 255;
|
||||
RGBAProtocol* pParent = dynamic_cast<RGBAProtocol*>(_parent);
|
||||
if (pParent && pParent->isCascadeOpacityEnabled())
|
||||
{
|
||||
parentOpacity = pParent->getDisplayedOpacity();
|
||||
}
|
||||
this->updateDisplayedOpacity(parentOpacity);
|
||||
}
|
||||
}
|
||||
void Label::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
{
|
||||
_displayedOpacity = _realOpacity * parentOpacity/255.0;
|
||||
|
||||
Object* pObj;
|
||||
CCARRAY_FOREACH(_children, pObj)
|
||||
{
|
||||
Sprite *item = static_cast<Sprite*>( pObj );
|
||||
item->updateDisplayedOpacity(_displayedOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
bool Label::isCascadeOpacityEnabled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Label::setCascadeOpacityEnabled(bool cascadeOpacityEnabled)
|
||||
{
|
||||
_cascadeOpacityEnabled = cascadeOpacityEnabled;
|
||||
}
|
||||
|
||||
const Color3B& Label::getColor(void) const
|
||||
{
|
||||
return _realColor;
|
||||
}
|
||||
|
||||
const Color3B& Label::getDisplayedColor() const
|
||||
{
|
||||
return _displayedColor;
|
||||
}
|
||||
|
||||
void Label::setColor(const Color3B& color)
|
||||
{
|
||||
_displayedColor = _realColor = color;
|
||||
|
||||
if( _cascadeColorEnabled )
|
||||
{
|
||||
Color3B parentColor = Color3B::WHITE;
|
||||
RGBAProtocol* pParent = dynamic_cast<RGBAProtocol*>(_parent);
|
||||
|
||||
if (pParent && pParent->isCascadeColorEnabled())
|
||||
parentColor = pParent->getDisplayedColor();
|
||||
|
||||
updateDisplayedColor(parentColor);
|
||||
}
|
||||
}
|
||||
|
||||
void Label::updateDisplayedColor(const Color3B& parentColor)
|
||||
{
|
||||
_displayedColor.r = _realColor.r * parentColor.r/255.0;
|
||||
_displayedColor.g = _realColor.g * parentColor.g/255.0;
|
||||
_displayedColor.b = _realColor.b * parentColor.b/255.0;
|
||||
|
||||
Object* pObj;
|
||||
CCARRAY_FOREACH(_children, pObj)
|
||||
{
|
||||
Sprite *item = static_cast<Sprite*>( pObj );
|
||||
item->updateDisplayedColor(_displayedColor);
|
||||
}
|
||||
}
|
||||
|
||||
bool Label::isCascadeColorEnabled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Label::setCascadeColorEnabled(bool cascadeColorEnabled)
|
||||
{
|
||||
_cascadeColorEnabled = cascadeColorEnabled;
|
||||
}
|
||||
|
||||
|
||||
NS_CC_END
|
|
@ -27,6 +27,8 @@
|
|||
#define _COCOS2D_CCLABEL_H_
|
||||
|
||||
#include "sprite_nodes/CCSpriteBatchNode.h"
|
||||
#include "CCLabelTextFormatProtocol.h"
|
||||
#include "ccTypes.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -39,33 +41,126 @@ enum class GlyphCollection {
|
|||
|
||||
};
|
||||
|
||||
class CC_DLL Label : public SpriteBatchNode, public LabelProtocol, public RGBAProtocol
|
||||
//fwd
|
||||
struct FontLetterDefinition;
|
||||
class FontAtlas;
|
||||
|
||||
|
||||
|
||||
class CC_DLL Label : public SpriteBatchNode, public LabelProtocol, public RGBAProtocol, public LabelTextFormatProtocol
|
||||
{
|
||||
public:
|
||||
|
||||
static Label* createWithTTF( const char* label, const char* fntFilePath, int fontSize, GlyphCollection glyphs = GlyphCollection::NEHE, int lineSize = 0, const char *customGlyphs = 0 );
|
||||
static Label* createWithBMFont( const char* label, const char* bmfontFilePath, int lineSize = 0 );
|
||||
// static create
|
||||
static Label* createWithTTF( const char* label, const char* fontFilePath, int fontSize, int lineSize = 0, TextHAlignment alignment = TextHAlignment::CENTER, GlyphCollection glyphs = GlyphCollection::NEHE, const char *customGlyphs = 0 );
|
||||
|
||||
virtual ~Label();
|
||||
Label();
|
||||
static Label* createWithBMFont( const char* label, const char* bmfontFilePath, TextHAlignment alignment = TextHAlignment::CENTER, int lineSize = 0 );
|
||||
|
||||
virtual void setAlignment(TextHAlignment alignment) = 0;
|
||||
virtual void setWidth(float width) = 0;
|
||||
virtual void setLineBreakWithoutSpace(bool breakWithoutSpace) = 0;
|
||||
virtual void setScale(float scale) = 0;
|
||||
virtual void setScaleX(float scaleX) = 0;
|
||||
virtual void setScaleY(float scaleY) = 0;
|
||||
bool setText(const char *stringToRender, float lineWidth, TextHAlignment alignment = TextHAlignment::LEFT, bool lineBreakWithoutSpaces = false);
|
||||
|
||||
virtual void setString(const char *stringToRender);
|
||||
virtual void setAlignment(TextHAlignment alignment);
|
||||
virtual void setWidth(float width);
|
||||
virtual void setLineBreakWithoutSpace(bool breakWithoutSpace);
|
||||
virtual void setScale(float scale);
|
||||
virtual void setScaleX(float scaleX);
|
||||
virtual void setScaleY(float scaleY);
|
||||
|
||||
// RGBAProtocol
|
||||
virtual bool isOpacityModifyRGB() const;
|
||||
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB);
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual void updateDisplayedOpacity(GLubyte parentOpacity);
|
||||
virtual bool isCascadeOpacityEnabled() const;
|
||||
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled);
|
||||
virtual void setColor(const Color3B& color);
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor);
|
||||
virtual bool isCascadeColorEnabled() const;
|
||||
virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
|
||||
virtual const Color3B& getColor(void) const;
|
||||
virtual const Color3B& getDisplayedColor() const;
|
||||
virtual unsigned char getOpacity() const;
|
||||
virtual unsigned char getDisplayedOpacity() const;
|
||||
|
||||
// needs to go - TEST STUFF /////////////////////////////////////////////////////////////////////////
|
||||
static Label* createWithBMFontOLD( const char* label, const char* bmfontFilePath, int lineSize = 0);
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CCLabelTextFormat protocol implementation
|
||||
virtual Sprite * getSpriteChild(int ID);
|
||||
virtual Array * getChildrenLetters();
|
||||
virtual Sprite * getSpriteForChar(unsigned short int theChar, int spriteIndexHint);
|
||||
virtual float getLetterPosXLeft( Sprite* sp );
|
||||
virtual float getLetterPosXRight( Sprite* sp );
|
||||
|
||||
|
||||
// font related stuff
|
||||
virtual int getCommonLineHeight();
|
||||
virtual int getKerningForCharsPair(unsigned short first, unsigned short second);
|
||||
virtual int getXOffsetForChar(unsigned short c);
|
||||
virtual int getYOffsetForChar(unsigned short c);
|
||||
virtual int getAdvanceForChar(unsigned short c, int hintPositionInString);
|
||||
virtual Rect getRectForChar(unsigned short c) ;
|
||||
|
||||
// string related stuff
|
||||
virtual int getStringNumLines();
|
||||
virtual int getStringLenght();
|
||||
virtual unsigned short getCharAtStringPosition(int position);
|
||||
virtual unsigned short * getUTF8String();
|
||||
virtual void assignNewUTF8String(unsigned short *newString);
|
||||
virtual TextHAlignment getTextAlignment();
|
||||
|
||||
// label related stuff
|
||||
virtual float getMaxLineWidth() ;
|
||||
virtual bool breakLineWithoutSpace();
|
||||
virtual Size getLabelContentSize();
|
||||
virtual void setLabelContentSize(const Size &newSize);
|
||||
|
||||
// carloX
|
||||
const char * getString() const { return "not implemented"; }
|
||||
|
||||
private:
|
||||
|
||||
Label(FontAtlas *pAtlas, TextHAlignment alignment);
|
||||
~Label();
|
||||
|
||||
static Label* createWithAtlas(FontAtlas *pAtlas, TextHAlignment alignment = TextHAlignment::LEFT, int lineSize = 0);
|
||||
|
||||
bool init();
|
||||
|
||||
void alignText();
|
||||
void hideAllLetters();
|
||||
void moveAllSpritesToCache();
|
||||
|
||||
bool computeAdvancesForString(unsigned short int *stringToRender);
|
||||
bool setCurrentString(unsigned short *stringToSet);
|
||||
bool setOriginalString(unsigned short *stringToSet);
|
||||
void resetCurrentString();
|
||||
|
||||
Sprite * getSprite();
|
||||
Sprite * createNewSpriteFromLetterDefinition(FontLetterDefinition &theDefinition, Texture2D *theTexture);
|
||||
Sprite * updateSpriteWithLetterDefinition(Sprite *spriteToUpdate, FontLetterDefinition &theDefinition, Texture2D *theTexture);
|
||||
Sprite * getSpriteForLetter(unsigned short int newLetter);
|
||||
Sprite * updateSpriteForLetter(Sprite *spriteToUpdate, unsigned short int newLetter);
|
||||
|
||||
Array _spriteArray;
|
||||
Array _spriteArrayCache;
|
||||
float _commonLineHeight;
|
||||
bool _lineBreakWithoutSpaces;
|
||||
float _width;
|
||||
TextHAlignment _alignment;
|
||||
unsigned short int * _currentUTF8String;
|
||||
unsigned short int * _originalUTF8String;
|
||||
Size * _advances;
|
||||
FontAtlas * _fontAtlas;
|
||||
Color3B _displayedColor;
|
||||
Color3B _realColor;
|
||||
bool _cascadeColorEnabled;
|
||||
bool _cascadeOpacityEnabled;
|
||||
unsigned char _displayedOpacity;
|
||||
unsigned char _realOpacity;
|
||||
bool _isOpacityModifyRGB;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif /*__COCOS2D_CCLABEL_H */
|
||||
|
|
|
@ -32,33 +32,33 @@ class CC_DLL LabelTextFormatProtocol
|
|||
public:
|
||||
|
||||
// sprite related stuff
|
||||
virtual cocos2d::Sprite * getSpriteChild(int ID) = 0;
|
||||
virtual cocos2d::Array * getChildrenLetters() = 0;
|
||||
virtual cocos2d::Sprite * getSpriteForChar(unsigned short int theChar, int spriteIndexHint) = 0;
|
||||
virtual float getLetterPosXLeft( cocos2d::Sprite* sp ) = 0;
|
||||
virtual float getLetterPosXRight( cocos2d::Sprite* sp ) = 0;
|
||||
virtual cocos2d::Sprite *getSpriteChild(int ID) = 0;
|
||||
virtual cocos2d::Array *getChildrenLetters() = 0;
|
||||
virtual cocos2d::Sprite *getSpriteForChar(unsigned short int theChar, int spriteIndexHint) = 0;
|
||||
virtual float getLetterPosXLeft( cocos2d::Sprite* sp ) = 0;
|
||||
virtual float getLetterPosXRight( cocos2d::Sprite* sp ) = 0;
|
||||
|
||||
// font related stuff
|
||||
virtual int getCommonLineHeight() = 0;
|
||||
virtual int getKerningForCharsPair(unsigned short first, unsigned short second) = 0;
|
||||
virtual int getXOffsetForChar(unsigned short c) = 0;
|
||||
virtual int getYOffsetForChar(unsigned short c) = 0;
|
||||
virtual int getAdvanceForChar(unsigned short c, int hintPositionInString) = 0;
|
||||
virtual cocos2d::Rect getRectForChar(unsigned short c) = 0;
|
||||
virtual int getCommonLineHeight() = 0;
|
||||
virtual int getKerningForCharsPair(unsigned short first, unsigned short second) = 0;
|
||||
virtual int getXOffsetForChar(unsigned short c) = 0;
|
||||
virtual int getYOffsetForChar(unsigned short c) = 0;
|
||||
virtual int getAdvanceForChar(unsigned short c, int hintPositionInString) = 0;
|
||||
virtual cocos2d::Rect getRectForChar(unsigned short c) = 0;
|
||||
|
||||
// string related stuff
|
||||
virtual int getStringNumLines() = 0;
|
||||
virtual int getStringLenght() = 0;
|
||||
virtual unsigned short getCharAtStringPosition(int position) = 0;
|
||||
virtual unsigned short * getUTF8String() = 0;
|
||||
virtual void assignNewUTF8String(unsigned short *newString) = 0;
|
||||
virtual TextHAlignment getTextAlignment() = 0;
|
||||
virtual int getStringNumLines() = 0;
|
||||
virtual int getStringLenght() = 0;
|
||||
virtual unsigned short getCharAtStringPosition(int position) = 0;
|
||||
virtual unsigned short * getUTF8String() = 0;
|
||||
virtual void assignNewUTF8String(unsigned short *newString) = 0;
|
||||
virtual TextHAlignment getTextAlignment() = 0;
|
||||
|
||||
// label related stuff
|
||||
virtual float getMaxLineWidth() = 0;
|
||||
virtual bool breakLineWithoutSpace() = 0;
|
||||
virtual cocos2d::Size getLabelContentSize() = 0;
|
||||
virtual void setLabelContentSize(const Size &newSize) = 0;
|
||||
virtual float getMaxLineWidth() = 0;
|
||||
virtual bool breakLineWithoutSpace() = 0;
|
||||
virtual cocos2d::Size getLabelContentSize() = 0;
|
||||
virtual void setLabelContentSize(const Size &newSize) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ bool LabelTextFormatter::alignText(LabelTextFormatProtocol *theLabel)
|
|||
vector<unsigned short> last_line;
|
||||
for (int ctr = 0; ctr <= str_len; ++ctr)
|
||||
{
|
||||
unsigned char currentChar = theLabel->getCharAtStringPosition(ctr);
|
||||
unsigned short int currentChar = theLabel->getCharAtStringPosition(ctr);
|
||||
|
||||
if (currentChar == '\n' || currentChar == 0)
|
||||
{
|
||||
|
@ -301,7 +301,7 @@ bool LabelTextFormatter::createStringSprites(LabelTextFormatProtocol *theLabel)
|
|||
unsigned short prev = -1;
|
||||
|
||||
|
||||
Size tmpSize = Size::ZERO;
|
||||
Size tmpSize = Size::ZERO;
|
||||
|
||||
int longestLine = 0;
|
||||
unsigned int totalHeight = 0;
|
||||
|
|
|
@ -1,733 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Use any of these editors to generate BMFonts:
|
||||
http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||
http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||
http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||
http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||
|
||||
****************************************************************************/
|
||||
#include "CCStringBMFont.h"
|
||||
#include "cocoa/CCString.h"
|
||||
#include "cocoa/CCDictionary.h"
|
||||
#include "CCConfiguration.h"
|
||||
#include "CCLabelTextFormatter.h"
|
||||
#include "draw_nodes/CCDrawingPrimitives.h"
|
||||
#include "sprite_nodes/CCSprite.h"
|
||||
//#include "support/CCPointExtension.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "CCDirector.h"
|
||||
#include "textures/CCTextureCache.h"
|
||||
#include "support/ccUTF8.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
||||
// The return value needs to be deleted by CC_SAFE_DELETE_ARRAY.
|
||||
static unsigned short* copyUTF16StringNN(unsigned short* str)
|
||||
{
|
||||
int length = str ? cc_wcslen(str) : 0;
|
||||
unsigned short* ret = new unsigned short[length+1];
|
||||
for (int i = 0; i < length; ++i) {
|
||||
ret[i] = str[i];
|
||||
}
|
||||
ret[length] = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//
|
||||
//CCLabelBMFont
|
||||
//
|
||||
|
||||
//LabelBMFont - Purge Cache
|
||||
void StringBMFont::purgeCachedData()
|
||||
{
|
||||
FNTConfigRemoveCache();
|
||||
}
|
||||
|
||||
StringBMFont * StringBMFont::create()
|
||||
{
|
||||
StringBMFont * pRet = new StringBMFont();
|
||||
if (pRet && pRet->init())
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
CC_SAFE_DELETE(pRet);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
StringBMFont * StringBMFont::create(const char *str, const char *fntFile, float width, TextHAlignment alignment)
|
||||
{
|
||||
return StringBMFont::create(str, fntFile, width, alignment, Point::ZERO);
|
||||
}
|
||||
|
||||
StringBMFont * StringBMFont::create(const char *str, const char *fntFile, float width)
|
||||
{
|
||||
return StringBMFont::create(str, fntFile, width, TextHAlignment::LEFT, Point::ZERO);
|
||||
}
|
||||
|
||||
StringBMFont * StringBMFont::create(const char *str, const char *fntFile)
|
||||
{
|
||||
return StringBMFont::create(str, fntFile, kLabelAutomaticWidth, TextHAlignment::LEFT, Point::ZERO);
|
||||
}
|
||||
|
||||
//LabelBMFont - Creation & Init
|
||||
StringBMFont *StringBMFont::create(const char *str, const char *fntFile, float width/* = kLabelAutomaticWidth*/, TextHAlignment alignment/* = kTextAlignmentLeft*/, Point imageOffset/* = Point::ZERO*/)
|
||||
{
|
||||
StringBMFont *pRet = new StringBMFont();
|
||||
if(pRet && pRet->initWithString(str, fntFile, width, alignment, imageOffset))
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
CC_SAFE_DELETE(pRet);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool StringBMFont::init()
|
||||
{
|
||||
return initWithString(NULL, NULL, kLabelAutomaticWidth, TextHAlignment::LEFT, Point::ZERO);
|
||||
}
|
||||
|
||||
bool StringBMFont::initWithString(const char *theString, const char *fntFile, float width/* = kLabelAutomaticWidth*/, TextHAlignment alignment/* = kTextAlignmentLeft*/, Point imageOffset/* = Point::ZERO*/)
|
||||
{
|
||||
CCAssert(!_configuration, "re-init is no longer supported");
|
||||
CCAssert( (theString && fntFile) || (theString==NULL && fntFile==NULL), "Invalid params for StringBMFont");
|
||||
|
||||
Texture2D *texture = NULL;
|
||||
|
||||
if (fntFile)
|
||||
{
|
||||
CCBMFontConfiguration *newConf = FNTConfigLoadFile(fntFile);
|
||||
if (!newConf)
|
||||
{
|
||||
CCLOG("cocos2d: WARNING. StringBMFont: Impossible to create font. Please check file: '%s'", fntFile);
|
||||
release();
|
||||
return false;
|
||||
}
|
||||
|
||||
newConf->retain();
|
||||
CC_SAFE_RELEASE(_configuration);
|
||||
_configuration = newConf;
|
||||
|
||||
_fntFile = fntFile;
|
||||
|
||||
texture = TextureCache::getInstance()->addImage(_configuration->getAtlasName());
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = new Texture2D();
|
||||
texture->autorelease();
|
||||
}
|
||||
|
||||
if (theString == NULL)
|
||||
{
|
||||
theString = "";
|
||||
}
|
||||
|
||||
if (SpriteBatchNode::initWithTexture(texture, strlen(theString)))
|
||||
{
|
||||
_width = width;
|
||||
_alignment = alignment;
|
||||
|
||||
_displayedOpacity = _realOpacity = 255;
|
||||
_displayedColor = _realColor = Color3B::WHITE;
|
||||
_cascadeOpacityEnabled = true;
|
||||
_cascadeColorEnabled = true;
|
||||
|
||||
_contentSize = Size::ZERO;
|
||||
|
||||
_isOpacityModifyRGB = _textureAtlas->getTexture()->hasPremultipliedAlpha();
|
||||
_anchorPoint = Point(0.5f, 0.5f);
|
||||
|
||||
_imageOffset = imageOffset;
|
||||
|
||||
_reusedChar = new Sprite();
|
||||
_reusedChar->initWithTexture(_textureAtlas->getTexture(), Rect(0, 0, 0, 0), false);
|
||||
_reusedChar->setBatchNode(this);
|
||||
|
||||
this->setString(theString);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
StringBMFont::StringBMFont()
|
||||
: _string(NULL)
|
||||
, _initialString(NULL)
|
||||
, _alignment(TextHAlignment::CENTER)
|
||||
, _width(-1.0f)
|
||||
, _configuration(NULL)
|
||||
, _lineBreakWithoutSpaces(false)
|
||||
, _imageOffset(Point::ZERO)
|
||||
, _reusedChar(NULL)
|
||||
, _displayedOpacity(255)
|
||||
, _realOpacity(255)
|
||||
, _displayedColor(Color3B::WHITE)
|
||||
, _realColor(Color3B::WHITE)
|
||||
, _cascadeColorEnabled(true)
|
||||
, _cascadeOpacityEnabled(true)
|
||||
, _isOpacityModifyRGB(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
StringBMFont::~StringBMFont()
|
||||
{
|
||||
CC_SAFE_RELEASE(_reusedChar);
|
||||
CC_SAFE_DELETE_ARRAY(_string);
|
||||
CC_SAFE_DELETE_ARRAY(_initialString);
|
||||
CC_SAFE_RELEASE(_configuration);
|
||||
}
|
||||
|
||||
// StringBMFont - Atlas generation
|
||||
int StringBMFont::kerningAmountForFirst(unsigned short first, unsigned short second)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int key = (first<<16) | (second & 0xffff);
|
||||
|
||||
if( _configuration->_kerningDictionary ) {
|
||||
tKerningHashElement *element = NULL;
|
||||
HASH_FIND_INT(_configuration->_kerningDictionary, &key, element);
|
||||
if(element)
|
||||
ret = element->amount;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char* StringBMFont::getString(void) const
|
||||
{
|
||||
return _initialStringUTF8.c_str();
|
||||
}
|
||||
|
||||
//StringBMFont - RGBAProtocol protocol
|
||||
const Color3B& StringBMFont::getColor() const
|
||||
{
|
||||
return _realColor;
|
||||
}
|
||||
|
||||
const Color3B& StringBMFont::getDisplayedColor() const
|
||||
{
|
||||
return _displayedColor;
|
||||
}
|
||||
|
||||
void StringBMFont::setColor(const Color3B& color)
|
||||
{
|
||||
_displayedColor = _realColor = color;
|
||||
|
||||
if( _cascadeColorEnabled ) {
|
||||
Color3B parentColor = Color3B::WHITE;
|
||||
RGBAProtocol* pParent = dynamic_cast<RGBAProtocol*>(_parent);
|
||||
if (pParent && pParent->isCascadeColorEnabled())
|
||||
{
|
||||
parentColor = pParent->getDisplayedColor();
|
||||
}
|
||||
this->updateDisplayedColor(parentColor);
|
||||
}
|
||||
}
|
||||
|
||||
GLubyte StringBMFont::getOpacity(void) const
|
||||
{
|
||||
return _realOpacity;
|
||||
}
|
||||
|
||||
GLubyte StringBMFont::getDisplayedOpacity(void) const
|
||||
{
|
||||
return _displayedOpacity;
|
||||
}
|
||||
|
||||
/** Override synthesized setOpacity to recurse items */
|
||||
void StringBMFont::setOpacity(GLubyte opacity)
|
||||
{
|
||||
_displayedOpacity = _realOpacity = opacity;
|
||||
|
||||
if( _cascadeOpacityEnabled ) {
|
||||
GLubyte parentOpacity = 255;
|
||||
RGBAProtocol* pParent = dynamic_cast<RGBAProtocol*>(_parent);
|
||||
if (pParent && pParent->isCascadeOpacityEnabled())
|
||||
{
|
||||
parentOpacity = pParent->getDisplayedOpacity();
|
||||
}
|
||||
this->updateDisplayedOpacity(parentOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
void StringBMFont::setOpacityModifyRGB(bool var)
|
||||
{
|
||||
_isOpacityModifyRGB = var;
|
||||
if (_children && _children->count() != 0)
|
||||
{
|
||||
Object* child;
|
||||
CCARRAY_FOREACH(_children, child)
|
||||
{
|
||||
Node* pNode = static_cast<Node*>( child );
|
||||
if (pNode)
|
||||
{
|
||||
RGBAProtocol *pRGBAProtocol = dynamic_cast<RGBAProtocol*>(pNode);
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setOpacityModifyRGB(_isOpacityModifyRGB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bool StringBMFont::isOpacityModifyRGB() const
|
||||
{
|
||||
return _isOpacityModifyRGB;
|
||||
}
|
||||
|
||||
void StringBMFont::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
{
|
||||
_displayedOpacity = _realOpacity * parentOpacity/255.0;
|
||||
|
||||
Object* pObj;
|
||||
CCARRAY_FOREACH(_children, pObj)
|
||||
{
|
||||
Sprite *item = static_cast<Sprite*>( pObj );
|
||||
item->updateDisplayedOpacity(_displayedOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
void StringBMFont::updateDisplayedColor(const Color3B& parentColor)
|
||||
{
|
||||
_displayedColor.r = _realColor.r * parentColor.r/255.0;
|
||||
_displayedColor.g = _realColor.g * parentColor.g/255.0;
|
||||
_displayedColor.b = _realColor.b * parentColor.b/255.0;
|
||||
|
||||
Object* pObj;
|
||||
CCARRAY_FOREACH(_children, pObj)
|
||||
{
|
||||
Sprite *item = static_cast<Sprite*>( pObj );
|
||||
item->updateDisplayedColor(_displayedColor);
|
||||
}
|
||||
}
|
||||
|
||||
bool StringBMFont::isCascadeColorEnabled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void StringBMFont::setCascadeColorEnabled(bool cascadeColorEnabled)
|
||||
{
|
||||
_cascadeColorEnabled = cascadeColorEnabled;
|
||||
}
|
||||
|
||||
bool StringBMFont::isCascadeOpacityEnabled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void StringBMFont::setCascadeOpacityEnabled(bool cascadeOpacityEnabled)
|
||||
{
|
||||
_cascadeOpacityEnabled = cascadeOpacityEnabled;
|
||||
}
|
||||
|
||||
// StringBMFont - AnchorPoint
|
||||
void StringBMFont::setAnchorPoint(const Point& point)
|
||||
{
|
||||
if( ! point.equals(_anchorPoint))
|
||||
{
|
||||
SpriteBatchNode::setAnchorPoint(point);
|
||||
updateLabel();
|
||||
}
|
||||
}
|
||||
|
||||
// StringBMFont - Alignment
|
||||
void StringBMFont::setAlignment(TextHAlignment alignment)
|
||||
{
|
||||
this->_alignment = alignment;
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
void StringBMFont::setWidth(float width)
|
||||
{
|
||||
this->_width = width;
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
void StringBMFont::setLineBreakWithoutSpace( bool breakWithoutSpace )
|
||||
{
|
||||
_lineBreakWithoutSpaces = breakWithoutSpace;
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
void StringBMFont::setScale(float scale)
|
||||
{
|
||||
SpriteBatchNode::setScale(scale);
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
void StringBMFont::setScaleX(float scaleX)
|
||||
{
|
||||
SpriteBatchNode::setScaleX(scaleX);
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
void StringBMFont::setScaleY(float scaleY)
|
||||
{
|
||||
SpriteBatchNode::setScaleY(scaleY);
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
float StringBMFont::getLetterPosXLeft( Sprite* sp )
|
||||
{
|
||||
return sp->getPosition().x * _scaleX - (sp->getContentSize().width * _scaleX * sp->getAnchorPoint().x);
|
||||
}
|
||||
|
||||
float StringBMFont::getLetterPosXRight( Sprite* sp )
|
||||
{
|
||||
return sp->getPosition().x * _scaleX + (sp->getContentSize().width * _scaleX * sp->getAnchorPoint().x);
|
||||
}
|
||||
|
||||
// StringBMFont - FntFile
|
||||
void StringBMFont::setFntFile(const char* fntFile)
|
||||
{
|
||||
if (fntFile != NULL && strcmp(fntFile, _fntFile.c_str()) != 0 )
|
||||
{
|
||||
CCBMFontConfiguration *newConf = FNTConfigLoadFile(fntFile);
|
||||
|
||||
CCAssert( newConf, "CCStringBMFont: Impossible to create font. Please check file");
|
||||
|
||||
_fntFile = fntFile;
|
||||
|
||||
CC_SAFE_RETAIN(newConf);
|
||||
CC_SAFE_RELEASE(_configuration);
|
||||
_configuration = newConf;
|
||||
|
||||
this->setTexture(TextureCache::getInstance()->addImage(_configuration->getAtlasName()));
|
||||
LabelTextFormatter::createStringSprites(this);
|
||||
}
|
||||
}
|
||||
|
||||
const char* StringBMFont::getFntFile()
|
||||
{
|
||||
return _fntFile.c_str();
|
||||
}
|
||||
|
||||
|
||||
//StringBMFont - Debug draw
|
||||
#if CC_LabelBMFontNew_DEBUG_DRAW
|
||||
void StringBMFont::draw()
|
||||
{
|
||||
SpriteBatchNode::draw();
|
||||
const Size& s = this->getContentSize();
|
||||
Point vertices[4]={
|
||||
ccp(0,0),ccp(s.width,0),
|
||||
ccp(s.width,s.height),ccp(0,s.height),
|
||||
};
|
||||
ccDrawPoly(vertices, 4, true);
|
||||
}
|
||||
|
||||
#endif // CC_LABELBMFONT_DEBUG_DRAW
|
||||
|
||||
|
||||
int StringBMFont::getCommonLineHeight()
|
||||
{
|
||||
if (_configuration)
|
||||
{
|
||||
return _configuration->_commonHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int StringBMFont::getKerningForCharsPair(unsigned short first, unsigned short second)
|
||||
{
|
||||
return this->kerningAmountForFirst(first, second);
|
||||
}
|
||||
|
||||
ccBMFontDef StringBMFont::getFontDefForChar(unsigned short int theChar)
|
||||
{
|
||||
ccBMFontDef fontDef;
|
||||
tFontDefHashElement *element = NULL;
|
||||
unsigned int key = theChar;
|
||||
|
||||
HASH_FIND_INT(_configuration->_fontDefDictionary, &key, element);
|
||||
|
||||
if (element)
|
||||
{
|
||||
fontDef = element->fontDef;
|
||||
}
|
||||
|
||||
return fontDef;
|
||||
}
|
||||
|
||||
// return a sprite for rendering one letter
|
||||
Sprite * StringBMFont::getSpriteForChar(unsigned short int theChar, int spriteIndexHint)
|
||||
{
|
||||
Rect rect;
|
||||
ccBMFontDef fontDef;
|
||||
Sprite *pRetSprite = 0;
|
||||
|
||||
// unichar is a short, and an int is needed on HASH_FIND_INT
|
||||
tFontDefHashElement *element = NULL;
|
||||
unsigned int key = theChar;
|
||||
|
||||
HASH_FIND_INT(_configuration->_fontDefDictionary, &key, element);
|
||||
|
||||
if (! element)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
fontDef = element->fontDef;
|
||||
|
||||
rect = fontDef.rect;
|
||||
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
||||
|
||||
rect.origin.x += _imageOffset.x;
|
||||
rect.origin.y += _imageOffset.y;
|
||||
|
||||
//bool hasSprite = true;
|
||||
pRetSprite = (Sprite*)(this->getChildByTag(spriteIndexHint));
|
||||
|
||||
if(pRetSprite )
|
||||
{
|
||||
// Reusing previous Sprite
|
||||
pRetSprite->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
pRetSprite = new Sprite();
|
||||
pRetSprite->initWithTexture(_textureAtlas->getTexture(), rect);
|
||||
addChild(pRetSprite, spriteIndexHint, spriteIndexHint);
|
||||
pRetSprite->release();
|
||||
|
||||
// Apply label properties
|
||||
pRetSprite->setOpacityModifyRGB(_isOpacityModifyRGB);
|
||||
|
||||
// Color MUST be set before opacity, since opacity might change color if OpacityModifyRGB is on
|
||||
pRetSprite->updateDisplayedColor(_displayedColor);
|
||||
pRetSprite->updateDisplayedOpacity(_displayedOpacity);
|
||||
}
|
||||
|
||||
// updating previous sprite
|
||||
pRetSprite->setTextureRect(rect, false, rect.size);
|
||||
return pRetSprite;
|
||||
}
|
||||
|
||||
int StringBMFont::getStringNumLines()
|
||||
{
|
||||
int quantityOfLines = 1;
|
||||
|
||||
unsigned int stringLen = _string ? cc_wcslen(_string) : 0;
|
||||
if (stringLen == 0)
|
||||
return (-1);
|
||||
|
||||
// count number of lines
|
||||
for (unsigned int i = 0; i < stringLen - 1; ++i)
|
||||
{
|
||||
unsigned short c = _string[i];
|
||||
if (c == '\n')
|
||||
{
|
||||
quantityOfLines++;
|
||||
}
|
||||
}
|
||||
|
||||
return quantityOfLines;
|
||||
}
|
||||
|
||||
// need cross implementation
|
||||
int StringBMFont::getStringLenght()
|
||||
{
|
||||
return _string ? cc_wcslen(_string) : 0;
|
||||
}
|
||||
|
||||
unsigned short StringBMFont::getCharAtStringPosition(int position)
|
||||
{
|
||||
return _string[position];
|
||||
}
|
||||
|
||||
int StringBMFont::getXOffsetForChar(unsigned short c)
|
||||
{
|
||||
ccBMFontDef fontDef = getFontDefForChar(c);
|
||||
return fontDef.xOffset;
|
||||
}
|
||||
|
||||
int StringBMFont::getYOffsetForChar(unsigned short c)
|
||||
{
|
||||
ccBMFontDef fontDef = getFontDefForChar(c);
|
||||
return fontDef.yOffset;
|
||||
}
|
||||
|
||||
Rect StringBMFont::getRectForChar(unsigned short c)
|
||||
{
|
||||
ccBMFontDef fontDef = getFontDefForChar(c);
|
||||
return fontDef.rect;
|
||||
}
|
||||
|
||||
int StringBMFont::getAdvanceForChar(unsigned short c, int hintPositionInString)
|
||||
{
|
||||
ccBMFontDef fontDef = getFontDefForChar(c);
|
||||
return fontDef.xAdvance;
|
||||
}
|
||||
|
||||
void StringBMFont::setLabelContentSize(const Size &newSize)
|
||||
{
|
||||
setContentSize(newSize);
|
||||
}
|
||||
|
||||
void StringBMFont::createStringSprites()
|
||||
{
|
||||
LabelTextFormatter::createStringSprites(this);
|
||||
}
|
||||
|
||||
void StringBMFont::setString(const char *newString)
|
||||
{
|
||||
// store initial string in char8 format
|
||||
_initialStringUTF8 = newString;
|
||||
|
||||
// update the initial string if needed
|
||||
unsigned short* utf16String = cc_utf8_to_utf16(newString);
|
||||
unsigned short* tmp = _initialString;
|
||||
_initialString = copyUTF16StringNN(utf16String);
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(tmp);
|
||||
CC_SAFE_DELETE_ARRAY(utf16String);
|
||||
|
||||
// do the rest of the josb
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
void StringBMFont::setCString(const char *label)
|
||||
{
|
||||
setString(label);
|
||||
}
|
||||
|
||||
void StringBMFont::updateLabel()
|
||||
{
|
||||
if ( _initialString!=0 )
|
||||
{
|
||||
// set the new string
|
||||
CC_SAFE_DELETE_ARRAY(_string);
|
||||
_string = copyUTF16StringNN(_initialString);
|
||||
|
||||
// hide all the letters and create or recicle sprites for the new letters
|
||||
updateLetterSprites();
|
||||
|
||||
// format the text on more than line
|
||||
multilineText();
|
||||
|
||||
// align the text (left - center - right)
|
||||
alignText();
|
||||
}
|
||||
}
|
||||
|
||||
void StringBMFont::updateLetterSprites()
|
||||
{
|
||||
// hide all the letters
|
||||
hideStringSprites();
|
||||
|
||||
// create new letters sprites
|
||||
createStringSprites();
|
||||
}
|
||||
|
||||
void StringBMFont::hideStringSprites()
|
||||
{
|
||||
if (_children && _children->count() != 0)
|
||||
{
|
||||
Object* child;
|
||||
CCARRAY_FOREACH(_children, child)
|
||||
{
|
||||
Node* pNode = (Node*) child;
|
||||
if (pNode)
|
||||
{
|
||||
pNode->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StringBMFont::multilineText()
|
||||
{
|
||||
if (_width > 0)
|
||||
{
|
||||
// format on more than one line
|
||||
LabelTextFormatter::multilineText(this);
|
||||
|
||||
// hide all the letter sprites and create/reclaim letters sprite with new position
|
||||
updateLetterSprites();
|
||||
}
|
||||
}
|
||||
|
||||
void StringBMFont::alignText()
|
||||
{
|
||||
if (_alignment != TextHAlignment::LEFT)
|
||||
{
|
||||
LabelTextFormatter::alignText(this);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short * StringBMFont::getUTF8String()
|
||||
{
|
||||
return _string;
|
||||
}
|
||||
|
||||
Sprite * StringBMFont::getSpriteChild(int ID)
|
||||
{
|
||||
return (Sprite*)this->getChildByTag(ID);
|
||||
}
|
||||
|
||||
float StringBMFont::getMaxLineWidth()
|
||||
{
|
||||
return _width;
|
||||
}
|
||||
|
||||
TextHAlignment StringBMFont::getTextAlignment()
|
||||
{
|
||||
return _alignment;
|
||||
}
|
||||
|
||||
Array* StringBMFont::getChildrenLetters()
|
||||
{
|
||||
return _children;
|
||||
}
|
||||
|
||||
void StringBMFont::assignNewUTF8String(unsigned short *newString)
|
||||
{
|
||||
CC_SAFE_DELETE_ARRAY(_string);
|
||||
_string = newString;
|
||||
}
|
||||
|
||||
Size StringBMFont::getLabelContentSize()
|
||||
{
|
||||
return getContentSize();
|
||||
}
|
||||
|
||||
bool StringBMFont::breakLineWithoutSpace()
|
||||
{
|
||||
return _lineBreakWithoutSpaces;
|
||||
}
|
||||
|
||||
|
||||
NS_CC_END
|
|
@ -1,204 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Use any of these editors to generate BMFonts:
|
||||
http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||
http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||
http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||
http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef __CCBITMAP_FONT_ATLAS_H__NEW_
|
||||
#define __CCBITMAP_FONT_ATLAS_H__NEW_
|
||||
|
||||
#include "sprite_nodes/CCSpriteBatchNode.h"
|
||||
#include "support/data_support/uthash.h"
|
||||
#include "CCLabelBMFont.h"
|
||||
#include "CCLabelTextFormatProtocol.h"
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "CCLabel.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL StringBMFont: public Label, public LabelTextFormatProtocol
|
||||
{
|
||||
public:
|
||||
StringBMFont();
|
||||
|
||||
virtual ~StringBMFont();
|
||||
/** Purges the cached data.
|
||||
Removes from memory the cached configurations and the atlas name dictionary.
|
||||
@since v0.99.3
|
||||
*/
|
||||
static void purgeCachedData();
|
||||
|
||||
/** creates a bitmap font atlas with an initial string and the FNT file */
|
||||
static StringBMFont * create(const char *str, const char *fntFile, float width, TextHAlignment alignment, Point imageOffset);
|
||||
|
||||
static StringBMFont * create(const char *str, const char *fntFile, float width, TextHAlignment alignment);
|
||||
|
||||
static StringBMFont * create(const char *str, const char *fntFile, float width);
|
||||
|
||||
static StringBMFont * create(const char *str, const char *fntFile);
|
||||
|
||||
/** Creates an label.
|
||||
*/
|
||||
static StringBMFont * create();
|
||||
|
||||
bool init();
|
||||
/** init a bitmap font atlas with an initial string and the FNT file */
|
||||
bool initWithString(const char *str, const char *fntFile, float width = kLabelAutomaticWidth, TextHAlignment alignment = TextHAlignment::LEFT, Point imageOffset = Point::ZERO);
|
||||
|
||||
/** updates the font chars based on the string to render */
|
||||
// super method
|
||||
virtual void setString(const char *newString);
|
||||
|
||||
virtual const char* getString(void) const;
|
||||
virtual void setCString(const char *label);
|
||||
virtual void setAnchorPoint(const Point& var);
|
||||
virtual void updateLabel();
|
||||
virtual void setAlignment(TextHAlignment alignment);
|
||||
virtual void setWidth(float width);
|
||||
virtual void setLineBreakWithoutSpace(bool breakWithoutSpace);
|
||||
virtual void setScale(float scale);
|
||||
virtual void setScaleX(float scaleX);
|
||||
virtual void setScaleY(float scaleY);
|
||||
|
||||
// RGBAProtocol
|
||||
virtual bool isOpacityModifyRGB() const;
|
||||
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB);
|
||||
virtual GLubyte getOpacity() const;
|
||||
virtual GLubyte getDisplayedOpacity() const;
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual void updateDisplayedOpacity(GLubyte parentOpacity);
|
||||
virtual bool isCascadeOpacityEnabled() const;
|
||||
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled);
|
||||
virtual const Color3B& getColor(void) const;
|
||||
virtual const Color3B& getDisplayedColor() const;
|
||||
virtual void setColor(const Color3B& color);
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor);
|
||||
virtual bool isCascadeColorEnabled() const;
|
||||
virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
|
||||
|
||||
|
||||
// StringBMFont protocol stuff
|
||||
virtual Sprite * getSpriteChild(int ID);
|
||||
virtual Array * getChildrenLetters();
|
||||
virtual Sprite * getSpriteForChar(unsigned short int theChar, int spriteIndexHint);
|
||||
virtual int getCommonLineHeight();
|
||||
virtual int getKerningForCharsPair(unsigned short first, unsigned short second);
|
||||
virtual int getXOffsetForChar(unsigned short c);
|
||||
virtual int getYOffsetForChar(unsigned short c);
|
||||
virtual int getAdvanceForChar(unsigned short c, int hintPositionInString);
|
||||
virtual Rect getRectForChar(unsigned short c);
|
||||
float getLetterPosXLeft( Sprite* sp );
|
||||
float getLetterPosXRight( Sprite* sp );
|
||||
virtual int getStringNumLines();
|
||||
virtual int getStringLenght();
|
||||
virtual unsigned short getCharAtStringPosition(int position);
|
||||
virtual unsigned short * getUTF8String();
|
||||
virtual void assignNewUTF8String(unsigned short *newString);
|
||||
virtual float getMaxLineWidth();
|
||||
virtual bool breakLineWithoutSpace();
|
||||
virtual TextHAlignment getTextAlignment();
|
||||
virtual Size getLabelContentSize();
|
||||
virtual void setLabelContentSize(const Size &newSize);
|
||||
|
||||
|
||||
void setFntFile(const char* fntFile);
|
||||
const char* getFntFile();
|
||||
|
||||
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||
virtual void draw();
|
||||
#endif // CC_LABELBMFONT_DEBUG_DRAW
|
||||
|
||||
private:
|
||||
char * atlasNameFromFntFile(const char *fntFile);
|
||||
int kerningAmountForFirst(unsigned short first, unsigned short second);
|
||||
|
||||
// some more new stuff
|
||||
void alignText();
|
||||
void multilineText();
|
||||
ccBMFontDef getFontDefForChar(unsigned short int theChar);
|
||||
void createStringSprites();
|
||||
void hideStringSprites();
|
||||
void updateLetterSprites();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// string to render
|
||||
unsigned short* _string;
|
||||
|
||||
// name of fntFile
|
||||
std::string _fntFile;
|
||||
|
||||
// initial string without line breaks
|
||||
unsigned short* _initialString;
|
||||
std::string _initialStringUTF8;
|
||||
|
||||
// alignment of all lines
|
||||
TextHAlignment _alignment;
|
||||
// max width until a line break is added
|
||||
float _width;
|
||||
|
||||
CCBMFontConfiguration *_configuration;
|
||||
|
||||
bool _lineBreakWithoutSpaces;
|
||||
// offset of the texture atlas
|
||||
Point _imageOffset;
|
||||
|
||||
// reused char
|
||||
Sprite *_reusedChar;
|
||||
|
||||
// texture RGBA
|
||||
GLubyte _displayedOpacity;
|
||||
GLubyte _realOpacity;
|
||||
Color3B _displayedColor;
|
||||
Color3B _realColor;
|
||||
bool _cascadeColorEnabled;
|
||||
bool _cascadeOpacityEnabled;
|
||||
/** conforms to RGBAProtocol protocol */
|
||||
bool _isOpacityModifyRGB;
|
||||
|
||||
};
|
||||
|
||||
/** Free function that parses a FNT file a place it on the cache
|
||||
*/
|
||||
CC_DLL CCBMFontConfiguration * FNTConfigLoadFile( const char *file );
|
||||
/** Purges the FNT config cache
|
||||
*/
|
||||
CC_DLL void FNTConfigRemoveCache( void );
|
||||
|
||||
// end of GUI group
|
||||
/// @}
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif //__CCBITMAP_FONT_ATLAS_H__
|
|
@ -1,671 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "CCStringTTF.h"
|
||||
#include "CCFont.h"
|
||||
#include "CCLabelTextFormatter.h"
|
||||
#include "CCFontAtlasCache.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
StringTTF::StringTTF(FontAtlas *pAtlas, TextHAlignment alignment): _currentUTF8String(0),
|
||||
_originalUTF8String(0),
|
||||
_fontAtlas(pAtlas),
|
||||
_alignment(alignment),
|
||||
_lineBreakWithoutSpaces(false),
|
||||
_advances(0),
|
||||
_displayedColor(Color3B::WHITE),
|
||||
_realColor(Color3B::WHITE),
|
||||
_cascadeColorEnabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
StringTTF* StringTTF::create(FontAtlas *pAtlas, TextHAlignment alignment, int lineSize)
|
||||
{
|
||||
StringTTF *ret = new StringTTF(pAtlas, alignment);
|
||||
|
||||
if (!ret)
|
||||
return nullptr;
|
||||
|
||||
if( ret->init() )
|
||||
{
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
StringTTF::~StringTTF()
|
||||
{
|
||||
if (_currentUTF8String)
|
||||
{
|
||||
delete [] _currentUTF8String;
|
||||
_currentUTF8String = 0;
|
||||
}
|
||||
|
||||
if (_advances)
|
||||
{
|
||||
delete [] _advances;
|
||||
_advances = 0;
|
||||
}
|
||||
|
||||
if (_fontAtlas)
|
||||
{
|
||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||
}
|
||||
}
|
||||
|
||||
bool StringTTF::init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void StringTTF::setString(const char *stringToRender)
|
||||
{
|
||||
setText(stringToRender, 0, TextHAlignment::CENTER, false);
|
||||
}
|
||||
|
||||
bool StringTTF::setText(const char *stringToRender, float lineWidth, TextHAlignment alignment, bool lineBreakWithoutSpaces)
|
||||
{
|
||||
if (!_fontAtlas)
|
||||
return false;
|
||||
|
||||
_width = lineWidth;
|
||||
_alignment = alignment;
|
||||
_lineBreakWithoutSpaces = lineBreakWithoutSpaces;
|
||||
|
||||
// release all the sprites
|
||||
moveAllSpritesToCache();
|
||||
|
||||
// store locally common line height
|
||||
_commonLineHeight = _fontAtlas->getCommonLineHeight();
|
||||
if (_commonLineHeight <= 0)
|
||||
return false;
|
||||
|
||||
int numLetter = 0;
|
||||
unsigned short* utf16String = cc_utf8_to_utf16(stringToRender);
|
||||
if(!utf16String)
|
||||
return false;
|
||||
|
||||
numLetter = cc_wcslen(utf16String);
|
||||
SpriteBatchNode::initWithTexture(&_fontAtlas->getTexture(0), numLetter);
|
||||
_cascadeColorEnabled = true;
|
||||
|
||||
//
|
||||
setCurrentString(utf16String);
|
||||
setOriginalString(utf16String);
|
||||
|
||||
// align text
|
||||
alignText();
|
||||
|
||||
// done here
|
||||
return true;
|
||||
}
|
||||
|
||||
void StringTTF::setAlignment(TextHAlignment alignment)
|
||||
{
|
||||
// store the new alignment
|
||||
if (alignment != _alignment)
|
||||
{
|
||||
// store
|
||||
_alignment = alignment;
|
||||
|
||||
// reset the string
|
||||
resetCurrentString();
|
||||
|
||||
// need to align text again
|
||||
alignText();
|
||||
}
|
||||
}
|
||||
|
||||
void StringTTF::setWidth(float width)
|
||||
{
|
||||
if (width != _width)
|
||||
{
|
||||
// store
|
||||
_width = width;
|
||||
|
||||
// need to align text again
|
||||
alignText();
|
||||
}
|
||||
}
|
||||
|
||||
void StringTTF::setLineBreakWithoutSpace(bool breakWithoutSpace)
|
||||
{
|
||||
if (breakWithoutSpace != _lineBreakWithoutSpaces)
|
||||
{
|
||||
// store
|
||||
_lineBreakWithoutSpaces = breakWithoutSpace;
|
||||
|
||||
// need to align text again
|
||||
alignText();
|
||||
}
|
||||
}
|
||||
|
||||
void StringTTF::setScale(float scale)
|
||||
{
|
||||
Node::setScale(scale);
|
||||
alignText();
|
||||
}
|
||||
|
||||
void StringTTF::setScaleX(float scaleX)
|
||||
{
|
||||
Node::setScaleX(scaleX);
|
||||
alignText();
|
||||
}
|
||||
|
||||
void StringTTF::setScaleY(float scaleY)
|
||||
{
|
||||
Node::setScaleY(scaleY);
|
||||
alignText();
|
||||
}
|
||||
|
||||
void StringTTF::alignText()
|
||||
{
|
||||
hideAllLetters();
|
||||
LabelTextFormatter::createStringSprites(this);
|
||||
|
||||
if( LabelTextFormatter::multilineText(this) )
|
||||
{
|
||||
hideAllLetters();
|
||||
LabelTextFormatter::createStringSprites(this);
|
||||
}
|
||||
|
||||
LabelTextFormatter::alignText(this);
|
||||
}
|
||||
|
||||
void StringTTF::hideAllLetters()
|
||||
{
|
||||
Object* Obj = NULL;
|
||||
CCARRAY_FOREACH(&_spriteArray, Obj)
|
||||
{
|
||||
((Sprite *)Obj)->setVisible(false);
|
||||
}
|
||||
|
||||
CCARRAY_FOREACH(&_spriteArrayCache, Obj)
|
||||
{
|
||||
((Sprite *)Obj)->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool StringTTF::computeAdvancesForString(unsigned short int *stringToRender)
|
||||
{
|
||||
if (_advances)
|
||||
{
|
||||
delete [] _advances;
|
||||
_advances = 0;
|
||||
}
|
||||
|
||||
Font &theFont = _fontAtlas->getFont();
|
||||
|
||||
int letterCount = 0;
|
||||
_advances = theFont.getAdvancesForTextUTF16(stringToRender, letterCount);
|
||||
|
||||
if(!_advances)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StringTTF::setOriginalString(unsigned short *stringToSet)
|
||||
{
|
||||
if (_originalUTF8String)
|
||||
{
|
||||
delete [] _originalUTF8String;
|
||||
_originalUTF8String = 0;
|
||||
}
|
||||
|
||||
int newStringLenght = cc_wcslen(stringToSet);
|
||||
_originalUTF8String = new unsigned short int [newStringLenght + 1];
|
||||
memset(_originalUTF8String, 0, (newStringLenght + 1) * 2);
|
||||
memcpy(_originalUTF8String, stringToSet, (newStringLenght * 2));
|
||||
_originalUTF8String[newStringLenght] = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StringTTF::setCurrentString(unsigned short *stringToSet)
|
||||
{
|
||||
// set the new string
|
||||
if (_currentUTF8String)
|
||||
{
|
||||
delete [] _currentUTF8String;
|
||||
_currentUTF8String = 0;
|
||||
}
|
||||
//
|
||||
_currentUTF8String = stringToSet;
|
||||
// compute the advances
|
||||
return computeAdvancesForString(stringToSet);
|
||||
}
|
||||
|
||||
void StringTTF::resetCurrentString()
|
||||
{
|
||||
// set the new string
|
||||
if (_currentUTF8String)
|
||||
{
|
||||
delete [] _currentUTF8String;
|
||||
_currentUTF8String = 0;
|
||||
}
|
||||
|
||||
int stringLenght = cc_wcslen(_originalUTF8String);
|
||||
_currentUTF8String = new unsigned short int [stringLenght + 1];
|
||||
memcpy(_currentUTF8String, _originalUTF8String, stringLenght * 2);
|
||||
_currentUTF8String[stringLenght] = 0;
|
||||
|
||||
}
|
||||
|
||||
Sprite * StringTTF::createNewSpriteFromLetterDefinition(FontLetterDefinition &theDefinition, Texture2D *theTexture)
|
||||
{
|
||||
Rect uvRect;
|
||||
uvRect.size.height = theDefinition.height;
|
||||
uvRect.size.width = theDefinition.width;
|
||||
uvRect.origin.x = theDefinition.U;
|
||||
uvRect.origin.y = theDefinition.V;
|
||||
|
||||
SpriteFrame *pFrame = SpriteFrame::createWithTexture(theTexture, uvRect);
|
||||
Sprite *tempSprite = getSprite();
|
||||
|
||||
if (!tempSprite)
|
||||
return nullptr;
|
||||
|
||||
tempSprite->initWithSpriteFrame(pFrame);
|
||||
tempSprite->setAnchorPoint(Point(theDefinition.anchorX, theDefinition.anchorY));
|
||||
tempSprite->setBatchNode(this);
|
||||
|
||||
return tempSprite;
|
||||
}
|
||||
|
||||
Sprite * StringTTF::updateSpriteWithLetterDefinition(Sprite *spriteToUpdate, FontLetterDefinition &theDefinition, Texture2D *theTexture)
|
||||
{
|
||||
if (!spriteToUpdate)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
Rect uvRect;
|
||||
uvRect.size.height = theDefinition.height;
|
||||
uvRect.size.width = theDefinition.width;
|
||||
uvRect.origin.x = theDefinition.U;
|
||||
uvRect.origin.y = theDefinition.V;
|
||||
|
||||
SpriteFrame *frame = SpriteFrame::createWithTexture(theTexture, uvRect);
|
||||
if (frame)
|
||||
{
|
||||
spriteToUpdate->setTexture(theTexture);
|
||||
spriteToUpdate->setDisplayFrame(frame);
|
||||
spriteToUpdate->setAnchorPoint(Point(theDefinition.anchorX, theDefinition.anchorY));
|
||||
spriteToUpdate->setBatchNode(this);
|
||||
}
|
||||
|
||||
return spriteToUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
Sprite * StringTTF::getSpriteForLetter(unsigned short int newLetter)
|
||||
{
|
||||
if (!_fontAtlas)
|
||||
return nullptr;
|
||||
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(newLetter, tempDefinition);
|
||||
if (validDefinition)
|
||||
{
|
||||
Sprite *newSprite = createNewSpriteFromLetterDefinition(tempDefinition, &_fontAtlas->getTexture(tempDefinition.textureID) );
|
||||
this->addChild(newSprite);
|
||||
return newSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Sprite * StringTTF::updateSpriteForLetter(Sprite *spriteToUpdate, unsigned short int newLetter)
|
||||
{
|
||||
if (!spriteToUpdate || !_fontAtlas)
|
||||
return nullptr;
|
||||
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(newLetter, tempDefinition);
|
||||
if (validDefinition)
|
||||
{
|
||||
Sprite *pNewSprite = updateSpriteWithLetterDefinition(spriteToUpdate, tempDefinition, &_fontAtlas->getTexture(tempDefinition.textureID) );
|
||||
return pNewSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void StringTTF::moveAllSpritesToCache()
|
||||
{
|
||||
Object* pObj = NULL;
|
||||
CCARRAY_FOREACH(&_spriteArray, pObj)
|
||||
{
|
||||
((Sprite *)pObj)->removeFromParent();
|
||||
_spriteArrayCache.addObject(pObj);
|
||||
}
|
||||
|
||||
_spriteArray.removeAllObjects();
|
||||
}
|
||||
|
||||
Sprite * StringTTF::getSprite()
|
||||
{
|
||||
if (_spriteArrayCache.count())
|
||||
{
|
||||
Sprite *retSprite = (Sprite *) _spriteArrayCache.lastObject();
|
||||
_spriteArrayCache.removeLastObject();
|
||||
return retSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
Sprite *retSprite = new Sprite;
|
||||
return retSprite;
|
||||
}
|
||||
}
|
||||
|
||||
///// PROTOCOL STUFF
|
||||
|
||||
Sprite * StringTTF::getSpriteChild(int ID)
|
||||
{
|
||||
Object* pObj = NULL;
|
||||
CCARRAY_FOREACH(&_spriteArray, pObj)
|
||||
{
|
||||
Sprite *pSprite = (Sprite *)pObj;
|
||||
if ( pSprite->getTag() == ID)
|
||||
{
|
||||
return pSprite;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Array * StringTTF::getChildrenLetters()
|
||||
{
|
||||
return &_spriteArray;
|
||||
}
|
||||
|
||||
Sprite * StringTTF::getSpriteForChar(unsigned short int theChar, int spriteIndexHint)
|
||||
{
|
||||
// ret sprite
|
||||
Sprite *retSprite = 0;
|
||||
|
||||
// look for already existing sprites
|
||||
retSprite = getSpriteChild(spriteIndexHint);
|
||||
|
||||
if (!retSprite)
|
||||
{
|
||||
retSprite = getSpriteForLetter(theChar);
|
||||
if (!retSprite)
|
||||
return nullptr;
|
||||
|
||||
if (retSprite)
|
||||
retSprite->setTag(spriteIndexHint);
|
||||
|
||||
_spriteArray.addObject(retSprite);
|
||||
}
|
||||
|
||||
// the sprite is now visible
|
||||
retSprite->setVisible(true);
|
||||
|
||||
// set the right texture letter to the sprite
|
||||
updateSpriteForLetter(retSprite, theChar);
|
||||
|
||||
// we are done here
|
||||
return retSprite;
|
||||
}
|
||||
|
||||
float StringTTF::getLetterPosXLeft( Sprite* sp )
|
||||
{
|
||||
float scaleX = _scaleX;
|
||||
return sp->getPosition().x * scaleX - (sp->getContentSize().width * scaleX * sp->getAnchorPoint().x);
|
||||
}
|
||||
|
||||
float StringTTF::getLetterPosXRight( Sprite* sp )
|
||||
{
|
||||
float scaleX = _scaleX;
|
||||
return sp->getPosition().x * scaleX + (sp->getContentSize().width * scaleX * sp->getAnchorPoint().x);
|
||||
}
|
||||
|
||||
int StringTTF::getCommonLineHeight()
|
||||
{
|
||||
return _commonLineHeight;
|
||||
}
|
||||
|
||||
int StringTTF::getKerningForCharsPair(unsigned short first, unsigned short second)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int StringTTF::getXOffsetForChar(unsigned short c)
|
||||
{
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(c, tempDefinition);
|
||||
if (!validDefinition)
|
||||
return -1;
|
||||
|
||||
return (tempDefinition.offsetX);
|
||||
}
|
||||
|
||||
int StringTTF::getYOffsetForChar(unsigned short c)
|
||||
{
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(c, tempDefinition);
|
||||
if (!validDefinition)
|
||||
return -1;
|
||||
|
||||
return (tempDefinition.offsetY);
|
||||
}
|
||||
|
||||
int StringTTF::getAdvanceForChar(unsigned short c, int hintPositionInString)
|
||||
{
|
||||
if (_advances)
|
||||
{
|
||||
// not that advance contains the X offset already
|
||||
FontLetterDefinition tempDefinition;
|
||||
bool validDefinition = _fontAtlas->getLetterDefinitionForChar(c, tempDefinition);
|
||||
if (!validDefinition)
|
||||
return -1;
|
||||
|
||||
return (_advances[hintPositionInString].width - tempDefinition.offsetX);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Rect StringTTF::getRectForChar(unsigned short c)
|
||||
{
|
||||
return _fontAtlas->getFont().getRectForChar(c);
|
||||
}
|
||||
|
||||
// string related stuff
|
||||
int StringTTF::getStringNumLines()
|
||||
{
|
||||
int quantityOfLines = 1;
|
||||
|
||||
unsigned int stringLen = _currentUTF8String ? cc_wcslen(_currentUTF8String) : 0;
|
||||
if (stringLen == 0)
|
||||
return (-1);
|
||||
|
||||
// count number of lines
|
||||
for (unsigned int i = 0; i < stringLen - 1; ++i)
|
||||
{
|
||||
unsigned short c = _currentUTF8String[i];
|
||||
if (c == '\n')
|
||||
{
|
||||
quantityOfLines++;
|
||||
}
|
||||
}
|
||||
|
||||
return quantityOfLines;
|
||||
}
|
||||
|
||||
int StringTTF::getStringLenght()
|
||||
{
|
||||
return _currentUTF8String ? cc_wcslen(_currentUTF8String) : 0;
|
||||
}
|
||||
|
||||
unsigned short StringTTF::getCharAtStringPosition(int position)
|
||||
{
|
||||
return _currentUTF8String[position];
|
||||
}
|
||||
|
||||
unsigned short * StringTTF::getUTF8String()
|
||||
{
|
||||
return _currentUTF8String;
|
||||
}
|
||||
|
||||
void StringTTF::assignNewUTF8String(unsigned short *newString)
|
||||
{
|
||||
setCurrentString(newString);
|
||||
}
|
||||
|
||||
TextHAlignment StringTTF::getTextAlignment()
|
||||
{
|
||||
return _alignment;
|
||||
}
|
||||
|
||||
// label related stuff
|
||||
float StringTTF::getMaxLineWidth()
|
||||
{
|
||||
return _width;
|
||||
}
|
||||
|
||||
bool StringTTF::breakLineWithoutSpace()
|
||||
{
|
||||
return _lineBreakWithoutSpaces;
|
||||
}
|
||||
|
||||
Size StringTTF::getLabelContentSize()
|
||||
{
|
||||
return getContentSize();
|
||||
}
|
||||
|
||||
void StringTTF::setLabelContentSize(const Size &newSize)
|
||||
{
|
||||
setContentSize(newSize);
|
||||
}
|
||||
|
||||
|
||||
// RGBA protocol
|
||||
|
||||
|
||||
bool StringTTF::isOpacityModifyRGB() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void StringTTF::setOpacityModifyRGB(bool isOpacityModifyRGB)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned char StringTTF::getOpacity() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char StringTTF::getDisplayedOpacity() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void StringTTF::setOpacity(GLubyte opacity)
|
||||
{
|
||||
}
|
||||
void StringTTF::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
{
|
||||
}
|
||||
|
||||
bool StringTTF::isCascadeOpacityEnabled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void StringTTF::setCascadeOpacityEnabled(bool cascadeOpacityEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
const Color3B& StringTTF::getColor(void) const
|
||||
{
|
||||
return _realColor;
|
||||
}
|
||||
|
||||
const Color3B& StringTTF::getDisplayedColor() const
|
||||
{
|
||||
return _displayedColor;
|
||||
}
|
||||
|
||||
void StringTTF::setColor(const Color3B& color)
|
||||
{
|
||||
_displayedColor = _realColor = color;
|
||||
|
||||
if( _cascadeColorEnabled )
|
||||
{
|
||||
Color3B parentColor = Color3B::WHITE;
|
||||
RGBAProtocol* pParent = dynamic_cast<RGBAProtocol*>(_parent);
|
||||
|
||||
if (pParent && pParent->isCascadeColorEnabled())
|
||||
parentColor = pParent->getDisplayedColor();
|
||||
|
||||
updateDisplayedColor(parentColor);
|
||||
}
|
||||
}
|
||||
|
||||
void StringTTF::updateDisplayedColor(const Color3B& parentColor)
|
||||
{
|
||||
_displayedColor.r = _realColor.r * parentColor.r/255.0;
|
||||
_displayedColor.g = _realColor.g * parentColor.g/255.0;
|
||||
_displayedColor.b = _realColor.b * parentColor.b/255.0;
|
||||
|
||||
Object* pObj;
|
||||
CCARRAY_FOREACH(_children, pObj)
|
||||
{
|
||||
Sprite *item = static_cast<Sprite*>( pObj );
|
||||
item->updateDisplayedColor(_displayedColor);
|
||||
}
|
||||
}
|
||||
|
||||
bool StringTTF::isCascadeColorEnabled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void StringTTF::setCascadeColorEnabled(bool cascadeColorEnabled)
|
||||
{
|
||||
_cascadeColorEnabled = cascadeColorEnabled;
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -1,146 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _StringTTF_h
|
||||
#define _StringTTF_h
|
||||
|
||||
#include "CCFontDefinition.h"
|
||||
#include "CCLabelTextFormatProtocol.h"
|
||||
#include "CCLabel.h"
|
||||
#include "CCFontAtlas.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL StringTTF : public Label, public LabelTextFormatProtocol
|
||||
{
|
||||
public:
|
||||
|
||||
static StringTTF* create(FontAtlas *pAtlas, TextHAlignment alignment = TextHAlignment::LEFT, int lineSize = 0);
|
||||
|
||||
// main interface
|
||||
bool setText(const char *stringToRender, float lineWidth, TextHAlignment alignment = TextHAlignment::LEFT, bool lineBreakWithoutSpaces = false);
|
||||
void setString(const char *stringToRender);
|
||||
const char* getString() const { return "not implemented"; }
|
||||
|
||||
virtual void setAlignment(TextHAlignment alignment);
|
||||
virtual void setWidth(float width);
|
||||
virtual void setLineBreakWithoutSpace(bool breakWithoutSpace);
|
||||
virtual void setScale(float scale);
|
||||
virtual void setScaleX(float scaleX);
|
||||
virtual void setScaleY(float scaleY);
|
||||
|
||||
|
||||
// RGBAProtocol
|
||||
virtual bool isOpacityModifyRGB() const;
|
||||
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB);
|
||||
virtual unsigned char getOpacity() const;
|
||||
virtual unsigned char getDisplayedOpacity() const;
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual void updateDisplayedOpacity(GLubyte parentOpacity);
|
||||
virtual bool isCascadeOpacityEnabled() const;
|
||||
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled);
|
||||
virtual const Color3B& getColor(void) const;
|
||||
virtual const Color3B& getDisplayedColor() const;
|
||||
virtual void setColor(const Color3B& color);
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor);
|
||||
virtual bool isCascadeColorEnabled() const;
|
||||
virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
|
||||
|
||||
|
||||
// CCLabelTextFormat protocol implementation
|
||||
|
||||
// sprite related stuff
|
||||
virtual Sprite * getSpriteChild(int ID);
|
||||
virtual Array * getChildrenLetters();
|
||||
virtual Sprite * getSpriteForChar(unsigned short int theChar, int spriteIndexHint);
|
||||
virtual float getLetterPosXLeft( Sprite* sp );
|
||||
virtual float getLetterPosXRight( Sprite* sp );
|
||||
|
||||
// font related stuff
|
||||
virtual int getCommonLineHeight();
|
||||
virtual int getKerningForCharsPair(unsigned short first, unsigned short second);
|
||||
virtual int getXOffsetForChar(unsigned short c);
|
||||
virtual int getYOffsetForChar(unsigned short c);
|
||||
virtual int getAdvanceForChar(unsigned short c, int hintPositionInString);
|
||||
virtual Rect getRectForChar(unsigned short c) ;
|
||||
|
||||
// string related stuff
|
||||
virtual int getStringNumLines();
|
||||
virtual int getStringLenght();
|
||||
virtual unsigned short getCharAtStringPosition(int position);
|
||||
virtual unsigned short * getUTF8String();
|
||||
virtual void assignNewUTF8String(unsigned short *newString);
|
||||
virtual TextHAlignment getTextAlignment();
|
||||
|
||||
// label related stuff
|
||||
virtual float getMaxLineWidth() ;
|
||||
virtual bool breakLineWithoutSpace();
|
||||
virtual Size getLabelContentSize();
|
||||
virtual void setLabelContentSize(const Size &newSize);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//
|
||||
StringTTF(FontAtlas *pAtlas, TextHAlignment alignment = TextHAlignment::LEFT);
|
||||
~StringTTF();
|
||||
|
||||
bool init();
|
||||
|
||||
void alignText();
|
||||
void hideAllLetters();
|
||||
void moveAllSpritesToCache();
|
||||
|
||||
bool computeAdvancesForString(unsigned short int *stringToRender);
|
||||
bool setCurrentString(unsigned short *stringToSet);
|
||||
bool setOriginalString(unsigned short *stringToSet);
|
||||
void resetCurrentString();
|
||||
|
||||
Sprite * getSprite();
|
||||
Sprite * createNewSpriteFromLetterDefinition(FontLetterDefinition &theDefinition, Texture2D *theTexture);
|
||||
Sprite * updateSpriteWithLetterDefinition(Sprite *spriteToUpdate, FontLetterDefinition &theDefinition, Texture2D *theTexture);
|
||||
Sprite * getSpriteForLetter(unsigned short int newLetter);
|
||||
Sprite * updateSpriteForLetter(Sprite *spriteToUpdate, unsigned short int newLetter);
|
||||
|
||||
Array _spriteArray;
|
||||
Array _spriteArrayCache;
|
||||
float _commonLineHeight;
|
||||
bool _lineBreakWithoutSpaces;
|
||||
float _width;
|
||||
TextHAlignment _alignment;
|
||||
unsigned short int * _currentUTF8String;
|
||||
unsigned short int * _originalUTF8String;
|
||||
Size * _advances;
|
||||
FontAtlas * _fontAtlas;
|
||||
Color3B _displayedColor;
|
||||
Color3B _realColor;
|
||||
bool _cascadeColorEnabled;
|
||||
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
#include "cocos2d.h"
|
||||
#include "CCTextImage.h"
|
||||
#include "CCFontFreeType.h"
|
||||
#include "CCFontRenderFreeType.h"
|
||||
#include "CCFont.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -91,8 +91,6 @@ bool TextPageDef::generatePageTexture(bool releasePageData)
|
|||
int dataLenght = (_width * _height * 4);
|
||||
bool textureCreated = _pageTexture->initWithData(_pageData, dataLenght, Texture2D::PixelFormat::RGBA8888, _width, _height, imageSize);
|
||||
|
||||
// _pageTexture->setPremultipliedAlpha(true);
|
||||
|
||||
// release the page data if requested
|
||||
if ( releasePageData && textureCreated )
|
||||
{
|
||||
|
@ -132,7 +130,7 @@ TextFontPagesDef::~TextFontPagesDef()
|
|||
}
|
||||
}
|
||||
|
||||
TextImage::TextImage(): _font(0), _fontRender(0), _fontPages(0)
|
||||
TextImage::TextImage(): _font(0), _fontPages(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -143,37 +141,38 @@ TextImage::~TextImage()
|
|||
|
||||
if (_font)
|
||||
_font->release();
|
||||
|
||||
if (_fontRender)
|
||||
delete _fontRender;
|
||||
}
|
||||
|
||||
bool TextImage::initWithString(const char * pText, int nWidth, int nHeight, const char * pFontName, int nSize, bool releaseRAWData)
|
||||
bool TextImage::initWithString(const char *text, int nWidth, int nHeight, cocos2d::Font* font, bool releaseRAWData)
|
||||
{
|
||||
// carloX
|
||||
bool textIsUTF16 = false;
|
||||
|
||||
// create the reference to the font we want to use
|
||||
if ( !createFontRef(pFontName, nSize) )
|
||||
return false;
|
||||
if (_font)
|
||||
{
|
||||
_font->release();
|
||||
_font = 0;
|
||||
}
|
||||
|
||||
// carloX
|
||||
_font = font;
|
||||
|
||||
// generate the glyphs for the requested text (glyphs are latter's bounding boxes)
|
||||
if ( !generateTextGlyphs(pText) )
|
||||
if ( !generateTextGlyphs(text) )
|
||||
return false;
|
||||
|
||||
|
||||
Size constrainSize;
|
||||
unsigned short int *strUTF16 = 0;
|
||||
int stringNumChars;
|
||||
|
||||
int stringNumChars;
|
||||
if ( textIsUTF16 )
|
||||
{
|
||||
strUTF16 = (unsigned short int *)pText;
|
||||
strUTF16 = (unsigned short int *)text;
|
||||
stringNumChars = cc_wcslen(strUTF16);
|
||||
}
|
||||
else
|
||||
{
|
||||
// string needs to go to unicode
|
||||
strUTF16 = _font->getUTF16Text(pText, stringNumChars);
|
||||
strUTF16 = _font->getUTF16Text(text, stringNumChars);
|
||||
}
|
||||
|
||||
if (!strUTF16 || !stringNumChars)
|
||||
|
@ -189,6 +188,8 @@ bool TextImage::initWithString(const char * pText, int nWidth, int nHeight, cons
|
|||
|
||||
// actually create the needed images
|
||||
return createImageDataFromPages(_fontPages, releaseRAWData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TextImage::createPageDefinitions(unsigned short int *inText, int imageWidth, int imageHeight, int lineHeight)
|
||||
|
@ -321,48 +322,6 @@ int TextImage::getNumGlyphsFittingInSize(std::map<unsigned short int, GlyphDef>
|
|||
return numChar;
|
||||
}
|
||||
|
||||
bool TextImage::createFontRef(const char *fontName, int fontSize)
|
||||
{
|
||||
if (_font)
|
||||
{
|
||||
_font->release();
|
||||
_font = 0;
|
||||
}
|
||||
|
||||
// carloX
|
||||
_font = new FontFreeType();
|
||||
|
||||
if (!_font)
|
||||
return false;
|
||||
|
||||
_font->retain();
|
||||
|
||||
if( !_font->createFontObject(fontName, fontSize))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TextImage::createFontRender()
|
||||
{
|
||||
if (!_font)
|
||||
return false;
|
||||
|
||||
if (_fontRender)
|
||||
{
|
||||
delete _fontRender;
|
||||
_fontRender = 0;
|
||||
}
|
||||
|
||||
// carloX
|
||||
_fontRender = new FontRenderFreeType(_font);
|
||||
|
||||
if (!_fontRender)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TextImage::addGlyphsToLine(TextLineDef *line, const char *lineText, bool textIsUTF16)
|
||||
{
|
||||
if (!_font)
|
||||
|
@ -445,19 +404,104 @@ bool TextImage::createImageDataFromPages(TextFontPagesDef *thePages, bool releas
|
|||
|
||||
unsigned char * TextImage::preparePageGlyphData(TextPageDef *thePage)
|
||||
{
|
||||
if ( !_fontRender )
|
||||
return renderGlyphData(thePage);
|
||||
}
|
||||
|
||||
unsigned char * TextImage::renderGlyphData(TextPageDef *thePage)
|
||||
{
|
||||
if (!thePage)
|
||||
return 0;
|
||||
|
||||
if (!_font)
|
||||
return 0;
|
||||
|
||||
if (thePage->getNumLines() == 0)
|
||||
return NULL;
|
||||
|
||||
int pageWidth = thePage->getWidth();
|
||||
int pageHeight = thePage->getHeight();
|
||||
|
||||
// prepare memory and clean to 0
|
||||
int sizeInBytes = (pageWidth * pageHeight * 4);
|
||||
unsigned char* data = new unsigned char[sizeInBytes];
|
||||
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
memset(data, 0, sizeInBytes);
|
||||
|
||||
int numLines = thePage->getNumLines();
|
||||
|
||||
for (int c = 0; c<numLines; ++c)
|
||||
{
|
||||
createFontRender();
|
||||
TextLineDef *pCurrentLine = thePage->getLineAt(c);
|
||||
|
||||
float origX = _font->getLetterPadding();
|
||||
float origY = pCurrentLine->getY();
|
||||
|
||||
int numGlyphToRender = pCurrentLine->getNumGlyph();
|
||||
|
||||
for (int cglyph = 0; cglyph < numGlyphToRender; ++cglyph)
|
||||
{
|
||||
GlyphDef currGlyph = pCurrentLine->getGlyphAt(cglyph);
|
||||
renderCharAt(currGlyph.getUTF8Letter(), origX, origY, data, pageWidth);
|
||||
origX += (currGlyph.getRect().size.width + _font->getLetterPadding());
|
||||
}
|
||||
}
|
||||
|
||||
if (_fontRender)
|
||||
#ifdef _DEBUG_FONTS_
|
||||
static int counter = 0;
|
||||
char outFilename[512];
|
||||
sprintf(outFilename,"testIMG%d", counter);
|
||||
++counter;
|
||||
Image *pImage = new Image;
|
||||
pImage->initWithRawData(data, (pageWidth * pageWidth * 4), 1024, 1024, 8, false);
|
||||
pImage->saveToFile(outFilename);
|
||||
#endif
|
||||
|
||||
// we are done here
|
||||
return data;
|
||||
}
|
||||
|
||||
bool TextImage::renderCharAt(unsigned short int charToRender, int posX, int posY, unsigned char *destMemory, int destSize)
|
||||
{
|
||||
if (!_font)
|
||||
return false;
|
||||
|
||||
unsigned char *sourceBitmap = 0;
|
||||
int sourceWidth = 0;
|
||||
int sourceHeight = 0;
|
||||
|
||||
// get the glyph's bitmap
|
||||
sourceBitmap = _font->getGlyphBitmap(charToRender, sourceWidth, sourceHeight);
|
||||
|
||||
if(!sourceBitmap)
|
||||
return false;
|
||||
|
||||
int iX = posX;
|
||||
int iY = posY;
|
||||
|
||||
for (int y = 0; y < sourceHeight; ++y)
|
||||
{
|
||||
return _fontRender->preparePageGlyphData(thePage);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
int bitmap_y = y * sourceWidth;
|
||||
|
||||
for (int x = 0; x < sourceWidth; ++x)
|
||||
{
|
||||
unsigned char cTemp = sourceBitmap[bitmap_y + x];
|
||||
|
||||
// the final pixel
|
||||
int iTemp = cTemp << 24 | cTemp << 16 | cTemp << 8 | cTemp;
|
||||
*(int*) &destMemory[(iX + ( iY * destSize ) ) * 4] = iTemp;
|
||||
|
||||
iX += 1;
|
||||
}
|
||||
|
||||
iX = posX;
|
||||
iY += 1;
|
||||
}
|
||||
|
||||
//everything good
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -25,11 +25,13 @@
|
|||
#ifndef _TextImage_h_
|
||||
#define _TextImage_h_
|
||||
|
||||
#include "CCFontRender.h"
|
||||
#include "CCFont.h"
|
||||
//#include "CCFont.h"
|
||||
#include <vector>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class Font;
|
||||
|
||||
/** @brief GlyphDef defines one single glyph (character) in a text image
|
||||
*
|
||||
* it defines the bounding box for the glyph in the texture page, the character the padding (spacing) between characters
|
||||
|
@ -161,27 +163,27 @@ public:
|
|||
TextImage();
|
||||
~TextImage();
|
||||
|
||||
bool initWithString(const char *pText, int nWidth, int nHeight, const char * pFontName, int nSize, bool releaseRAWData = true);
|
||||
bool initWithString(const char *text, int nWidth, int nHeight, Font* font, bool releaseRAWData = true);
|
||||
|
||||
TextFontPagesDef * getPages() { return _fontPages; }
|
||||
Font * getFont() { return _font; }
|
||||
|
||||
private:
|
||||
|
||||
unsigned char * preparePageGlyphData(TextPageDef *thePage);
|
||||
bool createImageDataFromPages(TextFontPagesDef *thePages, bool releaseRAWData = true);
|
||||
bool createFontRender();
|
||||
bool addGlyphsToLine(TextLineDef *line, const char *lineText, bool textIsUTF16 = false);
|
||||
bool createFontRef(const char *fontName, int size);
|
||||
bool generateTextGlyphs(const char * pText);
|
||||
int getNumGlyphsFittingInSize(std::map<unsigned short int, GlyphDef> &glyphDefs, unsigned short int *strUTF8, Font *pFont, Size *constrainSize, int &outNewSize);
|
||||
bool createPageDefinitions(unsigned short int *inText, int imageWidth, int imageHeight, int lineHeight);
|
||||
unsigned char * preparePageGlyphData(TextPageDef *thePage);
|
||||
|
||||
// glyph rendering
|
||||
unsigned char * renderGlyphData(TextPageDef *thePage);
|
||||
bool renderCharAt(unsigned short int charToRender, int posX, int posY, unsigned char *destMemory, int destSize);
|
||||
|
||||
std::map<unsigned short int, GlyphDef> _textGlyphs;
|
||||
TextFontPagesDef * _fontPages;
|
||||
Font * _font;
|
||||
FontRender * _fontRender;
|
||||
|
||||
|
||||
Font * _font;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -636,7 +636,7 @@ std::string FileUtils::fullPathForFilename(const char* filename)
|
|||
for (auto resOrderIter = _searchResolutionsOrderArray.begin();
|
||||
resOrderIter != _searchResolutionsOrderArray.end(); ++resOrderIter) {
|
||||
|
||||
// CCLOG("\n\nSEARCHING: %s, %s, %s", newFilename.c_str(), resOrderIter->c_str(), searchPathsIter->c_str());
|
||||
// CCLOG("SEARCHING: %s\n", std::string(*searchPathsIter + *resOrderIter + newFilename).c_str() );
|
||||
|
||||
fullpath = this->getPathForFilename(newFilename, *resOrderIter, *searchPathsIter);
|
||||
|
||||
|
@ -644,7 +644,7 @@ std::string FileUtils::fullPathForFilename(const char* filename)
|
|||
{
|
||||
// Using the filename passed in as key.
|
||||
_fullPathCache.insert(std::pair<std::string, std::string>(filename, fullpath));
|
||||
// CCLOG("Returning path: %s", fullpath.c_str());
|
||||
// CCLOG("Returning path: %s\n", fullpath.c_str());
|
||||
return fullpath;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,442 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#define __CC_PLATFORM_IMAGE_CPP__
|
||||
#include "platform/CCImageCommon_cpp.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include "platform/CCImage.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "platform/CCCommon.h"
|
||||
#include "CCStdC.h"
|
||||
#include "ft2build.h"
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#define szFont_kenning 2
|
||||
|
||||
#define SHIFT6(num) (num>>6)
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct TextLine {
|
||||
int iLineWidth;
|
||||
wchar_t* text;
|
||||
};
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class BitmapDC
|
||||
{
|
||||
public:
|
||||
BitmapDC()
|
||||
{
|
||||
libError = FT_Init_FreeType( &library );
|
||||
iInterval = szFont_kenning;
|
||||
_data = NULL;
|
||||
reset();
|
||||
}
|
||||
|
||||
~BitmapDC(void)
|
||||
{
|
||||
FT_Done_FreeType(library);
|
||||
}
|
||||
|
||||
void reset() {
|
||||
iMaxLineWidth = 0;
|
||||
iMaxLineHeight = 0;
|
||||
size_t size = vLines.size();
|
||||
for (int i=0; i<size; ++i) {
|
||||
TextLine line = vLines[i];
|
||||
free(line.text);
|
||||
}
|
||||
vLines.clear();
|
||||
}
|
||||
|
||||
|
||||
int utf8(char **p)
|
||||
{
|
||||
if ((**p & 0x80) == 0x00)
|
||||
{
|
||||
int a = *((*p)++);
|
||||
|
||||
return a;
|
||||
}
|
||||
if ((**p & 0xE0) == 0xC0)
|
||||
{
|
||||
int a = *((*p)++) & 0x1F;
|
||||
int b = *((*p)++) & 0x3F;
|
||||
|
||||
return (a << 6) | b;
|
||||
}
|
||||
if ((**p & 0xF0) == 0xE0)
|
||||
{
|
||||
int a = *((*p)++) & 0x0F;
|
||||
int b = *((*p)++) & 0x3F;
|
||||
int c = *((*p)++) & 0x3F;
|
||||
|
||||
return (a << 12) | (b << 6) | c;
|
||||
}
|
||||
if ((**p & 0xF8) == 0xF0)
|
||||
{
|
||||
int a = *((*p)++) & 0x07;
|
||||
int b = *((*p)++) & 0x3F;
|
||||
int c = *((*p)++) & 0x3F;
|
||||
int d = *((*p)++) & 0x3F;
|
||||
|
||||
return (a << 18) | (b << 12) | (c << 8) | d;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void buildLine(wchar_t* buf, size_t buf_len, FT_Face face, int iCurXCursor, FT_UInt cLastChar) {
|
||||
TextLine oTempLine;
|
||||
wchar_t* text = (wchar_t*)malloc(sizeof(wchar_t) * (buf_len+1));
|
||||
memcpy(text, buf, sizeof(wchar_t) * buf_len);
|
||||
text[buf_len] = '\0';
|
||||
oTempLine.text = text;
|
||||
|
||||
//get last glyph
|
||||
int iError = FT_Load_Char(face, cLastChar, FT_LOAD_DEFAULT);
|
||||
|
||||
oTempLine.iLineWidth = iCurXCursor - SHIFT6((face->glyph->metrics.horiAdvance - face->glyph->metrics.horiBearingX - face->glyph->metrics.width))/*-iInterval*/;//TODO interval
|
||||
iMaxLineWidth = MAX(iMaxLineWidth, oTempLine.iLineWidth);
|
||||
|
||||
vLines.push_back(oTempLine);
|
||||
}
|
||||
|
||||
bool divideString(FT_Face face, const char* sText, int iMaxWidth, int iMaxHeight) {
|
||||
int iError = 0;
|
||||
int iCurXCursor, iCurYCursor;
|
||||
const char* pText = sText;
|
||||
|
||||
FT_UInt unicode = utf8((char**)&pText);
|
||||
iError = FT_Load_Char(face, unicode, FT_LOAD_DEFAULT);
|
||||
if (iError) {
|
||||
return false;
|
||||
}
|
||||
iCurXCursor = -SHIFT6(face->glyph->metrics.horiBearingX);
|
||||
|
||||
FT_UInt cLastCh = 0;
|
||||
|
||||
pText = sText;
|
||||
size_t text_len = 0;
|
||||
wchar_t* text_buf = (wchar_t*) malloc(sizeof(wchar_t) * strlen(sText));
|
||||
while (unicode=utf8((char**)&pText)) {
|
||||
if (unicode == '\n') {
|
||||
buildLine(text_buf, text_len, face, iCurXCursor, cLastCh);
|
||||
text_len = 0;
|
||||
|
||||
iError = FT_Load_Char(face, unicode, FT_LOAD_DEFAULT);
|
||||
if (iError) {
|
||||
free(text_buf);
|
||||
return false;
|
||||
}
|
||||
iCurXCursor = -SHIFT6(face->glyph->metrics.horiBearingX);
|
||||
continue;
|
||||
}
|
||||
|
||||
iError = FT_Load_Char(face, unicode, FT_LOAD_DEFAULT);
|
||||
|
||||
if (iError) {
|
||||
free(text_buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
//check its width
|
||||
//divide it when exceeding
|
||||
if ((iMaxWidth > 0
|
||||
&& iCurXCursor + SHIFT6(face->glyph->metrics.width)
|
||||
> iMaxWidth)) {
|
||||
buildLine(text_buf, text_len, face , iCurXCursor, cLastCh);
|
||||
text_len = 0;
|
||||
|
||||
iCurXCursor = -SHIFT6(face->glyph->metrics.horiBearingX);
|
||||
}
|
||||
|
||||
cLastCh = unicode;
|
||||
text_buf[text_len] = unicode;
|
||||
++text_len;
|
||||
iCurXCursor += SHIFT6(face->glyph->metrics.horiAdvance) + iInterval;
|
||||
}
|
||||
|
||||
if (iError) {
|
||||
free(text_buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
buildLine(text_buf, text_len, face, iCurXCursor, cLastCh);
|
||||
free(text_buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* compute the start pos of every line
|
||||
*
|
||||
* return >0 represent the start x pos of the line
|
||||
* while -1 means fail
|
||||
*
|
||||
*/
|
||||
int computeLineStart(FT_Face face, Image::TextAlign eAlignMask, char cText,
|
||||
int iLineIndex) {
|
||||
int iRet;
|
||||
int iError = FT_Load_Glyph(face, FT_Get_Char_Index(face, cText),
|
||||
FT_LOAD_DEFAULT);
|
||||
if (iError) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (eAlignMask == Image::kAlignCenter) {
|
||||
iRet = (iMaxLineWidth - vLines[iLineIndex].iLineWidth) / 2
|
||||
- SHIFT6(face->glyph->metrics.horiBearingX );
|
||||
|
||||
} else if (eAlignMask == Image::kAlignRight) {
|
||||
iRet = (iMaxLineWidth - vLines[iLineIndex].iLineWidth)
|
||||
- SHIFT6(face->glyph->metrics.horiBearingX );
|
||||
} else {
|
||||
// left or other situation
|
||||
iRet = -SHIFT6(face->glyph->metrics.horiBearingX );
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
int computeLineStartY( FT_Face face, Image::TextAlign eAlignMask, int txtHeight, int borderHeight ){
|
||||
int iRet;
|
||||
if (eAlignMask == Image::kAlignCenter || eAlignMask == Image::kAlignLeft ||
|
||||
eAlignMask == Image::kAlignRight ) {
|
||||
//vertical center
|
||||
iRet = (borderHeight - txtHeight)/2 + SHIFT6(face->size->metrics.ascender);
|
||||
|
||||
} else if (eAlignMask == Image::kAlignBottomRight ||
|
||||
eAlignMask == Image::kAlignBottom ||
|
||||
eAlignMask == Image::kAlignBottomLeft ) {
|
||||
//vertical bottom
|
||||
iRet = borderHeight - txtHeight + SHIFT6(face->size->metrics.ascender);
|
||||
} else {
|
||||
// left or other situation
|
||||
iRet = SHIFT6(face->size->metrics.ascender);
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
bool getBitmap(const char *text, int nWidth, int nHeight, Image::TextAlign eAlignMask, const char * pFontName, float fontSize) {
|
||||
FT_Face face;
|
||||
FT_Error iError;
|
||||
|
||||
const char* pText = text;
|
||||
//data will be deleted by Image
|
||||
// if (_data) {
|
||||
// delete _data;
|
||||
// }
|
||||
|
||||
int iCurXCursor, iCurYCursor;
|
||||
bool bRet = false;
|
||||
if (libError) {
|
||||
return false;
|
||||
}
|
||||
do {
|
||||
//CCLog(" ---- FT_New_Face with pFontName = %s", pFontName);
|
||||
iError = FT_New_Face( library, pFontName, 0, &face );
|
||||
|
||||
if (iError) {
|
||||
//no valid font found use default
|
||||
//CCLog(" ---- no valid font, use default %s", pFontName);
|
||||
iError = FT_New_Face( library, "/usr/fonts/font_repository/monotype/arial.ttf", 0, &face );
|
||||
}
|
||||
CC_BREAK_IF(iError);
|
||||
|
||||
//select utf8 charmap
|
||||
iError = FT_Select_Charmap(face,FT_ENCODING_UNICODE);
|
||||
CC_BREAK_IF(iError);
|
||||
|
||||
iError = FT_Set_Pixel_Sizes(face, fontSize,fontSize);
|
||||
CC_BREAK_IF(iError);
|
||||
|
||||
iError = divideString(face, text, nWidth, nHeight)?0:1;
|
||||
|
||||
//compute the final line width
|
||||
iMaxLineWidth = MAX(iMaxLineWidth, nWidth);
|
||||
|
||||
iMaxLineHeight = (face->size->metrics.ascender >> 6)
|
||||
- (face->size->metrics.descender >> 6);
|
||||
iMaxLineHeight *= vLines.size();
|
||||
|
||||
int txtHeight = iMaxLineHeight;
|
||||
|
||||
//compute the final line height
|
||||
iMaxLineHeight = MAX(iMaxLineHeight, nHeight);
|
||||
_data = new unsigned char[iMaxLineWidth * iMaxLineHeight*4];
|
||||
// iCurYCursor = SHIFT6(face->size->metrics.ascender);
|
||||
iCurYCursor = computeLineStartY( face, eAlignMask, txtHeight, iMaxLineHeight );
|
||||
|
||||
memset(_data,0, iMaxLineWidth * iMaxLineHeight*4);
|
||||
|
||||
size_t lines = vLines.size();
|
||||
for (size_t i = 0; i < lines; i++) {
|
||||
const wchar_t* text_ptr = vLines[i].text;
|
||||
|
||||
//initialize the origin cursor
|
||||
iCurXCursor = computeLineStart(face, eAlignMask, text_ptr[0], i);
|
||||
|
||||
size_t text_len = wcslen(text_ptr);
|
||||
for (size_t i=0; i<text_len; ++i) {
|
||||
int iError = FT_Load_Char(face, text_ptr[i], FT_LOAD_RENDER);
|
||||
if (iError) {
|
||||
break;
|
||||
}
|
||||
|
||||
// convert glyph to bitmap with 256 gray
|
||||
// and get the bitmap
|
||||
FT_Bitmap& bitmap = face->glyph->bitmap;
|
||||
|
||||
int yoffset = iCurYCursor - (face->glyph->metrics.horiBearingY >> 6);
|
||||
int xoffset = iCurXCursor + (face->glyph->metrics.horiBearingX >> 6);
|
||||
for (int i = 0; i < bitmap.rows; ++i) {
|
||||
for (int j = 0; j < bitmap.width; ++j) {
|
||||
unsigned char cTemp = bitmap.buffer[i * bitmap.width + j];
|
||||
if (cTemp == 0) continue;
|
||||
|
||||
// if it has gray>0 we set show it as 1, o otherwise
|
||||
int iY = yoffset + i;
|
||||
int iX = xoffset + j;
|
||||
|
||||
if (iY>=iMaxLineHeight) {
|
||||
//exceed the height truncate
|
||||
continue;
|
||||
}
|
||||
|
||||
// _data[(iY * iMaxLineWidth + iX) * 4 + 3] =
|
||||
// bitmap.buffer[i * bitmap.width + j] ?
|
||||
// 0xff : 0;//alpha
|
||||
// _data[(iY * iMaxLineWidth + iX) * 4 + 1] =
|
||||
// bitmap.buffer[i * bitmap.width + j];//R
|
||||
// _data[(iY * iMaxLineWidth + iX) * 4 + 2] =
|
||||
// bitmap.buffer[i * bitmap.width + j];//G
|
||||
// _data[(iY * iMaxLineWidth + iX) * 4 + 0] =
|
||||
// bitmap.buffer[i * bitmap.width + j];//B
|
||||
|
||||
int iTemp = cTemp << 24 | cTemp << 16 | cTemp << 8 | cTemp;
|
||||
*(int*) &_data[(iY * iMaxLineWidth + iX) * 4 + 0] = iTemp;
|
||||
}
|
||||
}
|
||||
//step to next glyph
|
||||
iCurXCursor += (face->glyph->metrics.horiAdvance >> 6)
|
||||
+ iInterval;
|
||||
|
||||
pText++;
|
||||
}
|
||||
iCurYCursor += (face->size->metrics.ascender >> 6)
|
||||
- (face->size->metrics.descender >> 6);
|
||||
}
|
||||
//print all image bitmap
|
||||
// for (int i = 0; i < iMaxLineHeight; i++) {
|
||||
// for (int j = 0; j < iMaxLineWidth; j++) {
|
||||
// printf("%d",
|
||||
// _data[(i * iMaxLineWidth + j) * 4] ? 1 : 0);
|
||||
// }
|
||||
// printf("\n");
|
||||
// }
|
||||
|
||||
// free face
|
||||
FT_Done_Face(face);
|
||||
face = NULL;
|
||||
|
||||
//clear all lines
|
||||
vLines.clear();
|
||||
|
||||
//success;
|
||||
if (iError) {
|
||||
bRet = false;
|
||||
} else
|
||||
bRet = true;
|
||||
}while(0);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public:
|
||||
FT_Library library;
|
||||
unsigned char *_data;
|
||||
int libError;
|
||||
vector<TextLine> vLines;
|
||||
int iInterval;
|
||||
int iMaxLineWidth;
|
||||
int iMaxLineHeight;
|
||||
};
|
||||
|
||||
static BitmapDC& sharedBitmapDC()
|
||||
{
|
||||
static BitmapDC s_BmpDC;
|
||||
return s_BmpDC;
|
||||
}
|
||||
|
||||
bool Image::initWithString(
|
||||
const char * pText,
|
||||
int nWidth/* = 0*/,
|
||||
int nHeight/* = 0*/,
|
||||
TextAlign eAlignMask/* = kAlignCenter*/,
|
||||
const char * pFontName/* = nil*/,
|
||||
int nSize/* = 0*/)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
CC_BREAK_IF(! pText);
|
||||
BitmapDC &dc = sharedBitmapDC();
|
||||
|
||||
std::string fullFontName = pFontName;
|
||||
std::string lowerCasePath = fullFontName;
|
||||
std::transform(lowerCasePath.begin(), lowerCasePath.end(), lowerCasePath.begin(), ::tolower);
|
||||
|
||||
if ( lowerCasePath.find(".ttf") != std::string::npos ) {
|
||||
fullFontName = FileUtils::getInstance()->fullPathForFilename(pFontName);
|
||||
}
|
||||
//CCLog("-----pText=%s and Font File is %s nWidth= %d,nHeight=%d",pText,fullFontName.c_str(),nWidth,nHeight);
|
||||
|
||||
CC_BREAK_IF(! dc.getBitmap(pText, nWidth, nHeight, eAlignMask, fullFontName.c_str(), nSize));
|
||||
//CCLog("---- dc.getBitmap is Succesfull...");
|
||||
|
||||
// assign the dc._data to _data in order to save time
|
||||
_data = dc._data;
|
||||
CC_BREAK_IF(! _data);
|
||||
|
||||
_width = (short)dc.iMaxLineWidth;
|
||||
_height = (short)dc.iMaxLineHeight;
|
||||
_preMulti = true;
|
||||
_renderFormat = Texture2D::PixelFormat::RGBA8888;
|
||||
|
||||
bRet = true;
|
||||
|
||||
dc.reset();
|
||||
|
||||
} while (0);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
@ -52,18 +52,14 @@ SOURCES = ../actions/CCAction.cpp \
|
|||
../label_nodes/CCFontAtlas.cpp \
|
||||
../label_nodes/CCFontAtlasCache.cpp \
|
||||
../label_nodes/CCFontAtlasFactory.cpp \
|
||||
../label_nodes/CCFontCache.cpp \
|
||||
../label_nodes/CCFontDefinition.cpp \
|
||||
../label_nodes/CCFontFNT.cpp \
|
||||
../label_nodes/CCFontFreeType.cpp \
|
||||
../label_nodes/CCFontRenderFreeType.cpp \
|
||||
../label_nodes/CCLabel.cpp \
|
||||
../label_nodes/CCLabelAtlas.cpp \
|
||||
../label_nodes/CCLabelBMFont.cpp \
|
||||
../label_nodes/CCLabelTTF.cpp \
|
||||
../label_nodes/CCLabelTextFormatter.cpp \
|
||||
../label_nodes/CCStringBMFont.cpp \
|
||||
../label_nodes/CCStringTTF.cpp \
|
||||
../label_nodes/CCTextImage.cpp \
|
||||
../layers_scenes_transitions_nodes/CCLayer.cpp \
|
||||
../layers_scenes_transitions_nodes/CCScene.cpp \
|
||||
|
|
|
@ -49,18 +49,14 @@ SOURCES = ../actions/CCAction.cpp \
|
|||
../label_nodes/CCFontAtlas.cpp \
|
||||
../label_nodes/CCFontAtlasCache.cpp \
|
||||
../label_nodes/CCFontAtlasFactory.cpp \
|
||||
../label_nodes/CCFontCache.cpp \
|
||||
../label_nodes/CCFontDefinition.cpp \
|
||||
../label_nodes/CCFontFNT.cpp \
|
||||
../label_nodes/CCFontFreeType.cpp \
|
||||
../label_nodes/CCFontRenderFreeType.cpp \
|
||||
../label_nodes/CCLabel.cpp \
|
||||
../label_nodes/CCLabelAtlas.cpp \
|
||||
../label_nodes/CCLabelBMFont.cpp \
|
||||
../label_nodes/CCLabelTTF.cpp \
|
||||
../label_nodes/CCLabelTextFormatter.cpp \
|
||||
../label_nodes/CCStringBMFont.cpp \
|
||||
../label_nodes/CCStringTTF.cpp \
|
||||
../label_nodes/CCTextImage.cpp \
|
||||
../layers_scenes_transitions_nodes/CCLayer.cpp \
|
||||
../layers_scenes_transitions_nodes/CCScene.cpp \
|
||||
|
|
|
@ -178,18 +178,14 @@ xcopy /Y /Q "$(ProjectDir)..\platform\third_party\win32\libraries\*.*" "$(OutDir
|
|||
<ClCompile Include="..\label_nodes\CCFontAtlas.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCFontAtlasCache.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCFontAtlasFactory.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCFontCache.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCFontDefinition.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCFontFNT.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCFontFreeType.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCFontRenderFreeType.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCLabel.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCLabelAtlas.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCLabelBMFont.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCLabelTextFormatter.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCLabelTTF.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCStringBMFont.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCStringTTF.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCTextImage.cpp" />
|
||||
<ClCompile Include="..\layers_scenes_transitions_nodes\CCLayer.cpp" />
|
||||
<ClCompile Include="..\layers_scenes_transitions_nodes\CCScene.cpp" />
|
||||
|
@ -334,16 +330,12 @@ xcopy /Y /Q "$(ProjectDir)..\platform\third_party\win32\libraries\*.*" "$(OutDir
|
|||
<ClInclude Include="..\label_nodes\CCFontDefinition.h" />
|
||||
<ClInclude Include="..\label_nodes\CCFontFNT.h" />
|
||||
<ClInclude Include="..\label_nodes\CCFontFreeType.h" />
|
||||
<ClInclude Include="..\label_nodes\CCFontRender.h" />
|
||||
<ClInclude Include="..\label_nodes\CCFontRenderFreeType.h" />
|
||||
<ClInclude Include="..\label_nodes\CCLabel.h" />
|
||||
<ClInclude Include="..\label_nodes\CCLabelAtlas.h" />
|
||||
<ClInclude Include="..\label_nodes\CCLabelBMFont.h" />
|
||||
<ClInclude Include="..\label_nodes\CCLabelTextFormatProtocol.h" />
|
||||
<ClInclude Include="..\label_nodes\CCLabelTextFormatter.h" />
|
||||
<ClInclude Include="..\label_nodes\CCLabelTTF.h" />
|
||||
<ClInclude Include="..\label_nodes\CCStringBMFont.h" />
|
||||
<ClInclude Include="..\label_nodes\CCStringTTF.h" />
|
||||
<ClInclude Include="..\label_nodes\CCTextImage.h" />
|
||||
<ClInclude Include="..\layers_scenes_transitions_nodes\CCLayer.h" />
|
||||
<ClInclude Include="..\layers_scenes_transitions_nodes\CCScene.h" />
|
||||
|
|
|
@ -485,9 +485,6 @@
|
|||
<ClCompile Include="..\label_nodes\CCFontAtlasFactory.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\label_nodes\CCFontCache.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\label_nodes\CCFontDefinition.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
|
@ -497,21 +494,12 @@
|
|||
<ClCompile Include="..\label_nodes\CCFontFreeType.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\label_nodes\CCFontRenderFreeType.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\label_nodes\CCLabel.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\label_nodes\CCLabelTextFormatter.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\label_nodes\CCStringBMFont.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\label_nodes\CCStringTTF.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\label_nodes\CCTextImage.cpp">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1018,12 +1006,6 @@
|
|||
<ClInclude Include="..\label_nodes\CCFontFreeType.h">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\label_nodes\CCFontRender.h">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\label_nodes\CCFontRenderFreeType.h">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\label_nodes\CCLabel.h">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1033,12 +1015,6 @@
|
|||
<ClInclude Include="..\label_nodes\CCLabelTextFormatter.h">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\label_nodes\CCStringBMFont.h">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\label_nodes\CCStringTTF.h">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\label_nodes\CCTextImage.h">
|
||||
<Filter>label_nodes</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -142,7 +142,7 @@ void TextureCache::addImageAsync(const char *path, Object *target, SEL_CallFuncO
|
|||
if (_asyncStructQueue == NULL)
|
||||
{
|
||||
_asyncStructQueue = new queue<AsyncStruct*>();
|
||||
_imageInfoQueue = new queue<ImageInfo*>();
|
||||
_imageInfoQueue = new queue<ImageInfo*>();
|
||||
|
||||
// create a new thread to load images
|
||||
_loadingThread = new std::thread(&TextureCache::loadImage, this);
|
||||
|
|
|
@ -42,6 +42,7 @@ bool CCBAnimationManager::init()
|
|||
_documentOutletNodes = new Array();
|
||||
_documentCallbackNames = new Array();
|
||||
_documentCallbackNodes = new Array();
|
||||
_documentCallbackControlEvents = new Array();
|
||||
_keyframeCallbacks = new Array();
|
||||
_keyframeCallFuncs = new Dictionary();
|
||||
|
||||
|
@ -76,6 +77,7 @@ CCBAnimationManager::~CCBAnimationManager()
|
|||
CC_SAFE_RELEASE(_documentOutletNodes);
|
||||
CC_SAFE_RELEASE(_documentCallbackNames);
|
||||
CC_SAFE_RELEASE(_documentCallbackNodes);
|
||||
CC_SAFE_RELEASE(_documentCallbackControlEvents);
|
||||
|
||||
CC_SAFE_RELEASE(_keyframeCallFuncs);
|
||||
CC_SAFE_RELEASE(_keyframeCallbacks);
|
||||
|
@ -130,6 +132,11 @@ void CCBAnimationManager::addDocumentCallbackName(std::string name) {
|
|||
_documentCallbackNames->addObject(tmpName);
|
||||
}
|
||||
|
||||
void CCBAnimationManager::addDocumentCallbackControlEvents(Control::EventType eventType)
|
||||
{
|
||||
_documentCallbackControlEvents->addObject(Integer::create((int)eventType));
|
||||
}
|
||||
|
||||
Array* CCBAnimationManager::getDocumentCallbackNames() {
|
||||
return _documentCallbackNames;
|
||||
}
|
||||
|
@ -138,6 +145,11 @@ Array* CCBAnimationManager::getDocumentCallbackNodes() {
|
|||
return _documentCallbackNodes;
|
||||
}
|
||||
|
||||
Array* CCBAnimationManager::getDocumentCallbackControlEvents()
|
||||
{
|
||||
return _documentCallbackControlEvents;
|
||||
}
|
||||
|
||||
void CCBAnimationManager::addDocumentOutletNode(Node *node) {
|
||||
_documentOutletNodes->addObject(node);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "CCBSequence.h"
|
||||
#include "CCBValue.h"
|
||||
#include "CCBSequenceProperty.h"
|
||||
#include "GUI/CCControlExtension/CCControl.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
|
@ -40,6 +41,8 @@ public:
|
|||
|
||||
void addDocumentCallbackNode(Node *node);
|
||||
void addDocumentCallbackName(std::string name);
|
||||
void addDocumentCallbackControlEvents(Control::EventType eventType);
|
||||
|
||||
void addDocumentOutletNode(Node *node);
|
||||
void addDocumentOutletName(std::string name);
|
||||
|
||||
|
@ -48,6 +51,8 @@ public:
|
|||
std::string getDocumentControllerName();
|
||||
Array* getDocumentCallbackNames();
|
||||
Array* getDocumentCallbackNodes();
|
||||
Array* getDocumentCallbackControlEvents();
|
||||
|
||||
Array* getDocumentOutletNames();
|
||||
Array* getDocumentOutletNodes();
|
||||
std::string getLastCompletedSequenceName();
|
||||
|
@ -121,6 +126,7 @@ private:
|
|||
Array *_documentOutletNodes;
|
||||
Array *_documentCallbackNames;
|
||||
Array *_documentCallbackNodes;
|
||||
Array *_documentCallbackControlEvents;
|
||||
Array *_keyframeCallbacks;
|
||||
Dictionary *_keyframeCallFuncs;
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ CCBReader::CCBReader(NodeLoaderLibrary * pNodeLoaderLibrary, CCBMemberVariableAs
|
|||
, _nodesWithAnimationManagers(NULL)
|
||||
, _animationManagersForNodes(NULL)
|
||||
, _ownerCallbackNodes(NULL)
|
||||
, _hasScriptingOwner(false)
|
||||
{
|
||||
this->_nodeLoaderLibrary = pNodeLoaderLibrary;
|
||||
this->_nodeLoaderLibrary->retain();
|
||||
|
@ -88,7 +87,6 @@ CCBReader::CCBReader(CCBReader * ccbReader)
|
|||
, _nodesWithAnimationManagers(NULL)
|
||||
, _animationManagersForNodes(NULL)
|
||||
, _ownerCallbackNodes(NULL)
|
||||
, _hasScriptingOwner(false)
|
||||
{
|
||||
this->_loadedSpriteSheets = ccbReader->_loadedSpriteSheets;
|
||||
this->_nodeLoaderLibrary = ccbReader->_nodeLoaderLibrary;
|
||||
|
@ -97,13 +95,6 @@ CCBReader::CCBReader(CCBReader * ccbReader)
|
|||
this->_CCBMemberVariableAssigner = ccbReader->_CCBMemberVariableAssigner;
|
||||
this->_CCBSelectorResolver = ccbReader->_CCBSelectorResolver;
|
||||
this->_nodeLoaderListener = ccbReader->_nodeLoaderListener;
|
||||
|
||||
this->_ownerCallbackNames = ccbReader->_ownerCallbackNames;
|
||||
this->_ownerCallbackNodes = ccbReader->_ownerCallbackNodes;
|
||||
this->_ownerCallbackNodes->retain();
|
||||
this->_ownerOutletNames = ccbReader->_ownerOutletNames;
|
||||
this->_ownerOutletNodes = ccbReader->_ownerOutletNodes;
|
||||
this->_ownerOutletNodes->retain();
|
||||
|
||||
this->_CCBRootPath = ccbReader->getCCBRootPath();
|
||||
|
||||
|
@ -124,12 +115,12 @@ CCBReader::CCBReader()
|
|||
, _CCBSelectorResolver(NULL)
|
||||
, _nodesWithAnimationManagers(NULL)
|
||||
, _animationManagersForNodes(NULL)
|
||||
, _hasScriptingOwner(false)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
CCBReader::~CCBReader() {
|
||||
CCBReader::~CCBReader()
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(_owner);
|
||||
CC_SAFE_RELEASE_NULL(_data);
|
||||
|
||||
|
@ -139,9 +130,9 @@ CCBReader::~CCBReader() {
|
|||
_ownerOutletNames.clear();
|
||||
CC_SAFE_RELEASE(_ownerCallbackNodes);
|
||||
_ownerCallbackNames.clear();
|
||||
|
||||
CC_SAFE_RELEASE(_ownerOwnerCallbackControlEvents);
|
||||
|
||||
// Clear string cache.
|
||||
|
||||
this->_stringCache.clear();
|
||||
CC_SAFE_RELEASE(_nodesWithAnimationManagers);
|
||||
CC_SAFE_RELEASE(_animationManagersForNodes);
|
||||
|
@ -162,6 +153,10 @@ const std::string& CCBReader::getCCBRootPath() const
|
|||
|
||||
bool CCBReader::init()
|
||||
{
|
||||
_ownerOutletNodes = new Array();
|
||||
_ownerCallbackNodes = new Array();
|
||||
_ownerOwnerCallbackControlEvents = new Array();
|
||||
|
||||
// Setup action manager
|
||||
CCBAnimationManager *pActionManager = new CCBAnimationManager();
|
||||
setAnimationManager(pActionManager);
|
||||
|
@ -269,8 +264,6 @@ Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &
|
|||
|
||||
_actionManager->setRootContainerSize(parentSize);
|
||||
_actionManager->_owner = _owner;
|
||||
_ownerOutletNodes = new Array();
|
||||
_ownerCallbackNodes = new Array();
|
||||
|
||||
Dictionary* animationManagers = Dictionary::create();
|
||||
Node *pNodeGraph = readFileWithCleanUp(true, animationManagers);
|
||||
|
@ -280,8 +273,10 @@ Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &
|
|||
// Auto play animations
|
||||
_actionManager->runAnimationsForSequenceIdTweenDuration(_actionManager->getAutoPlaySequenceId(), 0);
|
||||
}
|
||||
|
||||
// Assign actionManagers to userObject
|
||||
if(_jsControlled) {
|
||||
if(_jsControlled)
|
||||
{
|
||||
_nodesWithAnimationManagers = new Array();
|
||||
_animationManagersForNodes = new Array();
|
||||
}
|
||||
|
@ -716,8 +711,8 @@ Node * CCBReader::readNodeGraph(Node * pParent)
|
|||
if(target != NULL)
|
||||
{
|
||||
CCBMemberVariableAssigner * targetAsCCBMemberVariableAssigner = dynamic_cast<CCBMemberVariableAssigner *>(target);
|
||||
if(targetAsCCBMemberVariableAssigner != NULL) {
|
||||
|
||||
if(targetAsCCBMemberVariableAssigner != NULL)
|
||||
{
|
||||
Dictionary* pCustomPropeties = ccNodeLoader->getCustomProperties();
|
||||
DictElement* pElement;
|
||||
CCDICT_FOREACH(pCustomPropeties, pElement)
|
||||
|
@ -741,7 +736,8 @@ Node * CCBReader::readNodeGraph(Node * pParent)
|
|||
|
||||
/* Read and add children. */
|
||||
int numChildren = this->readInt(false);
|
||||
for(int i = 0; i < numChildren; i++) {
|
||||
for(int i = 0; i < numChildren; i++)
|
||||
{
|
||||
Node * child = this->readNodeGraph(node);
|
||||
node->addChild(child);
|
||||
}
|
||||
|
@ -749,12 +745,16 @@ Node * CCBReader::readNodeGraph(Node * pParent)
|
|||
// FIX ISSUE #1860: "onNodeLoaded will be called twice if ccb was added as a CCBFile".
|
||||
// If it's a sub-ccb node, skip notification to NodeLoaderListener since it will be
|
||||
// notified at LINE #734: Node * child = this->readNodeGraph(node);
|
||||
if (!isCCBFileNode) {
|
||||
if (!isCCBFileNode)
|
||||
{
|
||||
// Call onNodeLoaded
|
||||
NodeLoaderListener * nodeAsNodeLoaderListener = dynamic_cast<NodeLoaderListener *>(node);
|
||||
if(nodeAsNodeLoaderListener != NULL) {
|
||||
if(nodeAsNodeLoaderListener != NULL)
|
||||
{
|
||||
nodeAsNodeLoaderListener->onNodeLoaded(node, ccNodeLoader);
|
||||
} else if(this->_nodeLoaderListener != NULL) {
|
||||
}
|
||||
else if(this->_nodeLoaderListener != NULL)
|
||||
{
|
||||
this->_nodeLoaderListener->onNodeLoaded(node, ccNodeLoader);
|
||||
}
|
||||
}
|
||||
|
@ -991,29 +991,43 @@ bool CCBReader::endsWith(const char* pString, const char* pEnding) {
|
|||
}
|
||||
}
|
||||
|
||||
bool CCBReader::isJSControlled() {
|
||||
bool CCBReader::isJSControlled()
|
||||
{
|
||||
return _jsControlled;
|
||||
}
|
||||
|
||||
void CCBReader::addOwnerCallbackName(std::string name) {
|
||||
void CCBReader::addOwnerCallbackName(const std::string& name)
|
||||
{
|
||||
_ownerCallbackNames.push_back(name);
|
||||
}
|
||||
|
||||
void CCBReader::addOwnerCallbackNode(Node *node) {
|
||||
void CCBReader::addOwnerCallbackNode(Node *node)
|
||||
{
|
||||
_ownerCallbackNodes->addObject(node);
|
||||
}
|
||||
|
||||
void CCBReader::addOwnerCallbackControlEvents(Control::EventType type)
|
||||
{
|
||||
_ownerOwnerCallbackControlEvents->addObject(Integer::create((int)type));
|
||||
}
|
||||
|
||||
void CCBReader::addDocumentCallbackName(std::string name) {
|
||||
void CCBReader::addDocumentCallbackName(const std::string& name)
|
||||
{
|
||||
_actionManager->addDocumentCallbackName(name);
|
||||
}
|
||||
|
||||
void CCBReader::addDocumentCallbackNode(Node *node) {
|
||||
void CCBReader::addDocumentCallbackNode(Node *node)
|
||||
{
|
||||
_actionManager->addDocumentCallbackNode(node);
|
||||
}
|
||||
|
||||
void CCBReader::addDocumentCallbackControlEvents(Control::EventType eventType)
|
||||
{
|
||||
_actionManager->addDocumentCallbackControlEvents(eventType);
|
||||
}
|
||||
|
||||
Array* CCBReader::getOwnerCallbackNames() {
|
||||
Array* CCBReader::getOwnerCallbackNames()
|
||||
{
|
||||
Array* pRet = Array::createWithCapacity(_ownerCallbackNames.size());
|
||||
std::vector<std::string>::iterator it = _ownerCallbackNames.begin();
|
||||
for (; it != _ownerCallbackNames.end(); ++it)
|
||||
|
@ -1024,11 +1038,18 @@ Array* CCBReader::getOwnerCallbackNames() {
|
|||
return pRet;
|
||||
}
|
||||
|
||||
Array* CCBReader::getOwnerCallbackNodes() {
|
||||
Array* CCBReader::getOwnerCallbackNodes()
|
||||
{
|
||||
return _ownerCallbackNodes;
|
||||
}
|
||||
|
||||
Array* CCBReader::getOwnerOutletNames() {
|
||||
Array* CCBReader::getOwnerCallbackControlEvents()
|
||||
{
|
||||
return _ownerOwnerCallbackControlEvents;
|
||||
}
|
||||
|
||||
Array* CCBReader::getOwnerOutletNames()
|
||||
{
|
||||
Array* pRet = Array::createWithCapacity(_ownerOutletNames.size());
|
||||
std::vector<std::string>::iterator it = _ownerOutletNames.begin();
|
||||
for (; it != _ownerOutletNames.end(); ++it)
|
||||
|
@ -1038,26 +1059,29 @@ Array* CCBReader::getOwnerOutletNames() {
|
|||
return pRet;
|
||||
}
|
||||
|
||||
Array* CCBReader::getOwnerOutletNodes() {
|
||||
Array* CCBReader::getOwnerOutletNodes()
|
||||
{
|
||||
return _ownerOutletNodes;
|
||||
}
|
||||
|
||||
Array* CCBReader::getNodesWithAnimationManagers() {
|
||||
Array* CCBReader::getNodesWithAnimationManagers()
|
||||
{
|
||||
return _nodesWithAnimationManagers;
|
||||
}
|
||||
|
||||
Array* CCBReader::getAnimationManagersForNodes() {
|
||||
Array* CCBReader::getAnimationManagersForNodes()
|
||||
{
|
||||
return _animationManagersForNodes;
|
||||
}
|
||||
|
||||
void CCBReader::addOwnerOutletName(std::string name)
|
||||
{
|
||||
_ownerOutletNames.push_back(name);
|
||||
|
||||
}
|
||||
|
||||
void CCBReader::addOwnerOutletNode(Node *node)
|
||||
{
|
||||
if (NULL != node)
|
||||
if (NULL == node)
|
||||
return;
|
||||
|
||||
_ownerOutletNodes->addObject(node);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include "CCBSequence.h"
|
||||
|
||||
#include "GUI/CCControlExtension/CCControl.h"
|
||||
|
||||
#define CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(T, METHOD) static T * METHOD() { \
|
||||
T * ptr = new T(); \
|
||||
|
@ -187,28 +187,29 @@ public:
|
|||
float readFloat();
|
||||
std::string readCachedString();
|
||||
bool isJSControlled();
|
||||
|
||||
|
||||
bool readCallbackKeyframesForSeq(CCBSequence* seq);
|
||||
bool readSoundKeyframesForSeq(CCBSequence* seq);
|
||||
|
||||
|
||||
|
||||
Array* getOwnerCallbackNames();
|
||||
Array* getOwnerCallbackNodes();
|
||||
Array* getOwnerCallbackControlEvents();
|
||||
|
||||
Array* getOwnerOutletNames();
|
||||
Array* getOwnerOutletNodes();
|
||||
Array* getNodesWithAnimationManagers();
|
||||
Array* getAnimationManagersForNodes();
|
||||
|
||||
|
||||
Dictionary* getAnimationManagers();
|
||||
void setAnimationManagers(Dictionary* x); // weak reference
|
||||
|
||||
void addOwnerCallbackName(std::string name);
|
||||
void addOwnerCallbackName(const std::string& name);
|
||||
void addOwnerCallbackNode(Node *node);
|
||||
void addOwnerCallbackControlEvents(Control::EventType type);
|
||||
|
||||
void addDocumentCallbackName(std::string name);
|
||||
void addDocumentCallbackName(const std::string& name);
|
||||
void addDocumentCallbackNode(Node *node);
|
||||
void addDocumentCallbackControlEvents(Control::EventType eventType);
|
||||
|
||||
static float getResolutionScale();
|
||||
static void setResolutionScale(float scale);
|
||||
|
@ -232,6 +233,8 @@ private:
|
|||
bool getBit();
|
||||
void alignBits();
|
||||
|
||||
bool init();
|
||||
|
||||
friend class NodeLoader;
|
||||
|
||||
private:
|
||||
|
@ -262,12 +265,10 @@ private:
|
|||
|
||||
std::vector<std::string> _ownerCallbackNames;
|
||||
Array* _ownerCallbackNodes;
|
||||
Array* _ownerOwnerCallbackControlEvents;
|
||||
std::string _CCBRootPath;
|
||||
|
||||
bool _jsControlled;
|
||||
|
||||
bool _hasScriptingOwner;
|
||||
bool init();
|
||||
};
|
||||
|
||||
// end of effects group
|
||||
|
|
|
@ -800,14 +800,22 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
|
|||
} else {
|
||||
CCLOG("Unexpected NULL target for selector.");
|
||||
}
|
||||
} else {
|
||||
if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT)
|
||||
{
|
||||
ccbReader->addDocumentCallbackNode(pNode);
|
||||
ccbReader->addDocumentCallbackName(selectorName);
|
||||
|
||||
} else {
|
||||
// Since there isn't a Control::EventType::NONE, add a TOUCH_DOWN type as a placeholder.
|
||||
ccbReader->addDocumentCallbackControlEvents(Control::EventType::TOUCH_DOWN);
|
||||
}
|
||||
else if (selectorTarget == CCBReader::TargetType::OWNER)
|
||||
{
|
||||
ccbReader->addOwnerCallbackNode(pNode);
|
||||
ccbReader->addOwnerCallbackName(selectorName);
|
||||
// Since there isn't a Control::EventType::NONE, add a TOUCH_DOWN type as a placeholder.
|
||||
ccbReader->addOwnerCallbackControlEvents(Control::EventType::TOUCH_DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -884,12 +892,13 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
|
|||
{
|
||||
ccbReader->addDocumentCallbackNode(pNode);
|
||||
ccbReader->addDocumentCallbackName(selectorName);
|
||||
|
||||
ccbReader->addDocumentCallbackControlEvents((Control::EventType)controlEvents);
|
||||
}
|
||||
else
|
||||
{
|
||||
ccbReader->addOwnerCallbackNode(pNode);
|
||||
ccbReader->addOwnerCallbackName(selectorName);
|
||||
ccbReader->addOwnerCallbackControlEvents((Control::EventType)controlEvents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -953,11 +962,13 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
|
|||
if (NULL != ownerCallbackNames && ownerCallbackNames->count() > 0 &&
|
||||
NULL != ownerCallbackNodes && ownerCallbackNodes->count() > 0)
|
||||
{
|
||||
assert(ownerCallbackNames->count() == ownerCallbackNodes->count());
|
||||
CCASSERT(ownerCallbackNames->count() == ownerCallbackNodes->count(), "");
|
||||
int nCount = ownerCallbackNames->count();
|
||||
for (int i = 0 ; i < nCount; i++) {
|
||||
|
||||
for (int i = 0 ; i < nCount; i++)
|
||||
{
|
||||
pCCBReader->addOwnerCallbackName((dynamic_cast<String*>(ownerCallbackNames->objectAtIndex(i)))->getCString());
|
||||
pCCBReader->addOwnerCallbackNode(dynamic_cast<Node*>(ownerCallbackNames->objectAtIndex(i)) );
|
||||
pCCBReader->addOwnerCallbackNode(dynamic_cast<Node*>(ownerCallbackNodes->objectAtIndex(i)) );
|
||||
}
|
||||
}
|
||||
//set variables
|
||||
|
@ -966,11 +977,13 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
|
|||
if (NULL != ownerOutletNames && ownerOutletNames->count() > 0 &&
|
||||
NULL != ownerOutletNodes && ownerOutletNodes->count() > 0)
|
||||
{
|
||||
assert(ownerOutletNames->count() == ownerOutletNodes->count());
|
||||
CCASSERT(ownerOutletNames->count() == ownerOutletNodes->count(), "");
|
||||
int nCount = ownerOutletNames->count();
|
||||
for (int i = 0 ; i < nCount; i++) {
|
||||
pCCBReader->addOwnerOutletName((dynamic_cast<String*>(ownerOutletNames->objectAtIndex(i)))->getCString());
|
||||
pCCBReader->addOwnerOutletNode(dynamic_cast<Node*>(ownerOutletNodes->objectAtIndex(i)) );
|
||||
|
||||
for (int i = 0 ; i < nCount; i++)
|
||||
{
|
||||
pCCBReader->addOwnerOutletName((static_cast<String*>(ownerOutletNames->objectAtIndex(i)))->getCString());
|
||||
pCCBReader->addOwnerOutletNode(static_cast<Node*>(ownerOutletNodes->objectAtIndex(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
|
||||
virtual double getValue() const;
|
||||
virtual void setStepValue(double stepValue);
|
||||
/** Set the numeric value of the stepper. If send is true, the Control::EventType::VALUE_CHANGED is sent. */
|
||||
virtual void setValueWithSendingEvent(double value, bool send);
|
||||
virtual bool isContinuous() const;
|
||||
|
||||
|
@ -75,9 +76,6 @@ public:
|
|||
/** Update the layout of the stepper with the given touch location. */
|
||||
void updateLayoutUsingTouchLocation(Point location);
|
||||
|
||||
/** Set the numeric value of the stepper. If send is true, the Control::EventType::VALUE_CHANGED is sent. */
|
||||
void setValue(double value, bool send);
|
||||
|
||||
/** Start the autorepeat increment/decrement. */
|
||||
void startAutorepeat();
|
||||
|
||||
|
|
|
@ -66,10 +66,16 @@ public class AdsFlurry implements InterfaceAds, FlurryAdListener {
|
|||
@Override
|
||||
public void setDebugMode(boolean isDebugMode) {
|
||||
isDebug = isDebugMode;
|
||||
FlurryAgent.setLogEnabled(isDebug);
|
||||
if (isDebugMode) {
|
||||
FlurryAgent.setLogLevel(Log.DEBUG);
|
||||
}
|
||||
final boolean curDebug = isDebug;
|
||||
PluginWrapper.runOnMainThread(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.setLogEnabled(curDebug);
|
||||
if (curDebug) {
|
||||
FlurryAgent.setLogLevel(Log.DEBUG);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +166,7 @@ public class AdsFlurry implements InterfaceAds, FlurryAdListener {
|
|||
@Override
|
||||
public void hideAds(Hashtable<String, String> adsInfo) {
|
||||
final Hashtable<String, String> curInfo = adsInfo;
|
||||
PluginWrapper.runOnGLThread(new Runnable(){
|
||||
PluginWrapper.runOnMainThread(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
try
|
||||
|
|
|
@ -58,64 +58,131 @@ public class AnalyticsFlurry implements InterfaceAnalytics {
|
|||
@Override
|
||||
public void startSession(String appKey) {
|
||||
LogD("startSession invoked!");
|
||||
FlurryAgent.onStartSession(mContext, appKey);
|
||||
final String curKey = appKey;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Class.forName("android.os.AsyncTask");
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
FlurryAgent.onStartSession(mContext, curKey);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopSession() {
|
||||
LogD("stopSession invoked!");
|
||||
FlurryAgent.onEndSession(mContext);
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.onEndSession(mContext);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSessionContinueMillis(int millis) {
|
||||
LogD("setSessionContinueMillis invoked!");
|
||||
FlurryAgent.setContinueSessionMillis(millis);
|
||||
final int curMillis = millis;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.setContinueSessionMillis(curMillis);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCaptureUncaughtException(boolean isEnabled) {
|
||||
LogD("setCaptureUncaughtException invoked!");
|
||||
FlurryAgent.setCaptureUncaughtExceptions(isEnabled);
|
||||
final boolean curEnable = isEnabled;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.setCaptureUncaughtExceptions(curEnable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDebugMode(boolean isDebugMode) {
|
||||
isDebug = isDebugMode;
|
||||
FlurryAgent.setLogEnabled(isDebug);
|
||||
if (isDebugMode) {
|
||||
FlurryAgent.setLogLevel(Log.DEBUG);
|
||||
}
|
||||
final boolean curDebugMode = isDebug;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.setLogEnabled(curDebugMode);
|
||||
if (curDebugMode) {
|
||||
FlurryAgent.setLogLevel(Log.DEBUG);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logError(String errorId, String message) {
|
||||
LogD("logError invoked!");
|
||||
FlurryAgent.onError(errorId, message, "");
|
||||
final String curID = errorId;
|
||||
final String curMsg = message;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.onError(curID, curMsg, "");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logEvent(String eventId) {
|
||||
LogD("logEvent(eventId) invoked!");
|
||||
FlurryAgent.logEvent(eventId);
|
||||
final String curId = eventId;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.logEvent(curId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logEvent(String eventId, Hashtable<String, String> paramMap) {
|
||||
LogD("logEvent(eventId, paramMap) invoked!");
|
||||
FlurryAgent.logEvent(eventId, paramMap);
|
||||
final String curId = eventId;
|
||||
final Hashtable<String, String> curParam = paramMap;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.logEvent(curId, curParam);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTimedEventBegin(String eventId) {
|
||||
LogD("logTimedEventBegin invoked!");
|
||||
FlurryAgent.logEvent(eventId, true);
|
||||
final String curId = eventId;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.logEvent(curId, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTimedEventEnd(String eventId) {
|
||||
LogD("logTimedEventEnd invoked!");
|
||||
FlurryAgent.endTimedEvent(eventId);
|
||||
final String curId = eventId;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlurryAgent.endTimedEvent(curId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,96 +192,144 @@ public class AnalyticsFlurry implements InterfaceAnalytics {
|
|||
|
||||
protected void logTimedEventBeginWithParams(JSONObject eventInfo) {
|
||||
LogD("logTimedEventBegin invoked!");
|
||||
try{
|
||||
String eventId = eventInfo.getString("Param1");
|
||||
|
||||
if (eventInfo.has("Param2"))
|
||||
{
|
||||
JSONObject params = eventInfo.getJSONObject("Param2");
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator it = params.keys();
|
||||
Hashtable<String, String> paramMap = new Hashtable<String, String>();
|
||||
while (it.hasNext()) {
|
||||
String key = (String) it.next();
|
||||
String value = params.getString(key);
|
||||
paramMap.put(key, value);
|
||||
final JSONObject curInfo = eventInfo;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
String eventId = curInfo.getString("Param1");
|
||||
|
||||
if (curInfo.has("Param2"))
|
||||
{
|
||||
JSONObject params = curInfo.getJSONObject("Param2");
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator it = params.keys();
|
||||
Hashtable<String, String> paramMap = new Hashtable<String, String>();
|
||||
while (it.hasNext()) {
|
||||
String key = (String) it.next();
|
||||
String value = params.getString(key);
|
||||
paramMap.put(key, value);
|
||||
}
|
||||
FlurryAgent.logEvent(eventId, paramMap, true);
|
||||
} else {
|
||||
FlurryAgent.logEvent(eventId, true);
|
||||
}
|
||||
} catch(Exception e){
|
||||
LogE("Exception in logTimedEventBegin", e);
|
||||
}
|
||||
FlurryAgent.logEvent(eventId, paramMap, true);
|
||||
} else {
|
||||
FlurryAgent.logEvent(eventId, true);
|
||||
}
|
||||
} catch(Exception e){
|
||||
LogE("Exception in logTimedEventBegin", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setReportLocation(boolean enabled) {
|
||||
LogD("setReportLocation invoked!");
|
||||
try{
|
||||
FlurryAgent.setReportLocation(enabled);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setReportLocation", e);
|
||||
}
|
||||
final boolean curEnable = enabled;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
FlurryAgent.setReportLocation(curEnable);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setReportLocation", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void logPageView() {
|
||||
LogD("logPageView invoked!");
|
||||
try{
|
||||
FlurryAgent.onPageView();
|
||||
} catch(Exception e){
|
||||
LogE("Exception in logPageView", e);
|
||||
}
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
FlurryAgent.onPageView();
|
||||
} catch(Exception e){
|
||||
LogE("Exception in logPageView", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setVersionName(String versionName) {
|
||||
LogD("setVersionName invoked!");
|
||||
try {
|
||||
FlurryAgent.setVersionName(versionName);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setVersionName", e);
|
||||
}
|
||||
final String curVer = versionName;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
FlurryAgent.setVersionName(curVer);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setVersionName", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setAge(int age) {
|
||||
LogD("setAge invoked!");
|
||||
try {
|
||||
FlurryAgent.setAge(age);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setAge", e);
|
||||
}
|
||||
final int curAge = age;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
FlurryAgent.setAge(curAge);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setAge", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setGender(int gender) {
|
||||
LogD("setGender invoked!");
|
||||
try {
|
||||
byte bGender;
|
||||
if (1 == gender) {
|
||||
bGender = Constants.MALE;
|
||||
} else {
|
||||
bGender = Constants.FEMALE;
|
||||
final int curGender = gender;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
byte bGender;
|
||||
if (1 == curGender) {
|
||||
bGender = Constants.MALE;
|
||||
} else {
|
||||
bGender = Constants.FEMALE;
|
||||
}
|
||||
FlurryAgent.setGender(bGender);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setGender", e);
|
||||
}
|
||||
}
|
||||
FlurryAgent.setGender(bGender);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setGender", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setUserId(String userId) {
|
||||
LogD("setUserId invoked!");
|
||||
try {
|
||||
FlurryAgent.setUserId(userId);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setUserId", e);
|
||||
}
|
||||
final String curUser = userId;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
FlurryAgent.setUserId(curUser);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setUserId", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setUseHttps(boolean useHttps) {
|
||||
LogD("setUseHttps invoked!");
|
||||
try {
|
||||
FlurryAgent.setUseHttps(useHttps);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setUseHttps", e);
|
||||
}
|
||||
|
||||
final boolean curCfg = useHttps;
|
||||
PluginWrapper.runOnMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
FlurryAgent.setUseHttps(curCfg);
|
||||
} catch(Exception e){
|
||||
LogE("Exception in setUseHttps", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
695437916886a559504bfbf29615b248a41be1c1
|
|
@ -1 +1 @@
|
|||
761ab0ca76abcdc06890e579f77fcdea6afa83c6
|
||||
799bef32d63b59bf79c42f65ede1d31446db8cb5
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
0cb89ef70f9172baa023fcbae9b87da09af2e776
|
||||
176fad5560bfaf91132d395364f9fb18be185a5e
|
|
@ -0,0 +1,30 @@
|
|||
5ndtII3qG6kuOW5UwVEQ1e0Of3ibjmMbEX0w5EScjFBk36yrdcepJ78mR/RsxxsWvSFunswgX4pi
|
||||
CqnonUMw723wi7mFULv7qCOKcH0XabcQomXnthj4elSas9BEeBrh9rF4rXxia3mr94+6Rxr3upP5
|
||||
VtFOUHkeSo81e/WZiBnyjaNB/5Ud0LkpUToIRmBSt4li1jvA4kq9C+NAjyEIE5VOOikpm+SBzXo9
|
||||
/QtnIbYhV2ZdEe8jCt0OluMjMcUueOuQgSyF62MJQqjMlVmUjO4tCYNnLGx5sBGcBxqIYL1XCekf
|
||||
vVyUvPAVBR5i+x8NG/MmPdFhwjeuuHjoByroBjNGDAMgUJyxYdjok+GOahc16wgDZ7PBvu46gF7A
|
||||
G8or3ruF+qp8or5U17OBbiuisB0pHNW4h8c2TtJD6Rq8i4NRUlmrUmZsc7QqU1H9eKoNqbyrcnK5
|
||||
t8M8fb5U/uHKxq0NRmvppLUwGxJpUzocv7I/hRSk2LxtmD58lTNmfzjgaZeP9pa8h3Tpto/sT+wV
|
||||
tUgHImreS6DB1wbiuRkzPZsLH1fnToD2/JWr+9g5iBvS+s6q2oLQ6gFzxhVoigt/tdo/0pMKtVO7
|
||||
76//QaQOSVAEs6F5JqiVYU3sxEukjpRHX/N6g8GdzCTrp7drmsokblWKFzW1SzrMZV0/XXJpvIbS
|
||||
N95ArnkCRkaPiPGoBVv9e5jsLtMnGoPelYrbmrcTY5L/d8x7wl0piN3ZzW+11UxoYI3dkANP7D98
|
||||
P83gnyq3pi60AuTBWVUqpeCrBLsrsGl3SH5pNg7qEv/OA+qgpbXTLNBeqGpFJ+NGqXmFlbEwMbpQ
|
||||
qAV8BA1lC1Jaq0McCwIBF6hYPrzHs71u6+A9xQic1IJ4jHjfu50cFIcRyaIl4fhfJv7wsXdmnsKt
|
||||
WoNwabsXGNQbcTw+9+5khbsnrOYWUGjqzqDnbV23ZUpx68DV0d1pcQ3XlITePtmcyIZD3RkZSwH4
|
||||
VRU5mL613jiI3z50VI90CfCX5SgPwzdpnCZX+cxWP/BkiS3r4ZCtnI9WcFkVHEYWgnDhTGbVBaaq
|
||||
K8+l1HaIMwZY6nRHTr0DVMM9URgeqk9CXbhfleBqHAiv3ANn6pJFOg/xTFZmMPS/+9kr9/M3qY6G
|
||||
hCdytoi1vZWF4pv+qHQl+i5t8Iu5hVC7+y9ODxhWdkVNt14s6LgJY51Ycey1+uxdmIgNob0l/xRN
|
||||
yugdrOFu56trwkrAjSbdnPVgGPltleLPA9zOlKH7OcDBdgoOAz8RGXjD/ZI8eQOae8DjAkGKX1TW
|
||||
ON5cXhvPTsjI+uVH0n/un7W4VSBsd8XSjBVVAEiVnp5R/rI0Q9Pg3zgosJkklx/GmMlLOdbXH8GA
|
||||
TA9D05nnPgYsBHiUAVzwDRiSXpK2iBqVxuo4JvTLYZMW+ElBpp0z07VrclYCO1Xt8jPdYg7X4U6R
|
||||
R3Y0AQZc/l6PG9Pi9qLiB2/OrI3Lm4vSFCKm+BIih1XzFhWUKI3clhguAErRmg33Hw//TfXBM2ab
|
||||
sLFOuH6l9XK93MR4gldVAAVBZ1Cp/phAOyL/3CREKGVPLGSFOnS3JD4bDkkxCfeL1SmDVQ1QXH+k
|
||||
lSHXV7ap52iCcJmwfYGC36JIMT9hWvQ/LJbPBDrxO/v3MNc3sTRayQsRGT0chLTPB3ZdL37HOtYO
|
||||
pM9D7xjJ/HZXkHVBxGdUJtq09vKvl/vPYStk2xLb1EvdNXVLWeh4K5RTvFjQKsSYmJyMTOIHXgPP
|
||||
8p5Yld41hutn+eBY3Cvm4RnNFBcFiCQKCKpTsavUYt3OJGw4fbYX/n2V2tSue3xxks0K+MwaVP0B
|
||||
gINCvbd5Kf1Heg2pWg/UIiRPLTSqgzH7rZgci5CL3PIPN73v3xYPAXlnLs9V3CWfgINCvbd5Kf0D
|
||||
svj7g/9SvvbHdgDI4WlDrZgci5CL3PIJiBvggx50ZxJ8HBFOYjNDuyvUNw4DO+/mILSuU8sXp3NY
|
||||
TXKZB5eq0md68ln+JjRLDXH0qbfNL6t3Bn5lJ8rqAPrjGlkPo2P7E2TPti1fK83qoxbY2JYyrZgc
|
||||
i5CL3PLYU08oU0MBIMpBFasBcMNAdUtZ6HgrlFMk249fN7o08a7utnOokH+xs/iPtlG4fKGlXHzW
|
||||
zLSuYqUD4BvyuQ7pKWXCoHgiDfREtGn8fpeoX430gyq665d84vBfb8ISwPbeeyBBbloLh8WbiXql
|
||||
pNA6x1gn6Vc6zQrXsx3lW64Ubw==
|
|
@ -13,25 +13,190 @@
|
|||
android:process=":remote" >
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.SplashActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
<intent-filter>
|
||||
<action android:name="hanxin_303310048990001_1_1" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.PayMainActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.PayUserCreditActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.PayUserDebitActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.PayOnUserTelActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.PayResultActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.PayResultLoseActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.RegisterActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.RegisterResultActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.UserProtocalActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.OnUserCardManageActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.OnUserUserManageActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.changePswActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.changeTelActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.OnUserBindCardCreditActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.OnUserBindCardDebitActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.OnUserBindCardPanActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.OnUserBindCardResultActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.SupportActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.GetpassActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.AuthBindCardActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.unionpay.upomp.bypay.activity.AboutActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Activity_MyDialog"
|
||||
android:windowSoftInputMode="adjustPan" >
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="cn.paypalm.jar.game360.InitialAct"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/FloatingWindowStyle"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="cn.paypalm.jar.game360.UserMessageAct"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/FloatingWindowStyle"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="cn.paypalm.jar.game360.BankcardPayAct"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/FloatingWindowStyle"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="cn.paypalm.jar.game360.SuccessAct"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/FloatingWindowStyle"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="cn.paypalm.jar.game360.BankcardAgreement"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/FloatingWindowStyle"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" >
|
||||
</activity>
|
||||
|
||||
<meta-data android:name="QHOPENSDK_APPID" android:value="Your app_id" />
|
||||
<meta-data android:name="QHOPENSDK_APPKEY" android:value="Your app_key" />
|
||||
<meta-data android:name="QHOPENSDK_PRIVATEKEY" android:value="Your app_private_key" />
|
||||
<meta-data android:name="QHOPENSDK_CHANNEL" android:value="QH360" />
|
||||
<meta-data android:name="QHOPENSDK_CHANNEL" android:value="QH360" />
|
||||
</applicationCfg>
|
||||
<permissionCfg>
|
||||
<uses-permission android:name="android.permission.SEND_SMS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission android:name="android.permission.READ_SMS" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SEND_SMS" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.READ_SMS" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
</permissionCfg>
|
||||
</manifestConfig>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<animation-list android:oneshot="false"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:duration="150" android:drawable="@drawable/zsht_loading_01" />
|
||||
<item android:duration="150" android:drawable="@drawable/zsht_loading_02" />
|
||||
<item android:duration="150" android:drawable="@drawable/zsht_loading_03" />
|
||||
<item android:duration="150" android:drawable="@drawable/zsht_loading_04" />
|
||||
<item android:duration="150" android:drawable="@drawable/zsht_loading_05" />
|
||||
<item android:duration="150" android:drawable="@drawable/zsht_loading_06" />
|
||||
<item android:duration="150" android:drawable="@drawable/zsht_loading_07" />
|
||||
</animation-list>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn1" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn1_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn1_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn1_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn1_click" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn2" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn2_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn2_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn2_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn2_click" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn3" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn3_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn3_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn3_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn3_click" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn4" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn4_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn4_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn4_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn4_click" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn5" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn5_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn5_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn5_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn5_click" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn6" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn6_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn6_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn6_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_btn6_click" />
|
||||
</selector>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_card_select" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_card_select_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_card_select_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_card_select_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_card_select_click" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter_bg" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter_bg_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter_bg_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter_bg_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter_bg_click" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter2_bg" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter2_bg_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter2_bg_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter2_bg_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_enter2_bg_click" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc_bg" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc_bg_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc_bg_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc_bg_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc_bg_click" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc2_bg" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc2_bg_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc2_bg_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc2_bg_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_esc2_bg_click" />
|
||||
</selector>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 默认状态 -->
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_bg" />
|
||||
<!-- 按下状态 -->
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_bg_on" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_bg_on" />
|
||||
<!-- 选中状态 -->
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_bg_on" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_bg_on" />
|
||||
</selector>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn1" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn1_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn1_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn1_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn1_click" />
|
||||
</selector>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn2" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn2_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn2_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn2_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_member_btn2_click" />
|
||||
</selector>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_select_month" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_select_month_on" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_select_month_on" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_select_month_on" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_select_month_on" />
|
||||
</selector>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_hq_click" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_hq" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_hq" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_hq" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_hq" />
|
||||
</selector>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 默认状态 -->
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_number_bg" />
|
||||
<!-- 按下状态 -->
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_number_bg_on" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_number_bg_on" />
|
||||
<!-- 选中状态 -->
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_number_bg_on" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_number_bg_on" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_btn_change" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_change_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_change_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_change_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_btn_change_click" />
|
||||
</selector>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 默认状态 -->
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_fh_bg" />
|
||||
<!-- 按下状态 -->
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_fh_bg_on" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_fh_bg_on" />
|
||||
<!-- 选中状态 -->
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_fh_bg_on" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_fh_bg_on" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_title_btn" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_title_btn_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_title_btn_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_title_btn_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_title_btn_click" />
|
||||
</selector>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 默认状态 -->
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_select_year" />
|
||||
<!-- 按下状态 -->
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_select_year_on" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_select_year_on" />
|
||||
<!-- 选中状态 -->
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_select_year_on" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_select_year_on" />
|
||||
|
||||
</selector>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This is the rating bar drawable that is used to a show a filled star. -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_checked="false"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_select_1" />
|
||||
<item android:state_checked="true"
|
||||
android:state_enabled="true"
|
||||
android:drawable="@drawable/upomp_bypay_info_select_2" />
|
||||
|
||||
</selector>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_2" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_2_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_2_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_2_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_2_click" />
|
||||
</selector>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_4" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_4_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_4_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_4_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_input_btn_4_click" />
|
||||
</selector>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 默认状态 -->
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_clear_default" />
|
||||
<!-- 按下状态 -->
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_clear_on" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_clear_on" />
|
||||
<!-- 选中状态 -->
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_clear_on" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_clear_on" />
|
||||
</selector>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 默认状态 -->
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_enter_default"/>
|
||||
<!-- 按下状态 -->
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_enter_on" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_enter_on" />
|
||||
<!-- 选中状态 -->
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_enter_on" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_btn_enter_on" />
|
||||
</selector>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 默认状态 -->
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_clear_bg" />
|
||||
<!-- 按下状态 -->
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_clear_bg_on" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_clear_bg_on" />
|
||||
<!-- 选中状态 -->
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_clear_bg_on" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_keyboard_letter_clear_bg_on" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_window_focused="false"
|
||||
android:drawable="@drawable/upomp_bypay_open_btn" />
|
||||
<item android:state_focused="true" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_open_btn_click" />
|
||||
<item android:state_focused="false" android:state_pressed="true"
|
||||
android:drawable="@drawable/upomp_bypay_open_btn_click" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/upomp_bypay_open_btn_click" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/upomp_bypay_open_btn_click" />
|
||||
</selector>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:pivotX="50%" android:pivotY="50%"
|
||||
android:fromDegrees="0" android:toDegrees="360" >
|
||||
<shape android:shape="ring" android:innerRadiusRatio="3"
|
||||
android:thicknessRatio="8" android:useLevel="false">
|
||||
<gradient android:type="sweep" android:useLevel="false"
|
||||
android:startColor="#003c6a99" android:centerColor="#883c6a99"
|
||||
android:centerY="0.50" android:endColor="#3c6a99" />
|
||||
</shape>
|
||||
</rotate>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:pivotX="50%" android:pivotY="50%"
|
||||
android:fromDegrees="0" android:toDegrees="360" >
|
||||
<shape android:shape="ring" android:innerRadiusRatio="3"
|
||||
android:thicknessRatio="8" android:useLevel="false">
|
||||
<gradient android:type="sweep" android:useLevel="false"
|
||||
android:startColor="#00ffffff" android:centerColor="#88ffffff"
|
||||
android:centerY="0.50" android:endColor="#ffffff" />
|
||||
</shape>
|
||||
</rotate>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/zsht_get_authcode_button_pressed" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/zsht_get_authcode_button_pressed" android:state_enabled="true" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/zsht_get_authcode_button" android:state_enabled="true"/>
|
||||
|
||||
</selector>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/zsht_back_pressed" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/zsht_back_pressed" android:state_enabled="true" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/zsht_back" android:state_enabled="true"/>
|
||||
|
||||
</selector>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/zsht_button_pressed" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/zsht_button_pressed" android:state_enabled="true" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/zsht_button" android:state_enabled="true"/>
|
||||
|
||||
</selector>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/zsht_input_focused" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/zsht_input_focused" android:state_enabled="true" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/zsht_input" android:state_enabled="true"/>
|
||||
|
||||
</selector>
|
|
@ -0,0 +1,79 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="35dip" android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="15dip" android:layout_marginTop="35dip"
|
||||
android:background="@drawable/upomp_bypay_bg">
|
||||
<LinearLayout android:focusable="true"
|
||||
android:focusableInTouchMode="true" android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
<RelativeLayout android:id="@+id/rl_header_about"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_title_bg">
|
||||
<Button android:id="@+id/btn_return_about"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_btn_title_esc"
|
||||
android:layout_alignParentRight="true" android:layout_marginRight="5dip"
|
||||
android:layout_marginTop="5dip" android:textColor="#ffffffff"
|
||||
android:text="@string/upomp_bypay_return" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/sv_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_about" android:layout_above="@+id/rl_bottom_about"
|
||||
android:gravity="center_vertical" >
|
||||
<ImageView android:id="@+id/about_0" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_loading_logo"
|
||||
android:layout_centerHorizontal="true" android:layout_marginTop="-40dip"/>
|
||||
<TextView android:id="@+id/about_1" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_below="@id/about_0"
|
||||
android:layout_marginTop="5dip" android:text="@string/upomp_bypay_about1"
|
||||
android:textColor="#123860" android:textSize="15sp"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<TextView android:id="@+id/about_2" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_below="@id/about_1"
|
||||
android:layout_marginTop="5dip" android:text="@string/upomp_bypay_about2"
|
||||
android:textColor="#123860" android:textSize="15sp"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<TextView android:id="@+id/about_3" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_below="@id/about_2"
|
||||
android:layout_marginTop="5dip" android:text="@string/upomp_bypay_about3"
|
||||
android:textColor="#123860" android:textSize="15sp"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<TextView android:id="@+id/about_4" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_below="@id/about_3"
|
||||
android:layout_marginTop="5dip" android:text="@string/upomp_bypay_about4"
|
||||
android:textColor="#123860" android:textSize="15sp"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<TextView android:id="@+id/about_5" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_below="@id/about_4"
|
||||
android:layout_marginTop="5dip" android:text="@string/upomp_bypay_about5"
|
||||
android:textColor="#123860" android:textSize="15sp"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<TextView android:id="@+id/about_6" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_below="@id/about_5"
|
||||
android:layout_marginTop="5dip" android:text="@string/upomp_bypay_about6"
|
||||
android:textColor="#123860" android:textSize="15sp"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<TextView android:id="@+id/about_7" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_below="@id/about_6"
|
||||
android:layout_marginTop="5dip" android:text="@string/upomp_bypay_about7"
|
||||
android:textColor="#123860" android:textSize="15sp"
|
||||
android:layout_centerHorizontal="true" />
|
||||
<TextView android:id="@+id/about_8" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_below="@id/about_7"
|
||||
android:layout_marginTop="5dip" android:text="@string/upomp_bypay_about8"
|
||||
android:textColor="#123860" android:textSize="15sp"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_bottom_about"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_bottom"
|
||||
android:layout_alignParentBottom="true">
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<Button android:id="@+id/btn_about" android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_bottom_about" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent">
|
||||
<LinearLayout android:focusable="true"
|
||||
android:focusableInTouchMode="true" android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
<RelativeLayout android:id="@+id/rl_bg"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:background="#77000000">
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_dialog"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content">
|
||||
<RelativeLayout android:id="@+id/rl_bg_activity_dialog"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_open_bg" android:gravity="center_vertical">
|
||||
<RelativeLayout android:id="@+id/rl_content_activity_dialog"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true">
|
||||
<RelativeLayout android:id="@+id/rl_icon_activity_dialog"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||
<ImageView android:id="@+id/iv_activity_dialog"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_open_icon"
|
||||
android:visibility="visible" />
|
||||
<ProgressBar android:id="@+id/pb_activity_dialog"
|
||||
android:layout_width="30dip" android:layout_height="30dip"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
<TextView android:id="@+id/tv_content_activity_dialog"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/rl_icon_activity_dialog"
|
||||
android:textColor="#ff000000" android:textSize="16sp"
|
||||
android:layout_centerVertical="true" android:layout_marginLeft="10dip" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_btn_activity_dialog"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true" android:layout_below="@id/rl_content_activity_dialog"
|
||||
android:layout_marginTop="10dip">
|
||||
<Button android:id="@+id/btn_return_activity_dialog"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_return" android:background="@drawable/upomp_bypay_open_btn_enter"
|
||||
android:textColor="#ffffffff" android:textSize="16sp"/>
|
||||
|
||||
<Button android:id="@+id/btn_see_activity_dialog"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/btn_return_activity_dialog"
|
||||
android:layout_marginLeft="20dip" android:background="@drawable/upomp_bypay_open_btn_enter"
|
||||
android:textColor="#ffffffff" android:textSize="16sp"/>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
<ImageView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="@id/rl_bg_activity_dialog"
android:background="@drawable/upomp_bypay_open_bg2" />
|
||||
</RelativeLayout>
</RelativeLayout>
|
|
@ -0,0 +1,208 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="35dip" android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="15dip" android:layout_marginTop="35dip"
|
||||
android:background="@drawable/upomp_bypay_bg">
|
||||
<LinearLayout android:focusable="true"
|
||||
android:focusableInTouchMode="true" android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
<RelativeLayout android:id="@+id/rl_header_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_title_bg">
|
||||
<Button android:id="@+id/btn_esc_auth_bind_card"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_btn_title_esc"
|
||||
android:layout_alignParentRight="true" android:layout_marginRight="5dip"
|
||||
android:layout_marginTop="5dip" android:textColor="#ffffffff"
|
||||
android:text="@string/upomp_bypay_pay_result_returnmerchant" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ScrollView android:id="@+id/sv_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_auth_bind_card"
|
||||
android:layout_above="@+id/rl_bottom_auth_bind_card">
|
||||
<RelativeLayout android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView android:id="@+id/iv_info_top_user_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_top2"
|
||||
android:layout_marginTop="20dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" />
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_card_info_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_below="@id/iv_info_top_user_auth_bind_card"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
<RelativeLayout android:id="@+id/rl_iv_card_user_auth_bind_card"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_card_info_auth_bind_card"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon3" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_card_info_content_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_card_user_auth_bind_card">
|
||||
<TextView android:id="@+id/tv_card_info_content_auth_bind_card"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:textSize="14sp" android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/tv_tel_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_card_info_auth_bind_card"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_iv_tel_user_auth_bind_card"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_tel_info_auth_bind_card"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon5" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_telnum_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_tel_user_auth_bind_card"
|
||||
android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/tv_telnum_content_auth_bind_card"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dip"
|
||||
android:layout_centerVertical="true" android:textColor="#6a7482"
|
||||
android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
<ImageView android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" android:background="#dbdee0"
|
||||
android:layout_marginRight="1dip" android:layout_marginLeft="1dip" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView android:id="@+id/iv_info_bot_user_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bot2"
|
||||
android:layout_below="@id/tv_tel_auth_bind_card"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip" />
|
||||
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_credit_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/iv_info_bot_user_auth_bind_card">
|
||||
|
||||
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_validity_auth_bind_card"
|
||||
android:layout_marginTop="20dip" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<TextView android:id="@+id/tv_validity_title_auth_bind_card"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip" android:textColor="#6a7482"
|
||||
android:text="@string/upomp_bypay_date" android:gravity="center_vertical"
|
||||
android:textSize="14sp" android:layout_centerVertical="true" />
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_validity_content_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_toRightOf="@+id/tv_validity_title_auth_bind_card"
|
||||
android:layout_marginLeft="5dip" android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_btn_mm_auth_bind_card"
|
||||
android:layout_width="68dip" android:layout_height="45dip"
|
||||
android:background="@drawable/upomp_bypay_btn_month">
|
||||
<Button android:id="@+id/btn_mm_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:textColor="#6a7482" android:background="#00000000"
|
||||
android:textSize="14sp" android:gravity="left|center_vertical"
|
||||
android:layout_marginLeft="5dip" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_btn_yy_auth_bind_card"
|
||||
android:layout_toRightOf="@+id/rl_btn_mm_auth_bind_card"
|
||||
android:layout_marginLeft="5dip" android:layout_width="68dip"
|
||||
android:layout_height="45dip" android:background="@drawable/upomp_bypay_btn_year">
|
||||
<Button android:id="@+id/btn_yy_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:background="#00000000" android:textColor="#6a7482"
|
||||
android:textSize="14sp" android:gravity="left|center_vertical"
|
||||
android:layout_marginLeft="5dip" />
|
||||
</RelativeLayout>
|
||||
<ImageButton android:id="@+id/ib_image_cvn2"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_input_icon"
|
||||
android:layout_alignParentRight="true" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_cvn2_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_validity_auth_bind_card"
|
||||
android:layout_marginTop="8dip" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
|
||||
|
||||
<Button android:id="@+id/btn_cvn2_content_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:textColor="#6a7482" android:gravity="left|center_vertical"
|
||||
android:hint="@string/upomp_bypa_cvn2" android:layout_marginLeft="5dip"
|
||||
android:password="true" android:textSize="14sp"
|
||||
android:background="#00000000" android:layout_toLeftOf="@+id/ib_image_cvn21" />
|
||||
<ImageButton android:id="@+id/ib_image_cvn21"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_input_icon"
|
||||
android:layout_alignParentRight="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_debit_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_credit_auth_bind_card">
|
||||
<RelativeLayout android:id="@+id/rl_pin_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" android:background="@drawable/upomp_bypay_input_bg">
|
||||
|
||||
|
||||
<Button android:id="@+id/btn_pin_content_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:textColor="#6a7482" android:gravity="left|center_vertical"
|
||||
android:textSize="14sp" android:background="#00000000"
|
||||
android:layout_marginLeft="5dip" android:hint="@string/upomp_bypay_secondcardpsw" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<Button android:id="@+id/btn_next_auth_bind_card"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_bind_card" android:textColor="#ffffff"
|
||||
android:layout_below="@id/rl_debit_auth_bind_card"
|
||||
android:layout_marginTop="20dip" android:textSize="20sp"
|
||||
android:background="@drawable/upomp_bypay_btn_enter2"
|
||||
android:layout_marginLeft="10dip" />
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
<com.unionpay.upomp.bypay.view.About
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true" android:paddingBottom="5dip" />
|
||||
<RelativeLayout android:id="@+id/main_dialog_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_auth_bind_card"
|
||||
android:layout_above="@+id/rl_bottom_auth_bind_card" />
|
||||
<RelativeLayout android:id="@+id/rl_bottom_auth_bind_card"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_bottom"
|
||||
android:layout_alignParentBottom="true">
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,214 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="35dip" android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="15dip" android:layout_marginTop="35dip"
|
||||
android:background="@drawable/upomp_bypay_bg">
|
||||
<LinearLayout android:focusable="true"
|
||||
android:focusableInTouchMode="true" android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
<RelativeLayout android:id="@+id/rl_header_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_title_bg">
|
||||
<Button android:id="@+id/btn_return_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_btn_title_esc"
|
||||
android:layout_alignParentRight="true" android:layout_marginRight="5dip"
|
||||
android:layout_marginTop="5dip" android:textColor="#ffffffff"
|
||||
android:text="@string/upomp_bypay_return" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ScrollView android:id="@+id/sv_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_bindcard_credit"
|
||||
android:layout_above="@+id/rl_bottom_bindcard_credit">
|
||||
<RelativeLayout android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView android:id="@+id/iv_info_top_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_top2"
|
||||
android:layout_marginTop="20dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" />
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_card_info_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_below="@id/iv_info_top_bindcard_credit"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
<RelativeLayout android:id="@+id/rl_iv_card_bindcard_credit"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_card_info_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon3" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_card_info_content_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_card_bindcard_credit">
|
||||
<RelativeLayout android:id="@+id/rl_issuercard_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="30dip"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView android:id="@+id/tv_issuercard_content_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dip"
|
||||
android:textColor="#6a7482" android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/tv_tel_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_card_info_bindcard_credit"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_iv_tel_bindcard_credit"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_tel_info_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon5" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_telnum_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_tel_bindcard_credit"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<TextView android:id="@+id/tv_telnum_title_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_firstmobilenum" android:gravity="right"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:textSize="14sp" />
|
||||
<TextView android:id="@+id/tv_telnum_content_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/tv_telnum_title_bindcard_credit"
|
||||
android:textColor="#6a7482" android:textSize="14sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" android:background="#dbdee0"
|
||||
android:layout_marginRight="1dip" android:layout_marginLeft="1dip" />
|
||||
</RelativeLayout>
|
||||
<ImageView android:id="@+id/iv_info_bot_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bot2"
|
||||
android:layout_below="@id/tv_tel_bindcard_credit"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip" />
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_mobilevalidcode_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/iv_info_bot_bindcard_credit"
|
||||
android:layout_marginTop="20dip" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<EditText android:id="@+id/et_mobilevalidcode_content_bindcard_credit"
|
||||
android:singleLine="true" android:layout_width="fill_parent"
|
||||
android:layout_height="45dip" android:numeric="integer"
|
||||
android:textSize="14sp" android:maxLength="6" android:textColor="#6a7482"
|
||||
android:hint="@string/upomp_bypay_secondshortmessagesecuritycode"
|
||||
android:layout_toLeftOf="@+id/btn_mobilevalidcode_content_bindcard_credit"
|
||||
android:background="#00000000" android:layout_marginLeft="5dip" />
|
||||
<Button android:id="@+id/btn_mobilevalidcode_content_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="45dip"
|
||||
android:layout_alignParentRight="true" android:background="@drawable/upomp_bypay_input_btn2"
|
||||
android:text="@string/upomp_bypay_retry" android:textSize="14sp"
|
||||
android:textColor="#6a7482" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_validity_bindcard_credit"
|
||||
android:layout_below="@id/rl_mobilevalidcode_bindcard_credit"
|
||||
android:layout_marginTop="8dip" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<TextView android:id="@+id/tv_validity_title_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip" android:textColor="#6a7482"
|
||||
android:text="@string/upomp_bypay_date" android:gravity="center_vertical"
|
||||
android:textSize="14sp" android:layout_centerVertical="true" />
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_validity_content_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_toRightOf="@+id/tv_validity_title_bindcard_credit"
|
||||
android:layout_marginLeft="5dip" android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_btn_mm_bindcard_credit"
|
||||
android:layout_width="68dip" android:layout_height="45dip"
|
||||
android:background="@drawable/upomp_bypay_btn_month">
|
||||
<Button android:id="@+id/btn_mm_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:textColor="#6a7482" android:background="#00000000"
|
||||
android:textSize="14sp" android:gravity="left|center_vertical"
|
||||
android:layout_marginLeft="5dip" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_btn_yy_bindcard_credit"
|
||||
android:layout_toRightOf="@+id/rl_btn_mm_bindcard_credit"
|
||||
android:layout_marginLeft="5dip" android:layout_width="68dip"
|
||||
android:layout_height="45dip" android:background="@drawable/upomp_bypay_btn_year">
|
||||
<Button android:id="@+id/btn_yy_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:background="#00000000" android:textColor="#6a7482"
|
||||
android:textSize="14sp" android:gravity="left|center_vertical"
|
||||
android:layout_marginLeft="5dip" />
|
||||
</RelativeLayout>
|
||||
<ImageButton android:id="@+id/ib_image_cvn2"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_input_icon"
|
||||
android:layout_alignParentRight="true" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_cvn2_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_validity_bindcard_credit"
|
||||
android:layout_marginTop="8dip" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
|
||||
<Button android:id="@+id/btn_cvn2_content_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:textColor="#6a7482" android:gravity="left|center_vertical"
|
||||
android:hint="@string/upomp_bypa_cvn2" android:layout_marginLeft="5dip"
|
||||
android:password="true" android:textSize="14sp" android:background="#00000000"
|
||||
android:layout_toLeftOf="@+id/ib_image_cvn21" />
|
||||
<ImageButton android:id="@+id/ib_image_cvn21"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_input_icon"
|
||||
android:layout_alignParentRight="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<Button android:id="@+id/btn_next_bindcard_credit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_next" android:textColor="#ffffff"
|
||||
android:layout_below="@id/rl_cvn2_bindcard_credit"
|
||||
android:layout_marginTop="20dip" android:textSize="20sp"
|
||||
android:background="@drawable/upomp_bypay_btn_enter2"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
<com.unionpay.upomp.bypay.view.About
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true" android:paddingBottom="5dip" />
|
||||
<RelativeLayout android:id="@+id/main_dialog_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_bindcard_credit"
|
||||
android:layout_above="@+id/rl_bottom_bindcard_credit" />
|
||||
<RelativeLayout android:id="@+id/rl_bottom_bindcard_credit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_bottom"
|
||||
android:layout_alignParentBottom="true">
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,172 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="35dip" android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="15dip" android:layout_marginTop="35dip"
|
||||
android:background="@drawable/upomp_bypay_bg">
|
||||
<LinearLayout android:focusable="true"
|
||||
android:focusableInTouchMode="true" android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
<RelativeLayout android:id="@+id/rl_header_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_title_bg">
|
||||
<Button android:id="@+id/btn_return_bindcard_debit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_btn_title_esc"
|
||||
android:layout_alignParentRight="true" android:layout_marginRight="5dip"
|
||||
android:layout_marginTop="5dip" android:textColor="#ffffffff"
|
||||
android:text="@string/upomp_bypay_return" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ScrollView android:id="@+id/sv_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_bindcard_debit"
|
||||
android:layout_above="@+id/rl_bottom_bindcard_debit">
|
||||
<RelativeLayout android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView android:id="@+id/iv_info_top_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_top2"
|
||||
android:layout_marginTop="20dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" />
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_card_info_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_below="@id/iv_info_top_bindcard_debit"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
<RelativeLayout android:id="@+id/rl_iv_card_bindcard_debit"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_card_info_bindcard_debit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon3" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_card_info_content_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_card_bindcard_debit">
|
||||
<RelativeLayout android:id="@+id/rl_issuercard_bindcard_debit"
|
||||
android:layout_width="wrap_content" android:layout_height="30dip"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView android:id="@+id/tv_issuercard_content_bindcard_debit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dip"
|
||||
android:textColor="#6a7482" android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/tv_tel_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_card_info_bindcard_debit"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_iv_tel_bindcard_debit"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_tel_info_bindcard_debit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon5" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_telnum_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_tel_bindcard_debit"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<TextView android:id="@+id/tv_telnum_title_bindcard_debit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_firstmobilenum" android:gravity="right"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:textSize="14sp" />
|
||||
<TextView android:id="@+id/tv_telnum_content_bindcard_debit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/tv_telnum_title_bindcard_debit"
|
||||
android:textColor="#6a7482" android:textSize="14sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" android:background="#dbdee0"
|
||||
android:layout_marginRight="1dip" android:layout_marginLeft="1dip" />
|
||||
</RelativeLayout>
|
||||
<ImageView android:id="@+id/iv_info_bot_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bot2"
|
||||
android:layout_below="@id/tv_tel_bindcard_debit"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip" />
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_mobilevalidcode_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/iv_info_bot_bindcard_debit"
|
||||
android:layout_marginTop="20dip" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<EditText android:id="@+id/et_mobilevalidcode_content_bindcard_debit"
|
||||
android:singleLine="true" android:layout_width="fill_parent"
|
||||
android:layout_height="45dip" android:numeric="integer"
|
||||
android:textSize="14sp" android:maxLength="6" android:textColor="#6a7482"
|
||||
android:hint="@string/upomp_bypay_secondshortmessagesecuritycode"
|
||||
android:layout_toLeftOf="@+id/btn_mobilevalidcode_content_bindcard_debit"
|
||||
android:background="#00000000" android:layout_marginLeft="5dip" />
|
||||
<Button android:id="@+id/btn_mobilevalidcode_content_bindcard_debit"
|
||||
android:layout_width="wrap_content" android:layout_height="45dip"
|
||||
android:layout_alignParentRight="true" android:background="@drawable/upomp_bypay_input_btn2"
|
||||
android:text="@string/upomp_bypay_retry" android:textSize="14sp"
|
||||
android:textColor="#6a7482" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_pin_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_mobilevalidcode_bindcard_debit"
|
||||
android:layout_marginTop="8dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" android:background="@drawable/upomp_bypay_input_bg">
|
||||
|
||||
|
||||
|
||||
<Button android:id="@+id/btn_pin_content_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:textColor="#6a7482" android:gravity="left|center_vertical"
|
||||
android:hint="@string/upomp_bypay_secondcardpsw" android:layout_marginLeft="5dip"
|
||||
android:textSize="14sp" android:background="#00000000" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Button android:id="@+id/btn_next_bindcard_debit"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_next" android:textColor="#ffffff"
|
||||
android:background="@drawable/upomp_bypay_btn_enter2"
|
||||
android:textSize="20sp" android:layout_below="@id/rl_pin_bindcard_debit"
|
||||
android:layout_marginLeft="10dip" android:layout_marginTop="8dip" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
<com.unionpay.upomp.bypay.view.About
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true" android:paddingBottom="5dip" />
|
||||
<RelativeLayout android:id="@+id/main_dialog_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_bindcard_debit"
|
||||
android:layout_above="@+id/rl_bottom_bindcard_debit" />
|
||||
<RelativeLayout android:id="@+id/rl_bottom_bindcard_debit"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_bottom"
|
||||
android:layout_alignParentBottom="true">
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_marginBottom="35dip" android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="15dip" android:layout_marginTop="35dip"
|
||||
android:background="@drawable/upomp_bypay_bg">
|
||||
<LinearLayout android:focusable="true"
|
||||
android:focusableInTouchMode="true" android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
<RelativeLayout android:id="@+id/rl_header_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_title_bg">
|
||||
<Button android:id="@+id/btn_return_bindcard_pan"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_btn_title_esc"
|
||||
android:layout_alignParentRight="true" android:layout_marginRight="5dip"
|
||||
android:layout_marginTop="5dip" android:textColor="#ffffffff"
|
||||
android:text="@string/upomp_bypay_return" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ScrollView android:id="@+id/sv_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_bindcard_pan"
|
||||
android:layout_above="@+id/rl_bottom_bindcard_pan">
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_user_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginTop="20dip">
|
||||
<RelativeLayout android:id="@+id/rl_user_content_bindcard_pan"
|
||||
android:layout_marginTop="8dip" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<EditText android:id="@+id/et_user_input_content_content_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:textColor="#6a7482" android:numeric="integer"
|
||||
android:singleLine="true" android:maxLength="23"
|
||||
android:hint="@string/upomp_bypay_pan" android:layout_marginLeft="5dip"
|
||||
android:background="#00000000" android:textSize="15sp"
|
||||
android:layout_toLeftOf="@+id/ib_info_bindcard_pan" />
|
||||
<ImageButton android:id="@+id/ib_info_bindcard_pan"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_input_icon"
|
||||
android:layout_alignParentRight="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_user_tel_bindcard_pan"
|
||||
android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginTop="8dip" android:layout_below="@id/rl_user_content_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<EditText android:id="@+id/et_user_tel_content_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:textColor="#6a7482" android:numeric="integer"
|
||||
android:singleLine="true" android:maxLength="11"
|
||||
android:layout_marginLeft="5dip" android:background="#00000000"
|
||||
android:hint="@string/upomp_bypay_tel" android:textSize="15sp" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_user_webvalidcode_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_user_tel_bindcard_pan"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip"
|
||||
android:layout_marginTop="8dip" android:background="@drawable/upomp_bypay_input_bg">
|
||||
|
||||
<EditText android:id="@+id/et_user_webvalidcode_content_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="45dip"
|
||||
android:numeric="integer" android:layout_marginLeft="5dip"
|
||||
android:maxLength="4" android:singleLine="true" android:textColor="#6a7482"
|
||||
android:background="#00000000" android:textSize="15sp"
|
||||
android:layout_toLeftOf="@+id/iv_user_webvalidcode_content_bindcard_pan"
|
||||
android:hint="@string/upomp_bypay_image_validate" />
|
||||
<ImageView android:id="@+id/iv_user_webvalidcode_content_bindcard_pan"
|
||||
android:layout_width="70dip" android:layout_height="38dip"
|
||||
android:layout_alignParentRight="true" android:layout_marginLeft="5dip"
|
||||
android:layout_marginRight="5dip" android:layout_centerVertical="true" />
|
||||
<ProgressBar android:id="@+id/p_user_webvalidcode_content_bindcard_pan"
|
||||
android:layout_width="30dip" android:layout_height="30dip"
|
||||
android:layout_alignParentRight="true" android:layout_marginRight="15dip"
|
||||
android:indeterminateDrawable="@drawable/upomp_bypay_progress"
|
||||
android:visibility="gone" android:layout_marginLeft="30dip"
|
||||
android:layout_marginTop="5dip" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<Button android:id="@+id/btn_user_login_content_next_bindcard_pan"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_next" android:textColor="#ffffff"
|
||||
android:layout_below="@id/rl_user_webvalidcode_bindcard_pan"
|
||||
android:layout_marginTop="20dip" android:layout_centerHorizontal="true"
|
||||
android:textSize="20sp" android:background="@drawable/upomp_bypay_btn_enter2" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
<com.unionpay.upomp.bypay.view.About
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true" android:paddingBottom="5dip" />
|
||||
<RelativeLayout android:id="@+id/main_dialog_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_bindcard_pan"
|
||||
android:layout_above="@+id/rl_bottom_bindcard_pan" />
|
||||
<RelativeLayout android:id="@+id/rl_bottom_bindcard_pan"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_bottom"
|
||||
android:layout_alignParentBottom="true">
|
||||
</RelativeLayout>
</RelativeLayout>
|
|
@ -0,0 +1,218 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="35dip"
|
||||
android:layout_marginLeft="15dip" android:layout_marginRight="15dip"
|
||||
android:layout_marginTop="35dip" android:background="@drawable/upomp_bypay_bg">
|
||||
<LinearLayout android:focusable="true"
|
||||
android:focusableInTouchMode="true" android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
<RelativeLayout android:id="@+id/rl_header_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_title_bg">
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ScrollView android:id="@+id/sv_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_bindcard_result" android:layout_above="@+id/rl_bottom_bindcard_result">
|
||||
<RelativeLayout android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView android:id="@+id/iv_result_top_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_top2"
|
||||
android:layout_marginTop="20dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" />
|
||||
<RelativeLayout android:id="@+id/tv_result_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/iv_result_top_bindcard_result"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_iv_result_bindcard_result"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_result_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon1" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_result_content_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_result_bindcard_result"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
|
||||
<TextView android:id="@+id/tv_result_content_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:textColor="#ff0000" android:textSize="14sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView android:id="@+id/iv_result_bot_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bot2"
|
||||
android:layout_below="@id/tv_result_bindcard_result"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip" />
|
||||
|
||||
<TextView android:id="@+id/iv_hint_bot_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/iv_result_bot_bindcard_result"
|
||||
android:layout_marginTop="20dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" android:text="@string/upomp_bypay_bindcard_hint"
|
||||
android:textColor="#6a7482" android:textSize="14sp"/>
|
||||
|
||||
<ImageView android:id="@+id/iv_info_top_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_top2"
|
||||
android:layout_marginTop="20dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" android:layout_below="@id/iv_hint_bot_bindcard_result"/>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_card_info_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_below="@id/iv_info_top_bindcard_result"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
<RelativeLayout android:id="@+id/rl_iv_card_bindcard_result"
|
||||
android:layout_width="40dip" android:layout_height="90dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_card_info_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon3" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_card_info_content_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="90dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_card_bindcard_result">
|
||||
<RelativeLayout android:id="@+id/rl_issuercard_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="30dip"
|
||||
android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/tv_issuercard_title_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_cardinfo_issuercard"
|
||||
android:textSize="14sp" android:gravity="right"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip" />
|
||||
<TextView android:id="@+id/tv_issuercard_content_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/tv_issuercard_title_bindcard_result"
|
||||
android:textColor="#6a7482" android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
<ImageView android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" android:background="#dbdee0"
|
||||
android:layout_below="@id/rl_issuercard_bindcard_result"
|
||||
android:layout_marginRight="1dip" />
|
||||
<RelativeLayout android:id="@+id/rl_card_type_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="30dip"
|
||||
android:layout_below="@id/rl_issuercard_bindcard_result"
|
||||
android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/tv_card_type_title_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_cardtype" android:gravity="right"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:textSize="14sp" />
|
||||
<TextView android:id="@+id/tv_card_type_content_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/tv_card_type_title_bindcard_result"
|
||||
android:textColor="#6a7482" android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
<ImageView android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" android:background="#dbdee0"
|
||||
android:layout_below="@id/rl_card_type_bindcard_result"
|
||||
android:layout_marginRight="1dip" />
|
||||
<RelativeLayout android:id="@+id/rl_pan_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="30dip"
|
||||
android:layout_below="@id/rl_card_type_bindcard_result"
|
||||
android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/tv_pan_title_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_cardmainactivity_cardid"
|
||||
android:gravity="right" android:textColor="#6a7482"
|
||||
android:layout_marginLeft="5dip" android:textSize="14sp" />
|
||||
<TextView android:id="@+id/tv_pan_content_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/tv_pan_title_bindcard_result"
|
||||
android:textColor="#6a7482" android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/tv_tel_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_card_info_bindcard_result"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_iv_tel_bindcard_result"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_tel_info_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon5" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_telnum_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_tel_bindcard_result"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<TextView android:id="@+id/tv_telnum_title_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_firstmobilenum" android:gravity="right"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:textSize="14sp" />
|
||||
<TextView android:id="@+id/tv_telnum_content_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/tv_telnum_title_bindcard_result"
|
||||
android:textColor="#6a7482" android:textSize="14sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" android:background="#dbdee0"
|
||||
android:layout_marginRight="1dip" android:layout_marginLeft="1dip" />
|
||||
</RelativeLayout>
|
||||
<ImageView android:id="@+id/iv_info_bot_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bot2"
|
||||
android:layout_below="@id/tv_tel_bindcard_result"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip" />
|
||||
|
||||
|
||||
|
||||
<TextView android:id="@+id/tv_help_bot_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/iv_info_bot_bindcard_result"
|
||||
android:layout_marginTop="20dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" android:text="@string/upomp_bypay_bindcard_help"
|
||||
android:textColor="#6a7482" android:textSize="14sp"/>
|
||||
|
||||
|
||||
<Button android:id="@+id/btn_return_bindcard_result"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textSize="20sp" android:background="@drawable/upomp_bypay_btn_esc2"
|
||||
android:text="@string/upomp_bypay_return" android:textColor="#ffffff"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip"
|
||||
android:layout_marginTop="20dip" android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/tv_help_bot_bindcard_result" />
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
<com.unionpay.upomp.bypay.view.About
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true" android:paddingBottom="5dip" />
|
||||
<RelativeLayout android:id="@+id/rl_bottom_bindcard_result"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_bottom"
|
||||
android:layout_alignParentBottom="true">
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
<RelativeLayout android:id="@+id/rl_head_list_title"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dip">
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView android:id="@+id/iv_info_top_user_list_title"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_top2"
|
||||
android:layout_below="@id/rl_head_list_title" />
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_card_info_list_title"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_below="@id/iv_info_top_user_list_title">
|
||||
<RelativeLayout android:id="@+id/rl_iv_card_user_list_title"
|
||||
android:layout_width="40dip" android:layout_height="40dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_card_info_list_title"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon3" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_card_info_content_list_title"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_card_user_list_title">
|
||||
<TextView android:id="@+id/tv_card_info_content_list_title"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:textSize="14sp" android:layout_centerVertical="true"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
<ImageView android:id="@+id/iv_default_icon" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_alignParentRight="true"
|
||||
android:background="@drawable/upomp_bypay_card_icon1"
|
||||
android:layout_below="@id/rl_head_list_title" />
|
||||
<!-- default -->
|
||||
<RelativeLayout android:id="@+id/rl_default_card_list_title"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_card_info_list_title"
|
||||
android:background="@drawable/upomp_bypay_info_bg">
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_iv_default_card_list_title"
|
||||
android:layout_width="40dip" android:layout_height="40dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_default_card_content_list_title"
|
||||
android:layout_width="fill_parent" android:layout_height="40dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_default_card_list_title"
|
||||
>
|
||||
<ImageView android:id="@+id/iv_default_icon_list_title" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_icon_card"
|
||||
android:layout_marginLeft="5dip" android:layout_centerVertical="true"/>
|
||||
<TextView android:id="@+id/tv_default_card_content_list_title"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_card_btn2" android:layout_marginLeft="5dip"
|
||||
android:textColor="#6a7482" android:layout_centerVertical="true"
|
||||
android:textSize="14sp" android:layout_toRightOf="@+id/iv_default_icon_list_title"/>
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_icon_jiantou"
|
||||
android:layout_marginRight="5dip" android:layout_alignParentRight="true" android:layout_centerVertical="true"/>
|
||||
</RelativeLayout>
|
||||
<ImageView android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" android:background="#dbdee0"
|
||||
android:layout_marginRight="1dip" android:layout_marginLeft="1dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_default_card_list_title"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- del -->
|
||||
<RelativeLayout android:id="@+id/rl_del_card_list_title"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_default_card_list_title"
|
||||
android:background="@drawable/upomp_bypay_info_bg">
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_iv_del_card_list_title"
|
||||
android:layout_width="40dip" android:layout_height="40dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_del_card_content_list_title"
|
||||
android:layout_width="fill_parent" android:layout_height="40dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_del_card_list_title"
|
||||
>
|
||||
<ImageView android:id="@+id/iv_del_icon_list_title" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_icon_pw"
|
||||
android:layout_marginLeft="5dip" android:layout_centerVertical="true"/>
|
||||
<TextView android:id="@+id/tv_del_card_content_list_title"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="@string/upomp_bypay_card_btn3" android:layout_marginLeft="5dip"
|
||||
android:textColor="#6a7482" android:layout_centerVertical="true"
|
||||
android:textSize="14sp" android:layout_toRightOf="@+id/iv_del_icon_list_title"/>
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_icon_jiantou"
|
||||
android:layout_marginRight="5dip" android:layout_alignParentRight="true" android:layout_centerVertical="true"/>
|
||||
</RelativeLayout>
|
||||
<ImageView android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" android:background="#dbdee0"
|
||||
android:layout_marginRight="1dip" android:layout_marginLeft="1dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_del_card_list_title"/>
|
||||
</RelativeLayout>
|
||||
<ImageView android:id="@+id/iv_info_bot_user_list_title"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bot2"
|
||||
android:layout_below="@id/rl_del_card_list_title" />
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,301 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/rl_user_getpass" android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:layout_marginBottom="35dip"
|
||||
android:layout_marginLeft="15dip" android:layout_marginRight="15dip"
|
||||
android:layout_marginTop="35dip" android:background="@drawable/upomp_bypay_bg">
|
||||
<LinearLayout android:focusable="true"
|
||||
android:focusableInTouchMode="true" android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_header_get_pass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_title_bg">
|
||||
<Button android:id="@+id/btn_return_get_pass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_btn_title_esc"
|
||||
android:layout_alignParentRight="true" android:layout_marginRight="5dip"
|
||||
android:layout_marginTop="5dip" android:textColor="#ffffffff"
|
||||
android:text="@string/upomp_bypay_return" />
|
||||
</RelativeLayout>
|
||||
<ScrollView android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:layout_below="@id/rl_header_get_pass">
|
||||
<RelativeLayout android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- one -->
|
||||
<RelativeLayout android:id="@+id/rl_info_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dip" android:visibility="gone">
|
||||
<RelativeLayout android:id="@+id/rl_username_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<EditText android:id="@+id/et_username_getpass"
|
||||
android:singleLine="true" android:layout_width="fill_parent"
|
||||
android:layout_height="40dip" android:textColor="#000000"
|
||||
android:hint="@string/upomp_bypay_getpass_name_hint"
|
||||
android:textSize="15sp" android:background="#00000000"
|
||||
android:maxLength="20" android:layout_marginLeft="5dip" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_telnum_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_username_getpass"
|
||||
android:layout_marginTop="8dip" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<EditText android:id="@+id/et_telnum_getpass"
|
||||
android:singleLine="true" android:layout_width="fill_parent"
|
||||
android:layout_height="40dip" android:textColor="#000000"
|
||||
android:hint="@string/upomp_bypay_getpass_tel_hint"
|
||||
android:numeric="integer" android:maxLength="11" android:textSize="15sp"
|
||||
android:background="#00000000" android:layout_marginLeft="5dip" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_validcode_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_telnum_getpass"
|
||||
android:layout_marginTop="8dip" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<EditText android:id="@+id/et_validcode_getpass"
|
||||
android:singleLine="true" android:layout_width="fill_parent"
|
||||
android:layout_height="40dip" android:numeric="integer"
|
||||
android:maxLength="6" android:textColor="#000000"
|
||||
android:hint="@string/upomp_bypay_note_validate" android:textSize="15sp"
|
||||
android:background="#00000000" android:layout_marginLeft="5dip" />
|
||||
<Button android:id="@+id/btn_validcode_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="40dip"
|
||||
android:layout_alignParentRight="true" android:layout_marginLeft="5dip"
|
||||
android:background="@drawable/upomp_bypay_input_btn4"
|
||||
android:text="@string/upomp_bypay_get" android:textSize="15dip"
|
||||
android:textColor="#000000" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_webvalidcode_getpass"
|
||||
android:layout_height="wrap_content" android:layout_width="fill_parent"
|
||||
android:layout_marginTop="8dip" android:layout_alignParentRight="true"
|
||||
android:layout_below="@id/rl_validcode_getpass"
|
||||
android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<EditText android:layout_height="40dip"
|
||||
android:singleLine="true" android:id="@+id/et_webvalidcode_getpass"
|
||||
android:layout_width="120dip" android:numeric="integer"
|
||||
android:textColor="#000000" android:maxLength="4"
|
||||
android:hint="@string/upomp_bypay_image_validate"
|
||||
android:textSize="15sp" android:background="#00000000"
|
||||
android:layout_marginLeft="5dip" />
|
||||
<ImageView android:id="@+id/iv_webvalidcode_getpass"
|
||||
android:layout_height="38dip" android:layout_marginLeft="5dip"
|
||||
android:layout_width="70dip" android:layout_alignParentRight="true" />
|
||||
<ProgressBar android:id="@+id/p_webvalidcode_getpass"
|
||||
android:layout_width="30dip" android:layout_height="30dip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:indeterminateDrawable="@drawable/upomp_bypay_progress"
|
||||
android:visibility="gone" android:layout_marginLeft="30dip"
|
||||
android:layout_marginTop="5dip" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_button_next_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_webvalidcode_getpass"
|
||||
android:layout_marginTop="20dip">
|
||||
<Button android:id="@+id/btn_button_next_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_btn_enter2"
|
||||
android:layout_centerHorizontal="true" android:textSize="20sp"
|
||||
android:text="@string/upomp_bypay_next" android:textColor="#FFFFFF" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
<!-- two -->
|
||||
<RelativeLayout android:id="@+id/rl_next_getpass"
|
||||
android:visibility="visible" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:layout_marginTop="8dip"
|
||||
>
|
||||
<ImageView android:id="@+id/iv_info_top_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_top2"
|
||||
android:layout_marginTop="20dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" />
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_name_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_below="@id/iv_info_top_getpass"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
<RelativeLayout android:id="@+id/rl_iv_name_getpass"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_name_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon4" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_name_content_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_name_getpass">
|
||||
<TextView android:id="@+id/tv_name_title_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:textSize="14sp" android:layout_centerVertical="true"
|
||||
android:text="@string/upomp_bypay_getpass_name" />
|
||||
<TextView android:id="@+id/tv_name_content_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:layout_toRightOf="@+id/tv_name_title_getpass"
|
||||
android:textSize="14sp" android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/tv_tel_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_name_getpass" android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_iv_tel_getpass"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_tel_info_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon5" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_telnum_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_tel_getpass" android:gravity="center_vertical">
|
||||
<TextView android:id="@+id/tv_telnum_content_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dip"
|
||||
android:layout_centerVertical="true" android:textColor="#6a7482"
|
||||
android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
<ImageView android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" android:background="#dbdee0"
|
||||
android:layout_marginRight="1dip" android:layout_marginLeft="1dip" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView android:id="@+id/iv_info_bot_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bot2"
|
||||
android:layout_below="@id/tv_tel_getpass"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip" />
|
||||
|
||||
|
||||
<ImageView android:id="@+id/iv_question_top_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_top2"
|
||||
android:layout_marginTop="10dip" android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip" android:layout_below="@id/iv_info_bot_getpass" />
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_question_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bg"
|
||||
android:layout_below="@id/iv_question_top_getpass"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
<RelativeLayout android:id="@+id/rl_iv_question_getpass"
|
||||
android:layout_width="40dip" android:layout_height="30dip"
|
||||
|
||||
android:background="@drawable/upomp_bypay_info_left">
|
||||
<ImageView android:id="@+id/iv_question_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" android:background="@drawable/upomp_bypay_info_icon4" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_question_content_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="30dip"
|
||||
android:layout_toRightOf="@+id/rl_iv_question_getpass">
|
||||
<TextView android:id="@+id/tv_question_title_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:textSize="14sp" android:layout_centerVertical="true"
|
||||
android:text="@string/upomp_bypay_securityissue" />
|
||||
<TextView android:id="@+id/tv_question_info_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textColor="#6a7482" android:layout_marginLeft="5dip"
|
||||
android:layout_toRightOf="@+id/tv_question_title_getpass"
|
||||
android:textSize="14sp" android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView android:id="@+id/iv_question_bot_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_info_bot2"
|
||||
android:layout_below="@id/rl_question_getpass"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip" />
|
||||
|
||||
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_question_result_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dip" android:layout_below="@id/iv_question_bot_getpass"
|
||||
android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<EditText android:id="@+id/et_question_result_getpass"
|
||||
android:singleLine="true" android:layout_width="fill_parent"
|
||||
android:layout_height="40dip" android:textColor="#000000" android:layout_marginLeft="5dip"
|
||||
android:hint="@string/upomp_bypay_getpass_questionkey_hint" android:textSize="15sp"
|
||||
android:background="#00000000" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_newpass_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_question_result_getpass"
|
||||
android:layout_marginTop="8dip" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<Button android:id="@+id/btn_newpass_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="40dip"
|
||||
android:hint="@string/upomp_bypay_getpass_psw1_hint" android:textColor="#000000"
|
||||
android:gravity="left|center_vertical" android:layout_marginLeft="5dip"
|
||||
android:layout_marginRight="5dip" android:background="#00000000" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_confirm_newpass_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_newpass_getpass"
|
||||
android:layout_marginTop="8dip" android:background="@drawable/upomp_bypay_input_bg"
|
||||
android:layout_marginLeft="10dip" android:layout_marginRight="10dip">
|
||||
|
||||
<Button android:id="@+id/btn_confirm_newpass_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="40dip"
|
||||
android:hint="@string/upomp_bypay_getpass_psw2_hint" android:textColor="#000000"
|
||||
android:gravity="left|center_vertical" android:layout_marginLeft="5dip"
|
||||
android:layout_marginRight="5dip" android:background="#00000000" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_result_psw_getpass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_confirm_newpass_getpass"
|
||||
android:layout_marginTop="20dip">
|
||||
<Button android:id="@+id/btn_result_psw_getpass"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_btn_enter2"
|
||||
android:layout_centerHorizontal="true" android:text="@string/upomp_bypay_affirm"
|
||||
android:textColor="#FFFFFF" android:textSize="20sp" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</ScrollView>
|
||||
<com.unionpay.upomp.bypay.view.About
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true" android:paddingBottom="5dip" />
|
||||
<RelativeLayout android:id="@+id/main_dialog_get_pass"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_below="@id/rl_header_get_pass" android:layout_above="@+id/rl_bottom_get_pass" />
|
||||
<RelativeLayout android:id="@+id/rl_bottom_get_pass"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_bottom"
|
||||
android:layout_alignParentBottom="true">
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent">
|
||||
<LinearLayout android:focusable="true"
|
||||
android:focusableInTouchMode="true" android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
<RelativeLayout android:id="@+id/rl_bg"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:background="#77000000">
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_dialog"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_cvn2"
|
||||
android:layout_centerHorizontal="true" android:layout_centerVertical="true">
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:gravity="bottom" android:id="@+id/keyborad_view">
|
||||
<RelativeLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_keyboard_bg">
|
||||
|
||||
<RelativeLayout android:id="@+id/rl_et_psw_window"
|
||||
android:layout_marginTop="30dip" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:layout_marginLeft="5dip"
|
||||
android:layout_marginRight="5dip" android:background="@drawable/upomp_bypay_keyboard_input_bg">
|
||||
<EditText android:id="@+id/et_psw_window"
|
||||
android:singleLine="true" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:editable="false"
|
||||
android:cursorVisible="false" android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="15dip" android:password="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="#00000000" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_bg_keyboard"
|
||||
android:layout_below="@id/rl_et_psw_window" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_keyboard_pw_bg"
|
||||
android:layout_marginLeft="5dip" android:layout_marginRight="5dip"
|
||||
android:layout_marginTop="5dip">
|
||||
<LinearLayout android:id="@+id/ll_keyboard"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true">
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_key_menu"
|
||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_bg_keyboard" android:layout_marginTop="5dip"
|
||||
android:layout_marginLeft="5dip" android:layout_marginRight="5dip">
|
||||
<RelativeLayout android:id="@+id/rl_line1_menu"
|
||||
android:layout_width="225dip" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_keyboard_nav_bg">
|
||||
<Button android:id="@+id/btn_num" android:layout_width="75dip"
|
||||
android:layout_height="40dip" android:background="@drawable/upomp_bypay_keyboard_btn1_on"
|
||||
android:text="@string/upomp_bypay_keyboard_number"
|
||||
android:textColor="#FFFFFF" android:layout_centerVertical="true" />
|
||||
<Button android:id="@+id/btn_letter" android:layout_width="75dip"
|
||||
android:layout_height="40dip" android:background="#00000000"
|
||||
android:text="@string/upomp_bypay_keyboard_letter"
|
||||
android:textColor="#FFFFFF" android:layout_toRightOf="@+id/btn_num"
|
||||
android:layout_centerVertical="true" />
|
||||
<Button android:id="@+id/btn_symbol" android:layout_width="75dip"
|
||||
android:layout_height="40dip" android:background="#00000000"
|
||||
android:text="@string/upomp_bypay_keyboard_symbol"
|
||||
android:layout_centerVertical="true" android:textColor="#FFFFFF"
|
||||
android:layout_toRightOf="@+id/btn_letter" />
|
||||
</RelativeLayout>
|
||||
<Button android:id="@+id/btn_enter" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_keyboard_btn_enter"
|
||||
android:text="@string/upomp_bypay_affirm" android:textColor="#FFFFFF"
|
||||
android:layout_alignParentRight="true" android:layout_marginTop="2dip" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,126 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||
<RelativeLayout android:id="@+id/rl_letter_line1"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||
<Button android:id="@+id/btn_keyQ" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" />
|
||||
<Button android:id="@+id/btn_keyW" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyQ"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyE" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyW"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyR" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyE"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyT" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyR"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyY" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyT"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyU" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyY"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyI" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyU"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyO" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyI"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyP" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyO"
|
||||
android:layout_marginLeft="3dip" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_letter_line2"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_letter_line1" android:layout_marginTop="10dip"
|
||||
android:layout_marginLeft="17dip">
|
||||
<Button android:id="@+id/btn_keyA" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" />
|
||||
<Button android:id="@+id/btn_keyS" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyA"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyD" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyS"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyF" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyD"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyG" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyF"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyH" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyG"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyJ" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyH"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyK" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyJ"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyL" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyK"
|
||||
android:layout_marginLeft="3dip" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_letter_line3"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_letter_line2" android:layout_marginTop="10dip">
|
||||
<Button android:id="@+id/btn_letter_size" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_keyboard_letter_a1"
|
||||
android:textColor="#ffffff" />
|
||||
<Button android:id="@+id/btn_keyZ" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_letter_size"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyX" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyZ"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyC" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyX"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyV" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyC"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyB" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyV"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyN" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyB"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_keyM" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_letter"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_keyN"
|
||||
android:layout_marginLeft="3dip" />
|
||||
<Button android:id="@+id/btn_letter_backspace"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:background="@drawable/upomp_bypay_keyboard_btn_l_clear"
|
||||
android:text="@string/upomp_bypay_keyboard_clear" android:textColor="#ffffff"
|
||||
android:layout_toRightOf="@+id/btn_keyM" android:layout_marginLeft="3dip" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||
<RelativeLayout android:id="@+id/rl_line1"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||
<Button android:id="@+id/btn_key1" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" />
|
||||
<Button android:id="@+id/btn_key2" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_key1"
|
||||
android:layout_marginLeft="10dip" />
|
||||
<Button android:id="@+id/btn_key3" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_key2"
|
||||
android:layout_marginLeft="10dip" />
|
||||
<Button android:id="@+id/btn_key4" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_key3"
|
||||
android:layout_marginLeft="10dip" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_line2"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_line1" android:layout_marginTop="10dip">
|
||||
<Button android:id="@+id/btn_key5" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" />
|
||||
<Button android:id="@+id/btn_key6" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_key5"
|
||||
android:layout_marginLeft="10dip" />
|
||||
<Button android:id="@+id/btn_key7" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_key6"
|
||||
android:layout_marginLeft="10dip" />
|
||||
<Button android:id="@+id/btn_key8" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_key7"
|
||||
android:layout_marginLeft="10dip" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout android:id="@+id/rl_line3"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_line2" android:layout_marginTop="10dip">
|
||||
<Button android:id="@+id/btn_key9" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" />
|
||||
<Button android:id="@+id/btn_key0" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_btn_number"
|
||||
android:textColor="#ffffff" android:layout_toRightOf="@+id/btn_key9"
|
||||
android:layout_marginLeft="10dip" />
|
||||
<Button android:id="@+id/btn_backspace" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:background="@drawable/upomp_bypay_keyboard_btn_clear"
|
||||
android:text="@string/upomp_bypay_keyboard_clear" android:textColor="#ffffff"
|
||||
android:layout_toRightOf="@+id/btn_key0" android:layout_marginLeft="10dip" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue