添加通讯录及相关函数 10/target/1 7/1 7/head 8/target/1 9/target/1
authorhcj <1224667075@qq.com>
Mon, 15 Apr 2024 07:14:37 +0000 (15:14 +0800)
committerhcj <1224667075@qq.com>
Mon, 15 Apr 2024 07:14:37 +0000 (15:14 +0800)
12 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirPresenter.h
code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirView.h
code/sdk/application/wearable/fd230app/nativeui/phone/include/phoneaddressmodel.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirView.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneView.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp [new file with mode: 0644]
code/sdk/application/wearable/service/msg_center/CMakeLists.txt
code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp
code/sdk/drivers/peripheral/slip/cat1Service/CMakeLists.txt
code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp

index b2c5047..bbe47b1 100644 (file)
@@ -595,6 +595,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallupPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneRingView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneRingPresenter.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/phoneaddressmodel.cpp
 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testView.cpp
index ddbdb05..97c7097 100644 (file)
@@ -4,6 +4,7 @@
 #include "Presenter.h"\r
 #include "PhoneDirView.h"\r
 \r
+\r
 namespace OHOS\r
 {\r
     class PhoneDirView;\r
@@ -23,6 +24,7 @@ namespace OHOS
 \r
         static PhoneDirPresenter *GetInstance();\r
 \r
+\r
     private:\r
         // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
         bool OnClick(UIView &view, const ClickEvent &event) override;\r
index 32d5944..d4b589a 100644 (file)
 #include "components/ui_button.h"\r
 #include "components/ui_label_button_ext.h"\r
 #include "graphic_config.h"\r
-#include "components/ui_label_button.h"\r
-\r
+#include "common/image_cache_manager.h"\r
+#include "UiConfig.h"\r
+#include "ui_resource_image.h"\r
 #include "PhoneDirPresenter.h"\r
+#include "wearable_log.h"\r
+\r
 namespace OHOS\r
 {\r
 \r
@@ -33,37 +36,46 @@ namespace OHOS
         void Init();\r
         void DeInit();\r
 \r
+        struct ButtonConfig_ext_t\r
+        {\r
+            int x;\r
+            int y;\r
+            int w;\r
+            int h;\r
+            const char *str;\r
+            const char *ViewId;\r
+            const char *ImageSrc;\r
+\r
+            //label\r
+            int label_x;\r
+            int label_y;\r
+            uint8_t ALIGN;\r
+            int  Fontsize;\r
+        \r
+        };\r
+\r
+\r
         UIView *GetView();\r
+        UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnClickListener *clickListener);\r
+        void initView_ext(int x,int y,int w,int h,int interval,const char *imagsrc);\r
+        void Set_onepage_address(const char *idstr);\r
+        void onepage_address_init(void);\r
 \r
     private:\r
         UIView::OnDragListener *draglistener{nullptr};\r
         PhoneDirView(PhoneDirView &&) = delete;\r
         PhoneDirView &operator=(PhoneDirView &&) = delete;\r
+        UILabelButtonExt *button[20]={NULL};\r
+        UILabelButtonExt *number_button[2]={NULL};\r
+        UILabel * label1_phone_name=nullptr;\r
+        UIImageView *phone_name=nullptr;\r
+        UILabel  *label1_ =nullptr;\r
+        UIScrollView *container_ =nullptr;\r
+        UIScrollView *container_one_page=nullptr;\r
 \r
-#if 0\r
-        UIViewGroup *container_ = nullptr;\r
-        UIScrollView *scrollView1_ = nullptr;\r
-        UILabel *label1_ = nullptr;\r
-        UILabel *label2_ = nullptr;\r
-        UIImageView *image1_ = nullptr;\r
-#endif\r
-        UIViewGroup *container_ = nullptr;\r
-        UIScrollView *scrollView1_ = nullptr;\r
-        UILabel *label1_ = nullptr;\r
-        UILabelButtonExt *labelButton8_ = nullptr;\r
-        UIImageView *image2_ = nullptr;\r
-        UILabelButtonExt *labelButton9_ = nullptr;\r
-        UIImageView *image3_ = nullptr;\r
-        UILabelButtonExt *labelButton10_ = nullptr;\r
-        UIImageView *image5_ = nullptr;\r
-        UIImageView *image7_ = nullptr;\r
-        UILabelButtonExt *labelButton13_ = nullptr;\r
-        UIImageView *image9_ = nullptr;\r
-        UIImageView *image8_ = nullptr;\r
-        UILabelButtonExt *labelButton11_ = nullptr;\r
-        UIImageView *image6_ = nullptr;\r
-        UILabelButtonExt *labelButton7_ = nullptr;\r
-        UIImageView *image1_ = nullptr;\r
+        UILabel  *label1_no =nullptr;\r
+        UILabel *label2_no=nullptr;\r
+        UIImageView *image1_no=nullptr;\r
     };\r
 } // namespace OHOS\r
 #endif // PhoneDir_PRESENTER_H\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/phoneaddressmodel.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/phoneaddressmodel.h
new file mode 100644 (file)
index 0000000..3e87289
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef PHONE_ADDRESS_MODEL_H
+#define PHONE_ADDRESS_MODEL_H
+#include "wearable_log.h"
+
+#define ADDRESS_BOOK_PATH "/user/userdata/addressbook.bin"
+
+
+namespace OHOS
+{
+
+struct phone_number
+{
+    char *number={NULL};
+    char *affiliating_area={NULL};
+    char *operator_t={NULL};
+    //struct phone_number *next;
+};
+
+
+struct Contact
+{
+    char *name={NULL};
+    int phone_num=0;
+    uint8_t sex;
+    struct phone_number phone_number_t[2];
+};
+
+
+struct addressbook
+{
+    uint16_t num=0;
+    struct Contact Contact_t[20];
+};
+
+
+void read_addressbook_bin_file();
+
+void write_addressbook_bin_flle();
+
+void add_addressbook(struct Contact *data);
+ 
+void get_phone_addrss_name(char *name,const char *phone);
+
+void free_address();
+
+void add_addressbook_by_AT(char *name,char *phone);
+
+    class phoneaddressbook
+    {
+    public:
+        static phoneaddressbook &GetInstance(void);
+
+    private:
+        phoneaddressbook();
+        phoneaddressbook(const phoneaddressbook &) = delete;
+        phoneaddressbook &operator=(const phoneaddressbook &) = delete;
+        virtual ~phoneaddressbook();
+    };
+
+}
+
+#endif
\ No newline at end of file
index bf2466d..cb61629 100644 (file)
@@ -4,6 +4,9 @@
 #include "NativeAbility.h"\r
 \r
 #include "phone/include/PhoneDirPresenter.h"\r
