private void populateSecondForm(LinearLayout formLayout) {
    formLayout.addView(createTitle(mContext.getString(R.string.account_create_password_title)));
    EditText passwordEditText =
        createEditText(
            mContext.getString(R.string.account_create_password_hint),
            InputType.TYPE_CLASS_TEXT,
            EditorInfo.IME_ACTION_DONE,
            false,
            PASSWORD_KEY);
    passwordEditText.setTransformationMethod(new PasswordTransformationMethod());

    formLayout.addView(passwordEditText);
    formLayout.addView(createErrorView(PASSWORD_KEY));

    formLayout.addView(createTitle(mContext.getString(R.string.account_create_gender_title)));
    Spinner spinner = new Spinner(mContext);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    params.bottomMargin = 17;
    spinner.setLayoutParams(params);

    final ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            mContext, R.array.sexes_array, android.R.layout.simple_spinner_item);
    spinner.setAdapter(adapter);
    spinner.setPrompt(mContext.getString(R.string.account_create_sex_spinner_prompt));
    spinner.setOnItemSelectedListener(
        new OnItemSelectedListener() {

          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {

            mFormData.put(GENDER_KEY, adapter.getItem(pos).toString());
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });

    if (mFormData.get(GENDER_KEY) != null) {
      spinner.setSelection(adapter.getPosition(mFormData.get(GENDER_KEY)));
    }

    formLayout.addView(spinner);
  }
  /**
   * Initializes expand collapse animation, has two types, collapse (1) and expand (0).
   *
   * @param view The view to animate
   * @param type The type of animation: 0 will expand from gone and 0 size to visible and layout
   *     size defined in xml. 1 will collapse view and set to gone
   */
  public ExpandCollapseAnimation(View view, int type) {

    mAnimatedView = view;
    mEndHeight = mAnimatedView.getMeasuredHeight();
    mLayoutParams = ((LinearLayout.LayoutParams) view.getLayoutParams());
    mType = type;
    if (mType == EXPAND) {

      mLayoutParams.bottomMargin = -mEndHeight;
    } else {

      mLayoutParams.bottomMargin = 0;
    }
    view.setVisibility(View.VISIBLE);
  }
  @SuppressLint("InflateParams")
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      convertView = LayoutInflater.from(context).inflate(R.layout.user_item, null);
      ItemViewCache itemViewCache = new ItemViewCache();
      itemViewCache.imageViewUser = (ImageView) convertView.findViewById(R.id.imageViewUser);
      itemViewCache.textViewUser = (TextView) convertView.findViewById(R.id.textViewUser);
      itemViewCache.textViewCount = (TextView) convertView.findViewById(R.id.textViewCount);
      itemViewCache.textViewDate = (TextView) convertView.findViewById(R.id.textViewDate);
      convertView.setTag(itemViewCache);
    }

    ItemViewCache cache = (ItemViewCache) convertView.getTag();
    User user = userList.get(position);
    URL url = user.getUserAvatar();
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(128, 128);
    layoutParams.leftMargin = 5;
    layoutParams.rightMargin = 5;
    layoutParams.topMargin = 5;
    layoutParams.bottomMargin = 5;
    cache.imageViewUser.setLayoutParams(layoutParams);
    if (url != null) {
      imageLoader.displayImage(url.toString(), cache.imageViewUser);
    }

    cache.textViewUser.setText(user.getTitle());
    cache.textViewCount.setText("随笔总数:" + user.getPostCount());
    cache.textViewDate.setText("最后更新:" + AppUtils.parseDateToString(user.getUpdatedDate()));

    return convertView;
  }
 /** Show find dialog. Very pretty UI code ;) */
 public void showFindDialog() {
   Log.d(TAG, "find dialog...");
   final Dialog dialog = new Dialog(this);
   dialog.setTitle(R.string.find_dialog_title);
   LinearLayout contents = new LinearLayout(this);
   contents.setOrientation(LinearLayout.VERTICAL);
   this.findTextInputField = new EditText(this);
   this.findTextInputField.setWidth(this.pagesView.getWidth() * 80 / 100);
   Button goButton = new Button(this);
   goButton.setText(R.string.find_go_button);
   goButton.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           String text = OpenFileActivity.this.findTextInputField.getText().toString();
           OpenFileActivity.this.findText(text);
           dialog.dismiss();
         }
       });
   LinearLayout.LayoutParams params =
       new LinearLayout.LayoutParams(
           LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
   params.leftMargin = 5;
   params.rightMargin = 5;
   params.bottomMargin = 2;
   params.topMargin = 2;
   contents.addView(findTextInputField, params);
   contents.addView(goButton, params);
   dialog.setContentView(contents);
   dialog.show();
 }
 /**
  * Generate layout params for grid item view with appropriate horizontal spacing. The vertical
  * spacing between grid items should be set by the list's divider height. The grid's top and
  * bottom margins can be set on the list by enabling header and footer dividers or by disabling
  * clipToPadding and setting bottom padding on the listview
  */
 private LinearLayout.LayoutParams getGridItemLayoutParams(int column) {
   LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1);
   lp.leftMargin = (column == 0 ? gridItemHorizontalSpacing : gridItemHorizontalSpacing / 2);
   lp.rightMargin =
       (column == numColumns - 1 ? gridItemHorizontalSpacing : gridItemHorizontalSpacing / 2);
   lp.topMargin = 0;
   lp.bottomMargin = 0; // rely on the list divider for vertical spacing between rows
   return lp;
 }
  @Override
  protected View onCreateDialogView() {
    LinearLayout.LayoutParams params;
    LinearLayout layout = new LinearLayout(mContext);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setPadding(6, 6, 6, 6);

    mColorView = new ImageView(mContext);
    mColorView.setMinimumHeight(30);
    mColorView.setBackgroundColor(0xffff0000);
    params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    params.bottomMargin = 25;
    layout.addView(mColorView, params);

    mSeekBarR = new SeekBar(mContext);
    mSeekBarR.setOnSeekBarChangeListener(this);
    mSeekBarR.getProgressDrawable().setColorFilter(0xbbff0000, PorterDuff.Mode.SRC_OVER);
    layout.addView(
        mSeekBarR,
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    mSeekBarG = new SeekBar(mContext);
    mSeekBarG.setOnSeekBarChangeListener(this);
    mSeekBarG.getProgressDrawable().setColorFilter(0xbb00ff00, PorterDuff.Mode.SRC_OVER);
    layout.addView(
        mSeekBarG,
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    mSeekBarB = new SeekBar(mContext);
    mSeekBarB.setOnSeekBarChangeListener(this);
    mSeekBarB.getProgressDrawable().setColorFilter(0xbb0000ff, PorterDuff.Mode.SRC_OVER);
    layout.addView(
        mSeekBarB,
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));

    if (shouldPersist()) {
      mValue = getPersistedInt(mDefault);
      mRed = (mValue & 0x00ff0000) >> 16;
      mGreen = (mValue & 0x0000ff00) >> 8;
      mBlue = mValue & 0x000000ff;
    }

    mSeekBarR.setMax(mMax);
    mSeekBarR.setProgress(mRed);
    mSeekBarG.setMax(mMax);
    mSeekBarG.setProgress(mGreen);
    mSeekBarB.setMax(mMax);
    mSeekBarB.setProgress(mBlue);
    mColorView.setBackgroundColor(mValue | 0xff000000);
    return (layout);
  }
 /**
  * </br>
  *
  * @return
  */
 private ViewGroup createPointLinearlayout() {
   LinearLayout pointContainerLayout = new LinearLayout(getContext());
   LinearLayout.LayoutParams params =
       new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
   pointContainerLayout.setLayoutParams(params);
   pointContainerLayout.setOrientation(LinearLayout.HORIZONTAL);
   pointContainerLayout.setGravity(Gravity.CENTER);
   params.gravity = Gravity.CENTER;
   params.topMargin = DeviceUtils.dp2px(getContext(), 15);
   params.bottomMargin = DeviceUtils.dp2px(getContext(), 15);
   return pointContainerLayout;
 }
 private void initTag(T dataItem) {
   if (null != tagsLayout) {
     LinearLayout.LayoutParams params =
         new LinearLayout.LayoutParams(
             width / (getItemCount() == 0 ? 1 : getItemCount()), LayoutParams.MATCH_PARENT);
     params.topMargin = DisplayUtil.dip2px(this.getContext(), 5);
     params.bottomMargin = DisplayUtil.dip2px(this.getContext(), 5);
     V view = getTag(dataItem);
     view.setLayoutParams(params);
     tagsLayout.addView(view);
     tags.add(view);
   }
 }
  private void initDatas() {
    code = SearchFragment.positionsClassCode;
    value = SearchFragment.positionsClassValue;
    if (PositionClassifyController.positionClassifies != null
        && PositionClassifyController.positionClassifies.size() > 0) {
      int n = PositionClassifyController.positionClassifies.size();
      for (int i = 0; i < n; i++) {
        final PositionClassify positionClassify =
            PositionClassifyController.positionClassifies.get(i);
        final PositionClassItemView positionView = new PositionClassItemView(context);
        positionView.setPositionClassify(positionClassify);
        positionView.setOnItemClickListener(
            new View.OnClickListener() {

              @Override
              public void onClick(View v) {
                // TODO Auto-generated method stub
                if (positionClassify.isHasSub()) {
                  showSubAddressViews(positionClassify);
                } else {
                  boolean flag = positionView.getCheckedStatus();
                  positionView.setCheckedStatus(!flag);
                  if (!flag) {
                    code = positionClassify.getCode();
                    value = positionClassify.getValue();
                    startIntent();
                    finish();
                  } else {
                    code = "";
                    value = "";
                  }
                }
              }
            });
        linear_main.addView(positionView);
        if (i < n - 1) {
          View line = LayoutInflater.from(context).inflate(R.layout.layout_line, null);
          linear_main.addView(line, params);
        } else {
          params =
              new LinearLayout.LayoutParams(
                  LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
          params.height = 1;
          params.leftMargin = 1;
          params.bottomMargin = 10;
          View line = LayoutInflater.from(context).inflate(R.layout.layout_line, null);
          linear_main.addView(line, params);
        }
      }
    }
  }
Example #10
0
  private void initComponent() {
    imageViewAvatar = (ImageView) findViewById(R.id.imageViewUserAvatar);
    textViewUserName = (TextView) findViewById(R.id.textViewUserName);
    textViewUpdate = (TextView) findViewById(R.id.textViewUserUpdate);
    textViewUri = (TextView) findViewById(R.id.textViewUserUri);
    //		listViewBlogList = (ListView) findViewById(R.id.listViewUserBlogList);

    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(128, 128);
    layoutParams.leftMargin = 15;
    layoutParams.topMargin = 15;
    layoutParams.rightMargin = 15;
    layoutParams.bottomMargin = 15;
    imageViewAvatar.setLayoutParams(layoutParams);
  }
Example #11
0
 public static void resetLL(View... view) {
   float rote = Handler_System.getWidthRoate(ApplicationBean.getApplication().getMode_w());
   if (view == null || rote == 1) {
     return;
   }
   for (View view2 : view) {
     LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) view2.getLayoutParams();
     layoutParams.leftMargin = (int) (layoutParams.leftMargin * rote);
     layoutParams.rightMargin = (int) (layoutParams.rightMargin * rote);
     layoutParams.topMargin = (int) (layoutParams.topMargin * rote);
     layoutParams.bottomMargin = (int) (layoutParams.bottomMargin * rote);
     view2.setLayoutParams(layoutParams);
   }
 }
  private void populateThirdForm(LinearLayout formLayout) {
    formLayout.addView(createTitle(mContext.getString(R.string.account_create_city_title)));
    EditText cityEditText =
        createEditText(
            mContext.getString(R.string.account_create_city_hint),
            InputType.TYPE_CLASS_TEXT,
            EditorInfo.IME_ACTION_DONE,
            false,
            CITY_KEY);

    if (mFormData.get(CITY_KEY) != null) {
      cityEditText.setText(mFormData.get(CITY_KEY));
    }

    formLayout.addView(cityEditText);
    formLayout.addView(createErrorView(CITY_KEY));

    formLayout.addView(createTitle(mContext.getString(R.string.account_create_country_title)));

    Spinner spinner = new Spinner(mContext);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    params.bottomMargin = 17;
    spinner.setLayoutParams(params);

    final ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(
            mContext, android.R.layout.simple_spinner_item, Countries.COUNTRIES);
    spinner.setAdapter(adapter);
    spinner.setPrompt(mContext.getString(R.string.account_create_country_spinner_prompt));
    spinner.setOnItemSelectedListener(
        new OnItemSelectedListener() {

          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {

            mFormData.put(COUNTRY_KEY, Countries.COUNTRY_CODES[pos]);
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });

    if (mFormData.get(COUNTRY_KEY) != null) {
      List<String> array = Arrays.asList(Countries.COUNTRY_CODES);
      spinner.setSelection(array.indexOf(mFormData.get(COUNTRY_KEY)));
    }

    formLayout.addView(spinner);
  }
  @Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {

    super.applyTransformation(interpolatedTime, t);
    if (interpolatedTime < 1.0f) {
      if (mType == EXPAND) {
        mLayoutParams.bottomMargin = -mEndHeight + (int) (mEndHeight * interpolatedTime);
      } else {
        mLayoutParams.bottomMargin = -(int) (mEndHeight * interpolatedTime);
      }
      Log.d("ExpandCollapseAnimation", "anim height " + mLayoutParams.bottomMargin);
      mAnimatedView.requestLayout();
    } else {
      if (mType == EXPAND) {
        mLayoutParams.bottomMargin = 0;
        mAnimatedView.requestLayout();
      } else {
        mLayoutParams.bottomMargin = -mEndHeight;
        mAnimatedView.setVisibility(View.GONE);
        mAnimatedView.requestLayout();
      }
    }
  }
  private View makeView() {
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);

    LinearLayout view = new LinearLayout(this);
    view.setOrientation(LinearLayout.VERTICAL);
    view.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    final int p = (int) (8 * metrics.density);
    view.setPadding(p, p, p, p);

    Typeface light = Typeface.create("sans-serif-light", Typeface.NORMAL);
    Typeface normal = Typeface.create("sans-serif", Typeface.BOLD);

    String paVersion = SystemProperties.get("ro.pa.version");

    final float size = 14 * metrics.density;
    final LinearLayout.LayoutParams lp =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.CENTER_HORIZONTAL;
    lp.bottomMargin = (int) (-4 * metrics.density);

    TextView tv = new TextView(this);
    if (normal != null) tv.setTypeface(normal);
    tv.setTextSize(1.25f * size);
    tv.setTextColor(0xFFFFFFFF);
    tv.setShadowLayer(4 * metrics.density, 0, 2 * metrics.density, 0x66000000);
    tv.setText("ParanoidAndroid");
    view.addView(tv, lp);

    tv = new TextView(this);
    if (light != null) tv.setTypeface(light);
    tv.setTextSize(size);
    tv.setTextColor(0xFFFFFFFF);
    tv.setShadowLayer(4 * metrics.density, 0, 2 * metrics.density, 0x66000000);
    tv.setText(paVersion);
    view.addView(tv, lp);

    return view;
  }
  private TextView createErrorView(String key) {
    TextView ret = new TextView(mContext);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    params.topMargin = 10;
    params.bottomMargin = 10;
    ret.setLayoutParams(params);
    ret.setTextColor(Color.RED);
    ret.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);

    HashMap<String, String> errors = mAccount.getErrors();
    if (errors != null && errors.containsKey(key)) {
      ret.setText(errors.get(key));
      ret.setVisibility(View.VISIBLE);
    } else {
      ret.setVisibility(View.INVISIBLE);
    }

    return ret;
  }
