TizenRefApp-8076 Implement screen reader support for No Alarms view 85/116485/5
authorSergii Kyryliuk <s.kyryliuk@partner.samsung.com>
Fri, 24 Feb 2017 15:06:54 +0000 (17:06 +0200)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 28 Feb 2017 15:31:38 +0000 (07:31 -0800)
Change-Id: I1299d57ba6d9289cea261a4a0fb1b9716e8f273c
Signed-off-by: Sergii Kyryliuk <s.kyryliuk@partner.samsung.com>
alarm-app/res/list/edje/ListPath.h
alarm-app/res/list/edje/add-button-style.edc [new file with mode: 0644]
alarm-app/res/list/edje/list-layout.edc
alarm-app/src/AlarmApp.cpp
alarm-app/src/List/AlarmsView.cpp

index 6f591d0267c8d37f0fc8dda615503fbdc408a98c..a0bd3a03e6827253ee7fa7013a6e7e2c64cdbc44 100644 (file)
 
 #define PATH_LIST_ITEM_STYLE        LIST_EDJ_DIR"list-item-style.edj"
 #define PATH_LIST_LAYOUT            LIST_EDJ_DIR"list-layout.edj"
+#define PATH_ADD_BUTTON_STYLE       LIST_EDJ_DIR"add-button-style.edj"
 
 #define PATH_ICON_ADD_ALARM         LIST_IMG_DIR"alarm_no_alarm_icon.png"
 #define PATH_NO_ALARMS_BG           LIST_IMG_DIR"tw_no_item_bg.png"
 
 #define STYLE_ITEM_BOTTOM_BUTTON    "bottom_button"
 #define LAYOUT_NO_ALARMS            "no_alarms"
-#define LAYOUT_ADD_ALARM            "add_alarm"
+#define STYLE_BUTTON_ADD_ALARM      "add_alarm"
 
 #endif /* LIST_PATH_H */
diff --git a/alarm-app/res/list/edje/add-button-style.edc b/alarm-app/res/list/edje/add-button-style.edc
new file mode 100644 (file)
index 0000000..d3843c5
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ListPath.h"
+
+#define ICON_WH 98
+
+#define TEXT_T 8
+#define TEXT_H 74
+#define TEXT_LR 60
+
+styles {
+       style {
+               name: "no_alarms_text";
+               base: "font=Tizen:style=Regular font_size=27 align=center color=#fff";
+       }
+}
+
+collections {
+       base_scale: 1.3;
+
+       group { "elm/button/base/"STYLE_BUTTON_ADD_ALARM;
+               parts {
+                       image { "image"; scale;
+                               images.image: PATH_ICON_ADD_ALARM COMP;
+                               desc { "default";
+                                       fixed: 1 1;
+                                       min: ICON_WH ICON_WH;
+                                       align: 0.5 0.0;
+                                       rel1.relative: 0.5 0.0;
+                                       rel2.relative: 0.5 0.0;
+                                       image.normal: PATH_ICON_ADD_ALARM;
+                               }
+                               desc { "pressed";
+                                       inherit: "default";
+                                       color: 255 255 255 179;
+                               }
+                       }
+                       spacer { "spacer.text.top"; scale;
+                               desc { "default";
+                                       fixed: 0 1;
+                                       min: 0 TEXT_T;
+                                       align: 0.5 0.0;
+                                       rel1 { relative: 0.0 1.0; to_y: "image"; }
+                                       rel2 { relative: 1.0 1.0; to_y: "image"; }
+                               }
+                       }
+                       spacer { "spacer.text.left"; scale;
+                               desc { "default";
+                                       fixed: 1 0;
+                                       min: TEXT_LR 0;
+                                       align: 0.0 0.5;
+                                       rel2.relative: 0.0 1.0;
+                               }
+                       }
+                       spacer { "spacer.text.right"; scale;
+                               desc { "default";
+                                       fixed: 1 0;
+                                       min: TEXT_LR 0;
+                                       align: 1.0 0.5;
+                                       rel1.relative: 1.0 0.0;
+                               }
+                       }
+                       textblock { "elm.text"; scale;
+                               desc { "default";
+                                       min: 0 TEXT_H;
+                                       rel1 { relative: 1.0 1.0; to_x: "spacer.text.left"; to_y: "spacer.text.top"; }
+                                       rel2 { relative: 0.0 1.0; to_x: "spacer.text.right"; }
+                                       text {
+                                               min: 1 0;
+                                               ellipsis: -1;
+                                               style: "no_alarms_text";
+                                       }
+                               }
+                       }
+               }
+               programs {
+                       program {
+                               signal: "mouse,down,*";
+                               source: "*";
+                               action: STATE_SET "pressed";
+                               target: "image";
+                       }
+                       program {
+                               signal: "mouse,up,*";
+                               source: "*";
+                               action: STATE_SET "default";
+                               target: "image";
+                       }
+                       program {
+                               signal: "mouse,clicked,*";
+                               source: "*";
+                               action: SIGNAL_EMIT "elm,action,click" "";
+                       }
+               }
+       }
+}
index 454c2feba377c70656ccd799828e6668aa6c688b..0af566db73afec91be449ae504b047b1b152730f 100644 (file)
 #define TITLE_T 51
 #define TITLE_H 39
 