+#include "phone/include/PhoneDirView.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_label_button_ext.h"\r
 \r
 namespace OHOS\r
 {\r
@@ -59,7 +62,16 @@ namespace OHOS
         if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
             (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
         {\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_PHONE);\r
+            if(strcmp( view.GetViewId(),"container_one_page")==0)\r
+            {\r
+                PhoneDirView::GetInstance()->Set_onepage_address(view.GetViewId());\r
+            }\r
+            else\r
+            {\r
+                NativeAbility::GetInstance().ChangeSlice(VIEW_PHONE);\r
+            }\r
+            \r
+            \r
         }\r
         UNUSED(view);\r
         return true;\r
@@ -67,6 +79,15 @@ namespace OHOS
 \r
     bool PhoneDirPresenter::OnClick(UIView &view, const ClickEvent &event)\r
     {\r
+        //if(strview.GetViewId())\r
+         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PhoneDirPresenter----------%s ---",view.GetViewId());\r
+        // if(atoi(view.GetViewId())!=0)\r
+        // {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PhoneDirPresenter----------%s ---",view.GetViewId());\r
+            PhoneDirView::GetInstance()->Set_onepage_address(view.GetViewId());\r
+        //}\r
+       \r
+        \r
         // 根据控件id查找是哪个控件触发了点击回调\r
         // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
         return true;\r
index 75bbae9..025024b 100644 (file)
@@ -2,17 +2,17 @@
 \r
 #include "phone/include/PhoneDirView.h"\r
 \r
-#include "common/image_cache_manager.h"\r
-#include "UiConfig.h"\r
-#include "ui_resource_image.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_button.h"\r
-#include "components/ui_label_button.h"\r
+#include "phone/include/phoneaddressmodel.h"\r
+#define PHONE_DIR_GIRL "/user/res/Phone/little-girl.bin"\r
+#define PHONE_DIR_BOY "/user/res/Phone/little-boy.bin"\r
+#define PHONE_DIR_GIRL_1 "/user/res/Phone/girl.bin"\r
+#define PHONE_DIR_BOY_1 "/user/res/Phone/boy.bin"\r
 namespace OHOS\r
 {\r
 \r
     static PhoneDirView *g_pPhoneDirView{nullptr};\r
 \r
+    extern addressbook addressbook_t;\r
     PhoneDirView::PhoneDirView()\r
     {\r
 \r
@@ -27,563 +27,343 @@ namespace OHOS
 \r
     PhoneDirView *PhoneDirView::GetInstance()\r
     {\r
-\r
         return g_pPhoneDirView;\r
     }\r
-#if 0\r
-    void PhoneDirView::Init()\r
+    static char *number_str[]={"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"};\r
+    UILabelButtonExt *PhoneDirView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnClickListener *clickListener)\r
     {\r
-        if (container_ == nullptr)\r
-        {\r
-            container_ = new UIViewGroup();\r
-            container_->SetPosition(0, 0, 466, 466);\r
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
-        }\r
-\r
-        // Add ScrollView to App\r
-        if (scrollView1_ == nullptr)\r
-        {\r
-            scrollView1_ = new UIScrollView();\r
-        }\r
-        scrollView1_->SetPosition(0, 0);        // widget's left position and top position\r
-        scrollView1_->Resize(466, 466);         // widget's width and height\r
-        scrollView1_->SetViewId("scrollView1"); // Set style\r
-        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
-\r
-        // Set additional property\r
-\r
-        // Add to rootView\r
-        container_->Add(scrollView1_);\r
-        scrollView1_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label1_ == nullptr)\r
-        {\r
-            label1_ = new UILabel();\r
-        }\r
-        label1_->SetPosition(158, 52); // widget's left position and top position\r
-        label1_->Resize(200, 60);      // widget's width and height\r
-        label1_->SetViewId("label1");  // Set style\r
-        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
-\r
-        // Set additional property\r
-        label1_->SetText("常用联系人");\r
-        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label1_->SetRollSpeed(0);\r
-        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
-        // Add to scrollView1\r
-        scrollView1_->Add(label1_);\r
-        label1_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label2_ == nullptr)\r
-        {\r
-            label2_ = new UILabel();\r
-        }\r
-        label2_->SetPosition(51, 291); // widget's left position and top position\r
-        label2_->Resize(400, 124);     // widget's width and height\r
-        label2_->SetViewId("label2");  // Set style\r
-        label2_->SetStyle(STYLE_TEXT_FONT, 26);\r
-\r
-        // Set additional property\r
-        label2_->SetText("未添加联系人,请前往“小希爱\n玩”APP进行设置");\r
-        label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label2_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
-        label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label2_->SetRollSpeed(0);\r
-        label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-\r
-        // Add to scrollView1\r
-        scrollView1_->Add(label2_);\r
-        label2_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image1_ == nullptr)\r
-        {\r
-            image1_ = new UIImageView();\r
-        }\r
-        image1_->SetPosition(158, 120); // widget's left position and top position\r
-        image1_->Resize(150, 150);      // widget's width and height\r
-        image1_->SetViewId("image1");   // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/PhoneDir/PhoneDirdir.bin";\r
-#else\r
-        char *image1imagesPath = "/user/res/Phone/phonedir.bin";\r
-#endif\r
-        image1_->SetSrc(image1imagesPath);\r
-\r
-        // Add to scrollView1\r
-        scrollView1_->Add(image1_);\r
-        image1_->SetVisible(true);\r
+        UILabelButtonExt *button = new UILabelButtonExt();\r
+        if (button == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: button new  fail!");\r
+            return nullptr;\r
+        }\r
+        button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);\r
+        button->SetViewId(buttonconfig.ViewId);\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "----------%s ---",buttonconfig.ViewId);\r
+        button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        button->SetImageSrc(buttonconfig.ImageSrc, buttonconfig.ImageSrc);\r
+        button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        if(clickListener!=NULL)\r
+        button->SetOnClickListener(clickListener);\r
+\r
+        button->SetText(buttonconfig.str);\r
+        button->SetAlign(TEXT_ALIGNMENT_LEFT);\r
+        button->SetLabelPosition(buttonconfig.label_x,buttonconfig.label_y );\r
+        button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, buttonconfig.Fontsize);\r
+        //button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        button->SetImagePosition(30, 25);\r
+        return button;\r
     }\r
 \r
-    void PhoneDirView::DeInit()\r
+   \r
+    void PhoneDirView::initView_ext(int x,int y,int w,int h,int interval,const char *imagsrc)\r
     {\r
-        if (container_ != nullptr)\r
-        {\r
-            container_->RemoveAll();\r
-            delete container_;\r
-            container_ = nullptr;\r
-        }\r
-        if (scrollView1_ != nullptr)\r
-        {\r
-            delete scrollView1_;\r
-            scrollView1_ = nullptr;\r
-        }\r
-        if (label1_ != nullptr)\r
-        {\r
-            delete label1_;\r
-            label1_ = nullptr;\r
-        }\r
-        if (label2_ != nullptr)\r
-        {\r
-            delete label2_;\r
-            label2_ = nullptr;\r
-        }\r
-        if (image1_ != nullptr)\r
-        {\r
-            delete image1_;\r
-            image1_ = nullptr;\r
-        }\r
+        /* -------------------------------------------------------------------------- */\r
+        UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
+        /* -------------------------------------------------------------------------- */\r
+        ButtonConfig_ext_t buttonconfig;\r
+        buttonconfig.x = x;\r
+        buttonconfig.y = y;\r
+        buttonconfig.w = w;\r
+        buttonconfig.h = h;\r
+\r
+        int len =addressbook_t.num;\r
+\r
+        for(int i=0;i<len;i++)\r
+        {\r
+            buttonconfig.str=addressbook_t.Contact_t[i].name;\r
+            //char buf[32]={0};\r
+            //sprintf(buf,"1",i);\r
+            //buf[0]=i+48;\r
+            buttonconfig.ViewId =number_str[i];\r
+            \r
+            buttonconfig.ImageSrc = addressbook_t.Contact_t[i].sex ? PHONE_DIR_BOY:PHONE_DIR_GIRL;\r
+            buttonconfig.label_x=120;\r
+            buttonconfig.label_y=0;\r
+            buttonconfig.Fontsize=30;\r
+            buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT;\r
+            button[i] = SetTheButton_ext(buttonconfig, clickListener);\r
+            buttonconfig.y+=interval;\r
+            container_->Add(button[i]);\r
+        }\r
+        onepage_address_init();\r
+        /* -------------------------------------------------------------------------- */  \r
     }\r
 \r
