← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~rpadovani/ubuntu-calculator-app/favouritesScreenBlank into lp:ubuntu-calculator-app/reboot

 

Riccardo Padovani has proposed merging lp:~rpadovani/ubuntu-calculator-app/favouritesScreenBlank into lp:ubuntu-calculator-app/reboot.

Commit message:
Use EmptyState from UCS to have a text in favourite page when is empty

Requested reviews:
  Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
  Bug #1428610 in Ubuntu Calculator App: "[reboot] Favourite screen is blank by default"
  https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1428610

For more details, see:
https://code.launchpad.net/~rpadovani/ubuntu-calculator-app/favouritesScreenBlank/+merge/252155

Use EmptyState from UCS to have a text in favourite page when is empty
-- 
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~rpadovani/ubuntu-calculator-app/favouritesScreenBlank into lp:ubuntu-calculator-app/reboot.
=== modified file 'app/ui/FavouritePage.qml'
--- app/ui/FavouritePage.qml	2015-03-02 21:11:20 +0000
+++ app/ui/FavouritePage.qml	2015-03-06 18:13:44 +0000
@@ -21,6 +21,7 @@
 import Ubuntu.Components.ListItems 1.0 as ListItem
 
 import "../engine"
+import "../upstreamcomponents"
 
 Page {
     anchors.fill: parent
@@ -37,6 +38,14 @@
         }
     }
 
+    EmptyState {
+        title: i18n.tr("No favourites")
+        subTitle: i18n.tr("Swipe calculations to the left\nto mark as favourites")
+        iconName: "starred"
+        anchors.centerIn: parent
+        visible: favouriteListview.model.count == 0
+    }
+
     ListView {
         id: favouriteListview
         anchors.fill: parent

=== added file 'app/upstreamcomponents/EmptyState.qml'
--- app/upstreamcomponents/EmptyState.qml	1970-01-01 00:00:00 +0000
+++ app/upstreamcomponents/EmptyState.qml	2015-03-06 18:13:44 +0000
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+import Ubuntu.Components 1.1
+
+/*
+ Component which displays an empty state (approved by design). It offers an
+ icon, title and subtitle to describe the empty state.
+*/
+
+Item {
+    id: emptyState
+
+    // Public APIs
+    property alias iconName: emptyIcon.name
+    property alias iconSource: emptyIcon.source
+    property alias iconColor: emptyIcon.color
+    property alias title: emptyLabel.text
+    property alias subTitle: emptySublabel.text
+
+    height: childrenRect.height
+
+    Icon {
+        id: emptyIcon
+        anchors.horizontalCenter: parent.horizontalCenter
+        height: units.gu(10)
+        width: height
+        color: "#BBBBBB"
+    }
+
+    Label {
+        id: emptyLabel
+        anchors.top: emptyIcon.bottom
+        anchors.topMargin: units.gu(5)
+        anchors.horizontalCenter: parent.horizontalCenter
+        fontSize: "large"
+        font.bold: true
+    }
+
+    Label {
+        id: emptySublabel
+        anchors.top: emptyLabel.bottom
+        anchors.horizontalCenter: parent.horizontalCenter
+        horizontalAlignment: Text.AlignHCenter
+    }
+}

=== added file 'app/upstreamcomponents/ubuntu_component_store.json'
--- app/upstreamcomponents/ubuntu_component_store.json	1970-01-01 00:00:00 +0000
+++ app/upstreamcomponents/ubuntu_component_store.json	2015-03-06 18:13:44 +0000
@@ -0,0 +1,6 @@
+{
+    "name": "EmptyState",
+    "description": "This widget provides a standardized way to show an empty state (approved by Canonical designers) to improve the user experience and avoid showing a blank page.",
+    "version": "1.0",
+    "documentation_url": "http://ubuntu-component-store.readthedocs.org/en/latest/_components/emptystate.html";
+}


Follow ups