Java Code Examples for android.content.res.Resources#getValue()

The following examples show how to use android.content.res.Resources#getValue() . 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: FeatureOverlayQuery.java    From geopackage-android-map with MIT License 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context        context
 * @param boundedOverlay bounded overlay
 * @param featureTiles   feature tiles
 * @since 1.2.5
 */
public FeatureOverlayQuery(Context context, BoundedOverlay boundedOverlay, FeatureTiles featureTiles) {
    this.boundedOverlay = boundedOverlay;
    this.featureTiles = featureTiles;

    Resources resources = context.getResources();

    // Get the screen percentage to determine when a feature is clicked
    TypedValue screenPercentage = new TypedValue();
    resources.getValue(R.dimen.map_feature_overlay_click_screen_percentage, screenPercentage, true);
    screenClickPercentage = screenPercentage.getFloat();

    maxFeaturesInfo = resources.getBoolean(R.bool.map_feature_overlay_max_features_info);
    featuresInfo = resources.getBoolean(R.bool.map_feature_overlay_features_info);

    FeatureDao featureDao = featureTiles.getFeatureDao();
    featureInfoBuilder = new FeatureInfoBuilder(context, featureDao);
}
 
Example 2
Source File: ApplicationInitialization.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Enable fullscreen related startup flags.
 * @param resources Resources to use while calculating initialization constants.
 * @param resControlContainerHeight The resource id for the height of the top controls.
 */
public static void enableFullscreenFlags(
        Resources resources, Context context, int resControlContainerHeight) {
    ContentApplication.initCommandLine(context);

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return;

    TypedValue threshold = new TypedValue();
    resources.getValue(R.dimen.top_controls_show_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString());
    resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString());
}
 
Example 3
Source File: ApplicationInitialization.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Enable fullscreen related startup flags.
 * @param resources Resources to use while calculating initialization constants.
 * @param resControlContainerHeight The resource id for the height of the browser controls.
 */
public static void enableFullscreenFlags(
        Resources resources, Context context, int resControlContainerHeight) {
    ContentApplication.initCommandLine(context);

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return;

    TypedValue threshold = new TypedValue();
    resources.getValue(R.dimen.top_controls_show_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString());
    resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true);
    Log.w("renshuai: ", "hello" + threshold.coerceToString().toString());
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString());

}
 
Example 4
Source File: ApplicationInitialization.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Enable fullscreen related startup flags.
 * @param resources Resources to use while calculating initialization constants.
 * @param resControlContainerHeight The resource id for the height of the browser controls.
 */
public static void enableFullscreenFlags(
        Resources resources, Context context, int resControlContainerHeight) {
    ContentApplication.initCommandLine(context);

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return;

    TypedValue threshold = new TypedValue();
    resources.getValue(R.dimen.top_controls_show_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString());
    resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString());
}
 
Example 5
Source File: OverflowListView.java    From ProjectX with Apache License 2.0 6 votes vote down vote up
OverflowListView(Context context) {
    super(context);
    setWillNotDraw(false);
    final Resources resources = context.getResources();
    final TypedValue outValue = new TypedValue();
    resources.getValue(R.dimen.floatingActionModeOverflowItemMaxShowCount, outValue, true);
    float count = outValue.getFloat();
    int overflowMinimumWidth = resources.getDimensionPixelOffset(
            R.dimen.floatingActionModeOverflowItemMinimumWidth);
    @SuppressLint("CustomViewStyleable") final TypedArray custom =
            context.obtainStyledAttributes(R.styleable.FloatingActionMode);
    count = custom.getFloat(
            R.styleable.FloatingActionMode_floatingActionModeOverflowItemMaxShowCount, count);
    overflowMinimumWidth = custom.getDimensionPixelOffset(
            R.styleable.FloatingActionMode_floatingActionModeOverflowItemMinimumWidth,
            overflowMinimumWidth);
    custom.recycle();
    setItemMinimumWidth(overflowMinimumWidth);
    mMaxHeight = (int) (mCalculator.getSize() * count);
    mCornerCrop.setFillType(Path.FillType.EVEN_ODD);
    mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
    mCropPath.setFillType(Path.FillType.EVEN_ODD);
    setOnItemClickListener(this);
}
 
