<targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.1359202976" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/taskmanager}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.1995741082" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
<tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.1817006367" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
- <tool command="i386-linux-gnueabi-g++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.1770946160" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.1770946160" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
<option id="gnu.cpp.compiler.option.optimization.level.1345501733" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.1210835446" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
<option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.1883867003" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/>
<option id="sbi.gnu.cpp.compiler.option.1516130097" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
- <listOptionValue builtIn="false" value="wearable-3.0-emulator.core.private_gcc49.i386.core.app"/>
+ <listOptionValue builtIn="false" value="wearable-3.0-emulator.core.private_llvm37.i386.core.app"/>
</option>
<option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.371616908" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
<listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/>
<option id="gnu.cpp.compiler.option.dialect.std.1800306444" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++1y" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1246859271" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
- <tool command="i386-linux-gnueabi-gcc" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.944164800" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+ <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.944164800" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.669046459" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
<option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.146661021" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
<option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.480122954" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/>
<option id="sbi.gnu.c.compiler.option.756861607" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
- <listOptionValue builtIn="false" value="wearable-3.0-emulator.core.private_gcc49.i386.core.app"/>
+ <listOptionValue builtIn="false" value="wearable-3.0-emulator.core.private_llvm37.i386.core.app"/>
</option>
<option id="sbi.gnu.c.compiler.option.frameworks_inc.core.793002243" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
<listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1206948254" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.1529618324" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
- <tool command="i386-linux-gnueabi-g++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.2042523143" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.2042523143" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
<option defaultValue="false" id="sbi.gnu.cpp.linker.option.shared_flag.core.801463445" name="Linker.Shared" superClass="sbi.gnu.cpp.linker.option.shared_flag.core" valueType="boolean"/>
<option defaultValue="false" id="sbi.gnu.cpp.linker.option.noundefined.core.612946377" name="Report unresolved symbol references (-Wl,--no-undefined)" superClass="sbi.gnu.cpp.linker.option.noundefined.core" valueType="boolean"/>
<option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.1145756352" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
#define ANIM_ITEM_EDJ "anim-item.edj"
#define TASK_ITEM_EDJ "task-item.edj"
#define ICONS_EDJ "icons.edj"
+#define APP_ICON_IMG "taskmanager.png"
#endif /* RESOURCE_H_ */
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
type: SWALLOW;
scale: 1;
description { state: "default" 0.0;
- visible: 1;
+ visible: 0;
}
- description { state: "hide" 0.0;
+ description { state: "show" 0.0;
inherit: "default" 0.0;
- visible: 0;
+ visible: 1;
}
}
part {
}
programs {
program {
- name : "show_bg";
- signal : "show_bg";
+ name : "hide_bg";
+ signal : "hide_bg";
source : "*";
action : STATE_SET "default" 0.0;
- target : "swl.bg";
+ target : "swl.bg";
}
program {
- name : "hide_bg";
- signal : "hide_bg";
+ name : "show_bg";
+ signal : "show_bg";
source : "*";
- action : STATE_SET "hide" 0.0;
- target : "swl.bg";
+ action : STATE_SET "show" 0.0;
+ target : "swl.bg";
}
program {
name : "close,clicked";
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
#ifndef App_h_
#define App_h_
+#include "TaskMngrService.h"
+
#include <app.h>
#include <app_control.h>
-
-#include "TaskMngrService.h"
+#include <Evas.h>
namespace TaskMngr {
class Window;
void onLowBattery(app_event_info_h appEvent);
void onRegionChanged(app_event_info_h appEvent);
+ void onHwBackButton(Evas_Object *obj, void *event_info);
+
private:
static App m_AppInst;
Window *m_pWindow;
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
private:
int m_IndexSize;
int m_SelectedIndex;
- bool m_IsSelected;
};
}
#endif /* IndexView_h_ */
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
#include "MainLayout.h"
#include "TaskListView.h"
+#include "IndexView.h"
namespace TaskMngr {
class MainController
MainController(Evas_Object *parent);
virtual ~MainController();
- private:
+ void pause();
+ void resume();
+
+ protected:
// MainLayout:
void onCloseAllButtonClicked() override;
// ITaskListViewListener:
- void onPageChanged() override;
- void onKillAnimFinished(TaskListViewItem &item) override;
+ void onListChanged(TaskListView &obj, int itemsCount) override;
+ void onCurrentPageChanged(TaskListView &obj) override;
void onClicked(TaskListViewItem &item) override;
- void onKillAllAnimFinished() override;
+ void onItemBeforeDelete(TaskListViewItem &item) override;
+
+ private:
+ void update();
+ void updateIndex(int itemsCount);
+ void updateNoContents(int itemsCount);
private:
TaskListView *m_pTaskListView;
+ IndexView *m_pIndexView;
};
}
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
virtual void onCloseAllButtonClicked() {};
private:
+ void prepareNoContents();
+
+ private:
Evas_Object *m_pNoContent;
};
}
#include "View.h"
#include "TaskListViewItem.h"
+#include <vector>
+#include <Ecore.h>
+
namespace TaskMngr
{
class ITaskListViewListener;
void setListener(ITaskListViewListener *listener);
void appendItem(TaskListViewItem &item);
+ std::vector<TaskListViewItem*> getItems() const;
+ int getItemsCount() const;
+ int getCurrentPageIndex() const;
TaskListViewItem *getCurrentPage() const;
- void playKillAllAnim();
- void freezeScrollPush();
- void freezeScrollPop();
+ void killAll();
+ void clear();
private:
Evas_Object *createPadding();
+ void freezeScrollPush();
+ void freezeScrollPop();
+
void onDelRequest(TaskListViewItem &item);
void onAppClicked(TaskListViewItem &item);
+ void onPageChanged(Evas_Object *obj, void *event_info);
+ Eina_Bool onBoxSizeChangedIlder();
+ void onBoxSizeChanged(Evas *e, Evas_Object *obj, void *event_info);
+
private:
ITaskListViewListener *m_pListener;
Evas_Object *m_pScroller;
Evas_Object *m_pBox;
Evas_Object *m_RightPadding;
+ Evas_Object *m_LeftPadding;
AppInfo m_AppInfo;
+ Ecore_Idler *m_pBoxSizeChangedIdler;
+ int m_LastItemsCount;
};
class ITaskListViewListener
{
public:
virtual ~ITaskListViewListener() {}
- virtual void onPageChanged() {};
- virtual void onKillAnimFinished(TaskListViewItem &item) {};
+ virtual void onListChanged(TaskListView &obj, int itemsCount) {};
+ virtual void onCurrentPageChanged(TaskListView &obj) {};
virtual void onClicked(TaskListViewItem &item) {};
- virtual void onKillAllAnimFinished() {};
+ virtual void onItemBeforeDelete(TaskListViewItem &item) {};
};
}
void playKillAnim();
void playKillUpAnim();
void playKillDownAnim();
+ const AppInfo &getAppInfo() const;
private:
void onMove(Evas *e, Evas_Object *obj, void *event_info);
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
#include <vector>
#include <app_info.h>
#include <rua.h>
+#include <rua_util.h>
namespace TaskMngr {
struct AppInfo {
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
#include "Window.h"
#include "MainController.h"
+#include <efl_extension.h>
+
using namespace TaskMngr;
App App::m_AppInst;
m_pWindow = new Window;
m_pWindow->show();
+ eext_object_event_callback_add(*m_pWindow, EEXT_CALLBACK_BACK, makeCbFirst(&App::onHwBackButton), this);
m_pRootController = new MainController(m_pWindow->getHostEvasObject());
m_pWindow->setContent(*m_pRootController);
return true;
}
+void App::onHwBackButton(Evas_Object *obj, void *event_info)
+{
+ LOG("");
+ if (m_pWindow)
+ m_pWindow->lower();
+}
+
void App::onTerminate()
{
TRACE;
void App::onPause()
{
TRACE;
+ if (m_pRootController)
+ m_pRootController->pause();
}
void App::onResume()
{
TRACE;
+ if (m_pRootController)
+ m_pRootController->resume();
}
void App::onControl(app_control_h app_control)
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
#include <vector>
#include <string>
+#include "Logger.h"
+
using namespace TaskMngr;
namespace {
IndexView::IndexView(Evas_Object *parent)
: m_IndexSize(0)
, m_SelectedIndex(-1)
- , m_IsSelected(false)
{
setEo(elm_index_add(parent));
setStyle("circle");
- expand();
setHorizontal(true);
setAutohide(false);
- show(true);
}
IndexView::~IndexView()
{
-
}
void IndexView::setSelectedItem(int index, bool value)
{
- if(index != m_SelectedIndex || value != m_IsSelected) {
+ if (index != m_SelectedIndex) {
m_SelectedIndex = index;
- m_IsSelected = value;
elm_index_item_selected_set(findItem(index), value);
}
}
void IndexView::setItemsCount(int size)
{
- if(size != m_IndexSize)
- {
- m_IndexSize = size;
- clear();
- }
+ if (size == m_IndexSize)
+ return;
+
+ m_IndexSize = size;
+ clear();
if (size > maxScrollSize)
size = maxScrollSize;
void IndexView::clear()
{
+ m_SelectedIndex = -1;
elm_index_item_clear(getEo());
}
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
MainController::MainController(Evas_Object *parent)
: MainLayout(parent)
, m_pTaskListView(nullptr)
+ , m_pIndexView(nullptr)
{
m_pTaskListView = new TaskListView(getEo());
m_pTaskListView->setListener(this);
setList(*m_pTaskListView);
+ m_pIndexView = new IndexView(getEo());
+ setIndex(*m_pIndexView);
+ update();
+}
+
+MainController::~MainController()
+{
+}
+
+void MainController::update()
+{
+ m_pTaskListView->clear();
+ auto list = App::getInst().getTaskMngr().getAppInfo();
+ for (const AppInfo &appInfo : list) {
+ m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
+ }
+
//TODO: only for test will be removed.
- AppInfo appInfo;
+/* AppInfo appInfo;
appInfo.icon = PathUtils::getResourcePath("images/test.jpg");
appInfo.name = "Hello";
m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
- m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
- m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
- m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
- m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
- m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
- m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
- m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
+ m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));*/
+ int itemsCount = m_pTaskListView->getItemsCount();
+ updateIndex(itemsCount);
+ updateNoContents(itemsCount);
+}
- auto list = App::getInst().getTaskMngr().getAppInfo();
- for (const AppInfo &appInfo : list) {
- m_pTaskListView->appendItem(*new TaskListViewItem(*m_pTaskListView, appInfo));
- }
+void MainController::updateIndex(int itemsCount)
+{
+ m_pIndexView->setItemsCount(itemsCount);
+ m_pIndexView->setSelectedItem(m_pTaskListView->getCurrentPageIndex());
}
-MainController::~MainController()
+void MainController::updateNoContents(int itemsCount)
{
+ bool empty = itemsCount <= 0;
+ showNoContents(empty);
+ showCloseButton(!empty);
}
-void MainController::onCloseAllButtonClicked()
+void MainController::pause()
{
LOG("");
}
-void MainController::onPageChanged()
+void MainController::resume()
{
LOG("");
+ update();
+}
+
+void MainController::onCloseAllButtonClicked()
+{
+ LOG("");
+ m_pTaskListView->killAll();
+}
+
+void MainController::onListChanged(TaskListView &obj, int itemsCount)
+{
+ LOG("", itemsCount);
+ if (itemsCount <= 0)
+ App::getInst().exit();
+ updateIndex(itemsCount);
+ updateNoContents(itemsCount);
}
-void MainController::onKillAnimFinished(TaskListViewItem &item)
+void MainController::onCurrentPageChanged(TaskListView &obj)
{
LOG("");
+ updateIndex(m_pTaskListView->getItemsCount());
}
void MainController::onClicked(TaskListViewItem &item)
{
LOG("");
+ App::getInst().getTaskMngr().launchApp(item.getAppInfo().appid, item.getAppInfo().uri);
}
-void MainController::onKillAllAnimFinished()
+void MainController::onItemBeforeDelete(TaskListViewItem &item)
{
LOG("");
+ App::getInst().getTaskMngr().killApp(item.getAppInfo().appid, item.getAppInfo().instanceId);
}
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
#include "MainLayout.h"
#include "Resource.h"
+#include "PathUtils.h"
+#include "Logger.h"
using namespace TaskMngr;
setContent(obj, "swl.index");
}
+void MainLayout::prepareNoContents()
+{
+ if (m_pNoContent)
+ return;
+
+ m_pNoContent = elm_layout_add(getEo());
+ elm_layout_theme_set(m_pNoContent, "layout", "nocontents", "text");
+ Evas_Object *icon = elm_image_add(m_pNoContent);
+ elm_image_file_set(icon, PathUtils::getSharedResPath(APP_ICON_IMG).c_str(), nullptr);
+ elm_object_part_content_set(m_pNoContent, "elm.swallow.icon", icon);
+ elm_object_part_text_set(m_pNoContent, "elm.text.title", "Recent apps"); // TODO: localization
+ elm_object_part_text_set(m_pNoContent, "elm.text", "No recent apps"); // TODO: localization
+ emitSignal(m_pNoContent, "elm,state,title,enable", "elm");
+ setContent(m_pNoContent, "swl.bg");
+}
+
void MainLayout::showNoContents(bool show)
{
- if (show && !m_pNoContent) {
- m_pNoContent = elm_layout_add(getEo());
- elm_layout_theme_set(getEo(), "layout", "nocontents", "text");
- setContent(m_pNoContent, "swl.bg");
- }
+ if (show)
+ prepareNoContents();
const char *sig = show ? "show_bg" : "hide_bg";
emitSignal(sig, "*");
#include "TaskListView.h"
#include "App.h"
#include "Window.h"
+#include "Logger.h"
+#include "Callback.h"
+
#include <efl_extension.h>
using namespace TaskMngr;
, m_pScroller(nullptr)
, m_pBox(nullptr)
, m_RightPadding(nullptr)
+ , m_LeftPadding(nullptr)
+ , m_pBoxSizeChangedIdler(nullptr)
+ , m_LastItemsCount(0)
{
m_pScroller = elm_scroller_add(parent);
setEo(m_pScroller);
elm_scroller_page_scroll_limit_set(m_pScroller, 1, 0);
elm_object_scroll_lock_y_set(m_pScroller, true);
elm_object_style_set(m_pScroller, "effect");
+ evas_object_smart_callback_add(m_pScroller, "scroll,page,changed", makeCbFirst(&TaskListView::onPageChanged), this);
Evas_Object *circleScroller = eext_circle_object_scroller_add(m_pScroller, nullptr);
eext_circle_object_scroller_policy_set(circleScroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
eext_rotary_object_event_activated_set(circleScroller, true);
evas_object_show(circleScroller);
- m_pBox = elm_box_add(m_pScroller);
- elm_box_pack_end(m_pBox, createPadding());
m_RightPadding = createPadding();
+ m_LeftPadding = createPadding();
+
+ m_pBox = elm_box_add(m_pScroller);
+ expand(m_pBox);
+ elm_box_pack_end(m_pBox, m_LeftPadding);
elm_box_pack_end(m_pBox, m_RightPadding);
elm_box_horizontal_set(m_pBox, true);
elm_box_homogeneous_set(m_pBox, false);
- expand(m_pBox);
+ evas_object_event_callback_add(m_pBox, EVAS_CALLBACK_RESIZE, makeCbFirst(&TaskListView::onBoxSizeChanged), this);
elm_object_content_set(m_pScroller, m_pBox);
}
TaskListView::~TaskListView()
{
+ if (m_pBoxSizeChangedIdler)
+ ecore_idler_del(m_pBoxSizeChangedIdler);
}
Evas_Object *TaskListView::createPadding()
void TaskListView::setListener(ITaskListViewListener *listener)
{
- m_pListener = nullptr;
+ m_pListener = listener;
}
void TaskListView::appendItem(TaskListViewItem &item)
TaskListViewItem *TaskListView::getCurrentPage() const
{
- return nullptr;
+ TaskListViewItem *res = nullptr;
+ Eina_List *list = elm_box_children_get(m_pBox);
+
+ if (list) {
+ int currentIndex = getCurrentPageIndex();
+ int count = eina_list_count(list);
+ if (currentIndex >=0 && currentIndex < count)
+ res = staticCast<TaskListViewItem*>(eina_list_nth(list, currentIndex));
+ }
+
+ return res;
+}
+
+int TaskListView::getItemsCount() const
+{
+ int res = 0;
+ Eina_List *list = elm_box_children_get(m_pBox);
+ if (list) {
+ res = eina_list_count(list) - 2; // 2 paddings
+ eina_list_free(list);
+ }
+ return res;
}
-void TaskListView::playKillAllAnim()
+std::vector<TaskListViewItem*> TaskListView::getItems() const
{
+ std::vector<TaskListViewItem*> res;
+
+ Eina_List *list = elm_box_children_get(m_pBox);
+ if (list) {
+ Eina_List *l = nullptr;
+ void *data = nullptr;
+
+ res.reserve(eina_list_count(list));
+
+ EINA_LIST_FOREACH(list, l, data) {
+ Evas_Object *obj = (Evas_Object*)data;
+ if (obj == m_LeftPadding || obj == m_RightPadding)
+ continue;
+
+ res.push_back(staticCast<TaskListViewItem*>(obj));
+ }
+
+ eina_list_free(list);
+ }
+
+ return res;
+}
+
+int TaskListView::getCurrentPageIndex() const
+{
+ int index = 0;
+ elm_scroller_current_page_get(m_pScroller, &index, nullptr);
+ return index;
+}
+
+void TaskListView::killAll()
+{
+ auto items = getItems();
+ for (TaskListViewItem *item : items) {
+ item->playKillAnim();
+ }
+}
+
+void TaskListView::clear()
+{
+ Eina_List *list = elm_box_children_get(m_pBox);
+ if (list) {
+ Eina_List *l = nullptr;
+ void *data = nullptr;
+ EINA_LIST_FOREACH(list, l, data) {
+ Evas_Object *obj = (Evas_Object*)data;
+
+ if (obj == m_LeftPadding || obj == m_RightPadding)
+ continue;
+ evas_object_del(obj);
+ }
+ eina_list_free(list);
+ }
}
void TaskListView::freezeScrollPush()
void TaskListView::onDelRequest(TaskListViewItem &item)
{
-
+ LOG("");
+ if (m_pListener)
+ m_pListener->onItemBeforeDelete(item);
+ item.destroy();
}
void TaskListView::onAppClicked(TaskListViewItem &item)
{
+ LOG("");
+ if (m_pListener)
+ m_pListener->onClicked(item);
+}
+
+void TaskListView::onPageChanged(Evas_Object *obj, void *event_info)
+{
+ LOG("");
+ if (m_pListener)
+ m_pListener->onCurrentPageChanged(*this);
+}
+Eina_Bool TaskListView::onBoxSizeChangedIlder()
+{
+ LOG("Current index:", getCurrentPageIndex());
+ m_pBoxSizeChangedIdler = nullptr;
+ int lastItemsCount = getItemsCount();
+ if (lastItemsCount != m_LastItemsCount) {
+ m_LastItemsCount = lastItemsCount;
+ if (m_pListener)
+ m_pListener->onListChanged(*this, m_LastItemsCount);
+ }
+ return false;
+}
+
+void TaskListView::onBoxSizeChanged(Evas *e, Evas_Object *obj, void *event_info)
+{
+ if (!m_pBoxSizeChangedIdler) {
+ m_pBoxSizeChangedIdler = ecore_idler_add(makeCbFirst(&TaskListView::onBoxSizeChangedIlder), this);
+ }
}
}
+const AppInfo &TaskListViewItem::getAppInfo() const
+{
+ return m_AppInfo;
+}
+
void TaskListViewItem::setIcon(const std::string &path)
{
if (path.empty())
if (m_IsKillAnimPlaying)
return;
- static const double killThreshold = 0.3;
+ static const double killThreshold = 0.25;
m_IsMouseDown = false;
if (m_IsDragStart) {
LOG("");
m_IsKillAnimPlaying = false;
m_Parent.onDelRequest(*this);
- destroy();
}
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
, Tail... msg)
{
std::ostringstream messageStr;
- std::initializer_list<bool> { (messageStr << msg, true)... };
+ (void)std::initializer_list<bool> { (messageStr << msg, true)... };
dlog_print(static_cast<log_priority>(prior)
, tag, "%s: %s(%d) -> %s", file, function, line
, messageStr.str().c_str());
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
* @return absolute path to file
*/
std::string getEdjePath(const std::string &fileName);
+
+ /**
+ * @brief Gets the absolute path to app. shared resource file
+ * @param[in] base file name
+ * @return absolute path to file
+ */
+ std::string getSharedResPath(const std::string &fileName);
};
}
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
return getResourcePath(EDJ_PATH"/" + fileName);
}
+std::string getSharedResPath(const std::string &fileName)
+{
+ std::string res;
+ static std::string basePath;
+ if (basePath.empty()) {
+ char *path = app_get_shared_resource_path();
+ if (path) {
+ basePath = path;
+ free(path);
+ }
+ }
+
+ res += basePath;
+ res += fileName;
+
+ return res;
+}
+
} // PathUtils
} // TaskMngr
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.
/*
- * Copyright 2017 Samsung Electronics Co., Ltd
+ * 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.