GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — QuickAndroid/ActivityReader.java at master · alimogh/QuickAndroid Expand file tree/ Copy pathActivityReader.javaMore file actions 84 lines (72 loc) · 2.22 KB / Copy pathActivityReader.javaFile metadata and controls84 lines (72 loc) · 2.22 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * ActivityReader would browse the xml file and list all the view in it * @organisation: eSprinkle * @version: 1.0.3 **/ class ActivityReader{ private BufferedReader br; private List<ViewType> list; private File file; private KnownViews knownViews; private String foundView="", foundId=""; private Map<String,String> xmlMeta; ActivityReader(String fileName) throws IOException, LocalException{ validateActivityFile(fileName); list = new ArrayList<ViewType>(); br=new BufferedReader(new FileReader(file)); knownViews = new KnownViews(); xmlMeta=new HashMap<String,String>(); String line; while((line=br.readLine())!=null){ line=line.trim(); //taking class inputs if(line.indexOf("eSprinkle-quickAndroid")>-1){ String eSprinkleMeta=line.replaceAll("\\s", ""); String key=line.substring(eSprinkleMeta.indexOf(":")+2,eSprinkleMeta.indexOf("=")+1); String value=line.substring(eSprinkleMeta.indexOf("[")+2,eSprinkleMeta.indexOf("]")+1); xmlMeta.put(key, value); } if((line.indexOf("<")>-1)==true && knownViews.contains(line.substring(1)) && foundView.equals("") ){ foundView=line.substring(1); continue; } if(!foundView.equals("")){ line=line.replaceAll("\\s",""); if(line.indexOf("android:id")>-1==true){ foundId=line.substring(17,line.length()-1); continue; } //if((line.indexOf("/>")>-1)==true){ @ changed if((line.indexOf(">")>-1)==true){ if(!foundId.equals("")){ list.add(new ViewType(foundView,foundId)); } foundId=""; foundView=""; } } } } public List<ViewType> getActivityList(){ return list; } public Map<String,String> getActivityMeta(){ return xmlMeta; } private void validateActivityFile(String fileName) throws LocalException{ if(fileName==null){ throw new LocalException("ActivityReader.validateActivityFile: Activity File is null"); } file=new File(fileName); if(!file.exists()) throw new LocalException("ActivityReader.validateActivityFile: Activity File not found"); } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |