add Context::getArray

This commit is contained in:
侯歌 2022-01-25 15:48:52 +08:00
parent 3ce71d25d1
commit 5ee4a2598d
20 changed files with 4322 additions and 377 deletions

View File

@ -34,17 +34,62 @@ const DisplayMetrics& Assets::getDisplayMetrics(){
return mDisplayMetrics; return mDisplayMetrics;
} }
void Assets::parseItem(const std::string&package,const std::vector<std::string>&tags,std::vector<AttributeSet>atts,const std::string&value){
const std::string&tag0=tags[0];
if(atts.size()==1){
if(tag0.compare("id")==0){
const std::string name=package+":id/"+atts.back().getString("name");
mIDS[name]=TextUtils::strtol(value);
LOGV("%s=%s",name.c_str(),value.c_str());
}else if(tag0.compare("color")==0){
const std::string name=atts[0].getString("name");
LOGV("color::%s:%s",name.c_str(),value.c_str());
}
}else if(atts.size()==2){int i=0;
if(tag0.compare("style")==0){
AttributeSet&attStyle=atts[0];
const std::string styleName =package+attStyle.getString("name");
const std::string styleParent=attStyle.getString("parent");
auto it=mStyles.find(styleName);
if(it==mStyles.end()){
it=mStyles.insert(it,std::pair<const std::string,AttributeSet>(styleName,AttributeSet()));
if(styleParent.length())it->second.add("parent",styleParent);
}
it->second.add(atts[1].getString("name"),value);
}else if(tag0.compare("array")==0){
const std::string name=atts[0].getString("name");
auto it=mArraies.find(name);
if(it==mArraies.end()){
it=mArraies.insert(it,std::pair<const std::string,std::vector<std::string>>(name,std::vector<std::string>()));
}
it->second.push_back(value);
//LOGD("tags:%s:%s",name.c_str(),value.c_str());
}
}
}
int Assets::addResource(const std::string&path,const std::string&name){ int Assets::addResource(const std::string&path,const std::string&name){
ZIPArchive*pak=new ZIPArchive(path); ZIPArchive*pak=new ZIPArchive(path);
size_t pos=name.find_last_of('/'); size_t pos=name.find_last_of('/');
std::string key=name; std::string key=name;
key=(pos!=std::string::npos)?name.substr(pos+1):name; key=(pos!=std::string::npos)?name.substr(pos+1):name;
mResources.insert(std::pair<const std::string,ZIPArchive*>(key,pak)); mResources.insert(std::pair<const std::string,ZIPArchive*>(key,pak));
LOGD("%s:%p",key.c_str(),pak);
std::vector<std::string>entries; int count=0;
pak->getEntries(entries); pak->forEachEntry([this,name,&count](const std::string&res){
LOGD("entries.count=%d pakpath=%s",entries.size(),path.c_str()); count++;
fetchIdFromResource(name+":values/ID.xml"); if(TextUtils::startWith(res,"values")){
LOGV("LoadKeyValues from:%s ...",res.c_str());
const std::string resid=name+":"+res;
loadKeyValues(resid,std::bind(&Assets::parseItem,this,name,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3));
}return 0;
});
LOGD("%s %d resource,[id:%d arraies:%d Styles:%d]",name.c_str(),count,mIDS.size(),mArraies.size(),mStyles.size());
for(auto a:mArraies){
//LOGD("Array %s",a.first.c_str());
//for (auto i:a.second)LOGD(" %s",i.c_str());
}
return pak?0:-1; return pak?0:-1;
} }
@ -109,45 +154,6 @@ std::unique_ptr<std::istream> Assets::getInputStream(const std::string&fullresid
return is; return is;
} }
int Assets::fetchIdFromResource(const std::string&fullresid){
int count=0;
std::string package;
parseResource(fullresid,nullptr,&package);
package+=":id/";
auto func=[&](const std::string&tag,const std::vector<AttributeSet>atts,const std::string&value){
if(tag.compare("id")==0){
const std::string name=package+atts.back().getString("name");
mIDS[name]=TextUtils::strtol(value);
LOGV("%s->%s",name.c_str(),value.c_str());
count++;
}
};
loadKeyValues(fullresid,func);
LOGD("load %d ids from %s",count,fullresid.c_str());
return count;
}
int Assets::fetchStyles(const std::string&fullresid){
int count=0;
std::string package;
parseResource(fullresid,nullptr,&package);
package+=":style/";
auto func=[&](const std::string&tag,std::vector<AttributeSet>atts,const std::string&value){
if(atts.size()==2){int i=0;
const std::string name=package+atts.at(0).getString("name");
auto it=mStyles.find(name);
if(it==mStyles.end())it=mStyles.insert(it,std::pair<const std::string,AttributeSet>(name,AttributeSet()));
it->second.add(atts[1].getString("name"),value);
for(auto a:atts){LOGD("%d",i++);a.dump();}
count++;
}
};
loadKeyValues(fullresid,func);
//for(auto s:mStyles){LOGD("Style %s",s.first.c_str());s.second.dump();}
LOGV("load %d Styles from %s",count,fullresid.c_str());
return count;
}
void Assets::loadStrings(const std::string&lan){ void Assets::loadStrings(const std::string&lan){
const std::string fname="strings/strings-"+lan+".json"; const std::string fname="strings/strings-"+lan+".json";
Json::CharReaderBuilder builder; Json::CharReaderBuilder builder;
@ -260,6 +266,19 @@ Drawable* Assets::getDrawable(const std::string&fullresid){
return d; return d;
} }
int Assets::getColor(const std::string&resid){
return 0;
}
int Assets::getArray(const std::string&resname,std::vector<std::string>&out){
auto it=mArraies.find(resname);
if(it!=mArraies.end()){
out=it->second;
return out.size();
}
return 0;
}
ColorStateList* Assets::getColorStateList(const std::string&fullresid){ ColorStateList* Assets::getColorStateList(const std::string&fullresid){
std::string resname; std::string resname;
ZIPArchive*pak=getResource(fullresid,&resname); ZIPArchive*pak=getResource(fullresid,&resname);
@ -275,43 +294,38 @@ ColorStateList* Assets::getColorStateList(const std::string&fullresid){
} }
typedef struct{ typedef struct{
std::vector<std::string>tags;
std::vector<AttributeSet> attrs; std::vector<AttributeSet> attrs;
std::string value; std::string content;
int level; std::function<void(const std::vector<std::string>&,const std::vector<AttributeSet>&attrs,const std::string&)>func;
std::function<void(const std::string&,const std::vector<AttributeSet>&attrs,const std::string&)>func;
}KVPARSER; }KVPARSER;
static void startElement(void *userData, const XML_Char *name, const XML_Char **satts){ static void startElement(void *userData, const XML_Char *name, const XML_Char **satts){
KVPARSER*kvp=(KVPARSER*)userData; KVPARSER*kvp=(KVPARSER*)userData;
if(strcmp(name,"resources")){//root node is not in KVPARSER::attrs if(strcmp(name,"resources")){//root node is not in KVPARSER::attrs
kvp->tags.push_back(name);
kvp->attrs.push_back(AttributeSet(satts)); kvp->attrs.push_back(AttributeSet(satts));
kvp->level++; kvp->content=std::string();
kvp->value=std::string();
}else{//strcmp(name,"resources")
//do nothing
kvp->level=0;
} }
} }
static void CharacterHandler(void *userData,const XML_Char *s, int len){ static void CharacterHandler(void *userData,const XML_Char *s, int len){
KVPARSER*kvp=(KVPARSER*)userData; KVPARSER*kvp=(KVPARSER*)userData;
kvp->value+=std::string(s,len); kvp->content+=std::string(s,len);
} }
static void endElement(void *userData, const XML_Char *name){ static void endElement(void *userData, const XML_Char *name){
KVPARSER*kvp=(KVPARSER*)userData; KVPARSER*kvp=(KVPARSER*)userData;
if(strcmp(name,"resources")){//root node is not in KVPARSER::attrs if(strcmp(name,"resources")){//root node is not in KVPARSER::attrs
TextUtils::trim(kvp->value); TextUtils::trim(kvp->content);
kvp->func(name,kvp->attrs,kvp->value); kvp->func(kvp->tags,kvp->attrs,kvp->content);
kvp->attrs.pop_back(); kvp->attrs.pop_back();
kvp->value=std::string(); kvp->tags.pop_back();
kvp->level--; kvp->content=std::string();
}else{// if(strcmp(name,"resources")==0
//kvp->func(kvp->parentAttr,name,name,INT_MIN);
} }
} }
int Assets::loadKeyValues(const std::string&fullresid,std::function<void(const std::string&, int Assets::loadKeyValues(const std::string&fullresid,std::function<void(const std::vector<std::string>&,
const std::vector<AttributeSet>&atts,const std::string&)>func){ const std::vector<AttributeSet>&atts,const std::string&)>func){
int len = 0; int len = 0;
char buf[256]; char buf[256];
@ -346,9 +360,15 @@ void Assets::clearStyles(){
} }
AttributeSet Assets::obtainStyledAttributes(const std::string&name){ AttributeSet Assets::obtainStyledAttributes(const std::string&name){
AttributeSet atts;
auto it=mStyles.find(name); auto it=mStyles.find(name);
if(it!=mStyles.end())return it->second; if(it!=mStyles.end())atts=it->second;
return AttributeSet(); const std::string parent=atts.getString("parent");
if(parent.length()){
AttributeSet parentAtts=obtainStyledAttributes(parent);
atts.inherit(parentAtts);
}
return atts;
} }
}//namespace }//namespace

