public void addRow(View view) {

    EditText editText = (EditText) _popPopupWindow.getContentView().findViewById(R.id.skillInput);

    if (!_newsTopics.contains(editText.getText().toString())) {
      LinearLayout linear = (LinearLayout) findViewById(R.id.LinearLayout1);

      LayoutInflater inflater =
          (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View rowView = (View) inflater.inflate(R.layout.row, null, false);

      TextView skillName = (TextView) rowView.findViewById(R.id.skillName);
      skillName.setText(editText.getText().toString());
      final Context mainActivity = this;

      rowView.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              Intent intent = new Intent(mainActivity, NewsActivity.class);

              TextView skillName = (TextView) v.findViewById(R.id.skillName);
              intent.putExtra(SKILL_NAME, skillName.getText().toString());
              startActivity(intent);
            }
          });

      linear.addView(rowView);
      linear.addView(getHorSep());
    }

    _popPopupWindow.dismiss();
    _popPopupWindow = null;
  }
Beispiel #2
0
  public void addButton(final String text, final String tag, final OnButtonClickListener listener) {
    final Button button =
        (Button) LayoutInflater.from(getContext()).inflate(R.layout.doorhanger_button, null);
    button.setText(text);
    button.setTag(tag);

    button.setOnClickListener(
        new Button.OnClickListener() {
          @Override
          public void onClick(View v) {
            listener.onButtonClick(DoorHanger.this, tag);
          }
        });

    if (mChoicesLayout.getChildCount() == 0) {
      // If this is the first button we're adding, make the choices layout visible.
      mChoicesLayout.setVisibility(View.VISIBLE);
      // Make the divider above the buttons visible.
      View divider = findViewById(R.id.divider_choices);
      divider.setVisibility(View.VISIBLE);
      divider.setBackgroundColor(mDividerColor);
    } else {
      // Add a vertical divider between additional buttons.
      Divider divider = new Divider(getContext(), null);
      divider.setOrientation(Divider.Orientation.VERTICAL);
      divider.setBackgroundColor(mDividerColor);
      mChoicesLayout.addView(divider);
    }

    mChoicesLayout.addView(button, sButtonParams);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    generateShuffle();

    mainLayout = (LinearLayout) findViewById(R.id.activity_main_linear_layout);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    params.weight = 1f;
    for (int i = 0; i < 4; i++) {
      LinearLayout row = new LinearLayout(this);
      // row.setOrientation(LinearLayout.HORIZONTAL);
      for (int j = 0; j < 3; j++) {
        ImageView imageView = new ImageView(this);
        imageView.setTag(tag++);
        imageView.setOnClickListener(this);
        imageView.setImageResource(R.drawable.card_back);
        row.addView(imageView, params);
      }
      mainLayout.addView(row, params);
    }
  }
 public void a(a parama, boolean paramBoolean) {
   LinearLayout localLinearLayout = (LinearLayout) g.a(b).inflate(2130903189, null);
   a(localLinearLayout, parama, a.size());
   a.add(parama);
   ESImageView localESImageView;
   if (((LinearLayout) c).getChildCount() != 0) {
     localESImageView = new ESImageView(b);
     localESImageView.setBackgroundResource(2130838205);
     if (paramBoolean) {
       ((LinearLayout) c).addView(localESImageView, new ViewGroup.LayoutParams(-1, 1));
     }
   } else {
     if (!paramBoolean) {
       break label174;
     }
     ((LinearLayout) c).addView(localLinearLayout);
   }
   for (; ; ) {
     localLinearLayout.setOnClickListener(new ip(this, localLinearLayout, parama));
     localLinearLayout.setOnLongClickListener(new iq(this, parama));
     localLinearLayout.setFocusable(true);
     return;
     ((LinearLayout) c).addView(localESImageView, 0, new ViewGroup.LayoutParams(-1, 1));
     break;
     label174:
     ((LinearLayout) c).addView(localLinearLayout, 0);
   }
 }
    private LinearLayout getView(int position, Context context) {
      LinearLayout ll = new LinearLayout(context);
      ll.setOrientation(LinearLayout.VERTICAL);
      int dp_5 = cn.sharesdk.framework.utils.R.dipToPx(context, 5);
      ll.setPadding(dp_5, dp_5, dp_5, dp_5);

      ImageView iv = new ImageView(context);
      iv.setScaleType(ScaleType.CENTER_INSIDE);
      LinearLayout.LayoutParams lpIv = new LinearLayout.LayoutParams(iconWidth, iconWidth);
      lpIv.gravity = Gravity.CENTER_HORIZONTAL;
      iv.setLayoutParams(lpIv);
      iv.setImageBitmap(getIcon(platforms[position]));
      ll.addView(iv);

      TextView tv = new TextView(context);
      tv.setTextColor(0xffffffff);
      tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
      tv.setSingleLine();
      tv.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP);
      LinearLayout.LayoutParams lpTv =
          new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
      lpTv.weight = 1;
      tv.setLayoutParams(lpTv);
      tv.setText(getName(platforms[position]));
      ll.addView(tv);

      return ll;
    }
 synchronized void initBottomStatus(int num) { // 4
   if (mLeftAmplitude == null || mRightAmplitude == null) {
     LogUtil.w(TAG, "mLeftAmplitude: " + mLeftAmplitude + " ,mRightAmplitude: " + mRightAmplitude);
     return;
   }
   mLeftAmplitude.removeAllViews();
   mRightAmplitude.removeAllViews();
   for (int i = 0; i < 6; i++) {
     ImageView imageViewl_i = new ImageView(getContext());
     ImageView imageViewR_i = new ImageView(getContext());
     if (i > (6 - num - 1)) { // 1
       imageViewl_i.setImageResource(R.drawable.chatroom_speaker);
     } else {
       imageViewl_i.setImageResource(R.drawable.chatroom_unspeaker);
     }
     if (i >= num) { // 4
       imageViewR_i.setImageResource(R.drawable.chatroom_unspeaker);
     } else {
       imageViewR_i.setImageResource(R.drawable.chatroom_speaker);
     }
     mLeftAmplitude.addView(
         imageViewl_i,
         new LinearLayout.LayoutParams(
             LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1.0f));
     mRightAmplitude.addView(
         imageViewR_i,
         new LinearLayout.LayoutParams(
             LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1.0f));
   }
 }
 private void addTab(@NonNull List<String> tabTexts, int i) {
   final TextView tab = new TextView(getContext());
   tab.setSingleLine();
   tab.setEllipsize(TextUtils.TruncateAt.END);
   tab.setGravity(Gravity.CENTER);
   tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, menuTextSize);
   tab.setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1.0f));
   tab.setTextColor(textUnselectedColor);
   tab.setCompoundDrawablesWithIntrinsicBounds(
       null, null, getResources().getDrawable(menuUnselectedIcon), null);
   tab.setText(tabTexts.get(i));
   tab.setPadding(dpTpPx(5), dpTpPx(12), dpTpPx(5), dpTpPx(12));
   // 添加点击事件
   tab.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           switchMenu(tab);
           if (mDropDownMenuListener != null) mDropDownMenuListener.onClickListener(v);
         }
       });
   tabMenuView.addView(tab);
   // 添加分割线
   if (i < tabTexts.size() - 1) {
     View view = new View(getContext());
     view.setLayoutParams(new LayoutParams(dpTpPx(0.5f), ViewGroup.LayoutParams.MATCH_PARENT));
     view.setBackgroundColor(dividerColor);
     tabMenuView.addView(view);
   }
 }
  @Override
  protected View onCreateDialogView() {
    LinearLayout.LayoutParams params;
    LinearLayout layout = new LinearLayout(mContext);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setPadding(6, 6, 6, 6);

    final TextView splashText = new TextView(mContext);
    if (mDialogMessage != null) splashText.setText(mDialogMessage);
    layout.addView(splashText);

    mValueText = new TextView(mContext);
    mValueText.setGravity(Gravity.CENTER_HORIZONTAL);
    mValueText.setTextSize(32);
    params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    layout.addView(mValueText, params);

    mSeekBar = new SeekBar(mContext);
    mSeekBar.setOnSeekBarChangeListener(this);
    layout.addView(
        mSeekBar,
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));

    if (shouldPersist()) mValue = getPersistedInt(mDefault);

    mSeekBar.setMax(mMax);
    mSeekBar.setProgress(mValue);
    return layout;
  }
  private void ensureHierarchy(Context context) {
    // If owner hasn't made its own view hierarchy, then as a convenience
    // we will construct a standard one here.
    if (findViewById(android.R.id.tabs) == null) {
      LinearLayout ll = new LinearLayout(context);
      ll.setOrientation(LinearLayout.VERTICAL);
      addView(
          ll,
          new FrameLayout.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

      TabWidget tw = new TabWidget(context);
      tw.setId(android.R.id.tabs);
      tw.setOrientation(TabWidget.HORIZONTAL);
      ll.addView(
          tw,
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0));

      FrameLayout fl = new FrameLayout(context);
      fl.setId(android.R.id.tabcontent);
      ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0));

      mRealTabContent = fl = new FrameLayout(context);
      mRealTabContent.setId(mContainerId);
      ll.addView(fl, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1));
    }
  }
 private LinearLayout getLL(Course course) {
   LinearLayout LL = new LinearLayout(getActivity());
   int padding = (int) (8 * getResources().getDisplayMetrics().density + 0.5F);
   LL.setPadding(padding, padding, padding, padding);
   LinearLayout.LayoutParams parameters =
       new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
   LL.setOrientation(LinearLayout.HORIZONTAL);
   LL.setLayoutParams(parameters);
   TextView courseName = new TextView(getActivity());
   LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1);
   courseName.setLayoutParams(params);
   courseName.setGravity(Gravity.LEFT);
   courseName.setText(course.getCode());
   LL.addView(courseName);
   TextView grade = new TextView(getActivity());
   grade.setTextColor(0xFFB40404);
   if (course.getPercentage() == -1) grade.setText("--%");
   else {
     DecimalFormat formatter = new DecimalFormat("0.#");
     grade.setText(formatter.format(course.getPercentage()) + "%");
   }
   LL.addView(grade);
   grade.setGravity(Gravity.RIGHT);
   return LL;
 }
