Java Code Examples for android.view.ViewConfiguration#getScaledMaximumFlingVelocity()

The following examples show how to use android.view.ViewConfiguration#getScaledMaximumFlingVelocity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PagedView.java    From LB-Launcher with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes various states for this workspace.
 */
protected void init() {
    mDirtyPageContent = new ArrayList<Boolean>();
    mDirtyPageContent.ensureCapacity(32);
    mScroller = new LauncherScroller(getContext());
    setDefaultInterpolator(new ScrollInterpolator());
    mCurrentPage = 0;
    mCenterPagesVertically = true;

    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledPagingTouchSlop();
    mPagingTouchSlop = configuration.getScaledPagingTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mDensity = getResources().getDisplayMetrics().density;

    // Scale the fling-to-delete threshold by the density
    mFlingToDeleteThresholdVelocity =
            (int) (mFlingToDeleteThresholdVelocity * mDensity);

    mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);
    mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * mDensity);
    mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * mDensity);
    setOnHierarchyChangeListener(this);
}
 
Example 2
Source File: ViewDragHelper.java    From toktok-android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 * If the interpolator is null, the default interpolator will be used.
 *
 * @param context      Context to initialize config-dependent params from
 * @param forParent    Parent view to monitor
 * @param interpolator interpolator for scroller
 */
private ViewDragHelper(@NonNull Context context, @Nullable ViewGroup forParent, @Nullable Interpolator interpolator, @Nullable Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, interpolator != null ? interpolator : sInterpolator);
}
 
Example 3
Source File: Utils.java    From iMoney with Apache License 2.0 6 votes vote down vote up
/**
 * initialize method, called inside the Chart.init() method.
 * 
 * @param res
 */
@SuppressWarnings("deprecation")
public static void init(Context context) {

    if (context == null) {
        // noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        // noinspection deprecation
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();

        Log.e("MPAndroidChart, Utils.init(...)", "PROVIDED CONTEXT OBJECT IS NULL");

    } else {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();

        Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();
    }
}
 
Example 4
Source File: ViewDragHelper.java    From WayHoo with Apache License 2.0 6 votes vote down vote up
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 * 
 * @param context
 *            Context to initialize config-dependent params from
 * @param forParent
 *            Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
	if (forParent == null) {
		throw new IllegalArgumentException("Parent view may not be null");
	}
	if (cb == null) {
		throw new IllegalArgumentException("Callback may not be null");
	}

	mParentView = forParent;
	mCallback = cb;

	final ViewConfiguration vc = ViewConfiguration.get(context);
	final float density = context.getResources().getDisplayMetrics().density;
	mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

	mTouchSlop = vc.getScaledTouchSlop();
	mMaxVelocity = vc.getScaledMaximumFlingVelocity();
	mMinVelocity = vc.getScaledMinimumFlingVelocity();
	mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
Example 5
Source File: ViewDragHelper.java    From Aurora with Apache License 2.0 6 votes vote down vote up
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
Example 6
Source File: ViewPagerBottomSheetBehavior.java    From FabulousFilter with Apache License 2.0 6 votes vote down vote up
public ViewPagerBottomSheetBehavior(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.BottomSheetBehavior_Layout);
    TypedValue value = a.peekValue(R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight);
    if (value != null && value.data == PEEK_HEIGHT_AUTO) {
        setPeekHeight(value.data);
    } else {
        setPeekHeight(a.getDimensionPixelSize(
                R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight, PEEK_HEIGHT_AUTO));
    }
    setHideable(a.getBoolean(R.styleable.BottomSheetBehavior_Layout_behavior_hideable, false));
    setSkipCollapsed(a.getBoolean(R.styleable.BottomSheetBehavior_Layout_behavior_skipCollapsed,
            false));
    a.recycle();
    ViewConfiguration configuration = ViewConfiguration.get(context);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
 