-#endif\r
-    void PhoneDirView::Init()\r
+    void PhoneDirView :: onepage_address_init(void)\r
     {\r
-        if (container_ == nullptr)\r
-        {\r
-            container_ = new UIViewGroup();\r
-            container_->SetPosition(0, 0, 466, 466);\r
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+        if (container_one_page == nullptr) {\r
+        container_one_page = new UIScrollView();\r
+        container_one_page->SetPosition(0, 0,Screen::GetInstance().GetWidth(),Screen::GetInstance().GetHeight());\r
+        container_one_page->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+        container_one_page->SetViewId("container_one_page");\r
         }\r
-\r
-        // Add ScrollView to App\r
-        if (scrollView1_ == nullptr)\r
-        {\r
-            scrollView1_ = new UIScrollView();\r
-        }\r
-        scrollView1_->SetPosition(0, 0);        // widget's left position and top position\r
-        scrollView1_->Resize(466, 466);         // widget's width and height\r
-        scrollView1_->SetViewId("scrollView1"); // Set style\r
-        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
-\r
-        // Set additional property\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnDragListener *scrollView1Drag = static_cast<UIView::OnDragListener *>(PhoneDirPresenter::GetInstance());\r
-        scrollView1_->SetOnDragListener(scrollView1Drag);\r
-        // Add to rootView\r
-        container_->Add(scrollView1_);\r
-        scrollView1_->SetVisible(true);\r
-\r
+    \r
         // Add Label to App\r
-        if (label1_ == nullptr)\r
-        {\r
-            label1_ = new UILabel();\r
+        if (label1_phone_name == nullptr) {\r
+            label1_phone_name = new UILabel();\r
         }\r
-        label1_->SetPosition(158, 52); // widget's left position and top position\r
-        label1_->Resize(200, 60);      // widget's width and height\r
-        label1_->SetViewId("label1");  // Set style\r
-        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label1_phone_name->SetPosition(158, 63);         // widget's left position and top position\r
+        label1_phone_name->Resize(206, 69);          // widget's width and height\r
+        label1_phone_name->SetViewId("label1");// Set style\r
+        label1_phone_name->SetStyle(STYLE_TEXT_FONT, 50);\r
 \r
         // Set additional property\r
-        label1_->SetText("常用联系人");\r
-        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label1_->SetRollSpeed(0);\r
-        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
-        // Add to scrollView1\r
-        scrollView1_->Add(label1_);\r
-        label1_->SetVisible(true);\r
-\r
-        // Add LabelButtonExt to App\r
-        if (labelButton8_ == nullptr)\r
-        {\r
-            labelButton8_ = new UILabelButtonExt();\r
-        }\r
-        labelButton8_->SetPosition(43, 243);      // widget's left position and top position\r
-        labelButton8_->Resize(380, 100);          // widget's width and height\r
-        labelButton8_->SetViewId("labelButton2"); // Set style\r
-        labelButton8_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
-\r
-        // Set additional property\r
-        labelButton8_->SetText("张三");\r
-        labelButton8_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-        labelButton8_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *labelButton8Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
-        labelButton8_->SetOnClickListener(labelButton8Click);\r
-        // Add to scrollView1\r
-        scrollView1_->Add(labelButton8_);\r
-        labelButton8_->SetVisible(true);\r
+        label1_phone_name->SetText(addressbook_t.Contact_t[0].name);\r
+        label1_phone_name->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label1_phone_name->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label1_phone_name->SetRollSpeed(0);\r
+        label1_phone_name->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 50);\r
 \r
+        // Add to rootView\r
+        container_one_page->Add(label1_phone_name);\r
+        label1_phone_name->SetVisible(true);\r
+        \r
         // Add ImageView to App\r
-        if (image2_ == nullptr)\r
-        {\r
-            image2_ = new UIImageView();\r
-        }\r
-        image2_->SetPosition(82, 260); // widget's left position and top position\r
-        image2_->Resize(89, 80);       // widget's width and height\r
-        image2_->SetViewId("image2");  // Set style\r
-\r
+        if (phone_name == nullptr) {\r
+            phone_name = new UIImageView();\r
+        }\r
+        phone_name->SetPosition(170, 140);         // widget's left position and top position\r
+        phone_name->Resize(109, 111);          // widget's width and height\r
+        phone_name->SetViewId("image1");// Set style\r
+        const char *Imagesrc=addressbook_t.Contact_t[0].sex ? PHONE_DIR_BOY_1:PHONE_DIR_GIRL_1;\r
+        phone_name->SetSrc(Imagesrc);\r
         // Set additional property\r
-#ifdef _WIN32\r
-        char *image2imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-boy.bin";\r
-#else\r
-        char *image2imagesPath = "/user/res/Phone/little-boy.bin";\r
-#endif\r
-        image2_->SetSrc(image2imagesPath);\r
-\r
-        // Add to scrollView1\r
-        scrollView1_->Add(image2_);\r
-        image2_->SetVisible(true);\r
-\r
-        // Add LabelButtonExt to App\r
-        if (labelButton9_ == nullptr)\r
-        {\r
-            labelButton9_ = new UILabelButtonExt();\r
-        }\r
-        labelButton9_->SetPosition(43, 363);      // widget's left position and top position\r
-        labelButton9_->Resize(380, 100);          // widget's width and height\r
-        labelButton9_->SetViewId("labelButton3"); // Set style\r
-        labelButton9_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
 \r
-        // Set additional property\r
-        labelButton9_->SetText("徐七");\r
-        labelButton9_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-        labelButton9_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        // SystemScrollView[TESTVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+        // SystemScrollView[TESTVIEW]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        // SystemScrollView[TESTVIEW]->SetScrollBlankSize(35);\r
+        // SystemScrollView[TESTVIEW]->SetReboundSize(50);\r
+        // SystemScrollView[TESTVIEW]->SetDirection(1);\r
+        // Add to rootView\r
+        container_one_page->Add(phone_name);\r
+        phone_name->SetVisible(true);\r
+        container_one_page->SetVisible(false);\r
+        container_one_page->SetDraggable(true);\r
+        container_one_page->SetTouchable(true);\r
+        RootView::GetInstance()->Add(container_one_page);\r
 \r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *labelButton9Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
-        labelButton9_->SetOnClickListener(labelButton9Click);\r
-        // Add to scrollView1\r
-        scrollView1_->Add(labelButton9_);\r
-        labelButton9_->SetVisible(true);\r
 \r
-        // Add ImageView to App\r
-        if (image3_ == nullptr)\r
-        {\r
-            image3_ = new UIImageView();\r
-        }\r
-        image3_->SetPosition(86, 381); // widget's left position and top position\r
-        image3_->Resize(100, 100);     // widget's width and height\r
-        image3_->SetViewId("image3");  // Set style\r
 \r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image3imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-boy.bin";\r
-#else\r
-        char *image3imagesPath = "/user/res/Phone/little-boy.bin";\r
-#endif\r
-        image3_->SetSrc(image3imagesPath);\r
+        UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
+        /* -------------------------------------------------------------------------- */\r
+        ButtonConfig_ext_t buttonconfig;\r
+        buttonconfig.x = 80;\r
+        buttonconfig.y = 300;\r
+        buttonconfig.w = 319;\r
+        buttonconfig.h = 106;\r
 \r
-        // Add to scrollView1\r
-        scrollView1_->Add(image3_);\r
-        image3_->SetVisible(true);\r
+        int len =addressbook_t.Contact_t[0].phone_num;\r
 \r
-        // Add LabelButtonExt to App\r
-        if (labelButton10_ == nullptr)\r
+        for(int i=0;i<2;i++)\r
         {\r
-            labelButton10_ = new UILabelButtonExt();\r
+            buttonconfig.str=addressbook_t.Contact_t[0].phone_number_t[0].number;\r
+            char buf[32]={0};\r
+            sprintf(buf,"button_%d",i);\r
+            buttonconfig.ViewId =buf;\r
+            \r
+            buttonconfig.label_x=50;\r
+            buttonconfig.label_y=0;\r
+            buttonconfig.Fontsize=30;\r
+            buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT;\r
+            number_button[i] = SetTheButton_ext(buttonconfig,NULL);\r
+            buttonconfig.y+=120;\r
+            container_one_page->Add(number_button[i]);\r
         }\r
-        labelButton10_->SetPosition(43, 483);      // widget's left position and top position\r
-        labelButton10_->Resize(380, 100);          // widget's width and height\r
-        labelButton10_->SetViewId("labelButton4"); // Set style\r
-        labelButton10_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
-\r
-        // Set additional property\r
-        labelButton10_->SetText("萧炎");\r
-        labelButton10_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-        labelButton10_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
 \r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *labelButton10Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
-        labelButton10_->SetOnClickListener(labelButton10Click);\r
-        // Add to scrollView1\r
-        scrollView1_->Add(labelButton10_);\r
-        labelButton10_->SetVisible(true);\r
 \r
-        // Add ImageView to App\r
-        if (image5_ == nullptr)\r
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(PhoneDirPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
         {\r
-            image5_ = new UIImageView();\r
+            return;\r
         }\r
-        image5_->SetPosition(92, 499); // widget's left position and top position\r
-        image5_->Resize(100, 100);     // widget's width and height\r
-        image5_->SetViewId("image5");  // Set style\r
+        container_one_page->SetOnDragListener(draglistener);\r
 \r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image5imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-girl.bin";\r
-#else\r
-        char *image5imagesPath = "/user/res/Phone/little-girl.bin";\r
-#endif\r
-        image5_->SetSrc(image5imagesPath);\r
 \r
-        // Add to scrollView1\r
-        scrollView1_->Add(image5_);\r
-        image5_->SetVisible(true);\r
+        return;\r
+        \r
+    }\r
 \r
-        // Add ImageView to App\r
-        if (image7_ == nullptr)\r
+    void PhoneDirView::Set_onepage_address(const char *idstr)\r
+    {\r
+        if(strcmp("container_one_page",idstr)==0)\r
         {\r
-            image7_ = new UIImageView();\r
-        }\r
-        image7_->SetPosition(167, -106); // widget's left position and top position\r
-        image7_->Resize(100, 100);       // widget's width and height\r
-        image7_->SetViewId("image7");    // Set style\r
-\r
-        // Set additional property\r
-\r
-        // Add to scrollView1\r
-        scrollView1_->Add(image7_);\r
-        image7_->SetVisible(true);\r
+            container_->SetVisible(true);\r
+            container_one_page->SetVisible(false);\r
+            return;\r
 \r
-        // Add LabelButtonExt to App\r
-        if (labelButton13_ == nullptr)\r
-        {\r
-            labelButton13_ = new UILabelButtonExt();\r
         }\r
-        labelButton13_->SetPosition(43, 723);      // widget's left position and top position\r
-        labelButton13_->Resize(380, 100);          // widget's width and height\r
-        labelButton13_->SetViewId("labelButton6"); // Set style\r
-        labelButton13_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
 \r
-        // Set additional property\r
-        labelButton13_->SetText("李四");\r
-        labelButton13_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-        labelButton13_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        container_->SetVisible(false);\r
+        container_one_page->SetVisible(true);\r
+        uint8_t id= atoi(idstr);//idstr[16];\r
+        if(addressbook_t.Contact_t[id].name)    \r
+        label1_phone_name->SetText(addressbook_t.Contact_t[id].name);\r
+        const char *Imagesrc=addressbook_t.Contact_t[id].sex ? PHONE_DIR_BOY_1:PHONE_DIR_GIRL_1;\r
+        phone_name->SetSrc(Imagesrc);\r
 \r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *labelButton13Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
-        labelButton13_->SetOnClickListener(labelButton13Click);\r
-        // Add to scrollView1\r
-        scrollView1_->Add(labelButton13_);\r
-        labelButton13_->SetVisible(true);\r
+        int len =addressbook_t.Contact_t[id].phone_num;\r
 \r
-        // Add ImageView to App\r
-        if (image9_ == nullptr)\r
+        for(int i=0;i<len;i++)\r
         {\r
-            image9_ = new UIImageView();\r
+            number_button[i]->SetVisible(true);\r
+            if(addressbook_t.Contact_t[id].phone_number_t[i].number)\r
+            number_button[i]->SetText(addressbook_t.Contact_t[id].phone_number_t[i].number);  \r
         }\r
-        image9_->SetPosition(100, 745); // widget's left position and top position\r
-        image9_->Resize(100, 100);      // widget's width and height\r
-        image9_->SetViewId("image9");   // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image9imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-boy.bin";\r
-#else\r
-        char *image9imagesPath = "/user/res/Phone/little-boy.bin";\r
-#endif\r
-        image9_->SetSrc(image9imagesPath);\r
-\r
-        // Add to scrollView1\r
-        scrollView1_->Add(image9_);\r
-        image9_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image8_ == nullptr)\r
+        if(len<2)\r
         {\r
-            image8_ = new UIImageView();\r
+            number_button[1]->SetVisible(false);\r
         }\r
-        image8_->SetPosition(183, 874); // widget's left position and top position\r
-        image8_->Resize(100, 100);      // widget's width and height\r
-        image8_->SetViewId("image8");   // Set style\r
-\r
-        // Set additional property\r
-\r
-        // Add to scrollView1\r
-        scrollView1_->Add(image8_);\r
-        image8_->SetVisible(true);\r
+        RootView::GetInstance()->Invalidate();\r
+        return;\r
+        \r
+    // // Add LabelButtonExt to App\r
+    // if (labelButton5_ == nullptr) {\r
+    //     labelButton5_ = new UILabelButtonExt();\r
+    // }\r
+    // labelButton5_->SetPosition(107, 293);         // widget's left position and top position\r
+    // labelButton5_->Resize(252, 77);          // widget's width and height\r
+    // labelButton5_->SetViewId("labelButton5");// Set style\r
+\r
+    // // Set additional property\r
+    // labelButton5_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 16);\r
+    // labelButton5_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+    // // Add to rootView\r
+    // container_->Add(labelButton5_);\r
+    // labelButton5_->SetVisible(true);\r
+    }\r
+    \r
+    // void PhoneDirView::phone_have_Init()\r
+    // {\r
+       \r
+    // }\r
 \r
-        // Add LabelButtonExt to App\r
-        if (labelButton11_ == nullptr)\r
+    void PhoneDirView::DeInit()\r
+    {\r
+        if (container_ != nullptr)\r
         {\r
-            labelButton11_ = new UILabelButtonExt();\r
-        }\r
-        labelButton11_->SetPosition(43, 603);      // widget's left position and top position\r
-        labelButton11_->Resize(380, 100);          // widget's width and height\r
-        labelButton11_->SetViewId("labelButton5"); // Set style\r
-        labelButton11_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
-\r
-        // Set additional property\r
-        labelButton11_->SetText("王六");\r
-        labelButton11_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-        labelButton11_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *labelButton11Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
-        labelButton11_->SetOnClickListener(labelButton11Click);\r
-        // Add to scrollView1\r
-        scrollView1_->Add(labelButton11_);\r
-        labelButton11_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image6_ == nullptr)\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+            if(label1_no==NULL)\r
+            {\r
+                if(label1_)\r
+                {\r
+                    delete label1_;\r
+                    label1_ = nullptr;\r
+                }\r
+                for(int i=0;i<addressbook_t.num;i++)\r
+                {    \r
+                    if( button[i])\r
+                    {\r
+                        delete  button[i];\r
+                        button[i] = nullptr;\r
+                    }\r
+                }\r
+\r
+                container_one_page->RemoveAll();\r
+                delete container_one_page;\r
+                container_one_page = nullptr;\r
+                if(phone_name)\r
+                {\r
+                    delete phone_name;\r
+                    phone_name = nullptr;\r
+                }\r
+                if(label1_phone_name)\r
+                {\r
+                    delete label1_phone_name;\r
+                    label1_phone_name = nullptr;\r
+                }\r
+                for(int i=0;i<2;i++)\r
+                {    \r
+                    if( number_button[i])\r
+                    {\r
+                        delete  number_button[i];\r
+                        number_button[i] = nullptr;\r
+                    }\r
+                }\r
+                write_addressbook_bin_flle();\r
+            }\r
+            else\r
+            {\r
+                delete label1_no;\r
+                label1_no=nullptr;\r
+                delete label2_no;\r
+                label2_no=nullptr;\r
+                delete image1_no;\r
+                image1_no=nullptr;\r
+                \r
+            }\r
+        }\r
+       \r
+    }\r
+    UIView *PhoneDirView::GetView()\r
+    {\r
+        if (label1_no == nullptr)\r
         {\r
-            image6_ = new UIImageView();\r
+            label1_no = new UILabel();\r
         }\r
-        image6_->SetPosition(95, 617); // widget's left position and top position\r
-        image6_->Resize(100, 100);     // widget's width and height\r
-        image6_->SetViewId("image6");  // Set style\r
+        label1_no->SetPosition(158, 52); // widget's left position and top position\r
+        label1_no->Resize(200, 60);      // widget's width and height\r
+        label1_no->SetViewId("label1");  // Set style\r
+        label1_no->SetStyle(STYLE_TEXT_FONT, 30);\r
 \r
         // Set additional property\r
-#ifdef _WIN32\r
-        char *image6imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-girl.bin";\r
-#else\r
-        char *image6imagesPath = "/user/res/Phone/little-girl.bin";\r
-#endif\r
-        image6_->SetSrc(image6imagesPath);\r
+        label1_no->SetText("常用联系人");\r
+        label1_no->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label1_no->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label1_no->SetRollSpeed(0);\r
+        label1_no->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(image6_);\r
-        image6_->SetVisible(true);\r
+        container_->Add(label1_no);\r
+        label1_no->SetVisible(false);\r
 \r
-        // Add LabelButtonExt to App\r
-        if (labelButton7_ == nullptr)\r
+        // Add Label to App\r
+        if (label2_no == nullptr)\r
         {\r
-            labelButton7_ = new UILabelButtonExt();\r
+            label2_no = new UILabel();\r
         }\r
-        labelButton7_->SetPosition(43, 123);      // widget's left position and top position\r
-        labelButton7_->Resize(380, 100);          // widget's width and height\r
-        labelButton7_->SetViewId("labelButton1"); // Set style\r
-        labelButton7_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        label2_no->SetPosition(51, 291); // widget's left position and top position\r
+        label2_no->Resize(400, 124);     // widget's width and height\r
+        label2_no->SetViewId("label2");  // Set style\r
+        label2_no->SetStyle(STYLE_TEXT_FONT, 26);\r
 \r
         // Set additional property\r
-        labelButton7_->SetText("KUMI同学(客服热线)");\r
-        labelButton7_->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff));\r
-        labelButton7_->SetAlign(TEXT_ALIGNMENT_RIGHT);\r
-        labelButton7_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-        labelButton7_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *labelButton7Click = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
-        labelButton7_->SetOnClickListener(labelButton7Click);\r
+        label2_no->SetText("未添加联系人,请前往“小希爱\n玩”APP进行设置");\r
+        label2_no->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label2_no->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
+        label2_no->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label2_no->SetRollSpeed(0);\r
+        label2_no->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+\r
         // Add to scrollView1\r
