Rev 280 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
280 | ligi | 1 | /*************************************************************** |
2 | * |
||
3 | * Canvas of DUBwise Installer |
||
4 | * |
||
5 | * Author: Marcus -LiGi- Bueschleb |
||
6 | * Mailto: LiGi @at@ LiGi DOTT de |
||
7 | * |
||
8 | ***************************************************************/ |
||
9 | |||
10 | import javax.microedition.lcdui.*; |
||
11 | import java.io.*; |
||
12 | import javax.microedition.io.*; |
||
13 | |||
14 | public class DUBwiseInstallerCanvas |
||
15 | extends Canvas |
||
16 | implements Runnable |
||
17 | { |
||
18 | |||
19 | // values to detect |
||
20 | int canvas_width=-1; |
||
21 | int canvas_height=-1; |
||
22 | |||
23 | int canvas_full_width=-1; |
||
24 | int canvas_full_height=-1; |
||
25 | boolean fullscreen=false; |
||
26 | boolean locationprovider; |
||
27 | boolean devicecontrol; |
||
28 | boolean bluetooth; |
||
29 | boolean cldc11; |
||
30 | boolean fileapi; |
||
31 | |||
316 | ligi | 32 | boolean sensorapi; |
33 | |||
34 | |||
280 | ligi | 35 | String comports; |
36 | String props; |
||
37 | // end values to detect |
||
38 | |||
39 | DUBwiseInstaller root; |
||
40 | |||
41 | public boolean try_class(String class_name) |
||
42 | { |
||
43 | try |
||
44 | { |
||
45 | Class.forName(class_name); |
||
46 | } |
||
47 | |||
48 | catch (Exception e) |
||
49 | { |
||
50 | return false; |
||
51 | } |
||
52 | return true; |
||
53 | } |
||
54 | public DUBwiseInstallerCanvas(DUBwiseInstaller _root) |
||
55 | |||
56 | { |
||
57 | root=_root; |
||
58 | new Thread(this).start(); |
||
59 | } |
||
60 | |||
61 | |||
62 | public void run() |
||
63 | { |
||
64 | |||
65 | repaint(); |
||
66 | serviceRepaints(); |
||
67 | |||
68 | try |
||
69 | { |
||
70 | Thread.sleep(500); |
||
71 | } |
||
72 | catch (Exception e) |
||
73 | {} |
||
74 | |||
75 | locationprovider=try_class("javax.microedition.location.LocationProvider");; |
||
76 | devicecontrol=try_class("com.nokia.mid.ui.DeviceControl"); |
||
77 | bluetooth=try_class("javax.bluetooth.DiscoveryAgent"); |
||
78 | cldc11=try_class("java.lang.Math"); |
||
79 | fileapi=try_class("javax.microedition.io.file.FileConnection"); |
||
80 | comports=System.getProperty("microedition.commports")+"\n"; |
||
316 | ligi | 81 | sensorapi=try_class("javax.microedition.sensor.SensorManager"); |
82 | |||
280 | ligi | 83 | props="enc: " +System.getProperty("microedition.encoding")+"\n"; |
84 | props+="platform: " +System.getProperty("microedition.platform")+"\n"; |
||
85 | props+="locale: " +System.getProperty("microedition.locale")+"\n"; |
||
86 | props+="config:" + System.getProperty("microedition.configuration")+"\n"; |
||
87 | props+="profiles: " +System.getProperty("microedition.profiles")+"\n"; |
||
88 | props+="hostname: " +System.getProperty("microedition.hostname")+"\n"; |
||
316 | ligi | 89 | props+="loc-version: " +System.getProperty("microedition.location.version")+"\n"; |
280 | ligi | 90 | |
316 | ligi | 91 | props+="sensor-api-version: " +System.getProperty("microedition.sensor.version")+"\n"; |
280 | ligi | 92 | |
316 | ligi | 93 | |
94 | // test for symbian src: http://discussion.forum.nokia.com/forum/showthread.php?t=96615 |
||
95 | try { |
||
96 | Class.forName("com.symbian.gcf.NativeInputStream"); |
||
97 | props+="symbian: true\n"; |
||
98 | } |
||
99 | catch (ClassNotFoundException e) { |
||
100 | props+="symbian: false\n"; |
||
101 | } |
||
280 | ligi | 102 | root.quit(); |
103 | |||
104 | } |
||
105 | |||
106 | |||
107 | boolean fs_check=true; |
||
108 | |||
109 | public void paint(Graphics g) |
||
110 | { |
||
111 | |||
112 | if (fs_check) try |
||
113 | { |
||
114 | |||
115 | setFullScreenMode(false); |
||
116 | canvas_width=this.getWidth(); |
||
117 | canvas_height=this.getHeight(); |
||
118 | |||
119 | setFullScreenMode(true); |
||
120 | canvas_full_width=this.getWidth(); |
||
121 | canvas_full_height=this.getHeight(); |
||
122 | |||
123 | fullscreen=((canvas_full_width!=canvas_width)||(canvas_full_height!=canvas_height)); |
||
124 | } |
||
125 | catch (Exception e) |
||
126 | { |
||
127 | canvas_width=this.getWidth(); |
||
128 | canvas_height=this.getHeight(); |
||
129 | canvas_full_width=this.getWidth(); |
||
130 | canvas_full_height=this.getHeight(); |
||
131 | |||
132 | } |
||
133 | |||
134 | fs_check=false; |
||
135 | g.setColor(0); |
||
136 | g.fillRect(0,0,canvas_full_width,canvas_full_height); |
||
137 | g.setColor(0x00BB00); |
||
138 | g.drawString("Detecting Hardware",0,0,Graphics.LEFT | Graphics.TOP); |
||
139 | |||
140 | } |
||
141 | } |