content: package com.music.player.bhandari.m.customViews.fast_scroller;
  
  import android.content.Context;
  import android.content.res.Configuration;
  import android.content.res.TypedArray;
  import android.graphics.drawable.Drawable;
  import android.os.Build;
  
  import androidx.annotation.AttrRes;
  import androidx.annotation.ColorInt;
  
  import android.view.View;
  
  /**
   * Copyright 2017 Amit Bhandari AB
   * <p>
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * <p>
   * http://www.apache.org/licenses/LICENSE-2.0
   * <p>
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  class RecyclerFastScrollerUtils {
      static void setViewBackground(View view, Drawable background) {
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
              view.setBackground(background);
          } else {
              //noinspection deprecation
              view.setBackgroundDrawable(background);
          }
      }
  
      static boolean isRTL(Context context) {
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
              Configuration config = context.getResources().getConfiguration();
              return config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
          } else {
              return false;
          }
      }
  
      @ColorInt
      static int resolveColor(Context context, @AttrRes int color) {
          TypedArray a = context.obtainStyledAttributes(new int[]{color});
          int resId = a.getColor(0, 0);
          a.recycle();
          return resId;
      }
  
      static int convertDpToPx(Context context, float dp) {
          return (int) (dp * context.getResources().getDisplayMetrics().density + 0.5f);
      }
  }