Beispiel #11
0
    public PRTHeader(Context context) {
      super(context);
      setOrientation(VERTICAL);

      LinearLayout llInner = new LinearLayout(context);
      LinearLayout.LayoutParams lpInner =
          new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      lpInner.gravity = Gravity.CENTER_HORIZONTAL;
      addView(llInner, lpInner);

      ivArrow = new RotateImageView(context);
      int resId = getBitmapRes(context, "ssdk_oks_ptr_ptr");
      if (resId > 0) {
        ivArrow.setImageResource(resId);
      }
      int dp_32 = dipToPx(context, 32);
      LayoutParams lpIv = new LayoutParams(dp_32, dp_32);
      lpIv.gravity = Gravity.CENTER_VERTICAL;
      llInner.addView(ivArrow, lpIv);

      pbRefreshing = new ProgressBar(context);
      llInner.addView(pbRefreshing, lpIv);
      pbRefreshing.setVisibility(View.GONE);

      tvHeader = new TextView(getContext());
      tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
      tvHeader.setGravity(Gravity.CENTER);
      int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 10);
      tvHeader.setPadding(dp_10, dp_10, dp_10, dp_10);
      tvHeader.setTextColor(0xff000000);
      LayoutParams lpTv = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      lpTv.gravity = Gravity.CENTER_VERTICAL;
      llInner.addView(tvHeader, lpTv);
    }
 public void addElementCircles() {
   CircleImageView civ;
   circle_holder.removeAllViewsInLayout();
   circleIndex.clear();
   QData qData;
   for (int i = 0; i < elements.size(); i++) {
     qData = elements.get(i);
     if (qData.isText()) {
       civ = new CircleImageView(this);
       civ.setImageDrawable(getResources().getDrawable(R.drawable.text));
       civ.setBorderColor(getResources().getColor(R.color.blue));
       civ.setBorderWidth(10);
       civ.setOnClickListener(circleClickListener);
       circle_holder.addView(civ, circle_params);
       circleIndex.add(civ);
     } else if (!qData.isText()) {
       civ = new CircleImageView(this);
       //                byte[] array = fragments.get(i).mData.getImage();
       civ.setImageBitmap(elements.get(i).getImageBitmap());
       civ.setBorderColor(getResources().getColor(R.color.blue));
       civ.setBorderWidth(10);
       civ.setOnClickListener(circleClickListener);
       circle_holder.addView(civ, circle_params);
       circleIndex.add(civ);
     }
     if (i == 0) circleIndex.get(i).setBorderColor(Color.WHITE);
   }
 }
 /** 初始化提醒事件时间选择按钮 */
 private void initAlertsButton() {
   LinearLayout llAlert = (LinearLayout) findViewById(R.id.llAddEventAlert);
   //		btnsDay = new ArrayList<Button>();
   //		btnsHours = new ArrayList<Button>();
   //		btnsMinute = new ArrayList<Button>();
   int[] alertsValues = getResources().getIntArray(R.array.alert_events);
   RelativeLayout rlAlertLinePictures =
       (RelativeLayout) getLayoutInflater().inflate(R.layout.view_add_event_alert_row, null);
   llAlert.addView(rlAlertLinePictures);
   if (alertsValues == null || alertsValues.length < 10) {
     return;
   }
   alertsValueButtons = new ArrayList<Button>();
   for (int i = 0; i < 3; i++) {
     RelativeLayout rlAlertLine =
         (RelativeLayout) getLayoutInflater().inflate(R.layout.view_add_event_alert_row, null);
     llAlert.addView(rlAlertLine);
     Button btn1 = (Button) rlAlertLine.findViewById(R.id.btnAddEventAlertRow1);
     Button btn2 = (Button) rlAlertLine.findViewById(R.id.btnAddEventAlertRow2);
     Button btn3 = (Button) rlAlertLine.findViewById(R.id.btnAddEventAlertRow3);
     createAlertsValuesButton(alertsValues[7 + i], btn1);
     createAlertsValuesButton(alertsValues[4 + i], btn2);
     createAlertsValuesButton(alertsValues[1 + i], btn3);
     alertsValueButtons.add(btn1);
     alertsValueButtons.add(btn2);
     alertsValueButtons.add(btn3);
   }
   showAlertsInView();
   setAlertsvalueToEventReminder();
 }