Example 6
Source File: SubListView.java    From ProjectX with Apache License 2.0 6 votes vote down vote up
SubListView(Context context) {
    super(context);
    final Resources resources = context.getResources();
    final TypedValue outValue = new TypedValue();
    resources.getValue(R.dimen.floatingActionModeSubItemMaxShowCount, outValue, true);
    float count = outValue.getFloat();
    int subMinimumWidth = resources.getDimensionPixelOffset(
            R.dimen.floatingActionModeSubItemMinimumWidth);
    @SuppressLint("CustomViewStyleable") final TypedArray custom =
            context.obtainStyledAttributes(R.styleable.FloatingActionMode);
    count = custom.getFloat(
            R.styleable.FloatingActionMode_floatingActionModeSubItemMaxShowCount, count);
    subMinimumWidth = custom.getDimensionPixelOffset(
            R.styleable.FloatingActionMode_floatingActionModeSubItemMinimumWidth,
            subMinimumWidth);
    custom.recycle();
    setItemMinimumWidth(subMinimumWidth);
    mMaxHeight = (int) (mCalculator.getSize() * count);
}
 
Example 7
Source File: MyFocusHighlightHelper.java    From LeanbackTvSample with MIT License 5 votes vote down vote up
void lazyInit(View view) {
    if (!mInitialized) {
        Resources res = view.getResources();
        TypedValue value = new TypedValue();
        res.getValue(R.dimen.lb_browse_header_select_scale, value, true);
        mSelectScale = value.getFloat();
        res.getValue(R.dimen.lb_browse_header_select_duration, value, true);
        mDuration = value.data;
        mInitialized = true;
    }
}
 
Example 8
Source File: LetterBitmap.java    From andOTP with MIT License 5 votes vote down vote up
/**
 * Constructor for <code>LetterTileProvider</code>
 *
 * @param context The {@link Context} to use
 */
public LetterBitmap(Context context) {
    final Resources res = context.getResources();

    mPaint.setTypeface(Typeface.create("sans-serif-light", Typeface.BOLD));
    mPaint.setColor(Color.WHITE);
    mPaint.setTextAlign(Paint.Align.CENTER);
    mPaint.setAntiAlias(true);

    mColors = res.obtainTypedArray(R.array.letter_tile_colors);

    TypedValue typedValue = new TypedValue();
    res.getValue(R.dimen.tile_letter_font_size_scale, typedValue, true);
    mTileLetterFontSizeScale = typedValue.getFloat();
}
 
Example 9
Source File: Util.java    From Leanplum-Android-SDK with Apache License 2.0 5 votes vote down vote up
/**
 * Generates a Resource name from resourceId located in res/ folder.
 *
 * @param resourceId id of the resource, must be greater then 0.
 * @return resourceName in format folder/file.extension.
 */
public static String generateResourceNameFromId(int resourceId) {
  try {
    if (resourceId <= 0) {
      Log.w("Provided resource id is invalid.");
      return null;
    }
    Resources resources = Leanplum.getContext().getResources();
    // Get entryName from resourceId, which represents a file name in res/ directory.
    String entryName = resources.getResourceEntryName(resourceId);
    // Get typeName from resourceId, which represents a folder where file is located in
    // res/ directory.
    String typeName = resources.getResourceTypeName(resourceId);

    // By using TypedValue we can get full path of a file with extension.
    TypedValue value = new TypedValue();
    resources.getValue(resourceId, value, true);

    // Regex matching to find real file extension, "image.img.png" will produce "png".
    String[] fullFileName = value.string.toString().split("\\.(?=[^\\.]+$)");
    String extension = "";
    // If extension is found, we will append dot before it.
    if (fullFileName.length == 2) {
      extension = "." + fullFileName[1];
    }

    // Return full resource name in format: drawable/image.png
    return typeName + "/" + entryName + extension;
  } catch (Exception e) {
    Log.w("Failed to generate resource name from provided resource id: ", e);
    Util.handleException(e);
  }
  return null;
}
 
