Exemple #1
0
  public Manager splashScreen(Manager parent) {
    VerticalFieldManager fm_MainHolder =
        new VerticalFieldManager(
            Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT | Manager.NO_VERTICAL_SCROLL) {
          public int getPreferredWidth() {
            return Display.getWidth();
          }

          public int getPreferredHeight() {
            return Display.getHeight();
          }

          protected void sublayout(int width, int height) {
            width = getPreferredWidth();
            height = getPreferredHeight();
            super.sublayout(width, height);
            super.setExtent(width, height);
          }
        };
    Background back = bkg_splash;
    fm_MainHolder.setBackground(back);
    parent.add(fm_MainHolder);
    return fm_MainHolder;
  }
Exemple #2
0
  public Manager mainScreen(Manager parent) {
    CInterface ci = new CInterface();
    final int columnHeight0 = (int) ((Display.getHeight() / 2));
    final int columnHeight1 = (int) (Display.getHeight() / 2);
    final int btnw = (int) ((float) Display.getWidth() * .75);
    final EncodedImage buttonoff =
        ci.getScaledImage(EncodedImage.getEncodedImageResource(button), btnw);
    final EncodedImage buttonon =
        ci.getScaledImage(EncodedImage.getEncodedImageResource(button_on), btnw);
    final EncodedImage friendsoff =
        ci.getScaledImage(EncodedImage.getEncodedImageResource(friends), btnw);
    final EncodedImage friendson =
        ci.getScaledImage(EncodedImage.getEncodedImageResource(friends_on), btnw);
    int imagew = (int) ((float) Display.getWidth() * .75);
    Bitmap blankbmp = Bitmap.getBitmapResource(blank);

    VerticalFieldManager fm_MainHolder =
        new VerticalFieldManager(
            Manager.USE_ALL_WIDTH
                | Manager.USE_ALL_HEIGHT
                | Manager.NO_HORIZONTAL_SCROLL
                | Manager.NO_VERTICAL_SCROLL) {
          public int getPreferredWidth() {
            return Display.getWidth();
          }

          public int getPreferredHeight() {
            return Display.getHeight();
          }

          protected void sublayout(int width, int height) {
            width = getPreferredWidth();
            height = getPreferredHeight();
            super.sublayout(width, height);
            super.setExtent(width, height);
          }
        };
    Background back = bkg_main;
    fm_MainHolder.setBackground(back);

    // MAIN LOGO
    HorizontalFieldManager lgo =
        new HorizontalFieldManager(
            Manager.NO_VERTICAL_SCROLL
                | Manager.NO_HORIZONTAL_SCROLL
                | Manager.FIELD_HCENTER
                | Manager.FIELD_VCENTER
                | Manager.USE_ALL_WIDTH) {
          public int getPreferredHeight() {
            return columnHeight0;
          }

          protected void sublayout(int width, int height) {
            width = super.getPreferredWidth();
            height = getPreferredHeight();
            super.sublayout(width, height);
            super.setExtent(width, height);
          }
        };
    BitmapField img =
        ci.WriteSimpleImage(
            lgo, logo, BitmapField.FIELD_VCENTER | BitmapField.FIELD_HCENTER, imagew, "");
    fm_MainHolder.add(lgo);

    // BUTTON HOLDER
    VerticalFieldManager vfmButton =
        new VerticalFieldManager(
            Manager.FIELD_HCENTER | Manager.FIELD_VCENTER | Manager.USE_ALL_WIDTH) {
          public int getPreferredHeight() {
            return columnHeight1;
          }

          public int getPreferredWidth() {
            return Display.getWidth();
          }

          protected void sublayout(int width, int height) {
            width = getPreferredWidth();
            height = getPreferredHeight();
            super.sublayout(width, height);
            super.setExtent(width, height);
          }
        };

    final BitmapField bmFieldSpan = new BitmapField(blankbmp, BitmapField.NON_FOCUSABLE);

    CustomButtonField cbfFriends =
        new CustomButtonField(
            btnw,
            strings.getString("invite_friends"),
            friendsoff.getBitmap(),
            friendson.getBitmap(),
            Field.FOCUSABLE | Field.FIELD_HCENTER | Field.FIELD_VCENTER) {
          protected boolean navigationClick(int status, int time) {
            c.action_callback("web_friends", "", "");
            return true;
          }
        };

    CustomButtonField cbfButton =
        new CustomButtonField(
            btnw,
            strings.getString("read_qr"),
            buttonoff.getBitmap(),
            buttonon.getBitmap(),
            Field.FOCUSABLE | Field.FIELD_HCENTER | Field.FIELD_VCENTER) {
          protected boolean navigationClick(int status, int time) {
            c.action_callback("qr_start", "", "");
            return true;
          }
        };

    vfmButton.add(cbfButton);
    vfmButton.add(bmFieldSpan);
    vfmButton.add(cbfFriends);
    fm_MainHolder.add(vfmButton);

    parent.add(fm_MainHolder);
    return fm_MainHolder;
  }
  public CambiarPuntosMap() {

    if (Display.getWidth() == 320) {

      getMainManager()
          .setBackground(
              BackgroundFactory.createBitmapBackground(
                  Bitmap.getBitmapResource("background_320.png")));
      tFuente = 17;
      tFuente2 = 20;
      veinticinco = 10;
      veinte = 10;
      trecientoscuarentaysiete = 170;
      setenta = 35;
      hr = Bitmap.getBitmapResource("hr_line_3.png");
      leftHr = 10;
      btnMapa = Bitmap.getBitmapResource("btnMapa_320.png");
      btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png");
      btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png");
      btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png");
    }
    if (Display.getWidth() == 360) {

      getMainManager()
          .setBackground(
              BackgroundFactory.createBitmapBackground(
                  Bitmap.getBitmapResource("background_360.png")));
      tFuente = 20;
      tFuente2 = 23;
      veinticinco = 10;
      veinte = 10;
      trecientoscuarentaysiete = 403;
      setenta = 35;
      hr = Bitmap.getBitmapResource("hr_line_3.png");
      leftHr = 30;
      btnMapa = Bitmap.getBitmapResource("btnMapa_320.png");
      btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png");
      btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png");
      btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png");
    }
    if (Display.getWidth() == 480) {

      getMainManager()
          .setBackground(
              BackgroundFactory.createBitmapBackground(
                  Bitmap.getBitmapResource("background_480.png")));
      tFuente = 20;
      tFuente2 = 23;
      veinticinco = 10;
      veinte = 10;
      trecientoscuarentaysiete = 291;
      setenta = 35;
      hr = Bitmap.getBitmapResource("hr_line.png");
      leftHr = 0;
      btnMapa = Bitmap.getBitmapResource("btnMapa_320.png");
      btnMapa1 = Bitmap.getBitmapResource("btnMapa1_320.png");
      btnAgregarMapa = Bitmap.getBitmapResource("btnAgregarMapa_320.png");
      btnAgregarMapa1 = Bitmap.getBitmapResource("btnAgregarMapa1_320.png");
    }
    if (Display.getWidth() == 640) {

      getMainManager()
          .setBackground(
              BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("background.png")));

      tFuente = 35;
      tFuente2 = 40;
    }

    try {

      FontFamily ffFont1 = FontFamily.forName("Arial");
      fLite = ffFont1.getFont(Font.SANS_SERIF_STYLE, tFuente);
      fTitle = ffFont1.getFont(Font.SANS_SERIF_STYLE, tFuente2);

      // hr = Bitmap.getBitmapResource("hr_line.png");

      // getMainManager().setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("background.png")));

      VerticalFieldManager logoHfm = new VerticalFieldManager(VerticalFieldManager.FIELD_HCENTER);
      logoHfm.setBackground(
          BackgroundFactory.createLinearGradientBackground(0xe68241, 0xe68241, 0xd16f2f, 0xd16f2f));
      logoHfm.setMargin(0, 0, 0, 0);

      ColorRichText emailCrt =
          new ColorRichText(
              Strings.CHANGECONFIG,
              0xffffff,
              RichTextField.FIELD_HCENTER | RichTextField.TEXT_ALIGN_HCENTER);
      emailCrt.setFont(fTitle);
      emailCrt.setMargin(veinticinco, 0, veinticinco, 0);

      logoHfm.add(emailCrt);

      VerticalField footerLogoHfm =
          new VerticalField(Display.getWidth(), veinte, VerticalFieldManager.FIELD_HCENTER);
      footerLogoHfm.setBackground(
          BackgroundFactory.createLinearGradientBackground(0x9cbe4f, 0x7a9b3c, 0x7a9b3c, 0x9cbe4f));

      ColorRichText introCrt =
          new ColorRichText(
              "Elige tus puntos favoritos",
              0xffffff,
              RichTextField.FIELD_HCENTER | RichTextField.TEXT_ALIGN_HCENTER);
      introCrt.setFont(fTitle);
      introCrt.setMargin(25, 0, 25, 0);
      footerLogoHfm.add(introCrt);

      logoHfm.add(footerLogoHfm);

      add(logoHfm);

      VerticalField allContentFiltro =
          new VerticalField(
              Display.getWidth(),
              trecientoscuarentaysiete,
              HorizontalField.FIELD_HCENTER
                  | VerticalField.VERTICAL_SCROLL
                  | VerticalField.VERTICAL_SCROLLBAR);

      Object[] municipioO = new Object[] {"one", "two", "three"};
      ObjectChoiceField municipioOcf = new FullWidthChoiceField();
      municipioOcf.setChoices(municipioO);
      municipioOcf.setMargin(0, 70, 0, 70);

      VerticalFieldManager municipioVfm =
          new VerticalFieldManager(
              VerticalFieldManager.FIELD_HCENTER | HorizontalFieldManager.FIELD_HCENTER);

      LabelField municipioLf = new LabelField("Municipio", LabelField.FIELD_HCENTER);
      municipioLf.setFont(fLite);
      municipioLf.setMargin(15, 0, 5, 0);

      municipioVfm.add(municipioLf); // |/ DrawStyle.HCENTER));
      municipioVfm.add(municipioOcf);

      hrBf = new BitmapField(hr);
      hrBf.setMargin(20, 0, 0, leftHr);
      municipioVfm.add(hrBf);

      allContentFiltro.add(municipioVfm);

      /**/
      Object[] establecimientoO = new Object[] {"one", "two", "three"};
      ObjectChoiceField establecimientoOcf = new FullWidthChoiceField();
      establecimientoOcf.setChoices(establecimientoO);
      establecimientoOcf.setMargin(0, 70, 0, 70);

      VerticalFieldManager establecimientoVfm =
          new VerticalFieldManager(
              VerticalFieldManager.FIELD_HCENTER | HorizontalFieldManager.FIELD_HCENTER);

      LabelField establecimientoLf = new LabelField("Establecimiento", LabelField.FIELD_HCENTER);
      establecimientoLf.setFont(fLite);
      establecimientoLf.setMargin(15, 0, 5, 0);

      establecimientoVfm.add(establecimientoLf); // |/ DrawStyle.HCENTER));
      establecimientoVfm.add(establecimientoOcf);

      hrBf = new BitmapField(hr);
      hrBf.setMargin(20, 0, 0, leftHr);
      establecimientoVfm.add(hrBf);

      allContentFiltro.add(establecimientoVfm);

      HorizontalFieldManager botonesHfc =
          new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER);
      // botonesHfc.setMargin(0, 50, 0, 0);

      BitmapButtonField btnMapaUser = new BitmapButtonField(btnMapa, btnMapa1, Field.FIELD_HCENTER);
      btnMapaUser.setChangeListener(
          new FieldChangeListener() {
            public void fieldChanged(Field field, int context) {
              UiApplication.getUiApplication().pushScreen(new ListaEstablecimiebtosMap());
            }
          });
      btnMapaUser.setMargin(20, 10, 0, 0);

      BitmapButtonField btnAgregarMapaUser =
          new BitmapButtonField(btnAgregarMapa, btnAgregarMapa1, Field.FIELD_HCENTER);
      btnAgregarMapaUser.setChangeListener(
          new FieldChangeListener() {
            public void fieldChanged(Field field, int context) {
              UiApplication.getUiApplication().pushScreen(new ListaEstablecimiebtosMap());
            }
          });
      btnAgregarMapaUser.setMargin(20, 10, 0, 0);

      botonesHfc.add(btnMapaUser);
      botonesHfc.add(btnAgregarMapaUser);

      allContentFiltro.add(botonesHfc);

      add(allContentFiltro);

    } catch (Exception e) {
      // TODO: handle exception
      System.out.println(e.getMessage());
      add(new RichTextField(e.getMessage()));
    }
  }
  public Questions(String currentUser, int week) {
    // current user
    this.currentUser = currentUser;
    // set week
    this.week = week;
    // set title
    setTitle("Questions");

    // background
    defaultBg =
        BackgroundFactory.createLinearGradientBackground(
            Color.WHITE, Color.LIGHTSKYBLUE, Color.WHITE, Color.GRAY);

    // main manager
    mainManager = (VerticalFieldManager) getMainManager();
    mainManager.setBackground(defaultBg);

    // create  buttons
    goBack = new ButtonField("Go back", ButtonField.FIELD_HCENTER);

    // create reader object
    reader = new ReadFile();

    // read the question file and return its contents
    test = reader.readTextFile("Questions2.txt");

    // process the information
    process_Qfile(test);
    // create and set the question objects
    CreateAndSetQuestionObj();

    // create Question list
    questions_list = CreateQList();

    // drop-down list
    questionsList = new ObjectChoiceField("This week's Questions: ", questions_list);

    // set margins
    questionsList.setMargin(20, 0, 0, 0);
    goBack.setMargin(30, 0, 0, 0);

    // add buttons to the listener
    questionsList.setChangeListener(this);
    goBack.setChangeListener(this);

    // create image and overwrite the paint method of verticalFieldManager
    // backgroundImage = Bitmap.getBitmapResource("beach4 copy1.jpg");
    backgroundImage = Bitmap.getBitmapResource("beach5 copy copy.jpg");
    mainManager =
        new VerticalFieldManager(
            VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.USE_ALL_HEIGHT) {
          public void paint(Graphics graphics) {

            graphics.drawBitmap(0, 0, 480, 510, backgroundImage, 0, 0);
            super.paint(graphics);
          }
        };
    this.add(mainManager);

    // add components
    mainManager.add(questionsList);
    mainManager.add(goBack);

    // decide which panel should display
    displayAnswer();
  }