Пример #1
0
  /**
   * Constructor of Invitation form. This form displays all the non-hike users and allow user to
   * send invitation to those users who are not on hike.
   */
  public FormInvitation() {

    getStyle().setBgColor(ColorCodes.selectContactBgGrey, true);

    // #if nokia2_0
    setTitle(LBL_INVITE_FRIENDS);
    // #endif

    setLayout(new BorderLayout());

    setScrollable(false);

    addComponent(BorderLayout.NORTH, searchTextArea);

    initCommands();

    searchTextArea.setTextChangedListener(this);

    inviteList = new List(inviteVector);
    inviteList.getStyle().setPadding(Component.LEFT, 0, true);
    inviteList.getSelectedStyle().setPadding(Component.LEFT, 0, true);
    inviteList.getStyle().setPadding(Component.RIGHT, 0, true);
    inviteList.getSelectedStyle().setPadding(Component.RIGHT, 0, true);
    inviteList.getStyle().setPadding(Component.BOTTOM, 0, true);
    inviteList.getSelectedStyle().setPadding(Component.BOTTOM, 0, true);
    inviteList.setRenderer(new InviteListRenderer());
    inviteList.addActionListener(
        new ActionListener() {
          boolean clicked = false;
          AddressBookEntry entry;

          public void actionPerformed(ActionEvent evt) {
            if (!clicked) {
              entry = (AddressBookEntry) inviteList.getSelectedItem();
              if (entry.getMsisdn() == null || entry.getPhoneNumber() == null) {
                return;
              }
              clicked = true;
              if (entry.getId().equals(UNKNOWN_CONTACT_ID)) {
                MqttManager.invite(entry.getName(), AppState.getNextMessageID());
              } else {
                MqttManager.invite(entry.getMsisdn(), AppState.getNextMessageID());
              }
              clicked = false;
              entry.setInvited(true);
              // flushReplace();
              revalidate();
            }
          }
        });

    addComponent(BorderLayout.CENTER, inviteList);
  }
Пример #2
0
  /**
   * Constructor of privacy form. This form gives options user to delete or unlink account from the
   * device. Adding and initializing all components are done in this constructor.
   */
  public FormPrivacy() {

    getStyle().setBgColor(ColorCodes.settingsScreenBgGrey, true);

    // #if nokia2_0
    setTitle(LBL_PRIVACY);
    // #endif

    privacyVector.addElement(new PrivacyModel(LBL_DELETE_ACCOUNT, MSG_DELETE_ACCOUNT));
    privacyVector.addElement(new PrivacyModel(LBL_SIGNOUT, MSG_SIGNOUT_ACCOUNT));

    initCommands();

    // #if nokia1_1
    // #         Label privacyLabel = new Label(LBL_PRIVACY);
    // #         privacyLabel.getStyle().setBgTransparency(0, true);
    // #         privacyLabel.getStyle().setFgColor(0x808080, true);
    // #         privacyLabel.getStyle().setMargin(Component.TOP, 5, true);
    // #         addComponent(privacyLabel);
    // #endif

    setLayout(new BoxLayout(BoxLayout.Y_AXIS));

    final List privacyList = new List(privacyVector);
    privacyList.setFocusable(false);
    privacyList.setFocus(false);
    privacyList.getStyle().setPadding(Component.LEFT, 0, true);
    privacyList.getSelectedStyle().setPadding(Component.LEFT, 0, true);
    privacyList.getStyle().setPadding(Component.RIGHT, 0, true);
    privacyList.getSelectedStyle().setPadding(Component.RIGHT, 0, true);
    privacyList.getStyle().setPadding(Component.BOTTOM, 0, true);
    privacyList.getSelectedStyle().setPadding(Component.BOTTOM, 0, true);
    privacyList.getStyle().setBgColor(ColorCodes.settingsScreenListBgGrey, true);
    privacyList.getSelectedStyle().setBgColor(ColorCodes.settingsScreenListBgGrey, true);
    privacyList.getStyle().setBgTransparency(255, true);
    privacyList.getSelectedStyle().setBgTransparency(255, true);
    privacyList
        .getStyle()
        .setBorder(
            Border.createCompoundBorder(
                null,
                Border.createEtchedRaised(
                    ColorCodes.settingsScreenBorderGrey, ColorCodes.settingsScreenBorderShadow),
                null,
                null),
            true);
    privacyList
        .getSelectedStyle()
        .setBorder(
            Border.createCompoundBorder(
                null,
                Border.createEtchedRaised(
                    ColorCodes.settingsScreenBorderGrey, ColorCodes.settingsScreenBorderShadow),
                null,
                null),
            true);
    privacyList.setRenderer(new PrivacyListRenderer());
    privacyList.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (!clicked) {
              clicked = true;

              switch (privacyList.getSelectedIndex()) {
                case 0:
                  showDialog(MSG_DELETE_ACCOUNT_CONFIRMATION, LBL_DELETE, LBL_CANCEL);
                  clicked = false;
                  break;

                case 1:
                  showDialog(MSG_SIGNOUT_ACCOUNT_CONFIRMATION, LBL_UNLINK, LBL_CANCEL);
                  clicked = false;
                  break;
              }
            }
          }
        });

    addComponent(privacyList);
  }