Example #16
0
 public void setBottomMargin(int height) {
   if (height < 0) return;
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
   lp.bottomMargin = height;
   mContentView.setLayoutParams(lp);
 }
  public LcSearchView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {

    super(context, attrs, defStyleAttr);
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.lc_search_view, this, true);
    mSearchTrack = findViewById(R.id.lc_search_plate);
    mTitleIcon = (ImageView) findViewById(R.id.lc_search_icon);
    mEditorTextView = (SearchAutoComplete) findViewById(R.id.lc_search_src_text);
    mClearBtn = (ImageView) findViewById(R.id.lc_search_clear_btn);
    mCancelTextView = (TextView) findViewById(R.id.lc_search_text_cancel);

    mTitleIcon.setOnClickListener(mOnClickListener);
    mClearBtn.setOnClickListener(mOnClickListener);
    mCancelTextView.setOnClickListener(mOnClickListener);
    mEditorTextView.setOnClickListener(mOnClickListener);
    mEditorTextView.setOnEditorActionListener(mOnEditorActionListener);
    mEditorTextView.setOnItemClickListener(mOnItemClickListener);
    mEditorTextView.addTextChangedListener(mTextWatcher);
    mEditorTextView.setSearchView(this);
    mEditorTextView.ensureImeVisible(true);
    // Inform any listener of focus changes
    mEditorTextView.setOnFocusChangeListener(
        new OnFocusChangeListener() {
          public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
              mTitleIcon.setAlpha(unfocusAlpha);
              mEditorTextView.setAlpha(unfocusAlpha);
            } else {
              mTitleIcon.setAlpha(1.0f);
              mEditorTextView.setAlpha(1.0f);
            }

            if (mOnTextFocusChangeListener != null) {
              mOnTextFocusChangeListener.onFocusChange(LcSearchView.this, hasFocus);
            }
          }
        });

    mDropDownAnchor = findViewById(mEditorTextView.getDropDownAnchor());
    if (mDropDownAnchor != null) {
      mDropDownAnchor.addOnLayoutChangeListener(
          new OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(
                View v,
                int left,
                int top,
                int right,
                int bottom,
                int oldLeft,
                int oldTop,
                int oldRight,
                int oldBottom) {
              adjustDropDownSizeAndPosition();
            }
          });
    }

    int maxWidth = -1;
    CharSequence cancelText = null;
    CharSequence queryHintText = null;
    int clearBtnResId = R.drawable.lc_icon_search_view_clear_light;
    int titleIconId = R.drawable.lc_icon_search_view_search_light;
    int searchBgId = R.drawable.lc_selector_search_view_frame_light;
    int imeOptions = -1;
    int inputType = -1;
    boolean focusable = true;

    final Resources res = getResources();

    TypedValue out = new TypedValue();
    res.getValue(R.dimen.lc_search_view_default_text_alpha, out, true);
    unfocusAlpha = out.getFloat();

    int queryTextSize = res.getDimensionPixelSize(R.dimen.lc_default_search_query_text_size);
    ColorStateList queryTextColor =
        res.getColorStateList(R.color.lc_search_view_query_text_color_light);
    ColorStateList queryHintTextColor =
        res.getColorStateList(R.color.lc_search_view_query_hint_text_color_light);
    int cancelTextSize = res.getDimensionPixelSize(R.dimen.lc_default_search_query_text_size);
    ColorStateList cancelTextColor = null;

    int mTrackMarginLeft = res.getDimensionPixelSize(R.dimen.lc_search_track_margin_left);
    mTrackMarginRight = res.getDimensionPixelSize(R.dimen.lc_search_track_margin_right);
    int mTrackMarginTop = res.getDimensionPixelSize(R.dimen.lc_search_track_margin_top);
    int mTrackMarginBottom = res.getDimensionPixelSize(R.dimen.lc_search_track_margin_bottom);
    int mTrackPaddingLeft = res.getDimensionPixelSize(R.dimen.lc_search_track_padding_left);
    int mTrackPaddingRight = res.getDimensionPixelSize(R.dimen.lc_search_track_padding_right);

    mMatchColor = res.getColor(R.color.lc_search_view_drop_down_match_text_color_light);
    mCursorResId = R.drawable.lc_shape_search_view_cursor_light;
    mDropDownBg = res.getDrawable(R.drawable.lc_search_drop_down_bg);
    mDropDownBlurRadius = 10;
    mPopupItemLayoutResId = R.layout.lc_search_dropdown_item_icons_2line_light;
    mAlwaysShowCancel = true;
    Drawable popupDivider = res.getDrawable(R.drawable.lc_search_drop_down_divider);

    TypedArray a =
        context.obtainStyledAttributes(attrs, R.styleable.LcSearchView, defStyleAttr, defStyleRes);

    a.getValue(R.styleable.LcSearchView_lcSearchUnfocusAlpha, out);
    unfocusAlpha = out.getFloat();

    queryTextSize =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcQueryTextSize, queryTextSize);
    cancelTextSize =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcCancelTextSize, cancelTextSize);
    if (a.hasValue(R.styleable.LcSearchView_lcQueryTextColor)) {
      queryTextColor = a.getColorStateList(R.styleable.LcSearchView_lcQueryTextColor);
    }

    if (a.hasValue(R.styleable.LcSearchView_lcQueryHintColor)) {
      queryHintTextColor = a.getColorStateList(R.styleable.LcSearchView_lcQueryHintColor);
    }
    if (a.hasValue(R.styleable.LcSearchView_lcCancelTextColor)) {
      cancelTextColor = a.getColorStateList(R.styleable.LcSearchView_lcCancelTextColor);
    } else {
      cancelTextColor = queryTextColor;
    }

    mTrackMarginBottom =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcInputMarginBottom, mTrackMarginBottom);
    mTrackMarginLeft =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcInputMarginLeft, mTrackMarginLeft);
    mTrackMarginRight =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcInputMarginRight, mTrackMarginRight);
    mTrackMarginTop =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcInputMarginTop, mTrackMarginTop);

    maxWidth = a.getDimensionPixelSize(R.styleable.LcSearchView_android_maxWidth, maxWidth);
    queryHintText = a.getText(R.styleable.LcSearchView_lcQueryHint);
    clearBtnResId = a.getResourceId(R.styleable.LcSearchView_lcClearIcon, clearBtnResId);
    titleIconId = a.getResourceId(R.styleable.LcSearchView_lcSearchIcon, titleIconId);
    searchBgId = a.getResourceId(R.styleable.LcSearchView_lcBackground, searchBgId);
    imeOptions = a.getInt(R.styleable.LcSearchView_android_imeOptions, imeOptions);
    inputType = a.getInt(R.styleable.LcSearchView_android_inputType, inputType);
    focusable = a.getBoolean(R.styleable.LcSearchView_android_focusable, focusable);

    mMatchColor = a.getColor(R.styleable.LcSearchView_lcMatchColor, mMatchColor);
    mCursorResId =
        a.getResourceId(R.styleable.LcSearchView_android_textCursorDrawable, mCursorResId);

    if (a.hasValue(R.styleable.LcSearchView_lcCancelText)) {
      cancelText = a.getString(R.styleable.LcSearchView_lcCancelText);
    }

    if (a.hasValue(R.styleable.LcSearchView_lcPopupBackground)) {
      mDropDownBg = a.getDrawable(R.styleable.LcSearchView_lcPopupBackground);
    }

    if (a.hasValue(R.styleable.LcSearchView_lcPopupListDivider)) {
      popupDivider = a.getDrawable(R.styleable.LcSearchView_lcPopupListDivider);
    }
    mDropDownBlurRadius =
        a.getDimensionPixelSize(R.styleable.LcSearchView_lcPopupBlurRadius, mDropDownBlurRadius);
    mPopupItemLayoutResId =
        a.getResourceId(R.styleable.LcSearchView_lcPopupItemLayout, mPopupItemLayoutResId);

    final int completeThreshold = a.getInt(R.styleable.LcSearchView_android_completionThreshold, 2);

    mAlwaysShowCancel =
        a.getBoolean(R.styleable.LcSearchView_lcAlwaysShowCancel, mAlwaysShowCancel);
    a.recycle();

    mEditorTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, queryTextSize);
    mEditorTextView.setTextColor(queryTextColor);
    mEditorTextView.setHintTextColor(queryHintTextColor);
    HIDDEN_METHOD.setCursorDrawableRes(mEditorTextView, mCursorResId);
    mEditorTextView.setPopupBackground(mDropDownBg);
    mEditorTextView.setPopupListDivider(popupDivider);
    mEditorTextView.setPopupBlurRadius(mDropDownBlurRadius);
    mEditorTextView.setThreshold(completeThreshold);

    if (mEditorTextView.hasFocus()) {
      mTitleIcon.setAlpha(1.0f);
      mEditorTextView.setAlpha(1.0f);
    } else {
      mTitleIcon.setAlpha(unfocusAlpha);
      mEditorTextView.setAlpha(unfocusAlpha);
    }

    mCancelTextView.setTextColor(cancelTextColor);
    mCancelTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, cancelTextSize);
    if (mAlwaysShowCancel) {
      mCancelTextView.setVisibility(View.VISIBLE);
    }
    mClearBtn.setImageResource(clearBtnResId);
    mTitleIcon.setImageResource(titleIconId);

    mSearchTrack.setBackgroundResource(searchBgId);
    LinearLayout.LayoutParams plateParams =
        (LinearLayout.LayoutParams) mSearchTrack.getLayoutParams();
    plateParams.topMargin = mTrackMarginTop;
    plateParams.bottomMargin = mTrackMarginBottom;
    plateParams.leftMargin = mTrackMarginLeft;
    plateParams.rightMargin = mAlwaysShowCancel ? 0 : mTrackMarginRight;

    LinearLayout.LayoutParams params = (LayoutParams) mTitleIcon.getLayoutParams();
    params.leftMargin = mTrackPaddingLeft;
    params = (LayoutParams) mClearBtn.getLayoutParams();
    params.rightMargin = mTrackPaddingRight;

    mCancelTextView.setPadding(mTrackMarginRight, 0, mTrackMarginRight, 0);

    if (maxWidth != -1) {
      setMaxWidth(maxWidth);
    }

    if (!TextUtils.isEmpty(queryHintText)) {
      setQueryHint(queryHintText);
    }

    if (imeOptions != -1) {
      setImeOptions(imeOptions);
    }
    if (inputType != -1) {
      setInputType(inputType);
    }

    if (cancelText != null) {
      mCancelTextView.setText(cancelText);
    }

    setFocusable(focusable);

    updateQueryHint();
  }
  @Override
  public void setValues(
      DataKind kind, ValuesDelta entry, EntityDelta state, boolean readOnly, ViewIdGenerator vig) {
    super.setValues(kind, entry, state, readOnly, vig);
    // Remove edit texts that we currently have
    if (mFieldEditTexts != null) {
      for (EditText fieldEditText : mFieldEditTexts) {
        mFields.removeView(fieldEditText);
      }
      mFieldEditTexts = null;
    }
    if (localGroupsSelectors != null) {
      for (View view : localGroupsSelectors) {
        mFields.removeView(view);
      }
      localGroupsSelectors = null;
    }
    boolean hidePossible = false;

    int fieldCount = kind.fieldList.size();
    if (LocalGroup.CONTENT_ITEM_TYPE.equals(kind.mimeType))
      localGroupsSelectors = new LocalGroupsSelector[fieldCount];
    else mFieldEditTexts = new EditText[fieldCount];
    for (int index = 0; index < fieldCount; index++) {
      final EditField field = kind.fieldList.get(index);
      if (LocalGroup.CONTENT_ITEM_TYPE.equals(kind.mimeType)) {
        final LocalGroupsSelector localGroupsSelector =
            new LocalGroupsSelector(mContext, entry, field.column);
        localGroupsSelector.setOnGroupSelectListener(
            new OnGroupSelectListener() {
              @Override
              public void onGroupChanged() {
                setDeleteButtonVisible(localGroupsSelector.getGroupId() > -1);
              }
            });
        // Show the delete button if we have a non-null value
        setDeleteButtonVisible(localGroupsSelector.getGroupId() > -1);
        localGroupsSelectors[index] = localGroupsSelector;
        mFields.addView(localGroupsSelector);
      } else {
        final EditText fieldView = new EditText(mContext);
        /*Begin: Modified by bxinchun for change the layout 2012/07/24*/
        /*Begin: Modified by xiepengfei for change the layout 2012/05/02*/
        LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(
                LayoutParams.MATCH_PARENT,
                field.isMultiLine() ? LayoutParams.WRAP_CONTENT : mMinFieldHeight);
        params.bottomMargin = 10;
        fieldView.setLayoutParams(params);
        /*End: Modified by xiepengfei for change the layout 2012/05/02*/
        /*End: Modified by bxinchun for change the layout 2012/07/24*/

        // Set either a minimum line requirement or a minimum height (because {@link TextView}
        // only takes one or the other at a single time).
        if (field.minLines != 0) {
          fieldView.setMinLines(field.minLines);
        } else {
          fieldView.setMinHeight(mMinFieldHeight);
        }
        fieldView.setTextAppearance(getContext(), android.R.style.TextAppearance_Medium);
        fieldView.setGravity(Gravity.TOP);
        /*Begin: Modified by xiepengfei for change the layout 2012/05/02*/
        fieldView.setBackgroundResource(R.drawable.edit_editor_background);
        fieldView.setTextSize(20);
        fieldView.setTextColor(Color.BLACK);
        /*End: Modified by xiepengfei for change the layout 2012/05/02*/
        mFieldEditTexts[index] = fieldView;
        fieldView.setId(vig.getId(state, kind, entry, index));
        if (field.titleRes > 0) {
          fieldView.setHint(field.titleRes);
        }
        int inputType = field.inputType;
        fieldView.setInputType(inputType);
        if (inputType == InputType.TYPE_CLASS_PHONE) {
          PhoneNumberFormatter.setPhoneNumberFormattingTextWatcher(mContext, fieldView);
        }

        // Show the "next" button in IME to navigate between text fields
        // TODO: Still need to properly navigate to/from sections without text fields,
        // See Bug: 5713510
        fieldView.setImeOptions(EditorInfo.IME_ACTION_NEXT);

        // Read current value from state
        final String column = field.column;
        final String value = entry.getAsString(column);
        fieldView.setText(value);

        // Show the delete button if we have a non-null value
        setDeleteButtonVisible(value != null);

        // Prepare listener for writing changes
        fieldView.addTextChangedListener(
            new TextWatcher() {
              @Override
              public void afterTextChanged(Editable s) {
                // Trigger event for newly changed value
                onFieldChanged(column, s.toString());
              }

              @Override
              public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

              @Override
              public void onTextChanged(CharSequence s, int start, int before, int count) {}
            });

        fieldView.setEnabled(isEnabled() && !readOnly);

        if (field.shortForm) {
          hidePossible = true;
          mHasShortAndLongForms = true;
          fieldView.setVisibility(mHideOptional ? View.VISIBLE : View.GONE);
        } else if (field.longForm) {
          hidePossible = true;
          mHasShortAndLongForms = true;
          fieldView.setVisibility(mHideOptional ? View.GONE : View.VISIBLE);
        } else {
          // Hide field when empty and optional value
          final boolean couldHide = (!ContactsUtils.isGraphic(value) && field.optional);
          final boolean willHide = (mHideOptional && couldHide);
          fieldView.setVisibility(willHide ? View.GONE : View.VISIBLE);
          hidePossible = hidePossible || couldHide;
        }

        mFields.addView(fieldView);
      }
    }

    // When hiding fields, place expandable
    setupExpansionView(hidePossible, mHideOptional);
    mExpansionView.setEnabled(!readOnly && isEnabled());
  }