Beispiel #14
0
 public void generateScreen() {
   List<String> names = presenter.getAccountNames(username, password);
   LinearLayout layout = (LinearLayout) findViewById(R.id.accountArray);
   TextView account = new TextView(this);
   Point size = new Point();
   Display display =
       ((android.view.WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
   display.getSize(size);
   Button temp;
   if (!(names.size() > 0)) {
     return;
   }
   account.setBackgroundColor(Color.BLACK);
   account.setHeight(2);
   account.setWidth(size.x);
   layout.addView(account);
   for (String name : names) {
     temp = new Button(this);
     temp.setText(name);
     temp.setGravity(Gravity.CENTER);
     temp.setOnClickListener(AccountClickListener);
     layout.addView(temp);
     account = new TextView(this);
     account.setWidth(size.x);
     account.setBackgroundColor(Color.BLACK);
     account.setHeight(2);
     layout.addView(account);
   }
 }
Beispiel #15
0
 @Override
 @NonNull
 protected LinearLayout makeCenterView() {
   LinearLayout rootLayout = new LinearLayout(activity);
   rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
   rootLayout.setOrientation(LinearLayout.VERTICAL);
   blackColorView = new ColorPanelView(activity);
   //noinspection ResourceType
   blackColorView.setId(BLACK_ID);
   blackColorView.setLayoutParams(
       new LinearLayout.LayoutParams(MATCH_PARENT, ConvertUtils.toPx(activity, 30)));
   blackColorView.setPointerDrawable(
       CompatUtils.getDrawable(activity, R.drawable.color_picker_cursor_bottom));
   blackColorView.setLockPointerInBounds(false);
   blackColorView.setOnColorChangedListener(
       new ColorPanelView.OnColorChangedListener() {
         @Override
         public void onColorChanged(ColorPanelView view, int color) {
           updateCurrentColor(color);
         }
       });
   rootLayout.addView(blackColorView);
   multiColorView = new ColorPanelView(activity);
   //noinspection ResourceType
   multiColorView.setId(MULTI_ID);
   multiColorView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
   multiColorView.setPointerDrawable(
       CompatUtils.getDrawable(activity, R.drawable.color_picker_cursor_top));
   multiColorView.setLockPointerInBounds(true);
   multiColorView.setOnColorChangedListener(
       new ColorPanelView.OnColorChangedListener() {
         @Override
         public void onColorChanged(ColorPanelView view, int color) {
           updateCurrentColor(color);
         }
       });
   rootLayout.addView(multiColorView);
   LinearLayout previewLayout = new LinearLayout(activity);
   previewLayout.setOrientation(LinearLayout.HORIZONTAL);
   previewLayout.setGravity(Gravity.CENTER);
   previewLayout.setLayoutParams(
       new LinearLayout.LayoutParams(MATCH_PARENT, ConvertUtils.toPx(activity, 30)));
   hexValView = new EditText(activity);
   hexValView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
   hexValView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
   hexValView.setImeOptions(EditorInfo.IME_ACTION_DONE);
   hexValView.setGravity(Gravity.CENTER);
   hexValView.setBackgroundColor(initColor);
   hexValView.setTextColor(Color.BLACK);
   hexValView.setShadowLayer(3, 0, 2, Color.WHITE); // 设置阴影,以便背景色为黑色系列时仍然看得见
   hexValView.setMinEms(6);
   hexValView.setMaxEms(8);
   hexValView.setPadding(0, 0, 0, 0);
   hexValView.setSingleLine(true);
   hexValView.setOnEditorActionListener(this);
   hexValDefaultColor = hexValView.getTextColors();
   previewLayout.addView(hexValView);
   rootLayout.addView(previewLayout);
   return rootLayout;
 }
  private void initView() {
    backBtn = (Button) this.findViewById(R.id.backBtn);
    backBtn.setOnClickListener(this);

    itemDescriptionTextView = (TextView) this.findViewById(R.id.itemDescriptionTextView);
    itemDescriptionTextView.setSelected(true);
    itemDescriptionTextView.setOnClickListener(this);

    claimsTextView = (TextView) this.findViewById(R.id.claimsTextView);
    claimsTextView.setSelected(false);
    claimsTextView.setOnClickListener(this);

    contentLayout = (LinearLayout) this.findViewById(R.id.contentLayout);

    itemDescOfTransferView = new ItemDescOfTransferView(this);
    itemDescOfTransferView.setVisibility(View.VISIBLE);

    claimsview = new ClaimsView(this);
    claimsview.setVisibility(View.GONE);

    contentLayout.addView(
        itemDescOfTransferView,
        new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    contentLayout.addView(
        claimsview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
  }
Beispiel #17
0
 public ConcertItem(Context context, Concert concert) {
   super(context);
   this.setOrientation(HORIZONTAL);
   LinearLayout layoutConcertData = new LinearLayout(context);
   layoutConcertData.setOrientation(VERTICAL);
   ImageView imgView = new ImageView(context);
   // LayoutParams llp = new LayoutParams(140, 140, Gravity.CENTER_HORIZONTAL);
   // imgView.setLayoutParams(llp);
   imgView.setBackgroundResource(R.drawable.party1);
   this.addView(imgView);
   TextView title = new TextView(context);
   title.setText(concert.getTitle());
   TextView begin = new TextView(context);
   // begin.setText(concert.getBeginDate());
   TextView end = new TextView(context);
   // end.setText(concert.getEndDate());
   TextView price = new TextView(context);
   price.setText("Price : " + concert.getPrice());
   TextView location = new TextView(context);
   location.setText("Location : " + concert.getLocation());
   layoutConcertData.addView(title);
   // this.layoutConcertData.addView(begin);
   // this.layoutConcertData.addView(end);
   layoutConcertData.addView(price);
   layoutConcertData.addView(location);
   this.addView(imgView);
   this.addView(layoutConcertData);
 }
  @Override
  protected void onCreate(Bundle state) {
    super.onCreate(state);

    setRequestedOrientation(SCREEN_ORIENTATION_NOSENSOR);

    String qrData = getIntent().getStringExtra(Intent.EXTRA_TEXT);

    cameraView = new CameraView(this);
    cameraBorder = new LinearLayout(this);
    cameraBorder.setGravity(CENTER);
    cameraBorder.setBackgroundColor(BLACK);
    cameraBorder.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT, 1f));
    cameraBorder.addView(cameraView);

    ImageView qrCodeView = new ImageView(this);

    qrCodeView.setScaleType(FIT_CENTER);
    qrCodeView.setBackgroundColor(WHITE);
    qrCodeView.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT, 1f));

    Display display = getWindowManager().getDefaultDisplay();
    boolean portrait = display.getWidth() < display.getHeight();
    layoutMain = new LinearLayout(this);
    if (portrait) layoutMain.setOrientation(VERTICAL);
    else layoutMain.setOrientation(HORIZONTAL);
    layoutMain.setWeightSum(2);
    layoutMain.addView(cameraBorder);
    layoutMain.addView(qrCodeView);
    setContentView(layoutMain);

    new QrGenAsyncTask(this, qrCodeView).execute(qrData);
  }
  private void DisplayUserSelect() {

    if (UserAcountModel.getInstance().getDocument() == null) return;

    NodeList nodeList = UserAcountModel.getInstance().getDocument().getElementsByTagName("user");
    userSelect = new Button[nodeList.getLength()];
    for (int i = 0; i < nodeList.getLength(); i++) {
      Node node = nodeList.item(i);
      if (node.getNodeType() == Node.ELEMENT_NODE) {
        NamedNodeMap attributes = node.getAttributes();

        Button select = new Button(this);
        TextView text = new TextView(this);
        select.setTag(attributes.getNamedItem("id").getTextContent());
        text.setText(
            attributes.getNamedItem("firstname").getTextContent()
                + " "
                + attributes.getNamedItem("lastname").getTextContent()
                + ": "
                + attributes.getNamedItem("username").getTextContent());
        select.setText(attributes.getNamedItem("id").getTextContent());
        userSelect[i] = select;
        LinearLayout llSelectUser = (LinearLayout) findViewById(R.id.llSelectUsers);
        llSelectUser.addView(text);
        llSelectUser.addView(userSelect[i]);
        userSelect[i].setOnClickListener(handleOnClick(userSelect[i]));
      }
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String response = getIntent().getStringExtra("response");
    boolean success = getIntent().getBooleanExtra("success", false);

    LinearLayout l = new LinearLayout(this);
    l.setOrientation(LinearLayout.VERTICAL);
    l.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    l.setPadding(10, 10, 10, 10);

    TextView t = new TextView(this);
    t.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    t.setGravity(Gravity.CENTER);
    if (success) {
      t.setText(R.string.sync_ok);
    } else {
      t.setText(R.string.sync_failed);
    }
    t.setTextSize(22);
    l.addView(t);
    t = new TextView(this);
    t.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    t.setText(response);
    l.addView(t);
    setContentView(l);
  }
Beispiel #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    loginLinearLayout = (LinearLayout) findViewById(R.id.myLoginLinearLayout);
    loginButton = (Button) findViewById(R.id.loginButton1);
    loginButton.setOnClickListener(registerButtonListener);
    loginTextView = (TextView) findViewById(R.id.loginTextView1);
    usernameEditText = (EditText) findViewById(R.id.usernameEditText1);
    passwordEditText = (EditText) findViewById(R.id.passwordEditText2);

    Bundle extras = getIntent().getExtras();
    isRegistering = extras.getBoolean("registering");

    if (isRegistering) {
      loginTextView.setText("Choose a username and password to register your account");
      loginButton.setText("Register");
    } else {
      loginTextView.setText("Login with your username and password");
      loginButton.setText("Login");

      TextView tv = new TextView(this);
      tv.setText("Don't have an account?");
      loginLinearLayout.addView(tv);

      registerButton = new Button(this);
      registerButton.setText("Register");
      registerButton.setOnClickListener(registerButtonListener);
      loginLinearLayout.addView(registerButton);
    }
  }
