Skip to content

Commit e4137ff

Browse files
api fine tuning and documentation
1 parent 96e3251 commit e4137ff

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/main/java/org/cryptomator/integrations/tray/TrayIntegrationProvider.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@
44

55
import java.util.Optional;
66

7+
/**
8+
* Allows to perform OS-specific tasks when the app gets minimized to or restored from a tray icon.
9+
*/
710
public interface TrayIntegrationProvider {
811

12+
/**
13+
* Loads the best-suited TrayIntegrationProvider.
14+
*
15+
* @return preferred TrayIntegrationProvider (if any)
16+
* @since 1.1.0
17+
*/
918
static Optional<TrayIntegrationProvider> get() {
1019
return IntegrationsLoader.load(TrayIntegrationProvider.class);
1120
}

src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,34 @@
77
import java.util.List;
88
import java.util.Optional;
99

10+
/**
11+
* Displays a tray icon and menu
12+
*
13+
* @since 1.1.0
14+
*/
1015
public interface TrayMenuController {
1116

1217
static Optional<TrayMenuController> get() {
1318
return IntegrationsLoader.load(TrayMenuController.class);
1419
}
1520

1621
/**
17-
* Adds an icon to the system tray.
22+
* Displays an icon on the system tray.
1823
*
19-
* @param iconData What image to show
20-
* @param tooltip Text shown when hovering
21-
* @throws IOException thrown when interacting with the given <code>iconData</code>
24+
* @param rawImageData What image to show
25+
* @param defaultAction Action to perform when interacting with the icon directly instead of its menu
26+
* @param tooltip Text shown when hovering
27+
* @throws IOException thrown when interacting with the given <code>rawImageData</code>
2228
*/
23-
void showTrayIcon(InputStream iconData, String tooltip) throws IOException;
29+
void showTrayIcon(InputStream rawImageData, Runnable defaultAction, String tooltip) throws IOException;
2430

2531
/**
2632
* Show the given options in the tray menu.
33+
* <p>
34+
* This method may be called multiple times, e.g. when the vault list changes.
2735
*
2836
* @param items Menu items
2937
*/
30-
void setTrayMenu(List<TrayMenuItem> items);
38+
void updateTrayMenu(List<TrayMenuItem> items);
3139

3240
}

0 commit comments

Comments
 (0)