-#define ICON_R 5
 #define ICON_T (25+16)
-#define ICON_WH 98
 
-#define TEXT_T 8
-#define TEXT_H 74
+
+#define TITLE_LR 64
 
 styles {
        style {
                name: "no_alarms_title";
                base: "font=Tizen:style=Bold font_size=30 align=center color=#4dcfff";
        }
-       style {
-               name: "no_alarms_text";
-               base: "font=Tizen:style=Regular font_size=27 align=center color=#fff";
-       }
 }
 
 collections {
        base_scale: 1.3;
 
-       group { LAYOUT_ADD_ALARM;
-               parts {
-                       spacer { "spacer.right"; scale;
-                               desc { "default";
-                                       fixed: 1 0;
-                                       min: ICON_R 0;
-                                       align: 1.0 0.5;
-                                       rel1.relative: 1.0 0.0;
-                               }
-                       }
-                       image { "image"; scale;
-                               images.image: PATH_ICON_ADD_ALARM COMP;
-                               desc { "default";
-                                       min: ICON_WH ICON_WH;
-                                       rel2 { relative: 0.0 1.0; to_x: "spacer.right"; }
-                                       image.normal: PATH_ICON_ADD_ALARM;
-                               }
-                               desc { "pressed";
-                                       inherit: "default";
-                                       color: 255 255 255 179;
-                               }
-                       }
-               }
-               programs {
-                       program {
-                               signal: "mouse,down,*";
-                               source: "*";
-                               action: STATE_SET "pressed";
-                               target: "image";
-                       }
-                       program {
-                               signal: "mouse,up,*";
-                               source: "*";
-                               action: STATE_SET "default";
-                               target: "image";
-                       }
-               }
-       }
-
        group { LAYOUT_NO_ALARMS;
                parts {
                        image { "image.bg";
@@ -96,13 +51,28 @@ collections {
                                        rel2.relative: 1.0 0.0;
                                }
                        }
+                       spacer { "spacer.title.left"; scale;
+                               desc { "default";
+                                       fixed: 1 0;
+                                       min: TITLE_LR 0;
+                                       align: 0.0 0.5;
+                                       rel2.relative: 0.0 1.0;
+                               }
+                       }
+                       spacer { "spacer.title.right"; scale;
+                               desc { "default";
+                                       fixed: 1 0;
+                                       min: TITLE_LR 0;
+                                       align: 1.0 0.5;
+                                       rel1.relative: 1.0 0.0;
+                               }
+                       }
                        textblock { "elm.text.title"; scale;
                                desc { "default";
-                                       fixed: 0 1;
                                        min: 0 TITLE_H;
                                        align: 0.5 0.0;
-                                       rel1 { relative: 0.0 1.0; to_y: "spacer.title.top"; }
-                                       rel2 { relative: 1.0 1.0; to_y: "spacer.title.top"; }
+                                       rel1 { relative: 1.0 1.0; to_x: "spacer.title.left";  to_y: "spacer.title.top"; }
+                                       rel2 { relative: 0.0 1.0; to_x: "spacer.title.right";  to_y: "spacer.title.top"; }
                                        text.style: "no_alarms_title";
                                }
                        }
@@ -123,25 +93,6 @@ collections {
                                        rel2 { relative: 0.5 1.0; to_y: "spacer.icon.top"; }
                                }
                        }
-                       spacer { "spacer.text.top"; scale;
-                               desc { "default";
-                                       fixed: 0 1;
-                                       min: 0 TEXT_T;
-                                       align: 0.5 0.0;
-                                       rel1 { relative: 0.0 1.0; to_y: "elm.swallow.icon"; }
-                                       rel2 { relative: 1.0 1.0; to_y: "elm.swallow.icon"; }
-                               }
-                       }
-                       textblock { "elm.text"; scale;
-                               desc { "default";
-                                       fixed: 0 1;
-                                       min: 0 TEXT_H;
-                                       align: 0.5 0.0;
-                                       rel1 { relative: 0.0 1.0; to_y: "spacer.text.top"; }
-                                       rel2 { relative: 1.0 1.0; to_y: "spacer.text.top"; }
-                                       text.style: "no_alarms_text";
-                               }
-                       }
                }
        }
 }