Beispiel #22
0
  public void setNativeView(RhoNativeViewManager.RhoNativeView nview) {
    restoreWebView();
    mNativeView = nview;
    mNativeViewView = mNativeView.getView();
    if (mNativeViewView != null) {
      view.removeView(webView);
      // int view_index = 0;
      // if (navBar != null) {
      // view_index = 1;
      // }
      if (navBar != null) {
        view.removeView(navBar);
      }
      if (toolBar != null) {
        view.removeView(toolBar);
      }
      int index = 0;
      if (navBar != null) {
        view.addView(navBar, index);
        index++;
      }
      view.addView(mNativeViewView, index, new LinearLayout.LayoutParams(FILL_PARENT, 0, 1));
      index++;
      if (toolBar != null) {
        view.addView(toolBar, index);
      }

      // view.bringChildToFront(mNativeViewView);
      // view.requestLayout();
    } else {
      mNativeView = null;
      mNativeViewView = null;
    }
  }
  @Override
  protected View onCreateDialogView() {
    LinearLayout.LayoutParams params;
    LinearLayout layout = new LinearLayout(mContext);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setPadding(6, 6, 6, 6);

    mValueText = new TextView(mContext);
    mValueText.setGravity(Gravity.CENTER_HORIZONTAL);
    mValueText.setTextSize(32);
    params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    layout.addView(mValueText, params);

    mSeekBar = new SeekBar(mContext);
    mSeekBar.setOnSeekBarChangeListener(this);

    layout.addView(
        mSeekBar,
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));

    if (shouldPersist()) {
      mValue = getPersistedInt(mDefault);
    }

    mSeekBar.setMax((int) ((mMax - mMin) / mInterval));
    mSeekBar.setProgress((int) ((mValue - mMin) / mInterval));

    String t = String.valueOf(mValue);
    mValueText.setText(mSuffix == null ? t : t.concat(mSuffix));
    return layout;
  }
