package mehdi.sakout.aboutpage;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.TypedValue;
class AboutPageUtils {
static Boolean isAppInstalled(Context context, String appName) {
PackageManager pm = context.getPackageManager();
boolean installed;
try {
pm.getPackageInfo(appName, PackageManager.GET_ACTIVITIES);
installed = true;
} catch (PackageManager.NameNotFoundException e) {
installed = false;
}
return installed;
}
static int getThemeAccentColor(Context context) {
int colorAttr;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
colorAttr = android.R.attr.colorAccent;
} else {
//Get colorAccent defined for AppCompat
colorAttr = context.getResources().getIdentifier("colorAccent", "attr", context.getPackageName());
}
TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(colorAttr, outValue, true);
return outValue.data;
}
}