Search in sources :

Example 51 with Toast

use of android.widget.Toast in project platform_frameworks_base by android.

the class AELogger method onAccessibilityEvent.

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    final String eventClass = event.getClassName() != null ? event.getClassName().toString() : null;
    final String eventText = event.getText() != null ? String.valueOf(event.getText()).toLowerCase(Locale.getDefault()) : null;
    final String eventType = AccessibilityEvent.eventTypeToString(event.getEventType());
    Log.d(TAG, String.format("typ=%s cls=%s pkg=%s txt=%s dsc=%s", eventType, eventClass, event.getPackageName(), eventText, event.getContentDescription()));
    // Show selected event types
    if (0 != (TOAST_EVENT_TYPES & event.getEventType())) {
        final Toast toast = Toast.makeText(this, eventType + ": " + eventClass, Toast.LENGTH_SHORT);
        toast.show();
    }
}
Also used : Toast(android.widget.Toast)

Example 52 with Toast

use of android.widget.Toast in project leakcanary by square.

the class AndroidHeapDumper method dumpHeap.

@Override
public File dumpHeap() {
    File heapDumpFile = leakDirectoryProvider.newHeapDumpFile();
    if (heapDumpFile == RETRY_LATER) {
        return RETRY_LATER;
    }
    FutureResult<Toast> waitingForToast = new FutureResult<>();
    showToast(waitingForToast);
    if (!waitingForToast.wait(5, SECONDS)) {
        CanaryLog.d("Did not dump heap, too much time waiting for Toast.");
        return RETRY_LATER;
    }
    Toast toast = waitingForToast.get();
    try {
        Debug.dumpHprofData(heapDumpFile.getAbsolutePath());
        cancelToast(toast);
        return heapDumpFile;
    } catch (Exception e) {
        CanaryLog.d(e, "Could not dump heap");
        // Abort heap dump
        return RETRY_LATER;
    }
}
Also used : FutureResult(com.squareup.leakcanary.internal.FutureResult) Toast(android.widget.Toast) File(java.io.File)

Example 53 with Toast

use of android.widget.Toast in project facebook-android-sdk by facebook.

the class PickerActivity method onError.

private void onError(Exception error) {
    String text = getString(R.string.exception, error.getMessage());
    Toast toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
    toast.show();
}
Also used : Toast(android.widget.Toast)

Example 54 with Toast

use of android.widget.Toast in project XobotOS by xamarin.

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;
    final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
    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.RIGHT, screenWidth - screenPos[0] - width / 2, height);
    } 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 55 with Toast

use of android.widget.Toast in project PhotoNoter by yydcdut.

the class PGEditView method toastFirstFail.

public void toastFirstFail(Context context) {
    Toast toast = Toast.makeText(context, R.string.pg_sdk_edit_first_show_fail, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
}
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