Example 7
Source File: SlideViewDragHelper.java    From Aurora with Apache License 2.0 6 votes vote down vote up
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private SlideViewDragHelper(Context context, ViewGroup forParent, SlideViewDragHelper.Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
Example 8
Source File: TrendScrollViewWidget.java    From LotteryTrend with Apache License 2.0 5 votes vote down vote up
private void initScrollView() {
	mScroller = new Scroller(getContext());
	setFocusable(true);
	setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
	setWillNotDraw(false);
	final ViewConfiguration configuration = ViewConfiguration
			.get(getContext());
	mTouchSlop = configuration.getScaledTouchSlop();
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
 
Example 9
Source File: PileLayout.java    From timecat with Apache License 2.0 5 votes vote down vote up
public PileLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.pile);
    interval = (int) a.getDimension(R.styleable.pile_interval, interval);
    sizeRatio = a.getFloat(R.styleable.pile_sizeRatio, sizeRatio);
    scaleStep = a.getFloat(R.styleable.pile_scaleStep, scaleStep);
    displayCount = a.getFloat(R.styleable.pile_displayCount, displayCount);
    a.recycle();

    ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

    onClickListener = v -> {
        if (null != adapter) {
            int position = Integer.parseInt(v.getTag().toString());
            if (position >= 0 && position < adapter.getItemCount()) {
                adapter.onItemClick(((FrameLayout) v).getChildAt(0), position);
            }
        }
    };

    getViewTreeObserver().addOnGlobalLayoutListener(() -> {
        if (getHeight() > 0 && null != adapter && !hasSetAdapter) {
            setAdapter(adapter);
        }
    });
}
 
Example 10
Source File: AutoScrollTextView.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
private void initView() {
	final Context cx = getContext();
	// 设置滚动减速器,在fling中会用到
	mScroller = new Scroller(cx, new DecelerateInterpolator(0.5f));
	final ViewConfiguration configuration = ViewConfiguration.get(cx);
	mTouchSlop = configuration.getScaledTouchSlop();
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

	mHandler.post(ScrollRunnable);

}
 
Example 11
Source File: AnchorBottomSheetBehavior.java    From anchor-bottom-sheet-behavior with Apache License 2.0 5 votes vote down vote up
/**
 * Default constructor for inflating AnchorBottomSheetBehaviors from layout.
 *
 * @param context The {@link Context}.
 * @param attrs   The {@link AttributeSet}.
 */
public AnchorBottomSheetBehavior(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(attrs,
            android.support.design.R.styleable.BottomSheetBehavior_Layout);
    TypedValue value = a.peekValue(android.support.design.R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight);
    if (value != null && value.data == PEEK_HEIGHT_AUTO) {
        setPeekHeight(value.data);
    } else {
        setPeekHeight(a.getDimensionPixelSize(
                android.support.design.R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight, PEEK_HEIGHT_AUTO));
    }
    setHideable(a.getBoolean(android.support.design.R.styleable.BottomSheetBehavior_Layout_behavior_hideable, false));
    setSkipCollapsed(a.getBoolean(android.support.design.R.styleable.BottomSheetBehavior_Layout_behavior_skipCollapsed,
            false));
    setSkipAnchored(a.getBoolean(R.styleable.AnchorBottomSheetBehavior_Layout_behavior_skipAnchored, false));
    a.recycle();

    a = context.obtainStyledAttributes(attrs, R.styleable.AnchorBottomSheetBehavior_Layout);
    mAnchorOffset = (int) a.getDimension(R.styleable.AnchorBottomSheetBehavior_Layout_behavior_anchorOffset, 0);
    //noinspection WrongConstant
    mState = a.getInt(R.styleable.AnchorBottomSheetBehavior_Layout_behavior_defaultState, mState);
    a.recycle();

    ViewConfiguration configuration = ViewConfiguration.get(context);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
}
 
