@Override
public void onInit(int status) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if(!tts.getAvailableLanguages().contains(Locale.getDefault())) {
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(MainActivity.activity);
dlgAlert.setMessage(R.string.install_tts);
dlgAlert.setTitle(R.string.lang_doesnt_support);
dlgAlert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
final String appPackageName = "com.google.android.tts";
try {
MainActivity.activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
MainActivity.activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
}
});
dlgAlert.create().show();
}
}
}
});