Beispiel #1
1
  private void initViews() {
    body = (RelativeLayout) findViewById(R.id.body);
    loadingoverlay = (LoadingOverlay) findViewById(R.id.loadingoverlay);

    registerTV = (TextView) findViewById(R.id.registerTV);
    findpwdTV = (TextView) findViewById(R.id.findpwdTV);

    userNameET = (ExEditText) findViewById(R.id.userNameET);
    passwordET = (ExEditText) findViewById(R.id.passwordET);
    loginButton = (Button) findViewById(R.id.loginButton);

    EditText pwdinneret = passwordET.getEditText();
    int pl = pwdinneret.getPaddingLeft();
    pwdinneret.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    pwdinneret.setBackgroundDrawable(getResources().getDrawable(R.drawable.blue_input_bg));
    pwdinneret.setPadding(pl, 0, 0, 0); // 如果同时用,setPadding 将不会起作用,用的是
    // drawable里面自带的padding。setPadding要在setBackgroundDrawable之后执行才能生效
    pwdinneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});

    EditText usernameinneret = userNameET.getEditText();
    pl = usernameinneret.getPaddingLeft();
    usernameinneret.setBackgroundDrawable(getResources().getDrawable(R.drawable.blue_input_bg));
    usernameinneret.setPadding(pl, 0, 0, 0);
    usernameinneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.proanswerwrite, container, false);
    dbVersion = ((MainActivity) getActivity()).getDBVersion();
    mTwoPane = ((MainActivity) getActivity()).getTwoPane();
    num = getArguments().getString("num");
    ansCount = getArguments().getString("ansCount");

    dbHelper = new DBHelper(getActivity(), dbName, null, dbVersion);
    db = dbHelper.getWritableDatabase();
    sql = "SELECT * FROM inner_db;";
    Cursor cursor = db.rawQuery(sql, null);
    cursor.moveToFirst();
    tempnick = cursor.getString(3);

    abar = ((MainActivity) getActivity()).getSupportActionBar();
    abar.setTitle(tempnick + "님에게 답변중");
    abar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE);
    abar.setDisplayHomeAsUpEnabled(true);

    ldialog = new LoadingDialog(this.getActivity()); // 변경
    ldialog
        .getWindow()
        .setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    ldialog.show();
    answerViewThread = (AnswerViewThread) new AnswerViewThread();
    answerViewThread.execute();

    conet = (EditText) rootView.findViewById(R.id.replycon);
    conet.setPadding(20, 20, 20, 20);

    return rootView;
  }
Beispiel #3
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;
 }
