{
return ;
}
-
label->SetPosition(params.x, params.y, params.width, params.height); // 位置大小
label->SetStyle(STYLE_TEXT_FONT, params.fontSize); // 字体大小
label->SetStyle(STYLE_LINE_HEIGHT, params.lineHeigh); // 字体行高
label->SetLineBreakMode(params.lineBreakMode); // 断行模式
label->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); // 设置此文本的对齐模式
label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, params.fontSize); // 设置标签的字体
-
return ;
}
return ;
}
button->SetPosition(params.x, params.y, params.width, params.height);
- //->SetViewId(params.viewId);
button->SetStyle(STYLE_BACKGROUND_COLOR, params.backgroundColor);
button->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
button->SetStyleForState(STYLE_BACKGROUND_COLOR, params.pressedBackgroundColor, UIButton::PRESSED);
-
+ button->SetDraggable(true);
return ;
}
void CallLOGListitemView::SetTheButton_ext( UILabelButtonExt *button,MainPhoneView_ButtonConfig_ext_t &buttonconfig)
{
- // UILabelButtonExt *button = new UILabelButtonExt();
+
if (button == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: button new fail!");
return ;
}
button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);
- //button->SetViewId(buttonconfig.ViewId);
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "----------%s ---",buttonconfig.ViewId);
button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
button->SetText(buttonconfig.str);
button->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 23);
button->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
button->SetStyleForState(STYLE_BACKGROUND_COLOR,0xff191919, UIButton::PRESSED);
-
+ button->SetDraggable(true);
return ;
}
void CallLOGListitemView::NewcalllogButtonExt(UIViewGroup * TempGroup,uint8_t index)
{
if(nullptr == TempGroup)
- return ;
-
-
- if(0 == index)
- {
- TempGroup->SetPosition(0, 0, 390, 104);
- TempGroup->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
- TempGroup->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
- TempGroup->SetStyle(STYLE_BORDER_RADIUS, 100);
-
-
-
- MainPhoneView_ButtonConfig_ext_t buttonconfig;
- buttonconfig.x = 0;
- buttonconfig.y = 0;
- buttonconfig.w = 390;
- buttonconfig.h = 104;
- buttonconfig.ViewId="xxxx";
-
-
-
-
- SetTheButton_ext(&button_calllog,buttonconfig);
- TempGroup->Add(&button_calllog);
+ return ;
+ MainPhoneView_ButtonConfig_ext_t buttonconfig;
+ buttonconfig.x = 0;
+ buttonconfig.y = 0;
+ buttonconfig.w = 390;
+ buttonconfig.h = 104;
+ buttonconfig.ViewId="xxxx";
+ buttonconfig.str="xxx";
+
+ SetTheButton_ext(&button_calllog,buttonconfig);
+ TempGroup->Add(&button_calllog);
- LabelParams labelParam = {
- .x = 49,
- .y = 19,
- .width = 280,
- .height = 41,
- .fontSize = 35,
- .lineHeigh = 0,
- .text = "xxx",
- .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
- };
-
-
-
- LabelViewInit(&button_calllog_time,labelParam,Color::GetColorFromRGBA(0xEE, 0xEE, 0xEE, 0xEE));
-
- TempGroup->Add(&button_calllog_time);
-
- labelParam.fontSize=18;
- labelParam.x=223+30;
- labelParam.y=60;
- labelParam.lineBreakMode=UILabel::LINE_BREAK_MARQUEE;
- labelParam.width=72;
- labelParam.height=21;
-
+ LabelParams labelParam = {
+ .x = 49,
+ .y = 19,
+ .width = 280,
+ .height = 41,
+ .fontSize = 35,
+ .lineHeigh = 0,
+ .text = "xxx",
+ .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+ };
+
+ LabelViewInit(&button_calllog_time,labelParam,Color::GetColorFromRGBA(0xEE, 0xEE, 0xEE, 0xEE));
+ TempGroup->Add(&button_calllog_time);
+
+ labelParam.fontSize=18;
+ labelParam.x=223+30;
+ labelParam.y=60;
+ labelParam.lineBreakMode=UILabel::LINE_BREAK_MARQUEE;
+ labelParam.width=72;
+ labelParam.height=21;
- ColorType color;
- LabelViewInit(&button_calllog_status,labelParam,color);
- TempGroup->Add(&button_calllog_status);
-
-
- call_log_type.SetPosition(253+90, 60); // widget's left position and top position
- call_log_type.Resize(20, 20); // widget's width and height
- call_log_type.SetViewId("image1");// Set style
- call_log_type.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
- call_log_type.SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-
- TempGroup->Add(&call_log_type);
- }
- else
- {
- TempGroup->SetPosition(0, 0, 100, 100);
- TempGroup->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
- TempGroup->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
- TempGroup->SetStyle(STYLE_BORDER_RADIUS, 100);
-
- ButtonParams buttonParam = {
- .x = 0,
- .y = 0,
- .width = 100,
- .height = 100,
- .backgroundColor = 0xff4fc34c,
- .pressedBackgroundColor = 0xff4fc34c,
- };
- ButtonViewInit(&DeleteButton,buttonParam);
-
- DeleteButton.SetImagePosition(0, 0);
- DeleteButton.SetImageSrc(PNG_DELETE_PHONELINE_IMAGE, PNG_DELETE_PHONELINE_IMAGE);
-
-
- TempGroup->Add(&DeleteButton);
- }
-
+ ColorType color;
+ LabelViewInit(&button_calllog_status,labelParam,color);
+ TempGroup->Add(&button_calllog_status);
+
+ call_log_type.SetPosition(253+90, 60); // widget's left position and top position
+ call_log_type.Resize(20, 20); // widget's width and height
+ call_log_type.SetViewId("image1");// Set style
+ call_log_type.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ call_log_type.SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+
+ TempGroup->Add(&call_log_type);
return ;
}
-
- void CallLOGListitemView::Init_button_calllog_SwipeView(UISwipeView *button_calllog_SwipeView)
- {
- if(button_calllog_SwipeView!=nullptr)
- {
- //button_calllog_SwipeView->SetCameraDistance((UISwipeView::HORIZONTAL));
-
- button_calllog_SwipeView->SetPosition(0, 0, 390, 104);
- button_calllog_SwipeView->SetTouchable(true);
- button_calllog_SwipeView->SetViewId("no_back");
-
- button_calllog_SwipeView->SetAnimatorTime(50); // 200:animator drag time(ms)
-
- // UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(MainPhonePresenter::GetInstance());
- // button_calllog_SwipeView->SetOnDragListener(dragListener);
-
- button_calllog_SwipeView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
- button_calllog_SwipeView->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
- button_calllog_SwipeView->SetStyle(STYLE_BORDER_RADIUS, 100);
-
-
- NewcalllogButtonExt(&SwipeViewItem[0], 0);
-
- button_calllog_SwipeView->Add(&SwipeViewItem[0]);
-
- NewcalllogButtonExt(&SwipeViewItem[1], 1);
-
- button_calllog_SwipeView->Add(&SwipeViewItem[1]);
-
- button_calllog_SwipeView->SetCurrentPage(0);
- button_calllog_SwipeView->SetIntercept(false);
- button_calllog_SwipeView->SetLoopState(false);
-
- button_calllog_SwipeView->SetVisible(true);
- button_calllog_SwipeView->SetReboundSize(0);
- button_calllog_SwipeView->SetBlankSize(0);
- //button_calllog_SwipeView[i]->SetDirection();
-
- //button_calllog_SwipeView->SetDraggable(false);
- }
-
- }
-
CallLOGListitemView::CallLOGListitemView()
{
SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
SetStyle(STYLE_BACKGROUND_OPA, 255);
SetUpChild();
- Add(&button_calllog_SwipeView);
+
}
CallLOGListitemView::~CallLOGListitemView()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallLOGListitemView::~CallLOGListitemView");
- Remove(&button_calllog_SwipeView);
-
- button_calllog_SwipeView.RemoveAll();
- SwipeViewItem[0].RemoveAll();
- SwipeViewItem[1].RemoveAll();
-
-
+ RemoveAll();
}
void CallLOGListitemView::SetItemInfo(CallLogInfo *data)
void CallLOGListitemView::SetUpChild()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallLOGListitemView::SetUpChild");
- Init_button_calllog_SwipeView(&button_calllog_SwipeView);
+ NewcalllogButtonExt(this, 0);
}
- UISwipeView *CallLOGListitemView::Getbutton_calllog_SwipeView(void)
+ UIViewGroup *CallLOGListitemView::Getbutton_calllog_SwipeView(void)
{
- return &button_calllog_SwipeView;
+ return NULL;
}
-
+
UILabelButtonExt *CallLOGListitemView::Getbutton_calllog(void)
{
return &button_calllog;
}
- UIButton *CallLOGListitemView::GetDeleteButton(void)
- {
- return &DeleteButton;
- }
-
-
}
\ No newline at end of file
* @LastEditTime: 2024-04-29 10:08:42
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp
*/
-#include "phone/include/MainPhoneView.h"
-#include "phone/include/MainPhonePresenter.h"
+#include "MainPhoneView.h"
+#include "MainPhonePresenter.h"
#include "components/ui_label_button_ext.h"
#include "phone/include/phoneaddressmodel.h"
#include "wearable_log.h"
void MainPhoneView::ClearAll(void)
{
//container_->RemoveAll();
-
if (MainPhoneViewScrollView != nullptr)
{
MainPhoneViewScrollView->RemoveAll();
delete NoCallsLabel;
NoCallsLabel = nullptr;
}
-
- for(int i=0;i<CALL_LOG_MAX_NUM;i++)
+
+ if(delete_log_view)
{
+ delete_log_view->RemoveAll();
+
+ delete TitleLabel;
+ TitleLabel = nullptr;
+
+ delete AttentionLabel;
+ AttentionLabel = nullptr;
+
+ delete RECORD_DELETE_ON_BUTTON;
+ RECORD_DELETE_ON_BUTTON = nullptr;
+
+ delete RECORD_DELETE_OFF_BUTTON;
+ RECORD_DELETE_OFF_BUTTON = nullptr;
- if(button_calllog_SwipeView[i])
+ delete delete_log_view;
+ delete_log_view = nullptr;
+ }
+
+ for(int i=0;i<CALL_LOG_MAX_NUM;i++)
+ {
+ if(Callloginfo_button[i])
{
- button_calllog_SwipeView[i]->RemoveAll();
- if(SwipeViewItem[i][0])
+ Callloginfo_button[i]->RemoveAll();
+ if(button_calllog[i])
{
- SwipeViewItem[i][0]->RemoveAll();
- if(button_calllog[i])
- {
- delete button_calllog[i];
- button_calllog[i] = nullptr;
- }
- if(button_calllog_time[i])
- {
- delete button_calllog_time[i];
- button_calllog_time[i] = nullptr;
- }
-
- if(button_calllog_status[i])
- {
- delete button_calllog_status[i];
- button_calllog_status[i] = nullptr;
- }
- if(call_log_type[i])
- {
- delete call_log_type[i];
- call_log_type[i] = nullptr;
- }
-
- delete SwipeViewItem[i][0];
- SwipeViewItem[i][0]=nullptr;
+ delete button_calllog[i];
+ button_calllog[i] = nullptr;
+ }
+ if(button_calllog_time[i])
+ {
+ delete button_calllog_time[i];
+ button_calllog_time[i] = nullptr;
}
- if(SwipeViewItem[i][1])
+
+ if(button_calllog_status[i])
{
- SwipeViewItem[i][1]->RemoveAll();
-
- if(DeleteButton[i])
- {
- delete DeleteButton[i];
- DeleteButton[i] = nullptr;
- }
- delete SwipeViewItem[i][1];
- SwipeViewItem[i][1]=nullptr;
+ delete button_calllog_status[i];
+ button_calllog_status[i] = nullptr;
}
-
- delete button_calllog_SwipeView[i];
- button_calllog_SwipeView[i]=nullptr;
+
+ if(call_log_type[i])
+ {
+ delete call_log_type[i];
+ call_log_type[i] = nullptr;
+ }
+
+ delete Callloginfo_button[i];
+ Callloginfo_button[i] = nullptr;
}
-
+
+
}
-
-
if(button_delete_all_calllog)
{
hintCallsLabel = nullptr;
}
- if(CalllogList)
- {
-
- delete CalllogList;
- CalllogList = nullptr;
- }
- if(p_LanguageSwitchListAdapter)
- {
- delete p_LanguageSwitchListAdapter;
- p_LanguageSwitchListAdapter = nullptr;
- }
-
for(int i=0;i<CALL_LOG_MAX_NUM;i++)
{
if(info[i])
}
}
-
+ MainPhoneViewScrollView->ClearFocus();
delete MainPhoneViewScrollView;
MainPhoneViewScrollView = nullptr;
static constexpr int16_t LANGUAGE_LIST_Y = 365;
static int32 num = 0;
- bool MainPhoneView::MainPhoneViewListViewInit(void)
+
+ void MainPhoneView::NewcalllogButtonExt(UIViewGroup * TempGroup,uint8_t index)
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::LanguageSwitchListViewInit");
- p_LanguageSwitchListAdapter = new CallLogListAdapter(); // UIList 的适配器
- if (p_LanguageSwitchListAdapter == nullptr)
+ if(nullptr == TempGroup)
+ return ;
+ MainPhoneView_ButtonConfig_ext_t buttonconfig;
+ buttonconfig.x = 0;
+ buttonconfig.y = 0;
+ buttonconfig.w = 390;
+ buttonconfig.h = 104;
+ buttonconfig.ViewId="xxxx";
+ buttonconfig.str="xxx";
+
+ UIView::OnClickListener *ButtonOnclickListen = static_cast<UIView::OnClickListener *>(MainPhonePresenter::GetInstance());
+ if (ButtonOnclickListen == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::p_LanguageSwitchListAdapter is nullptr!");
- return false;
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ButtonOnclickListen new fail!");
+ return;
}
-
- for (int i = num; i != 0; i--) {
- p_LanguageSwitchListAdapter->AddListItem(*info[i-1]);
+ button_calllog[index] = SetTheButton_ext(buttonconfig,ButtonOnclickListen);
+ TempGroup->Add(button_calllog[index]);
+
+
+ TelephonyInitInterface :: LabelParams labelParam = {
+ .x = 49,
+ .y = 19,
+ .width = 280,
+ .height = 41,
+ .fontSize = 35,
+ .lineHeigh = 0,
+ .text = "xxx",
+ .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+ };
+
+ button_calllog_time[index] = TelephonyInitInterface::LabelViewInit(labelParam,Color::GetColorFromRGBA(0xEE, 0xEE, 0xEE, 0xEE));
+
+ TempGroup->Add(button_calllog_time[index]);
+
+ labelParam.fontSize=18;
+ labelParam.x=223+30;
+ labelParam.y=60;
+ labelParam.lineBreakMode=UILabel::LINE_BREAK_MARQUEE;
+ labelParam.width=72;
+ labelParam.height=21;
+
+ ColorType color;
+
+ button_calllog_status[index] = TelephonyInitInterface::LabelViewInit(labelParam,color);
+
+ TempGroup->Add(button_calllog_status[index]);
- }
+ call_log_type[index]=new UIImageView();
+ call_log_type[index]->SetPosition(253+90, 60); // widget's left position and top position
+ call_log_type[index]->Resize(20, 20); // widget's width and height
+ call_log_type[index]->SetViewId("image1");// Set style
+ call_log_type[index]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ call_log_type[index]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ TempGroup->Add(call_log_type[index]);
- //p_LanguageSwitchListAdapter->SetItemClickListener(static_cast<UIView::OnClickListener *>(LanguageSwitchPresenter::GetInstance()));
- CalllogList = new UIList(UIList::VERTICAL);
- if (CalllogList == nullptr)
+ return ;
+
+ }
+ static char *str_id[]={"D_0","D_1","D_2","D_3","D_4","D_5","D_6","D_7","D_8","D_9","D_10","D_11","D_12","D_13","D_14","D_15","D_16","D_17","D_18","D_19","D_20"};
+
+ bool MainPhoneView::MainPhoneViewListViewInit(void)
+ {
+ for(int i=0; i<num ;i++)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::LanguageList is nullptr!");
- return false;
+
+ Callloginfo_button[i]= new UIViewGroup();
+ Callloginfo_button[i]->SetPosition(38, 365+i*124, 390, 104);
+ Callloginfo_button[i]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ Callloginfo_button[i]-> SetStyle(STYLE_BACKGROUND_OPA, 255);
+ Callloginfo_button[i]->SetViewId(str_id[i+1]);
+
+ UIView::OnLongPressListener *LongPressListen = static_cast<UIView::OnLongPressListener *>(MainPhonePresenter::GetInstance());
+ if (LongPressListen == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ButtonOnclickListen new fail!");
+ return false;
+ }
+
+ Callloginfo_button[i]->SetOnLongPressListener(LongPressListen);
+ NewcalllogButtonExt(Callloginfo_button[i],i);
+ SetItemInfo(info[num-i-1],i);
+
+ MainPhoneViewScrollView ->Add(Callloginfo_button[i]);
}
- CalllogList->SetPosition(LANGUAGE_LIST_X, LANGUAGE_LIST_Y, HORIZONTAL_RESOLUTION, num*124);
- CalllogList->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
- CalllogList->EnableAutoAlign(true); // 设置此列表的自动对齐状态。当滚动停止时,子视图被选中,其位置自动与预设位置对齐
- CalllogList->SetThrowDrag(true); // 设置手指抬起屏幕后是否继续滚动。
- CalllogList->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。
- CalllogList->SetSwipeACCLevel(200); /*设置手指抬起屏幕后的补偿距离。*/
- CalllogList->SetSelectPosition(346);
- //CalllogList->SetReboundSize(30);
- //CalllogList->SetScrollBlankSize(20);
- CalllogList->SetStartIndex(0);
- // FocusManager::GetInstance()->RequestFocus(CalllogList);
- // FocusManager::GetInstance()->RequestFocusByDirection(FOCUS_DIRECTION_UP);
- CalllogList->SetRotateFactor(1.0);
-
- CalllogList->SetAdapter(p_LanguageSwitchListAdapter);
-
- CalllogList->RefreshList();
-
- MainPhoneViewScrollView->Add(CalllogList);
+
+
+ DeleteUIScrollViewInit();
+
+ // MainPhoneViewScrollView->Add(delete_log_view);
return true;
}
-
+ void MainPhoneView::SetItemInfo(CallLogInfo *data,uint8_t i)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallLOGListitemView::SetItemInfo");
+ if(data==NULL)
+ {
+ return;
+ }
+
+ time_t currtime;
+ struct tm *timeinfo;
+ currtime=(data)->creationTime;
+ timeinfo = localtime(&currtime);
+ char time_buf[20]={0};
+
+ sprintf_s(time_buf,20 ,"%d-%d-%d %d:%02d", timeinfo->tm_year + 1900,timeinfo->tm_mon + 1,timeinfo->tm_mday,timeinfo->tm_hour,timeinfo->tm_min);
+ button_calllog[i]->SetText(time_buf);
+ button_calllog[i]->SetViewId((const char*)(data)->tel);
+ // button_calllog[i]->Set
+
+ char buf[20]={0};
+ sprintf_s(buf,20,"%s",(const char*)(data)->tel);
+ char name[NAME_LEN+1]={0};
+ if(get_phone_addrss_name(name,buf,NULL))
+ {
+ button_calllog_time[i]->SetText(name);
+ button_calllog_time[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME,35 ); // 设置标签的字体
- void MainPhoneView:: DeInit_button_calllog_SwipeView(void)
- {
- for(int i=0;i<CALL_LOG_MAX_NUM;i++)
+ }
+ else
{
- if(button_calllog_SwipeView[i])
- {
- button_calllog_SwipeView[i]->SetVisible(false);
- }
-
+ button_calllog_time[i]->SetText(buf);
+ button_calllog_time[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN,35 ); // 设置标签的字体
+ }
+
+ if((data)->status==CALL_MISSED)
+ {
+ button_calllog_status[i]->SetTextId(STR_MISSED_CALLS);
+ button_calllog_status[i]->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
}
- }
+ else if((data)->status==CALL_INCOMING)
+ {
+ button_calllog_status[i]->SetTextId(STR_RECEIVED_CALLS);
+ button_calllog_status[i]->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
+ }
+ else
+ {
+ button_calllog_status[i]->SetTextId(STR_DIALED_CALLS);
+ button_calllog_status[i]->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+ }
+
+ call_log_type[i]->SetSrc(data->calllogtype?PNG_CALL_LOG_PHONE_IMAGE:PNG_CALL_LOG_WATCH_IMAGE);
+
+ }
+
-
- int8_t MainPhoneView::get_delete_id(UIView *view)
+ bool MainPhoneView::DeleteUIScrollViewInit(void)
{
- for(int i=0;i<num;i++)
+
+ delete_log_view = new UIScrollView();
+ if (delete_log_view == nullptr)
{
- if(view==DeleteButton[i])
- {
- return num-i-1;
- }
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordDeleteView::RecordDeleteViewScrollView new fail!");
+ return false;
}
- return -1;
+ delete_log_view->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(MainPhonePresenter::GetInstance());
+ if (dragListener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dragListener is nullptr!!");
+ return false;
+ }
+ delete_log_view->SetViewId("no_back");
+
+ delete_log_view->SetOnDragListener(dragListener);
+ delete_log_view->SetTouchable(true);
+ delete_log_view->SetDraggable(true);
+
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordDeleteView::RecordDeleteLabelViewInit");
+ TelephonyInitInterface :: LabelParams labelParam = {
+ .x = 83,
+ .y = 50,
+ .width = 300,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ .text = "删除记录",
+ //.textId = STR_DELETE_RECORDING,
+ .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+ };
+ TitleLabel = TelephonyInitInterface::LabelViewInit(labelParam);
+ TitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); // 设置此文本的对齐模式
+ if (nullptr == TitleLabel)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordDeleteView::TitleLabel is nullptr!");
+ return false;
+ }
+ delete_log_view->Add(TitleLabel);
+ /* -------------------------------------------------------------------------- */
+ labelParam = {
+ .x = 53,
+ .y = 160,
+ .width = 360,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ .text = "是否删除",
+ //.textId = STR_DELETE_PERMANENTLY,
+ .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+ };
+ AttentionLabel = TelephonyInitInterface::LabelViewInit(labelParam);
+ if (nullptr == AttentionLabel)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordDeleteView::AttentionLabel is nullptr!");
+ return false;
+ }
+ AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
+ AttentionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); // 设置此文本的对齐模式
+ delete_log_view->Add(AttentionLabel);
+ /* -------------------------------------------------------------------------- */
+
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordDeleteView::RecordDeleteButtonViewInit");
+ UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(MainPhonePresenter::GetInstance());
+ if (clickListener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener is nullptr!!");
+ return false;
+ }
+ RECORD_DELETE_OFF_BUTTON = new UIButton();
+ if (RECORD_DELETE_OFF_BUTTON == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordDeleteView::RECORD_DELETE_OFF_BUTTON is new fail!");
+ return false;
+ }
+ RECORD_DELETE_OFF_BUTTON->SetPosition(111, 299, 100, 100);
+ RECORD_DELETE_OFF_BUTTON->SetViewId(DELETE_OFF_BUTTON_VIEWID);
+ RECORD_DELETE_OFF_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ RECORD_DELETE_OFF_BUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+ RECORD_DELETE_OFF_BUTTON->SetImageSrc("/user/res/SYSTEM_CheckOff.bin", "/user/res/SYSTEM_CheckOff.bin");
+ RECORD_DELETE_OFF_BUTTON->SetOnClickListener(clickListener);
+ delete_log_view->Add(RECORD_DELETE_OFF_BUTTON);
+ /* -------------------------------------------------------------------------- */
+ RECORD_DELETE_ON_BUTTON = new UIButton();
+ if (RECORD_DELETE_ON_BUTTON == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordDeleteView::RECORD_DELETE_ON_BUTTON is new fail!");
+ return false;
+ }
+ RECORD_DELETE_ON_BUTTON->SetPosition(256, 299, 100, 100);
+ RECORD_DELETE_ON_BUTTON->SetViewId(DELETE_ON_BUTTON_VIEWID);
+ RECORD_DELETE_ON_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ RECORD_DELETE_ON_BUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+ RECORD_DELETE_ON_BUTTON->SetImageSrc("/user/res/SYSTEM_CheckOn.bin", "/user/res/SYSTEM_CheckOn.bin");
+ RECORD_DELETE_ON_BUTTON->SetOnClickListener(clickListener);
+ delete_log_view->Add(RECORD_DELETE_ON_BUTTON);
+ delete_log_view->SetVisible(false);
+ return true;
+ }
+
+
+ void MainPhoneView::show_delete_log_view(uint8_t data,uint8_t id)
+ {
+ delete_log_view->SetVisible(data);
+ delete_id=id;
+
}
if(info[id]!=nullptr)
{
- //updatacalllogbutton(false);
+
for(int i=id;i<num;i++)
{
if(info[i+1] && (i+1) < num)
}
- void MainPhoneView::updatacalllogbutton(bool flag)
- {
- if(flag)
- {
- TelephonyInitInterface::LabelParams labelParam;
- if (num != 0) {
- int y=0;
- for (int i = num; i != 0; i--) {
- Init_button_calllog_SwipeView(info[i-1],y);
- y++;
- }
- hintCallsLabel->SetPosition(83,365+num*124);
-
- }
- else
- {
- hintCallsLabel->SetVisible(false);
- NoCallsLabel->SetVisible(true);
-
- }
- }
- else
- {
- DeInit_button_calllog_SwipeView();
- }
-
- }
-
- static char *str_id[]={"D_0","D_1","D_2","D_3","D_4","D_5","D_6","D_7","D_8","D_9","D_10","D_11","D_12","D_13","D_14","D_15","D_16","D_17","D_18","D_19","D_20"};
-
- void MainPhoneView:: NewcalllogButtonExtupdata(CallLogInfo *data, uint8_t index,uint8_t i)
- {
- return;
-
- if(index==0)
- {
- //SwipeViewItem[i][0]
- char *txt;
- char buf[20]={0};
- sprintf_s(buf,20,"%s",(const char*)(data)->tel);
- char name[NAME_LEN+1]={0};
- if(get_phone_addrss_name(name,buf,NULL))
- {
- txt=name;
- }else
- {
- txt=buf;
- }
- const char* ViewId=(const char*)(data)->tel;
- button_calllog[i]->SetViewId(ViewId);
- button_calllog[i]->SetText(txt);
-
- time_t currtime;
- struct tm *timeinfo;
- currtime=(data)->creationTime;
- timeinfo = localtime(&currtime);
- char time_buf[20]={0};
- sprintf_s(time_buf,20 ,"%d-%d-%d %d:%02d", timeinfo->tm_year + 1900,timeinfo->tm_mon + 1,timeinfo->tm_mday,timeinfo->tm_hour,timeinfo->tm_min);
+
- button_calllog_time[i]->SetText(time_buf);
-
- if (button_calllog_status[i] == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewTitleLabel new fail!");
- }
- if((data)->status==CALL_MISSED)
- {
- button_calllog_status[i]->SetTextId(STR_MISSED_CALLS);
- button_calllog_status[i]->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
- }
- else if((data)->status==CALL_INCOMING)
- {
- button_calllog_status[i]->SetTextId(STR_RECEIVED_CALLS);
- button_calllog_status[i]->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
- }
- else
- {
- button_calllog_status[i]->SetTextId(STR_DIALED_CALLS);
- button_calllog_status[i]->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
- }
- }
- else
- {
- DeleteButton[i]->SetViewId(str_id[i+1]);
- }
-
- }
-
- UIViewGroup * MainPhoneView::NewcalllogButtonExt(CallLogInfo *data, uint8_t index,uint8_t i)
- {
- UIViewGroup * TempGroup_ = new UIViewGroup();
- if(nullptr == TempGroup_)
- return nullptr;
- UIView::OnClickListener *ButtonOnclickListen = static_cast<UIView::OnClickListener *>(MainPhonePresenter::GetInstance());
- if (ButtonOnclickListen == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ButtonOnclickListen new fail!");
- return nullptr;
- }
-
- if(0 == index)
- {
- TempGroup_->SetPosition(0, 0, 390, 104);
- TempGroup_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
- TempGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
- TempGroup_->SetStyle(STYLE_BORDER_RADIUS, 100);
-
-
-
- MainPhoneView_ButtonConfig_ext_t buttonconfig;
- buttonconfig.x = 0;
- buttonconfig.y = 0;
- buttonconfig.w = 390;
- buttonconfig.h = 104;
- buttonconfig.ViewId="xxxx";
-
-
- time_t currtime;
- struct tm *timeinfo;
- currtime=(data)->creationTime;
- timeinfo = localtime(&currtime);
- char time_buf[20]={0};
-
-
- sprintf_s(time_buf,20 ,"%d-%d-%d %d:%02d", timeinfo->tm_year + 1900,timeinfo->tm_mon + 1,timeinfo->tm_mday,timeinfo->tm_hour,timeinfo->tm_min);
- buttonconfig.str=time_buf;
-
- buttonconfig.ViewId=(const char*)(data)->tel;
- button_calllog[i]=SetTheButton_ext(buttonconfig,ButtonOnclickListen);
- if(button_calllog[i]==nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::button_calllog new fail!");
- }
- TempGroup_->Add(button_calllog[i]);
-
-
-
-
-
- TelephonyInitInterface::LabelParams labelParam = {
- .x = 49,
- .y = 19,
- .width = 280,
- .height = 41,
- .fontSize = 35,
- .lineHeigh = 0,
- .text = "xxx",
- .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
- };
-
- char buf[20]={0};
- sprintf_s(buf,20,"%s",(const char*)(data)->tel);
- char name[NAME_LEN+1]={0};
- if(get_phone_addrss_name(name,buf,NULL))
- {
- labelParam.text=name;
- }
- else
- {
- labelParam.text=buf;
- }
- button_calllog_time[i] = TelephonyInitInterface::LabelViewInit(labelParam,Color::GetColorFromRGBA(0xEE, 0xEE, 0xEE, 0xEE));
- if (button_calllog_time[i] == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewTitleLabel new fail!");
- }
- TempGroup_->Add(button_calllog_time[i]);
-
- labelParam.fontSize=18;
- labelParam.x=223+30;
- labelParam.y=60;
- labelParam.lineBreakMode=UILabel::LINE_BREAK_MARQUEE;
- labelParam.width=72;
- labelParam.height=21;
-
- ColorType color;
- button_calllog_status[i] = TelephonyInitInterface::LabelViewInit(labelParam,color);
- if (button_calllog_status[i] == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewTitleLabel new fail!");
- }
- if((data)->status==CALL_MISSED)
- {
- button_calllog_status[i]->SetTextId(STR_MISSED_CALLS);
- button_calllog_status[i]->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
- }
- else if((data)->status==CALL_INCOMING)
- {
- button_calllog_status[i]->SetTextId(STR_RECEIVED_CALLS);
- button_calllog_status[i]->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
- }
- else
- {
- button_calllog_status[i]->SetTextId(STR_DIALED_CALLS);
- button_calllog_status[i]->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
- }
- TempGroup_->Add(button_calllog_status[i]);
-
- if (call_log_type[i] == nullptr) {
- call_log_type[i] = new UIImageView();
- }
- call_log_type[i] ->SetPosition(253+90, 60); // widget's left position and top position
- call_log_type[i] ->Resize(20, 20); // widget's width and height
- call_log_type[i] ->SetViewId("image1");// Set style
- call_log_type[i] ->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
- call_log_type[i] ->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- call_log_type[i]->SetSrc(data->calllogtype?PNG_CALL_LOG_PHONE_IMAGE:PNG_CALL_LOG_WATCH_IMAGE);
- TempGroup_->Add(call_log_type[i]);
- }
- else
- {
- TempGroup_->SetPosition(0, 0, 100, 100);
- TempGroup_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
- TempGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
- TempGroup_->SetStyle(STYLE_BORDER_RADIUS, 100);
-
- TelephonyInitInterface::ButtonParams buttonParam = {
- .x = 0,
- .y = 0,
- .width = 100,
- .height = 100,
- .viewId = str_id[i+1],
- .backgroundColor = 0xff4fc34c,
- .pressedBackgroundColor = 0xff4fc34c,
- };
- DeleteButton[i] = TelephonyInitInterface::ButtonViewInit(buttonParam);
- if (DeleteButton[i] == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodButton new fail!");
- return nullptr;
- }
- DeleteButton[i]->SetImagePosition(0, 0);
- DeleteButton[i]->SetImageSrc(PNG_DELETE_PHONELINE_IMAGE, PNG_DELETE_PHONELINE_IMAGE);
- DeleteButton[i]->SetOnClickListener(ButtonOnclickListen);
- TempGroup_->Add(DeleteButton[i]);
- }
-
- return TempGroup_;
- }
-
- void MainPhoneView::Init_button_calllog_SwipeView( CallLogInfo *data,uint8_t i)
- {
- if(button_calllog_SwipeView[i]!=nullptr)
- {
- NewcalllogButtonExtupdata(data,0,i);
- NewcalllogButtonExtupdata(data,1,i);
- return;
- }
- button_calllog_SwipeView[i] = new UISwipeView(UISwipeView::HORIZONTAL);
-
- button_calllog_SwipeView[i]->SetPosition(38, 365+i*(124), 390, 104);
- button_calllog_SwipeView[i]->SetTouchable(true);
- button_calllog_SwipeView[i]->SetViewId("no_back");
- button_calllog_SwipeView[i]->SetOnSwipeListener(presenter_);
- button_calllog_SwipeView[i]->SetAnimatorTime(50); // 200:animator drag time(ms)
- // UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(MainPhonePresenter::GetInstance());
- // button_calllog_SwipeView[i]->SetOnDragListener(dragListener);
-
- button_calllog_SwipeView[i]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
- button_calllog_SwipeView[i]->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
- button_calllog_SwipeView[i]->SetStyle(STYLE_BORDER_RADIUS, 100);
-
-
- SwipeViewItem[i][0] = NewcalllogButtonExt(data, 0,i);
-
- button_calllog_SwipeView[i]->Add(SwipeViewItem[i][0]);
-
- SwipeViewItem[i][1] = NewcalllogButtonExt(data,1, i);
-
- button_calllog_SwipeView[i]->Add(SwipeViewItem[i][1]);
-
- button_calllog_SwipeView[i]->SetCurrentPage(0);
- button_calllog_SwipeView[i]->SetIntercept(false);
- button_calllog_SwipeView[i]->SetLoopState(false);
-
- button_calllog_SwipeView[i]->SetVisible(true);
-
- //button_calllog_SwipeView[i]->SetDirection();
-
- button_calllog_SwipeView[i]->SetDraggable(false);
- MainPhoneViewScrollView->Add(button_calllog_SwipeView[i]);
- }
-
-
void MainPhoneView::MainPhoneViewInit(void)
{
if (MainPhoneViewScrollView == nullptr)
.direction = 1,
};
MainPhoneViewScrollView = TelephonyInitInterface::ScrollViewInit(scrollviewParam);
+
+
+
if (MainPhoneViewScrollView == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewScrollView new fail!");
return;
}
+
+
UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(MainPhonePresenter::GetInstance());
if (dragListener == nullptr)
{
return;
}
MainPhoneViewScrollView->SetOnDragListener(dragListener);
+
+ UIView::OnRotateListener *RotateListener = static_cast<UIView::OnRotateListener *>(MainPhonePresenter::GetInstance());
+
+ MainPhoneViewScrollView->SetOnRotateListener(RotateListener);
+ // // 增加表冠控制
+ MainPhoneViewScrollView->SetRotateFactor(2);
+ MainPhoneViewScrollView->RequestFocus();
+
+
+
/* ------------------------- MainPhoneViewTitleLabel ------------------------ */
TelephonyInitInterface::LabelParams labelParam = {
.x = 83,
TelephoneLineImageView->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
TelephoneLineImageView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-
+ /* ------------------------------ Add ------------------------------ */
+
+ MainPhoneViewScrollView->Add(MainPhoneViewTitleLabel);
+ MainPhoneViewScrollView->Add(DialingMethodButton);
+ MainPhoneViewScrollView->Add(FrequentlyContactedButton);
+ MainPhoneViewScrollView->Add(RecentCallLabel);
+ MainPhoneViewScrollView->Add(TelephoneLineImageView);
+
/* ------------------------------ NoCallsLabel ------------------------------ */
// info = new CallLogInfo[sizeof(CallLogInfo) * CALL_LOG_MAX_NUM];
if (GetCallLog(info, &num) == -1) {
if(num>CALL_LOG_MAX_NUM)
num=CALL_LOG_MAX_NUM;
-
if (num != 0) {
- // for (int i = num; i != 0; i--) {
- // Init_button_calllog_SwipeView(info[i-1],y);
- // y++;
- // }
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneViewListViewInit__");
MainPhoneViewListViewInit();
else
NoCallsLabel->SetVisible(true);
+ MainPhoneViewScrollView->Add(NoCallsLabel);
+
+
}
void MainPhoneView::OnSetUpView()
{
View<MainPhonePresenter>::OnSetUpView();
- MainPhoneViewScrollView->Add(MainPhoneViewTitleLabel);
- MainPhoneViewScrollView->Add(DialingMethodButton);
- MainPhoneViewScrollView->Add(FrequentlyContactedButton);
- MainPhoneViewScrollView->Add(RecentCallLabel);
- MainPhoneViewScrollView->Add(TelephoneLineImageView);
- MainPhoneViewScrollView->Add(NoCallsLabel);
-
container_=MainPhoneViewScrollView;
RootView::GetInstance()->Add(container_);
+ RootView::GetInstance()->Add(delete_log_view);
Draw();
}