use of android.widget.Toast in project android_frameworks_base by DirtyUnicorns.
the class SysUIToast method makeText.
public static Toast makeText(Context context, CharSequence text, int duration) {
Toast toast = Toast.makeText(context, text, duration);
toast.getWindowParams().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
return toast;
}
use of android.widget.Toast in project KISS by Neamar.
the class MainActivity method displayFavorites.
public void displayFavorites() {
int[] favoritesIds = favoritesKissBar.getVisibility() == View.VISIBLE ? favsIds : favBarIds;
ArrayList<Pojo> favoritesPojo = KissApplication.getDataHandler(MainActivity.this).getFavorites(tryToRetrieve);
if (favoritesPojo.size() == 0) {
int noFavCnt = prefs.getInt("no-favorites-tip", 0);
if (noFavCnt < 3 && !prefs.getBoolean("enable-favorites-bar", false)) {
Toast toast = Toast.makeText(MainActivity.this, getString(R.string.no_favorites), Toast.LENGTH_SHORT);
toast.show();
prefs.edit().putInt("no-favorites-tip", ++noFavCnt).apply();
}
}
// Don't look for items after favIds length, we won't be able to display them
for (int i = 0; i < Math.min(favoritesIds.length, favoritesPojo.size()); i++) {
Pojo pojo = favoritesPojo.get(i);
ImageView image = (ImageView) findViewById(favoritesIds[i]);
Result result = Result.fromPojo(MainActivity.this, pojo);
Drawable drawable = result.getDrawable(MainActivity.this);
if (drawable != null) {
image.setImageDrawable(drawable);
} else {
Log.e(TAG, "Falling back to default image for favorite.");
// Use the default contact image otherwise
image.setImageResource(R.drawable.ic_contact);
}
image.setVisibility(View.VISIBLE);
image.setContentDescription(pojo.displayName);
}
// Hide empty favorites (not enough favorites yet)
for (int i = favoritesPojo.size(); i < favoritesIds.length; i++) {
findViewById(favoritesIds[i]).setVisibility(View.GONE);
}
}
use of android.widget.Toast in project LEGO-MINDSTORMS-MINDdroid by NXT.
the class UniversalUploader method showToast.
/**
* Displays a message as a toast
*/
public void showToast(String message) {
Toast toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
toast.show();
return;
}
use of android.widget.Toast in project WordPress-Android by wordpress-mobile.
the class ReaderSubsActivity method showInfoToast.
/*
* toast message shown when adding/removing a tag - appears above the edit text at the bottom
*/
private void showInfoToast(String text) {
int yOffset = findViewById(R.id.layout_bottom).getHeight() + DisplayUtils.dpToPx(this, 8);
Toast toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 0, yOffset);
toast.show();
}
use of android.widget.Toast in project AdMoney by ErnestoGonAr.
the class EstablecerActivity method evento.
public void evento(View view) {
bandera = false;
Spinner spinner = (Spinner) findViewById(R.id.spinner);
String pregunta = spinner.getSelectedItem().toString();
EditText p1 = (EditText) findViewById(R.id.pin);
String pin = p1.getText().toString();
EditText p2 = (EditText) findViewById(R.id.pinC);
String pin2 = p2.getText().toString();
EditText r = (EditText) findViewById(R.id.pregSeg);
String resp = r.getText().toString();
if (spinner.getSelectedItemPosition() == 0) {
Toast toast = Toast.makeText(this, "Selecciona una pregunta", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.show();
return;
}
if (resp.equals("")) {
Toast toast = Toast.makeText(this, "Escribe tu respuesta", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.show();
return;
}
if (!(pin.length() == 4)) {
Toast toast = Toast.makeText(this, "NIP debe ser de 4 digitos", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.show();
return;
}
if (!pin.equals(pin2)) {
Toast toast = Toast.makeText(this, "El NIP no coincide", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.show();
return;
}
if (db.isthereData()) {
db.updateLOGINN(pin, pregunta, resp);
}
db.insertarLOGINN(pin, pregunta, resp);
bandera = true;
}
Aggregations