feat(profile/note): add toast on save failure

This commit is contained in:
FineFindus
2023-01-13 23:41:57 +01:00
parent 2c1b8da475
commit 5a8fed3c06
2 changed files with 7 additions and 13 deletions

View File

@@ -470,7 +470,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
username.setText('@'+account.acct+(isSelf ? ('@'+AccountSessionManager.getInstance().getAccount(accountID).domain) : "")); username.setText('@'+account.acct+(isSelf ? ('@'+AccountSessionManager.getInstance().getAccount(accountID).domain) : ""));
} }
CharSequence parsedBio=HtmlParser.parse(account.note, account.emojis, Collections.emptyList(), Collections.emptyList(), accountID); CharSequence parsedBio=HtmlParser.parse(account.note, account.emojis, Collections.emptyList(), Collections.emptyList(), accountID);
// bio.setOnClickListener(v->savePrivateNote());
if(TextUtils.isEmpty(parsedBio)){ if(TextUtils.isEmpty(parsedBio)){
bio.setVisibility(View.GONE); bio.setVisibility(View.GONE);
}else{ }else{
@@ -495,16 +494,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
noteEdit.clearFocus(); 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)); followersCount.setText(UiUtils.abbreviateNumber(account.followersCount));
followingCount.setText(UiUtils.abbreviateNumber(account.followingCount)); followingCount.setText(UiUtils.abbreviateNumber(account.followingCount));
postsCount.setText(UiUtils.abbreviateNumber(account.statusesCount)); postsCount.setText(UiUtils.abbreviateNumber(account.statusesCount));
@@ -1008,10 +997,14 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
} }
private void savePrivateNote(){ 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 @Override
public void onSuccess(Relationship result) { 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); }).exec(accountID);
} }

View File

@@ -69,6 +69,7 @@
<string name="sk_settings_profile">Set up profile</string> <string name="sk_settings_profile">Set up profile</string>
<string name="sk_personal_note">Add a note for this profile</string> <string name="sk_personal_note">Add a note for this profile</string>
<string name="sk_personal_note_confirm">Confirm edited note</string> <string name="sk_personal_note_confirm">Confirm edited note</string>
<string name="sk_personal_note_update_failed">Failed to save note</string>
<string name="sk_settings_posting">Posting preferences</string> <string name="sk_settings_posting">Posting preferences</string>
<string name="sk_settings_filters">Configure filters</string> <string name="sk_settings_filters">Configure filters</string>
<string name="sk_settings_auth">Security settings</string> <string name="sk_settings_auth">Security settings</string>