View File

@ -14,20 +14,20 @@ private:
std::string mDefault;//default resource std::string mDefault;//default resource
std::map<const std::string,std::string>strings; std::map<const std::string,std::string>strings;
std::map<const std::string,int>mIDS; std::map<const std::string,int>mIDS;
std::map<const std::string,std::vector<std::string>>mArraies;
std::map<const std::string,std::weak_ptr<Drawable::ConstantState>>mDrawables; std::map<const std::string,std::weak_ptr<Drawable::ConstantState>>mDrawables;
std::map<const std::string,class ZIPArchive*>mResources; std::map<const std::string,class ZIPArchive*>mResources;
std::map<const std::string,AttributeSet>mStyles; std::map<const std::string,AttributeSet>mStyles;
void parseResource(const std::string&fullresid,std::string*res,std::string*ns)const; void parseResource(const std::string&fullresid,std::string*res,std::string*ns)const;
void parseItem(const std::string&package,const std::vector<std::string>&tag,std::vector<AttributeSet>atts,const std::string&value);
ZIPArchive*getResource(const std::string & fullresid, std::string* relativeResid)const; ZIPArchive*getResource(const std::string & fullresid, std::string* relativeResid)const;
int fetchIdFromResource(const std::string&fullresid);
int fetchStyles(const std::string&fullresid);
protected: protected:
std::string mName; std::string mName;
DisplayMetrics mDisplayMetrics; DisplayMetrics mDisplayMetrics;
void loadStrings(const std::string&lan); void loadStrings(const std::string&lan);
int addResource(const std::string&path,const std::string&name=std::string()); int addResource(const std::string&path,const std::string&name=std::string());
int loadKeyValues(const std::string&resid, int loadKeyValues(const std::string&resid,
std::function<void(const std::string&tag,const std::vector<AttributeSet>&,const std::string&)>func); std::function<void(const std::vector<std::string>&tags,const std::vector<AttributeSet>&,const std::string&)>func);
public: public:
Assets(); Assets();
Assets(const std::string&path); Assets(const std::string&path);
@ -41,6 +41,8 @@ public:
std::vector<std::string> getStringArray(const std::string&resname,const std::string&arrayname)const; std::vector<std::string> getStringArray(const std::string&resname,const std::string&arrayname)const;
std::unique_ptr<std::istream> getInputStream(const std::string&resname)override; std::unique_ptr<std::istream> getInputStream(const std::string&resname)override;
Drawable * getDrawable(const std::string&resid)override; Drawable * getDrawable(const std::string&resid)override;
int getColor(const std::string&resid)override;
int getArray(const std::string&resname,std::vector<std::string>&)override;
ColorStateList* getColorStateList(const std::string&resid)override; ColorStateList* getColorStateList(const std::string&resid)override;
AttributeSet obtainStyledAttributes(const std::string&)override; AttributeSet obtainStyledAttributes(const std::string&)override;
}; };

View File

@ -30,6 +30,8 @@ public:
Drawable* getDrawable(const AttributeSet&atts,const std::string&key){ Drawable* getDrawable(const AttributeSet&atts,const std::string&key){
return atts.hasAttribute(key)?getDrawable(atts.getString(key)):nullptr; return atts.hasAttribute(key)?getDrawable(atts.getString(key)):nullptr;
} }
virtual int getColor(const std::string&resid)=0;
virtual int getArray(const std::string&resname,std::vector<std::string>&)=0;
virtual ColorStateList* getColorStateList(const std::string&resid)=0; virtual ColorStateList* getColorStateList(const std::string&resid)=0;
virtual AttributeSet obtainStyledAttributes(const std::string&resid)=0; virtual AttributeSet obtainStyledAttributes(const std::string&resid)=0;
}; };

View File

