Skip to content

Commit

Permalink
Remove feed refresh button
Browse files Browse the repository at this point in the history
The current refresh button has little to no use as it only updates the
ui, and that gets updated whenever the data changes anyways. As there
is no way of fetching the data on command, the button is useless and
should be removed, so I did.
  • Loading branch information
psikoi committed May 25, 2018
1 parent 765bed1 commit 745b444
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
Expand All @@ -55,7 +54,6 @@
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.PluginPanel;
import net.runelite.client.util.LinkBrowser;
import net.runelite.client.util.SwingUtil;
import net.runelite.http.api.RuneLiteAPI;
import net.runelite.http.api.feed.FeedItem;
import net.runelite.http.api.feed.FeedItemType;
Expand All @@ -71,8 +69,6 @@ class FeedPanel extends PluginPanel
{
private static final ImageIcon RUNELITE_ICON;
private static final ImageIcon OSRS_ICON;
private static final ImageIcon RESET_ICON;
private static final ImageIcon RESET_ICON_CLICK; //used as a click effect (darker version of the reset icon)

private static final Color TWEET_BACKGROUND = new Color(15, 15, 15);
private static final Color OSRS_NEWS_BACKGROUND = new Color(36, 30, 19);
Expand Down Expand Up @@ -110,11 +106,8 @@ else if (o2.getType() == FeedItemType.BLOG_POST)
{
synchronized (ImageIO.class)
{
BufferedImage reset = ImageIO.read(FeedPanel.class.getResourceAsStream("reset.png"));
RUNELITE_ICON = new ImageIcon(ImageIO.read(FeedPanel.class.getResourceAsStream("runelite.png")));
OSRS_ICON = new ImageIcon(ImageIO.read(FeedPanel.class.getResourceAsStream("osrs.png")));
RESET_ICON = new ImageIcon(reset);
RESET_ICON_CLICK = new ImageIcon(SwingUtil.grayscaleOffset(reset, -100));
}
}
catch (IOException e)
Expand All @@ -138,47 +131,11 @@ else if (o2.getType() == FeedItemType.BLOG_POST)
feedContainer.setLayout(new GridLayout(0, 1, 0, 4));
feedContainer.setBackground(ColorScheme.DARK_GRAY_COLOR);

/**
* This header contains the "News Feed" title and a refresh icon button.
*/
JPanel header = new JPanel();
header.setBackground(ColorScheme.DARK_GRAY_COLOR);
header.setLayout(new BorderLayout());
header.setBorder(new EmptyBorder(0, 0, 9, 0));

/**
* A refresh icon button, when clicked, it will swap icons for feedback effect and then call
* the rebuildFeed method.
*/
JLabel reset = new JLabel();
reset.setIcon(RESET_ICON);
reset.setVerticalAlignment(SwingConstants.CENTER);
reset.setHorizontalAlignment(SwingConstants.CENTER);
reset.setToolTipText("Refresh");

reset.addMouseListener(new MouseAdapter()
{
@Override
public void mousePressed(MouseEvent mouseEvent)
{
reset.setIcon(RESET_ICON_CLICK);
rebuildFeed();
}

@Override
public void mouseReleased(MouseEvent mouseEvent)
{
reset.setIcon(RESET_ICON);
}
});

JLabel title = new JLabel("News feed");
title.setBorder(new EmptyBorder(0, 0, 9, 0));
title.setForeground(Color.WHITE);

header.add(title, BorderLayout.WEST);
header.add(reset, BorderLayout.EAST);

add(header, BorderLayout.NORTH);
add(title, BorderLayout.NORTH);
add(feedContainer, BorderLayout.CENTER);
}

Expand Down
Binary file not shown.

0 comments on commit 745b444

Please sign in to comment.