Exemple #1
0
 protected PieItem makeItem(int image, int l) {
   ImageView view = new ImageView(mActivity);
   view.setImageResource(image);
   view.setMinimumWidth(mItemSize);
   view.setMinimumHeight(mItemSize);
   view.setScaleType(ScaleType.CENTER);
   LayoutParams lp = new LayoutParams(mItemSize, mItemSize);
   view.setLayoutParams(lp);
   return new PieItem(view, l);
 }
Exemple #2
0
 public void run() {
   titleIcon.setAdjustViewBounds(true);
   titleIcon.setMaxHeight(viewSize);
   titleIcon.setMaxWidth(viewSize);
   titleIcon.setMinimumHeight(viewSize);
   titleIcon.setMinimumWidth(viewSize);
   titleIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
   titleIcon.setImageBitmap(bitmap);
   menuIconAnimation(titleIcon);
 }
  private void init(Context context) {
    // 设置滑动效果
    animation =
        new RotateAnimation(
            0,
            -180,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(100);
    animation.setFillAfter(true);

    reverseAnimation =
        new RotateAnimation(
            -180,
            0,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    reverseAnimation.setInterpolator(new LinearInterpolator());
    reverseAnimation.setDuration(100);
    reverseAnimation.setFillAfter(true);

    inflater = LayoutInflater.from(context);
    headView = (LinearLayout) inflater.inflate(R.layout.pull_to_refresh_head, null);

    arrowImageView = (ImageView) headView.findViewById(R.id.head_arrowImageView);
    arrowImageView.setMinimumWidth(50);
    arrowImageView.setMinimumHeight(50);
    progressBar = (ProgressBar) headView.findViewById(R.id.head_progressBar);
    tipsTextview = (TextView) headView.findViewById(R.id.head_tipsTextView);
    lastUpdatedTextView = (TextView) headView.findViewById(R.id.head_lastUpdatedTextView);

    headContentOriginalTopPadding = headView.getPaddingTop();

    measureView(headView);
    headContentHeight = headView.getMeasuredHeight();
    headContentWidth = headView.getMeasuredWidth();

    headView.setPadding(
        headView.getPaddingLeft(),
        -1 * headContentHeight,
        headView.getPaddingRight(),
        headView.getPaddingBottom());
    headView.invalidate();

    // System.out.println("初始高度�?+headContentHeight);
    // System.out.println("初始TopPad�?+headContentOriginalTopPadding);

    addHeaderView(headView);
    setOnScrollListener(this);
  }
  private void init(Context context) {
    setCacheColorHint(context.getResources().getColor(android.R.color.transparent));
    inflater = LayoutInflater.from(context);
    headerView = (LinearLayout) inflater.inflate(R.layout.view_pulltorefresh, null);
    lvHeaderTipsTv = (TextView) headerView.findViewById(R.id.lvHeaderTipsTv);
    lvHeaderLastUpdatedTv = (TextView) headerView.findViewById(R.id.lvHeaderLastUpdatedTv);

    lvHeaderArrowIv = (ImageView) headerView.findViewById(R.id.lvHeaderArrowIv);
    // 设置下拉刷新图标的最小高度和宽度
    lvHeaderArrowIv.setMinimumWidth(70);
    lvHeaderArrowIv.setMinimumHeight(50);

    lvHeaderProgressBar = (ProgressBar) headerView.findViewById(R.id.lvHeaderProgressBar);
    measureView(headerView);
    headerContentHeight = headerView.getMeasuredHeight();
    // 设置内边距,正好距离顶部为一个负的整个布局的高度,正好把头部隐藏
    headerView.setPadding(0, -1 * headerContentHeight, 0, 0);
    // 重绘一下
    headerView.invalidate();
    // 将下拉刷新的布局加入ListView的顶部
    addHeaderView(headerView, null, false);
    // 设置滚动监听事件
    setOnScrollListener(this);

    // 设置旋转动画事件
    animation =
        new RotateAnimation(
            0,
            -180,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(250);
    animation.setFillAfter(true);

    reverseAnimation =
        new RotateAnimation(
            -180,
            0,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    reverseAnimation.setInterpolator(new LinearInterpolator());
    reverseAnimation.setDuration(200);
    reverseAnimation.setFillAfter(true);

    // 一开始的状态就是下拉刷新完的状态,所以为DONE
    state = DONE;
    // 是否正在刷新
    isRefreshable = false;
  }
 @Override
 public void onClick(View view) {
   if (otherThumb != null) {
     ImageView img = (ImageView) view;
     Bitmap currentThumb = ((BitmapDrawable) img.getDrawable()).getBitmap();
     img.setImageBitmap(otherThumb);
     img.setMinimumWidth(Math.max(otherThumb.getWidth(), 143));
     img.setMinimumHeight(Math.max(otherThumb.getHeight(), 127));
     otherThumb = currentThumb;
   }
 }
  private void init(Context context) {
    setCacheColorHint(context.getResources().getColor(R.color.transparent));
    inflater = LayoutInflater.from(context);

    headView = (LinearLayout) inflater.inflate(R.layout.head, null); // listview拼接headview

    arrowImageView = (ImageView) headView.findViewById(R.id.head_arrowImageView);
    arrowImageView.setMinimumWidth(70);
    arrowImageView.setMinimumHeight(50);
    progressBar = (ProgressBar) headView.findViewById(R.id.head_progressBar);
    tipsTextview = (TextView) headView.findViewById(R.id.head_tipsTextView);
    lastUpdatedTextView = (TextView) headView.findViewById(R.id.head_lastUpdatedTextView);

    measureView(headView);
    headContentHeight = headView.getMeasuredHeight(); // 头部高度
    headContentWidth = headView.getMeasuredWidth(); // 头部宽度

    headView.setPadding(
        0, -1 * headContentHeight, 0, 0); // setPadding(int left, int top, int right, int bottom)
    headView.invalidate(); // Invalidate the whole view

    Log.v("size", "width:" + headContentWidth + " height:" + headContentHeight);

    addHeaderView(headView, null, false); // 添加进headview
    setOnScrollListener(this); // 滚动监听

    animation =
        new RotateAnimation(
            0,
            -180,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(250);
    animation.setFillAfter(true); // 特效animation设置

    reverseAnimation =
        new RotateAnimation(
            -180,
            0,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    reverseAnimation.setInterpolator(new LinearInterpolator());
    reverseAnimation.setDuration(200);
    reverseAnimation.setFillAfter(true); // 特效reverseAnimation设置

    state = DONE;
    isRefreshable = false;
  }
Exemple #7
0
  private void init(Context context) {
    // TODO Auto-generated method stub
    inflater = LayoutInflater.from(context);

    headView = (LinearLayout) inflater.inflate(R.layout.list_head, null);

    arrowImageView = (ImageView) headView.findViewById(R.id.head_arrowImageView);
    arrowImageView.setMinimumWidth(70);
    arrowImageView.setMinimumHeight(50);
    progressBar = (ProgressBar) headView.findViewById(R.id.head_progressBar);
    tipsTextview = (TextView) headView.findViewById(R.id.head_tipsTextView);
    lastUpdatedTextView = (TextView) headView.findViewById(R.id.head_lastUpdatedTextView);

    headView.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    // measureView(this);
    measureView(headView);
    headContentHeight = headView.getMeasuredHeight();
    headContentWidth = headView.getMeasuredWidth();

    this.setPadding(0, -1 * headContentHeight, 0, 0);
    this.invalidate();

    animation =
        new RotateAnimation(
            0,
            -180,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(250);
    animation.setFillAfter(true);

    reverseAnimation =
        new RotateAnimation(
            -180,
            0,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    reverseAnimation.setInterpolator(new LinearInterpolator());
    reverseAnimation.setDuration(200);
    reverseAnimation.setFillAfter(true);

    state = DONE;

    isRefreshable = false;
  }
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    slidingDrawer.close();
    currentClasstime = (Classtime) parent.getItemAtPosition(position);

    if (currentClasstime != null) {
      mode = parentAct.startActionMode(new ScheduleActionMode());
      slidingDrawer.setVisibility(View.VISIBLE);

      String text = " ";
      text += currentClasstime.getCourseId() + " - " + currentClasstime.getName() + " ";

      String daytext = "\n\t";
      String building =
          currentClasstime.getBuilding().getId() + " " + currentClasstime.getBuilding().getRoom();
      String unique = currentClasstime.getUnique();

      String time = currentClasstime.getStartTime();
      String end = currentClasstime.getEndTime();

      if (currentClasstime.getDay() == 'H') {
        daytext += "TH";
      } else {
        daytext += currentClasstime.getDay();
      }

      // TODO: stringbuilder
      text += (daytext + " from " + time + "-" + end + " in " + building) + "\n";

      text += "\tUnique: " + unique + "\n";

      classInfoImageView.setBackgroundColor(Color.parseColor("#" + currentClasstime.getColor()));
      classInfoImageView.setMinimumHeight(10);
      classInfoImageView.setMinimumWidth(10);

      classInfoTextView.setTextColor(Color.BLACK);
      classInfoTextView.setTextSize(14f);
      classInfoTextView.setBackgroundColor(TRANSLUCENT_GRAY);
      classInfoTextView.setText(text);

      slidingDrawer.open();
    }
    // they clicked an empty cell
    else {
      if (mode != null) {
        mode.finish();
      }
      slidingDrawer.setVisibility(View.INVISIBLE);
    }
  }
 private PieItem constructItem(
     int width, String clickAction, String longPressAction, String iconUri, int minimumImageSize) {
   ImageView view = new ImageView(mContext);
   int iconType = setPieItemIcon(view, iconUri, clickAction);
   view.setMinimumWidth(minimumImageSize);
   view.setMinimumHeight(minimumImageSize);
   LayoutParams lp = new LayoutParams(minimumImageSize, minimumImageSize);
   view.setLayoutParams(lp);
   PieItem item =
       new PieItem(
           mContext, mPieContainer, 0, width, clickAction, longPressAction, view, iconType);
   item.setOnClickListener(this);
   if (!longPressAction.equals(ActionConstants.ACTION_NULL)) {
     item.setOnLongClickListener(this);
   }
   return item;
 }
Exemple #10
0
  private void loadTask() {
    String dataString = "";
    if (task.repetition != null) dataString += "Repetitions: " + task.repetition + '\n';
    if (task.holdTime != null) dataString += "Hold Time: " + task.holdTime + '\n';

    data.setText(dataString);

    txt.setText(task.longName);
    des.setText(task.text);

    anima = new AnimationDrawable();
    Log.e("tag", "IdddddO Exception");
    try {
      Log.e("tag", "" + task.getFrames().get(0));
      still =
          new BitmapDrawable(
              MediaStore.Images.Media.getBitmap(getContentResolver(), task.getFrames().get(0)));
    } catch (FileNotFoundException e1) {
      Log.e("tag", "File Not Found");
    } catch (IOException e1) {
      Log.e("tag", "IO Exception");
    }
    Log.e("tag", "IdddddO Exception");
    int w = still.getIntrinsicWidth();
    int h = still.getIntrinsicHeight();
    img.setMinimumWidth(w * 2);
    img.setMinimumHeight(h * 2);
    Log.e("tag", "Safe ");
    for (int i = 0; i < task.getFrames().size(); i++) {
      Bitmap temp1;
      try {
        temp1 = MediaStore.Images.Media.getBitmap(getContentResolver(), task.getFrames().get(i));
        Log.i("tag", "hello1");
        BitmapDrawable drw = new BitmapDrawable(temp1);
        img.setBackgroundDrawable(drw);
        anima.addFrame(drw, task.frameTimes.get(i) * 1000);
      } catch (FileNotFoundException e) {
        e.printStackTrace();
      } catch (IOException e) {

        e.printStackTrace();
      }
    }
    Log.i("tag", "hello");
    img.setBackgroundDrawable(still);
  }
  private void nextPage() {
    Logger.d(
        TAG,
        "nextpage() - page:"
            + page
            + ", texts:"
            + texts.length
            + ", callback:"
            + (callback != null));
    page++;
    if (page >= texts.length) {
      if (callback != null) {
        LuaClosure call = callback;
        callback = null;
        Engine.invokeCallback(call, "Button1");
      }
      WigPushDialogActivity.this.finish();
      return;
    }

    tvImageText.setText("");

    Media m = media[page];
    if (m != null) {
      try {
        byte[] img = Engine.mediaFile(m);
        CartridgeListActivity.setBitmapToImageView(
            BitmapFactory.decodeByteArray(img, 0, img.length), ivImage);
      } catch (Exception e) {
        tvImageText.setText(m.altText);
      }
    } else {
      ivImage.setImageBitmap(null);
      ivImage.setMinimumWidth(0);
      ivImage.setMinimumHeight(0);
    }

    tvImageText.setText(tvImageText.getText().toString() + "\n" + texts[page]);
  }
  /**
   * 添加下拉刷新的HeadView
   *
   * @date 2013-11-11 下午9:48:26
   * @change JohnWatson
   * @version 1.0
   */
  private void addHeadView() {
    mHeadRootView = (LinearLayout) mInflater.inflate(R.layout.pull_to_refresh_head, null);

    mArrowImageView = (ImageView) mHeadRootView.findViewById(R.id.head_arrowImageView);
    mArrowImageView.setMinimumWidth(70);
    mArrowImageView.setMinimumHeight(50);
    mProgressBar = (ImageView) mHeadRootView.findViewById(R.id.head_progressBar);
    mTipsTextView = (TextView) mHeadRootView.findViewById(R.id.head_tipsTextView);
    mLastUpdatedTextView = (TextView) mHeadRootView.findViewById(R.id.head_lastUpdatedTextView);

    measureView(mHeadRootView);
    mHeadViewHeight = mHeadRootView.getMeasuredHeight();
    mHeadViewWidth = mHeadRootView.getMeasuredWidth();

    mHeadRootView.setPadding(0, -1 * mHeadViewHeight, 0, 0);
    mHeadRootView.invalidate();

    Log.v("size", "width:" + mHeadViewWidth + " height:" + mHeadViewHeight);

    addHeaderView(mHeadRootView, null, false);

    mHeadState = DONE;
    changeHeadViewByState();
  }
Exemple #13
0
  /**
   * 添加下拉刷新的HeadView
   *
   * @date 2013-11-11 下午9:48:26
   * @change JohnWatson
   * @version 1.0
   */
  private void addHeadView() {
    mHeadView = (LinearLayout) mInflater.inflate(com.gemptc.activities.R.layout.head, null);

    LinearLayout head_linetest =
        (LinearLayout) mHeadView.findViewById(com.gemptc.activities.R.id.head_linetest);

    mArrowImageView = (ImageView) mHeadView.findViewById(R.id.head_arrowImageView);
    mArrowImageView.setMinimumWidth(70);
    mArrowImageView.setMinimumHeight(50);
    mProgressBar = (ProgressBar) mHeadView.findViewById(R.id.head_progressBar);
    mTipsTextView = (TextView) mHeadView.findViewById(R.id.head_tipsTextView);
    mLastUpdatedTextView = (TextView) mHeadView.findViewById(R.id.head_lastUpdatedTextView);

    measureView(mHeadView);
    mHeadViewHeight = mHeadView.getMeasuredHeight();
    mHeadViewWidth = mHeadView.getMeasuredWidth();

    int x = mHeadView.getMeasuredWidth();
    int x1 = mHeadView.getWidth();
    int y1 = mHeadView.getHeight();
    int y = mHeadView.getMeasuredHeight();

    int x12 = head_linetest.getMeasuredWidth();
    int x11 = head_linetest.getWidth();
    int y11 = head_linetest.getHeight();
    int y12 = head_linetest.getMeasuredHeight();

    mHeadView.setPadding(0, -1 * mHeadViewHeight, 0, 0);
    mHeadView.invalidate();

    Log.v("size", "width:" + mHeadViewWidth + " height:" + mHeadViewHeight);

    addHeaderView(mHeadView, null, false);

    mHeadState = DONE;
  }
 private void setImageViewSize(ImageView imageview) {
   /// get screen size
   imageview.setMinimumWidth(width);
   imageview.setMinimumHeight(width);
 }
  private void init(Context context) {
    inflater = LayoutInflater.from(context);
    headView =
        (LinearLayout) inflater.inflate(R.layout.list_refresh_head, null); // listview拼接headview
    footView = inflater.inflate(R.layout.list_more_view, null);
    footView.setVisibility(View.GONE);

    footView.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            if (onLoadaMoreListener != null) {
              onLoadaMoreListener.onLoadMore();
            }
          }
        });

    arrowImageView = (ImageView) headView.findViewById(R.id.array); // headview中各view
    arrowImageView.setMinimumWidth(50);
    arrowImageView.setMinimumHeight(50);
    progressBar = (ProgressBar) headView.findViewById(R.id.progressBar); // headview中各view
    tipsTextview = (TextView) headView.findViewById(R.id.tips); // headview中各view
    lastUpdatedTextView = (TextView) headView.findViewById(R.id.content); // headview中各view

    measureView(headView);
    headContentHeight = headView.getMeasuredHeight(); // 头部高度
    headContentWidth = headView.getMeasuredWidth(); // 头部宽度

    headView.setPadding(
        0, -1 * headContentHeight, 0, 0); // setPadding(int left, int top, int right, int bottom)
    headView.invalidate(); // Invalidate the whole view

    addHeaderView(headView); // 添加进headview
    addFooterView(footView);

    setOnScrollListener(this); // 滚动监听

    animation =
        new RotateAnimation(
            0,
            -180,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(250);
    animation.setFillAfter(true); // 特效animation设置

    reverseAnimation =
        new RotateAnimation(
            -180,
            0,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f,
            RotateAnimation.RELATIVE_TO_SELF,
            0.5f);
    reverseAnimation.setInterpolator(new LinearInterpolator());
    reverseAnimation.setDuration(250);
    reverseAnimation.setFillAfter(true); // 特效reverseAnimation设置
  }
  private Bitmap getMarkerBitmapFromView(
      View view, ImageView mMarkerImageView, @DrawableRes int resId, String nazwaAlbumu) {

    // View customMarkerView = ((LayoutInflater)
    // context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.element_marker,
    // null);
    // ImageView markerImageView = (ImageView)
    // customMarkerView.findViewById(R.id.miniaturka_marker);

    if (nazwaAlbumu != "") {
      Bitmap bitmap = dekodowanieBitmapy(sciezkaDoZdjecia, 40, 40);
      // Bitmap bitmap = BitmapFactory.decodeFile(sciezkaDoZdjecia);
      //
      try {
        ExifInterface exif = new ExifInterface(sciezkaDoZdjecia);
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1);
        Matrix matrix = new Matrix();
        if (orientation == 6) {
          matrix.postRotate(90);
        } else if (orientation == 3) {
          matrix.postRotate(180);
        } else if (orientation == 8) {
          matrix.postRotate(270);
        }
        // Bitmap bitmap = BitmapFactory.decodeFile(sciezka[obecneZdjecie]);
        bitmap =
            Bitmap.createBitmap(
                bitmap,
                0,
                0,
                bitmap.getWidth(),
                bitmap.getHeight(),
                matrix,
                true); // rotating bitmap

        mMarkerImageView.setImageBitmap(bitmap);
        mMarkerImageView.setMaxWidth(60);
        mMarkerImageView.setMaxHeight(60);
        mMarkerImageView.setMinimumWidth(57);
        mMarkerImageView.setMinimumHeight(57);
        //    markerImageView.setImageBitmap(bitmap);
        //   Toast.makeText(context, "bitmapa wgrana", Toast.LENGTH_SHORT).show();
      } catch (Exception e) {
      }
    }

    // markerImageView.setImageResource(R.drawable.folder_multiple_image);
    // markerImageView.setImageResource(context.getResources().getIdentifier("folder_multiple_image", "drawable", context.getPackageName()));
    // markerImageView.setImageResource(context.getResources().getIdentifier("folder_multiple_image", "drawable", context.getPackageName()));

    view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
    view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
    view.buildDrawingCache();
    Bitmap returnedBitmap =
        Bitmap.createBitmap(
            view.getMeasuredWidth(), view.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(returnedBitmap);
    canvas.drawColor(Color.WHITE, PorterDuff.Mode.SRC_IN);
    Drawable drawable = view.getBackground();
    if (drawable != null) drawable.draw(canvas);
    view.draw(canvas);
    return returnedBitmap;
  }
  @SuppressLint("UseSparseArrays")
  public AlphabetWavesView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final Resources res = context.getResources();

    TypedArray a =
        context.obtainStyledAttributes(attrs, R.styleable.AlphabetWavesView, defStyle, 0);
    mMaxOffset = a.getDimensionPixelSize(R.styleable.AlphabetWavesView_leMaxOffset, 54);
    mMoveCount = a.getInteger(R.styleable.AlphabetWavesView_leMoveCount, 7);
    mPopAnimTime = a.getInteger(R.styleable.AlphabetWavesView_lePopAnimTime, 120);

    mToastBg = a.getDrawable(R.styleable.AlphabetWavesView_leAlphabetToastBg);
    mSelectedBg = a.getDrawable(R.styleable.AlphabetWavesView_leSelectedBg);

    mToastOffset =
        a.getDimensionPixelSize(
            R.styleable.AlphabetWavesView_leToastOffset,
            res.getDimensionPixelSize(R.dimen.le_awv_toast_offset));
    mToastTextSize =
        a.getDimensionPixelSize(
            R.styleable.AlphabetWavesView_leToastTextSize,
            res.getDimensionPixelSize(R.dimen.le_awv_toast_text_size));
    mAlphabetTextSize =
        a.getDimensionPixelSize(
            R.styleable.AlphabetWavesView_leAlphabetTextSize,
            res.getDimensionPixelSize(R.dimen.le_awv_alphabet_text_size));
    mAlphabetMaxOffset =
        a.getDimensionPixelSize(
            R.styleable.AlphabetWavesView_leAlphabetMaxOffset,
            res.getDimensionPixelSize(R.dimen.le_awv_alphabet_max_offset));
    mPaddingTopBottom =
        a.getDimensionPixelSize(
            R.styleable.AlphabetWavesView_lePaddingTopBottom,
            res.getDimensionPixelSize(R.dimen.le_awv_padding_top_bottom));
    mAlphabetLeftMargin =
        a.getDimensionPixelSize(
            R.styleable.AlphabetWavesView_leAlphabetLeftMargin,
            res.getDimensionPixelSize(R.dimen.le_awv_alphabet_left_margin));
    a.recycle();

    if (mToastBg == null) {
      mToastBg = res.getDrawable(R.drawable.le_alphabet_toast_bg);
    }
    if (mSelectedBg == null) {
      mSelectedBg = res.getDrawable(R.drawable.le_alphabet_selected_bg);
    }

    mViewWidth = res.getDimensionPixelSize(R.dimen.le_awv_width);

    mHandler = new GestureHandler();
    mAlphabetList = new ArrayList<Alphabet>();
    mAnimMap = new HashMap<Integer, ValueAnimator>();

    mSelectedRect.set(0, 0, mSelectedBg.getIntrinsicWidth(), mSelectedBg.getIntrinsicHeight());
    isShowSelected = true;

    mPreviewImage = new ImageView(context);
    mPreviewImage.setMinimumWidth(mToastBg.getIntrinsicWidth());
    mPreviewImage.setMinimumHeight(mToastBg.getIntrinsicHeight());
    mPreviewImage.setBackground(mToastBg);
    mPreviewImage.setAlpha(0f);

    final int textMinSize = Math.max(0, mToastBg.getIntrinsicHeight() - 0);
    mPrimaryText = createPreviewTextView();
    mPrimaryText.setMinimumWidth(textMinSize);
    mPrimaryText.setMinimumHeight(textMinSize);

    mSecondaryText = createPreviewTextView();
    mSecondaryText.setMinimumWidth(textMinSize);
    mSecondaryText.setMinimumHeight(textMinSize);

    setGravity(Gravity.CENTER);
    setPadding(0, mPaddingTopBottom, 0, mPaddingTopBottom);
  }