@ -1,95 +0,0 @@
#include <theme.h>
#include <expat.h>
#include <cdtypes.h>
#include <cdlog.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string.h>
namespace cdroid{
Theme*Theme::mInst=nullptr;
Theme&Theme::getInstance(){
if(mInst==nullptr)
mInst=new Theme();
return *mInst;
}
typedef struct StyleData{
std::map<const std::string,AttributeSet>*maps;
AttributeSet*cur;
std::string key;
std::string value;
}STYLEDATA;
static void startElement(void *userData, const XML_Char *name, const XML_Char **satts){
AttributeSet atts(satts);
STYLEDATA*sd=(STYLEDATA*)userData;
std::map<const std::string,AttributeSet>*maps=sd->maps;
if(0==strcmp(name,"style")){
const std::string stylename=atts.getString("name");
const std::string parent=atts.getString("parent");
auto it=maps->find(stylename);
LOGD("<%s> parent=%s",stylename.c_str(),parent.c_str());
if(it!=maps->end()){
sd->cur=&it->second;
}else{
auto it2=maps->insert(std::make_pair<const std::string,AttributeSet>(stylename.c_str(),AttributeSet()));
sd->cur=&(it2.first->second);
if(!parent.empty())sd->cur->add("parent",parent);
}
}else if(0==strcmp(name,"item")){
sd->key = atts.getString("name");
sd->value=std::string();
}
}
static void CharacterHandler(void *userData,const XML_Char *s, int len){
STYLEDATA*sd=(STYLEDATA*)userData;
sd->value+=std::string(s,len);
}
static void endElement(void *userData, const XML_Char *name){
STYLEDATA*sd=(STYLEDATA*)userData;
std::map<const std::string,AttributeSet>*maps=sd->maps;
if(0==strcmp(name,"style")){
sd->cur=nullptr;
}else if(0==strcmp(name,"item")){
LOGV("\t%s=%s",sd->key.c_str(),sd->value.c_str());
sd->cur->add(sd->key,sd->value);
}
}
int Theme::loadStyles(std::istream&stream){
int len;
char buf[256];
XML_Parser parser=XML_ParserCreate(nullptr);
std::string curKey;
std::string curValue;
STYLEDATA sd={&mStyles,nullptr};
XML_SetUserData(parser,&sd);
XML_SetElementHandler(parser, startElement, endElement);
XML_SetCharacterDataHandler(parser,CharacterHandler);
do {
stream.read(buf,sizeof(buf));
len=stream.gcount();
if (XML_Parse(parser, buf,len,len==0) == XML_STATUS_ERROR) {
const char*es=XML_ErrorString(XML_GetErrorCode(parser));
LOGE("%s at line %ld",es, XML_GetCurrentLineNumber(parser));
XML_ParserFree(parser);
return 0;
}
} while(len!=0);
XML_ParserFree(parser);
}
const AttributeSet Theme::getStyle(const std::string&name)const{
auto it=mStyles.find(name);
if(it!=mStyles.end())
return it->second;
return AttributeSet();
}
}//namespace

View File

@ -1,23 +0,0 @@
#ifndef __THEME_STYLE_H__
#define __THEME_STYLE_H__
#include <cdtypes.h>
#include <cairomm/context.h>
#include <string>
#include <list>
#include <map>
#include <core/attributeset.h>
using namespace Cairo;
namespace cdroid{
class Theme{
protected:
std::map<const std::string,AttributeSet>mStyles;
static Theme*mInst;
public:
static Theme&getInstance();
int loadStyles(std::istream&s);
const AttributeSet getStyle(const std::string&name)const;
};
}//namespace
#endif

15
src/gui/core/ziparchive.cc Normal file → Executable file
View File