-        scrollView1_->Add(labelButton7_);\r
-        labelButton7_->SetVisible(true);\r
+        container_->Add(label2_no);\r
+        label2_no->SetVisible(true);\r
 \r
         // Add ImageView to App\r
-        if (image1_ == nullptr)\r
+        if (image1_no == nullptr)\r
         {\r
-            image1_ = new UIImageView();\r
+            image1_no = new UIImageView();\r
         }\r
-        image1_->SetPosition(76, 141); // widget's left position and top position\r
-        image1_->Resize(100, 100);     // widget's width and height\r
-        image1_->SetViewId("image1");  // Set style\r
+        image1_no->SetPosition(158, 120); // widget's left position and top position\r
+        image1_no->Resize(150, 150);      // widget's width and height\r
+        image1_no->SetViewId("image1");   // Set style\r
 \r
         // Set additional property\r
 #ifdef _WIN32\r
-        char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Phone/little-girl.bin";\r
+        char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/PhoneDir/PhoneDirdir.bin";\r
 #else\r
-        char *image1imagesPath = "/user/res/Phone/little-girl.bin";\r
+        char *image1imagesPath = "/user/res/Phone/phonedir.bin";\r
 #endif\r
-        image1_->SetSrc(image1imagesPath);\r
+        image1_no->SetSrc(image1imagesPath);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(image1_);\r
-        image1_->SetVisible(true);\r
-    }\r
-\r
-    void PhoneDirView::DeInit()\r
-    {\r
-        if (container_ != nullptr)\r
-        {\r
-            container_->RemoveAll();\r
-            delete container_;\r
-            container_ = nullptr;\r
-        }\r
-        if (scrollView1_ != nullptr)\r
-        {\r
-            delete scrollView1_;\r
-            scrollView1_ = nullptr;\r
-        }\r
-        if (label1_ != nullptr)\r
-        {\r
-            delete label1_;\r
-            label1_ = nullptr;\r
-        }\r
-        if (labelButton8_ != nullptr)\r
-        {\r
-            delete labelButton8_;\r
-            labelButton8_ = nullptr;\r
-        }\r
-        if (image2_ != nullptr)\r
-        {\r
-            delete image2_;\r
-            image2_ = nullptr;\r
-        }\r
-        if (labelButton9_ != nullptr)\r
-        {\r
-            delete labelButton9_;\r
-            labelButton9_ = nullptr;\r
-        }\r
-        if (image3_ != nullptr)\r
-        {\r
-            delete image3_;\r
-            image3_ = nullptr;\r
-        }\r
-        if (labelButton10_ != nullptr)\r
-        {\r
-            delete labelButton10_;\r
-            labelButton10_ = nullptr;\r
-        }\r
-        if (image5_ != nullptr)\r
-        {\r
-            delete image5_;\r
-            image5_ = nullptr;\r
-        }\r
-        if (image7_ != nullptr)\r
-        {\r
-            delete image7_;\r
-            image7_ = nullptr;\r
-        }\r
-        if (labelButton13_ != nullptr)\r
-        {\r
-            delete labelButton13_;\r
-            labelButton13_ = nullptr;\r
-        }\r
-        if (image9_ != nullptr)\r
-        {\r
-            delete image9_;\r
-            image9_ = nullptr;\r
-        }\r
-        if (image8_ != nullptr)\r
-        {\r
-            delete image8_;\r
-            image8_ = nullptr;\r
-        }\r
-        if (labelButton11_ != nullptr)\r
-        {\r
-            delete labelButton11_;\r
-            labelButton11_ = nullptr;\r
-        }\r
-        if (image6_ != nullptr)\r
-        {\r
-            delete image6_;\r
-            image6_ = nullptr;\r
-        }\r
-        if (labelButton7_ != nullptr)\r
-        {\r
-            delete labelButton7_;\r
-            labelButton7_ = nullptr;\r
-        }\r
-        if (image1_ != nullptr)\r
-        {\r
-            delete image1_;\r
-            image1_ = nullptr;\r
-        }\r
-    }\r
-    UIView *PhoneDirView::GetView()\r
-    {\r
-        Init();\r
+        container_->Add(image1_no);\r
+        image1_no->SetVisible(true);\r
         return container_;\r
     }\r
     void PhoneDirView::OnStart()\r
