|
|
@ -9,6 +9,11 @@ import com.fr.design.notification.SnapChatKey; |
|
|
|
import javax.swing.JMenu; |
|
|
|
import javax.swing.JMenu; |
|
|
|
import javax.swing.event.MenuEvent; |
|
|
|
import javax.swing.event.MenuEvent; |
|
|
|
import javax.swing.event.MenuListener; |
|
|
|
import javax.swing.event.MenuListener; |
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
|
|
|
import java.awt.Image; |
|
|
|
|
|
|
|
import java.awt.geom.Ellipse2D; |
|
|
|
|
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* created by Harrison on 2020/03/16 |
|
|
|
* created by Harrison on 2020/03/16 |
|
|
@ -37,7 +42,9 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { |
|
|
|
public boolean hasRead() { |
|
|
|
public boolean hasRead() { |
|
|
|
|
|
|
|
|
|
|
|
String calcKey = calcKey(); |
|
|
|
String calcKey = calcKey(); |
|
|
|
return SnapChatConfig.getInstance().hasRead(calcKey); |
|
|
|
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey); |
|
|
|
|
|
|
|
// 默认读过了。
|
|
|
|
|
|
|
|
return val == null ? defaultStatus() : val; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -47,6 +54,27 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { |
|
|
|
SnapChatConfig.getInstance().markRead(calcKey); |
|
|
|
SnapChatConfig.getInstance().markRead(calcKey); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean defaultStatus() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void addShortCut(ShortCut shortCut) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addSnapChatNotification(shortCut); |
|
|
|
|
|
|
|
super.addShortCut(shortCut); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void insertShortCut(int index, ShortCut shortCut) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addSnapChatNotification(shortCut); |
|
|
|
|
|
|
|
super.insertShortCut(index, shortCut); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public SnapChatKey key() { |
|
|
|
public SnapChatKey key() { |
|
|
|
|
|
|
|
|
|
|
@ -59,6 +87,22 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { |
|
|
|
return new SnapChatMenuListener(); |
|
|
|
return new SnapChatMenuListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 添加提醒 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param shortCut 快捷方式 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void addSnapChatNotification(ShortCut shortCut) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (shortCut instanceof SnapChatUpdateAction) { |
|
|
|
|
|
|
|
SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut; |
|
|
|
|
|
|
|
if (!action.hasRead()) { |
|
|
|
|
|
|
|
String calcKey = calcKey(); |
|
|
|
|
|
|
|
SnapChatConfig.getInstance().resetRead(calcKey); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String calcKey() { |
|
|
|
private String calcKey() { |
|
|
|
|
|
|
|
|
|
|
|
return key().calc(); |
|
|
|
return key().calc(); |
|
|
@ -141,4 +185,16 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { |
|
|
|
setUI(menuUI); |
|
|
|
setUI(menuUI); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BufferedImage image = new BufferedImage(16, 16, Image.SCALE_DEFAULT); |
|
|
|
|
|
|
|
Graphics2D g2d = image.createGraphics(); |
|
|
|
|
|
|
|
g2d.setColor(Color.green); |
|
|
|
|
|
|
|
Ellipse2D.Double shape = |
|
|
|
|
|
|
|
new Ellipse2D.Double(2, 2, 1, 1); |
|
|
|
|
|
|
|
g2d.fill(shape); |
|
|
|
|
|
|
|
g2d.draw(shape); |
|
|
|
|
|
|
|
System.out.println(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|