public void commandAction(Command cmd, Displayable d) { if (d == Dialogs.mErrorD) { mMidlet.setTopViewCurrent(); } else if (cmd == DELETE) { ShortcutItem item = (ShortcutItem) mShortcutList.getFocusedItem(); item.shortcut.action = 0; createShortcutsTab(); } else if (cmd == OK || cmd == CANCEL) { if (cmd == OK) { // save the current shortcut int button = mSelectedShortcut.shortcut.button; // #debug System.out.println("saving shortcut " + button); Shortcut s = mSettings.getShortcut(button); s.copy(mSelectedShortcut.shortcut); } createShortcutsTab(); } else { try { mSettings.flush(); mMidlet.setTopViewCurrent(); } catch (IOException e) { Dialogs.popupErrorDialog(mMidlet, this, Locale.get("error.FailedToSaveSettings")); } } }
private void itemStateChangedGeneralTab(Item item) { ChoiceGroup cg = (ChoiceGroup) item; if (cg == mKeepSignedInCG) { mSettings.setKeepSignedIn(cg.isSelected(0)); } else if (cg == mCacheContactsCG) { mSettings.setCacheContacts(cg.isSelected(0)); } else if (cg == mPreloadContactsCG) { mSettings.setPreloadContacts(cg.isSelected(0)); } else if (cg == mDelWOConfCG) { setDelWOConfCG(cg.isSelected(0)); } else if (cg == mDelWOConfSubCG) { mSettings.setDelWOCConv(mDWOCConvCI.isSelected); mSettings.setDelWOCMsg(mDWOCMsgCI.isSelected); } }
private void setDelWOConfCG(boolean selected) { // TODO Hack around J2ME Polish bug that cause the items to not get focus when // re-enabled mDelWOConfSubCG.deleteAll(); if (selected) { // #style ChoiceItem UiAccess.setAccessible(mDWOCConvCI, true); // #style ChoiceItem UiAccess.setAccessible(mDWOCMsgCI, true); } else { // #style ChoiceItemDisabled UiAccess.setAccessible(mDWOCConvCI, false); // #style ChoiceItemDisabled UiAccess.setAccessible(mDWOCMsgCI, false); } // TODO Continue of hack above // #if true // # mDelWOConfSubCG.append(mDWOCConvCI); // # mDelWOConfSubCG.append(mDWOCMsgCI); // #endif mSettings.setDelWOConf(selected); }
private void initDisplayTab() { mTickerCG.setSelectedIndex(TICKER_CONV, mSettings.getShowConvTicker()); mTickerCG.setSelectedIndex(TICKER_MSG, mSettings.getShowMsgTicker()); mTickerCG.setSelectedIndex(TICKER_APPT, mSettings.getShowApptTicker()); switch (mSettings.getTickerSpeed()) { case Settings.SLOW_TICKER: mTickerSpeedCG.setSelectedIndex(TICKER_SLOW, true); break; case Settings.MED_TICKER: mTickerSpeedCG.setSelectedIndex(TICKER_MED, true); break; case Settings.FAST_TICKER: mTickerSpeedCG.setSelectedIndex(TICKER_FAST, true); break; } }
private void createGeneralTab() { TabbedForm f = null; // #if true // # f = (TabbedForm)mView; // #endif // #style ChoiceGroup mKeepSignedInCG = new ChoiceGroup("", ChoiceGroup.MULTIPLE); // #style ChoiceItem mKeepSignedInCG.append(Locale.get("login.KeepSignedIn"), null); f.append(GENERAL_TAB, mKeepSignedInCG); // #style ChoiceGroup mCacheContactsCG = new ChoiceGroup("", ChoiceGroup.MULTIPLE); // #style ChoiceItem mCacheContactsCG.append(Locale.get("settings.CacheContacts"), null); /* TODO Add this in later f.append(GENERAL_TAB, mCacheContactsCG); */ // ========== Preload Contacts // #style ChoiceGroup mPreloadContactsCG = new ChoiceGroup("", ChoiceGroup.MULTIPLE); // #style ChoiceItem mPreloadContactsCG.append(Locale.get("settings.PreloadContacts"), null); f.append(GENERAL_TAB, mPreloadContactsCG); // ========== Delete w/o confirmation boolean delWOC = mSettings.getDelWOConf(); // #style ChoiceGroupOffset mDelWOConfCG = new ChoiceGroup("", ChoiceGroup.MULTIPLE); // #style ChoiceItem mDelWOConfCG.append(Locale.get("settings.DelWOConf"), null); mDelWOConfCG.setSelectedIndex(0, delWOC); f.append(GENERAL_TAB, mDelWOConfCG); // #style ChoiceGroupIndented mDelWOConfSubCG = new ChoiceGroup("", ChoiceGroup.MULTIPLE); // #style ChoiceItem mDWOCConvCI = new ChoiceItem(Locale.get("settings.Conversations"), null, Choice.MULTIPLE); // #style ChoiceItem mDWOCMsgCI = new ChoiceItem(Locale.get("settings.Messages"), null, Choice.MULTIPLE); f.append(GENERAL_TAB, mDelWOConfSubCG); // TODO remove when Polish fixes bug that causes layout/highlighting weirdness if the below is // removed // #style Spacer StringItem s = new StringItem(null, ""); f.append(GENERAL_TAB, s); }
private void initGeneralTab() { mKeepSignedInCG.setSelectedIndex(0, mSettings.getKeepSignedIn()); mCacheContactsCG.setSelectedIndex(0, mSettings.getCacheContacts()); mPreloadContactsCG.setSelectedIndex(0, mSettings.getPreloadContacts()); setDelWOConfCG(mSettings.getDelWOConf()); mDWOCConvCI.select(mSettings.getDelWOCConv()); mDWOCMsgCI.select(mSettings.getDelWOCMsg()); }
private void createShortcutsTab() { TabbedForm f = null; // #if true // # f = (TabbedForm)mView; // #endif // #style ChoiceGroup mShortcutList = new de.enough.polish.ui.ListItem(null); Shortcut[] shortcuts = mSettings.getShortcuts(); Shortcut firstUnused = null; for (int i = 0; i < shortcuts.length; i++) { if (!shortcuts[i].isConfigured()) { firstUnused = shortcuts[i]; break; } } ChoiceItem ci = null; if (firstUnused != null) { // #style ChoiceItem ci = new ShortcutItem(Locale.get("settings.NewShortcut"), null, List.IMPLICIT, firstUnused); mShortcutList.append(ci); } for (int i = 0; i < shortcuts.length; i++) { if (!shortcuts[i].isConfigured()) continue; // #style ChoiceItem ci = new ShortcutItem(shortcuts[i].toString(), null, List.IMPLICIT, shortcuts[i]); mShortcutList.append(ci); } f.deleteAll(SHORTCUTS_TAB); f.removeCommand(OK); f.removeCommand(CANCEL); f.addCommand(SAVE); f.addCommand(DELETE); f.append(SHORTCUTS_TAB, mShortcutList); mShortcutList.setItemCommandListener(this); mShortcutList.setDefaultCommand(List.SELECT_COMMAND); }
private void itemStateChangedDisplayTab(Item item) { ChoiceGroup cg = (ChoiceGroup) item; if (cg == mTickerCG) { mSettings.setShowConvTicker(cg.isSelected(TICKER_CONV)); mSettings.setShowMsgTicker(cg.isSelected(TICKER_MSG)); mSettings.setShowApptTicker(cg.isSelected(TICKER_APPT)); } else if (cg == mTickerSpeedCG) { switch (mTickerSpeedCG.getSelectedIndex()) { case TICKER_SLOW: mSettings.setTickerSpeed(Settings.SLOW_TICKER); break; case TICKER_MED: mSettings.setTickerSpeed(Settings.MED_TICKER); break; case TICKER_FAST: mSettings.setTickerSpeed(Settings.FAST_TICKER); break; } } }