@@ -597,6 +377,10 @@ namespace OHOS
         container_->SetWidth(Screen::GetInstance().GetWidth());\r
         container_->SetHeight(Screen::GetInstance().GetHeight());\r
 \r
+        container_->SetScrollBlankSize(35);\r
+        container_->SetReboundSize(50);\r
+        container_->SetDirection(1);\r
+\r
         // 创建 draglistener 实例并设置为拖动监听器\r
         UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(PhoneDirPresenter::GetInstance());\r
         if (draglistener == nullptr)\r
@@ -607,8 +391,37 @@ namespace OHOS
 \r
         container_->SetTouchable(true);\r
         container_->SetDraggable(true);\r
+        //read_addressbook_bin_file();\r
+\r
+\r
+         if (label1_ == nullptr) {\r
+        label1_ = new UILabel();\r
+            }\r
+        label1_->SetPosition(158, 18);         // widget's left position and top position\r
+        label1_->Resize(800, 88);          // widget's width and height\r
+        label1_->SetViewId("label1");// Set style\r
+        label1_->SetStyle(STYLE_TEXT_FONT, 50);\r
+\r
+        label1_->SetText("通讯录");\r
+        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label1_->SetTextColor(Color::GetColorFromRGBA(0xac, 0xa4, 0xa4, 0xff));\r
+        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label1_->SetRollSpeed(0);\r
+        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 50);\r
+        container_->Add(label1_);\r
+\r
+        if(addressbook_t.num<=0 ||addressbook_t.num>20)\r
+        {\r
+            GetView();\r
+        }\r
+        else\r
+        {\r
+            initView_ext(73,95,319,106,120,NULL);\r
+        }\r
+            \r
+\r
+      \r
 \r