Example 12
Source File: SwipeTouchHelper.java    From StackCardsView with Apache License 2.0 5 votes vote down vote up
public SwipeTouchHelper(StackCardsView view) {
    mSwipeView = view;
    final Context context = view.getContext();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mDragSlop = (int) (configuration.getScaledTouchSlop() / mSwipeView.getDragSensitivity());
    mMaxVelocity = configuration.getScaledMaximumFlingVelocity();
    mMinVelocity = configuration.getScaledMinimumFlingVelocity();
    float density = context.getResources().getDisplayMetrics().density;
    mMinFastDisappearVelocity = (int) (MIN_FLING_VELOCITY * density);
    mSpringSystem = SpringSystem.create();
    updateTouchChild();
}
 
Example 13
Source File: WheelView.java    From WheelViewDemo with Apache License 2.0 5 votes vote down vote up
public void initAttr(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    mOverScroller = new OverScroller(context);
    final ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
    mMinimumVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = viewConfiguration.getScaledMaximumFlingVelocity();
    scaledTouchSlop = viewConfiguration.getScaledTouchSlop();

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.WheelView, defStyleAttr, 0);
    float defaultTextSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, getResources().getDisplayMetrics());
    textColor = a.getColor(R.styleable.WheelView_wheelTextColor, 0xFF333333);
    textSize = a.getDimension(R.styleable.WheelView_wheelTextSize, defaultTextSize);
    showCount = a.getInt(R.styleable.WheelView_wheelShowCount, 5);
    totalOffsetX = a.getDimensionPixelSize(R.styleable.WheelView_wheelTotalOffsetX, 0);
    itemVerticalSpace = a.getDimensionPixelSize(R.styleable.WheelView_wheelItemVerticalSpace, 32);
    wheelRotationX = a.getFloat(R.styleable.WheelView_wheelRotationX, DEFAULT_ROTATION_X);
    velocityUnits = a.getInteger(R.styleable.WheelView_wheelRotationX, DEFAULT_VELOCITY_UNITS);
    if (velocityUnits < 0) {
        velocityUnits = Math.abs(velocityUnits);
    }
    a.recycle();

    initConfig();
    if (isInEditMode()) {
        IWheel[] items = new IWheel[50];
        for (int i = 0; i < items.length; i++) {
            items[i] = new WheelItem("菜单选项" + (i < 10 ? "0" + i : String.valueOf(i)));
        }
        setItems(items);
    }
}
 
Example 14
Source File: SdkCenteredViewPager.java    From Android-SDK-Demo with MIT License 5 votes vote down vote up
void initViewPager()
{
    setWillNotDraw( false );
    setDescendantFocusability( FOCUS_AFTER_DESCENDANTS );
    setFocusable( true );
    final Context context = getContext();
    mScroller = new Scroller( context, sInterpolator );
    final ViewConfiguration configuration = ViewConfiguration.get( context );
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = configuration.getScaledPagingTouchSlop();
    mMinimumVelocity = (int) ( MIN_FLING_VELOCITY * density );
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffect( context );
    mRightEdge = new EdgeEffect( context );

    mFlingDistance = (int) ( MIN_DISTANCE_FOR_FLING * density );
    mCloseEnough = (int) ( CLOSE_ENOUGH * density );
    mDefaultGutterSize = (int) ( DEFAULT_GUTTER_SIZE * density );

    setAccessibilityDelegate( new MyAccessibilityDelegate() );

    if ( this.getImportantForAccessibility()
            == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO )
    {
        setImportantForAccessibility( View.IMPORTANT_FOR_ACCESSIBILITY_YES );
    }
}
 
Example 15
Source File: HorizontalScrollView.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void initScrollView() {
    mScroller = new OverScroller(getContext());
    setFocusable(true);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    final ViewConfiguration configuration = ViewConfiguration.get(mContext);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mOverscrollDistance = configuration.getScaledOverscrollDistance();
    mOverflingDistance = configuration.getScaledOverflingDistance();
    mHorizontalScrollFactor = configuration.getScaledHorizontalScrollFactor();
}
 
