[apps/escher] Fix scroll view indicator margin

So it does not overflow the scrolled view. Fixed for the language
controllers (on boarding app and settings), one value was changed from a
magic 14 to Metric::CommonTopMargin = 15, it did not seem to break
anything.
This commit is contained in:
Léa Saviot
2020-05-11 15:58:48 +02:00
committed by Émilie Feral
parent b8244ec0c5
commit 5f26ca40cc
3 changed files with 10 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
#include "language_controller.h"
#include "../global_preferences.h"
#include "../apps_container.h"
#include <escher/scroll_view_indicator.h>
#include <algorithm>
namespace OnBoarding {
@@ -11,6 +12,9 @@ LanguageController::LanguageController(Responder * parentResponder) :
std::max(static_cast<int>(Metric::CommonLeftMargin),
(Ion::Display::Height - I18n::NumberOfLanguages*Metric::ParameterCellHeight)/2))
{
static_cast<ScrollViewIndicator * >(m_selectableTableView.decorator()->indicatorAtIndex(1))->setMargin(
std::max(static_cast<int>(Metric::CommonLeftMargin),
(Ion::Display::Height - I18n::NumberOfLanguages*Metric::ParameterCellHeight)/2));
}
bool LanguageController::handleEvent(Ion::Events::Event event) {

View File

@@ -23,8 +23,11 @@ public:
int reusableCellCount() const override;
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
private:
protected:
SelectableTableView m_selectableTableView;
private:
MessageTableCell m_cells[I18n::NumberOfLanguages];
};

View File

@@ -1,4 +1,5 @@
#include <escher/scroll_view_indicator.h>
#include <escher/metric.h>
#include <escher/palette.h>
extern "C" {
#include <assert.h>
@@ -8,7 +9,7 @@ extern "C" {
ScrollViewIndicator::ScrollViewIndicator() :
View(),
m_color(Palette::GreyDark),
m_margin(14)
m_margin(Metric::CommonTopMargin)
{
}