-        GetView();\r
         RootView::GetInstance()->Add(container_);\r
     }\r
 \r
index f195441..326c969 100644 (file)
@@ -32,31 +32,31 @@ namespace OHOS
 \r
     void PhoneView::Init()\r
     {\r
-        if (container_ == nullptr)\r
-        {\r
-            container_ = new UIViewGroup();\r
-            container_->SetPosition(0, 0, 466, 466);\r
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
-        }\r
+        // if (container_ == nullptr)\r
+        // {\r
+        //     container_ = new UIViewGroup();\r
+        //     container_->SetPosition(0, 0, 466, 466);\r
+        //     container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+        // }\r
 \r
         // Add ScrollView to App\r
-        if (scrollView1_ == nullptr)\r
+        if (container_ == nullptr)\r
         {\r
-            scrollView1_ = new UIScrollView();\r
+            container_ = new UIScrollView();\r
         }\r
-        scrollView1_->SetPosition(0, 0);        // widget's left position and top position\r
-        scrollView1_->Resize(466, 466);         // widget's width and height\r
-        scrollView1_->SetViewId("scrollView1"); // Set style\r
-        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        container_->SetPosition(0, 0);        // widget's left position and top position\r
+        container_->Resize(466, 466);         // widget's width and height\r
+        container_->SetViewId("scrollView1"); // Set style\r
+        container_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
 \r
         // Set additional property\r
 \r
-        // Add the CallBack about events\r
-        UIView::OnDragListener *scrollView1Drag = static_cast<UIView::OnDragListener *>(PhonePresenter::GetInstance());\r
-        scrollView1_->SetOnDragListener(scrollView1Drag);\r
+        // // Add the CallBack about events\r
+        // UIView::OnDragListener *scrollView1Drag = static_cast<UIView::OnDragListener *>(PhonePresenter::GetInstance());\r
+        // container_->SetOnDragListener(scrollView1Drag);\r
         // Add to rootView\r
-        container_->Add(scrollView1_);\r
-        scrollView1_->SetVisible(true);\r
+        //container_->Add(scrollView1_);\r
+        container_->SetVisible(true);\r
 \r
         // Add Label to App\r
         if (label1_ == nullptr)\r
@@ -76,7 +76,7 @@ namespace OHOS
         label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label1_);\r
+        container_->Add(label1_);\r
         label1_->SetVisible(true);\r
 \r
         // Add ImageView to App\r
@@ -91,7 +91,7 @@ namespace OHOS
         // Set additional property\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(image1_);\r
+        container_->Add(image1_);\r
         image1_->SetVisible(true);\r
 \r
         // Add Button to App\r
@@ -119,7 +119,7 @@ namespace OHOS
         UIView::OnClickListener *button2Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
         button2_->SetOnClickListener(button2Click);\r
         // Add to scrollView1\r
-        scrollView1_->Add(button2_);\r
+        container_->Add(button2_);\r
         button2_->SetVisible(true);\r
 \r
         // Add Button to App\r
@@ -147,7 +147,7 @@ namespace OHOS
         UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
         button1_->SetOnClickListener(button1Click);\r
         // Add to scrollView1\r
-        scrollView1_->Add(button1_);\r
+        container_->Add(button1_);\r
         button1_->SetVisible(true);\r
 \r
         // Add Button to App\r
@@ -167,7 +167,7 @@ namespace OHOS
         UIView::OnClickListener *button5Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
         button5_->SetOnClickListener(button5Click);\r
         // Add to scrollView1\r
-        scrollView1_->Add(button5_);\r
+        container_->Add(button5_);\r
         button5_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -188,7 +188,7 @@ namespace OHOS
         label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label2_);\r
+        container_->Add(label2_);\r
         label2_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -209,7 +209,7 @@ namespace OHOS
         label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label3_);\r
+        container_->Add(label3_);\r
         label3_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -230,7 +230,7 @@ namespace OHOS
         label4_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label4_);\r
+        container_->Add(label4_);\r
         label4_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -251,7 +251,7 @@ namespace OHOS
         label9_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label9_);\r
+        container_->Add(label9_);\r
         label9_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -273,7 +273,7 @@ namespace OHOS
         label14_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label14_);\r
+        container_->Add(label14_);\r
         label14_->SetVisible(true);\r
 \r
         // Add Button to App\r
@@ -294,7 +294,7 @@ namespace OHOS
         UIView::OnClickListener *button3Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
         button3_->SetOnClickListener(button3Click);\r
         // Add to scrollView1\r
-        scrollView1_->Add(button3_);\r
+        container_->Add(button3_);\r
         button3_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -315,7 +315,7 @@ namespace OHOS
         label13_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label13_);\r
+        container_->Add(label13_);\r
         label13_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -336,7 +336,7 @@ namespace OHOS
         label12_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label12_);\r
+        container_->Add(label12_);\r
         label12_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -358,7 +358,7 @@ namespace OHOS
         label10_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label10_);\r
+        container_->Add(label10_);\r
         label10_->SetVisible(true);\r
 \r
         // Add Button to App\r
@@ -380,7 +380,7 @@ namespace OHOS
         UIView::OnClickListener *button7Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
         button7_->SetOnClickListener(button7Click);\r
         // Add to scrollView1\r
-        scrollView1_->Add(button7_);\r
+        container_->Add(button7_);\r
         button7_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -401,7 +401,7 @@ namespace OHOS
         label11_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label11_);\r
+        container_->Add(label11_);\r
         label11_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -422,7 +422,7 @@ namespace OHOS
         label16_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label16_);\r
+        container_->Add(label16_);\r
         label16_->SetVisible(true);\r
 \r
         // Add Label to App\r
@@ -443,7 +443,7 @@ namespace OHOS
         label15_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(label15_);\r
+        container_->Add(label15_);\r
         label15_->SetVisible(true);\r
 \r
         // Add ImageView to App\r
@@ -458,23 +458,24 @@ namespace OHOS
         // Set additional property\r
 \r
         // Add to scrollView1\r
