Plugin side toolbar design tweak

- Added new parameter to navigation buttons: priority.
- Ordered the navigation buttons by their priority and name in PluginToolbar.
- Added a maximum size to the navigation buttons to keep all their sizes
the same.
- Added new icons for the following plugins:
   - Account (login/logout)
   - Grand Exchange
   - Feed
   - Info
   - Kourend Library
   - Notes
   - Screenshot
This commit is contained in:
Ruben Amendoeira
2018-05-02 03:23:54 +01:00
committed by Tomas Slusny
parent 6d331ae5a1
commit 3526b258bb
21 changed files with 24 additions and 3 deletions

View File

@@ -78,6 +78,7 @@ public class ConfigPlugin extends Plugin
navButton = NavigationButton.builder()
.name("Configuration")
.icon(icon)
.priority(0)
.panel(configPanel)
.build();

View File

@@ -122,6 +122,7 @@ public class DevToolsPlugin extends Plugin
navButton = NavigationButton.builder()
.name("Developer Tools")
.icon(icon)
.priority(1)
.panel(panel)
.build();

View File

@@ -98,6 +98,7 @@ public class FarmingTrackerPlugin extends Plugin
.name("Farming Tracker")
.icon(icon)
.panel(panel)
.priority(4)
.build();
pluginToolbar.addNavigation(navButton);

View File

@@ -93,6 +93,7 @@ public class FeedPlugin extends Plugin
navButton = NavigationButton.builder()
.name("News Feed")
.icon(icon)
.priority(8)
.panel(feedPanel)
.build();

View File

@@ -114,6 +114,7 @@ public class GrandExchangePlugin extends Plugin
button = NavigationButton.builder()
.name("GE Offers")
.icon(icon)
.priority(3)
.panel(panel)
.build();

View File

@@ -98,12 +98,13 @@ public class HiscorePlugin extends Plugin
BufferedImage icon;
synchronized (ImageIO.class)
{
icon = ImageIO.read(getClass().getResourceAsStream("hiscore.gif"));
icon = ImageIO.read(getClass().getResourceAsStream("normal.png"));
}
navButton = NavigationButton.builder()
.name("Hiscore")
.icon(icon)
.priority(5)
.panel(hiscorePanel)
.build();

View File

@@ -58,6 +58,7 @@ public class InfoPlugin extends Plugin
navButton = NavigationButton.builder()
.name("Info")
.icon(icon)
.priority(9)
.panel(panel)
.build();

View File

@@ -94,6 +94,7 @@ public class KourendLibraryPlugin extends Plugin
navButton = NavigationButton.builder()
.name("Kourend Library")
.priority(6)
.icon(icon)
.panel(panel)
.build();

View File

@@ -74,6 +74,7 @@ public class NotesPlugin extends Plugin
navButton = NavigationButton.builder()
.name("Notes")
.icon(icon)
.priority(7)
.panel(panel)
.build();

View File

@@ -122,6 +122,7 @@ public class XpTrackerPlugin extends Plugin
navButton = NavigationButton.builder()
.name("XP Tracker")
.icon(icon)
.priority(2)
.panel(xpPanel)
.build();

View File

@@ -74,6 +74,12 @@ public class NavigationButton
*/
private PluginPanel panel;
/**
* The order in which the button should be displayed in the side bar. (from lower to higher)
*/
private int priority;
/**
* Map of key-value pairs for setting the popup menu
*/

View File

@@ -24,8 +24,8 @@
*/
package net.runelite.client.ui;
import com.google.common.collect.ComparisonChain;
import com.google.common.eventbus.EventBus;
import java.util.Comparator;
import java.util.TreeSet;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -39,7 +39,11 @@ import net.runelite.client.events.PluginToolbarButtonRemoved;
public class PluginToolbar
{
private final EventBus eventBus;
private final TreeSet<NavigationButton> buttons = new TreeSet<>(Comparator.comparing(NavigationButton::getName));
private final TreeSet<NavigationButton> buttons = new TreeSet<>((a, b) ->
ComparisonChain.start()
.compare(a.getPriority(), b.getPriority())
.compare(a.getName(), b.getName())
.result());
@Inject
private PluginToolbar(final EventBus eventBus)

View File

@@ -310,6 +310,7 @@ public class SwingUtil
: navigationButton.getIcon();
final JButton button = new JButton();
button.setMaximumSize(new Dimension(30, 30));
button.setName(navigationButton.getName());
button.setToolTipText(navigationButton.getTooltip());
button.setIcon(new ImageIcon(scaledImage));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 692 B

After

Width:  |  Height:  |  Size: 218 B