-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from cryptomator/feature/tray-icon-loader
polymorphic tray icon loading
- Loading branch information
Showing
2 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/org/cryptomator/integrations/tray/TrayIconLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.cryptomator.integrations.tray; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
/** | ||
* A callback used by the {@link TrayMenuController} to load tray icons in the format required by the implementation. | ||
*/ | ||
@ApiStatus.Experimental | ||
sealed public interface TrayIconLoader permits TrayIconLoader.PngData, TrayIconLoader.FreedesktopIconName { | ||
|
||
@FunctionalInterface | ||
non-sealed interface PngData extends TrayIconLoader { | ||
|
||
/** | ||
* Loads an icon from a byte array holding a loaded PNG file. | ||
* | ||
* @param data png data | ||
*/ | ||
void loadPng(byte[] data); | ||
} | ||
|
||
@FunctionalInterface | ||
non-sealed interface FreedesktopIconName extends TrayIconLoader { | ||
|
||
/** | ||
* Loads an icon by looking it up {@code iconName} inside of {@code $XDG_DATA_DIRS/icons}. | ||
* | ||
* @param iconName the icon name | ||
*/ | ||
void lookupByName(String iconName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters