Пример #1
0
 public void convertBetteryBitmap()
 {
     batteryView = (ProgressBar)LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_battery_progress, null);
     batteryView.ProgressDrawable = (ContextCompat.GetDrawable(mContext,
                                                               Settings.ReadTheme < 4 ?
                                                               Resource.Drawable.seekbar_battery_bg : Resource.Drawable.seekbar_battery_night_bg));
     batteryView.Progress            = (battery);
     batteryView.DrawingCacheEnabled = (true);
     batteryView.Measure(View.MeasureSpec.MakeMeasureSpec(ScreenUtils.dpToPxInt(26), MeasureSpecMode.Exactly),
                         View.MeasureSpec.MakeMeasureSpec(ScreenUtils.dpToPxInt(14), MeasureSpecMode.Exactly));
     batteryView.Layout(0, 0, batteryView.MeasuredWidth, batteryView.MeasuredHeight);
     batteryView.BuildDrawingCache();
     //batteryBitmap = batteryView.getDrawingCache();
     // tips: @link{https://github.com/JustWayward/BookReader/issues/109}
     batteryBitmap = Bitmap.CreateBitmap(batteryView.DrawingCache);
     batteryView.DrawingCacheEnabled = (false);
     batteryView.DestroyDrawingCache();
 }