mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +08:00
fix idgen.py for strings
This commit is contained in:
parent
54f5ccedf1
commit
505b6aac25
@ -11,7 +11,7 @@ int main(int argc,const char*argv[]){
|
||||
auto click=[](View&v){
|
||||
LOGD("You clicked Button %d",v.getId());
|
||||
};
|
||||
for(int i=0;i<10;i++){
|
||||
for(int i=0;i<30;i++){
|
||||
TextView*tv=new Button(0,0);//TextView(150,30);
|
||||
tv->setText("Hello"+std::to_string(i));
|
||||
tv->setBackgroundColor(0xFF000000|i*632);
|
||||
|
@ -35,7 +35,7 @@ int main(int argc,const char*argv[]){
|
||||
LinearLayout*layout=new LinearLayout(800,600);
|
||||
layout->setOrientation(LinearLayout::VERTICAL);
|
||||
scroller->addView(layout,new LinearLayout::LayoutParams(LayoutParams::MATCH_PARENT,(LayoutParams::MATCH_PARENT)));
|
||||
for(int i=0;i<10;i++){
|
||||
for(int i=0;i<50;i++){
|
||||
LinearLayout::LayoutParams*lp=new LinearLayout::LayoutParams(LayoutParams::MATCH_PARENT,(LayoutParams::WRAP_CONTENT));
|
||||
lp->setMargins(5,2,5,2);
|
||||
EditText*edit=new EditText("Hello world! This value is positive for typical fonts that include",680,200);
|
||||
|
@ -1,37 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
/*Generated by machine ,Do not edit!!!*/
|
||||
/*Generated by machine ,Do not edit !!!*/
|
||||
|
||||
namespace uidemo1{
|
||||
|
||||
class R{
|
||||
public:
|
||||
class id {
|
||||
public: enum{
|
||||
idno = 0x00002710 /* 10000*/,
|
||||
filename = 0x00002711 /* 10001*/,
|
||||
filesize = 0x00002712 /* 10002*/,
|
||||
icon = 0x00002713 /* 10003*/,
|
||||
address = 0x00002714 /* 10004*/,
|
||||
BtnGo = 0x00002715 /* 10005*/,
|
||||
TextUrl = 0x00002716 /* 10006*/,
|
||||
WebView01 = 0x00002717 /* 10007*/,
|
||||
editText1 = 0x00002718 /* 10008*/,
|
||||
editText2 = 0x00002719 /* 10009*/,
|
||||
button1 = 0x0000271A /* 10010*/,
|
||||
light = 0x0000271B /* 10011*/,
|
||||
tv1 = 0x0000271C /* 10012*/,
|
||||
et1 = 0x0000271D /* 10013*/,
|
||||
tv2 = 0x0000271E /* 10014*/,
|
||||
et2 = 0x0000271F /* 10015*/,
|
||||
btnadd = 0x00002720 /* 10016*/,
|
||||
table = 0x00002721 /* 10017*/,
|
||||
exitbutton = 0x00002722 /* 10018*/,
|
||||
tablayout = 0x00002723 /* 10019*/,
|
||||
viewpager = 0x00002724 /* 10020*/
|
||||
};/*enum*/};/*class*/
|
||||
namespace R{
|
||||
namespace id{
|
||||
static constexpr int idno = 0x00002710 ;/*10000*/
|
||||
static constexpr int filename = 0x00002711 ;/*10001*/
|
||||
static constexpr int filesize = 0x00002712 ;/*10002*/
|
||||
static constexpr int icon = 0x00002713 ;/*10003*/
|
||||
static constexpr int address = 0x00002714 ;/*10004*/
|
||||
static constexpr int BtnGo = 0x00002715 ;/*10005*/
|
||||
static constexpr int TextUrl = 0x00002716 ;/*10006*/
|
||||
static constexpr int WebView01 = 0x00002717 ;/*10007*/
|
||||
static constexpr int editText1 = 0x00002718 ;/*10008*/
|
||||
static constexpr int editText2 = 0x00002719 ;/*10009*/
|
||||
static constexpr int button1 = 0x0000271A ;/*10010*/
|
||||
static constexpr int light = 0x0000271B ;/*10011*/
|
||||
static constexpr int tv1 = 0x0000271C ;/*10012*/
|
||||
static constexpr int et1 = 0x0000271D ;/*10013*/
|
||||
static constexpr int tv2 = 0x0000271E ;/*10014*/
|
||||
static constexpr int et2 = 0x0000271F ;/*10015*/
|
||||
static constexpr int btnadd = 0x00002720 ;/*10016*/
|
||||
static constexpr int table = 0x00002721 ;/*10017*/
|
||||
static constexpr int exitbutton = 0x00002722 ;/*10018*/
|
||||
static constexpr int tablayout = 0x00002723 ;/*10019*/
|
||||
static constexpr int viewpager = 0x00002724 ;/*10020*/
|
||||
};/*namespace id*/
|
||||
|
||||
};//endof class R
|
||||
namespace strings{
|
||||
static constexpr int Go = 0x00002710 ;/*10000*/
|
||||
static constexpr int address = 0x00002711 ;/*10001*/
|
||||
static constexpr int webview = 0x00002712 ;/*10002*/
|
||||
static constexpr int red = 0x00002713 ;/*10003*/
|
||||
static constexpr int green = 0x00002714 ;/*10004*/
|
||||
static constexpr int blue = 0x00002715 ;/*10005*/
|
||||
static constexpr int yellow = 0x00002716 ;/*10006*/
|
||||
static constexpr int row1 = 0x00002717 ;/*10007*/
|
||||
static constexpr int row2 = 0x00002718 ;/*10008*/
|
||||
static constexpr int row3 = 0x00002719 ;/*10009*/
|
||||
static constexpr int row4 = 0x0000271A ;/*10010*/
|
||||
static constexpr int inputnum = 0x0000271B ;/*10011*/
|
||||
static constexpr int inputcolumns = 0x0000271C ;/*10012*/
|
||||
};/*namespace strings*/
|
||||
|
||||
};//endof namespace R
|
||||
|
||||
}//endof namespace
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
<EditText android:id="@+id/TextUrl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/请输入网址"
|
||||
android:hint="@string/address"
|
||||
android:layout_alignTop="@id/BtnGo"
|
||||
android:layout_toLeftOf="@id/BtnGo"/>
|
||||
</RelativeLayout>
|
||||
@ -25,7 +25,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/address"
|
||||
android:text="@string/Text view ..."/>
|
||||
android:text="@string/webview"/>
|
||||
<AnalogClock
|
||||
android:layout_width="320dp"
|
||||
android:layout_height="320dp"
|
||||
|
15
apps/uidemo1/assets/values/strings.xml
Normal file
15
apps/uidemo1/assets/values/strings.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<strings lang="zh_CN">
|
||||
<string name="Go">Go</string>
|
||||
<string name="address">address</string>
|
||||
<string name="webview">webview</string>
|
||||
<string name="red">red</string>
|
||||
<string name="green">green</string>
|
||||
<string name="blue">blue</string>
|
||||
<string name="yellow">yellow</string>
|
||||
<string name="row1">row1</string>
|
||||
<string name="row2">row2</string>
|
||||
<string name="row3">row3</string>
|
||||
<string name="row4">row4</string>
|
||||
<string name="inputnum">inputnum</string>
|
||||
<string name="inputcolumns">inputcolumns</string>
|
||||
</strings>
|
141
apps/uidemo2/R.h
141
apps/uidemo2/R.h
@ -1,79 +1,80 @@
|
||||
#pragma once
|
||||
|
||||
/*Generated by machine ,Do not edit!!!*/
|
||||
/*Generated by machine ,Do not edit !!!*/
|
||||
|
||||
namespace uidemo2{
|
||||
|
||||
class R{
|
||||
public:
|
||||
class id {
|
||||
public: enum{
|
||||
power = 0x00002710 /* 10000*/,
|
||||
devicename = 0x00002711 /* 10001*/,
|
||||
coldfan = 0x00002712 /* 10002*/,
|
||||
fanspeed = 0x00002713 /* 10003*/,
|
||||
windtype = 0x00002714 /* 10004*/,
|
||||
move = 0x00002715 /* 10005*/,
|
||||
timer = 0x00002716 /* 10006*/,
|
||||
oxygen = 0x00002717 /* 10007*/,
|
||||
emode = 0x00002718 /* 10008*/,
|
||||
hum = 0x00002719 /* 10009*/,
|
||||
ailock = 0x0000271A /* 10010*/,
|
||||
oprecords = 0x0000271B /* 10011*/,
|
||||
usermanager = 0x0000271C /* 10012*/,
|
||||
temp_down = 0x0000271D /* 10013*/,
|
||||
temp_up = 0x0000271E /* 10014*/,
|
||||
imageView1 = 0x0000271F /* 10015*/,
|
||||
open = 0x00002720 /* 10016*/,
|
||||
pause = 0x00002721 /* 10017*/,
|
||||
close = 0x00002722 /* 10018*/,
|
||||
container1 = 0x00002723 /* 10019*/,
|
||||
devicename1 = 0x00002724 /* 10020*/,
|
||||
gap = 0x00002725 /* 10021*/,
|
||||
container2 = 0x00002726 /* 10022*/,
|
||||
devicename2 = 0x00002727 /* 10023*/,
|
||||
open1 = 0x00002728 /* 10024*/,
|
||||
pause1 = 0x00002729 /* 10025*/,
|
||||
close1 = 0x0000272A /* 10026*/,
|
||||
right_panel = 0x0000272B /* 10027*/,
|
||||
title = 0x0000272C /* 10028*/,
|
||||
viewpager = 0x0000272D /* 10029*/,
|
||||
footer = 0x0000272E /* 10030*/,
|
||||
buttonContainer = 0x0000272F /* 10031*/,
|
||||
lights = 0x00002730 /* 10032*/,
|
||||
curtains = 0x00002731 /* 10033*/,
|
||||
sockets = 0x00002732 /* 10034*/,
|
||||
airconds = 0x00002733 /* 10035*/,
|
||||
tvsets = 0x00002734 /* 10036*/,
|
||||
ailocks = 0x00002735 /* 10037*/,
|
||||
hangers = 0x00002736 /* 10038*/,
|
||||
centeraircond = 0x00002737 /* 10039*/,
|
||||
music = 0x00002738 /* 10040*/,
|
||||
wind = 0x00002739 /* 10041*/,
|
||||
acfan = 0x0000273A /* 10042*/,
|
||||
dvd = 0x0000273B /* 10043*/,
|
||||
container = 0x0000273C /* 10044*/,
|
||||
leftPanel = 0x0000273D /* 10045*/,
|
||||
imageView = 0x0000273E /* 10046*/,
|
||||
listview = 0x0000273F /* 10047*/,
|
||||
addbutton = 0x00002740 /* 10048*/,
|
||||
light1 = 0x00002741 /* 10049*/,
|
||||
light2 = 0x00002742 /* 10050*/,
|
||||
light3 = 0x00002743 /* 10051*/,
|
||||
light4 = 0x00002744 /* 10052*/,
|
||||
sencetype = 0x00002745 /* 10053*/,
|
||||
gridview = 0x00002746 /* 10054*/,
|
||||
smokesensor = 0x00002747 /* 10055*/,
|
||||
powerstate = 0x00002748 /* 10056*/,
|
||||
detail = 0x00002749 /* 10057*/,
|
||||
socket = 0x0000274A /* 10058*/,
|
||||
poweron = 0x0000274B /* 10059*/,
|
||||
poweroff = 0x0000274C /* 10060*/,
|
||||
volumn_down = 0x0000274D /* 10061*/,
|
||||
volumn_up = 0x0000274E /* 10062*/
|
||||
};/*enum*/};/*class*/
|
||||
namespace R{
|
||||
namespace id{
|
||||
static constexpr int power = 0x00002710 ;/*10000*/
|
||||
static constexpr int devicename = 0x00002711 ;/*10001*/
|
||||
static constexpr int coldfan = 0x00002712 ;/*10002*/
|
||||
static constexpr int fanspeed = 0x00002713 ;/*10003*/
|
||||
static constexpr int windtype = 0x00002714 ;/*10004*/
|
||||
static constexpr int move = 0x00002715 ;/*10005*/
|
||||
static constexpr int timer = 0x00002716 ;/*10006*/
|
||||
static constexpr int oxygen = 0x00002717 ;/*10007*/
|
||||
static constexpr int emode = 0x00002718 ;/*10008*/
|
||||
static constexpr int hum = 0x00002719 ;/*10009*/
|
||||
static constexpr int ailock = 0x0000271A ;/*10010*/
|
||||
static constexpr int oprecords = 0x0000271B ;/*10011*/
|
||||
static constexpr int usermanager = 0x0000271C ;/*10012*/
|
||||
static constexpr int temp_down = 0x0000271D ;/*10013*/
|
||||
static constexpr int temp_up = 0x0000271E ;/*10014*/
|
||||
static constexpr int imageView1 = 0x0000271F ;/*10015*/
|
||||
static constexpr int open = 0x00002720 ;/*10016*/
|
||||
static constexpr int pause = 0x00002721 ;/*10017*/
|
||||
static constexpr int close = 0x00002722 ;/*10018*/
|
||||
static constexpr int container1 = 0x00002723 ;/*10019*/
|
||||
static constexpr int devicename1 = 0x00002724 ;/*10020*/
|
||||
static constexpr int gap = 0x00002725 ;/*10021*/
|
||||
static constexpr int container2 = 0x00002726 ;/*10022*/
|
||||
static constexpr int devicename2 = 0x00002727 ;/*10023*/
|
||||
static constexpr int open1 = 0x00002728 ;/*10024*/
|
||||
static constexpr int pause1 = 0x00002729 ;/*10025*/
|
||||
static constexpr int close1 = 0x0000272A ;/*10026*/
|
||||
static constexpr int right_panel = 0x0000272B ;/*10027*/
|
||||
static constexpr int title = 0x0000272C ;/*10028*/
|
||||
static constexpr int viewpager = 0x0000272D ;/*10029*/
|
||||
static constexpr int footer = 0x0000272E ;/*10030*/
|
||||
static constexpr int buttonContainer = 0x0000272F ;/*10031*/
|
||||
static constexpr int lights = 0x00002730 ;/*10032*/
|
||||
static constexpr int curtains = 0x00002731 ;/*10033*/
|
||||
static constexpr int sockets = 0x00002732 ;/*10034*/
|
||||
static constexpr int airconds = 0x00002733 ;/*10035*/
|
||||
static constexpr int tvsets = 0x00002734 ;/*10036*/
|
||||
static constexpr int ailocks = 0x00002735 ;/*10037*/
|
||||
static constexpr int hangers = 0x00002736 ;/*10038*/
|
||||
static constexpr int centeraircond = 0x00002737 ;/*10039*/
|
||||
static constexpr int music = 0x00002738 ;/*10040*/
|
||||
static constexpr int wind = 0x00002739 ;/*10041*/
|
||||
static constexpr int acfan = 0x0000273A ;/*10042*/
|
||||
static constexpr int dvd = 0x0000273B ;/*10043*/
|
||||
static constexpr int container = 0x0000273C ;/*10044*/
|
||||
static constexpr int leftPanel = 0x0000273D ;/*10045*/
|
||||
static constexpr int imageView = 0x0000273E ;/*10046*/
|
||||
static constexpr int listview = 0x0000273F ;/*10047*/
|
||||
static constexpr int addbutton = 0x00002740 ;/*10048*/
|
||||
static constexpr int light1 = 0x00002741 ;/*10049*/
|
||||
static constexpr int light2 = 0x00002742 ;/*10050*/
|
||||
static constexpr int light3 = 0x00002743 ;/*10051*/
|
||||
static constexpr int light4 = 0x00002744 ;/*10052*/
|
||||
static constexpr int sencetype = 0x00002745 ;/*10053*/
|
||||
static constexpr int gridview = 0x00002746 ;/*10054*/
|
||||
static constexpr int smokesensor = 0x00002747 ;/*10055*/
|
||||
static constexpr int powerstate = 0x00002748 ;/*10056*/
|
||||
static constexpr int detail = 0x00002749 ;/*10057*/
|
||||
static constexpr int socket = 0x0000274A ;/*10058*/
|
||||
static constexpr int poweron = 0x0000274B ;/*10059*/
|
||||
static constexpr int poweroff = 0x0000274C ;/*10060*/
|
||||
static constexpr int volumn_down = 0x0000274D ;/*10061*/
|
||||
static constexpr int volumn_up = 0x0000274E ;/*10062*/
|
||||
};/*namespace id*/
|
||||
|
||||
};//endof class R
|
||||
namespace strings{
|
||||
};/*namespace strings*/
|
||||
|
||||
};//endof namespace R
|
||||
|
||||
}//endof namespace
|
||||
|
||||
|
1
apps/uidemo2/assets/values/strings.xml
Normal file
1
apps/uidemo2/assets/values/strings.xml
Normal file
@ -0,0 +1 @@
|
||||
<strings lang="zh_CN"/>
|
@ -20,7 +20,7 @@ namespace R{
|
||||
};/*namespace id*/
|
||||
|
||||
namespace strings{
|
||||
static constexpr int optionsContainer = 0x00002710 ;/*10000*/
|
||||
static constexpr int weathertips = 0x00002710 ;/*10000*/
|
||||
};/*namespace strings*/
|
||||
|
||||
};//endof namespace R
|
||||
|
@ -1,40 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<strings lang="zh_CN">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<string name="weathertips"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<string name="weathertips">weathertips</string>
|
||||
</strings>
|
||||
|
@ -1,21 +1,23 @@
|
||||
#!/usr/bin/python
|
||||
import xml.sax
|
||||
from xml.dom import minidom
|
||||
import xml.etree.ElementTree as xmltree
|
||||
from xml.dom.minidom import parse, parseString
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
class CDROIDHandler( xml.sax.ContentHandler ):
|
||||
def __init__(self):
|
||||
def __init__(self,namespace):
|
||||
self.idlist=[]
|
||||
self.strings=[]
|
||||
self.namespace=namespace
|
||||
|
||||
def startElement(self, tag, attributes):
|
||||
for attr in attributes.getNames():
|
||||
value = attributes.get(attr)
|
||||
if ':id' in attr:
|
||||
self.addID(attributes.get(attr))
|
||||
value = attributes[attr]
|
||||
self.addID(value)
|
||||
if 'string/' in value:
|
||||
self.addString(value)
|
||||
|
||||
@ -44,23 +46,25 @@ class CDROIDHandler( xml.sax.ContentHandler ):
|
||||
return new_ids
|
||||
|
||||
class IDGenerater(object):
|
||||
def __init__(self,idstart):
|
||||
def __init__(self,idstart,namespace):
|
||||
self.idstart=idstart
|
||||
self.namespace=namespace
|
||||
self.processDirs=['layout','drawable']
|
||||
self.parser = xml.sax.make_parser()
|
||||
self.parser.setFeature(xml.sax.handler.feature_namespaces, 0)
|
||||
self.Handler = CDROIDHandler()
|
||||
self.Handler = CDROIDHandler(namespace)
|
||||
self.parser.setContentHandler( self.Handler )
|
||||
|
||||
def dict2RH(self,filepath,namespace):
|
||||
def dict2RH(self,filepath):
|
||||
fr=open(filepath,"w")
|
||||
fr.write("#pragma once\n\n")
|
||||
fr.write("/*Generated by machine ,Do not edit !!!*/\n\n")
|
||||
fr.write("namespace %s{\n\n"%(namespace))
|
||||
fr.write("namespace %s{\n\n"%(self.namespace))
|
||||
fr.write("namespace R{\n")
|
||||
fr.write(" namespace id{\n")
|
||||
i=0
|
||||
print(self.Handler.idlist)
|
||||
#print(self.Handler.idlist)
|
||||
#print(self.Handler.strings)
|
||||
for k in self.Handler.idlist:
|
||||
fr.write("%8s static constexpr int %-24s= 0x%08X ;/*%d*/\n"%('',k,self.idstart+i,self.idstart+i))
|
||||
i+=1
|
||||
@ -68,8 +72,8 @@ class IDGenerater(object):
|
||||
|
||||
fr.write(" namespace strings{\n")
|
||||
i=0
|
||||
for s in self.Handler.strings:
|
||||
fr.write("%8s static constexpr int %-24s= 0x%08X ;/*%d*/\n"%('',k,self.idstart+i,self.idstart+i))
|
||||
for ss in self.Handler.strings:
|
||||
fr.write("%8s static constexpr int %-24s= 0x%08X ;/*%d*/\n"%('',ss,self.idstart+i,self.idstart+i))
|
||||
i+=1
|
||||
fr.write("%4s};/*namespace strings*/\n\n"%(''))
|
||||
|
||||
@ -95,8 +99,36 @@ class IDGenerater(object):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def fixed_writexml(self,writer,xmlroot): #, indent, addindent, newl,encoding):
|
||||
indent=''
|
||||
addindent='\t'
|
||||
newl='\n'
|
||||
encoding='utf-8'
|
||||
writer.write(indent + "<" + xmlroot.tagName)
|
||||
|
||||
attrs = xmlroot._get_attributes()
|
||||
a_names = attrs.keys()
|
||||
|
||||
for a_name in a_names:
|
||||
writer.write(" %s=\"" % a_name)
|
||||
minidom._write_data(writer, attrs[a_name].value)
|
||||
writer.write("\"")
|
||||
if xmlroot.childNodes:
|
||||
if len(xmlroot.childNodes) == 1 \
|
||||
and xmlroot.childNodes[0].nodeType == minidom.Node.TEXT_NODE:
|
||||
writer.write(">")
|
||||
xmlroot.childNodes[0].writexml(writer, "", "", "")
|
||||
writer.write("</%s>%s" % (xmlroot.tagName, newl))
|
||||
return
|
||||
writer.write(">%s" % (newl))
|
||||
for node in xmlroot.childNodes:
|
||||
if node.nodeType is not minidom.Node.TEXT_NODE:
|
||||
node.writexml(writer, indent + addindent, addindent, newl)
|
||||
writer.write("%s</%s>%s" % (indent, xmlroot.tagName, newl))
|
||||
else:
|
||||
writer.write("/>%s" % (newl))
|
||||
|
||||
def strings2XML(self,filename):
|
||||
print "===scanned strings===\n"
|
||||
print self.Handler.strings
|
||||
if not os.path.exists(filename):
|
||||
dom=parseString('<?xml version="1.0" encoding="utf-8"?>\n<strings lang="zh_CN"></strings>')
|
||||
@ -108,13 +140,13 @@ class IDGenerater(object):
|
||||
if self.elementExists(stringsNodeInFile,str):
|
||||
continue
|
||||
e=dom.createElement('string')
|
||||
text = dom.createTextNode('')
|
||||
text = dom.createTextNode(str)
|
||||
text.text=str
|
||||
e.setAttribute('name',str)
|
||||
e.appendChild(text)
|
||||
root.appendChild(e)
|
||||
|
||||
fp = open(filename, mode='w')#, encoding='utf-8')
|
||||
dom.writexml(fp, indent='', addindent='\t', newl='\n', encoding='utf-8')
|
||||
self.fixed_writexml(fp,root)# ,indent='', addindent='\t', newl='\n', encoding='utf-8')
|
||||
fp.close()
|
||||
|
||||
def dirHasId(self,path):
|
||||
@ -156,11 +188,11 @@ if ( __name__ == "__main__"):
|
||||
if os.path.exists(sys.argv[2]):
|
||||
fstat=os.stat(sys.argv[2])
|
||||
lastmodifytime=fstat.st_mtime
|
||||
idgen=IDGenerater(idstart)
|
||||
idgen=IDGenerater(idstart,namespace)
|
||||
if not os.path.exists(sys.argv[1]+"/values"):
|
||||
os.makedirs(sys.argv[1]+"/values")
|
||||
if idgen.scanxml(sys.argv[1])>lastmodifytime:
|
||||
idgen.dict2RH(sys.argv[2],namespace)
|
||||
idgen.dict2RH(sys.argv[2])
|
||||
idgen.dict2ID(sys.argv[1]+"/values/ID.xml")
|
||||
idgen.strings2XML(sys.argv[1]+"/values/strings.xml")
|
||||
else:
|
||||
|
@ -4,8 +4,9 @@
|
||||
#define TYPE_NON_TOUCH 1
|
||||
|
||||
namespace cdroid{
|
||||
#if 10
|
||||
|
||||
NestedScrollingParentHelper::NestedScrollingParentHelper(ViewGroup* viewGroup) {
|
||||
mNestedScrollAxes=0;
|
||||
mViewGroup = viewGroup;
|
||||
}
|
||||
|
||||
@ -229,5 +230,4 @@ void NestedScrollingChildHelper::setNestedScrollingParentForType(int type, ViewG
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}/*endof namespace*/
|
||||
|
@ -11,10 +11,12 @@ DECLARE_WIDGET2(NestedScrollView,"cdroid:attr/scrollViewStyle")
|
||||
|
||||
NestedScrollView::NestedScrollView(int w,int h):FrameLayout(w,h){
|
||||
initScrollView();
|
||||
LOGD("NestedScrollView cant scroll,do not use it");
|
||||
}
|
||||
|
||||
NestedScrollView::NestedScrollView(Context* context,const AttributeSet&attrs):FrameLayout(context,attrs){
|
||||
initScrollView();
|
||||
LOGE("NestedScrollView cant scroll,do not use it");
|
||||
}
|
||||
|
||||
bool NestedScrollView::startNestedScroll(int axes, int type){
|
||||
@ -206,6 +208,7 @@ int NestedScrollView::getMaxScrollAmount() {
|
||||
void NestedScrollView::initScrollView() {
|
||||
mScroller = new OverScroller(getContext());
|
||||
setFocusable(true);
|
||||
mFillViewport =true;
|
||||
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
||||
setWillNotDraw(false);
|
||||
ViewConfiguration& configuration = ViewConfiguration::get(getContext());
|
||||
@ -213,7 +216,7 @@ void NestedScrollView::initScrollView() {
|
||||
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
|
||||
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
|
||||
|
||||
mParentHelper = new NestedScrollingParentHelper(this);
|
||||
mParentHelper= new NestedScrollingParentHelper(this);
|
||||
mChildHelper = new NestedScrollingChildHelper(this);
|
||||
setNestedScrollingEnabled(true);
|
||||
}
|
||||
@ -675,17 +678,17 @@ bool NestedScrollView::onTouchEvent(MotionEvent& ev) {
|
||||
}
|
||||
}break;
|
||||
case MotionEvent::ACTION_UP:{
|
||||
VelocityTracker* velocityTracker = mVelocityTracker;
|
||||
velocityTracker->computeCurrentVelocity(1000, mMaximumVelocity);
|
||||
int initialVelocity = (int) velocityTracker->getYVelocity(mActivePointerId);
|
||||
if ((std::abs(initialVelocity) > mMinimumVelocity)) {
|
||||
flingWithNestedDispatch(-initialVelocity);
|
||||
} else if (mScroller->springBack(getScrollX(), getScrollY(), 0, 0, 0,
|
||||
getScrollRange())) {
|
||||
this->postInvalidateOnAnimation();
|
||||
}
|
||||
mActivePointerId = INVALID_POINTER;
|
||||
endDrag();
|
||||
VelocityTracker* velocityTracker = mVelocityTracker;
|
||||
velocityTracker->computeCurrentVelocity(1000, mMaximumVelocity);
|
||||
int initialVelocity = (int) velocityTracker->getYVelocity(mActivePointerId);
|
||||
if ((std::abs(initialVelocity) > mMinimumVelocity)) {
|
||||
flingWithNestedDispatch(-initialVelocity);
|
||||
} else if (mScroller->springBack(getScrollX(), getScrollY(), 0, 0, 0,
|
||||
getScrollRange())) {
|
||||
this->postInvalidateOnAnimation();
|
||||
}
|
||||
mActivePointerId = INVALID_POINTER;
|
||||
endDrag();
|
||||
}break;
|
||||
case MotionEvent::ACTION_CANCEL:
|
||||
if (mIsBeingDragged && getChildCount() > 0) {
|
||||
@ -1406,6 +1409,7 @@ void NestedScrollView::fling(int velocityY) {
|
||||
INT_MIN, INT_MAX, // y
|
||||
0, 0); // overscroll
|
||||
mLastScrollerY = getScrollY();
|
||||
LOGD("mLastScrollerY=%d",mLastScrollerY);
|
||||
this->postInvalidateOnAnimation();
|
||||
}
|
||||
}
|
||||
@ -1415,7 +1419,7 @@ void NestedScrollView::flingWithNestedDispatch(int velocityY) {
|
||||
bool canFling = (scrollY > 0 || velocityY > 0)
|
||||
&& (scrollY < getScrollRange() || velocityY < 0);
|
||||
if (!dispatchNestedPreFling(0, velocityY)) {
|
||||
dispatchNestedFling(0, velocityY, canFling);
|
||||
dispatchNestedFling(0, velocityY, canFling);
|
||||
fling(velocityY);
|
||||
}
|
||||
}
|
||||
@ -1464,6 +1468,7 @@ void NestedScrollView::ensureGlows() {
|
||||
|
||||
void NestedScrollView::draw(Canvas& canvas) {
|
||||
FrameLayout::draw(canvas);
|
||||
LOGD("mEdgeGlowTop=%p",mEdgeGlowTop);
|
||||
if (mEdgeGlowTop != nullptr) {
|
||||
int scrollY = getScrollY();
|
||||
if (!mEdgeGlowTop->isFinished()) {
|
||||
|
@ -114,10 +114,10 @@ public:
|
||||
int getNestedScrollAxes();
|
||||
bool shouldDelayChildPressedState();
|
||||
int getMaxScrollAmount();
|
||||
View& addView(View* child);
|
||||
View& addView(View* child, int index);
|
||||
View& addView(View* child, ViewGroup::LayoutParams* params);
|
||||
View& addView(View* child, int index, ViewGroup::LayoutParams* params);
|
||||
View& addView(View* child)override;
|
||||
View& addView(View* child, int index)override;
|
||||
View& addView(View* child, ViewGroup::LayoutParams* params)override;
|
||||
View& addView(View* child, int index, ViewGroup::LayoutParams* params)override;
|
||||
void setOnScrollChangeListener(OnScrollChangeListener l);
|
||||
bool isFillViewport();
|
||||
void setFillViewport(bool fillViewport);
|
||||
@ -145,11 +145,11 @@ public:
|
||||
void computeScroll();
|
||||
void requestChildFocus(View* child, View* focused);
|
||||
bool requestChildRectangleOnScreen(View* child, Rect rectangle, bool immediate);
|
||||
void requestLayout();
|
||||
void onAttachedToWindow();
|
||||
void requestLayout()override;
|
||||
void onAttachedToWindow()override;
|
||||
void fling(int velocityY);
|
||||
void scrollTo(int x, int y);
|
||||
void draw(Canvas& canvas);
|
||||
void scrollTo(int x, int y)override;
|
||||
void draw(Canvas& canvas)override;
|
||||
};
|
||||
}/*endof namespace*/
|
||||
#endif//__NESTED_SCROLLVIEW_H__
|
||||
|
@ -40,7 +40,7 @@ endif()
|
||||
|
||||
find_package(PkgConfig)
|
||||
find_package(SDL2 REQUIRED)
|
||||
if (SDL2_FOUND)
|
||||
if (FALSE AND SDL2_FOUND)
|
||||
list(APPEND X64_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
|
||||
list(APPEND X64_LIBRARIES ${SDL2_LIBRARIES})
|
||||
list(APPEND GRAPH_SRCS graph_sdl.c)
|
||||
|
Loading…
Reference in New Issue
Block a user