Example 10
Source File: PhoneTabSwitcherLayout.java    From ChromeLikeTabSwitcher with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new layout, which implements the functionality of a {@link TabSwitcher} on
 * smartphones.
 *
 * @param tabSwitcher
 *         The tab switcher, the layout belongs to, as an instance of the class {@link
 *         TabSwitcher}. The tab switcher may not be null
 * @param model
 *         The model of the tab switcher, the layout belongs to, as an instance of the class
 *         {@link TabSwitcherModel}. The model may not be null
 * @param arithmetics
 *         The arithmetics, which should be used by the layout, as an instance of the class
 *         {@link PhoneArithmetics}. The arithmetics may not be null
 * @param style
 *         The style, which allows to retrieve style attributes of the tab switcher, as an
 *         instance of the class {@link TabSwitcherStyle}. The style may not be null
 * @param touchEventDispatcher
 *         The dispatcher, which is used to dispatch touch events to event handlers, as an
 *         instance of the class {@link TouchEventDispatcher}. The dispatcher may not be null
 */
public PhoneTabSwitcherLayout(@NonNull final TabSwitcher tabSwitcher,
                              @NonNull final TabSwitcherModel model,
                              @NonNull final PhoneArithmetics arithmetics,
                              @NonNull final TabSwitcherStyle style,
                              @NonNull final TouchEventDispatcher touchEventDispatcher) {
    super(tabSwitcher, model, arithmetics, style, touchEventDispatcher);
    Resources resources = tabSwitcher.getResources();
    stackedTabCount = resources.getInteger(R.integer.phone_stacked_tab_count);
    tabInset = resources.getDimensionPixelSize(R.dimen.tab_inset);
    tabBorderWidth = resources.getDimensionPixelSize(R.dimen.tab_border_width);
    tabTitleContainerHeight =
            resources.getDimensionPixelSize(R.dimen.tab_title_container_height);
    maxCameraDistance = resources.getDimensionPixelSize(R.dimen.max_camera_distance);
    TypedValue typedValue = new TypedValue();
    resources.getValue(R.dimen.swiped_tab_scale, typedValue, true);
    swipedTabScale = typedValue.getFloat();
    resources.getValue(R.dimen.swiped_tab_alpha, typedValue, true);
    swipedTabAlpha = typedValue.getFloat();
    showSwitcherAnimationDuration =
            resources.getInteger(R.integer.show_switcher_animation_duration);
    hideSwitcherAnimationDuration =
            resources.getInteger(R.integer.hide_switcher_animation_duration);
    toolbarVisibilityAnimationDuration =
            resources.getInteger(R.integer.toolbar_visibility_animation_duration);
    toolbarVisibilityAnimationDelay =
            resources.getInteger(R.integer.toolbar_visibility_animation_delay);
    swipeAnimationDuration = resources.getInteger(R.integer.swipe_animation_duration);
    relocateAnimationDuration = resources.getInteger(R.integer.relocate_animation_duration);
    revertOvershootAnimationDuration =
            resources.getInteger(R.integer.revert_overshoot_animation_duration);
    revealAnimationDuration = resources.getInteger(R.integer.reveal_animation_duration);
    peekAnimationDuration = resources.getInteger(R.integer.peek_animation_duration);
    emptyViewAnimationDuration = resources.getInteger(R.integer.empty_view_animation_duration);
    maxStartOvershootAngle = resources.getInteger(R.integer.max_start_overshoot_angle);
    maxEndOvershootAngle = resources.getInteger(R.integer.max_end_overshoot_angle);
    swipedTabDistance = resources.getDimensionPixelSize(R.dimen.swiped_tab_distance);
    tabViewBottomMargin = -1;
    toolbarAnimation = null;
}
 
