Search in sources :

Example 21 with Toast

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;
}
Also used : Toast(android.widget.Toast)

Example 22 with 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);
    }
}
Also used : Pojo(fr.neamar.kiss.pojo.Pojo) Toast(android.widget.Toast) Drawable(android.graphics.drawable.Drawable) ImageView(android.widget.ImageView) SuppressLint(android.annotation.SuppressLint) Result(fr.neamar.kiss.result.Result)

Example 23 with Toast

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;
}
Also used : Toast(android.widget.Toast)

Example 24 with Toast

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();
}
Also used : Toast(android.widget.Toast)

Example 25 with Toast

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;
}
Also used : EditText(android.widget.EditText) Toast(android.widget.Toast) Spinner(android.widget.Spinner)

Aggregations

Toast (android.widget.Toast)485 Context (android.content.Context)89 View (android.view.View)86 TextView (android.widget.TextView)74 Intent (android.content.Intent)55 Rect (android.graphics.Rect)34 LayoutInflater (android.view.LayoutInflater)31 SuppressLint (android.annotation.SuppressLint)30 JSONObject (org.json.JSONObject)23 ImageView (android.widget.ImageView)21 RequestQueue (com.android.volley.RequestQueue)20 Response (com.android.volley.Response)20 EditText (android.widget.EditText)19 JSONException (org.json.JSONException)18 VolleyError (com.android.volley.VolleyError)17 JsonObjectRequest (com.android.volley.toolbox.JsonObjectRequest)17 User (model.User)16 PendingIntent (android.app.PendingIntent)15 File (java.io.File)15 HashMap (java.util.HashMap)15