Subversion Repositories Projects

Rev

Rev 280 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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