1package android.support.v17.leanback.widget; 2 3import android.graphics.drawable.Drawable; 4import android.os.Build; 5import android.view.View; 6 7final class ForegroundHelper { 8 /** 9 * Returns true if view.setForeground() is supported. 10 */ 11 static boolean supportsForeground() { 12 return Build.VERSION.SDK_INT >= 23; 13 } 14 15 static Drawable getForeground(View view) { 16 if (Build.VERSION.SDK_INT >= 23) { 17 return view.getForeground(); 18 } else { 19 return null; 20 } 21 } 22 23 static void setForeground(View view, Drawable drawable) { 24 if (Build.VERSION.SDK_INT >= 23) { 25 view.setForeground(drawable); 26 } 27 } 28} 29