From 6ef49823ac934f4c729cae33cbdc82b1b2586e39 Mon Sep 17 00:00:00 2001 From: nuclearfog Date: Sat, 16 Mar 2024 21:39:07 +0100 Subject: [PATCH] bug fix, layout fix, added comments --- .../twidda/backend/api/mastodon/Mastodon.java | 4 +- .../twidda/backend/async/AccountAction.java | 28 ++++++++----- .../backend/async/AnnouncementAction.java | 36 +++++++++-------- .../backend/async/AnnouncementLoader.java | 4 ++ .../backend/async/CredentialsLoader.java | 4 ++ .../backend/async/CredentialsUpdater.java | 3 ++ .../twidda/backend/async/DatabaseAction.java | 20 ++++++---- .../twidda/backend/async/DomainAction.java | 40 +++++++++++-------- .../twidda/backend/async/DomainLoader.java | 10 ++++- .../backend/async/EditHistoryLoader.java | 3 ++ .../backend/async/FollowRequestAction.java | 23 +++++++---- .../twidda/backend/async/ImageDownloader.java | 11 ++++- .../twidda/backend/async/ReactionUpdater.java | 11 ++--- .../twidda/backend/async/TagLoader.java | 26 ++++-------- .../twidda/ui/activities/ProfileActivity.java | 6 +-- .../ui/activities/SettingsActivity.java | 2 +- .../adapter/recyclerview/ScheduleAdapter.java | 8 ---- .../twidda/ui/fragments/AccountFragment.java | 4 +- .../ui/fragments/AnnouncementFragment.java | 8 ++-- .../twidda/ui/fragments/DomainFragment.java | 12 +++--- .../ui/fragments/NotificationFragment.java | 4 +- app/src/main/res/layout/dialog_userlist.xml | 22 ++++++++-- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 24 files changed, 175 insertions(+), 116 deletions(-) diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java index 4261889be..33a441a02 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java @@ -882,7 +882,7 @@ public ScheduledStatuses getScheduledStatuses(long minId, long maxId) throws Con try { List params = new ArrayList<>(); if (minId != 0L) - params.add("since_id=" + minId); + params.add("min_id=" + minId); if (maxId != 0L) params.add("max_id=" + maxId); params.add("limit=" + settings.getListSize()); @@ -1399,7 +1399,7 @@ else if (pushUpdate.getPolicy() == WebPush.POLICY_NONE) public Notifications getNotifications(long minId, long maxId) throws ConnectionException { List params = new ArrayList<>(); if (minId != 0L) - params.add("since_id=" + minId); + params.add("min_id=" + minId); if (maxId != 0L) params.add("max_id=" + maxId); params.add("limit=" + settings.getListSize()); diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/AccountAction.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/AccountAction.java index 3403a655c..62cf97f46 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/AccountAction.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/AccountAction.java @@ -30,7 +30,7 @@ public AccountAction(Context context) { @Override protected Result doInBackground(@NonNull Param param) { - switch (param.mode) { + switch (param.action) { case Param.SELECT: database.resetDatabase(); WebPush webPush = database.getWebPush(param.account); @@ -60,10 +60,14 @@ public static class Param { public static final int REMOVE = 2; final Account account; - final int mode; - - public Param(int mode, Account account) { - this.mode = mode; + final int action; + + /** + * @param action action to apply on selected account {@link #SELECT,#REMOVE} + * @param account account with login information + */ + public Param(int action, Account account) { + this.action = action; this.account = account; } } @@ -74,13 +78,17 @@ public Param(int mode, Account account) { public static class Result { public static final int SELECT = 10; - public static final int REMOVE = 20; + public static final int REMOVE = 11; public final Account account; - public final int mode; - - Result(int mode, Account account) { - this.mode = mode; + public final int action; + + /** + * @param action action applied on selected account {@link #SELECT,#REMOVE} + * @param account account with login information + */ + Result(int action, Account account) { + this.action = action; this.account = account; } } diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/AnnouncementAction.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/AnnouncementAction.java index 2cb79ecec..d3edd58a6 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/AnnouncementAction.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/AnnouncementAction.java @@ -29,13 +29,12 @@ public AnnouncementAction(Context context) { @Override protected Result doInBackground(@NonNull Param param) { try { - switch (param.mode) { - case Param.MODE_DISMISS: - connection.dismissAnnouncement(param.id); - return new Result(Result.MODE_DISMISS, param.id, null); + if (param.action == Param.DISMISS) { + connection.dismissAnnouncement(param.id); + return new Result(Result.DISMISS, null); } } catch (ConnectionException exception) { - return new Result(Result.MODE_ERROR, param.id, exception); + return new Result(Result.ERROR, exception); } return null; } @@ -45,13 +44,17 @@ protected Result doInBackground(@NonNull Param param) { */ public static class Param { - public static final int MODE_DISMISS = 1; + public static final int DISMISS = 1; - final int mode; + final int action; final long id; - public Param(int mode, long id) { - this.mode = mode; + /** + * @param action action to apply on announcement {@link #DISMISS} + * @param id ID of the announcement + */ + public Param(int action, long id) { + this.action = action; this.id = id; } } @@ -61,17 +64,18 @@ public Param(int mode, long id) { */ public static class Result { - public static final int MODE_ERROR = -1; - public static final int MODE_DISMISS = 10; + public static final int ERROR = -1; + public static final int DISMISS = 10; - public final int mode; - public final long id; + public final int action; @Nullable public final ConnectionException exception; - public Result(int mode, long id, @Nullable ConnectionException exception) { - this.mode = mode; - this.id = id; + /** + * @param action action applied on announcement + */ + public Result(int action, @Nullable ConnectionException exception) { + this.action = action; this.exception = exception; } } diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/AnnouncementLoader.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/AnnouncementLoader.java index fd3aa0911..d820fe51d 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/AnnouncementLoader.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/AnnouncementLoader.java @@ -41,11 +41,15 @@ protected Result doInBackground(@NonNull Void param) { * */ public static class Result { + @Nullable public final Announcements announcements; @Nullable public final ConnectionException exception; + /** + * @param announcements a list of announcements of the instance server or null if an error occured + */ public Result(@Nullable Announcements announcements, @Nullable ConnectionException exception) { this.announcements = announcements; this.exception = exception; diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/CredentialsLoader.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/CredentialsLoader.java index 631905d8d..f545bf573 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/CredentialsLoader.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/CredentialsLoader.java @@ -57,6 +57,10 @@ public static class Result { @Nullable public final ConnectionException exception; + /** + * @param user current user's information or null if an error occured + * @param credentials current user's credentials or null if an error occured + */ public Result(@Nullable User user, @Nullable Credentials credentials, @Nullable ConnectionException exception) { this.exception = exception; this.credentials = credentials; diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/CredentialsUpdater.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/CredentialsUpdater.java index 54c273895..f66e6aa7e 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/CredentialsUpdater.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/CredentialsUpdater.java @@ -54,6 +54,9 @@ public static class Result { @Nullable public final ConnectionException exception; + /** + * @param user updated information from the current user or null if an error occured + */ Result(@Nullable User user, @Nullable ConnectionException exception) { this.user = user; this.exception = exception; diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/DatabaseAction.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/DatabaseAction.java index f8be793d6..0f74291f7 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/DatabaseAction.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/DatabaseAction.java @@ -29,7 +29,7 @@ public DatabaseAction(Context context) { @Override protected Result doInBackground(@NonNull Param param) { try { - switch (param.mode) { + switch (param.action) { case Param.DELETE: db.resetDatabase(); return new Result(Result.DELETE); @@ -54,10 +54,13 @@ public static class Param { public static final int DELETE = 1; public static final int LOGOUT = 2; - final int mode; + final int action; - public Param(int mode) { - this.mode = mode; + /** + * @param action action performed on the app database {@link #DELETE,#LOGOUT} + */ + public Param(int action) { + this.action = action; } } @@ -70,10 +73,13 @@ public static class Result { public static final int DELETE = 10; public static final int LOGOUT = 11; - public final int mode; + public final int action; - Result(int mode) { - this.mode = mode; + /** + * @param action action performed on the database {@link #DELETE,#LOGOUT} or {@link #ERROR} if an error occured + */ + Result(int action) { + this.action = action; } } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/DomainAction.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/DomainAction.java index d13a5e3d7..e5f2c6196 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/DomainAction.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/DomainAction.java @@ -29,14 +29,14 @@ public DomainAction(Context context) { @Override protected Result doInBackground(@NonNull Param param) { try { - switch (param.mode) { - case Param.MODE_BLOCK: + switch (param.action) { + case Param.BLOCK: connection.blockDomain(param.domain); - return new Result(Result.MODE_BLOCK, param.domain, null); + return new Result(Result.BLOCK, param.domain, null); - case Param.MODE_UNBLOCK: + case Param.UNBLOCK: connection.unblockDomain(param.domain); - return new Result(Result.MODE_UNBLOCK, param.domain, null); + return new Result(Result.UNBLOCK, param.domain, null); default: return null; @@ -51,14 +51,18 @@ protected Result doInBackground(@NonNull Param param) { */ public static class Param { - public static final int MODE_BLOCK = 2; - public static final int MODE_UNBLOCK = 3; + public static final int BLOCK = 2; + public static final int UNBLOCK = 3; final String domain; - final int mode; - - public Param(int mode, String domain) { - this.mode = mode; + final int action; + + /** + * @param action action performed on instance domain {@link #BLOCK,#UNBLOCK} + * @param domain instance domain name + */ + public Param(int action, String domain) { + this.action = action; this.domain = domain; } } @@ -69,19 +73,23 @@ public Param(int mode, String domain) { public static class Result { public static final int ERROR = -1; - public static final int MODE_BLOCK = 5; - public static final int MODE_UNBLOCK = 6; + public static final int BLOCK = 5; + public static final int UNBLOCK = 6; - public final int mode; + public final int action; @Nullable public final ConnectionException exception; @Nullable public final String domain; - Result(int mode, @Nullable String domain, @Nullable ConnectionException exception) { + /** + * @param action action performed on a domain instance {@link #BLOCK,#UNBLOCK} + * @param domain instance domain name + */ + Result(int action, @Nullable String domain, @Nullable ConnectionException exception) { this.domain = domain; this.exception = exception; - this.mode = mode; + this.action = action; } } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/DomainLoader.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/DomainLoader.java index a76a7b375..8a756e35d 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/DomainLoader.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/DomainLoader.java @@ -42,11 +42,13 @@ protected Result doInBackground(@NonNull Param param) { */ public static class Param { - public static final long NO_CURSOR = 0L; - final long cursor; final int index; + /** + * @param cursor list cursor or '0' to start at the beginning of the domain list + * @param index index where to insert new items in the list/adapter + */ public Param(long cursor, int index) { this.cursor = cursor; this.index = index; @@ -64,6 +66,10 @@ public static class Result { @Nullable public final ConnectionException exception; + /** + * @param domains list of domains or null if an error occured + * @param index index where to insert new items in the list/adapter + */ Result(@Nullable Domains domains, int index, @Nullable ConnectionException exception) { this.domains = domains; this.index = index; diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/EditHistoryLoader.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/EditHistoryLoader.java index aa437dc14..ed2a3c8f4 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/EditHistoryLoader.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/EditHistoryLoader.java @@ -47,6 +47,9 @@ public static class Result { @Nullable public final ConnectionException exception; + /** + * @param history a list of previous versions of a status or null if an error occured + */ Result(@Nullable StatusEditHistory history, @Nullable ConnectionException exception) { this.history = history; this.exception = exception; diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/FollowRequestAction.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/FollowRequestAction.java index e40be2345..df61719bb 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/FollowRequestAction.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/FollowRequestAction.java @@ -30,7 +30,7 @@ public FollowRequestAction(Context context) { @Override protected Result doInBackground(@NonNull Param param) { try { - switch (param.mode) { + switch (param.action) { case Param.ACCEPT: connection.acceptFollowRequest(param.user_id); return new Result(Result.ACCEPT, param.notification_id, null); @@ -53,12 +53,17 @@ public static class Param { public static final int ACCEPT = 1; public static final int REJECT = 2; - final int mode; + final int action; final long user_id; final long notification_id; - public Param(int mode, long user_id, long notification_id) { - this.mode = mode; + /** + * @param action actzion to perform on a follow request + * @param user_id if of the user requesting to follow + * @param notification_id notification ID containing the follow request + */ + public Param(int action, long user_id, long notification_id) { + this.action = action; this.user_id = user_id; this.notification_id = notification_id; } @@ -73,14 +78,18 @@ public static class Result { public static final int ACCEPT = 10; public static final int REJECT = 20; - public final int mode; + public final int action; public final long notification_id; @Nullable public final ConnectionException exception; - Result(int mode, long notification_id, @Nullable ConnectionException exception) { + /** + * @param action action performed on the follow request {@link #ACCEPT,#REJECT} or {@link #ERROR} if an error occured + * @param notification_id notification ID containing the follow request + */ + Result(int action, long notification_id, @Nullable ConnectionException exception) { this.exception = exception; - this.mode = mode; + this.action = action; this.notification_id = notification_id; } } diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/ImageDownloader.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/ImageDownloader.java index 3d1f8d0e8..ff4118dba 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/ImageDownloader.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/ImageDownloader.java @@ -74,13 +74,17 @@ protected Result doInBackground(@NonNull Param request) { } /** - * Async request class to send information required to execute the task + * */ public static class Param { final Uri uri; final File cacheFolder; + /** + * @param uri online url of the image + * @param cacheFolder local folder to cache the image + */ public Param(Uri uri, File cacheFolder) { this.cacheFolder = cacheFolder; this.uri = uri; @@ -88,7 +92,7 @@ public Param(Uri uri, File cacheFolder) { } /** - * Async result class + * */ public static class Result { @@ -97,6 +101,9 @@ public static class Result { @Nullable public final ConnectionException exception; + /** + * @param uri local path of the cached image or null if an error occured + */ Result(@Nullable Uri uri, @Nullable ConnectionException exception) { this.exception = exception; this.uri = uri; diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/ReactionUpdater.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/ReactionUpdater.java index 1d882047e..3504e60c2 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/ReactionUpdater.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/ReactionUpdater.java @@ -32,14 +32,14 @@ protected Result doInBackground(@NonNull Param param) { switch (param.action) { case Param.ADD: connection.addReaction(param.id, param.code); - return new Result(Result.ADD, param.id, null); + return new Result(Result.ADD, null); case Param.REMOVE: connection.removeReaction(param.id, param.code); - return new Result(Result.REMOVE, param.id, null); + return new Result(Result.REMOVE, null); } } catch (ConnectionException exception) { - return new Result(Result.ERROR, param.id, exception); + return new Result(Result.ERROR, exception); } return null; } @@ -78,17 +78,14 @@ public static class Result { public static final int REMOVE = 11; public final int action; - public final long id; @Nullable public final ConnectionException exception; /** * @param action action performed on an announcement - * @param id ID of the announcement */ - Result(int action, long id, @Nullable ConnectionException exception) { + Result(int action, @Nullable ConnectionException exception) { this.action = action; - this.id = id; this.exception = exception; } } diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/TagLoader.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/TagLoader.java index 60f0e82fd..aa6165b77 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/TagLoader.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/TagLoader.java @@ -39,36 +39,36 @@ protected Result doInBackground(@NonNull Param param) { case Param.POPULAR_OFFLINE: Tags tags = db.getTrends(); if (!tags.isEmpty()) { - return new Result(Result.POPULAR, tags, param.index, null); + return new Result(tags, param.index, null); } // fall through case Param.POPULAR_ONLINE: tags = connection.getTags(); db.saveTrends(tags); - return new Result(Result.POPULAR, tags, param.index, null); + return new Result(tags, param.index, null); case Param.SEARCH: tags = connection.searchTags(param.trend); - return new Result(Result.SEARCH, tags, param.index, null); + return new Result(tags, param.index, null); case Param.FOLLOWING: tags = connection.showTagFollowing(param.cursor); - return new Result(Result.FOLLOWING, tags, param.index, null); + return new Result(tags, param.index, null); case Param.FEATURING: tags = connection.showTagFeaturing(); - return new Result(Result.FEATURING, tags, param.index, null); + return new Result(tags, param.index, null); case Param.SUGGESTIONS: tags = connection.showTagSuggestions(); - return new Result(Result.SUGGESTIONS, tags, param.index, null); + return new Result(tags, param.index, null); default: return null; } } catch (ConnectionException exception) { - return new Result(Result.ERROR, null, param.index, exception); + return new Result(null, param.index, exception); } } @@ -110,14 +110,6 @@ public Param(int type, int index, String trend, long cursor) { */ public static class Result { - public static final int ERROR = -1; - public static final int POPULAR = 20; - public static final int SEARCH = 21; - public static final int FOLLOWING = 22; - public static final int FEATURING = 23; - public static final int SUGGESTIONS = 24; - - public final int type; public final int index; @Nullable public final Tags tags; @@ -125,16 +117,14 @@ public static class Result { public final ConnectionException exception; /** - * @param type type of trend/tag list {@link #POPULAR,#SEARCH,#FOLLOWING,#FEATURING,#SUGGESTIONS} * @param tags tag/trend items * @param index index where to isnert the new items in the list/adapter * @param exception not null if an error occured */ - Result(int type, @Nullable Tags tags, int index, @Nullable ConnectionException exception) { + Result(@Nullable Tags tags, int index, @Nullable ConnectionException exception) { this.tags = tags; this.exception = exception; this.index = index; - this.type = type; } } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/activities/ProfileActivity.java b/app/src/main/java/org/nuclearfog/twidda/ui/activities/ProfileActivity.java index 4ea8e8a7c..3767d1245 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/activities/ProfileActivity.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/activities/ProfileActivity.java @@ -525,7 +525,7 @@ else if (type == ConfirmDialog.PROFILE_MUTE) { // confirmed domain block else if (type == ConfirmDialog.DOMAIN_BLOCK_ADD) { String url = Uri.parse(user.getProfileUrl()).getHost(); - DomainAction.Param param = new DomainAction.Param(DomainAction.Param.MODE_BLOCK, url); + DomainAction.Param param = new DomainAction.Param(DomainAction.Param.BLOCK, url); domainAction.execute(param, domainCallback); } } @@ -631,9 +631,9 @@ private void setRelationResult(@NonNull UserAction.Result result) { * set domain block result */ private void setDomainResult(DomainAction.Result result) { - if (result.mode == DomainAction.Result.MODE_BLOCK) { + if (result.action == DomainAction.Result.BLOCK) { Toast.makeText(getApplicationContext(), R.string.info_domain_blocked, Toast.LENGTH_SHORT).show(); - } else if (result.mode == DomainAction.Result.ERROR) { + } else if (result.action == DomainAction.Result.ERROR) { ErrorUtils.showErrorMessage(this, result.exception); } } diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/activities/SettingsActivity.java b/app/src/main/java/org/nuclearfog/twidda/ui/activities/SettingsActivity.java index 0678a049d..d7bb392e9 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/activities/SettingsActivity.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/activities/SettingsActivity.java @@ -576,7 +576,7 @@ public void onStopTrackingTouch(SeekBar seekBar) { * called from {@link DatabaseAction} */ private void onDatabaseResult(@NonNull DatabaseAction.Result result) { - switch (result.mode) { + switch (result.action) { case DatabaseAction.Result.DELETE: Toast.makeText(getApplicationContext(), R.string.info_database_cleared, Toast.LENGTH_SHORT).show(); break; diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/ScheduleAdapter.java b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/ScheduleAdapter.java index 8e242460f..90372d49d 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/ScheduleAdapter.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/ScheduleAdapter.java @@ -236,14 +236,6 @@ public void updateItem(@NonNull ScheduledStatus item) { } } - /** - * - */ - public void clear() { - items.clear(); - notifyDataSetChanged(); - } - /** * @return true if adapter doesn't contain any items */ diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AccountFragment.java b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AccountFragment.java index d7ac929c0..ab5e307d6 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AccountFragment.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AccountFragment.java @@ -156,9 +156,9 @@ private void onLoaderResult(AccountLoader.Result result) { * */ private void onActionResult(AccountAction.Result result) { - if (result.mode == AccountAction.Result.REMOVE) { + if (result.action == AccountAction.Result.REMOVE) { adapter.removeItem(result.account); - } else if (result.mode == AccountAction.Result.SELECT) { + } else if (result.action == AccountAction.Result.SELECT) { Context context = getContext(); if (context != null) { if (settings.pushEnabled()) { diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AnnouncementFragment.java b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AnnouncementFragment.java index 1892284de..01267d35b 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AnnouncementFragment.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AnnouncementFragment.java @@ -109,7 +109,7 @@ protected void onReset() { @Override public void onConfirm(int type) { if (type == ConfirmDialog.ANNOUNCEMENT_DISMISS) { - AnnouncementAction.Param param = new AnnouncementAction.Param(AnnouncementAction.Param.MODE_DISMISS, selectedId); + AnnouncementAction.Param param = new AnnouncementAction.Param(AnnouncementAction.Param.DISMISS, selectedId); announcementAction.execute(param, announcementResult); } } @@ -156,14 +156,14 @@ private void onAnnouncementLoaded(AnnouncementLoader.Result result) { */ private void onAnnouncementResult(AnnouncementAction.Result result) { Context context = getContext(); - switch (result.mode) { - case AnnouncementAction.Result.MODE_DISMISS: + switch (result.action) { + case AnnouncementAction.Result.DISMISS: if (context != null) Toast.makeText(context, R.string.info_announcement_dismissed, Toast.LENGTH_SHORT).show(); adapter.removeItem(selectedId); break; - case AnnouncementAction.Result.MODE_ERROR: + case AnnouncementAction.Result.ERROR: if (context != null) ErrorUtils.showErrorMessage(context, result.exception); break; diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/DomainFragment.java b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/DomainFragment.java index 913f72528..e9cd45fab 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/DomainFragment.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/DomainFragment.java @@ -66,7 +66,7 @@ public void onSaveInstanceState(@NonNull Bundle outState) { public void onStart() { super.onStart(); if (adapter.isEmpty()) { - load(DomainAdapter.NO_INDEX, DomainLoader.Param.NO_CURSOR); + load(DomainAdapter.NO_INDEX, 0L); setRefresh(true); } } @@ -82,7 +82,7 @@ public void onDestroy() { @Override protected void onReload() { - load(DomainAdapter.NO_INDEX, DomainLoader.Param.NO_CURSOR); + load(DomainAdapter.NO_INDEX, 0L); } @@ -91,7 +91,7 @@ protected void onReset() { adapter.clear(); domainLoader = new DomainLoader(requireContext()); domainAction = new DomainAction(requireContext()); - load(DomainAdapter.NO_INDEX, DomainLoader.Param.NO_CURSOR); + load(DomainAdapter.NO_INDEX, 0L); setRefresh(true); } @@ -119,7 +119,7 @@ public boolean onPlaceholderClick(int index, long cursor) { @Override public void onConfirm(int type) { if (type == ConfirmDialog.DOMAIN_BLOCK_REMOVE) { - DomainAction.Param param = new DomainAction.Param(DomainAction.Param.MODE_UNBLOCK, selectedDomain); + DomainAction.Param param = new DomainAction.Param(DomainAction.Param.UNBLOCK, selectedDomain); domainAction.execute(param, domainResult); } } @@ -154,13 +154,13 @@ private void onDomainLoaded(DomainLoader.Result result) { * */ private void onDomainResult(DomainAction.Result result) { - if (result.mode == DomainAction.Result.MODE_UNBLOCK) { + if (result.action == DomainAction.Result.UNBLOCK) { Context context = getContext(); if (result.domain != null && context != null) { adapter.removeItem(result.domain); Toast.makeText(context, R.string.info_domain_removed, Toast.LENGTH_SHORT).show(); } - } else if (result.mode == DomainAction.Result.ERROR) { + } else if (result.action == DomainAction.Result.ERROR) { adapter.disableLoading(); Context context = getContext(); if (context != null) { diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/NotificationFragment.java b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/NotificationFragment.java index 6c3cc537b..03a2c80fb 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/NotificationFragment.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/NotificationFragment.java @@ -229,10 +229,10 @@ private void onNotificationResult(@NonNull NotificationLoader.Result result) { private void onFollowRequestResult(FollowRequestAction.Result result) { Context context = getContext(); if (context != null) { - if (result.mode == FollowRequestAction.Result.ACCEPT) { + if (result.action == FollowRequestAction.Result.ACCEPT) { Toast.makeText(context, R.string.info_follow_request_accepted, Toast.LENGTH_SHORT).show(); adapter.removeItem(result.notification_id); - } else if (result.mode == FollowRequestAction.Result.ERROR) { + } else if (result.action == FollowRequestAction.Result.ERROR) { ErrorUtils.showErrorMessage(context, result.exception); } } diff --git a/app/src/main/res/layout/dialog_userlist.xml b/app/src/main/res/layout/dialog_userlist.xml index 3bcf3ae76..d82a98f2f 100644 --- a/app/src/main/res/layout/dialog_userlist.xml +++ b/app/src/main/res/layout/dialog_userlist.xml @@ -17,6 +17,7 @@ android:id="@+id/dialog_userlist_title_input" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="@android:color/transparent" android:layout_margin="@dimen/userlist_layout_margin" android:inputType="text" android:maxLines="2" @@ -24,11 +25,26 @@ android:hint="@string/userlist_enter_title" android:textSize="@dimen/userlist_textsize_input" /> - + android:gravity="center_vertical"> + + + + + + + geplanten Post von der Liste entfernen entferne Hashtag-Feature geplanten Post verwerfen? + Reply-Sichtbarkeit Mitglieder aus der Home-Timeline filtern Nutzerliste bearbeiten Follow-Anfrage annehmen? diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5ffe4d73e..418d2221d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -303,6 +303,7 @@ Tap to view 4 steps to login enter list title + reply policy: exclude members from home feed create list update