Beispiel #24
0
  public void restoreWebView() {
    if (mNativeView != null) {
      view.removeView(mNativeViewView);
      mNativeViewView = null;
      // int view_index = 0;
      // if (navBar != null) {
      // view_index = 1;
      // }

      if (navBar != null) {
        view.removeView(navBar);
      }
      if (toolBar != null) {
        view.removeView(toolBar);
      }

      int index = 0;
      if (navBar != null) {
        view.addView(navBar, index);
        index++;
      }
      view.addView(webView, index, new LinearLayout.LayoutParams(FILL_PARENT, 0, 1));
      index++;
      if (toolBar != null) {
        view.addView(toolBar, index);
      }

      // view.bringChildToFront(webView);

      mNativeView.destroyView();
      mNativeView = null;
      // view.requestLayout();
    }
  }
Beispiel #25
0
  // used when switching languages or building a hebrew page
  // reverse the order of every row in the grid
  private void flipViews(boolean flipTabsAlso) {

    int numChildren;
    if (tabRoot != null && flipTabsAlso) {
      numChildren = tabRoot.getChildCount();
      for (int i = 0; i < numChildren; i++) {
        View tempView = tabRoot.getChildAt(numChildren - 1);
        tabRoot.removeViewAt(numChildren - 1);
        tabRoot.addView(tempView, i);
      }
    }

    for (int i = 0; i < gridRoot.getChildCount(); i++) {
      View v = gridRoot.getChildAt(i);
      if (v instanceof LinearLayout) {
        LinearLayout ll = (LinearLayout) v;
        numChildren = ll.getChildCount();
        for (int j = 0; j < numChildren - 1; j++) {
          View tempView = ll.getChildAt(numChildren - 1);
          ll.removeViewAt(numChildren - 1);
          ll.addView(tempView, j);
        }
      }
    }
  }