-        scrollView1_->Add(image3_);\r
+        container_->Add(image3_);\r
         image3_->SetVisible(true);\r
     }\r
 \r
     void PhoneView::DeInit()\r
     {\r
+        // if (container_ != nullptr)\r
+        // {\r
+        //     container_->RemoveAll();\r
+        //     delete container_;\r
+        //     container_ = nullptr;\r
+        // }\r
         if (container_ != nullptr)\r
         {\r
             container_->RemoveAll();\r
             delete container_;\r
             container_ = nullptr;\r
         }\r
-        if (scrollView1_ != nullptr)\r
-        {\r
-            delete scrollView1_;\r
-            scrollView1_ = nullptr;\r
-        }\r
         if (label1_ != nullptr)\r
         {\r
             delete label1_;\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp
new file mode 100644 (file)
index 0000000..5fbe59a
--- /dev/null
@@ -0,0 +1,322 @@
+#include "phone/include/phoneaddressmodel.h"
+#include "wearable_log.h"
+#include <iostream>
+#include <string>
+#include "custom_utils.h"
+#include <cmsis_os2.h>
+#include <service/graphic_service.h>
+#include "thread_adapter.h"
+#include <iostream>
+#include <sstream>
+#include <iomanip>
+#include <string>
+#include "cmsis_os.h"
+
+#include "samgr_lite.h"
+
+
+
+
+namespace OHOS
+{
+    struct addressbook addressbook_t;
+
+    void read_addressbook_bin_file()
+    {
+
+    FILE *fp= fopen(ADDRESS_BOOK_PATH,"rb+");
+    if(fp==NULL)
+    {
+        fp= fopen(ADDRESS_BOOK_PATH,"wb+");
+        fclose(fp);
+        return;
+    }
+    char buf[124*20];
+    int ret=fread(buf,1,512,fp);
+    int offset_f=512;
+    while (ret==512)
+    {
+        ret=fread(&buf[offset_f],1,512,fp);
+        offset_f+=512;
+    }
+    
+    int num=buf[0];//人数
+    printf("人数: %d\r\n",num);
+    addressbook_t.num=num;
+    int offset=1;
+    for (int j=0;j<num;j++)
+    {
+        uint8_t sex = buf[offset];
+        printf("性别: %d\r\n",sex);
+        addressbook_t.Contact_t[j].sex=sex;
+        offset=offset+1;
+        uint8_t name_len=buf[offset];
+        printf("name_len %d\r\n",name_len);
+        char *name=(char *)malloc(sizeof(char)*name_len+1);
+        memset(name,0,name_len+1);
+        if(name_len==0)
+        {
+            name_len=strlen("未知");
+           printf("未知\r\n");
+        }
+        else
+        {
+            memcpy(name,&buf[offset+1],name_len);
+            printf("姓名: %s\r\n",name);
+            addressbook_t.Contact_t[j].name=name;
+        }
+        offset=offset+name_len+1;
+        uint8_t phone_num=buf[offset]; 
+        offset=offset+1;
+        addressbook_t.Contact_t[j].phone_num=phone_num;
+        for(int i=0;i<phone_num;i++)
+        { 
+
+            uint8_t phonen_len=buf[offset];
+            //char phonen_name[32]={0};
+            char *phonen_name=(char *)malloc(sizeof(char)*phonen_len+1);
+            memset(phonen_name,0,phonen_len+1);
+            memcpy(phonen_name,&buf[offset+1],phonen_len);
+            printf("号码: %s\r\n",phonen_name);
+            addressbook_t.Contact_t[j].phone_number_t[i].number=phonen_name;
+            offset=offset+phonen_len+1;
+        }
+        for(int i=0;i<phone_num;i++)
+        {
+            uint8_t add = buf[offset];
+            printf("归属地长度: %d\r\n",add);
+            char *add_buf=(char *)malloc(sizeof(char)*add+1);
+            memset(add_buf,0,add+1);
+            memcpy(add_buf,&buf[offset+1],add);
+            printf("归属地: %s\r\n",add_buf);
+            addressbook_t.Contact_t[j].phone_number_t[i].affiliating_area=add_buf;
+            offset=offset+add+1;
+
+            uint8_t yun = buf[offset];
+            char *yun_buf=(char *)malloc(sizeof(char)*yun+1);
+            memset(yun_buf,0,yun+1);
+            memcpy(yun_buf,&buf[offset+1],yun);
+            printf("运营商: %s\r\n",add_buf);
+            addressbook_t.Contact_t[j].phone_number_t[i].operator_t=yun_buf;
+
+            offset=offset+yun+1;
+        }
+    }
+    fclose(fp);
+    }
+
+    void get_phone_addrss_name(char *name,const char *phone)
+    {
+        for(int i=0;i<addressbook_t.num;i++)
+        {
+            if(strcmp(phone,addressbook_t.Contact_t[i].phone_number_t[0].number)==0)
+            {
+                strcpy(name,addressbook_t.Contact_t[i].name);
+                return;
+            }
+            else if(phone,addressbook_t.Contact_t[i].phone_num==2)
+            {
+                if(strcmp(phone,addressbook_t.Contact_t[i].phone_number_t[1].number)==0)
+                {
+                    strcpy(name,addressbook_t.Contact_t[i].name);
+                    return;
+                }   
+            }
+        }
+        strcpy(name,"未知");
+        return;
+    }
+
+    void write_addressbook_bin_flle()
+    {
+        FILE *fp= fopen(ADDRESS_BOOK_PATH,"wb+");
+        if(fp==NULL)
+        return;
+        char buf[256*20];
+        // int ret=fread(buf,1,512,fp);
+        // int offset_f=512;
+        // while (ret==512)
+        // {
+        //     ret=fread(&buf[offset_f],1,512,fp);
+        //     offset_f+=512;
+        // }
+    
+        buf[0] =addressbook_t.num;
+        printf("人数: %d\r\n",buf[0]);
+        int offset=1;
+        for(int i=0;i<addressbook_t.num;i++)
+        {
+            buf[offset]= addressbook_t.Contact_t[i].sex;
+            offset=offset+1;
+            printf("性别 %d\r\n",buf[offset]);
+            buf[offset]=strlen(addressbook_t.Contact_t[i].name)+1;
+            printf("写入名字长度: %d\r\n",buf[offset]);
+            memcpy(&buf[offset+1],addressbook_t.Contact_t[i].name,buf[offset]);
+            printf("写入名字: %s\r\n",&buf[offset+1]);
+            offset=offset+1+strlen(addressbook_t.Contact_t[i].name)+1;
+
+            buf[offset]=addressbook_t.Contact_t[i].phone_num;
+            printf("写入号码个数: %d\r\n",buf[offset]);
+            offset=offset+1;
+            for(int j=0;j<addressbook_t.Contact_t[i].phone_num;j++)
+            {
+                buf[offset]=strlen(addressbook_t.Contact_t[i].phone_number_t[j].number)+1;
+                memcpy(&buf[offset+1],addressbook_t.Contact_t[i].phone_number_t[j].number,buf[offset]);
+                printf("写入号码: %s\r\n",&buf[offset+1]);
+                offset=offset+1+strlen(addressbook_t.Contact_t[i].phone_number_t[j].number)+1;
+            }
+            for(int j=0;j<addressbook_t.Contact_t[i].phone_num;j++)
+            {
+                buf[offset]=strlen(addressbook_t.Contact_t[i].phone_number_t[j].affiliating_area)+1;
+                memcpy(&buf[offset+1],addressbook_t.Contact_t[i].phone_number_t[j].affiliating_area,buf[offset]);
+                printf("写入运营商: %s\r\n",&buf[offset+1]);
+                offset=offset+1+strlen(addressbook_t.Contact_t[i].phone_number_t[j].affiliating_area)+1;
+
+                buf[offset]=strlen(addressbook_t.Contact_t[i].phone_number_t[j].operator_t)+1;
+                memcpy(&buf[offset+1],addressbook_t.Contact_t[i].phone_number_t[j].operator_t,buf[offset]);
+                printf("写入所属地: %s\r\n",&buf[offset+1]);
+                offset=offset+1+strlen(addressbook_t.Contact_t[i].phone_number_t[j].operator_t)+1;
+            }
+        }
+        fwrite((void *)buf,1,offset,fp);
+        fclose(fp);
+    }
+    
+    void add_addressbook(struct Contact *data)
+    {
+       
+
+        if(data->name!=NULL)
+        {
+             
+            addressbook_t.Contact_t[addressbook_t.num].name=(char *)malloc(strlen(data->name));
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s %d",data->name,addressbook_t.num);
+            strcpy(addressbook_t.Contact_t[addressbook_t.num].name,data->name);
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",addressbook_t.Contact_t[addressbook_t.num].name);
+        }
+        else
+        {
+            addressbook_t.num-=1;
+            return;
+            addressbook_t.Contact_t[addressbook_t.num].name=(char *)malloc(strlen("未知"));
+            strcpy(addressbook_t.Contact_t[addressbook_t.num+1].name,"未知"); 
+        }
+
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneaddressbook::phoneaddressbook");
+
+        addressbook_t.Contact_t[addressbook_t.num].sex=data->sex;
+        addressbook_t.Contact_t[addressbook_t.num].phone_num=data->phone_num;
+        if(data->phone_num>2)
+        data->phone_num=2;
+        for(int i=0;i<data->phone_num;i++)
+        {
+            if(data->phone_number_t[i].number)
+            {
+                addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].number
+                =(char *)malloc(strlen(data->phone_number_t[i].number));
+                strcpy(addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].number,data->phone_number_t[i].number);
+            }
+            else
+            {
+                addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].number
+                =(char *)malloc(strlen("未知"));
+                strcpy(addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].number,"未知");
+            }
+
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneaddressbook::phoneaddressbook1111111111");
+
+            if(data->phone_number_t[i].affiliating_area)
+            {
+                addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].affiliating_area
+                =(char *)malloc(strlen(data->phone_number_t[i].affiliating_area));
+                strcpy(addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].affiliating_area,data->phone_number_t[i].affiliating_area);
+            }
+            else
+            {
+                addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].affiliating_area
+                =(char *)malloc(strlen("未知"));
+                strcpy(addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].affiliating_area,"未知");
+            }
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneaddressbook::phoneaddressbook2222222222");
+
+            if(data->phone_number_t[i].operator_t)
+            {
+                addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].operator_t
+                =(char *)malloc(strlen(data->phone_number_t[i].operator_t));
+                strcpy(addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].operator_t,data->phone_number_t[i].operator_t);
+            }
+            else
+            {
+                addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].operator_t
+                =(char *)malloc(strlen("未知"));
+                strcpy(addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].operator_t,"未知");
+            }
+        }
+        addressbook_t.num+=1;
+
+    
+    }
+    
+    void add_addressbook_by_AT(char *name,char *phone)
+    {
+        Contact data;
+        data.sex=0;
+        data.name=name;
+        data.phone_num=1;
+        data.phone_number_t[0].number=phone;
+        data.phone_number_t[0].affiliating_area=NULL;
+        data.phone_number_t[0].operator_t=NULL;
+
+        data.phone_number_t[1].number=NULL;
+        data.phone_number_t[1].affiliating_area=NULL;
+        data.phone_number_t[1].operator_t=NULL;
+
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneaddressbook::phoneaddressbook");
+        add_addressbook(&data);
+    }
+
+    void free_address()
+{
+    for(int i=0;i<addressbook_t.num;i++)
+    {
+        if(addressbook_t.Contact_t[i].name)
+        {
+            free(addressbook_t.Contact_t[i].name);
+        }
+        for(int y=0;y<addressbook_t.Contact_t[i].phone_num;y++)
+        {
+            if(addressbook_t.Contact_t[i].phone_number_t[y].number)
+            {
+                free(addressbook_t.Contact_t[i].phone_number_t[y].number);
+            }
+            if(addressbook_t.Contact_t[i].phone_number_t[y].affiliating_area)
+            {
+                free(addressbook_t.Contact_t[i].phone_number_t[y].affiliating_area);
+            }
+            if(addressbook_t.Contact_t[i].phone_number_t[y].operator_t)
+            {
+                free(addressbook_t.Contact_t[i].phone_number_t[y].operator_t);
+            }
+            
+        }
+       
+    }
+}
+
+    phoneaddressbook::phoneaddressbook()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "phoneaddressbook::phoneaddressbook");
+    }
+
+    phoneaddressbook::~phoneaddressbook()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "phoneaddressbook::~phoneaddressbook");
+    }
+
+    phoneaddressbook &phoneaddressbook::GetInstance()
+    {
+        static phoneaddressbook instance;
+        return instance;
+    }
+
+}
\ No newline at end of file
index 9e3e690..68ee1a1 100755 (executable)
@@ -10,6 +10,7 @@ set(PRIVATE_HEADER
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phone/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/producttest/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/system/include
@@ -107,6 +108,7 @@ set(PRIVATE_HEADER
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/system/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/producttest/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phone/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/config/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include
index d51939a..baa7cd9 100755 (executable)
@@ -31,6 +31,7 @@
 #include "cat1_server_hal.h"
 #include "NativeAbility.h"
 #include "custom_utils.h"
+#include "phoneaddressmodel.h"
 
 namespace OHOS {
 int changeImage = 0;
@@ -77,6 +78,7 @@ UIImageView* imageMicrophone = nullptr;
 UIImageView* imageHandUp = nullptr;
 UIImageView* imageHorns = nullptr;
 UILabel* callerNum = nullptr;
+UILabel* callername = nullptr;
 UILabel* callerDisplay = nullptr;
 UILabel* callDuration = nullptr;
 UILabel* currentTimes = nullptr;
@@ -497,6 +499,27 @@ static bool DrawPhoneCallViewLabel(void)
     callerNum->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE);
     callerNum->SetTextColor(Color::White());
 
+    // callername
+
+    callername = new UILabel();
+    if (callername == nullptr) {
+        return false;
+    }
+    callername->SetPosition(LABEL_COMINGVIEW_POSITION_X, LABEL_COMINGVIEW_POSITION_Y+40, Screen::GetInstance().GetWidth(),
+        TITLE_LABEL_DEFAULT_HEIGHT);
+    callername->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+    // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "CreatePhoneCallView phonenum:%s!",
+    //               CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+    const char *number=CallerLogModel::GetInstance()->GetPhoneNumber().c_str();
+    char name[32]={0};
+    OHOS::get_phone_addrss_name(name,number);
+
+    callername->SetText(name);
+    callername->SetAlign(TEXT_ALIGNMENT_CENTER);
+    callername->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE);
+    callername->SetTextColor(Color::White());
+
+
     comingTimes = new UILabel();
     if (comingTimes == nullptr) {
         FreePhoneCallViewLabel();
@@ -536,6 +559,7 @@ UIViewGroup* CreatePhoneCallView(void)
     phoneView->Add(imageAgree);
     phoneView->Add(imageDissgree);
     phoneView->Add(callerNum);
+    phoneView->Add(callername);
     phoneView->Add(comingTimes);
     phoneView->SetDraggable(true);
     phoneView->SetTouchable(true);
index ce50b70..76f2702 100644 (file)
@@ -12,6 +12,7 @@ set(PRIVATE_HEADER
     ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/innerkits
     ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits
     ${ROOT_DIR}/application/wearable/nativeapp/nativeui/heartrate/include
+    ${ROOT_DIR}/application/wearable/fd230app/nativeui/phone/include
 )
 
 set(SOURCES
index 8fd0cea..f693932 100644 (file)
@@ -10,6 +10,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include "phoneaddressmodel.h"
+
 #ifdef __cplusplus
 #if __cplusplus
 extern "C" {
@@ -265,6 +267,44 @@ static uint32_t AT_cat1_reset_network(uint8_t *para, uint32_t paraLen, char *str
     cat1_reset_network();
     return ERRCODE_SUCC;
 }
+
+
+static uint32_t ADD_ADDRESS(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(strCommonCmd);
+    uint8_t argv[PPG_MAX_ARGC][PPG_MAX_ARGV_LEN] = { 0 };
+    uint32_t argc = 0;
+
+    int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+    if (ret != PPG_SUCCESS) {
+        printf("CAT1TEST ATCMD Convert Command Failed\n");
+        return ERRCODE_FAIL;
+    }
+    OHOS::add_addressbook_by_AT((char *)argv[0],(char *)argv[1]);
+    //uapi_cat1_wakeup_cat1(1);
+    //u32_t sret= OsShellPing( argc, (const char *)argv[0]);
+    //printf("CAT1TEST ATCMD  ping   ret = 0x%X\n",sret);
+    //uapi_cat1_wakeup_cat1(0);
+   
+    return ERRCODE_SUCC;
+}
+
+
+static uint32_t read_ADDRESS(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(strCommonCmd);
+    uint8_t argv[PPG_MAX_ARGC][PPG_MAX_ARGV_LEN] = { 0 };
+    uint32_t argc = 0;
+
+    int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+    if (ret != PPG_SUCCESS) {
+        printf("CAT1TEST ATCMD Convert Command Failed\n");
+        return ERRCODE_FAIL;
+    }
+    OHOS::read_addressbook_bin_file();
+    return ERRCODE_SUCC;
+}
+
 static const at_cmd_table_t g_cat1_cmd[] = {
     { (char *)"AT^CAT1POWER",      cat1_power, (char *)"1" },
     { (char *)"AT^CAT1DIAL",      at_cat1_dial, (char *)"1" },
@@ -280,6 +320,9 @@ static const at_cmd_table_t g_cat1_cmd[] = {
     { (char *)"AT^CAT1RESETNETWORK",      AT_cat1_reset_network, (char *)"1" },
     { (char *)"AT^CAT1OTA",      AT_cat1_checkota, (char *)"1" },
        { (char *)"AT^CALL_1",      AT_CALL_ifconfig, (char *)"1" },
+    { (char *)"AT^CALL_ADD_ADRESSBOOK",      ADD_ADDRESS, (char *)"1" },
+    { (char *)"AT^CALL_READ_ADRESSBOOK",      read_ADDRESS, (char *)"1" },
+
 
 };