mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
prepare views
This commit is contained in:
parent
dec4dd85a8
commit
9f4fb208a0
5 changed files with 132 additions and 8 deletions
|
@ -33,6 +33,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
@ -236,6 +237,10 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||
holder.binding.date.setTextColor(ThemeHelper.getAttColor(context, textColor));
|
||||
holder.binding.messageContent.setTextColor(ThemeHelper.getAttColor(context, textColor));
|
||||
holder.binding.userName.setTextColor(ThemeHelper.getAttColor(context, textColor));
|
||||
holder.binding.userName.setText(
|
||||
status.account.getSpanDisplayName(context,
|
||||
new WeakReference<>(holder.binding.userName)),
|
||||
TextView.BufferType.SPANNABLE);
|
||||
|
||||
if (status.media_attachments != null && status.media_attachments.size() > 0) {
|
||||
holder.binding.media.mediaContainer.setVisibility(View.VISIBLE);
|
||||
|
@ -245,7 +250,7 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
|
|||
if (measuredWidth > 0) {
|
||||
defaultHeight = (int) (measuredWidth * 3) / 4;
|
||||
}
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, defaultHeight);
|
||||
LinearLayoutCompat.LayoutParams lp = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, defaultHeight);
|
||||
holder.binding.media.mediaContainer.setLayoutParams(lp);
|
||||
if (status.media_attachments.size() == 1) {
|
||||
holder.binding.media.media1Container.mediaRoot.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.util.List;
|
|||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.activities.MainActivity;
|
||||
import app.fedilab.android.databinding.FragmentPaginationBinding;
|
||||
import app.fedilab.android.databinding.FragmentDirectMessageBinding;
|
||||
import app.fedilab.android.mastodon.client.entities.api.Context;
|
||||
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||
import app.fedilab.android.mastodon.helper.Helper;
|
||||
|
@ -41,7 +41,7 @@ public class FragmentMastodonDirectMessage extends Fragment {
|
|||
|
||||
|
||||
public FirstMessage firstMessage;
|
||||
private FragmentPaginationBinding binding;
|
||||
private FragmentDirectMessageBinding binding;
|
||||
private StatusesVM statusesVM;
|
||||
private List<Status> statuses;
|
||||
private StatusDirectMessageAdapter statusDirectMessageAdapter;
|
||||
|
@ -66,7 +66,7 @@ public class FragmentMastodonDirectMessage extends Fragment {
|
|||
if (focusedStatus == null) {
|
||||
getChildFragmentManager().beginTransaction().remove(this).commit();
|
||||
}
|
||||
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
||||
binding = FragmentDirectMessageBinding.inflate(inflater, container, false);
|
||||
statusesVM = new ViewModelProvider(FragmentMastodonDirectMessage.this).get(StatusesVM.class);
|
||||
binding.recyclerView.setNestedScrollingEnabled(true);
|
||||
this.statuses = new ArrayList<>();
|
||||
|
|
|
@ -54,12 +54,20 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/user_pp"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
<include
|
||||
android:id="@+id/media"
|
||||
layout="@layout/layout_drawer_attachments"
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/message_content" />
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/message_content">
|
||||
|
||||
<include
|
||||
android:id="@+id/media"
|
||||
layout="@layout/layout_drawer_attachments"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2023 Thomas Schneider
|
||||
|
||||
This file is a part of Fedilab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:windowBackground">
|
||||
|
||||
<!-- Listview status -->
|
||||
<FrameLayout
|
||||
android:id="@+id/main_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/compose"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="6dp"
|
||||
android:scrollbars="none" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!-- Main Loader -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/loader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/compose"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_marginBottom="?actionBarSize"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/main_frame">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="bottom">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/add_attachment_button"
|
||||
style="@style/Widget.Material3.Button.IconButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_compose_attach" />
|
||||
|
||||
<app.fedilab.android.mastodon.helper.FedilabAutoCompleteTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="6"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/send_button"
|
||||
style="@style/Widget.Material3.Button.IconButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_baseline_send_24" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -24,6 +24,7 @@
|
|||
android:layout_margin="1dp"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintBottom_toTopOf="@+id/media4_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/media1_container"
|
||||
|
@ -35,6 +36,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="1dp"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/media4_container"
|
||||
|
@ -48,6 +50,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="1dp"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -58,6 +61,7 @@
|
|||
android:id="@+id/more_media"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
tools:visibility="visible"
|
||||
android:background="#88000000"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
|
|
Loading…
Reference in a new issue