예제 #1
0
    public Component getListCellRendererComponent(
        List list, Object value, int index, boolean isSelected) {

      PrivacyModel cell = (PrivacyModel) value;

      setLayout(new BorderLayout());

      Label name = new Label();
      name.getStyle().setPadding(Component.LEFT, 5, true);
      name.setText(cell.getTitle());
      name.getStyle().setFont(Fonts.MEDIUM, true);
      name.getStyle().setFgColor(ColorCodes.settingsScreenListItemHeadingGrey, true);
      name.getSelectedStyle().setPadding(Component.BOTTOM, 0, true);
      name.getStyle().setBgTransparency(0, true);

      TextArea description = new TextArea();
      description.setText(cell.getSubTitle());
      description.getStyle().setFgColor(ColorCodes.settingsScreenListItemDescGrey);
      description.getSelectedStyle().setFgColor(ColorCodes.settingsScreenListItemDescGrey);
      description.getStyle().setBgColor(ColorCodes.settingsScreenListBgGrey, true);
      description.getSelectedStyle().setBgColor(ColorCodes.settingsScreenListBgGrey, true);
      description.setEditable(false);
      description.setRows(2);
      description.setPreferredW(com.sun.lwuit.Display.getInstance().getDisplayWidth() - 20);
      description.getSelectedStyle().setBgTransparency(255, true);
      description.getStyle().setBgTransparency(255, true);
      description.getStyle().setBorder(Border.createEmpty(), true);
      description.getSelectedStyle().setBorder(Border.createEmpty(), true);
      description.getStyle().setPadding(Component.LEFT, 5, true);
      description.getSelectedStyle().setPadding(Component.LEFT, 5, true);
      description.getStyle().setPadding(Component.TOP, 0, true);
      description.getSelectedStyle().setPadding(Component.TOP, 0, true);
      description.getStyle().setPadding(Component.BOTTOM, 0, true);
      description.getSelectedStyle().setPadding(Component.BOTTOM, 0, true);
      description.getSelectedStyle().setFont(Fonts.SMALL, true);
      description.getStyle().setFont(Fonts.SMALL, true);

      Container nameDescContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
      nameDescContainer.getStyle().setPadding(Component.RIGHT, 0, true);
      nameDescContainer.getSelectedStyle().setPadding(Component.RIGHT, 0, true);
      nameDescContainer.getStyle().setBorder(Border.createEmpty(), true);
      nameDescContainer.getSelectedStyle().setBorder(Border.createEmpty(), true);
      nameDescContainer.addComponent(name);
      nameDescContainer.addComponent(description);

      arrowIconLabel = new Label();
      arrowIconLabel.setIcon(arrowIconImage);
      arrowIconLabel.getStyle().setAlignment(Component.CENTER);
      arrowIconLabel.getStyle().setBgTransparency(0, true);
      arrowIconLabel.getSelectedStyle().setBgTransparency(0, true);
      arrowIconLabel.getPressedStyle().setBgTransparency(0, true);
      arrowIconLabel.getPressedStyle().setBorder(null, true);
      arrowIconLabel.getStyle().setBorder(null, true);
      arrowIconLabel.getSelectedStyle().setBorder(null, true);
      arrowIconLabel.getStyle().setAlignment(CENTER);
      arrowIconLabel.getStyle().setPadding(Component.RIGHT, 10, true);

      mainContainer = new Container(new BorderLayout());
      mainContainer.setPreferredH(80);
      mainContainer.getStyle().setPadding(Component.TOP, 2, true);
      mainContainer
          .getStyle()
          .setBorder(
              Border.createCompoundBorder(
                  null,
                  Border.createEtchedRaised(
                      ColorCodes.settingsScreenSeperatorGrey,
                      ColorCodes.settingsScreenSeperatorShadow),
                  null,
                  null),
              true);
      mainContainer.addComponent(BorderLayout.WEST, nameDescContainer);
      mainContainer.addComponent(BorderLayout.EAST, arrowIconLabel);

      return mainContainer;
    }
예제 #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);
  }
