From b70bddba84f4cbaf4cb0d5354b52b82834844322 Mon Sep 17 00:00:00 2001 From: Denis Dolzhenko Date: Fri, 26 Aug 2016 15:49:18 +0300 Subject: [PATCH] Set prescale size for bubble image, fixed GUI Change-Id: Ie14b3ed5b9a74ed36fb332b8244fa2a1a85762a6 Signed-off-by: Denis Dolzhenko --- res/edje/conv_list_bubble.edc | 2 +- src/Conversation/ConvList/View/inc/BubbleBgViewItem.h | 2 ++ src/Conversation/ConvList/View/inc/BubbleViewItem.h | 2 +- src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp | 7 +++++-- src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp | 5 ++++- src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp | 1 + 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/res/edje/conv_list_bubble.edc b/res/edje/conv_list_bubble.edc index 196ec88..8b80f57 100644 --- a/res/edje/conv_list_bubble.edc +++ b/res/edje/conv_list_bubble.edc @@ -4,7 +4,7 @@ collections { BASE_SCALE; - #define MAX_TEXT_LEN 300 + #define MAX_TEXT_LEN 290 #define BUBBLE_BG_COLOR 90 111 199 230 #define BUBBLE_BG_COLOR_PRESSED 78 97 173 230 #define BUBBLE_BG_DRAFT_COLOR 106 126 204 255 diff --git a/src/Conversation/ConvList/View/inc/BubbleBgViewItem.h b/src/Conversation/ConvList/View/inc/BubbleBgViewItem.h index 2970a1d..71f51d7 100644 --- a/src/Conversation/ConvList/View/inc/BubbleBgViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleBgViewItem.h @@ -34,6 +34,8 @@ namespace Msg FailedStyle, RestrictedStyle }; + static const int bgPadLeft = 34; + static const int bgPadRight = 34; public: BubbleBgViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType); diff --git a/src/Conversation/ConvList/View/inc/BubbleViewItem.h b/src/Conversation/ConvList/View/inc/BubbleViewItem.h index 7fae586..c49d487 100644 --- a/src/Conversation/ConvList/View/inc/BubbleViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleViewItem.h @@ -30,7 +30,7 @@ namespace Msg : public View { public: - static const int maxWidth = 340; + static const int maxWidth = 408; BubbleViewItem(BubbleEntity &entity); virtual ~BubbleViewItem(); diff --git a/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp index a70e4ad..a7c5f61 100644 --- a/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp @@ -35,11 +35,14 @@ BubbleImageViewItem::~BubbleImageViewItem() Evas_Object *BubbleImageViewItem::createImage(Evas_Object *parent, const std::string &path) { + int imageWidth = 0; + int imageHeight = 0; + Evas_Object *image = elm_image_add(parent); elm_image_preload_disabled_set(image, true); + elm_image_prescale_set(image, maxWidth); + elm_image_aspect_fixed_set(image, true); elm_image_file_set(image, path.c_str(), nullptr); - int imageWidth = 0; - int imageHeight = 0; elm_image_object_size_get(image, &imageWidth, &imageHeight); if(imageWidth > maxWidth) { diff --git a/src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp index 332a7d2..ea62998 100644 --- a/src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp @@ -36,6 +36,8 @@ Evas_Object *BubbleTextViewItem::createText(Evas_Object *parent, const std::stri if(text.empty()) return nullptr; + static const int maxTextWidth = maxWidth - (bgPadLeft + bgPadRight); + Evas_Object *label = elm_label_add(parent); elm_object_style_set(label, "conv_bubble"); @@ -48,8 +50,9 @@ Evas_Object *BubbleTextViewItem::createText(Evas_Object *parent, const std::stri Evas_Coord ww = 0; Evas_Coord hh = 0; + evas_object_textblock_size_native_get(textBlock, &ww, &hh); - int wrapWidth = ww > maxWidth ? maxWidth : ww; + int wrapWidth = ww > maxTextWidth ? maxTextWidth : ww; elm_label_wrap_width_set(label, wrapWidth); return label; diff --git a/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp index 9176be2..d73c98d 100644 --- a/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp @@ -38,6 +38,7 @@ BubbleVideoViewItem::~BubbleVideoViewItem() Evas_Object *BubbleVideoViewItem::createIamge(Evas_Object *parent, const std::string &path) { Evas_Object *image = elm_image_add(parent); + elm_image_prescale_set(image, maxWidth); elm_image_file_set(image, path.c_str(), nullptr); int imageWidth = 0; int imageHeight = 0; -- 2.7.4