mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 20:08:08 +00:00
Fix chat list view and change file transfert button in chat bubble
This commit is contained in:
parent
713fa606dc
commit
67bb96a4ab
3 changed files with 40 additions and 14 deletions
|
|
@ -99,14 +99,23 @@
|
|||
android:textStyle="bold"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_name"
|
||||
style="@style/font25"
|
||||
android:layout_width="55dp"
|
||||
android:layout_height="55dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="false"
|
||||
android:background="@drawable/chat_list_indicator"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:text="FILE"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_name"
|
||||
style="@style/font26"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
|
|
@ -114,19 +123,22 @@
|
|||
android:layout_height="150dp"
|
||||
android:layout_below="@id/file_name"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:scaleType="centerInside"/>
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:scaleType="centerInside" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/open_file"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/file_name"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/open"
|
||||
android:textAppearance="@style/font8"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
|
|
|
|||
|
|
@ -388,7 +388,8 @@ public class ChatEventsAdapter extends ListSelectionAdapter {
|
|||
holder.fileTransferAction.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mContext.getPackageManager().checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, mContext.getPackageName()) == PackageManager.PERMISSION_GRANTED) {
|
||||
if (LinphoneManager.getLc() != null && LinphoneManager.getLc().isNetworkReachable()
|
||||
&& mContext.getPackageManager().checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, mContext.getPackageName()) == PackageManager.PERMISSION_GRANTED) {
|
||||
v.setEnabled(false);
|
||||
String filename = message.getFileTransferInformation().getName();
|
||||
String directory_path = Environment.getExternalStorageDirectory() + "/" + mContext.getString(R.string.app_name);
|
||||
|
|
@ -581,13 +582,21 @@ public class ChatEventsAdapter extends ListSelectionAdapter {
|
|||
Content fileContent = message.getFileTransferInformation();
|
||||
String appData = fileContent.getFilePath();
|
||||
if (fileContent != null && fileContent.isFile() && appData != null) {
|
||||
String extension = (LinphoneUtils.getExtensionFromFileName(message.getFileTransferInformation().getName()));
|
||||
if(extension != null) extension = extension.toUpperCase();
|
||||
else extension = "FILE";
|
||||
|
||||
if (extension.length() > 4) extension = extension.substring(0, 3);
|
||||
|
||||
LinphoneUtils.scanFile(message);
|
||||
holder.fileName.setText(fileContent.getName());
|
||||
holder.fileName.setText(extension);
|
||||
if (LinphoneUtils.isExtensionImage(appData)) {
|
||||
holder.messageImage.setVisibility(View.VISIBLE);
|
||||
loadBitmap(appData, holder.messageImage);
|
||||
holder.messageImage.setTag(appData);
|
||||
holder.fileName.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.fileName.setVisibility(View.VISIBLE);
|
||||
holder.openFileButton.setVisibility(View.VISIBLE);
|
||||
holder.openFileButton.setTag(appData);
|
||||
holder.openFileButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import org.linphone.R;
|
|||
import org.linphone.activities.LinphoneActivity;
|
||||
|
||||
public class ListSelectionHelper {
|
||||
private ImageView mEditButton, mSelectAllButton, mDeselectAllButton, mDeleteSelectionButton, mCancelButton;
|
||||
private ImageView mEditButton, mSelectAllButton, mDeselectAllButton, mDeleteSelectionButton, mCancelButton, mCreateChat;
|
||||
private LinearLayout mEditTopBar, mTopBar;
|
||||
private ListSelectionAdapter mAdapter;
|
||||
private DeleteListener mDeleteListener;
|
||||
|
|
@ -51,11 +51,13 @@ public class ListSelectionHelper {
|
|||
|
||||
mEditTopBar = view.findViewById(R.id.edit_list);
|
||||
mTopBar = view.findViewById(R.id.top_bar);
|
||||
mCreateChat = view.findViewById(R.id.new_discussion);
|
||||
|
||||
mCancelButton = view.findViewById(R.id.cancel);
|
||||
mCancelButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mCreateChat != null) mCreateChat.setVisibility(View.VISIBLE);
|
||||
quitEditionMode();
|
||||
}
|
||||
});
|
||||
|
|
@ -68,6 +70,7 @@ public class ListSelectionHelper {
|
|||
mAdapter.enableEdition(true);
|
||||
mTopBar.setVisibility(View.GONE);
|
||||
mEditTopBar.setVisibility(View.VISIBLE);
|
||||
if (mCreateChat != null) mCreateChat.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -102,6 +105,7 @@ public class ListSelectionHelper {
|
|||
public void onClick(View view) {
|
||||
mDeleteListener.onDeleteSelection(getSelectedObjects());
|
||||
dialog.dismiss();
|
||||
if (mCreateChat != null) mCreateChat.setVisibility(View.VISIBLE);
|
||||
quitEditionMode();
|
||||
}
|
||||
});
|
||||
|
|
@ -110,6 +114,7 @@ public class ListSelectionHelper {
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
dialog.dismiss();
|
||||
if (mCreateChat != null) mCreateChat.setVisibility(View.VISIBLE);
|
||||
quitEditionMode();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue