I am trying my best
This commit is contained in:
parent
029650ef2d
commit
cd342d1034
|
@ -1,18 +1,17 @@
|
||||||
package org.joinmastodon.android.api.requests.accounts;
|
package org.joinmastodon.android.api.requests.accounts;
|
||||||
|
|
||||||
import org.joinmastodon.android.api.MastodonAPIRequest;
|
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||||
import org.joinmastodon.android.model.PrivateNote;
|
import org.joinmastodon.android.model.Relationship;
|
||||||
|
|
||||||
public class SetPrivateNote extends MastodonAPIRequest<PrivateNote>{
|
public class SetPrivateNote extends MastodonAPIRequest<Relationship>{
|
||||||
public SetPrivateNote(String id, String comment){
|
public SetPrivateNote(String id, String comment){
|
||||||
super(MastodonAPIRequest.HttpMethod.POST, "/accounts/"+id+"/note", PrivateNote.class);
|
super(MastodonAPIRequest.HttpMethod.POST, "/accounts/"+id+"/note", Relationship.class);
|
||||||
Request req = new Request(comment);
|
Request req = new Request(comment);
|
||||||
setRequestBody(req);
|
setRequestBody(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Request{
|
private static class Request{
|
||||||
public String comment;
|
public String comment;
|
||||||
|
|
||||||
public Request(String comment){
|
public Request(String comment){
|
||||||
this.comment=comment;
|
this.comment=comment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,6 @@ import org.joinmastodon.android.fragments.report.ReportReasonChoiceFragment;
|
||||||
import org.joinmastodon.android.model.Account;
|
import org.joinmastodon.android.model.Account;
|
||||||
import org.joinmastodon.android.model.AccountField;
|
import org.joinmastodon.android.model.AccountField;
|
||||||
import org.joinmastodon.android.model.Attachment;
|
import org.joinmastodon.android.model.Attachment;
|
||||||
import org.joinmastodon.android.model.PrivateNote;
|
|
||||||
import org.joinmastodon.android.model.Relationship;
|
import org.joinmastodon.android.model.Relationship;
|
||||||
import org.joinmastodon.android.ui.SimpleViewHolder;
|
import org.joinmastodon.android.ui.SimpleViewHolder;
|
||||||
import org.joinmastodon.android.ui.SingleImagePhotoViewerListener;
|
import org.joinmastodon.android.ui.SingleImagePhotoViewerListener;
|
||||||
|
@ -177,25 +176,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
username=content.findViewById(R.id.username);
|
username=content.findViewById(R.id.username);
|
||||||
bio=content.findViewById(R.id.bio);
|
bio=content.findViewById(R.id.bio);
|
||||||
noteEdit=content.findViewById(R.id.note_edit);
|
noteEdit=content.findViewById(R.id.note_edit);
|
||||||
noteEdit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onFocusChange(View v, boolean hasFocus) {
|
|
||||||
if(!hasFocus){
|
|
||||||
Toast.makeText(getActivity(), "Its going here", Toast.LENGTH_LONG).show();
|
|
||||||
currentRequest = new SetPrivateNote(account.id, noteEdit.getText().toString()).setCallback(new Callback<>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(PrivateNote result) {
|
|
||||||
Toast.makeText(getActivity(), "Success", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(ErrorResponse error) {
|
|
||||||
Toast.makeText(getActivity(), "Error, not success", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// noteEditConfirm=content.findViewById(R.id.note_edit_confirm);
|
// noteEditConfirm=content.findViewById(R.id.note_edit_confirm);
|
||||||
// noteEditConfirm.setOnClickListener(v->onClickNoteSave());
|
// noteEditConfirm.setOnClickListener(v->onClickNoteSave());
|
||||||
noteEditWrapper=content.findViewById(R.id.note_edit_wrap);
|
noteEditWrapper=content.findViewById(R.id.note_edit_wrap);
|
||||||
|
@ -465,6 +445,13 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
|
|
||||||
boolean isSelf=AccountSessionManager.getInstance().isSelf(accountID, account);
|
boolean isSelf=AccountSessionManager.getInstance().isSelf(accountID, account);
|
||||||
|
|
||||||
|
noteEdit.setOnFocusChangeListener((v, hasFocus) -> {
|
||||||
|
if(!hasFocus){
|
||||||
|
// Toast.makeText(getActivity(), "Its going here", Toast.LENGTH_LONG).show();
|
||||||
|
savePrivateNote();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if(account.locked){
|
if(account.locked){
|
||||||
ssb=new SpannableStringBuilder("@");
|
ssb=new SpannableStringBuilder("@");
|
||||||
ssb.append(account.acct);
|
ssb.append(account.acct);
|
||||||
|
@ -1006,6 +993,17 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
scrollView.smoothScrollTo(0, 0);
|
scrollView.smoothScrollTo(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void savePrivateNote(){
|
||||||
|
new SetPrivateNote(profileAccountID, noteEdit.getText().toString()).setCallback(new SimpleCallback<>(this) {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Relationship result) {
|
||||||
|
relationship=result;
|
||||||
|
updateRelationship();
|
||||||
|
Toast.makeText(getActivity(), "Success", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void onFollowersOrFollowingClick(View v){
|
private void onFollowersOrFollowingClick(View v){
|
||||||
Bundle args=new Bundle();
|
Bundle args=new Bundle();
|
||||||
args.putString("account", accountID);
|
args.putString("account", accountID);
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
package org.joinmastodon.android.model;
|
|
||||||
|
|
||||||
public class PrivateNote extends BaseModel{
|
|
||||||
public String id;
|
|
||||||
public String note;
|
|
||||||
}
|
|
Loading…
Reference in New Issue