TizenRefApp-6449 Implement Circle Progress Popup 92/73692/4
authorEugene Kurzberg <i.kurtsberg@samsung.com>
Thu, 9 Jun 2016 07:38:07 +0000 (10:38 +0300)
committerEugene Kurzberg <i.kurtsberg@samsung.com>
Fri, 10 Jun 2016 09:45:13 +0000 (12:45 +0300)
Change-Id: I7f962363083b51d804b1cf127c7c34dd8d94de6d
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
lib-apps-common/inc/Ui/ProcessPopup.h [new file with mode: 0644]
lib-apps-common/project_def.prop
lib-apps-common/res/apps-common/CMakeLists.txt
lib-apps-common/res/apps-common/edje/AppsCommonPopup.h [new file with mode: 0644]
lib-apps-common/res/apps-common/edje/apps-common-popup.edc [new file with mode: 0644]
lib-apps-common/src/Ui/ProcessPopup.cpp [new file with mode: 0644]

diff --git a/lib-apps-common/inc/Ui/ProcessPopup.h b/lib-apps-common/inc/Ui/ProcessPopup.h
new file mode 100644 (file)
index 0000000..8fa2b15
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+
+#ifndef UI_PROCESS_POPUP_H
+#define UI_PROCESS_POPUP_H
+
+#include "Ui/Popup.h"
+
+namespace Ui
+{
+       class EXPORT_API ProcessPopup : public Popup
+       {
+       public:
+               enum Size
+               {
+                       SizeSmall,
+                       SizeMedium
+               };
+
+               /**
+                * @brief Create popup.
+                * @param[in]   size    Popup size
+                */
+               explicit ProcessPopup(Size size = SizeMedium);
+
+               /**
+                * @brief Allows method overload instead of shadowing
+                */
+               using Control::create;
+
+               /**
+                * @brief Create process popup with text.
+                * @param[in]   parent  Popup parent
+                * @param[in]   text    Popup text
+                * @param[in]   size    Popup size
+                * @return Created popup
+                */
+               static ProcessPopup *create(Evas_Object *parent, const char *text, Size size = SizeMedium);
+
+               /**
+                * @brief Set Popup text.
+                * @param[in]   text    Popup text
+                */
+               void setText(const char *text);
+
+       protected:
+               virtual Evas_Object *onCreate(Evas_Object *parent) override;
+
+       private:
+               Size m_Size;
+               Evas_Object *m_Layout;
+       };
+}
+
+#endif /* UI_PROCESS_POPUP_H */
index 31d8bb2..60b51da 100644 (file)
@@ -60,7 +60,7 @@ USER_EDCS_FONT_DIRS_ABS =
 # EDC Flags
 USER_EXT_EDC_KEYS = EDC0
 
-USER_EXT_EDC0_EDCS = res/apps-common/edje/apps-common-thumbnail.edc res/apps-common/edje/apps-common-progressbar-layout.edc res/apps-common/edje/apps-common-buttons.edc
+USER_EXT_EDC0_EDCS = res/apps-common/edje/apps-common-thumbnail.edc res/apps-common/edje/apps-common-progressbar-layout.edc res/apps-common/edje/apps-common-popup.edc res/apps-common/edje/apps-common-buttons.edc
 USER_EXT_EDC0_EDCS_IMAGE_DIRS = res
 USER_EXT_EDC0_EDCS_IMAGE_DIRS_ABS =
 USER_EXT_EDC0_EDCS_SOUND_DIRS = edje/sounds
index 6859237..23ef924 100644 (file)
@@ -1,4 +1,4 @@
-set(EDCFILES apps-common-thumbnail.edc apps-common-buttons.edc apps-common-progressbar-layout.edc)
+set(EDCFILES apps-common-thumbnail.edc apps-common-buttons.edc apps-common-progressbar-layout.edc apps-common-popup.edc)
 set(EDJDIR "${RES_DIR}/apps-common/edje")
 
 foreach(EDCFILE ${EDCFILES})
diff --git a/lib-apps-common/res/apps-common/edje/AppsCommonPopup.h b/lib-apps-common/res/apps-common/edje/AppsCommonPopup.h
new file mode 100644 (file)
index 0000000..cc6f588
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+
+#ifndef APPS_COMMON_POPUP_H
+#define APPS_COMMON_POPUP_H
+
+#include "AppsCommonPath.h"
+
+#define APPS_COMMON_POPUP_EDJ APPS_COMMON_EDJ_DIR"apps-common-popup.edj"
+
+#define GROUP_PROCESS_SMALL  "process_small"
+#define GROUP_PROCESS_MEDIUM "process_medium"
+
+#endif /* APPS_COMMON_POPUP_H */
diff --git a/lib-apps-common/res/apps-common/edje/apps-common-popup.edc b/lib-apps-common/res/apps-common/edje/apps-common-popup.edc
new file mode 100644 (file)
index 0000000..96595fe
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 "AppsCommonPopup.h"
+
+#define PROCESS_SMALL_POPUP_H 78
+#define PROCESS_SMALL_PROGRESS_LR 32
+#define PROCESS_SMALL_PROGRESS_WH 44
+#define PROCESS_SMALL_TEXT_SIZE 40
+
+#define PROCESS_MEDIUM_POPUP_H 120
+#define PROCESS_MEDIUM_PROGRESS_LR 32
+#define PROCESS_MEDIUM_PROGRESS_W 56
+#define PROCESS_MEDIUM_TEXT_SIZE 40
+
+styles {
+       style {
+               name: "process_small";
+               base: "font=Tizen:style=Light font_size="PROCESS_SMALL_TEXT_SIZE" align=right color=#3db9ccff";
+       }
+       style {
+               name: "process_medium";
+               base: "font=Tizen:style=Light font_size="PROCESS_MEDIUM_TEXT_SIZE" align=left color=#000000ff";
+       }
+}
+
+collections {
+       base_scale: 2.6;
+
+       group { GROUP_PROCESS_SMALL;
+               parts {
+                       spacer { "spacer.base"; scale;
+                               desc { "default";
+                                       min: 0 PROCESS_SMALL_POPUP_H;
+                               }
+                       }
+                       spacer { "spacer.progress_right"; scale;
+                               desc { "default";
+                                       min: PROCESS_SMALL_PROGRESS_LR 0;
+                                       align: 1.0 0.5;
+                                       rel1.relative: 1.0 0.0;
+                                       rel2.relative: 1.0 1.0;
+                               }
+                       }
+                       swallow { "elm.swallow.content"; scale;
+                               desc { "default";
+                                       min: PROCESS_SMALL_PROGRESS_WH PROCESS_SMALL_PROGRESS_WH;
+                                       align: 1.0 0.5;
+                                       rel1 { relative: 0.0 0.5; to_x: "spacer.progress_right"; }
+                                       rel2 { relative: 0.0 0.5; to_x: "spacer.progress_right"; }
+                               }
+                       }
+                       spacer { "spacer.text_right"; scale;
+                               desc { "default";
+                                       min: PROCESS_SMALL_PROGRESS_LR 0;
+                                       align: 1.0 0.5;
+                                       rel1 { relative: 0.0 0.0; to_x: "elm.swallow.content"; }
+                                       rel2 { relative: 0.0 1.0; to_x: "elm.swallow.content"; }
+                               }
+                       }
+                       textblock { "elm.text"; scale;
+                               desc { "default";
+                                       align: 0.0 0.5;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 0.0 1.0; to_x: "spacer.text_right"; }
+                                       text.style: "process_small";
+                               }
+                       }
+               }
+       }
+
+       group { GROUP_PROCESS_MEDIUM;
+               parts {
+                       spacer { "spacer.base"; scale;
+                               desc { "default";
+                                       min: 0 PROCESS_MEDIUM_POPUP_H;
+                               }
+                       }
+                       spacer { "spacer.progress_left"; scale;
+                               desc { "default";
+                                       min: PROCESS_MEDIUM_PROGRESS_LR 0;
+                                       align: 0.0 0.5;
+                                       rel1.relative: 0.0 0.0;
+                                       rel2.relative: 0.0 1.0;
+                               }
+                       }
+                       swallow { "elm.swallow.content"; scale;
+                               desc { "default";
+                                       min: PROCESS_MEDIUM_PROGRESS_W 0;
+                                       align: 0.0 0.5;
+                                       rel1 { relative: 1.0 0.5; to_x: "spacer.progress_left"; }
+                                       rel2 { relative: 1.0 0.5; to_x: "spacer.progress_left"; }
+                               }
+                       }
+                       spacer { "spacer.text_left"; scale;
+                               desc { "default";
+                                       min: PROCESS_MEDIUM_PROGRESS_LR 0;
+                                       align: 0.0 0.5;
+                                       rel1 { relative: 1.0 0.0; to_x: "elm.swallow.content"; }
+                                       rel2 { relative: 1.0 1.0; to_x: "elm.swallow.content"; }
+                               }
+                       }
+                       textblock { "elm.text"; scale;
+                               desc { "default";
+                                       align: 0.0 0.5;
+                                       rel1 { relative: 1.0 0.0; to_x: "spacer.text_left"; }
+                                       rel2 { relative: 1.0 1.0; }
+                                       text.style: "process_medium";
+                               }
+                       }
+               }
+       }
+}
diff --git a/lib-apps-common/src/Ui/ProcessPopup.cpp b/lib-apps-common/src/Ui/ProcessPopup.cpp
new file mode 100644 (file)
index 0000000..26f7396
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 "Ui/ProcessPopup.h"
+#include "Ui/Window.h"
+
+#include "App/Path.h"
+#include "AppsCommonPopup.h"
+
+#include <efl_extension.h>
+
+using namespace Ui;
+
+ProcessPopup::ProcessPopup(Size size)
+       : m_Size(size), m_Layout(nullptr)
+{
+       setBackCallback([]{ return false; });
+}
+
+ProcessPopup *ProcessPopup::create(Evas_Object *parent, const char *text, Size size)
+{
+       ProcessPopup *popup = new ProcessPopup(size);
+       popup->create(parent);
+       popup->setText(text);
+       return popup;
+}
+
+void ProcessPopup::setText(const char *text)
+{
+       elm_object_translatable_part_text_set(m_Layout, "elm.text", text);
+}
+
+Evas_Object *ProcessPopup::onCreate(Evas_Object *parent)
+{
+       static struct {
+               const char *layout;
+               const char *progress;
+       } styles[] = {
+               /* SizeSmall =  */ { GROUP_PROCESS_SMALL,  "process_small"  },
+               /* SizeMedium = */ { GROUP_PROCESS_MEDIUM, "process_medium" }
+       };
+
+       Evas_Object *popup = Popup::onCreate(parent);
+       auto &style = styles[m_Size];
+
+       m_Layout = elm_layout_add(popup);
+       elm_layout_file_set(m_Layout, App::getResourcePath(APPS_COMMON_POPUP_EDJ).c_str(), style.layout);
+       elm_object_content_set(popup, m_Layout);
+
+       Evas_Object *progressbar = elm_progressbar_add(m_Layout);
+       elm_object_style_set(progressbar, style.progress);
+       elm_progressbar_pulse_set(progressbar, EINA_TRUE);
+       elm_progressbar_pulse(progressbar, EINA_TRUE);
+       elm_object_content_set(m_Layout, progressbar);
+
+       return popup;
+}