录音界面添加录音超出限制提醒弹窗,录音排序待优化
authorluozheng <1732036298@qq.com>
Mon, 2 Sep 2024 02:12:18 +0000 (10:12 +0800)
committerluozheng <1732036298@qq.com>
Mon, 2 Sep 2024 02:12:18 +0000 (10:12 +0800)
16 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp
code/sdk/application/wearable/fd230app/nativeui/record/include/RecordDeleteView.h
code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingListAdapter.h
code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingModel.h
code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingNumLimitView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingView.h
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordDeleteView.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListAdapter.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingNumLimitView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPlayerView.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingView.cpp

index c6f79f8..3bac645 100644 (file)
@@ -503,6 +503,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/record/src/RecordingView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/record/src/RecordingModel.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/record/src/RecordingVolumeSettingView.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/record/src/RecordingNumLimitView.cpp
 
 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rotate/src/RotateView.cpp   
index ab206ee..d9c1f37 100644 (file)
 #include "custom_runtime.h"\r
 #include "uiservice/include/ui_service.h"\r
 #include "power_display_service.h"\r
-#include "record/include/RecordingModel.h"\r
 #include <NativeAbility.h>\r
 #include "AppViewIDs.h"\r
 #include "player/include/PlayersView.h"\r
+#include "record/include/RecordingPlayerView.h"\r
 #ifdef __cplusplus\r
 extern "C"\r
 {\r
@@ -530,9 +530,13 @@ extern "C"
                 SendMsgToUIService(UI_UPDATE_PLAYERPROCESS, 0, nullptr, 0);\r
             }\r
         }\r
-        else if(OHOS::RecordingModel::GetInstance()->GetRecordingPlayerViewCreate())\r
+        else if(OHOS::RecordingPlayerView::GetInstance())\r
         {\r
-            SendMsgToUIService(UI_UPDATE_RECORDPROCESS, 0, nullptr, 0);\r
+            OHOS::UICheckBox::UICheckBoxState state = OHOS::RecordingPlayerView::GetInstance()->GetPlayerButtonState();\r
+            if(state == OHOS::UICheckBox::UICheckBoxState::SELECTED)\r
+            {\r
+                SendMsgToUIService(UI_UPDATE_RECORDPROCESS, 0, nullptr, 0);\r
+            }\r
         }\r
     }\r
 \r
index 08b37e7..38e3a50 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-03-30 09:14:38\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-08-26 09:44:39\r
+ * @LastEditTime: 2024-08-31 20:51:23\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordDeleteView.h\r
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE\r
  */\r
@@ -55,6 +55,7 @@ namespace OHOS
         UILabelExt *DeleteNameLabel{nullptr};\r
         UIButton *RECORD_DELETE_ON_BUTTON{nullptr};  // 是否删除录音:是\r
         UIButton *RECORD_DELETE_OFF_BUTTON{nullptr}; // 是否删除录音:否\r
+        std::string mergefileName;\r
     };\r
 } // namespace OHOS\r
 #endif
\ No newline at end of file
index adf226a..59bac81 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-05 15:20:03
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-31 20:19:31
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingListAdapter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
 #ifndef RECORDING_LIST_ADAPTER_H
 #define RECORDING_LIST_ADAPTER_H
 
@@ -10,7 +18,7 @@ namespace OHOS
     typedef struct
     {
         int index;
-        const char *recordId;        // 录音编号
+        std::string recordId;        // 录音名
         const char *recordTotalTime; // 录音总时长
         const char *recordTime;      // 录音时间
     } RecordingListItem;
index 3a2e5aa..7494f18 100644 (file)
@@ -38,7 +38,7 @@ namespace OHOS
         RECORDER_RESPONSE_MAX,
     };
 
-#define MAX_RECORDING_NUM 20
+#define MAX_RECORDING_NUM 30
     typedef struct
     {
         char recordingFileName[32]; // 录音文件名
@@ -69,17 +69,17 @@ namespace OHOS
         void InitRecordingListItem();
         std::vector<RecordingListItem> &GetRecordinglistItems();
         std::string GetCurrentPlayRecordingName(void);
+        std::string GetCurrentPlayRecordingName(std::string name);
         int GetRecordingListNum();
         void SetRecordingListNum(int value);
         std::string GetCleanFileName(const std::string &filePath);
-        void SearchFiles(const std::string &directory, std::vector<std::string> &fileNames, int &mp3FileCount);
+        void SearchFiles(const std::string &directory, std::vector<RecordingListItem> &Recordings, int &mp3FileCount);
         void SetClickRecordingIndex(int index_);
         int GetClickRecordingIndex(void);
         std::vector<std::string> &GetFileNames(void);
         void SetTotalRecordDuration(std::string time);
         std::string GetTotalRecordDuration(void) const;
-        void SetRecordingInfo(RecordingInfo &info, int index);
-        void UpdateRecordingInfo(int index);
+        void UpdateRecordingInfo();
         void SetRecordFileName(std::string name);
         std::string GetRecordFileName(void);
         std::string Getyyyymmhhh_date(void);
@@ -95,12 +95,13 @@ namespace OHOS
         bool CreateRecordPlayDirectory(const char *path);
         const char *GetRecordDirectory() const;
         static std::string recordTempDuration; // 录音时长
-        int RecordDataWriteToFile();
-        int RecordDataReadToFile();
+        int RecordDataWriteToFile(std::string name);
+        int RecordDataReadToFile(std::string name);
+        void printfRecordData();
         void GetDuration(int64_t &duration);
         void UpdateRecordProcess();
-        bool GetRecordingPlayerViewCreate();
-        void SetRecordingPlayerViewCreate(bool state);
+        int getMaxRecordingNumber(void);
+        void setMaxRecordingNumber(int number);
 
     private:
         RecordingModel();
@@ -124,7 +125,7 @@ namespace OHOS
         bool isStopAndReset{false};                // 判断是否是停止还是重置状态
         bool audioInitStatus{false};
         /* -------------------------------------------------------------------------- */
-        std::vector<std::string> fileNames;                        // 文件名数组
+        std::vector<std::string> fileNames;                        // 录音文件名数组
         int RecordingMp3FileCount = 0;                             // 录音MP3数量
         const std::string directory = "/user/userdata/recording/"; // 录音目录
         const std::string recordInfoFile = "/user/userdata/recording/recordinfo.bin";
@@ -136,7 +137,10 @@ namespace OHOS
         char *yyyymmhhh_date;                 // 保存年月日时间
         std::string TotalRecordDuration;      // 保存录音的总时长
         std::string RecordingTimeAndDuration; // 录音日期和录音时长
-        RecordingInfo recordingInfo[MAX_RECORDING_NUM] = {0};
+        RecordingInfo info[MAX_RECORDING_NUM] = {0};
+        RecordingInfo recordingInfo{0};
+        std::string mergefileName;
+        int MaxRecordingNumber{0}; //要录取的最大录音编号
         /* -------------------------------------------------------------------------- */
         bool RecordingPlayerViewIsCreate{false};
     };
diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingNumLimitView.h b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingNumLimitView.h
new file mode 100644 (file)
index 0000000..16597fc
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-30 15:38:55
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-30 16:08:59
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingNumLimitView.h
+ */
+#ifndef _RECORDING_NUM_LIMIT_VIEW_
+#define _RECORDING_NUM_LIMIT_VIEW_
+#include "BaseView.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+
+namespace OHOS
+{
+    static constexpr const char *RECORDINGNUMLIMITVIEW = "RecordingNumLimitView";
+    static constexpr const char *RECORDINGNUMLIMITBUTTONVIEW = "RecordingNumLimitButtonView";
+    class RecordingNumLimitView
+    {
+    public:
+        struct LabelConfig
+        {
+            int16_t left;
+            int16_t top;
+            int16_t width;
+            int16_t height;
+            int16_t fontSize;      // 字体大小
+            int16_t lineHeigh;     // 行高
+            int16_t textId;        // 文本id
+            uint8_t lineBreakMode; // 断行模式。
+        };
+        RecordingNumLimitView();
+        ~RecordingNumLimitView();
+        UIScrollView *RecordingNumLimitViewInit(void);
+
+    private:
+        UILabelExt *CreateRecordingNumLimitLabel(LabelConfig &labelconfig); // 设置标签
+        void ClearAll(void);
+        UIScrollView *scrollView{nullptr};
+        UILabelExt *title{nullptr};
+        UIImageView *image{nullptr};
+        UILabelExt *note{nullptr};
+        UILabelExt *goitlabel{nullptr};
+        UIButton *goitbutton{nullptr};
+    };
+
+}
+#endif
index 27dc2fc..ec20a1c 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-03-30 09:14:38\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-08-28 14:45:22\r
+ * @LastEditTime: 2024-08-30 16:16:24\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingView.h\r
  */\r
 #ifndef RECORD_VIEW_H\r
@@ -24,6 +24,7 @@
 #include "record/include/RecordingPlayerView.h"\r
 #include "record/include/RecordDeleteView.h"\r
 #include "record/include/RecordingVolumeSettingView.h"\r
+#include "record/include/RecordingNumLimitView.h"\r
 \r
 namespace OHOS\r
 {\r
@@ -35,6 +36,7 @@ namespace OHOS
         RECORDINGPLAYERVIEW,        // 录音播放视图(subView)\r
         RECORDINGDELETEVIEW,        // 录音删除视图(subView)\r
         RECORDINGVOLUMESETTINGVIEW, // 声音设置视图(subView)\r
+        RECORDINGEXCELIMIT,         // 录音数量超出限制(subView)\r
         MAX_RECORDINGVIEWID,\r
     } RECORDINGVIEWID;\r
 \r
@@ -62,9 +64,10 @@ namespace OHOS
         bool ChangeRecordingPlayerView(int16_t thisView);     // 切换到“录音播放”视图\r
         bool ChangeRecordDeleteView(int16_t thisView);        // 切换到“录音删除”视图\r
         bool ChangeRecordVolumeSettingView(int16_t thisView); // 切换到“声音设置”视图\r
+        bool ChangeRecordNumLimitView(int16_t thisView);      // 切换到“录音超出限制”视图\r
         bool ClickFunc(int16_t interface);\r
         void ChangeView(int16_t hideView, int16_t showView);\r
-        int GetCurrentViewType(UIScrollView * view);\r
+        int GetCurrentViewType(UIScrollView *view);\r
         UIScrollView *GetRecordingViewScrollView(int index);\r
 \r
     public:\r
@@ -79,6 +82,7 @@ namespace OHOS
         RecordingPlayerView *p_RecordingPlayerView{nullptr};\r
         RecordDeleteView *p_RecordDeleteView{nullptr};\r
         RecordingVolumeSettingView *p_RecordingVolumeSettingView{nullptr};\r
+        RecordingNumLimitView *p_RecordingNumLimitView{nullptr};\r
 \r
     private:\r
         bool RecordingScrollViewInit(void);\r
index 8f6ae54..7e184ee 100644 (file)
@@ -1,7 +1,9 @@
 #include "record/include/RecordDeleteView.h"\r
 #include "record/include/RecordingPresenter.h"\r
+#include "record/include/RecordingModel.h"\r
 #include "wearable_log.h"\r
 #include "ui_resource_string.h"\r
+#include "ConfigModel.h"\r
 namespace OHOS\r
 {\r
     static RecordDeleteView *g_pRecordDeleteView{nullptr};\r
@@ -225,7 +227,8 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordDeleteViewInit::SetRecordDeleteName");\r
         if (DeleteNameLabel)\r
         {\r
-            DeleteNameLabel->SetText(name);\r
+            mergefileName = RecordingModel::GetInstance()->GetCurrentPlayRecordingName(name);\r
+            DeleteNameLabel->SetText(mergefileName.c_str());\r
             DeleteNameLabel->Invalidate();\r
         }\r
     }\r
index 3cde41b..ef4c677 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-02-27 09:16:50\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-08-27 14:38:37\r
+ * @LastEditTime: 2024-09-02 09:57:10\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp\r
  */\r
 \r
@@ -285,7 +285,7 @@ namespace OHOS
         recordList->SetDragACCLevel(5);\r
         recordList->SetSwipeACCLevel(800); /*设置手指抬起屏幕后的补偿距离。*/\r
         recordList->SetReboundSize(30);\r
-        recordList->SetScrollBlankSize(30);\r
+        // recordList->SetScrollBlankSize(30);\r
         recordList->SetIntercept(true); // 设置是否拦截输入事件。如果被截获,视图在本地处理后不会将输入事件传递给父视图。\r
         recordList->SetAdapter(p_RecordingListAdapter);\r
         RecordListScrollView->Add(recordList);\r
index 29f7df8..e8cebf9 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-05 15:20:03
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-31 09:26:00
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListAdapter.cpp
+ */
 #include "record/include/RecordingListAdapter.h"
 #include "record/include/RecordingListitemView.h"
 namespace OHOS
@@ -68,13 +75,14 @@ namespace OHOS
         if (inView == nullptr)
         {
             item = new RecordingListitemView();
-                }
+        }
         else
         {
             item = static_cast<RecordingListitemView *>(inView);
         }
         item->SetItemInfo(itemData);
         item->SetOnClickListener(itemClickListener);
+        item->SetViewIndex(index);
         return item;
     }
 
index 052e924..cc773de 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-02 20:10:18
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-24 17:40:14
+ * @LastEditTime: 2024-08-31 20:19:43
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp
  */
 #include "record/include/RecordingListitemView.h"
@@ -38,7 +38,7 @@ namespace OHOS
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingListitemView::SetItemInfo");
         m_ItemInfo = itemInfo;
-        m_recordId.SetText(itemInfo.recordId);
+        m_recordId.SetText(itemInfo.recordId.c_str());
         m_recordTotalTime.SetText(itemInfo.recordTotalTime);
         m_recordTime.SetText(itemInfo.recordTime);
     }
@@ -70,7 +70,8 @@ namespace OHOS
 
     int RecordingListitemView::GetRecordingListIndex()
     {
-        return m_ItemInfo.index;
+        // return m_ItemInfo.index;
+        return GetViewIndex();
     }
 
 }
\ No newline at end of file
index 9897afa..54beb2e 100644 (file)
@@ -12,6 +12,7 @@
 #include <cstring>
 #include <unistd.h>
 #include <sys/stat.h>
+#include "ConfigModel.h"
 namespace OHOS
 {
     std::string RecordingModel::recordTempDuration = 0;
@@ -504,7 +505,7 @@ namespace OHOS
      * @param -mp3FileCount 录音文件数量
      * @return void
      */
-    void RecordingModel::SearchFiles(const std::string &directory, std::vector<std::string> &fileNames, int &mp3FileCount)
+    void RecordingModel::SearchFiles(const std::string &directory, std::vector<RecordingListItem> &Recordings, int &mp3FileCount)
     {
         DIR *dir;
         struct dirent *ent;
@@ -521,14 +522,17 @@ namespace OHOS
                         std::string cleanFileName = GetCleanFileName(filePath);
                         if (!cleanFileName.empty())
                         {
+                            RecordDataReadToFile(cleanFileName.c_str());
+                            strcpy(info[mp3FileCount].recordingFileName, recordingInfo.recordingFileName);
+                            strcpy(info[mp3FileCount].recordingDuration, recordingInfo.recordingDuration);
+                            strcpy(info[mp3FileCount].recordingTime, recordingInfo.recordingTime);
                             mp3FileCount++;
-                            fileNames.push_back(cleanFileName);
                         }
                     }
                     else if (ent->d_type == DT_DIR) // 目录
                     {
                         std::string subDirectory = directory + fileName + "/";
-                        SearchFiles(subDirectory, fileNames, mp3FileCount); // 递归搜索子目录
+                        SearchFiles(subDirectory, Recordings, mp3FileCount); // 递归搜索子目录
                     }
                 }
             }
@@ -542,35 +546,38 @@ namespace OHOS
     void RecordingModel::InitRecordingListItem(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingModel::InitRecordingListItem");
-        RecordingMp3FileCount = 0;
+        if (!Recordings.empty())
+        {
+            Recordings.clear();
+        }
         if (!fileNames.empty())
         {
             fileNames.clear();
         }
-        if (!Recordings.empty())
+        for (int i = 0; i < RecordingMp3FileCount; ++i)
         {
-            Recordings.clear();
+            memset(info[i].recordingFileName, 0, sizeof(info[i].recordingFileName));
+            memset(info[i].recordingDuration, 0, sizeof(info[i].recordingDuration));
+            memset(info[i].recordingTime, 0, sizeof(info[i].recordingTime));
         }
-        SearchFiles(directory, fileNames, RecordingMp3FileCount);
-        RecordDataReadToFile();
+        RecordingMp3FileCount = 0;
+        SearchFiles(directory, Recordings, RecordingMp3FileCount);
         if (RecordingMp3FileCount != 0)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Total .mp3 Files Count:%d", RecordingMp3FileCount);
-            for (const auto &filename : fileNames)
+            MaxRecordingNumber = atoi(info[0].recordingFileName);
+            for (int i = 1; i < RecordingMp3FileCount; i++)
             {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "File Name::%s", filename.c_str());
+                if (atoi(info[i].recordingFileName) > MaxRecordingNumber)
+                {
+                    MaxRecordingNumber = atoi(info[i].recordingFileName);
+                }
             }
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MaxRecordingNumber:%d", MaxRecordingNumber);
             // 对 Recordings 数组进行操作
             for (int i = 0; i < RecordingMp3FileCount; i++)
             {
-                for (int j = 0; j < RecordingMp3FileCount; j++)
-                {
-                    if (fileNames[i] == recordingInfo[j].recordingFileName)
-                    {
-                        Recordings.push_back({i, recordingInfo[j].recordingFileName, recordingInfo[j].recordingDuration, recordingInfo[j].recordingTime});
-                        break;
-                    }
-                }
+                Recordings.push_back({i, GetCurrentPlayRecordingName(info[i].recordingFileName), info[i].recordingDuration, info[i].recordingTime});
             }
         }
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingModel::InitRecordingListItem over!!");
@@ -591,7 +598,41 @@ namespace OHOS
      */
     std::string RecordingModel::GetCurrentPlayRecordingName(void)
     {
-        return fileNames[GetClickRecordingIndex()];
+        return info[GetClickRecordingIndex()].recordingFileName;
+    }
+
+    std::string RecordingModel::GetCurrentPlayRecordingName(std::string name)
+    {
+        int language = ConfigModel::GetInstance()->GetLanguage();
+        if (language == 0) // 如果当前系统为中文
+        {
+            mergefileName = "录音 ";
+            mergefileName += name;
+        }
+        else
+        {
+            mergefileName = "Audio ";
+            mergefileName += name;
+        }
+        return mergefileName;
+    }
+
+    /*
+     * @brief 获取年月日时间和录音时长
+     */
+    std::string &RecordingModel::Getyyyymmhhh_dateAndTotalRecordDuration(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RecordingModel] Getyyyymmhhh_dateAndTotalRecordDuration");
+        std::string yyyymmhhh_date = Recordings[GetClickRecordingIndex()].recordTime;
+        std::string TotalRecordDuration = Recordings[GetClickRecordingIndex()].recordTotalTime;
+        // 去掉日期字符串末尾的换行符
+        if (!yyyymmhhh_date.empty() && yyyymmhhh_date.back() == '\n')
+        {
+            yyyymmhhh_date.erase(yyyymmhhh_date.length() - 1);
+        }
+        RecordingTimeAndDuration = (yyyymmhhh_date + "-" + TotalRecordDuration);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "recordTime = %s recordTotalTime = %s", yyyymmhhh_date.c_str(), TotalRecordDuration.c_str());
+        return RecordingTimeAndDuration;
     }
 
     /*
@@ -607,6 +648,11 @@ namespace OHOS
     void RecordingModel::SetRecordingListNum(int value)
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingModel::GetRecordingListNum %d", value);
+        if (value > MAX_RECORDING_NUM)
+        {
+            RecordingMp3FileCount = MAX_RECORDING_NUM;
+            return;
+        }
         RecordingMp3FileCount = value;
     }
 
@@ -671,41 +717,18 @@ namespace OHOS
         return yyyymmhhh_date;
     }
 
-    // 设置每首录音的信息:包含录音文件名,录音时长,录音时间
-    void RecordingModel::SetRecordingInfo(RecordingInfo &info, int index)
+    void RecordingModel::UpdateRecordingInfo()
     {
-        recordingInfo[index] = info;
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "recordingFileName = %s", recordingInfo[index].recordingFileName);
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "recordingDuration = %s", recordingInfo[index].recordingDuration);
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "recordingTime = %s", recordingInfo[index].recordingTime);
-    }
-
-    void RecordingModel::UpdateRecordingInfo(int index)
-    {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UpdateRecordingInfo %s", recordingInfo[index].recordingFileName);
         if (index < 0 || index > RecordingMp3FileCount)
         {
             return;
         }
-        char *file_name = recordingInfo[index].recordingFileName;
-        std::string delete_filename = (directory + file_name).append(".mp3");
+        std::string delete_filename_mp3 = (directory + GetCurrentPlayRecordingName()).append(".mp3");
+        std::string delete_filename_txt = (directory + GetCurrentPlayRecordingName()).append(".txt");
         /* -------------------------------- 删除录音文件 -------------------------------- */
-        uapi_delete_files(delete_filename.c_str());
+        uapi_delete_files(delete_filename_mp3.c_str());
+        uapi_delete_files(delete_filename_txt.c_str());
         /* -------------------------------------------------------------------------- */
-        int i = 0;
-        for (i = index; i < (RecordingMp3FileCount - 1); i++)
-        {
-            strcpy(recordingInfo[i].recordingFileName, recordingInfo[i + 1].recordingFileName);
-            strcpy(recordingInfo[i].recordingDuration, recordingInfo[i + 1].recordingDuration);
-            strcpy(recordingInfo[i].recordingTime, recordingInfo[i + 1].recordingTime);
-
-            fileNames[i] = fileNames[i + 1];
-        }
-        RecordingMp3FileCount--;
-        RecordingInfo info = {0};
-        SetRecordingInfo(info, i);
-        fileNames[i].clear();
-        RecordDataWriteToFile();
     }
 
     // 设置当前的录音文件名,每次录音会更改