Beispiel #26
0
  private void init(MainView v, Object params) {
    Context ctx = RhodesActivity.getContext();

    view = new MyView(ctx);
    view.setOrientation(LinearLayout.VERTICAL);
    view.setGravity(Gravity.BOTTOM);
    view.setLayoutParams(new LinearLayout.LayoutParams(FILL_PARENT, FILL_PARENT));

    webView = null;
    if (v != null) webView = v.detachWebView();
    if (webView == null) webView = RhodesActivity.safeGetInstance().createWebView();
    view.addView(webView, new LinearLayout.LayoutParams(FILL_PARENT, 0, 1));

    LinearLayout bottom = new LinearLayout(ctx);
    bottom.setOrientation(LinearLayout.HORIZONTAL);
    bottom.setBackgroundColor(Color.GRAY);
    bottom.setLayoutParams(new LinearLayout.LayoutParams(FILL_PARENT, WRAP_CONTENT, 0));
    view.addView(bottom);

    toolBar = bottom;

    setupToolbar(toolBar, params);

    webView.requestFocus();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GdxTests.tests.add(MatrixTest.class);

    LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.HORIZONTAL);

    list = new FrameLayout(this);
    list.setId(1);
    list.setLayoutParams(
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    layout.addView(list);

    list.setLayoutParams(new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));

    view = new FrameLayout(this);
    view.setId(2);
    view.setLayoutParams(new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 2));
    layout.addView(view);

    setContentView(layout);

    if (savedInstanceState == null) {
      getSupportFragmentManager().beginTransaction().add(1, new TestListFragment()).commit();
    }
  }
