From 5a8fed3c064e99c0f03323d755986e44559e930b Mon Sep 17 00:00:00 2001
From: FineFindus <63370021+FineFindus@users.noreply.github.com>
Date: Fri, 13 Jan 2023 23:41:57 +0100
Subject: [PATCH] feat(profile/note): add toast on save failure
---
.../android/fragments/ProfileFragment.java | 19 ++++++-------------
mastodon/src/main/res/values/strings_sk.xml | 1 +
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java
index 80aecc796..75485a655 100644
--- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java
+++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java
@@ -470,7 +470,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
username.setText('@'+account.acct+(isSelf ? ('@'+AccountSessionManager.getInstance().getAccount(accountID).domain) : ""));
}
CharSequence parsedBio=HtmlParser.parse(account.note, account.emojis, Collections.emptyList(), Collections.emptyList(), accountID);
-// bio.setOnClickListener(v->savePrivateNote());
if(TextUtils.isEmpty(parsedBio)){
bio.setVisibility(View.GONE);
}else{
@@ -495,16 +494,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
noteEdit.clearFocus();
}));
-// if(noteEdit.getText().toString() == null){
-// noteEditConfirm.setImageResource(R.drawable.ic_fluent_checkmark_24_regular);
-// noteEditConfirm.setClickable(false);
-// noteEditConfirm.setAlpha(.50f);
-// }else{
-// noteEditConfirm.setImageResource(R.drawable.ic_fluent_checkmark_24_filled);
-// noteEditConfirm.setClickable(true);
-// noteEditConfirm.setAlpha(1.0f);
-// }
-
followersCount.setText(UiUtils.abbreviateNumber(account.followersCount));
followingCount.setText(UiUtils.abbreviateNumber(account.followingCount));
postsCount.setText(UiUtils.abbreviateNumber(account.statusesCount));
@@ -1008,10 +997,14 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
}
private void savePrivateNote(){
- currentRequest = new SetPrivateNote(profileAccountID, noteEdit.getText().toString()).setCallback(new SimpleCallback<>(this) {
+ currentRequest = new SetPrivateNote(profileAccountID, noteEdit.getText().toString()).setCallback(new Callback<>() {
@Override
public void onSuccess(Relationship result) {
- Toast.makeText(getActivity(), "Successfully updated note", Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void onError(ErrorResponse result) {
+ Toast.makeText(getActivity(), getString(R.string.sk_personal_note_update_failed), Toast.LENGTH_LONG).show();
}
}).exec(accountID);
}
diff --git a/mastodon/src/main/res/values/strings_sk.xml b/mastodon/src/main/res/values/strings_sk.xml
index 96c816a84..d118f320f 100644
--- a/mastodon/src/main/res/values/strings_sk.xml
+++ b/mastodon/src/main/res/values/strings_sk.xml
@@ -69,6 +69,7 @@
Set up profile
Add a note for this profile
Confirm edited note
+ Failed to save note
Posting preferences
Configure filters
Security settings