#include "watchQRcode/include/WatchQRCodeView.h"
#include "wearable_log.h"
#include "custom_utils.h"
+#include "language/font/ui_resource_string.h"
namespace OHOS
{
{
WatchQRCodeGroupView->RemoveAll();
- delete Watch_QR_Code_View;
- Watch_QR_Code_View = nullptr;
-
- delete DeviceNameLabel;
- DeviceNameLabel = nullptr;
-
- delete WatchQRCodeGroupView;
- WatchQRCodeGroupView = nullptr;
+ if (TitleLabel != nullptr)
+ {
+ delete TitleLabel;
+ TitleLabel = nullptr;
+ }
+
+ if (Watch_QR_Code_View != nullptr)
+ {
+ delete Watch_QR_Code_View;
+ Watch_QR_Code_View = nullptr;
+ }
+
+ if (DeviceNameLabel != nullptr)
+ {
+ delete DeviceNameLabel;
+ DeviceNameLabel = nullptr;
+ }
+
+ if (WatchQRCodeGroupView != nullptr)
+ {
+ delete WatchQRCodeGroupView;
+ WatchQRCodeGroupView = nullptr;
+ }
}
}
bool WatchQRCodeView::WatchQRCodeInitViewGroup(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::WatchQRCodeInitViewGroup");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::WatchQRCodeInitViewGroup");
WatchQRCodeGroupView = new UIViewGroup();
if (WatchQRCodeGroupView == nullptr)
{
bool WatchQRCodeView::WatchQRCodeInitQrcodeImage(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::WatchQRCodeInitQrcodeImage");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::WatchQRCodeInitQrcodeImage");
Watch_QR_Code_View = new UIQrcode();
if (Watch_QR_Code_View == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::Watch_QR_Code_View new fail!");
return false;
}
- Watch_QR_Code_View->SetPosition(93, 110, 280, 280);
+ Watch_QR_Code_View->SetPosition(93, 100, 280, 280);
+ Watch_QR_Code_View->SetECCLevel(QrCode::Ecc::LOW);/*QR 码的 ECC(Error Correction Code ,错误纠正码)级别表示二维码的纠错能力或容错率*/
Watch_QR_Code_View->SetAutoEnable(false);
Watch_QR_Code_View->SetResizeMode(UIImageView::ImageResizeMode::CENTER);
std::string str = WatchQRCodePresenter::GetInstance()->WatchQRCodeGetQRCodeStr();
bool WatchQRCodeView::WatchQRCodeInitLabel(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::WatchQRCodeInitLabel");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::WatchQRCodeInitLabel");
+ TitleLabel = new UILabelExt();
+ if (TitleLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::TitleLabel new label fail");
+ return false;
+ }
+ TitleLabel->SetPosition(83, 50, 300, 35);
+ TitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+ TitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ TitleLabel->SetTextId(STR_SCANNING_BINDING);
+ TitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TitleLabel->SetRollSpeed(70);
+ TitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ TitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ WatchQRCodeGroupView->Add(TitleLabel);
+ /* -------------------------------------------------------------------------- */
DeviceNameLabel = new UILabel();
if (DeviceNameLabel == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::DeviceNameLabel new label fail");
return false;
}
- // DeviceNameLabel->SetText("KUMI_XXXX");
uint8_t ble_name[30] = {0};
uint32_t ble_name_len = sizeof(ble_name);
errcode_t ret = uapi_get_nv_btname(ble_name, &ble_name_len);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get btname %s ,ret 0x%X\n", ble_name, ret);
- DeviceNameLabel->SetText((char*)ble_name);
- DeviceNameLabel->SetPosition(83, 412, 300, 35);
+ DeviceNameLabel->SetText((char *)ble_name);
+ DeviceNameLabel->SetPosition(83, 402, 300, 35);
DeviceNameLabel->SetStyle(STYLE_TEXT_FONT, 30);
DeviceNameLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
DeviceNameLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- DeviceNameLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ DeviceNameLabel->SetRollSpeed(70);
+ DeviceNameLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
DeviceNameLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
DeviceNameLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
WatchQRCodeGroupView->Add(DeviceNameLabel);
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::OnStop");
View<WatchQRCodePresenter>::OnStop();
-
RootView::GetInstance()->RemoveAll();
RootView::GetInstance()->ClearOnKeyActListener();
+ ClearAll();
return;
}