Beispiel #28
0
  public void addNavBar(String title, Map<Object, Object> left, Map<Object, Object> right) {
    removeNavBar();

    Context ctx = RhodesActivity.getContext();

    LinearLayout top = new LinearLayout(ctx);
    top.setOrientation(LinearLayout.HORIZONTAL);
    top.setBackgroundColor(Color.GRAY);
    top.setGravity(Gravity.CENTER);
    top.setLayoutParams(new LinearLayout.LayoutParams(FILL_PARENT, WRAP_CONTENT, 0));

    View leftButton = createButton(left);
    leftButton.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1));
    top.addView(leftButton);

    TextView label = new TextView(ctx);
    label.setText(title);
    label.setGravity(Gravity.CENTER);
    label.setTextSize((float) 30.0);
    label.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 2));
    top.addView(label);

    if (right != null) {
      View rightButton = createButton(right);
      rightButton.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1));
      top.addView(rightButton);
    }

    navBar = top;
    view.addView(navBar, 0);
  }
  private void addMessageToLayout(Message message) {
    TextView user = new TextView(this);
    TextView messageView = new TextView(this);

    user.setTextColor(getResources().getColor(R.color.messageTitle));
    user.setText(
        "("
            + DateFormat.format("hh:mm aa", message.getTimestamp())
            + ") "
            + message.getUsername()
            + ":");
    user.setTextSize(15);
    user.setPadding(5, 15, 5, 0);
    user.setTypeface(Typeface.DEFAULT_BOLD);

    messageView.setText(message.getContent());
    messageView.setTextColor(getResources().getColor(R.color.textColor));
    messageView.setTextSize(15);
    messageView.setPadding(5, 0, 5, 0);

    View line = new View(this);
    line.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 1));
    line.setBackgroundColor(getResources().getColor(R.color.messageLine));
    line.setPadding(0, 0, 0, 15);

    messages.addView(user);
    messages.addView(messageView);
    messages.addView(line);
  }
Beispiel #30
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // Find Views
    mListView = (ListView) findViewById(R.id.listView1);
    /** 用mLinear做为load-progress的容器。 */
    LinearLayout mLinear = new LinearLayout(this);
    mLinear.setOrientation(LinearLayout.HORIZONTAL);
    mProgressBar = new ProgressBar(this);
    mProgressBar.setPadding(0, 0, 15, 0);
    mLinear.addView(mProgressBar, WClayoutParams);

    TextView textView = new TextView(this);
    textView.setText("加载中...");
    textView.setGravity(Gravity.CENTER_VERTICAL);
    mLinear.addView(textView, FFlayoutParams);

    mLinear.setGravity(Gravity.CENTER);

    registerForContextMenu(mListView);
    // 将load-progress加进ListView的最底行
    mListView.addFooterView(mLinear);
    mAdapter = new PageAdapter();
    mListView.setAdapter(mAdapter);
    mListView.setOnScrollListener(this);
  }