Skip to content

Commit 8788eac

Browse files
authored
[revert] removal of BagdeIcon (#8426)
Reverts #8365. Fixes: #8422 --- <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide]([https://github.com/dart-lang/sdk/blob/main/CONTRIBUTING.md](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](#8098)). </details>
1 parent 3a86fa5 commit 8788eac

File tree

2 files changed

+5
-43
lines changed

2 files changed

+5
-43
lines changed

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66

77
import okhttp3.internal.immutableListOf
88
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
9+
import org.jetbrains.changelog.Changelog
910
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
1011
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
1112
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
1213
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask
1314
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1415
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
15-
import java.io.File
1616
import java.time.LocalDate
1717
import java.time.format.DateTimeFormatter
18-
import org.jetbrains.changelog.Changelog
1918

2019
// Specify UTF-8 for all compilations so we avoid Windows-1252.
2120
allprojects {
@@ -186,7 +185,8 @@ intellijPlatform {
186185
VerifyPluginTask.FailureLevel.COMPATIBILITY_PROBLEMS,
187186
// VerifyPluginTask.FailureLevel.DEPRECATED_API_USAGES, // https://github.com/flutter/flutter-intellij/issues/7718
188187
// VerifyPluginTask.FailureLevel.SCHEDULED_FOR_REMOVAL_API_USAGES,
189-
VerifyPluginTask.FailureLevel.EXPERIMENTAL_API_USAGES,
188+
// `BadgeIcon`:
189+
// VerifyPluginTask.FailureLevel.EXPERIMENTAL_API_USAGES,
190190
// VerifyPluginTask.FailureLevel.INTERNAL_API_USAGES,
191191
// VerifyPluginTask.FailureLevel.OVERRIDE_ONLY_API_USAGES,
192192
VerifyPluginTask.FailureLevel.NON_EXTENDABLE_API_USAGES,
@@ -197,7 +197,7 @@ intellijPlatform {
197197
)
198198
verificationReportsFormats = VerifyPluginTask.VerificationReportsFormats.ALL
199199
subsystemsToCheck = VerifyPluginTask.Subsystems.ALL
200-
200+
201201
ides {
202202
recommended()
203203
}

src/io/flutter/toolwindow/ToolWindowBadgeUpdater.java

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.intellij.openapi.wm.ToolWindow;
1111
import com.intellij.openapi.wm.ToolWindowId;
1212
import com.intellij.openapi.wm.ToolWindowManager;
13+
import com.intellij.ui.BadgeIcon;
1314
import io.flutter.run.common.RunMode;
1415
import io.flutter.run.daemon.FlutterApp;
1516

@@ -51,43 +52,4 @@ else if (app.getMode() == RunMode.DEBUG) {
5152
});
5253
}
5354
}
54-
55-
private static class BadgeIcon implements Icon {
56-
private final Icon baseIcon;
57-
private final Color overlayColor;
58-
private static final float alpha = 1.0F;
59-
60-
public BadgeIcon(Icon baseIcon, Color overlayColor) {
61-
this.baseIcon = baseIcon;
62-
this.overlayColor = overlayColor;
63-
}
64-
65-
@Override
66-
public void paintIcon(Component c, Graphics g, int x, int y) {
67-
baseIcon.paintIcon(c, g, x, y);
68-
69-
Graphics2D g2d = (Graphics2D)g.create();
70-
try {
71-
g2d.translate(x, y);
72-
73-
g2d.setComposite(AlphaComposite.SrcOver.derive(alpha));
74-
75-
g2d.setColor(overlayColor);
76-
g2d.fillRect(0, 0, getIconWidth(), getIconHeight());
77-
}
78-
finally {
79-
g2d.dispose();
80-
}
81-
}
82-
83-
@Override
84-
public int getIconWidth() {
85-
return baseIcon.getIconWidth();
86-
}
87-
88-
@Override
89-
public int getIconHeight() {
90-
return baseIcon.getIconHeight();
91-
}
92-
}
9355
}

0 commit comments

Comments
 (0)