コード例 #1
0
 private void createProgressView() {
   mCircleView = new CircleImageView(getContext(), CIRCLE_BG_LIGHT, CIRCLE_DIAMETER / 2);
   mProgress = new MaterialProgressDrawable(getContext(), this);
   mProgress.setBackgroundColor(CIRCLE_BG_LIGHT);
   mCircleView.setImageDrawable(mProgress);
   mCircleView.setVisibility(View.GONE);
   addView(mCircleView);
 }
コード例 #2
0
 /** One of DEFAULT, or LARGE. */
 public void setSize(int size) {
   if (size != MaterialProgressDrawable.LARGE && size != MaterialProgressDrawable.DEFAULT) {
     return;
   }
   final DisplayMetrics metrics = getResources().getDisplayMetrics();
   if (size == MaterialProgressDrawable.LARGE) {
     mCircleHeight = mCircleWidth = (int) (CIRCLE_DIAMETER_LARGE * metrics.density);
   } else {
     mCircleHeight = mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
   }
   // force the bounds of the progress circle inside the circle view to
   // update by setting it to null before updating its size and then
   // re-setting it
   mCircleView.setImageDrawable(null);
   mProgress.updateSizes(size);
   mCircleView.setImageDrawable(mProgress);
 }