Example 11
Source File: ResourcesCompat.java    From Carbon with Apache License 2.0 5 votes vote down vote up
/**
 * @param context                     The Context to get Resources from
 * @param id                          The Resource id to load
 * @param value                       A TypedValue to use in the fetching
 * @param style                       The font style to load
 * @param fontCallback                A callback to trigger when the font is fetched or an error occurs
 * @param handler                     A handler to the thread the callback should be called on
 * @param isRequestFromLayoutInflator Whether this request originated from XML. This is used to
 *                                    determine if we use or ignore the fontProviderFetchStrategy attribute in
 *                                    font provider XML fonts.
 * @return
 */
private static Typeface loadFont(@NonNull Context context, int id, TypedValue value,
                                 int style, int weight, @Nullable androidx.core.content.res.ResourcesCompat.FontCallback fontCallback, @Nullable Handler handler,
                                 boolean isRequestFromLayoutInflator) {
    final Resources resources = context.getResources();
    resources.getValue(id, value, true);
    Typeface typeface = loadFont(context, resources, value, id, style, weight, fontCallback, handler,
            isRequestFromLayoutInflator);
    if (typeface == null && fontCallback == null) {
        throw new NotFoundException("Font resource ID #0x"
                + Integer.toHexString(id) + " could not be retrieved.");
    }
    return typeface;
}
 
Example 12
Source File: OverviewConfiguration.java    From StackOverView with MIT License 5 votes vote down vote up
/** Updates the state, given the specified context */
void update(Context context) {
    Resources res = context.getResources();
    DisplayMetrics dm = res.getDisplayMetrics();

    // Insets
    displayRect.set(0, 0, dm.widthPixels, dm.heightPixels);

    // Task stack
    taskStackScrollDuration =
            res.getInteger(R.integer.recents_animate_task_stack_scroll_duration);

    //获取dimen资源值
    TypedValue widthPaddingPctValue = new TypedValue();
    res.getValue(R.dimen.recents_stack_width_padding_percentage, widthPaddingPctValue, true);
    taskStackWidthPaddingPct = widthPaddingPctValue.getFloat();

    //获取dimen资源值
    TypedValue stackOverscrollPctValue = new TypedValue();
    res.getValue(R.dimen.recents_stack_overscroll_percentage, stackOverscrollPctValue, true);
    taskStackOverscrollPct = stackOverscrollPctValue.getFloat();

    taskStackMaxDim = res.getInteger(R.integer.recents_max_task_stack_view_dim);
    taskStackTopPaddingPx = res.getDimensionPixelSize(R.dimen.recents_stack_top_padding);

    // Task view animation and styles
    taskViewEnterFromHomeDelay =
            res.getInteger(R.integer.recents_animate_task_enter_from_home_delay);
    taskViewEnterFromHomeDuration =
            res.getInteger(R.integer.recents_animate_task_enter_from_home_duration);
    taskViewEnterFromHomeStaggerDelay =
            res.getInteger(R.integer.recents_animate_task_enter_from_home_stagger_delay);
    taskViewRemoveAnimDuration =
            res.getInteger(R.integer.recents_animate_task_view_remove_duration);
    taskViewRemoveAnimTranslationXPx =
            res.getDimensionPixelSize(R.dimen.recents_task_view_remove_anim_translation_x);
    taskViewTranslationZMinPx = res.getDimensionPixelSize(R.dimen.recents_task_view_z_min);
    taskViewTranslationZMaxPx = res.getDimensionPixelSize(R.dimen.recents_task_view_z_max);
}
 
Example 13
Source File: BitmapUtils.java    From picasso with Apache License 2.0 4 votes vote down vote up
static boolean isXmlResource(Resources resources, @DrawableRes int drawableId) {
  TypedValue typedValue = new TypedValue();
  resources.getValue(drawableId, typedValue, true);
  CharSequence file = typedValue.string;
  return file != null && file.toString().endsWith(".xml");
}
 
Example 14
Source File: AnimatorInflater.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private static @Config int getChangingConfigs(@NonNull Resources resources, @AnyRes int id) {
    synchronized (sTmpTypedValue) {
        resources.getValue(id, sTmpTypedValue, true);
        return sTmpTypedValue.changingConfigurations;
    }
}
 
