Compare commits
14 Commits
feature/pu
...
feature/pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26297fbb5b | ||
|
|
cd342d1034 | ||
|
|
029650ef2d | ||
|
|
ac24f636df | ||
|
|
1688168bc1 | ||
|
|
46b842afc4 | ||
|
|
3f773a52cc | ||
|
|
48664bb580 | ||
|
|
094cd67728 | ||
|
|
9d800106cc | ||
|
|
68bb23e3b4 | ||
|
|
68397bd487 | ||
|
|
3104ddb4b6 | ||
|
|
9bddd6b274 |
@@ -0,0 +1,19 @@
|
||||
package org.joinmastodon.android.api.requests.accounts;
|
||||
|
||||
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||
import org.joinmastodon.android.model.Relationship;
|
||||
|
||||
public class SetPrivateNote extends MastodonAPIRequest<Relationship>{
|
||||
public SetPrivateNote(String id, String comment){
|
||||
super(MastodonAPIRequest.HttpMethod.POST, "/accounts/"+id+"/note", Relationship.class);
|
||||
Request req = new Request(comment);
|
||||
setRequestBody(req);
|
||||
}
|
||||
|
||||
private static class Request{
|
||||
public String comment;
|
||||
public Request(String comment){
|
||||
this.comment=comment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -37,8 +30,8 @@ import android.view.WindowInsets;
|
||||
import android.widget.Button;
|
||||
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;
|
||||
@@ -52,6 +45,7 @@ import org.joinmastodon.android.api.requests.accounts.GetAccountRelationships;
|
||||
import org.joinmastodon.android.api.requests.accounts.GetAccountStatuses;
|
||||
import org.joinmastodon.android.api.requests.accounts.GetOwnAccount;
|
||||
import org.joinmastodon.android.api.requests.accounts.SetAccountFollowed;
|
||||
import org.joinmastodon.android.api.requests.accounts.SetPrivateNote;
|
||||
import org.joinmastodon.android.api.requests.accounts.UpdateAccountCredentials;
|
||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||
import org.joinmastodon.android.fragments.account_list.FollowerListFragment;
|
||||
@@ -116,8 +110,9 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||
private SwipeRefreshLayout refreshLayout;
|
||||
private CoverOverlayGradientDrawable coverGradient=new CoverOverlayGradientDrawable();
|
||||
private float titleTransY;
|
||||
private View postsBtn, followersBtn, followingBtn;
|
||||
private EditText nameEdit, bioEdit;
|
||||
private View postsBtn, followersBtn, followingBtn, noteEditWrapper;
|
||||
private EditText nameEdit, bioEdit, noteEdit;
|
||||
private ImageButton noteEditConfirm;
|
||||
private ProgressBar actionProgress, notifyProgress;
|
||||
private FrameLayout[] tabViews;
|
||||
private TabLayoutMediator tabLayoutMediator;
|
||||
@@ -180,6 +175,10 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||
name=content.findViewById(R.id.name);
|
||||
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_wrap);
|
||||
followersCount=content.findViewById(R.id.followers_count);
|
||||
followersLabel=content.findViewById(R.id.followers_label);
|
||||
followersBtn=content.findViewById(R.id.followers_btn);
|
||||
@@ -446,6 +445,15 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||
|
||||
boolean isSelf=AccountSessionManager.getInstance().isSelf(accountID, account);
|
||||
|
||||
// noteEdit.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
// if(!hasFocus){
|
||||
//// Toast.makeText(getActivity(), "Its going here", Toast.LENGTH_LONG).show();
|
||||
// savePrivateNote();
|
||||
//// noteEdit.setOnFocusChangeListener(savePrivateNote());
|
||||
// }
|
||||
// });
|
||||
noteEdit.setOnClickListener(v->savePrivateNote());
|
||||
|
||||
if(account.locked){
|
||||
ssb=new SpannableStringBuilder("@");
|
||||
ssb.append(account.acct);
|
||||
@@ -464,12 +472,28 @@ 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{
|
||||
bio.setVisibility(View.VISIBLE);
|
||||
bio.setText(parsedBio);
|
||||
}
|
||||
|
||||
if(isOwnProfile){
|
||||
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);
|
||||
// }
|
||||
|
||||
followersCount.setText(UiUtils.abbreviateNumber(account.followersCount));
|
||||
followingCount.setText(UiUtils.abbreviateNumber(account.followingCount));
|
||||
postsCount.setText(UiUtils.abbreviateNumber(account.statusesCount));
|
||||
@@ -666,6 +690,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||
notifyProgress.setIndeterminateTintList(notifyButton.getTextColors());
|
||||
followsYouView.setVisibility(relationship.followedBy ? View.VISIBLE : View.GONE);
|
||||
notifyButton.setSelected(relationship.notifying);
|
||||
noteEdit.setText(relationship.note);
|
||||
if (getActivity() != null) notifyButton.setContentDescription(getString(relationship.notifying ? R.string.sk_user_post_notifications_on : R.string.sk_user_post_notifications_off, '@'+account.username));
|
||||
}
|
||||
|
||||
@@ -971,6 +996,17 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||
scrollView.smoothScrollTo(0, 0);
|
||||
}
|
||||
|
||||
private void savePrivateNote(){
|
||||
currentRequest = 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){
|
||||
Bundle args=new Bundle();
|
||||
args.putString("account", accountID);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M7.5,7C7.224,7 7,7.224 7,7.5C7,7.776 7.224,8 7.5,8H12.5C12.776,8 13,7.776 13,7.5C13,7.224 12.776,7 12.5,7H7.5ZM7,10.5C7,10.224 7.224,10 7.5,10H12.5C12.776,10 13,10.224 13,10.5C13,10.776 12.776,11 12.5,11H7.5C7.224,11 7,10.776 7,10.5ZM7.5,13C7.224,13 7,13.224 7,13.5C7,13.776 7.224,14 7.5,14H9.5C9.776,14 10,13.776 10,13.5C10,13.224 9.776,13 9.5,13H7.5ZM6.5,2C6.224,2 6,2.224 6,2.5V3H5.5C4.672,3 4,3.672 4,4.5V16.5C4,17.328 4.672,18 5.5,18H11.5C11.633,18 11.76,17.947 11.854,17.854L15.854,13.854C15.947,13.76 16,13.633 16,13.5V4.5C16,3.672 15.328,3 14.5,3H14V2.5C14,2.224 13.776,2 13.5,2C13.224,2 13,2.224 13,2.5V3H10.5V2.5C10.5,2.224 10.276,2 10,2C9.724,2 9.5,2.224 9.5,2.5V3H7V2.5C7,2.224 6.776,2 6.5,2ZM14.5,4C14.776,4 15,4.224 15,4.5V13H12.5C11.672,13 11,13.672 11,14.5V17H5.5C5.224,17 5,16.776 5,16.5V4.5C5,4.224 5.224,4 5.5,4H14.5ZM14.293,14L12,16.293V14.5C12,14.224 12.224,14 12.5,14H14.293Z"
|
||||
android:fillColor="#212121"/>
|
||||
</vector>
|
||||
@@ -256,11 +256,49 @@
|
||||
android:textColor="?android:textColorSecondary"
|
||||
tools:text="\@Gargron" />
|
||||
|
||||
<org.joinmastodon.android.ui.views.LinkedTextView
|
||||
<FrameLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/note_edit_wrap"
|
||||
android:layout_below="@id/username"
|
||||
android:layout_marginTop="0dp"
|
||||
android:padding="2dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/note_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:inputType="textMultiLine|textCapSentences"
|
||||
android:singleLine="false"
|
||||
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_personal_note"/>
|
||||
|
||||
<!-- <ImageButton-->
|
||||
<!-- android:id="@+id/note_edit_confirm"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:src="@drawable/ic_fluent_checkmark_24_regular"-->
|
||||
<!-- android:backgroundTint="#00000000"-->
|
||||
<!-- android:layout_marginTop="2dp"-->
|
||||
<!-- android:layout_marginEnd="10dp"-->
|
||||
<!-- android:layout_gravity="right|center_vertical" />-->
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<org.joinmastodon.android.ui.views.LinkedTextView
|
||||
android:id="@+id/bio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/username"
|
||||
android:layout_below="@id/note_edit_wrap"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginRight="16dp"
|
||||
@@ -331,10 +369,11 @@
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:background="@drawable/bg_fab"
|
||||
android:tint="@color/fab_icon"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_edit_34"
|
||||
android:stateListAnimator="@animator/fab_shadow"
|
||||
android:src="@drawable/ic_edit_34"/>
|
||||
android:tint="@color/fab_icon"
|
||||
tools:ignore="SpeakableTextPresentCheck,SpeakableTextPresentCheck" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
<string name="sk_app_username" translatable="false">\@megalodon</string>
|
||||
<string name="sk_tabs_disable_swipe">Disable swiping between tabs</string>
|
||||
<string name="sk_settings_profile">Set up profile</string>
|
||||
<string name="sk_personal_note">Personal note for this profile:</string>
|
||||
<string name="sk_settings_posting">Posting preferences</string>
|
||||
<string name="sk_settings_filters">Configure filters</string>
|
||||
<string name="sk_settings_auth">Security settings</string>
|
||||
|
||||
Reference in New Issue
Block a user