2021-07-29 14:19:19 +02:00
|
|
|
package com.cappielloantonio.play.util;
|
|
|
|
|
|
2022-12-28 14:29:54 +01:00
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
|
|
import com.google.android.gms.common.ConnectionResult;
|
|
|
|
|
import com.google.android.gms.common.GoogleApiAvailability;
|
|
|
|
|
|
2021-07-29 14:19:19 +02:00
|
|
|
public class UIUtil {
|
|
|
|
|
public static int getSpanCount(int itemCount, int maxSpan) {
|
|
|
|
|
int itemSize = itemCount == 0 ? 1 : itemCount;
|
|
|
|
|
|
|
|
|
|
if (itemSize / maxSpan > 0) {
|
|
|
|
|
return maxSpan;
|
2021-08-01 11:48:18 +02:00
|
|
|
} else {
|
2021-07-29 14:19:19 +02:00
|
|
|
return itemSize % maxSpan;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-28 14:29:54 +01:00
|
|
|
|
|
|
|
|
public static boolean isCastApiAvailable(Context context) {
|
|
|
|
|
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS;
|
|
|
|
|
}
|
2021-07-29 14:19:19 +02:00
|
|
|
}
|