Replace lock Sone page with Kotlin version
[Sone.git] / src / main / java / net / pterodactylus / sone / data / SoneOptions.java
1 package net.pterodactylus.sone.data;
2
3 import static net.pterodactylus.sone.data.SoneOptions.LoadExternalContent.NEVER;
4
5 import javax.annotation.Nonnull;
6
7 /**
8  * All Sone-specific options.
9  *
10  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
11  */
12 public interface SoneOptions {
13
14         boolean isAutoFollow();
15         void setAutoFollow(boolean autoFollow);
16
17         boolean isSoneInsertNotificationEnabled();
18         void setSoneInsertNotificationEnabled(boolean soneInsertNotificationEnabled);
19
20         boolean isShowNewSoneNotifications();
21         void setShowNewSoneNotifications(boolean showNewSoneNotifications);
22
23         boolean isShowNewPostNotifications();
24         void setShowNewPostNotifications(boolean showNewPostNotifications);
25
26         boolean isShowNewReplyNotifications();
27         void setShowNewReplyNotifications(boolean showNewReplyNotifications);
28
29         LoadExternalContent getShowCustomAvatars();
30         void setShowCustomAvatars(LoadExternalContent showCustomAvatars);
31
32         @Nonnull LoadExternalContent getLoadLinkedImages();
33         void setLoadLinkedImages(@Nonnull LoadExternalContent loadLinkedImages);
34
35         /**
36          * Possible values for all options that are related to loading external content.
37          *
38          * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
39          */
40         enum LoadExternalContent {
41
42                 /** Never show custom avatars. */
43                 NEVER,
44
45                 /** Only show custom avatars of followed Sones. */
46                 FOLLOWED,
47
48                 /** Only show custom avatars of Sones you manually trust. */
49                 MANUALLY_TRUSTED,
50
51                 /** Only show custom avatars of automatically trusted Sones. */
52                 TRUSTED,
53
54                 /** Always show custom avatars. */
55                 ALWAYS,
56
57         }
58
59         /**
60          * {@link SoneOptions} implementation.
61          *
62          * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
63          */
64         public class DefaultSoneOptions implements SoneOptions {
65
66                 private boolean autoFollow = false;
67                 private boolean soneInsertNotificationsEnabled = false;
68                 private boolean showNewSoneNotifications = true;
69                 private boolean showNewPostNotifications = true;
70                 private boolean showNewReplyNotifications = true;
71                 private LoadExternalContent showCustomAvatars = NEVER;
72                 private LoadExternalContent loadLinkedImages = NEVER;
73
74                 @Override
75                 public boolean isAutoFollow() {
76                         return autoFollow;
77                 }
78
79                 @Override
80                 public void setAutoFollow(boolean autoFollow) {
81                         this.autoFollow = autoFollow;
82                 }
83
84                 @Override
85                 public boolean isSoneInsertNotificationEnabled() {
86                         return soneInsertNotificationsEnabled;
87                 }
88
89                 @Override
90                 public void setSoneInsertNotificationEnabled(boolean soneInsertNotificationEnabled) {
91                         this.soneInsertNotificationsEnabled = soneInsertNotificationEnabled;
92                 }
93
94                 @Override
95                 public boolean isShowNewSoneNotifications() {
96                         return showNewSoneNotifications;
97                 }
98
99                 @Override
100                 public void setShowNewSoneNotifications(boolean showNewSoneNotifications) {
101                         this.showNewSoneNotifications = showNewSoneNotifications;
102                 }
103
104                 @Override
105                 public boolean isShowNewPostNotifications() {
106                         return showNewPostNotifications;
107                 }
108
109                 @Override
110                 public void setShowNewPostNotifications(boolean showNewPostNotifications) {
111                         this.showNewPostNotifications = showNewPostNotifications;
112                 }
113
114                 @Override
115                 public boolean isShowNewReplyNotifications() {
116                         return showNewReplyNotifications;
117                 }
118
119                 @Override
120                 public void setShowNewReplyNotifications(boolean showNewReplyNotifications) {
121                         this.showNewReplyNotifications = showNewReplyNotifications;
122                 }
123
124                 @Override
125                 public LoadExternalContent getShowCustomAvatars() {
126                         return showCustomAvatars;
127                 }
128
129                 @Override
130                 public void setShowCustomAvatars(LoadExternalContent showCustomAvatars) {
131                         this.showCustomAvatars = showCustomAvatars;
132                 }
133
134                 @Nonnull
135                 @Override
136                 public LoadExternalContent getLoadLinkedImages() {
137                         return loadLinkedImages;
138                 }
139
140                 @Override
141                 public void setLoadLinkedImages(@Nonnull LoadExternalContent loadLinkedImages) {
142                         this.loadLinkedImages = loadLinkedImages;
143                 }
144
145         }
146
147 }