@ -24,7 +24,7 @@ ZIPArchive::~ZIPArchive(){
} }
int ZIPArchive::getEntries(std::vector<std::string>&entries)const{ int ZIPArchive::getEntries(std::vector<std::string>&entries)const{
int num=zip_get_num_entries((zip_t*)zip,ZIP_FL_UNCHANGED); const int num=zip_get_num_entries((zip_t*)zip,ZIP_FL_UNCHANGED);
for(int i=0;i<num;i++){ for(int i=0;i<num;i++){
const char*name=zip_get_name((zip_t*)zip,i,0); const char*name=zip_get_name((zip_t*)zip,i,0);
entries.push_back(name); entries.push_back(name);
@ -32,6 +32,19 @@ int ZIPArchive::getEntries(std::vector<std::string>&entries)const{
return num; return num;
} }
int ZIPArchive::forEachEntry(std::function<bool(const std::string)>func)const{
int count=0;
if(func){
const int num=zip_get_num_entries((zip_t*)zip,ZIP_FL_NODIR);
for(int i=0;i<num;i++){
const char*name=zip_get_name((zip_t*)zip,i,0);
count+=(func(name)!=false);
}
}
return count;
}
bool ZIPArchive::hasEntry(const std::string&name,bool excludeDirectories)const{ bool ZIPArchive::hasEntry(const std::string&name,bool excludeDirectories)const{
int flags=ZIP_FL_ENC_UTF_8;//DEFAULLT_ENC_FLAG; int flags=ZIP_FL_ENC_UTF_8;//DEFAULLT_ENC_FLAG;
if (excludeDirectories)flags = flags | ZIP_FL_NODIR; if (excludeDirectories)flags = flags | ZIP_FL_NODIR;

3
src/gui/private/ziparchive.h Normal file → Executable file
View File

@ -4,6 +4,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <memory> #include <memory>
#include <functional>
namespace cdroid{ namespace cdroid{
class ZIPArchive{ class ZIPArchive{
@ -15,6 +17,7 @@ public:
~ZIPArchive(); ~ZIPArchive();
void remove(const std::string&fname)const; void remove(const std::string&fname)const;
int getEntries(std::vector<std::string>&entries)const; int getEntries(std::vector<std::string>&entries)const;
int forEachEntry(std::function<bool(const std::string)>fun)const;
bool hasEntry(const std::string&name,bool excludeDirectories=false)const; bool hasEntry(const std::string&name,bool excludeDirectories=false)const;
std::istream* getInputStream(const std::string&fname)const; std::istream* getInputStream(const std::string&fname)const;
void*getZipHandle(const std::string&fname)const; void*getZipHandle(const std::string&fname)const;

50
src/gui/res/values/ID.xml Normal file → Executable file
View File

@ -1,27 +1,33 @@
<?xml version="1.0" encoding="utf-8"?><!--Generated by CDdroid's machine,Do not edit !!!--> <?xml version="1.0" encoding="utf-8"?><!--Generated by CDdroid's machine,Do not edit !!!-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<id name="increment">0x000003e8</id> <id name="parentPanel">0x000003e8</id>
<id name="numberpicker_input">0x000003e9</id> <id name="topPanel">0x000003e9</id>
<id name="decrement">0x000003ea</id> <id name="title_template">0x000003ea</id>
<id name="icon">0x000003eb</id> <id name="icon">0x000003eb</id>
<id name="parentPanel">0x000003ec</id> <id name="alertTitle">0x000003ec</id>
<id name="topPanel">0x000003ed</id> <id name="titleDivider">0x000003ed</id>
<id name="title_template">0x000003ee</id> <id name="contentPanel">0x000003ee</id>
<id name="alertTitle">0x000003ef</id> <id name="scrollView">0x000003ef</id>
<id name="titleDivider">0x000003f0</id> <id name="message">0x000003f0</id>
<id name="contentPanel">0x000003f1</id> <id name="customPanel">0x000003f1</id>
<id name="scrollView">0x000003f2</id> <id name="custom">0x000003f2</id>
<id name="message">0x000003f3</id> <id name="buttonPanel">0x000003f3</id>
<id name="customPanel">0x000003f4</id> <id name="leftSpacer">0x000003f4</id>
<id name="custom">0x000003f5</id> <id name="button1">0x000003f5</id>
<id name="buttonPanel">0x000003f6</id> <id name="button3">0x000003f6</id>
<id name="leftSpacer">0x000003f7</id> <id name="button2">0x000003f7</id>
<id name="button1">0x000003f8</id> <id name="rightSpacer">0x000003f8</id>
<id name="button3">0x000003f9</id> <id name="titleDividerNoCustom">0x000003f9</id>
<id name="button2">0x000003fa</id> <id name="text1">0x000003fa</id>
<id name="rightSpacer">0x000003fb</id> <id name="select_dialog_listview">0x000003fb</id>
<id name="background">0x000003fc</id> <id name="increment">0x000003fc</id>
<id name="progress">0x000003fd</id> <id name="numberpicker_input">0x000003fd</id>
<id name="secondaryProgress">0x000003fe</id> <id name="decrement">0x000003fe</id>
<id name="textSpacerNoTitle">0x000003ff</id>
<id name="textSpacerNoButtons">0x00000400</id>
<id name="titleDividerTop">0x00000401</id>
<id name="background">0x00000402</id>
<id name="progress">0x00000403</id>
<id name="secondaryProgress">0x00000404</id>
</resources> </resources>

238
src/gui/res/values/arrays.xml Executable file
View File

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/colors.xml
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Do not translate. These are all of the drawable resources that should be preloaded by
the zygote process before it starts forking application processes. -->
<array name="preloaded_drawables">
<item>@drawable/ab_share_pack_material</item>
<item>@drawable/ab_solid_shadow_material</item>
<item>@drawable/action_bar_item_background_material</item>
<item>@drawable/activated_background_material</item>
<item>@drawable/btn_borderless_material</item>
<item>@drawable/btn_check_material_anim</item>
<item>@drawable/btn_colored_material</item>
<item>@drawable/btn_default_material</item>
<item>@drawable/btn_group_holo_dark</item>
<item>@drawable/btn_group_holo_light</item>
<item>@drawable/btn_radio_material_anim</item>
<item>@drawable/btn_star_material</item>
<item>@drawable/btn_toggle_material</item>
<item>@drawable/button_inset</item>
<item>@drawable/cab_background_bottom_material</item>
<item>@drawable/cab_background_top_material</item>
<item>@drawable/control_background_32dp_material</item>
<item>@drawable/control_background_40dp_material</item>
<item>@drawable/dialog_background_material</item>
<item>@drawable/editbox_dropdown_background_dark</item>
<item>@drawable/edit_text_material</item>
<item>@drawable/expander_group_material</item>
<item>@drawable/fastscroll_label_left_material</item>
<item>@drawable/fastscroll_label_right_material</item>
<item>@drawable/fastscroll_thumb_material</item>
<item>@drawable/fastscroll_track_material</item>
<item>@drawable/floating_popup_background_dark</item>
<item>@drawable/floating_popup_background_light</item>
<item>@drawable/gallery_item_background</item>
<item>@drawable/ic_ab_back_material</item>
<item>@drawable/ic_ab_back_material_dark</item>
<item>@drawable/ic_ab_back_material_light</item>
<item>@drawable/ic_account_circle</item>
<item>@drawable/ic_arrow_drop_right_black_24dp</item>
<item>@drawable/ic_clear</item>
<item>@drawable/ic_clear_disabled</item>
<item>@drawable/ic_clear_material</item>
<item>@drawable/ic_clear_normal</item>
<item>@drawable/ic_commit_search_api_material</item>
<item>@drawable/ic_dialog_alert_material</item>
<item>@drawable/ic_find_next_material</item>
<item>@drawable/ic_find_previous_material</item>
<item>@drawable/ic_go</item>
<item>@drawable/ic_go_search_api_material</item>
<item>@drawable/ic_media_route_connecting_material</item>
<item>@drawable/ic_media_route_material</item>
<item>@drawable/ic_menu_close_clear_cancel</item>
<item>@drawable/ic_menu_copy_material</item>
<item>@drawable/ic_menu_cut_material</item>
<item>@drawable/ic_menu_find_material</item>
<item>@drawable/ic_menu_more</item>
<item>@drawable/ic_menu_moreoverflow_material</item>
<item>@drawable/ic_menu_paste_material</item>
<item>@drawable/ic_menu_search_material</item>
<item>@drawable/ic_menu_selectall_material</item>
<item>@drawable/ic_menu_share_material</item>
<item>@drawable/ic_search_api_material</item>
<item>@drawable/ic_voice_search_api_material</item>
<item>@drawable/indicator_check_mark_dark</item>
<item>@drawable/indicator_check_mark_light</item>
<item>@drawable/item_background_borderless_material</item>
<item>@drawable/item_background_borderless_material_dark</item>
<item>@drawable/item_background_borderless_material_light</item>
<item>@drawable/item_background_material</item>
<item>@drawable/item_background_material_dark</item>
<item>@drawable/item_background_material_light</item>
<item>@drawable/list_choice_background_material</item>
<item>@drawable/list_divider_material</item>
<item>@drawable/list_section_divider_material</item>
<item>@drawable/menu_background_fill_parent_width</item>
<item>@drawable/notification_material_action_background</item>
<item>@drawable/notification_material_media_action_background</item>
<item>@drawable/number_picker_divider_material</item>
<item>@drawable/popup_background_material</item>
<item>@drawable/popup_inline_error_above_holo_dark</item>
<item>@drawable/popup_inline_error_above_holo_light</item>
<item>@drawable/popup_inline_error_holo_dark</item>
<item>@drawable/popup_inline_error_holo_light</item>
<item>@drawable/progress_horizontal_material</item>
<item>@drawable/progress_indeterminate_horizontal_material</item>
<item>@drawable/progress_large_material</item>
<item>@drawable/progress_medium_material</item>
<item>@drawable/progress_small_material</item>
<item>@drawable/quickcontact_badge_overlay_dark</item>
<item>@drawable/quickcontact_badge_overlay_light</item>
<item>@drawable/quickcontact_badge_overlay_normal_dark</item>
<item>@drawable/quickcontact_badge_overlay_normal_light</item>
<item>@drawable/quickcontact_badge_overlay_pressed_dark</item>
<item>@drawable/quickcontact_badge_overlay_pressed_light</item>
<item>@drawable/ratingbar_indicator_material</item>
<item>@drawable/ratingbar_material</item>
<item>@drawable/ratingbar_small_material</item>
<item>@drawable/screen_background_dark</item>
<item>@drawable/screen_background_dark_transparent</item>
<item>@drawable/screen_background_light</item>
<item>@drawable/screen_background_light_transparent</item>
<item>@drawable/screen_background_selector_dark</item>
<item>@drawable/screen_background_selector_light</item>
<item>@drawable/scrollbar_handle_material</item>
<item>@drawable/seekbar_thumb_material_anim</item>
<item>@drawable/seekbar_tick_mark_material</item>
<item>@drawable/seekbar_track_material</item>
<item>@drawable/spinner_background_material</item>
<item>@drawable/spinner_textfield_background_material</item>
<item>@drawable/switch_thumb_material_anim</item>
<item>@drawable/switch_track_material</item>
<item>@drawable/tab_indicator_material</item>
<item>@drawable/text_cursor_material</item>
<item>@drawable/text_edit_paste_window</item>
<item>@drawable/textfield_search_material</item>
<item>@drawable/text_select_handle_left_material</item>
<item>@drawable/text_select_handle_middle_material</item>
<item>@drawable/text_select_handle_right_material</item>
<item>@drawable/toast_frame</item>
</array>
<!-- Do not translate. These are all of the color state list resources that should be
preloaded by the zygote process before it starts forking application processes. -->
<array name="preloaded_color_state_lists">
<item>@color/primary_text_dark</item>
<item>@color/primary_text_dark_disable_only</item>
<item>@color/primary_text_dark_nodisable</item>
<item>@color/primary_text_disable_only_holo_dark</item>
<item>@color/primary_text_disable_only_holo_light</item>
<item>@color/primary_text_holo_dark</item>
<item>@color/primary_text_holo_light</item>
<item>@color/primary_text_light</item>
<item>@color/primary_text_light_disable_only</item>
<item>@color/primary_text_light_nodisable</item>
<item>@color/primary_text_nodisable_holo_dark</item>
<item>@color/primary_text_nodisable_holo_light</item>
<item>@color/secondary_text_dark</item>
<item>@color/secondary_text_dark_nodisable</item>
<item>@color/secondary_text_holo_dark</item>
<item>@color/secondary_text_holo_light</item>
<item>@color/secondary_text_light</item>
<item>@color/secondary_text_light_nodisable</item>
<item>@color/secondary_text_nodisable_holo_dark</item>
<item>@color/secondary_text_nodisable_holo_light</item>
<item>@color/secondary_text_nofocus</item>
<item>@color/hint_foreground_dark</item>
<item>@color/hint_foreground_holo_dark</item>
<item>@color/hint_foreground_holo_light</item>
<item>@color/hint_foreground_light</item>
<item>@color/bright_foreground_light</item>
<item>@color/bright_foreground_dark</item>
<item>@color/tab_indicator_text</item>
<item>#ff000000</item>
<item>#00000000</item>
<item>#ffffffff</item>
<!-- Material color state lists -->
<item>@color/background_cache_hint_selector_material_dark</item>
<item>@color/background_cache_hint_selector_material_light</item>
<item>@color/btn_default_material_dark</item>
<item>@color/btn_default_material_light</item>
<item>@color/primary_text_disable_only_material_dark</item>
<item>@color/primary_text_disable_only_material_light</item>
<item>@color/primary_text_material_dark</item>
<item>@color/primary_text_material_light</item>
<item>@color/search_url_text_material_dark</item>
<item>@color/search_url_text_material_light</item>
</array>
<array name="preloaded_freeform_multi_window_drawables">
<item>@drawable/decor_maximize_button_dark</item>
<item>@drawable/decor_maximize_button_light</item>
</array>
<!-- Used in LocalePicker -->
<string-array translatable="false" name="special_locale_codes">
<!-- http://b/17150708 - ensure that the list of languages says "Arabic"
rather than "Arabic (Egypt)". If you're an OEM supporting multiple
Arabic locales, you should remove this entry so that ar_EG is shown
as "Arabic (Egypt)" in Settings. -->
<item>ar_EG</item>
<item>zh_CN</item>
<item>zh_TW</item>
</string-array>
<!-- Used in LocalePicker -->
<string-array translatable="false" name="special_locale_names">
<!-- http://b/17150708 - ensure that the list of languages says "Arabic"
rather than "Arabic (Egypt)". If you're an OEM supporting multiple
Arabic locales, you should remove this entry so that ar_EG is shown
as "Arabic (Egypt)" in Settings. -->
<item>العربية</item>
<item>中文 (简体)</item>
<item>中文 (繁體)</item>
</string-array>
<array name="sim_colors">
<item>@color/Teal_700</item>
<item>@color/Blue_700</item>
<item>@color/Indigo_700</item>
<item>@color/Purple_700</item>
<item>@color/Pink_700</item>
<item>@color/Red_700</item>
</array>
<!-- Used in ResolverTargetActionsDialogFragment -->
<string-array name="resolver_target_actions_pin">
<item>@string/pin_target</item>
<item>@string/app_info</item>
</string-array>
<string-array name="resolver_target_actions_unpin">
<item>@string/unpin_target</item>
<item>@string/app_info</item>
</string-array>
</resources>

80
src/gui/res/values/colors.xml Executable file
View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="safe_mode_text">#80ffffff</color>
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
<color name="red">#ffff0000</color>
<color name="transparent">#00000000</color>
<color name="background_dark">#ff000000</color>
<color name="background_light">#ffffffff</color>
<color name="bright_foreground_dark">@android:color/background_light</color>
<color name="bright_foreground_light">@android:color/background_dark</color>
<color name="bright_foreground_dark_disabled">#80ffffff</color>
<color name="bright_foreground_light_disabled">#80000000</color>
<color name="bright_foreground_dark_inverse">@android:color/bright_foreground_light</color>
<color name="bright_foreground_light_inverse">@android:color/bright_foreground_dark</color>
<color name="dim_foreground_dark">#bebebe</color>
<color name="dim_foreground_dark_disabled">#80bebebe</color>
<color name="dim_foreground_dark_inverse">#323232</color>
<color name="dim_foreground_dark_inverse_disabled">#80323232</color>
<color name="hint_foreground_dark">#808080</color>
<color name="dim_foreground_light">#323232</color>
<color name="dim_foreground_light_disabled">#80323232</color>
<color name="dim_foreground_light_inverse">#bebebe</color>
<color name="dim_foreground_light_inverse_disabled">#80bebebe</color>
<color name="hint_foreground_light">#808080</color>
<color name="highlighted_text_dark">#9983CC39</color>
<color name="highlighted_text_light">#9983CC39</color>
<color name="link_text_dark">#5c5cff</color>
<color name="link_text_light">#0000ee</color>
<color name="suggestion_highlight_text">#177bbd</color>
<!-- For settings framework -->
<color name="lighter_gray">#ddd</color>
<color name="darker_gray">#aaa</color>
<!-- For security permissions -->
<color name="perms_dangerous_grp_color">#33b5e5</color>
<color name="perms_dangerous_perm_color">#33b5e5</color>
<color name="shadow">#cc222222</color>
<!-- For search-related UIs -->
<color name="search_url_text_normal">#7fa87f</color>
<color name="search_url_text_selected">@android:color/black</color>
<color name="search_url_text_pressed">@android:color/black</color>
<color name="search_widget_corpus_item_background">@android:color/lighter_gray</color>
<!-- SlidingTab -->
<color name="sliding_tab_text_color_active">@android:color/black</color>
<color name="sliding_tab_text_color_shadow">@android:color/black</color>
<!-- keyguard tab -->
<color name="keyguard_text_color_normal">#ffffff</color>
<color name="keyguard_text_color_unlock">#a7d84c</color>
<color name="keyguard_text_color_soundoff">#ffffff</color>
<color name="keyguard_text_color_soundon">#e69310</color>
<color name="keyguard_text_color_decline">#fe0a5a</color>
<!-- keyguard clock -->
<color name="lockscreen_clock_background">#ffffffff</color>
<color name="lockscreen_clock_foreground">#ffffffff</color>
<color name="lockscreen_clock_am_pm">#ffffffff</color>
<color name="lockscreen_owner_info">#ff9a9a9a</color>
<!-- keyguard overscroll widget pager -->
<color name="kg_multi_user_text_active">#ffffffff</color>
<color name="kg_multi_user_text_inactive">#ff808080</color>
<color name="kg_widget_pager_gradient">#ffffffff</color>
<!-- LockPatternView -->
<color name="lock_pattern_view_regular_color">#ffffffff</color>
<color name="lock_pattern_view_success_color">#ffffffff</color>
<!-- FaceLock -->
<color name="facelock_spotlight_mask">#CC000000</color>
<color name="micro_text_light">#434343</color>
</resources>

3450
src/gui/res/values/config.xml Executable file

File diff suppressed because it is too large Load Diff

5
src/gui/res/values/dimens.xml Executable file
View File

@ -0,0 +1,5 @@
<resources>
<dimen name="fab_margin">16dp</dimen>
<dimen name="window_size">1080dp</dimen>
</resources>

145
src/gui/res/values/ids.xml Executable file
View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<resources>
<item type="id" name="background" />
<item type="id" name="checkbox" />
<item type="id" name="content" />
<item type="id" name="empty" />
<item type="id" name="hint" />
<item type="id" name="icon" />
<item type="id" name="icon_frame" />
<item type="id" name="icon_badge" />
<item type="id" name="icon1" />
<item type="id" name="icon2" />
<item type="id" name="input" />
<item type="id" name="left_icon" />
<item type="id" name="list" />
<item type="id" name="list_container" />
<item type="id" name="menu" />
<item type="id" name="message" />
<item type="id" name="primary" />
<item type="id" name="progress" />
<item type="id" name="right_icon" />
<item type="id" name="summary" />
<item type="id" name="selectedIcon" />
<item type="id" name="tabcontent" />
<item type="id" name="tabhost" />
<item type="id" name="tabs" />
<item type="id" name="text1" />
<item type="id" name="text2" />
<item type="id" name="title" />
<item type="id" name="title_container" />
<item type="id" name="toggle" />
<item type="id" name="secondaryProgress" />
<item type="id" name="lock_screen" />
<item type="id" name="edit" />
<item type="id" name="widget_frame" />
<item type="id" name="switch_widget" />
<item type="id" name="button1" />
<item type="id" name="button2" />
<item type="id" name="button3" />
<item type="id" name="extractArea" />
<item type="id" name="candidatesArea" />
<item type="id" name="inputArea" />
<item type="id" name="inputExtractEditText" />
<item type="id" name="selectAll" />
<item type="id" name="cut" />
<item type="id" name="copy" />
<item type="id" name="paste" />
<item type="id" name="copyUrl" />
<item type="id" name="selectTextMode" />
<item type="id" name="switchInputMethod" />
<item type="id" name="keyboardView" />
<item type="id" name="closeButton" />
<item type="id" name="startSelectingText" />
<item type="id" name="stopSelectingText" />
<item type="id" name="addToDictionary" />
<item type="id" name="accountPreferences" />
<item type="id" name="smallIcon" />
<item type="id" name="custom" />
<item type="id" name="home" />
<item type="id" name="fillInIntent" />
<item type="id" name="rowTypeId" />
<item type="id" name="up" />
<item type="id" name="action_menu_divider" />
<item type="id" name="icon_menu_presenter" />
<item type="id" name="list_menu_presenter" />
<item type="id" name="action_menu_presenter" />
<item type="id" name="overflow_menu_presenter" />
<item type="id" name="popup_submenu_presenter" />
<item type="id" name="action_bar_spinner" />
<item type="id" name="current_scene" />
<item type="id" name="scene_layoutid_cache" />
<item type="id" name="mask" />
<item type="id" name="transitionPosition" />
<item type="id" name="transitionTransform" />
<item type="id" name="parentMatrix" />
<item type="id" name="statusBarBackground" />
<item type="id" name="navigationBarBackground" />
<item type="id" name="pasteAsPlainText" />
<item type="id" name="undo" />
<item type="id" name="redo" />
<item type="id" name="replaceText" />
<item type="id" name="shareText" />
<item type="id" name="textAssist" />
<item type="id" name="selection_start_handle" />
<item type="id" name="selection_end_handle" />
<item type="id" name="insertion_handle" />
<item type="id" name="floating_toolbar_menu_item_image_button" />
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_SHOW_ON_SCREEN}. -->
<item type="id" name="accessibilityActionShowOnScreen" />
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_SCROLL_TO_POSITION}. -->
<item type="id" name="accessibilityActionScrollToPosition" />
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_SCROLL_UP}. -->
<item type="id" name="accessibilityActionScrollUp" />
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_SCROLL_LEFT}. -->
<item type="id" name="accessibilityActionScrollLeft" />
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_SCROLL_DOWN}. -->
<item type="id" name="accessibilityActionScrollDown" />
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_SCROLL_RIGHT}. -->
<item type="id" name="accessibilityActionScrollRight" />
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_SET_PROGRESS}. -->
<item type="id" name="accessibilityActionSetProgress" />
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_CONTEXT_CLICK}. -->
<item type="id" name="accessibilityActionContextClick" />
<item type="id" name="remote_input_tag" />
<item type="id" name="cross_task_transition" />
<item type="id" name="accessibilityActionClickOnClickableSpan" />
<!-- ItemTouchHelper uses this id to save a View's original elevation. -->
<item type="id" name="item_touch_helper_previous_elevation"/>
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_MOVE_WINDOW}. -->
<item type="id" name="accessibilityActionMoveWindow" />
<!-- Action used to manually trigger an autofill request -->
<item type="id" name="autofill" />
</resources>

