mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-06 17:38:48 +00:00
PlanActivity: Remove image from toast. It won't work with targetSdkVersion 30.
This commit is contained in:
parent
440c1665e6
commit
87d94aef0d
3 changed files with 8 additions and 33 deletions
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z" />
|
||||
</vector>
|
|
@ -367,8 +367,7 @@ public class PlanActivity extends Activity {
|
|||
viewAnimator.setDisplayedChild(1);
|
||||
|
||||
if (!stations.isEmpty()) {
|
||||
new Toast(PlanActivity.this).imageToast(R.drawable.ic_info_outline_white_24dp,
|
||||
R.string.toast_plan_interactive_hint);
|
||||
new Toast(PlanActivity.this).toast(R.string.toast_plan_interactive_hint);
|
||||
|
||||
plan.setStationsAware(new StationsAware() {
|
||||
public List<Station> getStations() {
|
||||
|
|
|
@ -30,41 +30,28 @@ public class Toast {
|
|||
}
|
||||
|
||||
public final void toast(final int textResId, final Object... formatArgs) {
|
||||
customToast(0, textResId, android.widget.Toast.LENGTH_SHORT, formatArgs);
|
||||
customToast(textResId, android.widget.Toast.LENGTH_SHORT, formatArgs);
|
||||
}
|
||||
|
||||
public final void toast(final CharSequence text) {
|
||||
customToast(0, text, android.widget.Toast.LENGTH_SHORT);
|
||||
customToast(text, android.widget.Toast.LENGTH_SHORT);
|
||||
}
|
||||
|
||||
public final void longToast(final int textResId, final Object... formatArgs) {
|
||||
customToast(0, textResId, android.widget.Toast.LENGTH_LONG, formatArgs);
|
||||
customToast(textResId, android.widget.Toast.LENGTH_LONG, formatArgs);
|
||||
}
|
||||
|
||||
public final void longToast(final CharSequence text) {
|
||||
customToast(0, text, android.widget.Toast.LENGTH_LONG);
|
||||
customToast(text, android.widget.Toast.LENGTH_LONG);
|
||||
}
|
||||
|
||||
public final void imageToast(final int imageResId, final int textResId, final Object... formatArgs) {
|
||||
customToast(imageResId, textResId, android.widget.Toast.LENGTH_LONG, formatArgs);
|
||||
}
|
||||
|
||||
private void customToast(final int imageResId, final int textResId, final int duration,
|
||||
private void customToast(final int textResId, final int duration,
|
||||
final Object... formatArgs) {
|
||||
customToast(imageResId, context.getString(textResId, formatArgs), duration);
|
||||
customToast(context.getString(textResId, formatArgs), duration);
|
||||
}
|
||||
|
||||
private void customToast(final int imageResId, final CharSequence text, final int duration) {
|
||||
private void customToast(final CharSequence text, final int duration) {
|
||||
final android.widget.Toast toast = android.widget.Toast.makeText(context, text, duration);
|
||||
final TextView toastText = toast.getView().findViewById(android.R.id.message);
|
||||
if (imageResId != 0 && toastText != null) {
|
||||
toastText.setCompoundDrawablesWithIntrinsicBounds(imageResId, 0, 0, 0);
|
||||
toastText.setCompoundDrawablePadding(
|
||||
context.getResources().getDimensionPixelOffset(R.dimen.list_entry_padding_horizontal_verylax));
|
||||
// tint
|
||||
final int textColor = toastText.getTextColors().getDefaultColor();
|
||||
toastText.getCompoundDrawables()[0].setColorFilter(textColor, PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
toast.show();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue