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();
}
}
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;
}
}
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();
}
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;
}
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();
}
Aggregations