68
src/gui/res/values/qwerty.xml Executable file
View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
keyWidth="10%p"
horizontalGap="2%p"
verticalGap="5%p"
keyHeight="20%p"
>
<Row>
<Key codes="113" keyLabel="q" keyEdgeFlags="left"/>
<Key codes="119" keyLabel="w"/>
<Key codes="101" keyLabel="e"/>
<Key codes="114" keyLabel="r"/>
<Key codes="116" keyLabel="t"/>
<Key codes="121" keyLabel="y"/>
<Key codes="117" keyLabel="u"/>
<Key codes="105" keyLabel="i"/>
<Key codes="111" keyLabel="o"/>
<Key codes="112" keyLabel="p" keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="97" keyLabel="a" horizontalGap="5%p"
keyEdgeFlags="left"/>
<Key codes="115" keyLabel="s"/>
<Key codes="100" keyLabel="d"/>
<Key codes="102" keyLabel="f"/>
<Key codes="103" keyLabel="g"/>
<Key codes="104" keyLabel="h"/>
<Key codes="106" keyLabel="j"/>
<Key codes="107" keyLabel="k"/>
<Key codes="108" keyLabel="l" keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="-1" keyIcon="cdroid:drawable/sym_keyboard_shift.png"
keyWidth="15%p" isModifier="true"
isSticky="true" keyEdgeFlags="left"/>
<Key codes="122" keyLabel="z"/>
<Key codes="120" keyLabel="x"/>
<Key codes="99" keyLabel="c"/>
<Key codes="118" keyLabel="v"/>
<Key codes="98" keyLabel="b"/>
<Key codes="110" keyLabel="n"/>
<Key codes="109" keyLabel="m"/>
<Key codes="-5" keyIcon="cdroid:drawable/sym_keyboard_delete.png"
keyWidth="15%p" keyEdgeFlags="right"
isRepeatable="true"/>
</Row>
<Row rowEdgeFlags="bottom">
<Key codes="-3" keyIcon="cdroid:drawable/sym_keyboard_done.png"
keyWidth="15%p" keyEdgeFlags="left"/>
<Key codes="-2" keyLabel="123" keyWidth="10%p"/>
<!--
codes: -101 is not a framework-defined key code but a key code that is
privately defined in com.example.android.softkeyboard.LatinKeyboardView.
-->
<Key codes="-101" keyIcon="cdroid:drawable/sym_keyboard_language_switch.png"
keyWidth="10%p"/>
<Key codes="32" keyIcon="cdroid:drawable/sym_keyboard_space.png"
keyWidth="30%p" isRepeatable="true"/>
<Key codes="46,44" keyLabel=". ,"
keyWidth="15%p"/>
<Key codes="10" keyIcon="cdroid:drawable/sym_keyboard_return.png"
keyWidth="20%p" keyEdgeFlags="right"/>
</Row>
</Keyboard>