@@ -720,24 +743,6 @@ namespace OHOS
         return recordFileName;
     }
 
-    /*
-     * @brief 获取年月日时间和录音时长
-     */
-    std::string &RecordingModel::Getyyyymmhhh_dateAndTotalRecordDuration(void)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RecordingModel] Getyyyymmhhh_dateAndTotalRecordDuration");
-        std::string yyyymmhhh_date = Getyyyymmhhh_date();
-        std::string TotalRecordDuration = recordingInfo[RecordingMp3FileCount - index - 1].recordingDuration;
-        // 去掉日期字符串末尾的换行符
-        if (!yyyymmhhh_date.empty() && yyyymmhhh_date.back() == '\n')
-        {
-            yyyymmhhh_date.erase(yyyymmhhh_date.length() - 1);
-        }
-        RecordingTimeAndDuration = (yyyymmhhh_date + "-" + TotalRecordDuration);
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingTimeAndDuration %s", RecordingTimeAndDuration.c_str());
-        return RecordingTimeAndDuration;
-    }
-
     void RecordingModel::GetDuration(int64_t &duration)
     {
         duration = DurationTime;
@@ -751,13 +756,14 @@ namespace OHOS
         }
     }
 
-    bool RecordingModel::GetRecordingPlayerViewCreate()
+    int RecordingModel::getMaxRecordingNumber(void)
     {
-        return RecordingPlayerViewIsCreate;
+        return MaxRecordingNumber;
     }
-    void RecordingModel::SetRecordingPlayerViewCreate(bool state)
+
+    void RecordingModel::setMaxRecordingNumber(int number)
     {
-        RecordingPlayerViewIsCreate = state;
+        MaxRecordingNumber = number;
     }
 
     /*创建录音播放路径*/
@@ -786,49 +792,65 @@ namespace OHOS
         return directory.c_str();
     }
 
-    int RecordingModel::RecordDataWriteToFile()
+    // 保存录音信息文件
+    int RecordingModel::RecordDataWriteToFile(std::string name)
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:RecordDataWriteToFile,%d", __LINE__, RecordingMp3FileCount);
-        if (0 == RecordingMp3FileCount)
+        if (name.empty())
         {
             return OHOS_FAILURE;
         }
-
-        FILE *fp = fopen(recordInfoFile.c_str(), "wb+");
+        name = directory + name.append(".txt");
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:RecordDataWriteToFile %s", __LINE__, name.c_str());
+        FILE *fp = fopen(name.c_str(), "wb+");
         if (nullptr == fp)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:RecordDataWriteToFile fail", __LINE__);
             return OHOS_FAILURE;
         }
 
-        size_t ret = fwrite(recordingInfo, sizeof(RecordingInfo), RecordingMp3FileCount, fp);
-        if (RecordingMp3FileCount != ret)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:RecordDataWriteToFile fail", __LINE__);
-        }
+        std::string recordingFileName = GetRecordFileName();                  // 录音文件名
+        std::string yyymmhhh_date = Getyyyymmhhh_date();                      // 保存录音年月日时间
+        std::string TotalRecordDuration = RecordingModel::recordTempDuration; // 录音的总时长
+        recordingInfo = {0};
+        strncpy_s(recordingInfo.recordingFileName, 32, recordingFileName.c_str(), recordingFileName.length());
+        strncpy_s(recordingInfo.recordingDuration, 16, TotalRecordDuration.c_str(), TotalRecordDuration.length());
+        strncpy_s(recordingInfo.recordingTime, 16, yyymmhhh_date.c_str(), yyymmhhh_date.length());
+
+        size_t ret = fwrite((void *)&recordingInfo, sizeof(RecordingInfo), 1, fp);
         fclose(fp);
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:RecordDataWriteToFile success", __LINE__);
 
         return OHOS_SUCCESS;
     }
 
-    int RecordingModel::RecordDataReadToFile()
+    // 读取录音信息文件
+    int RecordingModel::RecordDataReadToFile(std::string name)
     {
-        if (0 == RecordingMp3FileCount)
+        if (name.empty())
         {
             return OHOS_FAILURE;
         }
-        FILE *fp = fopen(recordInfoFile.c_str(), "rb");
+        name = directory + name.append(".txt");
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:RecordDataReadToFile %s", __LINE__, name.c_str());
+        FILE *fp = fopen(name.c_str(), "rb");
         if (fp == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:RecordDataReadToFile", __LINE__);
             return OHOS_FAILURE;
         }
-        fread(recordingInfo, sizeof(RecordingInfo), RecordingMp3FileCount, fp);
+        fread((void *)&recordingInfo, sizeof(RecordingInfo), 1, fp);
+        printfRecordData();
         fclose(fp);
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:RecordDataReadToFile success", __LINE__);
         return OHOS_SUCCESS;
     }
+
+    void RecordingModel::printfRecordData()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "recordingFileName %s", recordingInfo.recordingFileName);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "recordingDuration %s", recordingInfo.recordingDuration);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "recordingTime %s", recordingInfo.recordingTime);
+    }
     /* ----------------------------------- 定时器 ---------------------------------- */
     // 声明定时器变量
     osTimerId_t g_timer = NULL;
diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingNumLimitView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingNumLimitView.cpp
new file mode 100644 (file)
index 0000000..1cf98c5
--- /dev/null
@@ -0,0 +1,192 @@
+#include "record/include/RecordingNumLimitView.h"
+#include "wearable_log.h"
+#include "record/include/RecordingPresenter.h"
+namespace OHOS
+{
+
+    RecordingNumLimitView::RecordingNumLimitView()
+    {
+    }
+
+    RecordingNumLimitView::~RecordingNumLimitView()
+    {
+        ClearAll();
+    }
+
+    void RecordingNumLimitView::ClearAll(void)
+    {
+        if (scrollView != nullptr)
+        {
+            scrollView->RemoveAll();
+            if (title)
+            {
+                delete title;
+                title = nullptr;
+            }
+            if (image)
+            {
+                delete image;
+                image = nullptr;
+            }
+            if (note)
+            {
+                delete note;
+                note = nullptr;
+            }
+            if (goitlabel)
+            {
+                delete goitlabel;
+                goitlabel = nullptr;
+            }
+            if (goitbutton)
+            {
+                delete goitbutton;
+                goitbutton = nullptr;
+            }
+            delete scrollView;
+            scrollView = nullptr;
+        }
+    }
+
+    UILabelExt *RecordingNumLimitView::CreateRecordingNumLimitLabel(LabelConfig &labelconfig)
+    {
+        UILabelExt *label = new UILabelExt();
+        if (label == nullptr)
+        {
+            return nullptr;
+        }
+        label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); // 位置大小
+        label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);                                       // 字体大小
+        label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);                                    // 字体行高
+        label->SetTextId(labelconfig.textId);
+        label->SetLineBreakMode(labelconfig.lineBreakMode); // 断行模式。
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);
+        return label;
+    }
+
+    UIScrollView *RecordingNumLimitView::RecordingNumLimitViewInit(void)
+    {
+        if (scrollView == nullptr)
+        {
+            scrollView = new UIScrollView();
+            if (scrollView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "scrollView new fail!");
+                return nullptr;
+            }
+            scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+            UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(RecordingPresenter::GetInstance());
+            if (draglistener == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "draglistener can not be nullptr!");
+                return nullptr;
+            }
+            scrollView->SetViewId(RECORDINGNUMLIMITVIEW);
+            scrollView->SetOnDragListener(draglistener);
+            scrollView->SetTouchable(true);
+            scrollView->SetDraggable(true);
+            /* -------------------------------------------------------------------------- */
+            LabelConfig labelconfig = {
+                .left = 83,
+                .top = 50,
+                .width = 300,
+                .height = 35,
+                .fontSize = 30,
+                .lineHeigh = 35,
+                .textId = STR_RECORDER,
+                .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+            };
+            if (title == nullptr)
+            {
+                title = CreateRecordingNumLimitLabel(labelconfig);
+                if (title == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "title can not be nullptr!");
+                    return nullptr;
+                }
+                scrollView->Add(title);
+            }
+            /* -------------------------------------------------------------------------- */
+            if (image == nullptr)
+            {
+                image = new UIImageView();
+                if (image == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "image can not be nullptr!");
+                    return nullptr;
+                }
+                image->SetPosition(193, 120, 80, 80);
+                image->SetSrc(PNG_ATTENTION_IMAGE);
+                scrollView->Add(image);
+            }
+            /* -------------------------------------------------------------------------- */
+            labelconfig = {
+                .left = 53,
+                .top = 222,
+                .width = 360,
+                .height = 70,
+                .fontSize = 30,
+                .lineHeigh = 35,
+                .textId = STR_VOICE_RECORDING_REMINDER_NOTE, // 录音数量不得超过30首,请删除已有录音
+                .lineBreakMode = UILabel::LINE_BREAK_WRAP,
+            };
+            if (note == nullptr)
+            {
+                note = CreateRecordingNumLimitLabel(labelconfig);
+                if (note == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "note can not be nullptr!");
+                    return nullptr;
+                }
+                scrollView->Add(note);
+            }
+            /* -------------------------------------------------------------------------- */
+            if (goitbutton == nullptr)
+            {
+                goitbutton = new UIButton();
+                if (goitbutton == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "goitbutton can not be nullptr!");
+                    return nullptr;
+                }
+                goitbutton->SetPosition(93, note->GetY() + note->GetTextHeight() + 48, 280, 90);
+                goitbutton->SetViewId(RECORDINGNUMLIMITBUTTONVIEW);
+                goitbutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+                goitbutton->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+                goitbutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff383838, UIButton::PRESSED);
+                UIView::OnClickListener *clicilistener = static_cast<UIView::OnClickListener *>(RecordingPresenter::GetInstance());
+                if (clicilistener == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clicilistener can not be nullptr!");
+                    return nullptr;
+                }
+                goitbutton->SetOnClickListener(clicilistener);
+                scrollView->Add(goitbutton);
+            }
+            /* -------------------------------------------------------------------------- */
+            int16_t y = goitbutton->GetY() + 28;
+            labelconfig = {
+                .left = 133,
+                .top = y,
+                .width = 200,
+                .height = 35,
+                .fontSize = 30,
+                .lineHeigh = 35,
+                .textId = STR_KONW, // 知道了
+                .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+            };
+            if (goitlabel == nullptr)
+            {
+                goitlabel = CreateRecordingNumLimitLabel(labelconfig);
+                if (goitlabel == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "goitlabel can not be nullptr!");
+                    return nullptr;
+                }
+                scrollView->Add(goitlabel);
+            }
+        }
+        return scrollView;
+    }
+}
\ No newline at end of file
index bdf785b..dce388f 100644 (file)
@@ -386,6 +386,13 @@ namespace OHOS
     {\r
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RecordingPlayerView] ResetComponentStatus");\r
 \r
