source: trunk/LogicMail/src/org/logicprobe/LogicMail/PlatformInfo.java @ 942

Revision 942, 3.8 KB checked in by octorian, 10 months ago (diff)

Initial screen factory and tree field sizing support for the Bold 9900 (refs #347)

Line 
1/*-
2 * Copyright (c) 2009, Derek Konigsberg
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the project nor the names of its
15 *    contributors may be used to endorse or promote products derived
16 *    from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 * OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31package org.logicprobe.LogicMail;
32
33import org.logicprobe.LogicMail.util.PlatformUtils;
34
35/**
36 * Provides information about the platform the application is running on,
37 * wrapping OS version specific API calls as necessary.
38 * Also used as a placeholder to make sure all the platform libraries
39 * are built correctly.
40 */
41public abstract class PlatformInfo {
42    private static PlatformInfo instance;
43
44    /**
45     * Array of concrete PlatformInfo classes, in order from the highest
46     * API version to the lowest.
47     */
48    private static String[] infoClasses = {
49        "org.logicprobe.LogicMail.PlatformInfoBB60",
50        "org.logicprobe.LogicMail.PlatformInfoBB50",
51        "org.logicprobe.LogicMail.PlatformInfoBB47",
52        "org.logicprobe.LogicMail.PlatformInfoBB46",
53        "org.logicprobe.LogicMail.PlatformInfoBB45"
54    };
55
56    /**
57     * Gets the single instance of PlatformInfo.
58     *
59     * @return instance of PlatformInfo
60     */
61    public static synchronized PlatformInfo getInstance() {
62        if(instance == null) {
63            instance = (PlatformInfo)PlatformUtils.getFactoryInstance(infoClasses);
64        }
65        return instance;
66    }
67
68    /**
69     * Gets the BlackBerry platform version.
70     *
71     * @return the platform version
72     */
73    public abstract String getPlatformVersion();
74
75    /**
76     * Checks whether the platform has support for application indicators on
77     * the device homescreen.  These should be available on any OS 4.6+ device
78     * with an appropriate build of this application.
79     *
80     * @return true, if application indicator support is available
81     */
82    public abstract boolean hasApplicationIndicators();
83   
84    /**
85     * Checks for whether the platform has a touch screen.
86     *
87     * @return true, if this is a touch screen device
88     */
89    public abstract boolean hasTouchscreen();
90
91    /**
92     * Checks for whether the platform supports a virtual keyboard.
93     *
94     * @return true, if this is a virtual keyboard device
95     */
96    public abstract boolean hasVirtualKeyboard();
97   
98    /**
99     * Gets the filesystem roots that the application can write to.
100     *
101     * @return the filesystem roots
102     */
103    public abstract String[] getFilesystemRoots();
104}
Note: See TracBrowser for help on using the repository browser.