20
src/gui/res/values/styles.xml Executable file
View File

@ -0,0 +1,20 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

87
src/gui/res/values/symbols.xml Executable file
View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
keyWidth="10%p"
horizontalGap="0px"
verticalGap="0px"
keyHeight="@dimen/key_height"
>
<Row>
<Key codes="49" keyLabel="1" keyEdgeFlags="left"/>
<Key codes="50" keyLabel="2"/>
<Key codes="51" keyLabel="3"/>
<Key codes="52" keyLabel="4"/>
<Key codes="53" keyLabel="5"/>
<Key codes="54" keyLabel="6"/>
<Key codes="55" keyLabel="7"/>
<Key codes="56" keyLabel="8"/>
<Key codes="57" keyLabel="9"/>
<Key codes="48" keyLabel="0" keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="64" keyLabel="\@" keyEdgeFlags="left"/>
<Key codes="35" keyLabel="\#"/>
<Key codes="36" keyLabel="$"/>
<Key codes="37" keyLabel="%"/>
<Key codes="38" keyLabel="&amp;"/>
<Key codes="42" keyLabel="*"/>
<Key codes="45" keyLabel="-"/>
<Key codes="61" keyLabel="="/>
<Key codes="40" keyLabel="("/>
<Key codes="41" keyLabel=")" keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="-1" keyIcon="cdroid:drawable/sym_keyboard_shift.png"
keyWidth="15%p" isModifier="true"
isSticky="true" keyEdgeFlags="left"/>
<Key codes="33" keyLabel="!" />
<Key codes="34" keyLabel="&quot;"/>
<Key codes="39" keyLabel="\'"/>
<Key codes="58" keyLabel=":"/>
<Key codes="59" keyLabel=";"/>
<Key codes="47" keyLabel="/" />
<Key codes="63" keyLabel="\?"/>
<Key codes="-5" keyIcon="cdroid:drawable/sym_keyboard_delete.png"
keyWidth="15%p" keyEdgeFlags="right"
isRepeatable="true"/>
</Row>
<Row rowEdgeFlags="bottom">
<Key codes="-3" keyIcon="cdroid:drawable/sym_keyboard_done.png"
keyWidth="15%p" keyEdgeFlags="left" />
<Key codes="-2" keyLabel="ABC" keyWidth="10%p" />
<!--
codes: -101 is not a framework-defined key code but a key code that is
privately defined in com.example.android.softkeyboard.LatinKeyboardView.
-->
<Key codes="-101" keyIcon="cdroid:drawable/sym_keyboard_language_switch.png"
keyWidth="10%p" />
<Key codes="32" keyIcon="cdroid:drawable/sym_keyboard_space" keyWidth="30%p"
isRepeatable="true"/>
<Key codes="44" keyLabel="," keyWidth="15%p" />
<Key codes="10" keyIcon="cdroid:drawable/sym_keyboard_return.png"
keyWidth="20%p" keyEdgeFlags="right"
/>
</Row>
</Keyboard>

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="@dimen/key_height"
>
<Row>
<Key codes="126" keyLabel="~" keyEdgeFlags="left"/>
<Key codes="177" keyLabel="±"/>
<Key codes="215" keyLabel="×"/>
<Key codes="247" keyLabel="÷"/>
<Key codes="8226" keyLabel="•"/>
<Key codes="176" keyLabel="°"/>
<Key codes="96" keyLabel="`"/>
<Key codes="180" keyLabel="´"/>
<Key codes="123" keyLabel="{"/>
<Key codes="125" keyLabel="}" keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="169" keyLabel="©" keyEdgeFlags="left"/>
<Key codes="163" keyLabel="£"/>
<Key codes="8364" keyLabel="€"/>
<Key codes="94" keyLabel="^"/>
<Key codes="174" keyLabel="®"/>
<Key codes="165" keyLabel="¥"/>
<Key codes="95" keyLabel="_"/>
<Key codes="43" keyLabel="+"/>
<Key codes="91" keyLabel="["/>
<Key codes="93" keyLabel="]" keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="-1" keyIcon="cdroid:drawable/sym_keyboard_shift.png"
keyWidth="15%p" isModifier="true"
isSticky="true" keyEdgeFlags="left"/>
<Key codes="161" keyLabel="¡" />
<Key codes="60" keyLabel="&lt;"/>
<Key codes="62" keyLabel="&gt;"/>
<Key codes="162" keyLabel="¢"/>
<Key codes="124" keyLabel="|"/>
<Key codes="92" keyLabel="\\" />
<Key codes="191" keyLabel="¿"/>
<Key codes="-5" keyIcon="cdroid:drawable/sym_keyboard_delete.png"
keyWidth="15%p" keyEdgeFlags="right"
isRepeatable="true"/>
</Row>
<Row rowEdgeFlags="bottom">
<Key codes="-3" keyIcon="cdroid:drawable/sym_keyboard_done.png"
keyWidth="15%p" keyEdgeFlags="left" />
<Key codes="-2" keyLabel="ABC" keyWidth="10%p" />
<!--
codes: -101 is not a framework-defined key code but a key code that is
privately defined in com.example.android.softkeyboard.LatinKeyboardView.
-->
<Key codes="-101" keyIcon="cdroid:drawable/sym_keyboard_language_switch.png"
keyWidth="10%p" />
<Key codes="32" keyIcon="cdroid:drawable/sym_keyboard_space" keyWidth="30%p"
isRepeatable="true"/>
<Key codes="8230" keyLabel="…" keyWidth="15%p" />
<Key codes="10" keyIcon="cdroid:drawable/sym_keyboard_return.png"
keyWidth="20%p" keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -1,99 +0,0 @@
#include <widget/toolbar.h>
namespace cdroid{
void ToolBar::setTitleMargin(int start, int top, int end, int bottom){
mTitleMarginStart = start;
mTitleMarginTop = top;
mTitleMarginEnd = end;
mTitleMarginBottom = bottom;
requestLayout();
}
int ToolBar::getTitleMarginStart()const{
return mTitleMarginStart;
}
void ToolBar::setTitleMarginStart(int margin) {
mTitleMarginStart = margin;
requestLayout();
}
int ToolBar::getTitleMarginTop()const {
return mTitleMarginTop;
}
void ToolBar::setTitleMarginTop(int margin) {
mTitleMarginTop = margin;
requestLayout();
}
int ToolBar::getTitleMarginEnd()const{
return mTitleMarginEnd;
}
void ToolBar::setTitleMarginEnd(int margin) {
mTitleMarginEnd = margin;
requestLayout();
}
int ToolBar::getTitleMarginBottom() const{
return mTitleMarginBottom;
}
void ToolBar::setTitleMarginBottom(int margin) {
mTitleMarginBottom = margin;
requestLayout();
}
void ToolBar::setLogo(const std::string& resId){
}
void ToolBar::setLogo(Drawable* drawable){
}
Drawable* ToolBar::getLogo() {
return mLogoView != nullptr ? mLogoView.getDrawable() : nullptr;
}
void ToolBar::setLogoDescription(const std::string& description){
if (!description.empty()) {
ensureLogoView();
}
if (mLogoView) {
mLogoView->setContentDescription(description);
}
}
std::string ToolBar::getLogoDescription()const{
return mLogoView ? mLogoView->getContentDescription() : "";
}
void ToolBar::ensureLogoView() {
if (mLogoView == nullptr) {
mLogoView = new ImageView(getContext());
}
}
bool ToolBar::hasExpandedActionView()const{
}
void ToolBar::collapseActionView(){
}
std::string ToolBar::getTitle(){
return mTitle;
}
void ToolBar::setTitle(const std::string&title){
mTitle=title;
}
}

