Search in sources :

Example 36 with Toast

use of android.widget.Toast in project AdMoney by ErnestoGonAr.

the class Reporte_Prestamos method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reporte__prestamos);
    bd = new BDHandlerAM(this);
    RecyclerView rv = (RecyclerView) findViewById(R.id.recycler_prestamos);
    try {
        String[][] dataSet = bd.obtenerPrestamos();
        LinearLayoutManager ln = new LinearLayoutManager(this);
        ln.setOrientation(LinearLayoutManager.VERTICAL);
        CustomAdapter_Prestamos adapter = new CustomAdapter_Prestamos(dataSet);
        rv.setLayoutManager(ln);
        rv.setAdapter(adapter);
    } catch (ArrayIndexOutOfBoundsException e) {
        Toast toast = Toast.makeText(this, "No hay prestamos", Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.show();
        return;
    }
}
Also used : CustomAdapter_Prestamos(layout.CustomAdapter_Prestamos) Toast(android.widget.Toast) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 37 with Toast

use of android.widget.Toast in project android_frameworks_base by AOSPA.

the class ActionMenuItemView method onLongClick.

@Override
public boolean onLongClick(View v) {
    if (hasText()) {
        // Don't show the cheat sheet for items that already show text.
        return false;
    }
    final int[] screenPos = new int[2];
    final Rect displayFrame = new Rect();
    getLocationOnScreen(screenPos);
    getWindowVisibleDisplayFrame(displayFrame);
    final Context context = getContext();
    final int width = getWidth();
    final int height = getHeight();
    final int midy = screenPos[1] + height / 2;
    int referenceX = screenPos[0] + width / 2;
    if (v.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) {
        final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
        // mirror
        referenceX = screenWidth - referenceX;
    }
    Toast cheatSheet = Toast.makeText(context, mItemData.getTitle(), Toast.LENGTH_SHORT);
    if (midy < displayFrame.height()) {
        // Show along the top; follow action buttons
        cheatSheet.setGravity(Gravity.TOP | Gravity.END, referenceX, screenPos[1] + height - displayFrame.top);
    } else {
        // Show along the bottom center
        cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
    }
    cheatSheet.show();
    return true;
}
Also used : Context(android.content.Context) Rect(android.graphics.Rect) Toast(android.widget.Toast)

Example 38 with Toast

use of android.widget.Toast in project android_frameworks_base by AOSPA.

the class NekoActivationActivity method toastUp.

private void toastUp(String s) {
    Toast toast = Toast.makeText(this, s, Toast.LENGTH_SHORT);
    toast.getView().setBackgroundDrawable(null);
    toast.show();
}
Also used : Toast(android.widget.Toast)

Example 39 with Toast

use of android.widget.Toast in project android_frameworks_base by AOSPA.

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 40 with Toast

use of android.widget.Toast in project android_frameworks_base by AOSPA.

the class LockTaskNotify method makeAllUserToastAndShow.

private Toast makeAllUserToastAndShow(String text) {
    Toast toast = Toast.makeText(mContext, text, Toast.LENGTH_LONG);
    toast.getWindowParams().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
    toast.show();
    return toast;
}
Also used : Toast(android.widget.Toast)

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