Started IMDN fragment
This commit is contained in:
parent
4eb1f827d8
commit
9e3edcbf5f
8 changed files with 468 additions and 3 deletions
152
res/layout/chat_imdn.xml
Normal file
152
res/layout/chat_imdn.xml
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/colorH" >
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/top"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/top_bar"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@color/colorF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
|
android:src="@drawable/back"
|
||||||
|
android:background="@drawable/toolbar_button"
|
||||||
|
android:contentDescription="@string/content_description_back"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.2"
|
||||||
|
android:padding="18dp"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.8"
|
||||||
|
android:padding="15dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_below="@id/top">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/bubble"
|
||||||
|
layout="@layout/chat_bubble"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="20dp"/>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/read_layout_header"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@color/colorG">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/font27"
|
||||||
|
android:text="@string/displayed"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:src="@drawable/message_read"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/read_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/delivered_layout_header"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@color/colorG">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/font28"
|
||||||
|
android:text="@string/delivered"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:src="@drawable/message_delivered"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/delivered_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/undelivered_layout_header"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@color/colorG">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/font29"
|
||||||
|
android:text="@string/undelivered"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:src="@drawable/message_undelivered"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/undelivered_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
80
res/layout/chat_imdn_cell.xml
Normal file
80
res/layout/chat_imdn_cell.xml
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:background="@color/colorH"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/separator"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:background="@color/colorE"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/avatar_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/contact_picture"
|
||||||
|
android:src="@drawable/avatar"
|
||||||
|
android:contentDescription="@string/content_description_contact_picture"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginLeft="5dp"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/mask"
|
||||||
|
android:src="@drawable/avatar_mask"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginLeft="5dp"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_centerVertical="true"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
style="@style/font6"
|
||||||
|
android:lines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toRightOf="@id/avatar_layout"
|
||||||
|
android:layout_toLeftOf="@id/time"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:layout_centerVertical="true"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -191,6 +191,7 @@
|
||||||
<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">Read</string>
|
<string name="displayed">Read</string>
|
||||||
<string name="delivered">Delivered</string>
|
<string name="delivered">Delivered</string>
|
||||||
|
<string name="undelivered">Undelivered</string>
|
||||||
<string name="sent">Sent</string>
|
<string name="sent">Sent</string>
|
||||||
<string name="resend">Resend</string>
|
<string name="resend">Resend</string>
|
||||||
<string name="error_opening_file">An error occurs when opening this file.</string>
|
<string name="error_opening_file">An error occurs when opening this file.</string>
|
||||||
|
|
|
@ -162,4 +162,22 @@
|
||||||
<item name="android:textSize">12sp</item>
|
<item name="android:textSize">12sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="font27" parent="@android:style/TextAppearance.Medium">
|
||||||
|
<item name="android:textColor">@color/colorK</item>
|
||||||
|
<item name="android:textSize">15sp</item>
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="font28" parent="@android:style/TextAppearance.Medium">
|
||||||
|
<item name="android:textColor">@color/colorD</item>
|
||||||
|
<item name="android:textSize">15sp</item>
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="font29" parent="@android:style/TextAppearance.Medium">
|
||||||
|
<item name="android:textColor">@color/colorI</item>
|
||||||
|
<item name="android:textSize">15sp</item>
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -65,6 +65,7 @@ import android.widget.Toast;
|
||||||
import org.linphone.call.CallActivity;
|
import org.linphone.call.CallActivity;
|
||||||
import org.linphone.call.CallIncomingActivity;
|
import org.linphone.call.CallIncomingActivity;
|
||||||
import org.linphone.call.CallOutgoingActivity;
|
import org.linphone.call.CallOutgoingActivity;
|
||||||
|
import org.linphone.chat.ImdnFragment;
|
||||||
import org.linphone.contacts.ContactPicked;
|
import org.linphone.contacts.ContactPicked;
|
||||||
import org.linphone.fragments.AboutFragment;
|
import org.linphone.fragments.AboutFragment;
|
||||||
import org.linphone.fragments.AccountPreferencesFragment;
|
import org.linphone.fragments.AccountPreferencesFragment;
|
||||||
|
@ -431,6 +432,9 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
case GROUP_CHAT:
|
case GROUP_CHAT:
|
||||||
fragment = new GroupChatFragment();
|
fragment = new GroupChatFragment();
|
||||||
break;
|
break;
|
||||||
|
case MESSAGE_IMDN:
|
||||||
|
fragment = new ImdnFragment();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -721,6 +725,11 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras);
|
changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void goToChatMessageImdnInfos() {
|
||||||
|
Bundle extras = new Bundle();
|
||||||
|
changeCurrentFragment(FragmentsAvailable.MESSAGE_IMDN, extras);
|
||||||
|
}
|
||||||
|
|
||||||
public void goToChatList() {
|
public void goToChatList() {
|
||||||
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
|
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,6 +252,12 @@ public class ChatEventsAdapter extends ListSelectionAdapter {
|
||||||
holder.imdmLabel.setText(R.string.file_transfer_error);
|
holder.imdmLabel.setText(R.string.file_transfer_error);
|
||||||
holder.imdmLabel.setTextColor(mContext.getResources().getColor(R.color.colorI));
|
holder.imdmLabel.setTextColor(mContext.getResources().getColor(R.color.colorI));
|
||||||
}
|
}
|
||||||
|
holder.imdmLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
LinphoneActivity.instance().goToChatMessageImdnInfos();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (isEditionEnabled()) {
|
if (isEditionEnabled()) {
|
||||||
layoutParams.addRule(RelativeLayout.LEFT_OF, holder.delete.getId());
|
layoutParams.addRule(RelativeLayout.LEFT_OF, holder.delete.getId());
|
||||||
|
@ -546,8 +552,6 @@ public class ChatEventsAdapter extends ListSelectionAdapter {
|
||||||
if (bm_tmp != bm) {
|
if (bm_tmp != bm) {
|
||||||
bm.recycle();
|
bm.recycle();
|
||||||
bm = bm_tmp;
|
bm = bm_tmp;
|
||||||
} else {
|
|
||||||
bm_tmp = null;
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
|
|
200
src/android/org/linphone/chat/ImdnFragment.java
Normal file
200
src/android/org/linphone/chat/ImdnFragment.java
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
/*
|
||||||
|
ImdnFragment.java
|
||||||
|
Copyright (C) 2010-2018 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
|
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 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.linphone.chat;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Matrix;
|
||||||
|
import android.media.ExifInterface;
|
||||||
|
import android.media.ThumbnailUtils;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.linphone.LinphoneUtils;
|
||||||
|
import org.linphone.R;
|
||||||
|
import org.linphone.activities.LinphoneActivity;
|
||||||
|
import org.linphone.compatibility.Compatibility;
|
||||||
|
import org.linphone.contacts.ContactsManager;
|
||||||
|
import org.linphone.core.ChatMessage;
|
||||||
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ImdnFragment extends Fragment {
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
private LinearLayout mRead, mDelivered, mUndelivered;
|
||||||
|
private ImageView mBackButton;
|
||||||
|
private ChatBubbleViewHolder mBubble;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
mInflater = inflater;
|
||||||
|
View view = mInflater.inflate(R.layout.chat_imdn, container, false);
|
||||||
|
|
||||||
|
mBackButton = view.findViewById(R.id.back);
|
||||||
|
mBackButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
LinphoneActivity.instance().onBackPressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mRead = view.findViewById(R.id.read_layout);
|
||||||
|
mDelivered = view.findViewById(R.id.delivered_layout);
|
||||||
|
mUndelivered = view.findViewById(R.id.undelivered_layout);
|
||||||
|
|
||||||
|
mBubble = new ChatBubbleViewHolder(view.findViewById(R.id.bubble));
|
||||||
|
mBubble.eventLayout.setVisibility(View.GONE);
|
||||||
|
mBubble.bubbleLayout.setVisibility(View.VISIBLE);
|
||||||
|
mBubble.delete.setVisibility(View.GONE);
|
||||||
|
mBubble.messageText.setVisibility(View.GONE);
|
||||||
|
mBubble.messageImage.setVisibility(View.GONE);
|
||||||
|
mBubble.fileTransferLayout.setVisibility(View.GONE);
|
||||||
|
mBubble.fileName.setVisibility(View.GONE);
|
||||||
|
mBubble.openFileButton.setVisibility(View.GONE);
|
||||||
|
mBubble.messageStatus.setVisibility(View.INVISIBLE);
|
||||||
|
mBubble.messageSendingInProgress.setVisibility(View.GONE);
|
||||||
|
mBubble.imdmLayout.setVisibility(View.INVISIBLE);
|
||||||
|
mBubble.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||||
|
|
||||||
|
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||||
|
layoutParams.setMargins(100, 10, 10, 10);
|
||||||
|
mBubble.background.setBackgroundResource(R.drawable.resizable_chat_bubble_outgoing);
|
||||||
|
Compatibility.setTextAppearance(mBubble.contactName, getActivity(), R.style.font3);
|
||||||
|
Compatibility.setTextAppearance(mBubble.fileTransferAction, getActivity(), R.style.font15);
|
||||||
|
mBubble.fileTransferAction.setBackgroundResource(R.drawable.resizable_confirm_delete_button);
|
||||||
|
mBubble.contactPictureMask.setImageResource(R.drawable.avatar_chat_mask_outgoing);
|
||||||
|
|
||||||
|
ChatMessage message = null; //TODO
|
||||||
|
if (message.hasTextContent()) {
|
||||||
|
String msg = message.getTextContent();
|
||||||
|
Spanned text = LinphoneUtils.getTextWithHttpLinks(msg);
|
||||||
|
mBubble.messageText.setText(text);
|
||||||
|
mBubble.messageText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
mBubble.messageText.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
String appData = message.getAppdata();
|
||||||
|
if (appData != null) { // Something to display
|
||||||
|
mBubble.fileName.setVisibility(View.VISIBLE);
|
||||||
|
mBubble.fileName.setText(LinphoneUtils.getNameFromFilePath(appData));
|
||||||
|
if (LinphoneUtils.isExtensionImage(appData)) {
|
||||||
|
mBubble.messageImage.setVisibility(View.VISIBLE);
|
||||||
|
mBubble.messageImage.setImageBitmap(loadBitmap(appData));
|
||||||
|
mBubble.messageImage.setTag(appData);
|
||||||
|
} else {
|
||||||
|
mBubble.openFileButton.setVisibility(View.VISIBLE);
|
||||||
|
mBubble.openFileButton.setTag(appData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: real values
|
||||||
|
View v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
||||||
|
v.findViewById(R.id.separator).setVisibility(View.GONE);
|
||||||
|
((TextView)v.findViewById(R.id.time)).setText("Aujourd'hui - 17h58");
|
||||||
|
((TextView)v.findViewById(R.id.name)).setText("Albert");
|
||||||
|
mRead.addView(v);
|
||||||
|
v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
||||||
|
((TextView)v.findViewById(R.id.time)).setText("Aujourd'hui - 17h52");
|
||||||
|
((TextView)v.findViewById(R.id.name)).setText("Charlotte");
|
||||||
|
mRead.addView(v);
|
||||||
|
v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
||||||
|
v.findViewById(R.id.separator).setVisibility(View.GONE);
|
||||||
|
((TextView)v.findViewById(R.id.time)).setText("Aujourd'hui - 17h36");
|
||||||
|
((TextView)v.findViewById(R.id.name)).setText("Fabrice");
|
||||||
|
mDelivered.addView(v);
|
||||||
|
v = mInflater.inflate(R.layout.chat_imdn_cell, container, false);
|
||||||
|
v.findViewById(R.id.separator).setVisibility(View.GONE);
|
||||||
|
((TextView)v.findViewById(R.id.name)).setText("Heloïse");
|
||||||
|
mUndelivered.addView(v);
|
||||||
|
|
||||||
|
mBubble.contactName.setText("10/07/2017 - 17h35 - Violaine");
|
||||||
|
mBubble.messageText.setText("Lorem ipsum dolor sit aet patetris");
|
||||||
|
mBubble.messageText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
mBubble.messageText.setVisibility(View.VISIBLE);
|
||||||
|
// End of todo
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Bitmap loadBitmap(String path) {
|
||||||
|
Bitmap bm = null;
|
||||||
|
Bitmap thumbnail = null;
|
||||||
|
if (LinphoneUtils.isExtensionImage(path)) {
|
||||||
|
if (path.startsWith("content")) {
|
||||||
|
try {
|
||||||
|
bm = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), Uri.parse(path));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
Log.e(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bm = BitmapFactory.decodeFile(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rotate the bitmap if possible/needed, using EXIF data
|
||||||
|
try {
|
||||||
|
android.graphics.Bitmap bm_tmp;
|
||||||
|
ExifInterface exif = new ExifInterface(path);
|
||||||
|
int pictureOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
if (pictureOrientation == 6) {
|
||||||
|
matrix.postRotate(90);
|
||||||
|
} else if (pictureOrientation == 3) {
|
||||||
|
matrix.postRotate(180);
|
||||||
|
} else if (pictureOrientation == 8) {
|
||||||
|
matrix.postRotate(270);
|
||||||
|
}
|
||||||
|
bm_tmp = android.graphics.Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
|
||||||
|
if (bm_tmp != bm) {
|
||||||
|
bm.recycle();
|
||||||
|
bm = bm_tmp;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bm != null) {
|
||||||
|
thumbnail = ThumbnailUtils.extractThumbnail(bm, 500, 500);
|
||||||
|
bm.recycle();
|
||||||
|
}
|
||||||
|
return thumbnail;
|
||||||
|
} else {
|
||||||
|
return BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.avatar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,7 +35,8 @@ public enum FragmentsAvailable {
|
||||||
CHAT,
|
CHAT,
|
||||||
CREATE_CHAT,
|
CREATE_CHAT,
|
||||||
INFO_GROUP_CHAT,
|
INFO_GROUP_CHAT,
|
||||||
GROUP_CHAT;
|
GROUP_CHAT,
|
||||||
|
MESSAGE_IMDN;
|
||||||
|
|
||||||
public boolean shouldAnimate() {
|
public boolean shouldAnimate() {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue