diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/SetPrivateNote.java b/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/SetPrivateNote.java index 6b928b5e4..ab8b3c52b 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/SetPrivateNote.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/SetPrivateNote.java @@ -4,17 +4,17 @@ import org.joinmastodon.android.api.MastodonAPIRequest; import org.joinmastodon.android.model.PrivateNote; public class SetPrivateNote extends MastodonAPIRequest{ - public SetPrivateNote(String id, String note){ + public SetPrivateNote(String id, String comment){ super(MastodonAPIRequest.HttpMethod.POST, "/accounts/"+id+"/note", PrivateNote.class); - Request req = new Request(note); + Request req = new Request(comment); setRequestBody(req); } - public static class Request{ + private static class Request{ public String comment; - public Request(String note){ - this.comment = note; + public Request(String comment){ + this.comment=comment; } } } 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 38f46d3df..cbe31f242 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -1,16 +1,11 @@ package org.joinmastodon.android.fragments; -import static android.content.Context.CLIPBOARD_SERVICE; - import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.Activity; import android.app.Fragment; -import android.content.ClipData; -import android.content.ClipboardManager; -import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Outline; @@ -19,8 +14,6 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.os.VibrationEffect; -import android.os.Vibrator; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.style.ImageSpan; @@ -39,7 +32,6 @@ import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; @@ -185,9 +177,28 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList username=content.findViewById(R.id.username); bio=content.findViewById(R.id.bio); noteEdit=content.findViewById(R.id.note_edit); - noteEditConfirm=content.findViewById(R.id.note_edit_confirm); - noteEditConfirm.setOnClickListener(v->onClickNoteSave()); - noteEditWrapper=content.findViewById(R.id.note_edit_wrapper); + 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.setOnClickListener(v->onClickNoteSave()); + noteEditWrapper=content.findViewById(R.id.note_edit_wrap); followersCount=content.findViewById(R.id.followers_count); followersLabel=content.findViewById(R.id.followers_label); followersBtn=content.findViewById(R.id.followers_btn); @@ -307,16 +318,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList return sizeWrapper; } - private void onClickNoteSave() { - Toast.makeText(getActivity(), "Its going here", Toast.LENGTH_LONG).show(); - currentRequest = new SetPrivateNote(account.id, noteEdit.getText().toString()).setCallback(new SimpleCallback(this) { - @Override - public void onSuccess(PrivateNote result) { - Toast.makeText(getActivity(), "Success", Toast.LENGTH_LONG).show(); - } - }); - } - @Override protected void doLoadData(){ currentRequest=new GetAccountByID(profileAccountID) @@ -493,15 +494,15 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList noteEditWrapper.setVisibility(View.GONE); } - 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); - } +// 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)); diff --git a/mastodon/src/main/res/drawable/ic_fluent_notepad_20_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_notepad_20_regular.xml new file mode 100644 index 000000000..67619d7cf --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_notepad_20_regular.xml @@ -0,0 +1,9 @@ + + + diff --git a/mastodon/src/main/res/layout/fragment_profile.xml b/mastodon/src/main/res/layout/fragment_profile.xml index 5a5521c3f..52d40060b 100644 --- a/mastodon/src/main/res/layout/fragment_profile.xml +++ b/mastodon/src/main/res/layout/fragment_profile.xml @@ -259,7 +259,7 @@ @@ -274,39 +274,23 @@ android:layout_marginHorizontal="16dp" android:inputType="textMultiLine|textCapSentences" android:singleLine="false" - android:drawableStart="@drawable/ic_fluent_globe_20_regular" + android:drawableStart="@drawable/ic_fluent_notepad_20_regular" android:drawablePadding="12dp" android:drawableTint="?android:textColorSecondary" android:background="@drawable/bg_search_field" android:paddingHorizontal="16dp" android:elevation="0dp" - android:hint="@string/sk_example_domain"/> + android:hint="@string/sk_personal_note"/> - - - - - - - - - - - - - - - - - + + + + + + + + + @@ -314,7 +298,7 @@ android:id="@+id/bio" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_below="@id/note_edit_wrapper" + android:layout_below="@id/note_edit_wrap" android:layout_marginLeft="16dp" android:layout_marginTop="4dp" android:layout_marginRight="16dp"