Beispiel #4
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    LinearLayout ll = (LinearLayout) findViewById(R.id.container);
    Field[] fields = InputType.class.getDeclaredFields();
    LayoutParams lparams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    for (Field f : fields) {
      if (!f.getType().equals(int.class)) continue;
      int mods = f.getModifiers();
      if ((mods & (Modifier.FINAL | Modifier.STATIC)) == 0) continue;

      TextView v = new TextView(this);
      EditText e = new EditText(this);
      v.setLayoutParams(lparams);
      e.setPadding(5, 5, 5, 15);
      e.setLayoutParams(lparams);

      try {
        e.setInputType(f.getInt(null));
        v.setText(f.getName());
      } catch (Exception e1) {
        e1.printStackTrace();
      }

      ll.addView(v);
      ll.addView(e);
    }
  }
  /** 사용자 정보를 layout에 그려준다. */
  @Override
  protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    View view = inflate(getContext(), R.layout.kakao_profile_layout, this);

    profile = (NetworkImageView) view.findViewById(R.id.com_kakao_profile_image);
    if (profileImageURL != null) setProfileURL(profileImageURL);
    if (!editable) {
      ImageView editableMark = (ImageView) view.findViewById(R.id.profile_edit);
      editableMark.setVisibility(View.INVISIBLE);
    }

    nicknameText = (EditText) view.findViewById(R.id.com_kakao_profile_nickname);
    if (!editable) {
      nicknameText.setEnabled(false);
      nicknameText.setKeyListener(null);
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        nicknameText.setBackground(null);
      } else {
        nicknameText.setBackgroundDrawable(null);
      }
      nicknameText.setPadding(0, 0, 0, 0);
      nicknameText.setTextColor(getResources().getColor(R.color.com_kakao_profile_text));
    }
    if (nickname != null) nicknameText.setText(nickname);

    userIdText = (TextView) view.findViewById(R.id.com_kakao_profile_userId);
    if (userId != null) userIdText.setText(userId);
  }
 private void showCarDialog() {
   final EditText inputText = new EditText(this);
   inputText.setInputType(InputType.TYPE_CLASS_TEXT);
   inputText.setPadding(75, 20, 20, 20);
   new AlertDialog.Builder(this)
       .setTitle("Insert your car's registration number")
       .setMessage("Insert your car's registration number or exit.")
       .setView(inputText)
       .setPositiveButton(
           "Save",
           new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int whichButton) {
               String text = inputText.getText().toString();
               if (text.length() > 0) {
                 mediator.setCar(text);
               } else {
                 Toast.makeText(getApplicationContext(), "No car submitted", Toast.LENGTH_LONG)
                     .show();
                 finish();
               }
             }
           })
       .setNegativeButton(
           "Cancel",
           new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int whichButton) {
               finish();
             }
           })
       .show();
 }
  @SuppressLint("NewApi")
  public void onMenuCopyClicked() {
    String text =
        dobroitem.post.getMessage() == null
            ? dobroitem.post.getFormattedText().toString()
            : dobroitem.post.getMessage();
    /*
    Intent i = new Intent(getContext(), CopyPasteActivity.class);
    i.putExtra("text", );
    i.putExtra(GDActivity.GD_ACTION_BAR_TITLE, "Скопируйте текст");
    getContext().startActivity(i);
    */
    View v = null;
    if (Build.VERSION.SDK_INT < 11) {
      EditText edit = new EditText(getContext());
      edit.setPadding(10, 10, 10, 10);
      edit.setGravity(Gravity.TOP);
      edit.setTextColor(Color.BLACK);
      edit.setBackgroundColor(Color.WHITE);
      edit.setInputType(InputType.TYPE_NULL);
      edit.setHorizontallyScrolling(false);
      edit.setSingleLine(false);
      edit.setText(text);
      v = edit;
    } else {
      SharedPreferences prefs = DobroApplication.getApplicationStatic().getDefaultPrefs();
      int font_size = 10;
      try {
        font_size = Integer.parseInt(prefs.getString("font_size", "16"));
      } catch (Exception e) {
      }
      if (font_size < 10) font_size = 10;

      TextView edit = new TextView(getContext());
      edit.setPadding(10, 10, 10, 10);
      edit.setTextSize(font_size);
      edit.setTextColor(Color.BLACK);
      edit.setBackgroundColor(Color.WHITE);
      edit.setFocusable(true);
      edit.setTextIsSelectable(true);
      edit.setText(text);
      v = edit;
    }
    Dialog d = new Dialog(getContext(), android.R.style.Theme_NoTitleBar_Fullscreen);
    d.requestWindowFeature(Window.FEATURE_NO_TITLE);
    d.setCanceledOnTouchOutside(true);
    d.setContentView(v);
    d.show();
  }
 public EditDialog(Context context, String title, String value, OnDataSetListener callback) {
   super(context);
   mCallback = callback;
   TextView label = new TextView(context);
   label.setText("hint");
   edit = new EditText(context);
   edit.setText(value);
   edit.setPadding(30, 0, 0, 0);
   layout = new LinearLayout(context);
   layout.setOrientation(LinearLayout.VERTICAL);
   LinearLayout.LayoutParams param2 = new LinearLayout.LayoutParams(200, 50);
   param2.leftMargin = 30;
   layout.addView(edit, param2);
   setView(layout);
   setTitle(title);
   setButton(context.getText(R.string.btn_ok), this);
   setButton2(context.getText(R.string.btn_cancle), (OnClickListener) null);
 }
  private void setupViews(Context context, AttributeSet attrs) {
    mImg = new ImageView(context);
    LayoutParams lp0 = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    //		lp0.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    //		lp0.addRule(RelativeLayout.CENTER_VERTICAL);
    //		mImg.setPadding(0, 0, 10, 0);
    mImg.setImageResource(R.drawable.iphone_clean_icon);
    mImg.setVisibility(View.GONE);
    mImg.setId(R.id.iphonecontact_clear_edittext);
    addView(mImg, lp0);

    mImg.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            mEdt.setText("");
          }
        });

    mEdt = new EditText(context);
    mEdt.setBackgroundResource(android.R.color.transparent);
    if (mbg != null) {
      setBackgroundDrawable(mbg);
    }
    mEdt.setPadding(mEdtTextPaddingLeft, 0, 0, 0);
    mEdt.setTextSize(mEdtTextSize);
    mEdt.setGravity(Gravity.CENTER_VERTICAL);
    if (mEdtTextColor != 0) {
      mEdt.setTextColor(mEdtTextColor);
    }
    mEdt.setHint(mEdtHint);
    mEdt.setSingleLine(true);
    LayoutParams lp1 = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    addView(mEdt, lp1);
    mEdt.addTextChangedListener(new EditTextWatcher());
  }
