New message view implemented and messaging view modified as per new UX guidelines. 62/46762/1
authorpolu.sandeep <polu.sandeep@samsung.com>
Wed, 26 Aug 2015 01:34:57 +0000 (10:34 +0900)
committerpolu.sandeep <polu.sandeep@samsung.com>
Wed, 26 Aug 2015 01:34:57 +0000 (10:34 +0900)
Change-Id: Ie41e13448a3d20278d596914058a793af1dfef54

TelegramTizen/db_manager/tg_db_manager.c
TelegramTizen/db_manager/tg_db_manager.h
TelegramTizen/inc/tg_first_registration.h
TelegramTizen/inc/tg_login.h
TelegramTizen/src/telegramtizen.c
TelegramTizen/src/tg_buddy_list.c
TelegramTizen/src/tg_db_wrapper.c
TelegramTizen/src/tg_first_registration.c
TelegramTizen/src/tg_login.c
TelegramTizen/src/tg_registration.c
TelegramTizen/tg_utils/tg_common.h

index 31bcc2e..99a9d72 100644 (file)
@@ -325,7 +325,7 @@ Eina_Bool get_values_from_table(sqlite3* db, const char* table_name, Eina_List*
        return EINA_TRUE;
 }
 
-Eina_List* get_values_from_table_sync_order_by(sqlite3* db, const char* table_name, Eina_List* column_names, Eina_List* column_types, const char* order_column, Eina_Bool is_asc)
+Eina_List* get_values_from_table_sync_order_by(sqlite3* db, const char* table_name, Eina_List* column_names, Eina_List* column_types, const char* order_column, Eina_Bool is_asc, const char* where_clause)
 {
        Eina_List* query_vals = NULL;
 
@@ -397,6 +397,13 @@ Eina_List* get_values_from_table_sync_order_by(sqlite3* db, const char* table_na
        var_query = realloc(var_query, strlen(var_query) + strlen(table_name) + 1);
        strcat(var_query, table_name);
 
+       if (where_clause) {
+               var_query = realloc(var_query, strlen(var_query)+strlen(" WHERE ") + 1);
+               strcat(var_query, " WHERE ");
+               var_query = realloc(var_query, strlen(var_query)+strlen(where_clause) + 1);
+               strcat(var_query, where_clause);
+       }
+
        if (order_column) {
                var_query = realloc(var_query, strlen(var_query)+strlen(" ORDER BY ") + 1);
                strcat(var_query, " ORDER BY ");
@@ -411,6 +418,8 @@ Eina_List* get_values_from_table_sync_order_by(sqlite3* db, const char* table_na
                }
        }
 
+
+
        var_query = realloc(var_query, strlen(var_query) + 2);
        strcat(var_query, ";");
 
index d643683..7b4e536 100644 (file)
@@ -17,7 +17,7 @@ extern Eina_Bool insert_table(sqlite3* db, const char* table_name, Eina_List* co
 extern Eina_Bool update_table(sqlite3* db, const char* table_name, Eina_List* column_names, Eina_List* column_types, Eina_List* column_values, const char* where_clause);
 extern Eina_Bool get_values_from_table(sqlite3* db, const char* table_name, Eina_List* column_names, int (*callback)(void*,int,char**,char**), const char* where_clause, void* data_to_callback);
 extern Eina_List* get_values_from_table_sync(sqlite3* db, const char* table_name, Eina_List* column_names, Eina_List* column_types, const char* where_clause);
-extern Eina_List* get_values_from_table_sync_order_by(sqlite3* db, const char* table_name, Eina_List* column_names, Eina_List* column_types, const char* order_column, Eina_Bool is_asc);
+extern Eina_List* get_values_from_table_sync_order_by(sqlite3* db, const char* table_name, Eina_List* column_names, Eina_List* column_types, const char* order_column, Eina_Bool is_asc, const char* where_clause);
 extern Eina_Bool close_database(sqlite3* db);
 
 
index 941c96c..e97cdb0 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "tg_common.h"
 
-extern void launch_first_registration_cb(void *data);
+extern void launch_first_registration_cb(appdata_s *ad);
 
 
 
index b801721..e9b030d 100644 (file)
@@ -11,6 +11,6 @@
 
 #include "tg_common.h"
 
-extern void launch_login_cb(void *data);
+extern void launch_login_cb(appdata_s* ad);
 
 #endif /* TG_LOGIN_H_ */
index c36b5fd..22054a3 100644 (file)
@@ -11,6 +11,7 @@
 #include "server_requests.h"
 #include "tg_buddy_chat_view.h"
 #include "tg_init_screen.h"
+#include "tg_user_main_view.h"
 
 static void
 popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
@@ -723,7 +724,13 @@ static int _on_service_client_msg_received_cb(void *data, bundle *const rec_msg)
                        load_group_chat_data(app);
                        load_peer_data(app);
                        elm_naviframe_item_pop(app->nf);
-                       launch_buddy_list_cb(app);
+
+                       //launch_buddy_list_cb(app);
+
+                       launch_user_main_view_cb(app);
+
+
+
                } else if (app->current_app_state == TG_BUDDY_LIST_STATE) {
                        refresh_buddy_list(app);
                } else {
@@ -1226,18 +1233,31 @@ void app_nf_back_cb(void *data, Evas_Object *obj, void *event_info)
                case TG_INIT_SCREEN_STATE:
                        elm_win_lower(ad->win);
                        elm_exit();
-               break;
+                       break;
+               case TG_START_MESSAGING_VIEW_STATE:
+                       elm_naviframe_item_pop(ad->nf);
+                       ad->current_app_state = TG_USER_MAIN_VIEW_STATE;
+                       break;
                case TG_REGISTRATION_STATE:
                        elm_win_lower(ad->win);
                        elm_exit();
                        break;
                case TG_LOGIN_STATE:
+
+                       if (ad->timer_value > 0) {
+                               Ecore_Timer* timer = evas_object_data_get(ad->nf, "code_timer");
+                               if (timer)
+                                       ecore_timer_del(timer);
+                       }
+
                        elm_naviframe_item_pop(ad->nf);
                        ad->current_app_state = TG_REGISTRATION_STATE;
                        break;
                case TG_PROFILE_REGISTRATION_STATE:
-                       ad->current_app_state = TG_REGISTRATION_STATE;
-                       elm_naviframe_item_pop(ad->nf);
+/*                     ad->current_app_state = TG_REGISTRATION_STATE;
+                       elm_naviframe_item_pop(ad->nf);*/
+                       elm_win_lower(ad->win);
+                       elm_exit();
                        break;
                case TG_BUDDY_LIST_STATE:
                        evas_object_data_set(ad->nf, "buddy_list", NULL);
@@ -1372,9 +1392,8 @@ static void create_base_gui(appdata_s *ad)
        if (!user_info) {
                elm_naviframe_item_pop(ad->nf);
                ad->current_app_state = TG_REGISTRATION_STATE;
-               //launch_registration_cb(ad);
-               //launch_first_registration_cb(ad);
                launch_init_screen(ad);
+               //launch_user_main_view_cb(ad);
        } else {
                //show_toast(ad, "user already registered");
                load_registered_user_data(ad, user_info);
@@ -1383,7 +1402,8 @@ static void create_base_gui(appdata_s *ad)
                load_peer_data(ad);
                // Launch buddy list view
                elm_naviframe_item_pop(ad->nf);
-               launch_buddy_list_cb(ad);
+               //launch_buddy_list_cb(ad);
+               launch_user_main_view_cb(ad);
        }
        //eina_list_free(user_info);
 }
index fc9e17f..b667cfc 100644 (file)
@@ -348,20 +348,6 @@ void on_search_clicked(void *data, Evas_Object *obj, void *event_info)
        refresh_buddy_list(ad);
 }
 
-Evas_Object* create_button(Evas_Object *parent, char *style, char *text)
-{
-       Evas_Object *button;
-
-       button = elm_button_add(parent);
-       if (style)
-               elm_object_style_set(button, style);
-       if (text)
-               elm_object_text_set(button, text);
-       evas_object_show(button);
-
-       return button;
-}
-
 void left_panel_button_clicked_cb(void *data, Evas_Object * obj, void *event_info)
 {
        appdata_s *ad = data;
index eeadc7d..4231df7 100644 (file)
@@ -335,7 +335,7 @@ Eina_List* get_all_peer_details()
                col_types = eina_list_append(col_types, TG_DB_COLUMN_INTEGER);
 
                //peer_details = get_values_from_table_sync(db, table_name, col_names, col_types, NULL);
-               peer_details = get_values_from_table_sync_order_by(db, table_name, col_names, col_types, PEER_INFO_TABLE_LAST_MESSAGE_DATE, EINA_FALSE);
+               peer_details = get_values_from_table_sync_order_by(db, table_name, col_names, col_types, PEER_INFO_TABLE_LAST_MESSAGE_DATE, EINA_FALSE, NULL);
 
                eina_list_free(col_names);
                eina_list_free(col_types);
@@ -645,7 +645,15 @@ Eina_List* get_buddy_list_info()
                col_types = eina_list_append(col_types, TG_DB_COLUMN_INTEGER);
                col_types = eina_list_append(col_types, TG_DB_COLUMN_INTEGER);
 
-               user_details = get_values_from_table_sync(db, table_name, col_names, col_types, NULL);
+
+               char* where_clause = (char*)malloc(strlen(BUDDY_INFO_TABLE_REAL_FIRST_NAME) + strlen(" <> ") + strlen("'Telegram'") + 1);
+               strcpy(where_clause, BUDDY_INFO_TABLE_REAL_FIRST_NAME);
+               strcat(where_clause, " <> ");
+               strcat(where_clause, "'Telegram'");
+
+
+               //user_details = get_values_from_table_sync(db, table_name, col_names, col_types, NULL);
+               user_details = get_values_from_table_sync_order_by(db, table_name, col_names, col_types, BUDDY_INFO_TABLE_PRINT_NAME, EINA_TRUE, where_clause);
 
                eina_list_free(col_names);
                eina_list_free(col_types);
index 3c04214..e16864a 100644 (file)
 
 #include "tg_first_registration.h"
 #include "server_requests.h"
+#include "tg_user_main_view.h"
 
-static void on_submit_button_clicked(void *data, Evas_Object *btn, void *ev)
+#define NAME_INFO_TEXT "Set up your first and last name"
+
+static void on_first_name_change_enable_ok_button(void *data, Evas_Object *obj, void *event_info)
 {
-       appdata_s* ad = evas_object_data_get(btn, "app_data");
-       Evas_Object* first_name_entry = evas_object_data_get(btn, "first_name_entry");
-       Evas_Object* last_name_entry = evas_object_data_get(btn, "last_name_entry");
+       appdata_s* ad = data;
+       Evas_Object* done_btn = evas_object_data_get(ad->nf, "name_done_btn");
+       char buf[256] = {'\0',};
+       snprintf(buf, sizeof(buf), "%s", elm_object_text_get(obj));
+       char* org_buf = trim(buf);
+
+       if (strlen(org_buf) > 0) {
+               elm_object_disabled_set(done_btn, EINA_FALSE);
+       } else {
+               elm_object_disabled_set(done_btn, EINA_TRUE);
+       }
+       free(org_buf);
+}
 
-       const char* first_name = elm_object_text_get(first_name_entry);
-       if (!first_name) {
+
+static void on_name_entry_done_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       appdata_s* ad = data;
+#if 1
+       Evas_Object* first_name_entry = evas_object_data_get(ad->nf, "first_name_entry");
+       Evas_Object* last_name_entry = evas_object_data_get(ad->nf, "second_name_entry");
+       const char* tfirst_name = elm_object_text_get(first_name_entry);
+       if (!tfirst_name) {
                show_toast(ad, "Enter first name");
                return;
        }
-
-       const char* last_name = elm_object_text_get(last_name_entry);
-       if (!last_name) {
-               last_name = "";
+       const char* tlast_name = elm_object_text_get(last_name_entry);
+       if (!tlast_name) {
+               tlast_name = "";
        }
+       char* first_name = trim((char*)tfirst_name);
+       char* last_name = trim((char*)tlast_name);
        send_request_for_profile_registration(ad->service_client, first_name, last_name);
+       free(first_name);
+       free(last_name);
+#else
+       elm_naviframe_item_pop(ad->nf);
+       launch_user_main_view_cb(ad);
+#endif
 }
 
 
-void launch_first_registration_cb(void *data)
+
+void launch_first_registration_cb(appdata_s *ad)
 {
-       appdata_s* ad = data;
+
+       if (!ad)
+               return;
+       ad->current_app_state = TG_PROFILE_REGISTRATION_STATE;
 
        char edj_path[PATH_MAX] = {0, };
+       app_get_resource(TELEGRAM_INIT_VIEW_EDJ, edj_path, (int)PATH_MAX);
 
-       ad->current_app_state = TG_PROFILE_REGISTRATION_STATE;
-       ad->is_first_time_registration = EINA_TRUE;
+       Evas_Object* scroller = elm_scroller_add(ad->nf);
+       elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+       elm_scroller_policy_set(scroller,ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+       elm_win_resize_object_add(ad->win, scroller);
+
+       Evas_Object* layout = elm_layout_add(ad->nf);
+       elm_layout_file_set(layout, edj_path, "name_reg_screen");
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_show(layout);
+       elm_object_content_set(scroller, layout);
+
+       char* info_txt = NULL;
+       info_txt = (char*)malloc(strlen(NAME_INFO_TEXT) + 1);
+       strcpy(info_txt, NAME_INFO_TEXT);
+
+       char temp_txt[512] = {0,};
+       snprintf(temp_txt, sizeof(temp_txt), "<font=Tizen:style=Regular color=#666362 align=left><font_size=32>%s</font_size></font>", info_txt);
+       free(info_txt);
+
+       Evas_Object* info_btn = elm_entry_add(layout);
+       elm_object_text_set(info_btn, temp_txt);
+       evas_object_size_hint_weight_set(info_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(info_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       elm_entry_single_line_set(info_btn,  EINA_FALSE);
+       elm_entry_editable_set(info_btn, EINA_FALSE);
+       elm_entry_line_wrap_set(info_btn, EINA_TRUE);
+       evas_object_show(info_btn);
+       elm_object_part_content_set(layout, "setup_guide_text", info_btn);
 
-       Evas_Coord w, h;
-       elm_win_screen_size_get(ad->win, NULL, NULL, &w, &h);
-       h -= 130;
 
-       // creating main layout
-       Evas_Object* main_layout = elm_layout_add(ad->win);
-       app_get_resource(EDJ_CHAT_CONV_FILE, edj_path, (int)PATH_MAX);
-       elm_layout_file_set(main_layout, edj_path, "chat_first_registration");
-       evas_object_size_hint_min_set(main_layout, w, h);
+       Evas_Object* first_name_entry = elm_entry_add(layout);
+       evas_object_size_hint_weight_set(first_name_entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(first_name_entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
-       Evas_Object* first_name_lbl = elm_label_add(main_layout);
-       elm_object_text_set(first_name_lbl, "Enter first name:");
-       evas_object_show(first_name_lbl);
-       elm_object_part_content_set(main_layout, "swallow.first_name_label", first_name_lbl);
+       elm_object_part_text_set(first_name_entry, "elm.guide", "<font=Tizen:style=Regular color=#666362 align=left><font_size=36>First name (required)</font_size></font>");
 
-       Evas_Object* first_name_entry = elm_entry_add(main_layout);
        elm_entry_single_line_set(first_name_entry, EINA_TRUE);
+       elm_entry_scrollable_set (first_name_entry, EINA_FALSE);
+       elm_entry_cnp_mode_set(first_name_entry, ELM_CNP_MODE_NO_IMAGE);
+       elm_entry_context_menu_disabled_set(first_name_entry, EINA_TRUE);
+       elm_entry_text_style_user_push(first_name_entry, "DEFAULT='color=#000000'");
        evas_object_show(first_name_entry);
-       elm_object_part_content_set(main_layout, "swallow.first_name_entry", first_name_entry);
+       elm_object_part_content_set(layout, "first_name_entry", first_name_entry);
+
+       evas_object_data_set(ad->nf, "first_name_entry", (void*)first_name_entry);
+
+       evas_object_smart_callback_add(first_name_entry, "changed", on_first_name_change_enable_ok_button, ad);
+
+
+       Evas_Object* second_name_entry = elm_entry_add(layout);
+       evas_object_size_hint_weight_set(second_name_entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(second_name_entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+       elm_object_part_text_set(second_name_entry, "elm.guide", "<font=Tizen:style=Regular color=#666362 align=left><font_size=36>Last name (optional)</font_size></font>");
+
+       elm_entry_single_line_set(second_name_entry, EINA_TRUE);
+       elm_entry_scrollable_set (second_name_entry, EINA_FALSE);
+       elm_entry_cnp_mode_set(second_name_entry, ELM_CNP_MODE_NO_IMAGE);
+       elm_entry_context_menu_disabled_set(second_name_entry, EINA_TRUE);
+       elm_entry_text_style_user_push(second_name_entry, "DEFAULT='color=#000000'");
+       evas_object_show(second_name_entry);
+       elm_object_part_content_set(layout, "second_name_entry", second_name_entry);
 
+       evas_object_data_set(ad->nf, "second_name_entry", (void*)second_name_entry);
 
-       Evas_Object* last_name_lbl = elm_label_add(main_layout);
-       elm_object_text_set(last_name_lbl, "Enter last name:");
-       evas_object_show(last_name_lbl);
-       elm_object_part_content_set(main_layout, "swallow.last_name_label", last_name_lbl);
 
-       Evas_Object* last_name_entry = elm_entry_add(main_layout);
-       elm_entry_single_line_set(last_name_entry, EINA_TRUE);
-       evas_object_show(last_name_entry);
-       elm_object_part_content_set(main_layout, "swallow.last_name_entry", last_name_entry);
+       Elm_Object_Item* navi_item = elm_naviframe_item_push(ad->nf, "Your name", NULL, NULL, scroller, NULL);
 
-       Evas_Object* submit_btn = elm_button_add(main_layout);
-       elm_object_text_set(submit_btn, "Submit");
-       evas_object_show(submit_btn);
+    Evas_Object *done_btn = elm_button_add(ad->nf);
+    elm_object_style_set(done_btn, "naviframe/title_icon");
+    elm_object_text_set(done_btn, "Done");
+    evas_object_smart_callback_add(done_btn, "clicked", on_name_entry_done_clicked, ad);
 
-       evas_object_data_set(submit_btn, "app_data", ad);
-       evas_object_data_set(submit_btn, "first_name_entry", first_name_entry);
-       evas_object_data_set(submit_btn, "last_name_entry", last_name_entry);
+    Evas_Object *cancel_btn = elm_label_add(ad->nf);
+    elm_object_style_set(cancel_btn, "naviframe/title_icon");
 
-       elm_object_part_content_set(main_layout, "swallow.submit_btn", submit_btn);
+    elm_object_item_part_content_set(navi_item, "title_right_btn", done_btn);
+    elm_object_item_part_content_set(navi_item, "title_left_btn", cancel_btn);
 
-       evas_object_smart_callback_add(submit_btn, "clicked", on_submit_button_clicked, ad);
+    evas_object_data_set(ad->nf, "name_done_btn", (void*)done_btn);
+    elm_object_disabled_set(done_btn, EINA_TRUE);
 
-       elm_naviframe_item_push(ad->nf, "Telegram", NULL, NULL, main_layout, NULL);
 }
 
 
index a26e6d2..858594b 100644 (file)
@@ -7,11 +7,34 @@
 
 #include "tg_login.h"
 #include "server_requests.h"
+#include "tg_first_registration.h"
 
-static void _send_code_ok_cb(void *data, Evas_Object *obj, void *event_info)
+#define TIMER_TEXT "We will call in "
+
+#define CODE_INFO_TEXT "We've sent an SMS with an activation code to your phone "
+
+
+static void on_code_change_enable_ok_button(void *data, Evas_Object *obj, void *event_info)
 {
-       appdata_s* ad = evas_object_data_get(obj, "app_data");
-       Evas_Object* entry = evas_object_data_get(obj, "entry_obj");
+       appdata_s* ad = data;
+       Evas_Object* done_btn = evas_object_data_get(ad->nf, "code_done_btn");
+       char buf[256] = {'\0',};
+       snprintf(buf, sizeof(buf), "%s", elm_object_text_get(obj));
+
+       if (strlen(buf) == MAX_CODE_LENGTH) {
+               elm_object_disabled_set(done_btn, EINA_FALSE);
+       } else {
+               elm_object_disabled_set(done_btn, EINA_TRUE);
+       }
+
+}
+
+static void on_code_entry_done_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       appdata_s* ad = data;
+#if 1
+       Evas_Object* entry = evas_object_data_get(ad->nf, "code_number_entry");
+
        if(entry) {
                char* tval = strdup(elm_object_text_get(entry));
                char* val = trim(tval);
@@ -23,81 +46,199 @@ static void _send_code_ok_cb(void *data, Evas_Object *obj, void *event_info)
                }
                send_request_for_validation(ad->service_client, val);
        }
+#else
+       if (ad->timer_value > 0) {
+               Ecore_Timer* timer = evas_object_data_get(ad->nf, "code_timer");
+               if (timer)
+                       ecore_timer_del(timer);
+       }
+       elm_naviframe_item_pop(ad->nf);
+       launch_first_registration_cb(ad);
+#endif
 }
 
-static void _send_code_sms_login_cb(void *data, Evas_Object *obj, void *event_info)
+static void on_wrong_num_clicked(void *data, Evas_Object *obj, void *event_info)
 {
-       // to do
+       appdata_s* ad = data;
+       if (ad->timer_value > 0) {
+               Ecore_Timer* timer = evas_object_data_get(ad->nf, "code_timer");
+               ecore_timer_del(timer);
+       }
+       elm_naviframe_item_pop(ad->nf);
+       ad->current_app_state = TG_REGISTRATION_STATE;
 }
 
-static void _send_code_call_login_cb(void *data, Evas_Object *obj, void *event)
+static Eina_Bool on_code_timer_cb(void* data)
 {
-       // to do
+       appdata_s* ad = data;
+       (ad->timer_value)--;
+
+       int cur_time_in_secs = ad->timer_value;
+
+       Evas_Object* info_timer = evas_object_data_get(ad->nf, "info_timer");
+
+       int seconds = cur_time_in_secs % 60;
+       int minutes = (cur_time_in_secs / 60) % 60;
+
+       char sec_str[10];
+       char min_str[10];
+
+       sprintf(min_str, "%d", minutes);
+       sprintf(sec_str, "%d", seconds);
+
+       char* timer_text = (char*)malloc(strlen(TIMER_TEXT) + strlen(min_str) + strlen(":") + strlen(sec_str) + 1);
+       strcpy(timer_text, TIMER_TEXT);
+       strcat(timer_text, min_str);
+       strcat(timer_text, ":");
+       strcat(timer_text, sec_str);
+
+       char temp_txt[512] = {0,};
+       snprintf(temp_txt, sizeof(temp_txt), "<font=Tizen:style=Regular color=#666362 align=left><font_size=32>%s</font_size></font>", timer_text);
+
+       elm_object_text_set(info_timer, temp_txt);
+
+       free(timer_text);
+
+       if (ad->timer_value == 0 || (seconds == 0 && minutes == 0) ) {
+
+               Ecore_Timer* timer = evas_object_data_get(ad->nf, "code_timer");
+               ecore_timer_del(timer);
+
+               return ECORE_CALLBACK_CANCEL;
+       }
+       return ECORE_CALLBACK_RENEW;
 }
 
+void start_timer(appdata_s* ad)
+{
+       ad->timer_value = 120;
+       Ecore_Timer* timer = ecore_timer_add(1.0f, on_code_timer_cb, ad);
+       evas_object_data_set(ad->nf, "code_timer", (void*)timer);
+}
 
-void launch_login_cb(void *data)
+void launch_login_cb(appdata_s* ad)
 {
-       appdata_s* ad = data;
 
-       char edj_path[PATH_MAX] = {0, };
+       if (!ad) {
+               return;
+       }
 
-       Evas_Coord w, h;
        ad->current_app_state = TG_LOGIN_STATE;
 
+       char edj_path[PATH_MAX] = {0, };
+       app_get_resource(TELEGRAM_INIT_VIEW_EDJ, edj_path, (int)PATH_MAX);
+
+       Evas_Object* scroller = elm_scroller_add(ad->nf);
+       elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+       elm_scroller_policy_set(scroller,ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+       Evas_Object* layout = elm_layout_add(ad->nf);
+       elm_layout_file_set(layout, edj_path, "code_check_screen");
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_show(layout);
+       elm_object_content_set(scroller, layout);
+
+       char* info_txt = NULL;
+
+       if (ad->phone_number) {
+               info_txt = (char*)malloc(strlen(CODE_INFO_TEXT) + strlen(ad->phone_number) + 1);
+               strcpy(info_txt, CODE_INFO_TEXT);
+               strcat(info_txt, ad->phone_number);
+       } else {
+               info_txt = (char*)malloc(strlen(CODE_INFO_TEXT) + 1);
+               strcpy(info_txt, CODE_INFO_TEXT);
+       }
+
+       char temp_txt[512] = {0,};
+       snprintf(temp_txt, sizeof(temp_txt), "<font=Tizen:style=Regular color=#666362 align=left><font_size=32>%s</font_size></font>", info_txt);
+       free(info_txt);
+
+       Evas_Object* info_btn = elm_entry_add(layout);
+       elm_object_text_set(info_btn, temp_txt);
+       evas_object_size_hint_weight_set(info_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(info_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       elm_entry_single_line_set(info_btn,  EINA_FALSE);
+       elm_entry_editable_set(info_btn, EINA_FALSE);
+       elm_entry_line_wrap_set(info_btn, EINA_TRUE);
+       evas_object_show(info_btn);
+       elm_object_part_content_set(layout, "phone_status", info_btn);
+
+
+       Evas_Object* code_number_entry = elm_entry_add(layout);
+       elm_object_part_text_set(code_number_entry, "elm.guide", "<font=Tizen:style=Regular color=#666362 align=left><font_size=36>Code</font_size></font>");
+       elm_entry_cursor_end_set(code_number_entry);
+       evas_object_size_hint_weight_set(code_number_entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(code_number_entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       elm_entry_single_line_set(code_number_entry,  EINA_TRUE);
+       elm_entry_scrollable_set (code_number_entry, EINA_FALSE);
+       elm_entry_cnp_mode_set(code_number_entry, ELM_CNP_MODE_NO_IMAGE);
+       elm_entry_context_menu_disabled_set(code_number_entry, EINA_TRUE);
+       elm_entry_text_style_user_push(code_number_entry, "DEFAULT='color=#000000'");
+       evas_object_show(code_number_entry);
+       elm_object_part_content_set(layout, "code_entry", code_number_entry);
+
+       evas_object_data_set(ad->nf, "code_number_entry", (void*)code_number_entry);
+
+
+       limit_filter_data.max_char_count = MAX_CODE_LENGTH;
+
+       elm_entry_markup_filter_append(code_number_entry, elm_entry_filter_limit_size, &limit_filter_data);
+       //Set the entry field to accept only numbers
+       elm_entry_markup_filter_append(code_number_entry, elm_entry_filter_accept_set, &accept_set);
+
+       Ecore_IMF_Context *imf_context;
+       imf_context = elm_entry_imf_context_get(code_number_entry);
+       ecore_imf_context_input_panel_layout_set(imf_context, ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER);
+       //Enable OK button if no of chars has reached to 10 then
+       evas_object_smart_callback_add(code_number_entry, "changed", on_code_change_enable_ok_button, ad);
+
+
+       char temp_timer_txt[512] = {0,};
+       snprintf(temp_timer_txt, sizeof(temp_timer_txt), "<font=Tizen:style=Regular color=#666362 align=left><font_size=32>%s2::00</font_size></font>", TIMER_TEXT);
+
+
+       Evas_Object* info_timer = elm_entry_add(layout);
+       elm_object_text_set(info_timer, temp_timer_txt);
+       evas_object_size_hint_weight_set(info_timer, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(info_timer, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       elm_entry_single_line_set(info_timer,  EINA_FALSE);
+       elm_entry_editable_set(info_timer, EINA_FALSE);
+       elm_entry_line_wrap_set(info_timer, EINA_TRUE);
+       evas_object_show(info_timer);
+       elm_object_part_content_set(layout, "timer_text", info_timer);
+
+       evas_object_data_set(ad->nf, "info_timer", (void*)info_timer);
 
-       elm_win_screen_size_get(ad->win, NULL, NULL, &w, &h);
 
-       Evas_Object* layout = elm_layout_add(ad->win);
-       app_get_resource(EDJ_LOGIN_FILE, edj_path, (int)PATH_MAX);
+       Evas_Object* wrong_num_btn = elm_entry_add(layout);
+       elm_entry_editable_set(wrong_num_btn, EINA_FALSE);
+       elm_object_text_set(wrong_num_btn, "<font=Tizen:style=Regular color=#0000ff align=left><font_size=32>Wrong number?</font_size></font>");
+       evas_object_size_hint_weight_set(wrong_num_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(wrong_num_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_smart_callback_add(wrong_num_btn, "clicked", on_wrong_num_clicked, ad);
+       elm_object_part_content_set(layout, "wrong_num_btn", wrong_num_btn);
 
-       elm_layout_file_set(layout, edj_path, "login");
 
-       Evas_Object* box = elm_box_add(layout);
-       evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
-       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
-       evas_object_size_hint_min_set(box, w, h - 200);
+       Elm_Object_Item* navi_item = elm_naviframe_item_push(ad->nf, "Your code", NULL, NULL, scroller, NULL);
 
-       elm_object_part_content_set(layout, "bg", box); /* To expands layout */
+    Evas_Object *done_btn = elm_button_add(ad->nf);
+    elm_object_style_set(done_btn, "naviframe/title_icon");
+    elm_object_text_set(done_btn, "Done");
+    evas_object_smart_callback_add(done_btn, "clicked", on_code_entry_done_clicked, ad);
 
-       elm_object_part_text_set(layout, "label", "Enter Telegram Code");
 
-       evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, 0.0);
-       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0.0);
+    Evas_Object *cancel_btn = elm_label_add(ad->nf);
+    elm_object_style_set(cancel_btn, "naviframe/title_icon");
 
-       Evas_Object* entry = elm_entry_add(layout);
-       elm_entry_input_panel_layout_set(entry,ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
-       evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0);
-       elm_object_part_content_set(layout, "entry", entry);
 
 
-       Evas_Object* ok_btn = elm_button_add(layout);
-       elm_object_text_set(ok_btn, "OK");
-       evas_object_size_hint_weight_set(ok_btn, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(ok_btn, EVAS_HINT_FILL, 0);
-       elm_object_part_content_set(layout, "ok_btn", ok_btn);
-       evas_object_data_set(ok_btn, "app_data", ad);
-       evas_object_data_set(ok_btn, "entry_obj", entry);
-       evas_object_smart_callback_add(ok_btn, "clicked", _send_code_ok_cb, ad);
+    elm_object_item_part_content_set(navi_item, "title_right_btn", done_btn);
+    elm_object_item_part_content_set(navi_item, "title_left_btn", cancel_btn);
 
-       Evas_Object* sms_btn = elm_button_add(layout);
-       elm_object_text_set(sms_btn, "Request new code via SMS");
-       evas_object_size_hint_weight_set(sms_btn, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(sms_btn, EVAS_HINT_FILL, 0);
-       elm_object_part_content_set(layout, "sms_btn", sms_btn);
-       evas_object_data_set(sms_btn, "app_data", ad);
-       evas_object_data_set(sms_btn, "entry_obj", entry);
-       evas_object_smart_callback_add(sms_btn, "clicked", _send_code_sms_login_cb, ad);
+    evas_object_data_set(ad->nf, "code_done_btn", (void*)done_btn);
+    elm_object_disabled_set(done_btn, EINA_TRUE);
 
-       Evas_Object* call_btn = elm_button_add(layout);
-       elm_object_text_set(call_btn, "Request new code via CALL");
-       evas_object_size_hint_weight_set(call_btn, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(call_btn, EVAS_HINT_FILL, 0);
-       elm_object_part_content_set(layout, "call_btn", call_btn);
-       evas_object_data_set(call_btn, "app_data", ad);
-       evas_object_data_set(call_btn, "entry_obj", entry);
-       evas_object_smart_callback_add(call_btn, "clicked", _send_code_call_login_cb, ad);
+    start_timer(ad);
 
-       elm_naviframe_item_push(ad->nf, "Telegram", NULL, NULL, layout, NULL);
 }
index 661630e..257614f 100644 (file)
@@ -8,7 +8,7 @@
 #include "tg_registration.h"
 #include "tg_db_manager.h"
 #include "server_requests.h"
-
+#include "tg_login.h"
 #include "device_contacts_manager.h"
 #include "contacts-db-utils.h"
 
@@ -17,9 +17,6 @@ static void on_text_change_enable_ok_button(void *data, Evas_Object *obj, void *
 {
        appdata_s* ad = data;
        Evas_Object* country_name_btn = evas_object_data_get(ad->nf, "country_name_btn");
-       //Evas_Object* country_code_btn = evas_object_data_get(ad->nf, "country_code_btn");
-       //Evas_Object* pn_number_entry = evas_object_data_get(ad->nf, "pn_number_entry");
-    //evas_object_data_set(ad->nf, "reg_cancel_btn", (void*)cancel_btn);
        Evas_Object* done_btn = evas_object_data_get(ad->nf, "reg_done_btn");
        char buf[256] = {'\0',};
        snprintf(buf, sizeof(buf), "%s", elm_object_text_get(obj));
@@ -66,35 +63,13 @@ static void on_naviframe_done_clicked(void *data, Evas_Object *obj, void *event_
 static void on_naviframe_cancel_clicked(void *data, Evas_Object *obj, void *event_info)
 {
        appdata_s* ad = data;
+#if 0
        elm_win_lower(ad->win);
        elm_exit();
-}
-
-
-
-void _send_code_sms_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       appdata_s* ad = evas_object_data_get(obj, "app_data");
-       Evas_Object* entry = evas_object_data_get(obj, "entry_obj");
-       if(entry) {
-               char* tval = strdup(elm_object_text_get(entry));
-
-               char* val = trim(tval);
-               free(tval);
-               if(!val || strlen(val) <= 0 || numbers_only(val) == 0) {
-                       show_toast(ad, "Enter a valid phone number");
-                       free(val);
-                       return;
-               }
-               ad->phone_number = strdup(val);
-               // request service for login
-               send_request_for_registration(ad->service_client, ad->phone_number, EINA_TRUE);
-       }
-}
-
-static void _send_code_call_cb(void *data, Evas_Object *obj, void *event)
-{
-       //appdata_reg_s* ad_reg = data;
+#else
+       elm_naviframe_item_pop(ad->nf);
+       launch_login_cb(ad);
+#endif
 }
 
 static void country_name_popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
@@ -102,16 +77,13 @@ static void country_name_popup_dismissed_cb(void *data, Evas_Object *obj, void *
        evas_object_del(obj);
 }
 
-
 static void country_name_popup_item_select_cb(void *data, Evas_Object *obj, void *event_info)
 {
-
        appdata_s* ad = data;
        Evas_Object* country_name_btn = evas_object_data_get(ad->nf, "country_name_btn");
        Evas_Object* country_code_btn = evas_object_data_get(ad->nf, "country_code_btn");
        Evas_Object* pn_number_entry = evas_object_data_get(ad->nf, "pn_number_entry");
 
-
        const char *label = elm_object_item_text_get((Elm_Object_Item *)event_info);
        if (label) {
                elm_object_text_set(country_name_btn, label);
@@ -178,69 +150,12 @@ static void on_country_name_list_clicked(void *data, Evas_Object *obj, void *eve
 
 void launch_registration_cb(appdata_s* ad)
 {
-#if 0
-       appdata_s* ad = data;
-       char edj_path[PATH_MAX] = {0, };
-
-       ad->current_app_state = TG_REGISTRATION_STATE;
-
-       Evas_Object* layout = elm_layout_add(ad->win);
-       app_get_resource(EDJ_REG_FILE, edj_path, (int)PATH_MAX);
-       elm_layout_file_set(layout, edj_path, "login");
-
-       Evas_Object* box = elm_box_add(layout);
-       evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
-       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
-       elm_object_part_content_set(layout, "bg", box);
-       elm_object_part_text_set(layout, "label", "Enter Phone Number");
-
-       evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, 0.0);
-       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0.0);
-
-       Evas_Object* entry = elm_entry_add(layout);
-       evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0);
-       elm_entry_input_panel_layout_set(entry,ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
-       elm_object_part_content_set(layout, "entry", entry);
-
-       Evas_Object* sms_btn = elm_button_add(layout);
-       elm_object_text_set(sms_btn, "Request code via SMS");
-       evas_object_size_hint_weight_set(sms_btn, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(sms_btn, EVAS_HINT_FILL, 0);
-       elm_object_part_content_set(layout, "sms_btn", sms_btn);
-       evas_object_data_set(sms_btn, "app_data", ad);
-       evas_object_data_set(sms_btn, "entry_obj", entry);
-       evas_object_smart_callback_add(sms_btn, "clicked", _send_code_sms_cb, ad);
-
-       Evas_Object* call_btn = elm_button_add(layout);
-       elm_object_text_set(call_btn, "Request code via CALL");
-       evas_object_size_hint_weight_set(call_btn, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(call_btn, EVAS_HINT_FILL, 0);
-       elm_object_part_content_set(layout, "call_btn", call_btn);
-       evas_object_data_set(call_btn, "app_data", ad);
-       evas_object_data_set(call_btn, "entry_obj", entry);
-       evas_object_smart_callback_add(call_btn, "clicked", _send_code_call_cb, ad);
-
-       Elm_Object_Item* navi_item = elm_naviframe_item_push(ad->nf, "Your phone", NULL, NULL, layout, NULL);
-
-    Evas_Object *cancel_btn = elm_button_add(layout);
-    elm_object_style_set(cancel_btn, "naviframe/title_icon");
-    elm_object_text_set(cancel_btn, "Cancel");
-    evas_object_smart_callback_add(cancel_btn, "clicked", on_naviframe_cancel_clicked, ad);
-
-    Evas_Object *done_btn = elm_button_add(layout);
-    elm_object_style_set(done_btn, "naviframe/title_icon");
-    elm_object_text_set(done_btn, "Done");
-    evas_object_smart_callback_add(done_btn, "clicked", on_naviframe_done_clicked, ad);
-
-
-    elm_object_item_part_content_set(navi_item, "title_left_btn", cancel_btn);
-    elm_object_item_part_content_set(navi_item, "title_right_btn", done_btn);
-#else
+       if (!ad) {
+               return;
+       }
 
        ad->current_app_state = TG_REGISTRATION_STATE;
 
-
        char edj_path[PATH_MAX] = {0, };
        app_get_resource(TELEGRAM_INIT_VIEW_EDJ, edj_path, (int)PATH_MAX);
 
@@ -248,7 +163,6 @@ void launch_registration_cb(appdata_s* ad)
        elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
        elm_scroller_policy_set(scroller,ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
 
-
        Evas_Object* layout = elm_layout_add(ad->nf);
        elm_layout_file_set(layout, edj_path, "registration_screen");
        evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -338,6 +252,4 @@ void launch_registration_cb(appdata_s* ad)
     evas_object_data_set(ad->nf, "reg_done_btn", (void*)done_btn);
     evas_object_data_set(ad->nf, "reg_cancel_btn", (void*)cancel_btn);
     elm_object_disabled_set(done_btn, EINA_TRUE);
-
-#endif
 }
index c89af44..be36c66 100644 (file)
@@ -32,6 +32,7 @@
 #define TELEGRAM_CUSTOM_WINSET_EDJ     "edje/telegram_theme.edj"
 #define TELEGRAM_CHAT_VIEW_EDJ "edje/telegram_chat_view.edj"
 #define TELEGRAM_INIT_VIEW_EDJ "edje/telegram_init_screen.edj"
+#define TELEGRAM_GENLIST_THEME_EDJ     "edje/telegram_genlist_theme.edj"
 
 
 #define GRP_MAIN "main"
@@ -41,9 +42,9 @@
 #define FM_ICON_PATH "images/"
 #define FM_ICON_ROBO_BUDDY       FM_ICON_PATH"robo_buddy.png"
 #define SEARCH_ICON FM_ICON_PATH"/search_icon.png"
-#define ATTACH_ICON FM_ICON_PATH"/attach_icon.png"
-#define SMILEY_ICON FM_ICON_PATH"/smiley_icon.png"
-#define SEND_ICON FM_ICON_PATH"/send_icon.png"
+#define ATTACH_ICON FM_ICON_PATH"/ic_ab_attach.png"
+#define SMILEY_ICON FM_ICON_PATH"/ic_msg_panel_smiles.png"
+#define SEND_ICON FM_ICON_PATH"/ic_send.png"
 #define CHAT_BG FM_ICON_PATH"/chat_bg.jpg"
 #define BLUR_BG FM_ICON_PATH"/blur_img.jpg"
 #define CAMERA_ICON FM_ICON_PATH"/camera-icon.png"
 #define FM_ICON_LOCATION       FM_ICON_PATH"ic_attach_location.png"
 
 
+#define TG_ICON_FLOATING_PENCIL       FM_ICON_PATH"floating_pencil.png"
+#define TG_ICON_FLOATING_BG       FM_ICON_PATH"floating_pressed.png"
+#define TG_SEARCH_ICON       FM_ICON_PATH"ic_ab_search.png"
+
+#define TG_MENU_GROUP       FM_ICON_PATH"menu_newgroup.png"
+#define TG_MENU_INVITE       FM_ICON_PATH"menu_invite.png"
+#define TG_MENU_CONTACTS       FM_ICON_PATH"menu_contacts.png"
+#define TG_MENU_SECRET       FM_ICON_PATH"menu_secret.png"
+#define TG_MENU_SETTINGS       FM_ICON_PATH"menu_settings.png"
+
+#define TG_CHAT_DEFAULT_BG       FM_ICON_PATH"background_hd.jpg"
+
+
 #define INIT_SCREEN_1       FM_ICON_PATH"screenshot_1.png"
 #define INIT_SCREEN_2       FM_ICON_PATH"screenshot_2.png"
 #define INIT_SCREEN_3       FM_ICON_PATH"screenshot_3.png"
@@ -71,6 +85,8 @@
 #define INIT_SCREEN_5       FM_ICON_PATH"screenshot_5.png"
 #define INIT_SCREEN_6       FM_ICON_PATH"screenshot_6.png"
 #define INIT_SCREEN_7       FM_ICON_PATH"screenshot_7.png"
+#define TG_NO_CHAT_LIST       FM_ICON_PATH"no_chat.png"
+
 
 
 
@@ -118,6 +134,24 @@ static char *phone_codes[SIZE_CODE][2] = { {"Argentina (+54)", "+54"},
                                                                                {"United States (+1)" , "+1"}
                                                                             };
 
+
+
+#define NUMBER_OF_MENU_ITEMS 5
+
+#define MENU_NEW_GROUP "New Group"
+#define MENU_SECRET_CHAT "New secret Chat"
+#define MENU_CONTACTS "Contacts"
+#define MENU_INVITE_FRIENDS "Invite Friends"
+#define MENU_SETTINGS "settings"
+
+static char* main_view_menu_items[NUMBER_OF_MENU_ITEMS][2] = { {MENU_NEW_GROUP, TG_MENU_GROUP},
+                                                                               {MENU_SECRET_CHAT, TG_MENU_SECRET},
+                                                                               {MENU_CONTACTS, TG_MENU_CONTACTS},
+                                                                               {MENU_INVITE_FRIENDS, TG_MENU_INVITE},
+                                                                               {MENU_SETTINGS, TG_MENU_SETTINGS}
+                                                                            };
+
+
 typedef enum {
        CHAT_MESSAGE_BUBBLE_NONE = 0,
        CHAT_MESSAGE_BUBBLE_SENT,
@@ -136,7 +170,7 @@ static Elm_Entry_Filter_Accept_Set accept_set = {
  };
 
 #define MAX_NUM_LENGTH 10
-
+#define MAX_CODE_LENGTH 5
 
 typedef struct {
        int type;
@@ -187,7 +221,9 @@ typedef enum state_of_app {
        TG_BUDDY_LIST_SELECTION_STATE,
        TG_GROUP_CHAT_NAME_ENTRY_STATE,
        TG_BUDDY_CHAT_STATE,
-       TG_BUDDY_CHAT_CONV_STATE
+       TG_BUDDY_CHAT_CONV_STATE,
+       TG_USER_MAIN_VIEW_STATE,
+       TG_START_MESSAGING_VIEW_STATE
 } state_of_app_s;
 
 enum tgl_typing_status {
@@ -340,6 +376,7 @@ typedef struct appdata {
        service_client* service_client;
        Eina_Bool is_first_time_registration;
        Eina_List* loaded_msg_list;
+       int timer_value;
 } appdata_s;
 
 extern void show_toast(appdata_s* ad, char* value);
@@ -380,6 +417,47 @@ static char*  trim(char * s)
        return strndup(s, l);
 }
 
+static Evas_Object* create_circle_button(Evas_Object *parent, char* text, char* filepath) {
+       Evas_Object *button, *image;
+       button= elm_button_add(parent);
+       elm_object_style_set(button, "circle");
+       if (text)
+               elm_object_text_set(button, text);
+       image = elm_image_add(button);
+       elm_image_file_set(image, filepath, NULL);
+       elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE);
+       elm_object_part_content_set(button, "icon", image);
+       evas_object_smart_callback_add(button, "clicked", NULL, NULL);
+       evas_object_show(button);
+       return button;
+}
+
+static void on_menu_list_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       Elm_Object_Item *it = event_info;
+       elm_genlist_item_selected_set(it, EINA_FALSE);
+}
+
+static void on_user_list_search_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       appdata_s* ad = data;
+       show_toast(ad, "search clicked");
+}
+
+static Evas_Object* create_button(Evas_Object *parent, char *style, char *text)
+{
+       Evas_Object *button;
+
+       button = elm_button_add(parent);
+       if (style)
+               elm_object_style_set(button, style);
+       if (text)
+               elm_object_text_set(button, text);
+       evas_object_show(button);
+
+       return button;
+}
+
 static int numbers_only(const char *s)
 {
        return 1;
@@ -444,7 +522,7 @@ static Eina_Bool compare_date_with_current_date(int rtime) {
        return EINA_FALSE;
 }
 
-static void telegram_set_mask_and_circular_pic(Evas_Object *image, char *image_path, char *mask_path, int width, int height)
+static void telegram_set_c(Evas_Object *image, char *image_path, char *mask_path, int width, int height)
 {
        if (image == NULL)
                return;