}
// Add ScrollView to App
- if (scrollView1_ == nullptr)
+ if (scrollView_ == nullptr)
{
- scrollView1_ = new UIScrollView();
+ scrollView_ = new UIScrollView();
}
- scrollView1_->SetPosition(0, 0); // widget's left position and top position
- scrollView1_->Resize(466, 466); // widget's width and height
- scrollView1_->SetViewId("scrollView1"); // Set style
- scrollView1_->SetReboundSize(100);
- scrollView1_->SetScrollBlankSize(35);
- scrollView1_->SetHorizontalScrollState(false);
- // Add to rootView
- container_->Add(scrollView1_);
- scrollView1_->SetVisible(true);
-
- // 初始化Image
- // TraingModel::GetInstance()->InitImageView(image1_, 200, 131, 80, 48, "image1", BUBBLE_IMAGE);
- // TraingModel::GetInstance()->InitImageView(image2_, 230, 183, 20, 20, "image2", PIONT_BUBBLE_IMAGE);
- // TraingModel::GetInstance()->InitImageView(image3_, 96, 118, 271, 233, "image3", PATH_IMAGE);
- // TraingModel::GetInstance()->InitImageView(image4_, 212, 402, 40, 40, "image4", INCO_UP_40_IMAGE);
- TraingModel::GetInstance()->InitImageView(image5_, 80, 470 - 338, 54, 80, "image5", WALKING_54_IMAGE);
- TraingModel::GetInstance()->InitImageView(image6_, 97, 552 - 338, 80, 20, "image6", LINE_IMAGE);
- TraingModel::GetInstance()->InitImageView(image8_, 97, 682 - 338, 80, 20, "image6", LINE_IMAGE);
- TraingModel::GetInstance()->InitImageView(image9_, 97, 812 - 338, 80, 20, "image6", LINE_IMAGE);
- TraingModel::GetInstance()->InitImageView(image10_, 97, 942 - 338, 80, 20, "image6", LINE_IMAGE);
- TraingModel::GetInstance()->InitImageView(image11_, 97, 1072 - 338, 80, 20, "image6", LINE_IMAGE);
-
- // scrollView1_->Add(image3_);
- scrollView1_->Add(image6_);
- scrollView1_->Add(image8_);
- scrollView1_->Add(image9_);
- scrollView1_->Add(image10_);
- scrollView1_->Add(image11_);
- // scrollView1_->Add(image1_);
- // scrollView1_->Add(image2_);
- // scrollView1_->Add(image4_);
- scrollView1_->Add(image5_);
-
- // 初始化button
- TraingModel::GetInstance()->InitButton(button1_, 42, 1319 - 338, 380, 100, BUTTONBACK);
- button1_->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingEnddataPresenter::GetInstance()));
- scrollView1_->Add(button1_);
+ scrollView_->SetPosition(0, 0); // widget's left position and top position
+ scrollView_->Resize(466, 466); // widget's width and height
+ scrollView_->SetViewId("scrollView1"); // Set style
+ scrollView_->SetReboundSize(100);
+ scrollView_->SetScrollBlankSize(35);
+ scrollView_->SetHorizontalScrollState(false);
+ container_->Add(scrollView_);
+ scrollView_->SetVisible(true);
+
+ // 初始化image
+ TraingModel::GetInstance()->InitImageView(image5_, 80, 132, 54, 80, "image5", WALKING_54_IMAGE);
+ TraingModel::GetInstance()->InitImageView(image6_, 97, 214, 80, 20, "image6", LINE_IMAGE);
+ TraingModel::GetInstance()->InitImageView(image8_, 97, 344, 80, 20, "image8", LINE_IMAGE);
+ TraingModel::GetInstance()->InitImageView(image9_, 97, 474, 80, 20, "image9", LINE_IMAGE);
+ TraingModel::GetInstance()->InitImageView(image10_, 97, 604, 80, 20, "image10", LINE_IMAGE);
+ TraingModel::GetInstance()->InitImageView(image11_, 97, 734, 80, 20, "image11", LINE_IMAGE);
+ scrollView_->Add(image6_);
+ scrollView_->Add(image8_);
+ scrollView_->Add(image9_);
+ scrollView_->Add(image10_);
+ scrollView_->Add(image11_);
+ scrollView_->Add(image5_);
// 初始化Lable
- TraingModel::GetInstance()->InitLabel(label1_, 188, 52, 90, 35, "label1", "健身类", DEFAULT_VECTOR_FONT_FILENAME, 30);
- // TraingModel::GetInstance()->InitLabel(label2_, 220, 140, 60, 40, "label2", "达标", DEFAULT_VECTOR_FONT_FILENAME, 20);
- // TraingModel::GetInstance()->InitLabel(label3_, 114, 252, 60, 40, "label3", "终", DEFAULT_VECTOR_FONT_FILENAME, 20);
- // TraingModel::GetInstance()->InitLabel(label4_, 172, 284, 60, 40, "label4", "起", DEFAULT_VECTOR_FONT_FILENAME, 20);
- // TraingModel::GetInstance()->InitLabel(label5_, 155, 372, 60, 40, "label5", "距离:8.3KM", DEFAULT_VECTOR_FONT_FILENAME, 30);
- TraingModel::GetInstance()->InitLabel(label6_, 146, 478 - 338, 60, 40, "label6", "健走", DEFAULT_VECTOR_FONT_FILENAME, 30);
- TraingModel::GetInstance()->InitLabel(label7_, 146, 517 - 338, 60, 40, "label7", "13:00:22-15:00:12", DEFAULT_VECTOR_FONT_FILENAME, 28);
-
- TraingModel::GetInstance()->InitLabel(label8_, 146, 590 - 338, 60, 40, "label8", "目标完成度", DEFAULT_VECTOR_FONT_FILENAME, 26);
- TraingModel::GetInstance()->InitLabel(label9_, 146, 720 - 338, 60, 40, "label9", "训练时长", DEFAULT_VECTOR_FONT_FILENAME, 26);
- TraingModel::GetInstance()->InitLabel(label10_, 146, 850 - 338, 60, 40, "label10", "距离(米)", DEFAULT_VECTOR_FONT_FILENAME, 26);
- TraingModel::GetInstance()->InitLabel(label11_, 146, 980 - 338, 60, 40, "label11", "平均心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 26);
- TraingModel::GetInstance()->InitLabel(label12_, 146, 1110 - 338, 60, 40, "label2", "训练强度", DEFAULT_VECTOR_FONT_FILENAME, 26);
- TraingModel::GetInstance()->InitLabel(label18_, 155, 1232 - 338, 60, 40, "label8", "更多数据请前往手机\nAPP“小希爱玩”查看", DEFAULT_VECTOR_FONT_FILENAME, 26);
-
- label7_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
- label8_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
- label9_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
- label10_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
- label11_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
- label12_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
- label18_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
-
- TraingModel::GetInstance()->InitLabel(label13_, 146, 626 - 338, 60, 40, "label18", "226%", DEFAULT_VECTOR_FONT_FILENAME, 40);
- label13_->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
- TraingModel::GetInstance()->InitLabel(label14_, 146, 756 - 338, 60, 40, "label14", "05:45:46", DEFAULT_VECTOR_FONT_FILENAME, 40);
- label14_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8a, 0x36, 0xff));
- TraingModel::GetInstance()->InitLabel(label15_, 146, 886 - 338, 60, 40, "label15", "8,301", DEFAULT_VECTOR_FONT_FILENAME, 40);
- label15_->SetTextColor(Color::GetColorFromRGBA(0x36, 0x4a, 0xff, 0xff));
- TraingModel::GetInstance()->InitLabel(label16_, 146, 1016 - 338, 60, 40, "label16", "144", DEFAULT_VECTOR_FONT_FILENAME, 40);
- label16_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
- TraingModel::GetInstance()->InitLabel(label17_, 146, 1146 - 338, 60, 40, "label17", "中等强度", DEFAULT_VECTOR_FONT_FILENAME, 40);
- label17_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
- TraingModel::GetInstance()->InitLabel(label19_, 201, 1348 - 338, 60, 40, "label19", "关闭", DEFAULT_VECTOR_FONT_FILENAME, 31);
-
- scrollView1_->Add(label1_);
- // scrollView1_->Add(label2_);
- // scrollView1_->Add(label3_);
- // scrollView1_->Add(label4_);
- // scrollView1_->Add(label5_);
- scrollView1_->Add(label6_);
- scrollView1_->Add(label7_);
- scrollView1_->Add(label8_);
- scrollView1_->Add(label9_);
- scrollView1_->Add(label10_);
- scrollView1_->Add(label11_);
- scrollView1_->Add(label12_);
- scrollView1_->Add(label13_);
- scrollView1_->Add(label14_);
- scrollView1_->Add(label15_);
- scrollView1_->Add(label16_);
- scrollView1_->Add(label17_);
- scrollView1_->Add(label18_);
- scrollView1_->Add(label19_);
+ // 初始化标签
+ TraingModel::GetInstance()->InitLabel(labeltype, 188, 52, 90, 35, "label1", "健身类", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TraingModel::GetInstance()->InitLabel(labelsport, 147, 140, 240, 35, "label6", "健走", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TraingModel::GetInstance()->InitLabel(labelduration, 146, 179, 240, 40, "label7", "13:00:22-15:00:12", DEFAULT_VECTOR_FONT_FILENAME, 28);
+ TraingModel::GetInstance()->InitLabel(labelutag, 146, 252, 240, 40, "label8", "目标完成度", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TraingModel::GetInstance()->InitLabel(labelutime, 146, 382, 240, 40, "label9", "训练时长", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TraingModel::GetInstance()->InitLabel(labelumile, 146, 512, 240, 40, "label10", "距离(米)", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TraingModel::GetInstance()->InitLabel(labeluheart, 146, 642, 240, 40, "label11", "平均心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TraingModel::GetInstance()->InitLabel(labelustrong, 146, 772, 240, 40, "label2", "训练强度", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TraingModel::GetInstance()->InitLabel(labelnote, 80, 894, 300, 40, "label8", "更多数据请前往手机APP查看", DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ // 设置文本颜色
+ labelduration->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+ labelutag->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+ labelutime->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+ labelumile->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+ labeluheart->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+ labelustrong->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+ labelnote->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+
+ TraingModel::GetInstance()->InitLabel(labeltag, 146, 292, 240, 60, "label18", "230%", DEFAULT_VECTOR_FONT_FILENAME, 40);
+ labeltag->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+ TraingModel::GetInstance()->InitLabel(labeltime, 146, 418, 240, 60, "label14", "05:45:46", DEFAULT_VECTOR_FONT_FILENAME, 40);
+ labeltime->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8a, 0x36, 0xff));
+ TraingModel::GetInstance()->InitLabel(labelmile, 146, 548, 240, 60, "label15", "8,301", DEFAULT_VECTOR_FONT_FILENAME, 40);
+ labelmile->SetTextColor(Color::GetColorFromRGBA(0x36, 0x4a, 0xff, 0xff));
+ TraingModel::GetInstance()->InitLabel(labelheart, 146, 678, 240, 60, "label16", "144", DEFAULT_VECTOR_FONT_FILENAME, 40);
+ labelheart->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
+ TraingModel::GetInstance()->InitLabel(labelstrong, 146, 808, 240, 60, "label17", "中等强度", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ labelstrong->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
+
+ scrollView_->Add(labeltype);
+ scrollView_->Add(labelsport);
+ scrollView_->Add(labeltime);
+ scrollView_->Add(labelutag);
+ scrollView_->Add(labelutime);
+ scrollView_->Add(labelumile);
+ scrollView_->Add(labeluheart);
+ scrollView_->Add(labelustrong);
+ scrollView_->Add(labeltag);
+ scrollView_->Add(labelduration);
+ scrollView_->Add(labelmile);
+ scrollView_->Add(labelheart);
+ scrollView_->Add(labelstrong);
+ scrollView_->Add(labelnote);
+
+ // 初始化button
+ TraingModel::GetInstance()->InitButtonExt(buttonexit, 42, 1319 - 338, 380, 100, BUTTONBACK, STR_OFF, 30);
+ buttonexit->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingEnddataPresenter::GetInstance()));
+ scrollView_->Add(buttonexit);
// Add ImageView to App
if (image7_ == nullptr)
image7_->Resize(100, 100); // widget's width and height
image7_->SetViewId("image7"); // Set style
// Add to rootView
- scrollView1_->Add(image7_);
+ scrollView_->Add(image7_);
image7_->SetVisible(true);
}
viewiInitStatus = true;
}
}
+
+ void TraingEnddataView::InitData()
+ {
+ SportData *enddata = TraingModel::GetInstance()->GetSportdata();
+
+ // 运动项目
+ labelsport->SetTextId(enddata->sportId);
+
+ // 运动开始结束时间
+ std::string startTimeStr = TraingModel::GetInstance()->AnalysisTimestamp(enddata->starttime);
+ std::string endTimeStr = TraingModel::GetInstance()->AnalysisTimestamp(enddata->endtime);
+ std::string durationStr = startTimeStr + "-" + endTimeStr;
+ labelduration->SetText(durationStr.c_str());
+
+ // 运动目标
+ labeltag->SetText("100%"); // 暂时设置为默认
+
+ // 运动时长
+ uint32_t time = TraingModel::GetInstance()->GetTrainingTime();
+ std::string timeStr = TraingModel::GetInstance()->AnalysisTimestamp(time);
+ labeltime->SetText(timeStr.c_str());
+
+ // 运动距离
+ std::string mileStr = std::to_string(enddata->distance);
+ labelmile->SetText(mileStr.c_str());
+
+ // 平均心率
+ int heart = TraingModel::GetInstance()->CalculateAverageHeartRate(155); // 设置一个测试值
+ std::string heartStr = std::to_string(heart);
+ labelheart->SetText(heartStr.c_str());
+
+ // 训练强度
+ labelstrong->SetText("中等强度");
+ }
+
void TraingEnddataView::OnStart()
{
container_ = new UIViewGroup();
container_->SetDraggable(true);
PreLoad();
+ InitData();
RootView::GetInstance()->Add(container_);
}
RootView::GetInstance()->RemoveAll();
return;
}
+
}