diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileAboutFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileAboutFragment.java index 52ecfd95..3a9e4eb8 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileAboutFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileAboutFragment.java @@ -13,11 +13,14 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; +import android.view.ViewTreeObserver; import android.widget.EditText; import android.widget.TextView; import org.joinmastodon.android.R; import org.joinmastodon.android.model.AccountField; +import org.joinmastodon.android.ui.BetterItemAnimator; +import org.joinmastodon.android.ui.OutlineProviders; import org.joinmastodon.android.ui.text.CustomEmojiSpan; import org.joinmastodon.android.ui.utils.SimpleTextWatcher; import org.joinmastodon.android.ui.utils.UiUtils; @@ -68,6 +71,8 @@ public class ProfileAboutFragment extends Fragment{ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState){ list=new UsableRecyclerView(getActivity()); list.setId(R.id.list); + list.setItemAnimator(new BetterItemAnimator()); + list.setDrawSelectorOnTop(true); list.setLayoutManager(new LinearLayoutManager(getActivity())); imgLoader=new ListImageLoaderWrapper(getActivity(), list, new RecyclerViewDelegate(list), null); list.setAdapter(adapter=new AboutAdapter()); @@ -76,7 +81,7 @@ public class ProfileAboutFragment extends Fragment{ list.setClipToPadding(false); dividerPaint.setStyle(Paint.Style.STROKE); dividerPaint.setStrokeWidth(V.dp(1)); - dividerPaint.setColor(getResources().getColor(R.color.gray_200)); + dividerPaint.setColor(getResources().getColor(R.color.gray_200)); // TODO themes list.addItemDecoration(new RecyclerView.ItemDecoration(){ @Override public void onDrawOver(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State state){ @@ -85,7 +90,9 @@ public class ProfileAboutFragment extends Fragment{ int pos=parent.getChildAdapterPosition(item); int draggedPos=draggedViewHolder==null ? -1 : draggedViewHolder.getAbsoluteAdapterPosition(); if(positem.name=e.toString())); value.addTextChangedListener(new SimpleTextWatcher(e->item.value=e.toString())); + findViewById(R.id.remove_row_btn).setOnClickListener(this::onRemoveRowClick); } @Override @@ -236,6 +244,16 @@ public class ProfileAboutFragment extends Fragment{ title.setText(item.name); value.setText(item.value); } + + private void onRemoveRowClick(View v){ + int pos=getAbsoluteAdapterPosition(); + fields.remove(pos); + adapter.notifyItemRemoved(pos); + for(int i=0;i + + diff --git a/mastodon/src/main/res/layout/fragment_profile.xml b/mastodon/src/main/res/layout/fragment_profile.xml index 256d8121..c712d67d 100644 --- a/mastodon/src/main/res/layout/fragment_profile.xml +++ b/mastodon/src/main/res/layout/fragment_profile.xml @@ -210,8 +210,7 @@ android:layout_marginTop="8dp" android:layout_marginRight="16dp" android:textAppearance="@style/m3_body_large" - android:background="@null" - android:padding="0px" + android:background="@drawable/edit_text_border" android:inputType="textMultiLine|textCapSentences" android:visibility="gone" tools:text="Founder, CEO and lead developer @Mastodon, Germany." /> diff --git a/mastodon/src/main/res/layout/item_profile_about_editable.xml b/mastodon/src/main/res/layout/item_profile_about_editable.xml index cdbfc53c..442b1569 100644 --- a/mastodon/src/main/res/layout/item_profile_about_editable.xml +++ b/mastodon/src/main/res/layout/item_profile_about_editable.xml @@ -6,14 +6,26 @@ android:layout_height="wrap_content" android:background="?colorBackgroundLight" android:elevation="2dp" - android:outlineProvider="background" - android:padding="16dp"> + android:outlineProvider="background"> + +