Beispiel #10
0
  private LinearLayout createProductInfo(com.app.commons.JSONObject jo) {
    JSONArray ja = jo.getJSONArray("settleGoods");
    if (ja == null || ja.length() == 0) {
      return null;
    }
    final String productSku = jo.getString("productSku");
    LinearLayout info = new LinearLayout(CartActivtiy.this);
    int cart_height = Math.round(getResources().getDimension(R.dimen.cart_height));
    info.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    info.setMinimumHeight(cart_height);
    info.setOrientation(LinearLayout.HORIZONTAL);
    info.setGravity(Gravity.CENTER_VERTICAL);
    info.setBackgroundResource(R.drawable.border2);
    info.setPadding(10, 0, 10, 0);
    final CheckBox rb = new CheckBox(CartActivtiy.this);
    rb.setPadding(0, 0, 10, 0);
    rb.setButtonDrawable(R.drawable.checkbox);
    if (jo.getBoolean("checked")) {
      rb.setChecked(true);
      settleNum = settleNum + 1;
    } else {
      rb.setChecked(false);
    }
    rb.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            Map<String, Object> param = new HashMap<>();
            param.put("ids", productSku);
            param.put("checkeds", rb.isChecked() ? "Y" : "N");
            Utils.asyncHttpRequestPost(
                Constants.URL_CART_CHANGESTATUS,
                param,
                new JsonHttpResponseHandler() {
                  @Override
                  public void onSuccess(int statusCode, Header[] headers, JSONObject res) {
                    com.app.commons.JSONObject jo = new com.app.commons.JSONObject(res);
                    if (statusCode == 200) {
                      if (jo.getBoolean("success")) {
                        flushCartInfo();
                      } else {
                        Toast.makeText(
                                CartActivtiy.this, jo.getString("errMsg"), Toast.LENGTH_SHORT)
                            .show();
                        flushCartInfo();
                      }
                    } else {
                      Toast.makeText(CartActivtiy.this, statusCode, Toast.LENGTH_SHORT).show();
                    }
                  }
                });
          }
        });
    info.addView(rb);
    LinearLayout center = new LinearLayout(CartActivtiy.this);
    LinearLayout.LayoutParams centerLP =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    centerLP.weight = 1;
    center.setOrientation(LinearLayout.VERTICAL);
    center.setLayoutParams(centerLP);
    center.setPadding(10, 0, 0, 0);
    int wh2 = Math.round(getResources().getDimension(R.dimen.btn_cart_height));
    if (ja != null && ja.length() > 0) {
      ImageView iv = new ImageView(CartActivtiy.this);
      int wh = Math.round(getResources().getDimension(R.dimen.cart_img_wh));
      iv.setLayoutParams(new ViewGroup.LayoutParams(wh, wh));
      iv.setImageResource(R.drawable.loading);
      Utils.asyncLoadInternetImageView(
          iv, Constants.URL_IMAGE + "/200X200" + ja.getJSONObject(0).getString("photoUrl"));
      info.addView(iv);
      TextView tv = new TextView(CartActivtiy.this);
      if (ja.length() == 1) {
        tv.setText(ja.getJSONObject(0).getString("goodsName"));
      } else {
        tv.setText(getResources().getString(R.string.goods_set));
      }
      center.addView(tv);
      LinearLayout bottom = new LinearLayout(CartActivtiy.this);
      bottom.setLayoutParams(
          new ViewGroup.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
      bottom.setOrientation(LinearLayout.HORIZONTAL);
      bottom.setPadding(0, 15, 0, 0);
      LinearLayout.LayoutParams wrap = new LinearLayout.LayoutParams(wh2, wh2);
      wrap.setMargins(5, 0, 5, 0);
      final EditText et = new EditText(CartActivtiy.this);
      et.setBackgroundResource(R.drawable.wrapcontent);
      et.setText(jo.getString("number"));
      et.setSingleLine(true);
      et.setKeyListener(new DigitsKeyListener(false, false));
      et.setLayoutParams(wrap);
      et.setGravity(Gravity.RIGHT);
      et.setPadding(5, 2, 5, 2);
      et.setFocusable(true);
      et.addTextChangedListener(
          new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}

            @Override
            public void afterTextChanged(Editable editable) {
              if (editable.length() == 0) {
                editable.append(String.valueOf(def_num));
              } else if (Integer.parseInt(editable.toString()) <= 0) {
                editable.replace(0, 1, String.valueOf(def_num));
              } else if (editable.length() > 2) {
                editable.replace(0, editable.length(), String.valueOf(def_maxnum));
              }
              Map<String, Object> param = new HashMap<>();
              param.put("id", productSku);
              param.put("count", editable.toString());
              Utils.asyncHttpRequestPost(
                  Constants.URL_CART_CHANGENUMBER,
                  param,
                  new JsonHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, Header[] headers, JSONObject res) {
                      com.app.commons.JSONObject jo = new com.app.commons.JSONObject(res);
                      if (statusCode == 200) {
                        if (jo.getBoolean("success")) {
                          flushCartInfo();
                        } else {
                          Toast.makeText(
                                  CartActivtiy.this, jo.getString("errMsg"), Toast.LENGTH_SHORT)
                              .show();
                          flushCartInfo();
                        }
                      } else {
                        Toast.makeText(CartActivtiy.this, statusCode, Toast.LENGTH_SHORT).show();
                      }
                    }
                  });
            }
          });
      ImageView sub = new ImageView(CartActivtiy.this);
      sub.setScaleType(ImageView.ScaleType.FIT_CENTER);
      sub.setLayoutParams(wrap);
      sub.setImageResource(R.drawable.cart_sub);
      sub.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              int num = Integer.parseInt(et.getText().toString());
              if (num > 1) {
                et.setText(String.valueOf((num - 1)));
              }
            }
          });
      ImageView add = new ImageView(CartActivtiy.this);
      add.setLayoutParams(wrap);
      add.setScaleType(ImageView.ScaleType.FIT_CENTER);
      add.setImageResource(R.drawable.cart_add);
      add.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              Integer num = Integer.parseInt(et.getText().toString());
              et.setText(String.valueOf(num + 1));
            }
          });
      bottom.addView(sub);
      bottom.addView(et);
      bottom.addView(add);
      if (jo.getString("remark") != null) {
        TextView remark = new TextView(CartActivtiy.this);
        remark.setText(jo.getString("remark"));
        remark.setTextColor(getResources().getColor(R.color.red));
        bottom.addView(remark);
      }
      center.addView(bottom);
    }
    LinearLayout right = new LinearLayout(CartActivtiy.this);
    right.setOrientation(LinearLayout.VERTICAL);
    right.setGravity(Gravity.CENTER);
    right.setPadding(0, 0, 0, 5);
    TextView tv2 = new TextView(CartActivtiy.this);
    tv2.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    tv2.setGravity(Gravity.CENTER);
    tv2.setText("¥" + jo.getString("amount"));
    tv2.setTextColor(getResources().getColor(R.color.red));
    right.addView(tv2);
    ImageButton ib = new ImageButton(CartActivtiy.this);
    int cdelw = Math.round(getResources().getDimension(R.dimen.cart_delete_width));
    int cdelh = Math.round(getResources().getDimension(R.dimen.cart_delete_height));
    ib.setLayoutParams(new ViewGroup.LayoutParams(cdelw, cdelh));
    ib.setScaleType(ImageView.ScaleType.FIT_CENTER);
    ib.setBackgroundResource(R.drawable.border3);
    ib.setImageResource(R.drawable.cart_delete);
    ib.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Map<String, Object> param = new HashMap<String, Object>();
            param.put("ids", productSku);
            Utils.asyncHttpRequestPost(
                Constants.URL_CART_DELETEPRODUCTS,
                param,
                new JsonHttpResponseHandler() {
                  @Override
                  public void onSuccess(int statusCode, Header[] headers, JSONObject res) {
                    com.app.commons.JSONObject jo = new com.app.commons.JSONObject(res);
                    if (statusCode == 200) {
                      if (jo.getBoolean("success")) {
                        flushCartInfo();
                      } else {
                        Toast.makeText(
                                CartActivtiy.this, jo.getString("errMsg"), Toast.LENGTH_SHORT)
                            .show();
                        flushCartInfo();
                      }
                    } else {
                      Toast.makeText(CartActivtiy.this, statusCode, Toast.LENGTH_SHORT).show();
                    }
                  }
                });
          }
        });
    right.addView(ib);
    info.addView(center);
    info.addView(right);
    return info;
  }
  @Override
  public void createControl(TitaniumModuleManager tmm) {
    tv = new EditText(tmm.getAppContext());
    tv.isFocusable();
    tv.setId(100);

    tv.addTextChangedListener(this);
    tv.setOnEditorActionListener(this);
    tv.setText(value);
    tv.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
    tv.setPadding(4, 2, 4, 2);
    tv.setSingleLine();
    TitaniumUIHelper.styleText(tv, fontSize, fontWeight);

    if (color != null) {
      tv.setTextColor(TitaniumColorHelper.parseColor(color));
    }
    if (backgroundColor != null) {
      tv.setBackgroundColor(TitaniumColorHelper.parseColor(backgroundColor));
    }

    cancelBtn = new ImageButton(tmm.getAppContext());
    cancelBtn.isFocusable();
    cancelBtn.setId(101);
    cancelBtn.setPadding(0, 0, 0, 0);
    Drawable d = new BitmapDrawable(this.getClass().getResourceAsStream("cancel.png"));
    cancelBtn.setImageDrawable(d);
    cancelBtn.setMinimumWidth(48);

    cancelBtn.setVisibility(showCancel ? View.VISIBLE : View.GONE);
    cancelBtn.setOnClickListener(
        new OnClickListener() {

          public void onClick(View view) {
            handler.sendEmptyMessage(MSG_CANCEL);
          }
        });

    RelativeLayout layout = new RelativeLayout(tmm.getAppContext());
    control = layout;

    layout.setGravity(Gravity.NO_GRAVITY);
    layout.setPadding(0, 0, 0, 0);
    if (barColor != null) {
      layout.setBackgroundColor(TitaniumColorHelper.parseColor(barColor));
    }

    RelativeLayout.LayoutParams params =
        new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    params.addRule(RelativeLayout.LEFT_OF, 101);
    params.setMargins(4, 4, 0, 4);
    layout.addView(tv, params);

    params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    params.setMargins(0, 4, 4, 4);
    layout.addView(cancelBtn, params);
  }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle("Custom Regex");

    final TextView regexLabel = new TextView(getActivity());
    regexLabel.setText("Enter the Regex to match");
    int paddingE = getResources().getDimensionPixelOffset(R.dimen.card_external_padding);
    int paddingI = getResources().getDimensionPixelOffset(R.dimen.card_internal_padding);
    regexLabel.setPadding(paddingI, paddingI, paddingI, 0);

    // Use an EditText view to get user input.
    final EditText input = new EditText(getActivity());
    input.setId(0);
    input.setSingleLine(true);
    input.setPadding(paddingI, 0, paddingI, 0);

    final TextView secondsLabel = new TextView(getActivity());
    secondsLabel.setText("Enter the interval in seconds");
    secondsLabel.setPadding(paddingI, paddingE, paddingI, 0);

    final EditText secondsEdit = new EditText(getActivity());
    secondsEdit.setSingleLine(true);
    secondsEdit.setInputType(InputType.TYPE_CLASS_NUMBER);
    secondsEdit.setPadding(paddingI, 0, paddingI, paddingI);

    LinearLayout parentView = new LinearLayout(getActivity());
    parentView.setOrientation(LinearLayout.VERTICAL);
    ViewGroup.LayoutParams LLParams =
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    parentView.setLayoutParams(LLParams);
    parentView.addView(regexLabel);
    parentView.addView(input);
    parentView.addView(secondsLabel);
    parentView.addView(secondsEdit);

    builder.setView(parentView);

    if (mDefaultValue != null) {
      input.setText(mDefaultValue);
    }

    if (mDefaultSeconds != null) {
      secondsEdit.setText(mDefaultSeconds.toString());
    }

    builder.setPositiveButton(
        "Ok",
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int whichButton) {
            String value = input.getText().toString();
            String seconds = secondsEdit.getText().toString();
            // Set value in Prefs and reload them for the list.
            SharedPreferences prefs =
                getActivity()
                    .getSharedPreferences(
                        "com.ryansteckler.nlpunbounce_preferences", Context.MODE_WORLD_READABLE);
            Set<String> sampleSet = new HashSet<String>();
            Set<String> set =
                new HashSet<String>(prefs.getStringSet(mDefaultSetName + "_regex_set", sampleSet));
            set.add(value + "$$||$$" + seconds);
            if (mDefaultValue != "") {
              set.remove(mDefaultValue + "$$||$$" + mDefaultSeconds);
            }

            SharedPreferences.Editor edit = prefs.edit();
            edit.putStringSet(mDefaultSetName + "_regex_set", set);
            edit.commit();
            ((WakelockRegexFragment) (getTargetFragment())).reload();
            return;
          }
        });

    builder.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            return;
          }
        });

    return builder.create();
  }
  public ActionBarMenuItem setIsSearchField(boolean value) {
    if (value && searchField == null) {
      searchField = new EditText(getContext());
      searchField.setTextSize(18);
      searchField.setTextColor(0xffffffff);
      searchField.setSingleLine(true);
      searchField.setBackgroundResource(R.drawable.search_light_states);
      searchField.setPadding(0, 0, 0, 0);
      searchField.setInputType(EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
      if (android.os.Build.VERSION.SDK_INT < 11) {
        searchField.setOnCreateContextMenuListener(
            new OnCreateContextMenuListener() {
              public void onCreateContextMenu(
                  ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
                menu.clear();
              }
            });
      } else {
        searchField.setCustomSelectionActionModeCallback(
            new ActionMode.Callback() {
              public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
              }

              public void onDestroyActionMode(ActionMode mode) {}

              public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                return false;
              }

              public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                return false;
              }
            });
      }
      searchField.setOnEditorActionListener(
          new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
              if (actionId == EditorInfo.IME_ACTION_SEARCH
                  || event != null
                      && event.getAction() == KeyEvent.ACTION_UP
                      && event.getKeyCode() == KeyEvent.KEYCODE_SEARCH) {
                AndroidUtilities.hideKeyboard(searchField);
              }
              return false;
            }
          });
      searchField.addTextChangedListener(
          new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
              if (listener != null) {
                listener.onTextChanged(searchField);
              }
            }

            @Override
            public void afterTextChanged(Editable s) {}
          });

      /*
          ImageView img = (ImageView) searchView.findViewById(R.id.search_close_btn);
      if (img != null) {
          img.setImageResource(R.drawable.ic_msg_btn_cross_custom);
      }
           */
      try {
        Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
        mCursorDrawableRes.setAccessible(true);
        mCursorDrawableRes.set(searchField, R.drawable.search_carret);
      } catch (Exception e) {
        // nothing to do
      }
      if (Build.VERSION.SDK_INT >= 11) {
        searchField.setImeOptions(EditorInfo.IME_FLAG_NO_FULLSCREEN | EditorInfo.IME_ACTION_SEARCH);
        searchField.setTextIsSelectable(false);
      } else {
        searchField.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
      }
      parentMenu.addView(searchField, 0);
      LinearLayout.LayoutParams layoutParams =
          (LinearLayout.LayoutParams) searchField.getLayoutParams();
      layoutParams.weight = 1;
      layoutParams.width = 0;
      layoutParams.gravity = Gravity.CENTER_VERTICAL;
      layoutParams.height = AndroidUtilities.dp(36);
      layoutParams.rightMargin = AndroidUtilities.dp(22);
      layoutParams.leftMargin = AndroidUtilities.dp(6);
      searchField.setLayoutParams(layoutParams);
      searchField.setVisibility(GONE);
    }
    isSearchField = value;
    return this;
  }
  @Override
  public View createView(LayoutInflater inflater) {
    if (fragmentView == null) {
      searching = false;
      searchWas = false;

      actionBar.setBackButtonImage(R.drawable.ic_ab_back);
      actionBar.setAllowOverlayTitle(true);
      if (isAlwaysShare) {
        actionBar.setTitle(
            LocaleController.getString("AlwaysShareWithTitle", R.string.AlwaysShareWithTitle));
      } else if (isNeverShare) {
        actionBar.setTitle(
            LocaleController.getString("NeverShareWithTitle", R.string.NeverShareWithTitle));
      } else {
        actionBar.setTitle(
            isBroadcast
                ? LocaleController.getString("NewBroadcastList", R.string.NewBroadcastList)
                : LocaleController.getString("NewGroup", R.string.NewGroup));
        actionBar.setSubtitle(
            LocaleController.formatString(
                "MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
      }

      actionBar.setActionBarMenuOnItemClick(
          new ActionBar.ActionBarMenuOnItemClick() {
            @Override
            public void onItemClick(int id) {
              if (id == -1) {
                finishFragment();
              } else if (id == done_button) {
                if (selectedContacts.isEmpty()) {
                  return;
                }
                ArrayList<Integer> result = new ArrayList<>();
                result.addAll(selectedContacts.keySet());
                if (isAlwaysShare || isNeverShare) {
                  if (delegate != null) {
                    delegate.didSelectUsers(result);
                  }
                  finishFragment();
                } else {
                  Bundle args = new Bundle();
                  args.putIntegerArrayList("result", result);
                  args.putBoolean("broadcast", isBroadcast);
                  presentFragment(new GroupCreateFinalActivity(args));
                }
              }
            }
          });
      ActionBarMenu menu = actionBar.createMenu();
      menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

      searchListViewAdapter = new ContactsSearchAdapter(getParentActivity(), null, false);
      searchListViewAdapter.setCheckedMap(selectedContacts);
      searchListViewAdapter.setUseUserCell(true);
      listViewAdapter = new ContactsAdapter(getParentActivity(), true, false, null);
      listViewAdapter.setCheckedMap(selectedContacts);

      fragmentView = new LinearLayout(getParentActivity());
      LinearLayout linearLayout = (LinearLayout) fragmentView;
      linearLayout.setOrientation(LinearLayout.VERTICAL);

      FrameLayout frameLayout = new FrameLayout(getParentActivity());
      linearLayout.addView(frameLayout);
      LinearLayout.LayoutParams layoutParams =
          (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
      layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
      layoutParams.gravity = Gravity.TOP;
      frameLayout.setLayoutParams(layoutParams);

      userSelectEditText = new EditText(getParentActivity());
      userSelectEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
      userSelectEditText.setHintTextColor(0xff979797);
      userSelectEditText.setTextColor(0xff212121);
      userSelectEditText.setInputType(
          InputType.TYPE_TEXT_VARIATION_FILTER
              | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
              | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
      userSelectEditText.setMinimumHeight(AndroidUtilities.dp(54));
      userSelectEditText.setSingleLine(false);
      userSelectEditText.setLines(2);
      userSelectEditText.setMaxLines(2);
      userSelectEditText.setVerticalScrollBarEnabled(true);
      userSelectEditText.setHorizontalScrollBarEnabled(false);
      userSelectEditText.setPadding(0, 0, 0, 0);
      userSelectEditText.setImeOptions(
          EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
      userSelectEditText.setGravity(
          (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
      AndroidUtilities.clearCursorDrawable(userSelectEditText);
      frameLayout.addView(userSelectEditText);
      FrameLayout.LayoutParams layoutParams1 =
          (FrameLayout.LayoutParams) userSelectEditText.getLayoutParams();
      layoutParams1.width = FrameLayout.LayoutParams.MATCH_PARENT;
      layoutParams1.height = FrameLayout.LayoutParams.WRAP_CONTENT;
      layoutParams1.leftMargin = AndroidUtilities.dp(10);
      layoutParams1.rightMargin = AndroidUtilities.dp(10);
      layoutParams1.gravity = Gravity.TOP;
      userSelectEditText.setLayoutParams(layoutParams1);

      if (isAlwaysShare) {
        userSelectEditText.setHint(
            LocaleController.getString(
                "AlwaysShareWithPlaceholder", R.string.AlwaysShareWithPlaceholder));
      } else if (isNeverShare) {
        userSelectEditText.setHint(
            LocaleController.getString(
                "NeverShareWithPlaceholder", R.string.NeverShareWithPlaceholder));
      } else {
        userSelectEditText.setHint(
            LocaleController.getString("SendMessageTo", R.string.SendMessageTo));
      }
      if (Build.VERSION.SDK_INT >= 11) {
        userSelectEditText.setTextIsSelectable(false);
      }
      userSelectEditText.addTextChangedListener(
          new TextWatcher() {
            @Override
            public void beforeTextChanged(
                CharSequence charSequence, int start, int count, int after) {
              if (!ignoreChange) {
                beforeChangeIndex = userSelectEditText.getSelectionStart();
                changeString = new SpannableString(charSequence);
              }
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {}

            @Override
            public void afterTextChanged(Editable editable) {
              if (!ignoreChange) {
                boolean search = false;
                int afterChangeIndex = userSelectEditText.getSelectionEnd();
                if (editable.toString().length() < changeString.toString().length()) {
                  String deletedString = "";
                  try {
                    deletedString =
                        changeString.toString().substring(afterChangeIndex, beforeChangeIndex);
                  } catch (Exception e) {
                    FileLog.e("tmessages", e);
                  }
                  if (deletedString.length() > 0) {
                    if (searching && searchWas) {
                      search = true;
                    }
                    Spannable span = userSelectEditText.getText();
                    for (int a = 0; a < allSpans.size(); a++) {
                      XImageSpan sp = allSpans.get(a);
                      if (span.getSpanStart(sp) == -1) {
                        allSpans.remove(sp);
                        selectedContacts.remove(sp.uid);
                      }
                    }
                    if (!isAlwaysShare && !isNeverShare) {
                      actionBar.setSubtitle(
                          LocaleController.formatString(
                              "MembersCount",
                              R.string.MembersCount,
                              selectedContacts.size(),
                              maxCount));
                    }
                    listView.invalidateViews();
                  } else {
                    search = true;
                  }
                } else {
                  search = true;
                }
                if (search) {
                  String text = userSelectEditText.getText().toString().replace("<", "");
                  if (text.length() != 0) {
                    searching = true;
                    searchWas = true;
                    if (listView != null) {
                      listView.setAdapter(searchListViewAdapter);
                      searchListViewAdapter.notifyDataSetChanged();
                      if (android.os.Build.VERSION.SDK_INT >= 11) {
                        listView.setFastScrollAlwaysVisible(false);
                      }
                      listView.setFastScrollEnabled(false);
                      listView.setVerticalScrollBarEnabled(true);
                    }
                    if (emptyTextView != null) {
                      emptyTextView.setText(
                          LocaleController.getString("NoResult", R.string.NoResult));
                    }
                    searchListViewAdapter.searchDialogs(text);
                  } else {
                    searchListViewAdapter.searchDialogs(null);
                    searching = false;
                    searchWas = false;
                    listView.setAdapter(listViewAdapter);
                    listViewAdapter.notifyDataSetChanged();
                    if (android.os.Build.VERSION.SDK_INT >= 11) {
                      listView.setFastScrollAlwaysVisible(true);
                    }
                    listView.setFastScrollEnabled(true);
                    listView.setVerticalScrollBarEnabled(false);
                    emptyTextView.setText(
                        LocaleController.getString("NoContacts", R.string.NoContacts));
                  }
                }
              }
            }
          });

      LinearLayout emptyTextLayout = new LinearLayout(getParentActivity());
      emptyTextLayout.setVisibility(View.INVISIBLE);
      emptyTextLayout.setOrientation(LinearLayout.VERTICAL);
      linearLayout.addView(emptyTextLayout);
      layoutParams = (LinearLayout.LayoutParams) emptyTextLayout.getLayoutParams();
      layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
      emptyTextLayout.setLayoutParams(layoutParams);
      emptyTextLayout.setOnTouchListener(
          new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
              return true;
            }
          });

      emptyTextView = new TextView(getParentActivity());
      emptyTextView.setTextColor(0xff808080);
      emptyTextView.setTextSize(20);
      emptyTextView.setGravity(Gravity.CENTER);
      emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
      emptyTextLayout.addView(emptyTextView);
      layoutParams = (LinearLayout.LayoutParams) emptyTextView.getLayoutParams();
      layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.weight = 0.5f;
      emptyTextView.setLayoutParams(layoutParams);

      FrameLayout frameLayout2 = new FrameLayout(getParentActivity());
      emptyTextLayout.addView(frameLayout2);
      layoutParams = (LinearLayout.LayoutParams) frameLayout2.getLayoutParams();
      layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.weight = 0.5f;
      frameLayout2.setLayoutParams(layoutParams);

      listView = new LetterSectionsListView(getParentActivity());
      listView.setEmptyView(emptyTextLayout);
      listView.setVerticalScrollBarEnabled(false);
      listView.setDivider(null);
      listView.setDividerHeight(0);
      listView.setFastScrollEnabled(true);
      listView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
      listView.setAdapter(listViewAdapter);
      if (Build.VERSION.SDK_INT >= 11) {
        listView.setFastScrollAlwaysVisible(true);
        listView.setVerticalScrollbarPosition(
            LocaleController.isRTL
                ? ListView.SCROLLBAR_POSITION_LEFT
                : ListView.SCROLLBAR_POSITION_RIGHT);
      }
      linearLayout.addView(listView);
      layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
      layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
      listView.setLayoutParams(layoutParams);
      listView.setOnItemClickListener(
          new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
              TLRPC.User user = null;
              if (searching && searchWas) {
                user = searchListViewAdapter.getItem(i);
              } else {
                int section = listViewAdapter.getSectionForPosition(i);
                int row = listViewAdapter.getPositionInSectionForPosition(i);
                if (row < 0 || section < 0) {
                  return;
                }
                user = (TLRPC.User) listViewAdapter.getItem(section, row);
              }
              if (user == null) {
                return;
              }

              boolean check = true;
              if (selectedContacts.containsKey(user.id)) {
                check = false;
                try {
                  XImageSpan span = selectedContacts.get(user.id);
                  selectedContacts.remove(user.id);
                  SpannableStringBuilder text =
                      new SpannableStringBuilder(userSelectEditText.getText());
                  text.delete(text.getSpanStart(span), text.getSpanEnd(span));
                  allSpans.remove(span);
                  ignoreChange = true;
                  userSelectEditText.setText(text);
                  userSelectEditText.setSelection(text.length());
                  ignoreChange = false;
                } catch (Exception e) {
                  FileLog.e("tmessages", e);
                }
              } else {
                if (selectedContacts.size() == maxCount) {
                  return;
                }
                ignoreChange = true;
                XImageSpan span = createAndPutChipForUser(user);
                span.uid = user.id;
                ignoreChange = false;
              }
              if (!isAlwaysShare && !isNeverShare) {
                actionBar.setSubtitle(
                    LocaleController.formatString(
                        "MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
              }
              if (searching || searchWas) {
                ignoreChange = true;
                SpannableStringBuilder ssb = new SpannableStringBuilder("");
                for (ImageSpan sp : allSpans) {
                  ssb.append("<<");
                  ssb.setSpan(
                      sp,
                      ssb.length() - 2,
                      ssb.length(),
                      SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
                }
                userSelectEditText.setText(ssb);
                userSelectEditText.setSelection(ssb.length());
                ignoreChange = false;

                searchListViewAdapter.searchDialogs(null);
                searching = false;
                searchWas = false;
                listView.setAdapter(listViewAdapter);
                listViewAdapter.notifyDataSetChanged();
                if (android.os.Build.VERSION.SDK_INT >= 11) {
                  listView.setFastScrollAlwaysVisible(true);
                }
                listView.setFastScrollEnabled(true);
                listView.setVerticalScrollBarEnabled(false);
                emptyTextView.setText(
                    LocaleController.getString("NoContacts", R.string.NoContacts));
              } else {
                if (view instanceof UserCell) {
                  ((UserCell) view).setChecked(check, true);
                }
              }
            }
          });
      listView.setOnScrollListener(
          new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView absListView, int i) {
              if (i == SCROLL_STATE_TOUCH_SCROLL) {
                AndroidUtilities.hideKeyboard(userSelectEditText);
              }
              if (listViewAdapter != null) {
                listViewAdapter.setIsScrolling(i != SCROLL_STATE_IDLE);
              }
            }

            @Override
            public void onScroll(
                AbsListView absListView,
                int firstVisibleItem,
                int visibleItemCount,
                int totalItemCount) {
              if (absListView.isFastScrollEnabled()) {
                AndroidUtilities.clearDrawableAnimation(absListView);
              }
            }
          });
    } else {
      ViewGroup parent = (ViewGroup) fragmentView.getParent();
      if (parent != null) {
        parent.removeView(fragmentView);
      }
    }
    return fragmentView;
  }
  /**
   * Creates a new ListView component.
   *
   * @param container container that the component will be placed in
   */
  public ListView(ComponentContainer container) {
    super(container);
    this.container = container;
    items = YailList.makeEmptyList();
    // initialize selectionIndex which also sets selection
    SelectionIndex(0);
    view = new android.widget.ListView(container.$context());
    view.setOnItemClickListener(this);
    view.setChoiceMode(android.widget.ListView.CHOICE_MODE_SINGLE);
    view.setScrollingCacheEnabled(false);
    listViewLayout = new LinearLayout(container.$context());
    listViewLayout.setOrientation(LinearLayout.VERTICAL);

    txtSearchBox = new EditText(container.$context());
    txtSearchBox.setSingleLine(true);
    txtSearchBox.setWidth(Component.LENGTH_FILL_PARENT);
    txtSearchBox.setPadding(10, 10, 10, 10);
    txtSearchBox.setHint("Search list...");

    // set up the listener
    txtSearchBox.addTextChangedListener(
        new TextWatcher() {

          @Override
          public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
            // When user changed the Text
            adapter.getFilter().filter(cs);
          }

          @Override
          public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
            // no-op. Required method
          }

          @Override
          public void afterTextChanged(Editable arg0) {
            // no-op. Required method
          }
        });

    if (showFilter) {
      txtSearchBox.setVisibility(View.VISIBLE);
    } else {
      txtSearchBox.setVisibility(View.GONE);
    }

    // set the colors and initialize the elements
    // note that the TextColor and ElementsFromString setters
    // need to have the textColor set first, since they reset the
    // adapter

    Width(Component.LENGTH_FILL_PARENT);
    BackgroundColor(DEFAULT_BACKGROUND_COLOR);
    SelectionColor(DEFAULT_SELECTION_COLOR);

    textColor = DEFAULT_TEXT_COLOR;
    TextColor(textColor);
    textSize = DEFAULT_TEXT_SIZE;
    TextSize(textSize);
    ElementsFromString("");

    listViewLayout.addView(txtSearchBox);
    listViewLayout.addView(view);
    listViewLayout.requestLayout();
    container.$add(this);
  };