Do not use message field to display file name for the day we'll be able to send both file and text
This commit is contained in:
parent
83fffb16d2
commit
cf127fee22
4 changed files with 45 additions and 49 deletions
|
@ -109,55 +109,50 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
style="@style/font11"
|
||||
android:autoLink="web"
|
||||
android:linksClickable="true"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayoutCentered"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center">
|
||||
<TextView
|
||||
android:id="@+id/file_name"
|
||||
style="@style/font11"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:visibility="gone"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"/>
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:visibility="gone"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/file_name"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/open_file"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@color/colorA"
|
||||
android:padding="5dp"
|
||||
android:maxLines="1"
|
||||
style="@style/font25"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/open"/>
|
||||
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/open_file"
|
||||
android:gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_below="@id/file_name"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@color/colorA"
|
||||
android:padding="5dp"
|
||||
style="@style/font25"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/open"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
style="@style/font11"
|
||||
android:autoLink="web"
|
||||
android:linksClickable="true"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_transfer_layout"
|
||||
android:visibility="gone"
|
||||
|
|
|
@ -55,6 +55,8 @@ public class ChatBubbleViewHolder {
|
|||
public RelativeLayout fileTransferLayout;
|
||||
public ProgressBar fileTransferProgressBar;
|
||||
public Button fileTransferAction;
|
||||
|
||||
public TextView fileName;
|
||||
public TextView openFileButton;
|
||||
|
||||
public CheckBox delete;
|
||||
|
@ -82,6 +84,8 @@ public class ChatBubbleViewHolder {
|
|||
fileTransferLayout = view.findViewById(R.id.file_transfer_layout);
|
||||
fileTransferProgressBar = view.findViewById(R.id.progress_bar);
|
||||
fileTransferAction = view.findViewById(R.id.file_transfer_action);
|
||||
|
||||
fileName = view.findViewById(R.id.file_name);
|
||||
openFileButton = view.findViewById(R.id.open_file);
|
||||
|
||||
delete = view.findViewById(R.id.delete_message);
|
||||
|
|
|
@ -68,9 +68,7 @@ import java.io.IOException;
|
|||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
|
||||
|
||||
|
@ -138,6 +136,7 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
|
|||
holder.fileTransferLayout.setVisibility(View.GONE);
|
||||
holder.fileTransferProgressBar.setProgress(0);
|
||||
holder.fileTransferAction.setEnabled(true);
|
||||
holder.fileName.setVisibility(View.GONE);
|
||||
holder.openFileButton.setVisibility(View.GONE);
|
||||
holder.messageStatus.setVisibility(View.INVISIBLE);
|
||||
holder.messageSendingInProgress.setVisibility(View.GONE);
|
||||
|
@ -250,13 +249,13 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
|
|||
String appData = message.getAppdata();
|
||||
if (externalBodyUrl != null) { // Incoming file transfer
|
||||
if (appData != null) { // Download already done, just display the result
|
||||
holder.messageText.setVisibility(View.VISIBLE);
|
||||
holder.messageText.setText(fileTransferContent.getName());
|
||||
holder.fileName.setVisibility(View.VISIBLE);
|
||||
holder.fileName.setText(fileTransferContent.getName());
|
||||
|
||||
displayDownloadedFile(message, holder);
|
||||
} else { // Attachment not yet downloaded
|
||||
holder.messageText.setVisibility(View.VISIBLE);
|
||||
holder.messageText.setText(fileTransferContent.getName());
|
||||
holder.fileName.setVisibility(View.VISIBLE);
|
||||
holder.fileName.setText(fileTransferContent.getName());
|
||||
|
||||
holder.fileTransferLayout.setVisibility(View.VISIBLE);
|
||||
holder.fileTransferProgressBar.setVisibility(View.GONE);
|
||||
|
|
|
@ -57,9 +57,7 @@ import org.linphone.contacts.ContactAddress;
|
|||
import org.linphone.contacts.ContactsManager;
|
||||
import org.linphone.contacts.LinphoneContact;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Buffer;
|
||||
import org.linphone.core.ChatMessage;
|
||||
import org.linphone.core.ChatMessageListener;
|
||||
import org.linphone.core.ChatMessageListenerStub;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomListener;
|
||||
|
|
Loading…
Reference in a new issue