Example #19
0
 @Override
 public void set_MarginBottom(int marginBottom) {
   LinearLayout.LayoutParams params = (LayoutParams) getLayoutParams();
   params.bottomMargin = marginBottom;
 }
Example #20
0
 /** 设置流布局的底部外边距 */
 public static void setLinearLayoutBottomMargin(LinearLayout linearLayout, int newBottomMargin) {
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) linearLayout.getLayoutParams();
   lp.bottomMargin = newBottomMargin;
   linearLayout.setLayoutParams(lp);
 }
Example #21
0
 @SuppressWarnings("deprecation")
 @Override
 protected void onCreateLayout(boolean firstCreation) {
   setContentView(R.layout.activity_effects);
   audioSink = Player.localAudioSinkUsedInEffects;
   panelControls = (LinearLayout) findViewById(R.id.panelControls);
   panelControls.setBackgroundDrawable(new ColorDrawable(UI.color_list));
   panelEqualizer = (LinearLayout) findViewById(R.id.panelEqualizer);
   panelSecondary = (ViewGroup) findViewById(R.id.panelSecondary);
   if (panelSecondary instanceof ScrollView) {
     panelSecondary.setHorizontalFadingEdgeEnabled(false);
     panelSecondary.setVerticalFadingEdgeEnabled(false);
     panelSecondary.setFadingEdgeLength(0);
   }
   btnGoBack = (BgButton) findViewById(R.id.btnGoBack);
   btnGoBack.setOnClickListener(this);
   btnGoBack.setIcon(UI.ICON_GOBACK);
   chkEqualizer = (BgButton) findViewById(R.id.chkEqualizer);
   chkEqualizer.setOnClickListener(this);
   chkEqualizer.setTextColor(UI.colorState_text_listitem_reactive);
   chkEqualizer.formatAsLabelledCheckBox();
   chkBass = (BgButton) findViewById(R.id.chkBass);
   chkBass.setOnClickListener(this);
   chkBass.setTextColor(UI.colorState_text_listitem_reactive);
   chkBass.formatAsLabelledCheckBox();
   chkVirtualizer = (BgButton) findViewById(R.id.chkVirtualizer);
   chkVirtualizer.setOnClickListener(this);
   chkVirtualizer.setTextColor(UI.colorState_text_listitem_reactive);
   chkVirtualizer.formatAsLabelledCheckBox();
   btnMenu = (BgButton) findViewById(R.id.btnMenu);
   btnMenu.setOnClickListener(this);
   btnMenu.setIcon(UI.ICON_MENU);
   btnChangeEffect = (BgButton) findViewById(R.id.btnChangeEffect);
   if (btnChangeEffect != null) {
     btnChangeEffect.setOnClickListener(this);
     btnChangeEffect.setCompoundDrawables(
         new TextIconDrawable(
             UI.ICON_EQUALIZER, UI.color_text_listitem, UI.defaultControlContentsSize),
         null,
         null,
         null);
     btnChangeEffect.setMinimumHeight(UI.defaultControlSize);
     btnChangeEffect.setTextColor(UI.colorState_text_listitem_reactive);
   } else {
     UI.isLargeScreen = true;
     Player.bassBoostMode = false;
   }
   barBass = (BgSeekBar) findViewById(R.id.barBass);
   barBass.setMax(BassBoost.getMaxStrength());
   barBass.setValue(BassBoost.getStrength(audioSink));
   barBass.setKeyIncrement(BassBoost.getMaxStrength() / 50);
   barBass.setOnBgSeekBarChangeListener(this);
   barBass.setInsideList(true);
   barBass.setAdditionalContentDescription(getText(R.string.bass_boost).toString());
   barVirtualizer = (BgSeekBar) findViewById(R.id.barVirtualizer);
   barVirtualizer.setMax(Virtualizer.getMaxStrength());
   barVirtualizer.setValue(Virtualizer.getStrength(audioSink));
   barVirtualizer.setKeyIncrement(Virtualizer.getMaxStrength() / 50);
   barVirtualizer.setOnBgSeekBarChangeListener(this);
   barVirtualizer.setInsideList(true);
   barVirtualizer.setAdditionalContentDescription(getText(R.string.virtualization).toString());
   LinearLayout.LayoutParams lp;
   if (!UI.isLargeScreen && UI.isLandscape) {
     if (btnChangeEffect != null) {
       lp = (LinearLayout.LayoutParams) btnChangeEffect.getLayoutParams();
       lp.topMargin = 0;
       btnChangeEffect.setLayoutParams(lp);
     }
     lp = (LinearLayout.LayoutParams) chkEqualizer.getLayoutParams();
     lp.bottomMargin = 0;
     chkEqualizer.setLayoutParams(lp);
     lp = (LinearLayout.LayoutParams) chkBass.getLayoutParams();
     lp.bottomMargin = 0;
     chkBass.setLayoutParams(lp);
     lp = (LinearLayout.LayoutParams) chkVirtualizer.getLayoutParams();
     lp.bottomMargin = 0;
     chkVirtualizer.setLayoutParams(lp);
     lp = (LinearLayout.LayoutParams) barBass.getLayoutParams();
     lp.bottomMargin = UI.controlMargin;
     barBass.setLayoutParams(lp);
     lp = (LinearLayout.LayoutParams) barVirtualizer.getLayoutParams();
     lp.bottomMargin = UI.controlMargin;
     barVirtualizer.setLayoutParams(lp);
     panelControls.setPadding(
         UI.controlLargeMargin, UI.thickDividerSize, UI.controlLargeMargin, 0);
   } else if (UI.isLargeScreen) {
     UI.prepareViewPaddingForLargeScreen(
         panelControls,
         0,
         (screenNotSoLarge && !UI.isLandscape) ? UI.controlMargin : UI.controlLargeMargin);
     if (!UI.isLandscape && (panelControls instanceof LinearLayout)) {
       panelControls.setOrientation(LinearLayout.VERTICAL);
       panelControls.setWeightSum(0);
       final int margin = (screenNotSoLarge ? UI.controlMargin : (UI.controlLargeMargin << 1));
       lp =
           new LinearLayout.LayoutParams(
               LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
       lp.leftMargin = margin;
       lp.topMargin = margin;
       lp.rightMargin = margin;
       lp.bottomMargin = margin;
       panelSecondary.setLayoutParams(lp);
       lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0);
       lp.weight = 1;
       lp.leftMargin = margin;
       lp.topMargin = (screenNotSoLarge ? UI.controlLargeMargin : margin);
       lp.rightMargin = margin;
       lp.bottomMargin = margin;
       panelEqualizer.setLayoutParams(lp);
       if (screenNotSoLarge) {
         lp = (LinearLayout.LayoutParams) barBass.getLayoutParams();
         lp.bottomMargin = UI.controlLargeMargin;
         barBass.setLayoutParams(lp);
         lp = (LinearLayout.LayoutParams) barVirtualizer.getLayoutParams();
         lp.bottomMargin = UI.controlLargeMargin;
         barVirtualizer.setLayoutParams(lp);
       }
     }
   } else {
     panelControls.setPadding(UI.controlMargin, UI.thickDividerSize, UI.controlMargin, 0);
   }
   UI.prepareControlContainer(findViewById(R.id.panelTop), false, true);
   prepareViewForMode(true);
 }
  /** Called from menu when user want to go to specific page. */
  private void showGotoPageDialog() {
    final Dialog d = new Dialog(this);
    d.setTitle(R.string.goto_page_dialog_title);
    LinearLayout contents = new LinearLayout(this);
    contents.setOrientation(LinearLayout.VERTICAL);
    TextView label = new TextView(this);
    final int pagecount = this.pdfPagesProvider.getPageCount();
    label.setText("Page number from " + 1 + " to " + pagecount);
    this.pageNumberInputField = new EditText(this);
    this.pageNumberInputField.setInputType(InputType.TYPE_CLASS_NUMBER);
    this.pageNumberInputField.setText("" + (this.pagesView.getCurrentPage() + 1));
    Button goButton = new Button(this);
    goButton.setText(R.string.goto_page_go_button);
    goButton.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            int pageNumber = -1;
            try {
              pageNumber =
                  Integer.parseInt(OpenFileActivity.this.pageNumberInputField.getText().toString())
                      - 1;
            } catch (NumberFormatException e) {
              /* ignore */
            }
            d.dismiss();
            if (pageNumber >= 0 && pageNumber < pagecount) {
              OpenFileActivity.this.gotoPage(pageNumber);

            } else {
              OpenFileActivity.this.errorMessage("Invalid page number");
            }
          }
        });
    Button page1Button = new Button(this);
    page1Button.setText(getResources().getString(R.string.page) + " 1");
    page1Button.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            d.dismiss();
            OpenFileActivity.this.gotoPage(0);
          }
        });
    Button lastPageButton = new Button(this);
    lastPageButton.setText(getResources().getString(R.string.page) + " " + pagecount);
    lastPageButton.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            d.dismiss();
            OpenFileActivity.this.gotoPage(pagecount - 1);
          }
        });
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    params.leftMargin = 5;
    params.rightMargin = 5;
    params.bottomMargin = 2;
    params.topMargin = 2;
    contents.addView(label, params);
    contents.addView(pageNumberInputField, params);
    contents.addView(goButton, params);
    contents.addView(page1Button, params);
    contents.addView(lastPageButton, params);
    d.setContentView(contents);
    d.show();
  }
  /**
   * Inits the view.
   *
   * @param context the context
   */
  private void initView(Context context) {

    mContext = context;

    // 顶部刷新栏整体内容
    headerView = new LinearLayout(context);
    headerView.setOrientation(LinearLayout.HORIZONTAL);
    // setBackgroundColor(getResources().getColor(R.color.pull_refresh_background));
    setBackgroundColor(getResources().getColor(R.color.new_white));
    headerView.setGravity(Gravity.CENTER);
    headerView.setPadding(0, 5, 0, 5);

    // 显示箭头与进度
    FrameLayout headImage = new FrameLayout(context);
    arrowImageView = new ImageView(context);
    // 从包里获取的箭头图片
    arrowImage =
        BitmapFactory.decodeStream(AbListViewHeader.class.getResourceAsStream("ab_arrow.png"));
    arrowImageView.setImageBitmap(arrowImage);

    // style="?android:attr/progressBarStyleSmall" 默认的样式
    headerProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyle);
    headerProgressBar.setVisibility(View.GONE);

    LinearLayout.LayoutParams layoutParamsWW =
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    layoutParamsWW.gravity = Gravity.CENTER;
    layoutParamsWW.width = 50;
    layoutParamsWW.height = 50;
    headImage.addView(arrowImageView, layoutParamsWW);
    headImage.addView(headerProgressBar, layoutParamsWW);

    // 顶部刷新栏文本内容
    LinearLayout headTextLayout = new LinearLayout(context);
    tipsTextview = new TextView(context);
    headTextLayout.setOrientation(LinearLayout.VERTICAL);
    headTextLayout.setGravity(Gravity.CENTER_VERTICAL);
    headTextLayout.setPadding(12, 0, 0, 0);
    LinearLayout.LayoutParams layoutParamsWW2 =
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    headTextLayout.addView(tipsTextview, layoutParamsWW2);
    tipsTextview.setTextColor(getResources().getColor(R.color.attendance_absent));
    tipsTextview.setTextSize(15);

    LinearLayout.LayoutParams layoutParamsWW3 =
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    layoutParamsWW3.gravity = Gravity.CENTER;
    layoutParamsWW3.bottomMargin = 5;
    layoutParamsWW3.topMargin = 5;

    LinearLayout headerLayout = new LinearLayout(context);
    headerLayout.setOrientation(LinearLayout.HORIZONTAL);
    headerLayout.setGravity(Gravity.CENTER);

    headerLayout.addView(headImage, layoutParamsWW3);
    headerLayout.addView(headTextLayout, layoutParamsWW3);

    LinearLayout.LayoutParams lp =
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.BOTTOM;
    // 添加大布局
    headerView.addView(headerLayout, lp);

    this.addView(headerView, lp);
    // 获取View的高度
    int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    this.measure(w, h);
    headerHeight = this.getMeasuredHeight();
    // 向上偏移隐藏起来
    headerView.setPadding(0, -1 * headerHeight, 0, 0);

    mRotateUpAnim =
        new RotateAnimation(
            0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateUpAnim.setFillAfter(true);
    mRotateDownAnim =
        new RotateAnimation(
            -180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateDownAnim.setFillAfter(true);

    setState(STATE_NORMAL);
  }
 public void setPagerProperties(final ViewPager vp) {
   final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) vp.getLayoutParams();
   lp.height = mEmojiKeyboardHeight;
   lp.bottomMargin = mEmojiPagerBottomMargin;
   vp.setLayoutParams(lp);
 }