+        RecordingModel *p_RecordingModel = RecordingModel::GetInstance();\r
+        if (p_RecordingModel == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingModel::GetInstance fail!!");\r
+            return;\r
+        }\r
+\r
         if (PlayerProgressBar != nullptr)\r
         {\r
             PlayerProgressBar->SetValue(0); // 0:进度0%\r
@@ -393,7 +400,8 @@ namespace OHOS
         }\r
         if (RecordingFileName != nullptr)\r
         {\r
-            RecordingFileName->SetText(RecordingModel::GetInstance()->GetCurrentPlayRecordingName().c_str());\r
+            std::string name = p_RecordingModel->GetCurrentPlayRecordingName();\r
+            RecordingFileName->SetText(p_RecordingModel->GetCurrentPlayRecordingName(name).c_str());\r
             RecordingFileName->Invalidate();\r
         }\r
         if (RecordingTimeAndDuration != nullptr)\r
index 09b010e..86e63f7 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-03-30 09:14:38\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-08-28 15:41:29\r
+ * @LastEditTime: 2024-09-02 09:47:40\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp\r
  */\r
 \r
@@ -69,7 +69,6 @@ namespace OHOS
         Presenter<RecordingView>::OnStop();\r
         p_RecordingModel->ClearRecordingPlayer();\r
         StopRecord();\r
-        RecordingModel::GetInstance()->SetRecordingPlayerViewCreate(false);\r
         // ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON);\r
     }\r
 \r
@@ -118,6 +117,9 @@ namespace OHOS
             case RECORDINGVOLUMESETTINGVIEW:\r
                 p_RecordingView->ChangeView(RECORDINGVOLUMESETTINGVIEW, RECORDINGPLAYERVIEW); // 声音设置视图(subView)->录音播放视图(subView)\r
                 break;\r
+            case RECORDINGEXCELIMIT:\r
+                p_RecordingView->ChangeView(RECORDINGEXCELIMIT, RECORDINGVIEW);\r
+                break;\r
             default:\r
                 break;\r
             }\r
@@ -181,16 +183,17 @@ namespace OHOS
         }\r
         args[5] = (char *)malloc(100); // 分配内存\r
         /* -------------------------------------------------------------------------- */\r
-        int num = p_RecordingModel->GetRecordingListNum();\r
+        int num = p_RecordingModel->getMaxRecordingNumber();\r
         std::string recordfileNme;\r
-        if (num < 9)\r
-        {\r
-            recordfileNme = "record_0" + std::to_string(num + 1);\r
-        }\r
-        else\r
-        {\r
-            recordfileNme = "record_" + std::to_string(num + 1);\r
-        }\r
+        // if (num < 9)\r
+        // {\r
+        //     recordfileNme = "record_0" + std::to_string(num + 1);\r
+        // }\r
+        // else\r
+        // {\r
+        //     recordfileNme = "record_" + std::to_string(num + 1);\r
+        // }\r
+        recordfileNme = std::to_string(num + 1);\r
         p_RecordingModel->SetRecordFileName(recordfileNme);\r
         sprintf(args[5], "%s%s.mp3", RecordingModel::GetInstance()->GetRecordDirectory(), recordfileNme.c_str());\r
         /* ---------------------------------- 开始录音 ---------------------------------- */\r
@@ -215,18 +218,18 @@ namespace OHOS
         AudioCaptureSample(argc, (const char **)&argv);\r
         /* ---------------------------------- 停止定时器 --------------------------------- */\r
         p_RecordingModel->Recording_StopTimer();\r
+        /* --------------------------------- 录音数量加1 --------------------------------- */\r
+        p_RecordingModel->SetRecordingListNum(p_RecordingModel->GetRecordingListNum() + 1);\r
         /* --------------------------------- 设置录音信息 --------------------------------- */\r
-        int index = p_RecordingModel->GetRecordingListNum();                            // 保存录音的下标\r
-        std::string recordingFileName = p_RecordingModel->GetRecordFileName();          // 录音文件名\r
-        std::string yyymmhhh_date = RecordingModel::GetInstance()->Getyyyymmhhh_date(); // 保存录音年月日时间\r
-        std::string TotalRecordDuration = RecordingModel::recordTempDuration;           // 录音的总时长\r
-        RecordingInfo info = {0};\r
-        strncpy_s(info.recordingFileName, 32, recordingFileName.c_str(), recordingFileName.length());\r
-        strncpy_s(info.recordingDuration, 16, TotalRecordDuration.c_str(), TotalRecordDuration.length());\r
-        strncpy_s(info.recordingTime, 16, yyymmhhh_date.c_str(), yyymmhhh_date.length());\r
-        p_RecordingModel->SetRecordingInfo(info, index);\r
-        p_RecordingModel->SetRecordingListNum(index + 1);\r
-        p_RecordingModel->RecordDataWriteToFile();\r
+        // int num = p_RecordingModel->GetRecordingListNum();                              // 保存录音的下标\r
+        std::string recordingFileName = p_RecordingModel->GetRecordFileName(); // 录音文件名\r
+        // std::string yyymmhhh_date = RecordingModel::GetInstance()->Getyyyymmhhh_date(); // 保存录音年月日时间\r
+        // std::string TotalRecordDuration = RecordingModel::recordTempDuration;           // 录音的总时长\r
+        // RecordingInfo info = {0};\r
+        // strncpy_s(info.recordingFileName, 32, recordingFileName.c_str(), recordingFileName.length());\r
+        // strncpy_s(info.recordingDuration, 16, TotalRecordDuration.c_str(), TotalRecordDuration.length());\r
+        // strncpy_s(info.recordingTime, 16, yyymmhhh_date.c_str(), yyymmhhh_date.length());\r
+        p_RecordingModel->RecordDataWriteToFile(recordingFileName.c_str());\r
 \r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingView StopRecord over!!");\r
     }\r
