From ab14aa498b45ecd2222b03d6c3607461a0ceb3f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 13 Nov 2016 11:57:23 +0100 Subject: [PATCH] Rename enum to better match its purpose --- src/main/java/net/pterodactylus/sone/core/Core.java | 4 ++-- .../java/net/pterodactylus/sone/data/SoneOptions.java | 16 ++++++++-------- .../net/pterodactylus/sone/template/ProfileAccessor.java | 14 +++++++------- .../java/net/pterodactylus/sone/web/OptionsPage.java | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 42542c0..8c4264a 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -69,7 +69,7 @@ import net.pterodactylus.sone.data.Profile.Field; import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.data.Sone.SoneStatus; -import net.pterodactylus.sone.data.SoneOptions.ShowCustomAvatars; +import net.pterodactylus.sone.data.SoneOptions.LoadExternalContent; import net.pterodactylus.sone.data.TemporaryImage; import net.pterodactylus.sone.database.AlbumBuilder; import net.pterodactylus.sone.database.Database; @@ -1070,7 +1070,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, sone.getOptions().setShowNewSoneNotifications(configuration.getBooleanValue(sonePrefix + "/Options/ShowNotification/NewSones").getValue(true)); sone.getOptions().setShowNewPostNotifications(configuration.getBooleanValue(sonePrefix + "/Options/ShowNotification/NewPosts").getValue(true)); sone.getOptions().setShowNewReplyNotifications(configuration.getBooleanValue(sonePrefix + "/Options/ShowNotification/NewReplies").getValue(true)); - sone.getOptions().setShowCustomAvatars(ShowCustomAvatars.valueOf(configuration.getStringValue(sonePrefix + "/Options/ShowCustomAvatars").getValue(ShowCustomAvatars.NEVER.name()))); + sone.getOptions().setShowCustomAvatars(LoadExternalContent.valueOf(configuration.getStringValue(sonePrefix + "/Options/ShowCustomAvatars").getValue(LoadExternalContent.NEVER.name()))); /* if we’re still here, Sone was loaded successfully. */ synchronized (sone) { diff --git a/src/main/java/net/pterodactylus/sone/data/SoneOptions.java b/src/main/java/net/pterodactylus/sone/data/SoneOptions.java index 4abf16f..b5e42ee 100644 --- a/src/main/java/net/pterodactylus/sone/data/SoneOptions.java +++ b/src/main/java/net/pterodactylus/sone/data/SoneOptions.java @@ -1,6 +1,6 @@ package net.pterodactylus.sone.data; -import static net.pterodactylus.sone.data.SoneOptions.ShowCustomAvatars.NEVER; +import static net.pterodactylus.sone.data.SoneOptions.LoadExternalContent.NEVER; /** * All Sone-specific options. @@ -24,15 +24,15 @@ public interface SoneOptions { boolean isShowNewReplyNotifications(); void setShowNewReplyNotifications(boolean showNewReplyNotifications); - ShowCustomAvatars getShowCustomAvatars(); - void setShowCustomAvatars(ShowCustomAvatars showCustomAvatars); + LoadExternalContent getShowCustomAvatars(); + void setShowCustomAvatars(LoadExternalContent showCustomAvatars); /** - * The possible values for the “show custom avatars” option. + * Possible values for all options that are related to loading external content. * * @author David ‘Bombe’ Roden */ - enum ShowCustomAvatars { + enum LoadExternalContent { /** Never show custom avatars. */ NEVER, @@ -63,7 +63,7 @@ public interface SoneOptions { private boolean showNewSoneNotifications = true; private boolean showNewPostNotifications = true; private boolean showNewReplyNotifications = true; - private ShowCustomAvatars showCustomAvatars = NEVER; + private LoadExternalContent showCustomAvatars = NEVER; @Override public boolean isAutoFollow() { @@ -116,12 +116,12 @@ public interface SoneOptions { } @Override - public ShowCustomAvatars getShowCustomAvatars() { + public LoadExternalContent getShowCustomAvatars() { return showCustomAvatars; } @Override - public void setShowCustomAvatars(ShowCustomAvatars showCustomAvatars) { + public void setShowCustomAvatars(LoadExternalContent showCustomAvatars) { this.showCustomAvatars = showCustomAvatars; } diff --git a/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java b/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java index 7362179..fafba86 100644 --- a/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java @@ -20,7 +20,7 @@ package net.pterodactylus.sone.template; import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.data.Profile; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.data.SoneOptions.ShowCustomAvatars; +import net.pterodactylus.sone.data.SoneOptions.LoadExternalContent; import net.pterodactylus.sone.freenet.wot.OwnIdentity; import net.pterodactylus.sone.freenet.wot.Trust; import net.pterodactylus.util.template.Accessor; @@ -74,24 +74,24 @@ public class ProfileAccessor extends ReflectionAccessor { /* always show your own avatars. */ return avatarId; } - ShowCustomAvatars showCustomAvatars = currentSone.getOptions().getShowCustomAvatars(); - if (showCustomAvatars == ShowCustomAvatars.NEVER) { + LoadExternalContent showCustomAvatars = currentSone.getOptions().getShowCustomAvatars(); + if (showCustomAvatars == LoadExternalContent.NEVER) { return null; } - if (showCustomAvatars == ShowCustomAvatars.ALWAYS) { + if (showCustomAvatars == LoadExternalContent.ALWAYS) { return avatarId; } - if (showCustomAvatars == ShowCustomAvatars.FOLLOWED) { + if (showCustomAvatars == LoadExternalContent.FOLLOWED) { return currentSone.hasFriend(remoteSone.getId()) ? avatarId : null; } Trust trust = remoteSone.getIdentity().getTrust((OwnIdentity) currentSone.getIdentity()); if (trust == null) { return null; } - if ((showCustomAvatars == ShowCustomAvatars.MANUALLY_TRUSTED) && (trust.getExplicit() != null) && (trust.getExplicit() > 0)) { + if ((showCustomAvatars == LoadExternalContent.MANUALLY_TRUSTED) && (trust.getExplicit() != null) && (trust.getExplicit() > 0)) { return avatarId; } - if ((showCustomAvatars == ShowCustomAvatars.TRUSTED) && (((trust.getExplicit() != null) && (trust.getExplicit() > 0)) || ((trust.getImplicit() != null) && (trust.getImplicit() > 0)))) { + if ((showCustomAvatars == LoadExternalContent.TRUSTED) && (((trust.getExplicit() != null) && (trust.getExplicit() > 0)) || ((trust.getImplicit() != null) && (trust.getImplicit() > 0)))) { return avatarId; } return null; diff --git a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java index ae1dcc3..4aaf232 100644 --- a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java +++ b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java @@ -24,7 +24,7 @@ import java.util.List; import net.pterodactylus.sone.core.Preferences; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.data.SoneOptions.ShowCustomAvatars; +import net.pterodactylus.sone.data.SoneOptions.LoadExternalContent; import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.template.Template; @@ -75,7 +75,7 @@ public class OptionsPage extends SoneTemplatePage { boolean showNotificationNewReplies = request.getHttpRequest().isPartSet("show-notification-new-replies"); currentSone.getOptions().setShowNewReplyNotifications(showNotificationNewReplies); String showCustomAvatars = request.getHttpRequest().getPartAsStringFailsafe("show-custom-avatars", 32); - currentSone.getOptions().setShowCustomAvatars(ShowCustomAvatars.valueOf(showCustomAvatars)); + currentSone.getOptions().setShowCustomAvatars(LoadExternalContent.valueOf(showCustomAvatars)); webInterface.getCore().touchConfiguration(); } Integer insertionDelay = parseInt(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16), null); -- 2.7.4