[imdm] fix bubleImageCell download button size + mark chat room as read if open
This commit is contained in:
parent
e51d26cfb0
commit
72bda7d195
6 changed files with 99 additions and 34 deletions
|
@ -1 +1 @@
|
||||||
version.name=3.2.2-97-gf7378dac
|
version.name=3.2.5-19-g07d4f18
|
||||||
|
|
|
@ -59,7 +59,9 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="10dp">
|
android:paddingTop="10dp"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/contact_header"
|
android:id="@+id/contact_header"
|
||||||
|
@ -106,7 +108,33 @@
|
||||||
android:layout_below="@id/progress_bar"/>
|
android:layout_below="@id/progress_bar"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/imdmLayout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="12dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:gravity="right"
|
||||||
|
android:visibility="invisible">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/imdmText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Displayed"
|
||||||
|
android:textSize="10dp"
|
||||||
|
android:paddingRight="5dp"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imdmIcon"
|
||||||
|
android:layout_width="10dp"
|
||||||
|
android:layout_height="12dp"
|
||||||
|
android:src="@drawable/valid"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -174,6 +174,9 @@ Vos amis pourront vous joindre plus facilement si vous associez votre compte à
|
||||||
<string name="message_cant_be_decrypted_notif">Vous ne pouvez pas déchiffrer ce message.</string>
|
<string name="message_cant_be_decrypted_notif">Vous ne pouvez pas déchiffrer ce message.</string>
|
||||||
<string name="lime_not_verified">Vous essayez d\'envoyer un message à un contact non vérifié par ZRTP tout en utilisant LIME.\nAppelez ce contact et vérifié sa clef ZRTP avant de lui envoyer des messages.</string>
|
<string name="lime_not_verified">Vous essayez d\'envoyer un message à un contact non vérifié par ZRTP tout en utilisant LIME.\nAppelez ce contact et vérifié sa clef ZRTP avant de lui envoyer des messages.</string>
|
||||||
<string name="processing_image">Traitement de l\'image, cela peut prendre quelques secondes selon sa taille</string>
|
<string name="processing_image">Traitement de l\'image, cela peut prendre quelques secondes selon sa taille</string>
|
||||||
|
<string name="displayed">Lu</string>
|
||||||
|
<string name="delivered">Reçu</string>
|
||||||
|
<string name="resend">Renvoyer</string>
|
||||||
<!--Status Bar-->
|
<!--Status Bar-->
|
||||||
<string name="status_connected">Enregistré</string>
|
<string name="status_connected">Enregistré</string>
|
||||||
<string name="status_not_connected">Non enregistré</string>
|
<string name="status_not_connected">Non enregistré</string>
|
||||||
|
|
|
@ -185,6 +185,9 @@
|
||||||
<string name="message_cant_be_decrypted_notif">You are unable to decrypt this message.</string>
|
<string name="message_cant_be_decrypted_notif">You are unable to decrypt this message.</string>
|
||||||
<string name="lime_not_verified">You are trying to send a message using LIME to a contact not verified by ZRTP.\nPlease call this contact and verify his ZRTP key before sending your messages.</string>
|
<string name="lime_not_verified">You are trying to send a message using LIME to a contact not verified by ZRTP.\nPlease call this contact and verify his ZRTP key before sending your messages.</string>
|
||||||
<string name="processing_image">Processing image, can take up to a few seconds depending on the size of the file</string>
|
<string name="processing_image">Processing image, can take up to a few seconds depending on the size of the file</string>
|
||||||
|
<string name="displayed">Displayed</string>
|
||||||
|
<string name="delivered">Delivered</string>
|
||||||
|
<string name="resend">Resend</string>
|
||||||
|
|
||||||
<!-- Status Bar -->
|
<!-- Status Bar -->
|
||||||
<string name="status_connected">Registered</string>
|
<string name="status_connected">Registered</string>
|
||||||
|
|
|
@ -18,30 +18,6 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import org.linphone.compatibility.Compatibility;
|
|
||||||
import org.linphone.core.LinphoneAddress;
|
|
||||||
import org.linphone.core.LinphoneBuffer;
|
|
||||||
import org.linphone.core.LinphoneChatMessage;
|
|
||||||
import org.linphone.core.LinphoneChatMessage.State;
|
|
||||||
import org.linphone.core.LinphoneChatRoom;
|
|
||||||
import org.linphone.core.LinphoneContent;
|
|
||||||
import org.linphone.core.LinphoneCore;
|
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
|
||||||
import org.linphone.core.LinphoneCoreListenerBase;
|
|
||||||
import org.linphone.mediastream.Log;
|
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -97,6 +73,30 @@ import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.linphone.compatibility.Compatibility;
|
||||||
|
import org.linphone.core.LinphoneAddress;
|
||||||
|
import org.linphone.core.LinphoneBuffer;
|
||||||
|
import org.linphone.core.LinphoneChatMessage;
|
||||||
|
import org.linphone.core.LinphoneChatMessage.State;
|
||||||
|
import org.linphone.core.LinphoneChatRoom;
|
||||||
|
import org.linphone.core.LinphoneContent;
|
||||||
|
import org.linphone.core.LinphoneCore;
|
||||||
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
|
import org.linphone.core.LinphoneCoreListenerBase;
|
||||||
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
||||||
public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener {
|
public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener {
|
||||||
private static final int ADD_PHOTO = 1337;
|
private static final int ADD_PHOTO = 1337;
|
||||||
|
@ -1021,6 +1021,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
public ImageView messageStatus;
|
public ImageView messageStatus;
|
||||||
public ProgressBar messageSendingInProgress;
|
public ProgressBar messageSendingInProgress;
|
||||||
public ImageView contactPictureMask;
|
public ImageView contactPictureMask;
|
||||||
|
public LinearLayout imdmLayout;
|
||||||
|
public ImageView imdmIcon;
|
||||||
|
public TextView imdmLabel;
|
||||||
|
|
||||||
public ViewHolder(View view) {
|
public ViewHolder(View view) {
|
||||||
id = view.getId();
|
id = view.getId();
|
||||||
|
@ -1037,6 +1040,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
messageStatus = (ImageView) view.findViewById(R.id.status);
|
messageStatus = (ImageView) view.findViewById(R.id.status);
|
||||||
messageSendingInProgress = (ProgressBar) view.findViewById(R.id.inprogress);
|
messageSendingInProgress = (ProgressBar) view.findViewById(R.id.inprogress);
|
||||||
contactPictureMask = (ImageView) view.findViewById(R.id.mask);
|
contactPictureMask = (ImageView) view.findViewById(R.id.mask);
|
||||||
|
imdmLayout = (LinearLayout) view.findViewById(R.id.imdmLayout);
|
||||||
|
imdmIcon = (ImageView) view.findViewById(R.id.imdmIcon);
|
||||||
|
imdmLabel = (TextView) view.findViewById(R.id.imdmText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1178,16 +1184,38 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
}
|
}
|
||||||
holder.contactName.setText(timestampToHumanDate(context, message.getTime()) + " - " + displayName);
|
holder.contactName.setText(timestampToHumanDate(context, message.getTime()) + " - " + displayName);
|
||||||
|
|
||||||
if (status == LinphoneChatMessage.State.NotDelivered) {
|
/*if (status == LinphoneChatMessage.State.NotDelivered) {
|
||||||
holder.messageStatus.setVisibility(View.VISIBLE);
|
holder.messageStatus.setVisibility(View.VISIBLE);
|
||||||
holder.messageStatus.setImageResource(R.drawable.chat_message_not_delivered);
|
holder.messageStatus.setImageResource(R.drawable.chat_message_not_delivered);
|
||||||
} else if (status == LinphoneChatMessage.State.InProgress) {
|
} else*/
|
||||||
|
if (status == LinphoneChatMessage.State.InProgress) {
|
||||||
holder.messageSendingInProgress.setVisibility(View.VISIBLE);
|
holder.messageSendingInProgress.setVisibility(View.VISIBLE);
|
||||||
} else if (!message.isSecured() && !message.isOutgoing() &&
|
} else if (!message.isSecured() && !message.isOutgoing() &&
|
||||||
LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory) {
|
LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory) {
|
||||||
holder.messageStatus.setVisibility(View.VISIBLE);
|
holder.messageStatus.setVisibility(View.VISIBLE);
|
||||||
holder.messageStatus.setImageResource(R.drawable.lime_ko);
|
holder.messageStatus.setImageResource(R.drawable.lime_ko);
|
||||||
}
|
}
|
||||||
|
else if(status == State.DeliveredToUser && message.isOutgoing()){
|
||||||
|
holder.imdmLayout.setVisibility(View.VISIBLE);
|
||||||
|
holder.imdmIcon.setImageResource(R.drawable.valid_disabled);
|
||||||
|
holder.imdmLabel.setText(R.string.delivered);
|
||||||
|
holder.imdmLabel.setTextColor(getResources().getColor(R.color.colorA));
|
||||||
|
}
|
||||||
|
else if(status == State.Displayed && message.isOutgoing()){
|
||||||
|
holder.imdmLayout.setVisibility(View.VISIBLE);
|
||||||
|
holder.imdmIcon.setImageResource(R.drawable.valid);
|
||||||
|
holder.imdmLabel.setText(R.string.displayed);
|
||||||
|
holder.imdmLabel.setTextColor(getResources().getColor(R.color.colorA));
|
||||||
|
}
|
||||||
|
else if(status == State.NotDelivered && message.isOutgoing()){
|
||||||
|
holder.imdmLayout.setVisibility(View.VISIBLE);
|
||||||
|
holder.imdmIcon.setImageResource(R.drawable.chat_message_not_delivered);
|
||||||
|
holder.imdmLabel.setText(R.string.resend);
|
||||||
|
holder.imdmLabel.setTextColor(getResources().getColor(R.color.colorI));
|
||||||
|
}
|
||||||
|
if(!message.isOutgoing()){
|
||||||
|
holder.imdmLayout.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
if (externalBodyUrl != null || fileTransferContent != null) {
|
if (externalBodyUrl != null || fileTransferContent != null) {
|
||||||
String appData = message.getAppData();
|
String appData = message.getAppData();
|
||||||
|
@ -1252,7 +1280,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
LinphoneManager.getLc().getChatRoom(message.getFrom()).markAsRead();;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
holder.imdmLayout.setVisibility(View.INVISIBLE);
|
||||||
holder.fileTransferAction.setText(getString(R.string.accept));
|
holder.fileTransferAction.setText(getString(R.string.accept));
|
||||||
holder.fileTransferAction.setOnClickListener(new OnClickListener() {
|
holder.fileTransferAction.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 33fcf86a6b9acf38de4fc03a531d7df8ed927def
|
Subproject commit c0ef01c8be50ee4da734df19d8a429e3038f1347
|
Loading…
Reference in a new issue