use of org.chromium.ui.widget.Toast in project AndroidChromium by JackyAndroid.
the class ShortcutHelper method showAddedToHomescreenToast.
/**
* Show toast to alert user that the shortcut was added to the home screen.
*/
private static void showAddedToHomescreenToast(final String title) {
assert ThreadUtils.runningOnUiThread();
Context applicationContext = ContextUtils.getApplicationContext();
String toastText = applicationContext.getString(R.string.added_to_homescreen, title);
Toast toast = Toast.makeText(applicationContext, toastText, Toast.LENGTH_SHORT);
toast.show();
}
use of org.chromium.ui.widget.Toast in project AndroidChromium by JackyAndroid.
the class AbstractMediaRouteController method showCastError.
protected void showCastError(String routeName) {
Toast toast = Toast.makeText(getContext(), getContext().getString(R.string.cast_error_playing_video, routeName), Toast.LENGTH_SHORT);
toast.show();
}
use of org.chromium.ui.widget.Toast in project AndroidChromium by JackyAndroid.
the class RemoteMediaPlayerController method showMessageToast.
private void showMessageToast(String message) {
Toast toast = Toast.makeText(mCastContextApplicationContext, message, Toast.LENGTH_SHORT);
toast.show();
}
use of org.chromium.ui.widget.Toast in project AndroidChromium by JackyAndroid.
the class CustomButtonParams method buildBottomBarButton.
/**
* Builds an {@link ImageButton} from the data in this params. Generated buttons should be
* placed on the bottom bar. The button's tag will be its id.
* @param parent The parent that the inflated {@link ImageButton}.
* @param listener {@link OnClickListener} that should be used with the button.
* @return Parsed list of {@link CustomButtonParams}, which is empty if the input is invalid.
*/
ImageButton buildBottomBarButton(Context context, ViewGroup parent, OnClickListener listener) {
if (mIsOnToolbar)
return null;
ImageButton button = (ImageButton) LayoutInflater.from(context).inflate(R.layout.custom_tabs_bottombar_item, parent, false);
button.setId(mId);
button.setImageBitmap(mIcon);
button.setContentDescription(mDescription);
if (mPendingIntent == null) {
button.setEnabled(false);
} else {
button.setOnClickListener(listener);
}
button.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
final int screenWidth = view.getResources().getDisplayMetrics().widthPixels;
final int screenHeight = view.getResources().getDisplayMetrics().heightPixels;
final int[] screenPos = new int[2];
view.getLocationOnScreen(screenPos);
final int width = view.getWidth();
Toast toast = Toast.makeText(view.getContext(), view.getContentDescription(), Toast.LENGTH_SHORT);
toast.setGravity(Gravity.BOTTOM | Gravity.END, screenWidth - screenPos[0] - width / 2, screenHeight - screenPos[1]);
toast.show();
return true;
}
});
return button;
}
use of org.chromium.ui.widget.Toast in project AndroidChromium by JackyAndroid.
the class ToolbarLayout method showAccessibilityToast.
/**
* Shows the content description toast for items on the toolbar.
* @param view The view to anchor the toast.
* @param description The string shown in the toast.
* @return Whether a toast has been shown successfully.
*/
protected boolean showAccessibilityToast(View view, CharSequence description) {
if (description == null)
return false;
final int screenWidth = getResources().getDisplayMetrics().widthPixels;
final int[] screenPos = new int[2];
view.getLocationOnScreen(screenPos);
final int width = view.getWidth();
Toast toast = Toast.makeText(getContext(), description, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP | Gravity.END, screenWidth - screenPos[0] - width / 2, screenPos[1] + getHeight() / 2);
toast.show();
return true;
}
Aggregations