index 073c137634a6b1a0ffc731d89dd9a9b65fba071e..d668a958b19d216f8efd1c55f5c413870434c69b 100644 (file)
@@ -58,9 +58,12 @@ bool AlarmApp::onCreate()
        elm_theme_extension_add(nullptr, App::getResourcePath(PATH_LIST_ITEM_STYLE).c_str());
        elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ALARM_CHECK_STYLE).c_str());
        elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ALERT_BUTTON_STYLE).c_str());
+       elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ADD_BUTTON_STYLE).c_str());
 
        Application::onCreate();
        getWindow()->setRotationEnabled(true);
+       elm_atspi_accessible_translation_domain_set(getWindow()->getEvasObject(), TEXT_DOMAIN);
+       elm_atspi_accessible_name_set(getWindow()->getEvasObject(), "WDS_ALM_HEADER_ALARM_ABB");
 
        return true;
 }
index dab13cd612c23c9c2b9f1bf25979a0b50f78d16c..088b5a079a76783f67184f7d33f2ebbbff1be6d5 100644 (file)
@@ -160,7 +160,13 @@ Evas_Object *AlarmsView::createNoContents(Evas_Object *parent)
        Evas_Object *layout = elm_layout_add(parent);
        elm_layout_file_set(layout, App::getResourcePath(PATH_LIST_LAYOUT).c_str(), LAYOUT_NO_ALARMS);
        elm_object_translatable_part_text_set(layout, "elm.text.title", "WDS_ALM_HEADER_ALARM_ABB");
-       elm_object_translatable_part_text_set(layout, "elm.text", "WDS_ALM_OPT_ADD_ALARM_ABB");
+
+       Evas_Object *edje = elm_layout_edje_get(layout);
+       Evas_Object *title = elm_access_object_register((Evas_Object *) edje_object_part_object_get(edje, "elm.text.title"), layout);
+       elm_atspi_accessible_role_set(title, ELM_ATSPI_ROLE_HEADER);
+       elm_atspi_accessible_translation_domain_set(title, TEXT_DOMAIN);
+       elm_atspi_accessible_name_set(title, "WDS_ALM_HEADER_ALARM_ABB");
+
        elm_object_part_content_set(layout, "elm.swallow.icon", createAddButton(layout));
 
        return layout;
@@ -169,14 +175,11 @@ Evas_Object *AlarmsView::createNoContents(Evas_Object *parent)
 Evas_Object *AlarmsView::createAddButton(Evas_Object *parent)
 {
        Evas_Object *button = elm_button_add(parent);
-       elm_object_style_set(button, "transparent");
+       elm_object_style_set(button, STYLE_BUTTON_ADD_ALARM);
+       elm_object_translatable_text_set(button, "WDS_ALM_OPT_ADD_ALARM_ABB");
        evas_object_smart_callback_add(button, "clicked",
                        (Evas_Smart_Cb) makeCallback(&AlarmsView::onAddPressed), this);
 
-       Evas_Object *image = elm_layout_add(button);
-       elm_layout_file_set(image, App::getResourcePath(PATH_LIST_LAYOUT).c_str(), LAYOUT_ADD_ALARM);
-       elm_object_content_set(button, image);
-
        return button;
 }