mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +01:00
[android] set image preview size to 1/4 of screen height
This commit is contained in:
@@ -259,7 +259,7 @@ public class ConversationActivity extends BriarActivity
|
|||||||
textInputView.setEnabled(false);
|
textInputView.setEnabled(false);
|
||||||
textInputView.setListener(this);
|
textInputView.setListener(this);
|
||||||
if (FEATURE_FLAG_IMAGE_ATTACHMENTS) {
|
if (FEATURE_FLAG_IMAGE_ATTACHMENTS) {
|
||||||
textInputView.setAttachImageListener(this);
|
textInputView.setAttachImageListener(this, getWindowManager());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,11 @@ import android.support.design.widget.FloatingActionButton;
|
|||||||
import android.support.v4.view.AbsSavedState;
|
import android.support.v4.view.AbsSavedState;
|
||||||
import android.support.v7.graphics.Palette;
|
import android.support.v7.graphics.Palette;
|
||||||
import android.support.v7.widget.AppCompatImageButton;
|
import android.support.v7.widget.AppCompatImageButton;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewGroup.LayoutParams;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import com.bumptech.glide.load.DataSource;
|
import com.bumptech.glide.load.DataSource;
|
||||||
@@ -79,8 +82,16 @@ class TextAttachmentController extends TextSendController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttachImageListener(AttachImageListener imageListener) {
|
public void setAttachImageListener(AttachImageListener imageListener,
|
||||||
|
WindowManager windowManager) {
|
||||||
this.imageListener = imageListener;
|
this.imageListener = imageListener;
|
||||||
|
// set preview size based on screen height
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
LayoutParams layoutParams = imageView.getLayoutParams();
|
||||||
|
layoutParams.height = displayMetrics.heightPixels / 4;
|
||||||
|
imageView.setLayoutParams(layoutParams);
|
||||||
|
// show image button
|
||||||
showImageButton(true);
|
showImageButton(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import android.support.v7.widget.AppCompatImageButton;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import com.vanniktech.emoji.EmojiEditText;
|
import com.vanniktech.emoji.EmojiEditText;
|
||||||
import com.vanniktech.emoji.RecentEmoji;
|
import com.vanniktech.emoji.RecentEmoji;
|
||||||
@@ -143,9 +144,10 @@ public class TextInputView extends KeyboardAwareLinearLayout {
|
|||||||
textSendController.setSendListener(listener);
|
textSendController.setSendListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttachImageListener(AttachImageListener imageListener) {
|
public void setAttachImageListener(AttachImageListener imageListener,
|
||||||
|
WindowManager windowManager) {
|
||||||
attachmentController = (TextAttachmentController) textSendController;
|
attachmentController = (TextAttachmentController) textSendController;
|
||||||
attachmentController.setAttachImageListener(imageListener);
|
attachmentController.setAttachImageListener(imageListener, windowManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onImageReceived(@Nullable Intent resultData) {
|
public void onImageReceived(@Nullable Intent resultData) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
android:id="@+id/imageView"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/text_input_image_height"
|
android:layout_height="@dimen/text_input_image_height"
|
||||||
|
android:minHeight="@dimen/button_size"
|
||||||
tools:background="@color/msg_status_bubble_background"
|
tools:background="@color/msg_status_bubble_background"
|
||||||
tools:ignore="ContentDescription"
|
tools:ignore="ContentDescription"
|
||||||
tools:srcCompat="@tools:sample/avatars"/>
|
tools:srcCompat="@tools:sample/avatars"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user