Example 15
Source File: LollipopDrawablesCompat.java    From RippleDrawable with MIT License 4 votes vote down vote up
public static Drawable getDrawable(Resources res, int resid, Resources.Theme theme) {
    TypedValue value = new TypedValue();
    res.getValue(resid, value, true);
    return loadDrawable(res, value, theme);
}
 
Example 16
Source File: Barber.java    From barber with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused")
public static float resolveFloatResource(Resources res, int resId) {
    TypedValue outValue = new TypedValue();
    res.getValue(resId, outValue, true);
    return outValue.getFloat();
}
 
Example 17
Source File: NumberFeaturesTile.java    From geopackage-android with MIT License 4 votes vote down vote up
/**
 * Constructor
 *
 * @param context context
 */
public NumberFeaturesTile(Context context) {

    Resources resources = context.getResources();

    // Set the default text paint values
    textPaint.setColor(ContextCompat.getColor(context, R.color.number_features_tile_text_color));
    textPaint.setTextSize(resources.getDimensionPixelSize(R.dimen.number_features_tile_text_size));

    // Set the default circle paint values
    if (resources.getBoolean(R.bool.number_features_tile_circle_draw)) {
        circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        circlePaint.setStyle(Paint.Style.STROKE);
        circlePaint.setColor(ContextCompat.getColor(context, R.color.number_features_tile_circle_color));
        TypedValue circleStrokeWidth = new TypedValue();
        resources.getValue(R.dimen.number_features_tile_circle_stroke_width,
                circleStrokeWidth, true);
        circlePaint.setStrokeWidth(circleStrokeWidth.getFloat());
    }

    // Set the default circle fill paint values
    if (resources.getBoolean(R.bool.number_features_tile_circle_fill_draw)) {
        circleFillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        circleFillPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        circleFillPaint.setColor(ContextCompat.getColor(context, R.color.number_features_tile_circle_fill_color));
    }

    // Set the default tile border paint values
    if (resources.getBoolean(R.bool.number_features_tile_border_draw)) {
        tileBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        tileBorderPaint.setStyle(Paint.Style.STROKE);
        tileBorderPaint.setColor(ContextCompat.getColor(context, R.color.number_features_tile_border_color));
        TypedValue tileBorderStrokeWidth = new TypedValue();
        resources.getValue(R.dimen.number_features_tile_border_stroke_width,
                tileBorderStrokeWidth, true);
        tileBorderPaint.setStrokeWidth(tileBorderStrokeWidth.getFloat());
    }

    // Set the default tile fill paint values
    if (resources.getBoolean(R.bool.number_features_tile_fill_draw)) {
        tileFillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        tileFillPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        tileFillPaint.setColor(ContextCompat.getColor(context, R.color.number_features_tile_fill_color));
    }

    // Set the default circle padding percentage
    TypedValue circlePadding = new TypedValue();
    resources.getValue(R.dimen.number_features_tile_circle_padding_percentage,
            circlePadding, true);
    circlePaddingPercentage = circlePadding.getFloat();

    // Set the default draw unindexed tiles value
    drawUnindexedTiles = resources.getBoolean(R.bool.number_features_tile_unindexed_draw);
}
 
Example 18
Source File: LollipopDrawablesCompat.java    From Carbon with Apache License 2.0 4 votes vote down vote up
public static Drawable getDrawable(Resources res, int resid, Resources.Theme theme) {
    TypedValue value = new TypedValue();
    res.getValue(resid, value, true);
    return loadDrawable(res, value, theme);
}
 
Example 19
Source File: ScrollableNumberPicker.java    From ScrollableNumberPicker with MIT License 4 votes vote down vote up
private void init(Context context, AttributeSet attrs) {
    if (isInEditMode()) {
        return;
    }

    LayoutInflater layoutInflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    layoutInflater.inflate(R.layout.number_picker, this);

    TypedArray typedArray =
        context.obtainStyledAttributes(attrs, R.styleable.ScrollableNumberPicker);
    Resources res = getResources();

    downIcon = typedArray.getResourceId(R.styleable.ScrollableNumberPicker_snp_buttonIconDown, downIcon);
    upIcon = typedArray.getResourceId(R.styleable.ScrollableNumberPicker_snp_buttonIconUp, upIcon);
    leftIcon = typedArray.getResourceId(R.styleable.ScrollableNumberPicker_snp_buttonIconLeft, leftIcon);
    rightIcon = typedArray.getResourceId(R.styleable.ScrollableNumberPicker_snp_buttonIconRight, rightIcon);

    mMinValue = typedArray.getInt(R.styleable.ScrollableNumberPicker_snp_minValue,
        res.getInteger(R.integer.default_minValue));
    mMaxValue = typedArray.getInt(R.styleable.ScrollableNumberPicker_snp_maxValue,
        res.getInteger(R.integer.default_maxValue));

    mStepSize = typedArray.getInt(R.styleable.ScrollableNumberPicker_snp_stepSize,
        res.getInteger(R.integer.default_stepSize));

    mUpdateIntervalMillis = typedArray.getInt(R.styleable.ScrollableNumberPicker_snp_updateInterval,
        res.getInteger(R.integer.default_updateInterval));

    mOrientation = typedArray.getInt(R.styleable.ScrollableNumberPicker_snp_orientation,
        LinearLayout.HORIZONTAL);

    mValue = typedArray.getInt(R.styleable.ScrollableNumberPicker_snp_value,
        res.getInteger(R.integer.default_value));

    mValueTextSize = typedArray.getDimension(R.styleable.ScrollableNumberPicker_snp_value_text_size,
        INVALID_RES);
    mValueTextColor = typedArray.getColor(R.styleable.ScrollableNumberPicker_snp_value_text_color,
        0);
    mValueTextAppearanceResId = typedArray.getResourceId(R.styleable.ScrollableNumberPicker_snp_value_text_appearance, INVALID_RES);

    mScrollEnabled = typedArray.getBoolean(R.styleable.ScrollableNumberPicker_snp_scrollEnabled,
        res.getBoolean(R.bool.default_scrollEnabled));

    mButtonColorStateList = ContextCompat.getColorStateList(context, typedArray.getResourceId(R.styleable.ScrollableNumberPicker_snp_buttonBackgroundTintSelector, R.color.btn_tint_selector));

    mValueMarginStart = (int) typedArray.getDimension(R.styleable.ScrollableNumberPicker_snp_valueMarginStart, res.getDimension(R.dimen.default_value_margin_start));
    mValueMarginEnd = (int) typedArray.getDimension(R.styleable.ScrollableNumberPicker_snp_valueMarginStart, res.getDimension(R.dimen.default_value_margin_end));

    mButtonPaddingLeft = (int) typedArray.getDimension(R.styleable.ScrollableNumberPicker_snp_buttonPaddingLeft, res.getDimension(R.dimen.default_button_padding_left));
    mButtonPaddingRight = (int) typedArray.getDimension(R.styleable.ScrollableNumberPicker_snp_buttonPaddingRight, res.getDimension(R.dimen.default_button_padding_right));
    mButtonPaddingTop = (int) typedArray.getDimension(R.styleable.ScrollableNumberPicker_snp_buttonPaddingTop, res.getDimension(R.dimen.default_button_padding_top));
    mButtonPaddingBottom = (int) typedArray.getDimension(R.styleable.ScrollableNumberPicker_snp_buttonPaddingBottom, res.getDimension(R.dimen.default_button_padding_bottom));

    TypedValue outValue = new TypedValue();
    res.getValue(R.dimen.default_button_scale_factor, outValue, true);
    float defaultValue = outValue.getFloat();
    mButtonTouchScaleFactor = typedArray.getFloat(R.styleable.ScrollableNumberPicker_snp_buttonTouchScaleFactor, defaultValue);

    typedArray.recycle();

    initViews();

    mAutoIncrement = false;
    mAutoDecrement = false;

    mUpdateIntervalHandler = new Handler();
}