···11+/*-
22+ * Copyright (c) 2010, Derek Konigsberg
33+ * All rights reserved.
44+ *
55+ * Redistribution and use in source and binary forms, with or without
66+ * modification, are permitted provided that the following conditions
77+ * are met:
88+ *
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ * 3. Neither the name of the project nor the names of its
1515+ * contributors may be used to endorse or promote products derived
1616+ * from this software without specific prior written permission.
1717+ *
1818+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1919+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2020+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2121+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2222+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2323+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2424+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2525+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2626+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2727+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2828+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
2929+ * OF THE POSSIBILITY OF SUCH DAMAGE.
3030+ */
3131+package org.logicprobe.LogicMail;
3232+3333+public class PlatformInfoBB60 extends PlatformInfoBB50 {
3434+3535+}
···11+/*-
22+ * Copyright (c) 2010, Derek Konigsberg
33+ * All rights reserved.
44+ *
55+ * Redistribution and use in source and binary forms, with or without
66+ * modification, are permitted provided that the following conditions
77+ * are met:
88+ *
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ * 3. Neither the name of the project nor the names of its
1515+ * contributors may be used to endorse or promote products derived
1616+ * from this software without specific prior written permission.
1717+ *
1818+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1919+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2020+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2121+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2222+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2323+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2424+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2525+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2626+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2727+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2828+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
2929+ * OF THE POSSIBILITY OF SUCH DAMAGE.
3030+ */
3131+package org.logicprobe.LogicMail.ui;
3232+3333+public class ScreenFactoryBB60 extends ScreenFactoryBB50 {
3434+3535+ protected StandardScreen getStandardTouchScreen(NavigationController navigationController, ScreenProvider screenProvider) {
3636+ return new StandardTouchScreenBB60(navigationController, screenProvider);
3737+ }
3838+}
···11+/*-
22+ * Copyright (c) 2010, Derek Konigsberg
33+ * All rights reserved.
44+ *
55+ * Redistribution and use in source and binary forms, with or without
66+ * modification, are permitted provided that the following conditions
77+ * are met:
88+ *
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ * 3. Neither the name of the project nor the names of its
1515+ * contributors may be used to endorse or promote products derived
1616+ * from this software without specific prior written permission.
1717+ *
1818+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1919+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2020+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2121+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2222+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2323+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2424+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2525+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2626+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2727+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2828+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
2929+ * OF THE POSSIBILITY OF SUCH DAMAGE.
3030+ */
3131+package org.logicprobe.LogicMail.ui;
3232+3333+import org.logicprobe.LogicMail.LogicMailResource;
3434+3535+import net.rim.device.api.ui.Field;
3636+import net.rim.device.api.ui.component.StandardTitleBar;
3737+3838+public class StandardScreenBB60 extends StandardScreen {
3939+4040+ public StandardScreenBB60(NavigationController navigationController, ScreenProvider screenProvider) {
4141+ super(navigationController, screenProvider);
4242+ }
4343+4444+ protected Field createTitleField() {
4545+ StandardTitleBar titlebarField = new StandardTitleBar();
4646+ titlebarField.addTitle(
4747+ resources.getString(LogicMailResource.APPNAME)
4848+ + " - "
4949+ + screenProvider.getTitle());
5050+ titlebarField.addSignalIndicator();
5151+ titlebarField.setPropertyValue(
5252+ StandardTitleBar.PROPERTY_BATTERY_VISIBILITY,
5353+ StandardTitleBar.BATTERY_VISIBLE_ALWAYS);
5454+ return titlebarField;
5555+ }
5656+5757+ protected void cleanupTitleField(Field titleField) {
5858+ // System title field does not require cleanup
5959+ }
6060+}
···11+/*-
22+ * Copyright (c) 2010, Derek Konigsberg
33+ * All rights reserved.
44+ *
55+ * Redistribution and use in source and binary forms, with or without
66+ * modification, are permitted provided that the following conditions
77+ * are met:
88+ *
99+ * 1. Redistributions of source code must retain the above copyright
1010+ * notice, this list of conditions and the following disclaimer.
1111+ * 2. Redistributions in binary form must reproduce the above copyright
1212+ * notice, this list of conditions and the following disclaimer in the
1313+ * documentation and/or other materials provided with the distribution.
1414+ * 3. Neither the name of the project nor the names of its
1515+ * contributors may be used to endorse or promote products derived
1616+ * from this software without specific prior written permission.
1717+ *
1818+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1919+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2020+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2121+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2222+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2323+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2424+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2525+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2626+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2727+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2828+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
2929+ * OF THE POSSIBILITY OF SUCH DAMAGE.
3030+ */
3131+package org.logicprobe.LogicMail.ui;
3232+3333+import net.rim.device.api.command.AlwaysExecutableCommand;
3434+import net.rim.device.api.command.Command;
3535+import net.rim.device.api.command.ReadOnlyCommandMetadata;
3636+import net.rim.device.api.system.Bitmap;
3737+import net.rim.device.api.ui.image.ImageFactory;
3838+import net.rim.device.api.ui.toolbar.ToolbarButtonField;
3939+import net.rim.device.api.ui.toolbar.ToolbarManager;
4040+import net.rim.device.api.ui.toolbar.ToolbarSpacer;
4141+import net.rim.device.api.util.IntHashtable;
4242+import net.rim.device.api.util.StringProvider;
4343+4444+import org.logicprobe.LogicMail.ui.ScreenProvider.ShortcutItem;
4545+4646+public class StandardTouchScreenBB60 extends StandardScreenBB60 {
4747+ private ToolbarManager toolbarManager;
4848+ private IntHashtable shortcutIdMap;
4949+5050+ public StandardTouchScreenBB60(NavigationController navigationController, ScreenProvider screenProvider) {
5151+ super(navigationController, screenProvider);
5252+5353+ if(screenProvider.hasShortcuts()) {
5454+ ShortcutItem[] shortcuts = screenProvider.getShortcuts();
5555+ if(shortcuts != null) {
5656+ initializeShortcutBar(shortcuts);
5757+ }
5858+ }
5959+ }
6060+6161+ private void initializeShortcutBar(ShortcutItem[] shortcuts) {
6262+ shortcutIdMap = new IntHashtable(5);
6363+ toolbarManager = new ToolbarManager();
6464+ int len = Math.min(shortcuts.length, 5);
6565+ for(int i=0; i<len; i++) {
6666+ ToolbarButtonField button;
6767+ if(shortcuts[i] == null) {
6868+ button = new ToolbarSpacer(i);
6969+ }
7070+ else {
7171+ button = new ToolbarButtonField(
7272+ ImageFactory.createImage(
7373+ Bitmap.getBitmapResource(shortcuts[i].getEnabledIcon())),
7474+ new StringProvider(shortcuts[i].getName()), i);
7575+ button.setEnabled(true);
7676+ button.setCommand(new Command(new ShortcutCommand(shortcuts[i])));
7777+ shortcutIdMap.put(shortcuts[i].getId(), button);
7878+ }
7979+ toolbarManager.add(button);
8080+ }
8181+ setStatus(toolbarManager);
8282+8383+ }
8484+8585+ /* (non-Javadoc)
8686+ * @see org.logicprobe.LogicMail.ui.StandardScreen#isShortcutEnabled(int)
8787+ */
8888+ public boolean isShortcutEnabled(int id) {
8989+ boolean result = false;
9090+ if(shortcutIdMap != null) {
9191+ Object value = shortcutIdMap.get(id);
9292+ if(value instanceof ToolbarButtonField) {
9393+ result = ((ToolbarButtonField)value).isEnabled();
9494+ }
9595+ }
9696+ return result;
9797+ }
9898+9999+ /* (non-Javadoc)
100100+ * @see org.logicprobe.LogicMail.ui.StandardScreen#setShortcutEnabled(int, boolean)
101101+ */
102102+ public void setShortcutEnabled(int id, boolean enabled) {
103103+ if(shortcutIdMap != null) {
104104+ Object value = shortcutIdMap.get(id);
105105+ if(value instanceof ToolbarButtonField) {
106106+ ((ToolbarButtonField)value).setEnabled(enabled);
107107+ }
108108+ }
109109+ }
110110+111111+ private class ShortcutCommand extends AlwaysExecutableCommand {
112112+ private final ShortcutItem item;
113113+114114+ public ShortcutCommand(ShortcutItem item) {
115115+ this.item = item;
116116+ }
117117+118118+ public void execute(ReadOnlyCommandMetadata metadata, Object context) {
119119+ screenProvider.shortcutAction(item);
120120+ }
121121+ }
122122+}