View File

@ -1,72 +0,0 @@
#ifndef __TOOLBAR_H__
#define __TOOLBAR_H__
#include <widget/viewgroup.h>
namespace cdroid{
class ToolBar:public ViewGroup{
private:
ActionMenuView mMenuView;
TextView* mTitleTextView;
TextView* mSubtitleTextView;
ImageButton* mNavButtonView;
ImageView* mLogoView;
Drawable* mCollapseIcon;
std::string mCollapseDescription;
ImageButton* mCollapseButtonView;
View*mExpandedActionView;
int mPopupTheme;
int mTitleTextAppearance;
int mSubtitleTextAppearance;
int mNavButtonStyle;
int mButtonGravity;
int mMaxButtonHeight;
int mTitleMarginStart;
int mTitleMarginEnd;
int mTitleMarginTop;
int mTitleMarginBottom;
//RtlSpacingHelper mContentInsets;
int mContentInsetStartWithNavigation;
int mContentInsetEndWithActions;
int mGravity = Gravity::START | Gravity::CENTER_VERTICAL;
std::string mTitleText;
std::string mSubtitleText;
int mTitleTextColor;
int mSubtitleTextColor;
bool mEatingTouch;
private:
void ensureLogoView();
public:
void setTitleMargin(int start, int top, int end, int bottom);
int getTitleMarginStart()const;
void setTitleMarginStart(int margin);
int getTitleMarginTop()const;
void setTitleMarginTop(int margin);
int getTitleMarginEnd()const;
void setTitleMarginEnd(int margin);
int getTitleMarginBottom()const;
void setTitleMarginBottom(int margin);
void setLogo(const std::string& resId);
void setLogo(Drawable* drawable);
Drawable* getLogo()const;
void setLogoDescription(const std::string& description);
std::string getLogoDescription()const;
bool hasExpandedActionView()const;
void collapseActionView();
std::string getTitle()const;
void setTitle(const std::string&);
};
}//namespace
#endif

