Rev 316 | Go to most recent revision | Details | 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 | |||
32 | String comports; |
||
33 | String props; |
||
34 | // end values to detect |
||
35 | |||
36 | DUBwiseInstaller root; |
||
37 | |||
38 | public boolean try_class(String class_name) |
||
39 | { |
||
40 | try |
||
41 | { |
||
42 | Class.forName(class_name); |
||
43 | } |
||
44 | |||
45 | catch (Exception e) |
||
46 | { |
||
47 | return false; |
||
48 | } |
||
49 | return true; |
||
50 | } |
||
51 | public DUBwiseInstallerCanvas(DUBwiseInstaller _root) |
||
52 | |||
53 | { |
||
54 | root=_root; |
||
55 | new Thread(this).start(); |
||
56 | } |
||
57 | |||
58 | |||
59 | public void run() |
||
60 | { |
||
61 | |||
62 | repaint(); |
||
63 | serviceRepaints(); |
||
64 | |||
65 | try |
||
66 | { |
||
67 | Thread.sleep(500); |
||
68 | } |
||
69 | catch (Exception e) |
||
70 | {} |
||
71 | |||
72 | locationprovider=try_class("javax.microedition.location.LocationProvider");; |
||
73 | devicecontrol=try_class("com.nokia.mid.ui.DeviceControl"); |
||
74 | bluetooth=try_class("javax.bluetooth.DiscoveryAgent"); |
||
75 | cldc11=try_class("java.lang.Math"); |
||
76 | fileapi=try_class("javax.microedition.io.file.FileConnection"); |
||
77 | comports=System.getProperty("microedition.commports")+"\n"; |
||
78 | props="enc: " +System.getProperty("microedition.encoding")+"\n"; |
||
79 | props+="platform: " +System.getProperty("microedition.platform")+"\n"; |
||
80 | props+="locale: " +System.getProperty("microedition.locale")+"\n"; |
||
81 | props+="config:" + System.getProperty("microedition.configuration")+"\n"; |
||
82 | props+="profiles: " +System.getProperty("microedition.profiles")+"\n"; |
||
83 | props+="hostname: " +System.getProperty("microedition.hostname")+"\n"; |
||
84 | props+="loc-version: " +System.getProperty("microedition.location.version ")+"\n"; |
||
85 | |||
86 | |||
87 | root.quit(); |
||
88 | |||
89 | } |
||
90 | |||
91 | |||
92 | boolean fs_check=true; |
||
93 | |||
94 | public void paint(Graphics g) |
||
95 | { |
||
96 | |||
97 | if (fs_check) try |
||
98 | { |
||
99 | |||
100 | setFullScreenMode(false); |
||
101 | canvas_width=this.getWidth(); |
||
102 | canvas_height=this.getHeight(); |
||
103 | |||
104 | setFullScreenMode(true); |
||
105 | canvas_full_width=this.getWidth(); |
||
106 | canvas_full_height=this.getHeight(); |
||
107 | |||
108 | fullscreen=((canvas_full_width!=canvas_width)||(canvas_full_height!=canvas_height)); |
||
109 | } |
||
110 | catch (Exception e) |
||
111 | { |
||
112 | canvas_width=this.getWidth(); |
||
113 | canvas_height=this.getHeight(); |
||
114 | canvas_full_width=this.getWidth(); |
||
115 | canvas_full_height=this.getHeight(); |
||
116 | |||
117 | } |
||
118 | |||
119 | fs_check=false; |
||
120 | g.setColor(0); |
||
121 | g.fillRect(0,0,canvas_full_width,canvas_full_height); |
||
122 | g.setColor(0x00BB00); |
||
123 | g.drawString("Detecting Hardware",0,0,Graphics.LEFT | Graphics.TOP); |
||
124 | |||
125 | } |
||
126 | } |