Example 16
Source File: ViewPagerCompat.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
Example 17
Source File: CustomScrollView.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
private void initScrollView() {
	mScroller = new Scroller(getContext());
	setFocusable(true);
	setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
	setWillNotDraw(false);
	final ViewConfiguration configuration = ViewConfiguration
			.get(getContext());
	mTouchSlop = configuration.getScaledTouchSlop();
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
 
Example 18
Source File: DraggableGridViewPager.java    From Android-DraggableGridViewPager with MIT License 5 votes vote down vote up
private void initDraggableGridViewPager() {
	setWillNotDraw(false);
	setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
	setFocusable(true);
	setChildrenDrawingOrderEnabled(true);

	final Context context = getContext();
	final ViewConfiguration configuration = ViewConfiguration.get(context);
	final float density = context.getResources().getDisplayMetrics().density;

	mGridGap = (int) (DEFAULT_GRID_GAP * density);

	// internal paddings
	mPaddingLeft = getPaddingLeft();
	mPaddingTop = getPaddingTop();
	mPaddingRight = getPaddingRight();
	mPaddingButtom = getPaddingBottom();
	super.setPadding(0, 0, 0, 0);

	mScroller = new Scroller(context, sInterpolator);
	mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
	mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

	mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
	mCloseEnough = (int) (CLOSE_ENOUGH * density);
}
 
Example 19
Source File: VelocityViewPager.java    From Rey-MusicPlayer with Apache License 2.0 5 votes vote down vote up
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new VelocityScroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
Example 20
Source File: BarChartView.java    From TraceByAmap with MIT License 4 votes vote down vote up
private void init() {
    lineWidth = DisplayUtil.dp2px(2);
    int lineColor = Color.parseColor("#434343");
    int nameTextColor = Color.parseColor("#CC202332");
    int clickedNameTextColor = Color.parseColor("#CCFFFFFF");
    nameTextSize = DisplayUtil.dp2px(15);
    clickedNameTextSize = DisplayUtil.dp2px(20);
    barChartInterval = DisplayUtil.dp2px(30);

    int barChartValueTextColor = Color.parseColor("#CC202332");
    clickedValueTextSize = DisplayUtil.dp2px(20);
    valueTextSize = DisplayUtil.dp2px(12);
    clickedValueTextSize = DisplayUtil.dp2px(17);
    barChartWidth = DisplayUtil.dp2px(20);
    chartPaddingTop = DisplayUtil.dp2px(10);
    paddingStart = DisplayUtil.dp2px(15);
    paddingEnd = DisplayUtil.dp2px(15);
    distanceFormNameToLine = DisplayUtil.dp2px(15);
    valueTobarChartDistance = DisplayUtil.dp2px(10);

    linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    linePaint.setStyle(Paint.Style.FILL);
    linePaint.setStrokeWidth(lineWidth);
    linePaint.setColor(lineColor);

    namePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    namePaint.setTextSize(nameTextSize);
    namePaint.setColor(nameTextColor);
    nameFontMetrics = namePaint.getFontMetrics();

    clickedNamePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    clickedNamePaint.setColor(clickedNameTextColor);
    clickedNamePaint.setTextSize(clickedNameTextSize);

    valuePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    valuePaint.setTextSize(valueTextSize);
    valuePaint.setColor(barChartValueTextColor);
    valueFontMetrics = valuePaint.getFontMetrics();

    clickedValuePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    clickedValuePaint.setColor(barChartValueTextColor);
    clickedValuePaint.setTextSize(clickedValueTextSize);

    barChartPaintRect = new Rect();
    barChartPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    scroller = new Scroller(getContext(), new LinearInterpolator());
    ViewConfiguration configuration = ViewConfiguration.get(getContext());
    minimumVelocity = configuration.getScaledMinimumFlingVelocity();
    maximumVelocity = configuration.getScaledMaximumFlingVelocity();

    barChartColors = new SparseArray<int[]>();
}