View File

@ -40,6 +40,9 @@ void ViewPager::initViewPager(){
mVelocityTracker=nullptr; mVelocityTracker=nullptr;
mScroller = new Scroller(context, mInterpolator); mScroller = new Scroller(context, mInterpolator);
mIsScrollStarted=false; mIsScrollStarted=false;
mPopulatePending=false;
mIsBeingDragged =false;
mIsUnableToDrag =false;
mScrollState = SCROLL_STATE_IDLE; mScrollState = SCROLL_STATE_IDLE;
mAdapter = nullptr; mAdapter = nullptr;
mObserver = nullptr; mObserver = nullptr;
@ -49,6 +52,11 @@ void ViewPager::initViewPager(){
mFakeDragging = false; mFakeDragging = false;
mDrawingOrder = DRAW_ORDER_DEFAULT; mDrawingOrder = DRAW_ORDER_DEFAULT;
mActivePointerId =INVALID_POINTER; mActivePointerId =INVALID_POINTER;
mExpectedAdapterCount=0;
mTopPageBounds=0;
mBottomPageBounds=0;
mLastMotionX = mLastMotionY = 0;
mInitialMotionX = mInitialMotionY = 0;
ViewConfiguration configuration = ViewConfiguration::get(context); ViewConfiguration configuration = ViewConfiguration::get(context);
const float density = context->getDisplayMetrics().density; const float density = context->getDisplayMetrics().density;
@ -69,6 +77,7 @@ void ViewPager::initViewPager(){
mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
mCloseEnough = (int) (CLOSE_ENOUGH * density); mCloseEnough = (int) (CLOSE_ENOUGH * density);
mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density); mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);
mGutterSize = 0;
} }
ViewPager::ItemInfo::ItemInfo(){ ViewPager::ItemInfo::ItemInfo(){