public static ScrollView LinkifyText(Context context, String message) {
    ScrollView svMessage = new ScrollView(context);
    TextView tvMessage = new TextView(context);

    SpannableString spanText = new SpannableString(message);

    Linkify.addLinks(spanText, Linkify.ALL);
    tvMessage.setText(spanText);
    tvMessage.setMovementMethod(LinkMovementMethod.getInstance());

    svMessage.setPadding(14, 2, 10, 12);
    svMessage.addView(tvMessage);

    return svMessage;
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.initial);

    Button btnNewRosary = (Button) findViewById(R.id.btnNewRosary);
    btnNewRosary.setOnClickListener(mNewRosaryClickListener);

    Button btnNext = (Button) findViewById(R.id.btnNext);
    btnNext.setOnClickListener(mNextClickListener);

    Button btnPrevious = (Button) findViewById(R.id.btnPrevious);
    btnPrevious.setOnClickListener(mPreviousClickListener);

    // Display display = getWindowManager().getDefaultDisplay();
    // int width = display.getWidth();
    // int height = display.getHeight();

    ScrollView ScrollViewBody = (ScrollView) findViewById(R.id.ScrollViewBody);
    ScrollViewBody.setPadding(10, 5, 10, 50);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final OfflineTabActivity activity = (OfflineTabActivity) getActivity();
    menu = activity.getMenu();
    View rootView = inflater.inflate(R.layout.menu_layout, container, false);

    ScrollView scroll = new ScrollView(getActivity().getApplicationContext());
    TableLayout menulist = new TableLayout(getActivity().getApplicationContext());
    TableRow.LayoutParams param = new TableRow.LayoutParams();
    param.setMargins(0, 0, 15, 0);
    final String sid = "4";
    int id = 0;
    for (Beverage beverage : menu) {
      if (beverage.getType().equals("soft")) {
        id++;

        TableRow row = new TableRow(getActivity().getApplicationContext());

        TextView tekst = new TextView(getActivity().getApplicationContext());
        tekst.setText(beverage.getName());
        tekst.setLayoutParams(param);
        tekst.setId(Integer.parseInt(sid + id));
        row.addView(tekst);

        TextView amount = new TextView(getActivity().getApplicationContext());
        amount.setText("€ " + beverage.getPrice());
        amount.setLayoutParams(param);
        row.addView(amount);

        menulist.addView(row);
      }
    }
    scroll.setPadding(20, 5, 0, 5);
    scroll.addView(menulist);
    return scroll;
  }
Esempio n. 4
0
    ModalScreenLayout(Context context) {
      super(context);

      setPadding(PADDING, PADDING, PADDING, PADDING);

      _content = new ScrollView(context);
      addView(_content);
      _content.setPadding(PADDING, PADDING, PADDING, PADDING);
      _content.setScrollbarFadingEnabled(true);

      _close_btn = new Button(context);
      addView(_close_btn);

      _close_btn.setPadding(PADDING, PADDING, PADDING, PADDING);
      _close_btn.setText(R.string.screen_menu_close);
      View.OnClickListener close_listener =
          new View.OnClickListener() {
            public void onClick(View v) {
              close();
            }
          };
      _close_btn.setOnClickListener(close_listener);
    }
Esempio n. 5
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final TabActivity activity = (TabActivity) getActivity();
    menu = activity.getMenu();
    View rootView = inflater.inflate(R.layout.menu_layout, container, false);

    ScrollView scroll = new ScrollView(getActivity().getApplicationContext());
    TableLayout menulist = new TableLayout(getActivity().getApplicationContext());
    TableRow.LayoutParams param = new TableRow.LayoutParams();
    param.setMargins(0, 0, 15, 0);
    final String sid = "1";
    int id = 0;
    for (Beverage beverage : menu) {
      if (beverage.getType().equals("bier")) {
        id++;

        TableRow row = new TableRow(getActivity().getApplicationContext());

        TextView tekst = new TextView(getActivity().getApplicationContext());
        tekst.setText(beverage.getName());
        tekst.setLayoutParams(param);
        tekst.setId(Integer.parseInt(sid + id));
        row.addView(tekst);

        Button plus = new Button(getActivity().getApplicationContext());
        plus.setText("plus");
        plus.setLayoutParams(param);
        plus.setId(id);
        plus.setOnClickListener(
            new OnClickListener() {

              @Override
              public void onClick(View v) {
                int id = v.getId();
                TextView name = (TextView) getView().findViewById(Integer.parseInt(sid + id));
                String naam = name.getText().toString();
                String currentsaldo = activity.plus(naam);
                TextView total = (TextView) getView().findViewById(Integer.parseInt(sid + id + id));
                total.setText("€ " + currentsaldo);
                activity.setTotal();
                total.invalidate();
              }
            });
        row.addView(plus);

        Button min = new Button(getActivity().getApplicationContext());
        min.setText("min");
        min.setLayoutParams(param);
        min.setId(id);
        min.setOnClickListener(
            new OnClickListener() {

              @Override
              public void onClick(View v) {
                int id = v.getId();
                TextView name = (TextView) getView().findViewById(Integer.parseInt(sid + id));
                String naam = name.getText().toString();
                String currentsaldo = activity.min(naam);
                TextView total = (TextView) getView().findViewById(Integer.parseInt(sid + id + id));
                total.setText("€ " + currentsaldo);
                activity.setTotal();
                total.invalidate();
              }
            });
        row.addView(min);

        TextView amount = new TextView(getActivity().getApplicationContext());
        amount.setText("€" + beverage.getPrice());
        amount.setLayoutParams(param);
        row.addView(amount);

        TextView total = new TextView(getActivity().getApplicationContext());
        total.setLayoutParams(param);
        total.setText("€ 0.00");
        total.setId(Integer.parseInt(sid + id + id));
        row.addView(total);

        menulist.addView(row);
      }
    }
    scroll.setPadding(20, 5, 0, 5);
    scroll.addView(menulist);
    return scroll;
  }