예제 #3
0
    public Component getListCellRendererComponent(
        List list, Object value, int index, boolean isSelected) {
      if (value != null) {
        addressEntry = (AddressBookEntry) value;

        Log.v(TAG, "AddressBookEntry: " + addressEntry);

        Log.v(TAG, "Index is:" + index);
        onFocusLbl.getStyle().setBgTransparency(20, true);

        Container namephnumContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        namephnumContainer.getStyle().setPadding(Component.LEFT, 3, true);
        namephnumContainer.getStyle().setPadding(Component.TOP, 5, true);
        namephnumContainer.getStyle().setPadding(Component.BOTTOM, 8, true);

        Label contactName = new Label(addressEntry.getName());
        contactName.getStyle().setBgTransparency(0, true);
        contactName.getStyle().setFgColor(ColorCodes.selectContactNameGrey, true);
        contactName.getStyle().setPadding(Component.BOTTOM, 0, true);

        contactName.getSelectedStyle().setFont(Fonts.MONO_MEDIUM, true);
        contactName.getStyle().setFont(Fonts.MONO_MEDIUM, true);
        contactName.getSelectedStyle().setBorder(null, true);
        contactName.setPreferredSize(
            new Dimension(
                (Display.getInstance().getDisplayWidth() - inviteImage.getWidth() - 25), 30));

        Label phoneNum = new Label(addressEntry.getMsisdn());
        phoneNum.getStyle().setBgTransparency(0, true);
        phoneNum.getStyle().setPadding(Component.TOP, 0, true);
        phoneNum.getSelectedStyle().setBorder(null, true);
        phoneNum.getSelectedStyle().setFont(Fonts.MONO_SMALL, true);
        phoneNum.getStyle().setFont(Fonts.MONO_SMALL, true);
        phoneNum.getStyle().setFgColor(ColorCodes.selectContactNumberGrey);

        namephnumContainer.addComponent(contactName);
        namephnumContainer.addComponent(phoneNum);

        inviteButton = new Button(inviteImage);
        inviteButton.getStyle().setBgTransparency(0, true);
        inviteButton.getSelectedStyle().setBgTransparency(0, true);
        inviteButton.getPressedStyle().setBgTransparency(0, true);
        inviteButton.getPressedStyle().setBorder(null, true);
        inviteButton.getStyle().setBorder(null, true);
        inviteButton.getSelectedStyle().setBorder(null, true);
        inviteButton.getStyle().setAlignment(CENTER);

        tickMark = new Label(sentInviteImage);
        tickMark.getStyle().setAlignment(Component.CENTER);
        tickMark.getStyle().setBgTransparency(0, true);
        tickMark.getSelectedStyle().setBgTransparency(0, true);
        tickMark.getPressedStyle().setBgTransparency(0, true);
        tickMark.getPressedStyle().setBorder(null, true);
        tickMark.getStyle().setBorder(null, true);
        tickMark.getSelectedStyle().setBorder(null, true);
        tickMark.getStyle().setAlignment(CENTER);
        tickMark.getStyle().setPadding(Component.RIGHT, 30, true);

        mainContainer = new Container(new BorderLayout());
        mainContainer
            .getStyle()
            .setBorder(
                Border.createCompoundBorder(
                    null,
                    Border.createEtchedRaised(
                        ColorCodes.selectContactSeperator, ColorCodes.selectContactSeperatorShadow),
                    null,
                    null),
                true);

        mainContainer.addComponent(BorderLayout.WEST, namephnumContainer);
        if (inviteButton.getParent() == null) {
          mainContainer.addComponent(BorderLayout.EAST, inviteButton);
        }

        getStyle().setPadding(Component.RIGHT, 0, true);
        getUnselectedStyle().setPadding(Component.RIGHT, 0, true);
        getPressedStyle().setPadding(Component.RIGHT, 0, true);
        getSelectedStyle().setPadding(Component.RIGHT, 0, true);

        if (addressEntry.isInvited()) {
          mainContainer.removeComponent(inviteButton);
          mainContainer.addComponent(BorderLayout.EAST, tickMark);
        }
      }

      return mainContainer;
    }