@@ -242,6 +245,11 @@ namespace OHOS
 \r
         if (strcmp(view.GetViewId(), RECORD_BUTTON) == 0)\r
         {\r
+            if (p_RecordingModel->GetRecordingListNum() >= MAX_RECORDING_NUM)\r
+            {\r
+                view_->ChangeView(RECORDINGVIEW, RECORDINGEXCELIMIT);\r
+                return true;\r
+            }\r
             StartRecord();\r
             return true;\r
         }\r
@@ -254,12 +262,13 @@ namespace OHOS
         else if (strcmp(view.GetViewId(), RECORD_DELETE_ON_BUTTON_VIEWID) == 0) // 若点击的是录音删除按钮\r
         {\r
             int index = p_RecordingModel->GetClickRecordingIndex();\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "index = %d", index);\r
             // std::string delete_path = RecordingModel::GetInstance()->GetRecordDirectory();\r
             // std::string delete_filename = p_RecordingModel->GetFileNames()[index] + ".mp3";\r
             // std::string fileName = delete_path + delete_filename;\r
             // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "index = %d ", index);\r
             // uapi_delete_files(fileName.c_str());//删除录音文件\r
-            p_RecordingModel->UpdateRecordingInfo(p_RecordingModel->GetRecordingListNum() - index - 1);\r
+            p_RecordingModel->UpdateRecordingInfo();\r
 \r
             p_RecordingView->ChangeView(RECORDINGDELETEVIEW, RECORDINGVIEW);\r
             return true;\r
@@ -269,6 +278,11 @@ namespace OHOS
             p_RecordingView->ChangeView(RECORDINGDELETEVIEW, RECORDINGPLAYERVIEW);\r
             return true;\r
         }\r
+        else if (strcmp(view.GetViewId(), RECORDINGNUMLIMITBUTTONVIEW) == 0)\r
+        {\r
+            p_RecordingView->ChangeView(RECORDINGEXCELIMIT, RECORDINGVIEW);\r
+            return true;\r
+        }\r
         return true;\r
     }\r
 \r
@@ -351,7 +365,7 @@ namespace OHOS
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordListViewListener::OnClick index:%d", index);\r
         if (index >= RecordingModel::GetInstance()->GetRecordingListNum())\r
         {\r
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordListViewListener::OnClick is no index");\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordListViewListener::OnClick is no index");\r
             return false;\r
         }\r
         /* -------------------------------- 保存被点击录音下标 ------------------------------- */\r
index 4e5eefd..3180e9c 100644 (file)
@@ -79,6 +79,11 @@ namespace OHOS
                 delete p_RecordingVolumeSettingView;\r
                 p_RecordingVolumeSettingView = nullptr;\r
             }\r
+            if (p_RecordingNumLimitView != nullptr)\r
+            {\r
+                delete p_RecordingNumLimitView;\r
+                p_RecordingNumLimitView = nullptr;\r
+            }\r
             for (int i = RECORDINGVIEW; i < MAX_RECORDINGVIEWID; i++)\r
             {\r
                 RecordingViewScrollView[i] = nullptr;\r
@@ -194,7 +199,6 @@ namespace OHOS
                 return false;\r
             }\r
             RecordingViewScrollView[thisView] = p_RecordingPlayerView->RecordingPlayerViewInit();\r
-            RecordingModel::GetInstance()->SetRecordingPlayerViewCreate(true);\r
             container_->Add(RecordingViewScrollView[thisView]);\r
         }\r
         // 设置“录音播放器”【录音文件名标签】的"文本内容"为被点击的"录音"的录音名\r
@@ -244,6 +248,24 @@ namespace OHOS
         return true;\r
     }\r
 \r
+    // 切换到“录音超出限制”视图\r
+    bool RecordingView::ChangeRecordNumLimitView(int16_t thisView)\r
+    {\r
+        if (RecordingViewScrollView[thisView] == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingView::ChangeRecordNumLimitView");\r
+            p_RecordingNumLimitView = new RecordingNumLimitView();\r
+            if (p_RecordingNumLimitView == nullptr)\r
+            {\r
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingView:: new scrollView[%d] fail", thisView);\r
+                return false;\r
+            }\r
+            RecordingViewScrollView[thisView] = p_RecordingNumLimitView->RecordingNumLimitViewInit();\r
+            container_->Add(RecordingViewScrollView[thisView]);\r
+        }\r
+        return true;\r
+    }\r
+\r
     // 1.RecordingViewMapper:结构体定义了一个将视图ID映射到特定成员函数指针的映射表。\r
     struct RecordingViewMapper\r
     {\r
@@ -259,6 +281,7 @@ namespace OHOS
         {RECORDINGPLAYERVIEW, &RecordingView::ChangeRecordingPlayerView},\r
         {RECORDINGDELETEVIEW, &RecordingView::ChangeRecordDeleteView},\r
         {RECORDINGVOLUMESETTINGVIEW, &RecordingView::ChangeRecordVolumeSettingView},\r
+        {RECORDINGEXCELIMIT, &RecordingView::ChangeRecordNumLimitView},\r
     };\r
 \r
     // 3.根据传入的interface参数执行相应视图ID关联的成员函数。\r