549 lines
19 KiB
C++
549 lines
19 KiB
C++
#include "TjdUiAppBusinesscardView.h"
|
|
#include "NativeAbility.h"
|
|
#include "TjdUiAppIds.h"
|
|
#include "TjdUiImageIds.h"
|
|
#include "TjdUiMemManage.h"
|
|
#include "TjdUiMultiLanguageExt.h"
|
|
#include "TjdUiUtils.h"
|
|
#include "chip_io.h"
|
|
#include "common/image_cache_manager.h"
|
|
#include "sql_fit.h"
|
|
#include "sys_config.h"
|
|
#include "wearable_log.h"
|
|
// #include "gfx_utils/mem_check.h"
|
|
// #include "TjdUiAppBusinesscardModel.h"
|
|
|
|
using namespace OHOS;
|
|
|
|
#define ENABLE_PRINT_INFO 1
|
|
#if ENABLE_PRINT_INFO
|
|
#define static_print_info(...) sys_ui_log_i(__VA_ARGS__) //一般信息打印宏控制
|
|
#define static_print_warn(...) sys_ui_log_w(__VA_ARGS__) //警告信息打印一般常开
|
|
#define static_print_error(...) sys_ui_log_e(__VA_ARGS__) //错误信息打印一般常开
|
|
#define static_print_debug(...) sys_ui_log_d(__VA_ARGS__) //调试信息打印
|
|
#else
|
|
#define static_print_info(...)
|
|
#define static_print_warn(...)
|
|
#define static_print_error(...)
|
|
#define static_print_debug(...)
|
|
#endif
|
|
|
|
namespace TJD {
|
|
|
|
static bool enter_list_flag = true;
|
|
|
|
#define IMAGE_BIN_PATH TJD_IMAGE_PATH "img_business_card.bin"
|
|
|
|
struct BusinessCardInfo
|
|
{
|
|
BusinessCardItemIndex index;
|
|
int resId;
|
|
BusinessCardType type;
|
|
uint16_t descriptionId;
|
|
qrcode_type_t ifBoundsImgIndex;
|
|
};
|
|
|
|
// clang-format off
|
|
BusinessCardInfo g_pv_businessCards[] = {
|
|
{BUSINESSCARD_WECHAT_INDEX, IMG_BUSINESS_CARD_WECHAT, BUSINESSCARD_TYPE_NORMAL, STR_ID_334 ,QRCODE_WECHATCARD},
|
|
{BUSINESSCARD_QQ_INDEX, IMG_BUSINESS_CARD_QQ, BUSINESSCARD_TYPE_NORMAL, STR_ID_335 ,QRCODE_QQ},
|
|
{BUSINESSCARD_FACEBOOK_INDEX, IMG_BUSINESS_CARD_FACE_BOOK, BUSINESSCARD_TYPE_NORMAL, STR_ID_336 ,QRCODE_FACEBOOK },
|
|
{BUSINESSCARD_WHATSAPP_INDEX, IMG_BUSINESS_CARD_WHATSAPP, BUSINESSCARD_TYPE_NORMAL, STR_ID_337 ,QRCODE_WHATSAPP},
|
|
{BUSINESSCARD_TWITTER_INDEX, IMG_BUSINESS_CARD_X, BUSINESSCARD_TYPE_NORMAL, STR_ID_338 ,QRCODE_TWITTER},
|
|
{BUSINESSCARD_INSTAGRAM_INDEX, IMG_BUSINESS_CARD_INSTAGRAM, BUSINESSCARD_TYPE_NORMAL, STR_ID_339 ,QRCODE_INSTAGRAM},
|
|
{BUSINESSCARD_LINE_INDEX, IMG_BUSINESS_CARD_LINE, BUSINESSCARD_TYPE_NORMAL, STR_ID_340 ,QRCODE_LINE},
|
|
};
|
|
// clang-format on
|
|
|
|
static TjdUiAppBusinessCardView *g_pv_AppBusinesscardView = nullptr;
|
|
static BusinessCardTipView *g_BusinessCardTipView = nullptr;
|
|
static BusinessCardListView *g_BusinessCardListView = nullptr;
|
|
static BusinessCardCardView *g_BusinessCardCardView = nullptr;
|
|
// static VoiceAssistantAwakeView *g_VoiceAssistantAwakeView = nullptr;
|
|
|
|
// class BusinesscardOnClickedListener : public UIView::OnClickListener
|
|
// {
|
|
// public:
|
|
// BusinesscardOnClickedListener() {}
|
|
// virtual ~BusinesscardOnClickedListener() {}
|
|
// virtual bool OnClick(UIView &view, const ClickEvent &event)
|
|
// {
|
|
|
|
// return true;
|
|
// }
|
|
|
|
// private:
|
|
// };
|
|
|
|
static inline int16_t HorizontalCenter(int16_t width) { return (OHOS::HORIZONTAL_RESOLUTION - width) / 2; }
|
|
static inline int16_t HorizontalCenter(int16_t width, int16_t parentWidth) { return (parentWidth - width) / 2; }
|
|
|
|
static inline void InitLabel(OHOS::UILabel &label, uint8_t size, int16_t y, const char *text)
|
|
{
|
|
label.SetFont(TJD_VECTOR_FONT_FILENAME, size);
|
|
label.SetText(text);
|
|
label.SetLineBreakMode(OHOS::UILabel::LINE_BREAK_ADAPT);
|
|
label.SetAlign(OHOS::TEXT_ALIGNMENT_CENTER, OHOS::TEXT_ALIGNMENT_CENTER);
|
|
label.SetPosition(HorizontalCenter(label.GetWidth()), y);
|
|
}
|
|
|
|
bool BusinesscardUIScrollView::OnDragStartEvent(const OHOS::DragEvent &event)
|
|
{
|
|
TjdUiAppBusinessCardView *businesscardView = TjdUiAppBusinessCardView::GetInstance();
|
|
if (businesscardView == nullptr) {
|
|
return true;
|
|
}
|
|
|
|
if (TjdUiAppBusinessCardView::currentViewIndex_ != BusinessCardIndex::BUSINESSCARD_TIPVIEW &&
|
|
TjdUiAppBusinessCardView::currentViewIndex_ != BusinessCardIndex::BUSINESSCARD_LISTVIEW) {
|
|
return true;
|
|
}
|
|
|
|
isOnStart_ = true;
|
|
return OHOS::UIScrollViewNested::OnDragStartEvent(event);
|
|
}
|
|
|
|
bool BusinesscardUIScrollView::OnDragEvent(const OHOS::DragEvent &event)
|
|
{
|
|
if (!isOnStart_) {
|
|
return true;
|
|
}
|
|
|
|
TjdUiAppBusinessCardView *businesscardView = TjdUiAppBusinessCardView::GetInstance();
|
|
if (businesscardView == nullptr) {
|
|
return true;
|
|
}
|
|
|
|
if (TjdUiAppBusinessCardView::currentViewIndex_ != BusinessCardIndex::BUSINESSCARD_TIPVIEW &&
|
|
TjdUiAppBusinessCardView::currentViewIndex_ != BusinessCardIndex::BUSINESSCARD_LISTVIEW) {
|
|
return true;
|
|
}
|
|
|
|
return OHOS::UIScrollViewNested::OnDragEvent(event);
|
|
}
|
|
|
|
bool BusinesscardUIScrollView::OnDragEndEvent(const OHOS::DragEvent &event)
|
|
{
|
|
if (!isOnStart_) {
|
|
return true;
|
|
}
|
|
isOnStart_ = false;
|
|
|
|
TjdUiAppBusinessCardView *businesscardView = TjdUiAppBusinessCardView::GetInstance();
|
|
if (businesscardView == nullptr) {
|
|
return true;
|
|
}
|
|
|
|
if (TjdUiAppBusinessCardView::currentViewIndex_ != BusinessCardIndex::BUSINESSCARD_TIPVIEW &&
|
|
TjdUiAppBusinessCardView::currentViewIndex_ != BusinessCardIndex::BUSINESSCARD_LISTVIEW) {
|
|
return true;
|
|
}
|
|
return OHOS::UIScrollViewNested::OnDragEndEvent(event);
|
|
}
|
|
|
|
TjdUiAppBusinessCardView::TjdUiAppBusinessCardView()
|
|
{
|
|
// OHOS::MemCheck::GetInstance()->EnableLeakCheck(true);
|
|
g_pv_AppBusinesscardView = this;
|
|
}
|
|
|
|
TjdUiAppBusinessCardView::~TjdUiAppBusinessCardView()
|
|
{
|
|
g_pv_AppBusinesscardView = nullptr;
|
|
// OHOS::MemCheck::GetInstance()->EnableLeakCheck(false);
|
|
}
|
|
|
|
TjdUiAppBusinessCardView *TjdUiAppBusinessCardView::GetInstance(void) { return g_pv_AppBusinesscardView; }
|
|
BusinessCardIndex TjdUiAppBusinessCardView::currentViewIndex_ = BusinessCardIndex::BUSINESSCARD_MAXTHVIEW;
|
|
void TjdUiAppBusinessCardView::InitBusinesscardList()
|
|
{
|
|
auto &image = OHOS::ImageCacheManager::GetInstance();
|
|
image.LoadAllInMultiRes(IMAGE_BIN_PATH);
|
|
|
|
if (businessCardItemList_ == nullptr) {
|
|
businessCardItemList_ = new std::list<BusinessCardCaseInfo>();
|
|
}
|
|
businessCardItemList_->clear();
|
|
OHOS::ImageInfo *boundInfo = nullptr;
|
|
for (const auto &businessCard : g_pv_businessCards) {
|
|
boundInfo = image.LoadOneInMultiRes(IMG_BUSINESS_CARD_ALREADY_BOUND, IMAGE_BIN_PATH);
|
|
imgItemInfo[businessCard.index] = image.LoadOneInMultiRes(businessCard.resId, IMAGE_BIN_PATH);
|
|
businessCardItemList_->push_back({businessCard.index, businessCard.type, imgItemInfo[businessCard.index],
|
|
businessCard.descriptionId, boundInfo, businessCard.ifBoundsImgIndex});
|
|
}
|
|
}
|
|
|
|
void TjdUiAppBusinessCardView::OnStart()
|
|
{
|
|
static_print_info("TjdUiAppBusinessCardView::OnStart()");
|
|
View<TjdUiAppBusinesscardPresenter>::OnStart();
|
|
|
|
if (TjdUiAppBusinesscardPresenter::GetInstance() == nullptr) {
|
|
static_print_info("TjdUiAppBusinesscardPresenter::GetInstance is nullptr!!\n");
|
|
return;
|
|
}
|
|
|
|
// OHOS::ImageCacheManager::GetInstance().LoadAllInMultiRes(IMAGE_BIN_PATH);
|
|
OHOS::ImageCacheManager::GetInstance().LoadAllInMultiRes(IMAGE_BIN_PATH);
|
|
|
|
if (mainView_ == nullptr) {
|
|
mainView_ = new BusinesscardUIScrollView();
|
|
}
|
|
mainView_->SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
|
|
// mainView_->SetOnDragListener(TjdUiAppBusinesscardPresenter::GetInstance());
|
|
|
|
// OHOS::RootView::GetInstance()->Add(mainView_);
|
|
AddViewToRootContainer(mainView_);
|
|
|
|
InitBusinesscardList();
|
|
InitTargetView(BusinessCardIndex::BUSINESSCARD_CARDVIEW);
|
|
// AddViewToRootContainer(vocassistance);
|
|
// TjdUiVocassistModel::GetInstance()->Init();
|
|
if (sql_bt_get_qrcode_show_flag()) {
|
|
ShowView(BusinessCardIndex::BUSINESSCARD_LISTVIEW);
|
|
} else {
|
|
ShowView(BusinessCardIndex::BUSINESSCARD_TIPVIEW);
|
|
}
|
|
}
|
|
|
|
void TjdUiAppBusinessCardView::OnStop()
|
|
{
|
|
// RootView::GetInstance()->Remove(containerAll_);
|
|
if (mainView_ != nullptr) {
|
|
mainView_->RemoveAll();
|
|
delete mainView_;
|
|
mainView_ = nullptr;
|
|
}
|
|
|
|
for (int i = 0; i < BusinessCardIndex::BUSINESSCARD_MAXTHVIEW; i++) {
|
|
if (viewManager_[i] != nullptr) {
|
|
viewManager_[i]->RemoveAll();
|
|
delete viewManager_[i];
|
|
viewManager_[i] = nullptr;
|
|
}
|
|
}
|
|
OHOS::ImageCacheManager::GetInstance().UnloadAllInMultiRes(IMAGE_BIN_PATH);
|
|
}
|
|
|
|
void TjdUiAppBusinessCardView::InitTargetView(BusinessCardIndex index)
|
|
{
|
|
if (viewManager_[index] != nullptr) {
|
|
return;
|
|
}
|
|
|
|
// clang-format off
|
|
switch (index) {
|
|
case BUSINESSCARD_TIPVIEW: viewManager_[index] = new BusinessCardTipView(); break;
|
|
case BUSINESSCARD_LISTVIEW: viewManager_[index] = new BusinessCardListView(); break;
|
|
case BUSINESSCARD_CARDVIEW: viewManager_[index] = new BusinessCardCardView(); break;
|
|
|
|
default: break;
|
|
}
|
|
// clang-format on
|
|
|
|
if (viewManager_[index] == nullptr) {
|
|
return;
|
|
}
|
|
|
|
viewManager_[index]->SetPosition(0, 0);
|
|
viewManager_[index]->SetVisible(false);
|
|
mainView_->Add(viewManager_[index]);
|
|
}
|
|
|
|
void TjdUiAppBusinessCardView::ShowView(BusinessCardIndex showIndex)
|
|
{
|
|
if (showIndex < 0 || showIndex >= BusinessCardIndex::BUSINESSCARD_MAXTHVIEW) {
|
|
return;
|
|
}
|
|
|
|
InitTargetView(showIndex);
|
|
|
|
if (currentViewIndex_ >= 0 && currentViewIndex_ < BusinessCardIndex::BUSINESSCARD_MAXTHVIEW &&
|
|
viewManager_[currentViewIndex_] != nullptr) {
|
|
viewManager_[currentViewIndex_]->HideView();
|
|
}
|
|
|
|
if (viewManager_[showIndex] != nullptr) {
|
|
viewManager_[showIndex]->ShowView();
|
|
}
|
|
|
|
currentViewIndex_ = showIndex;
|
|
}
|
|
|
|
BusinessCardTipView::BusinessCardTipView(void)
|
|
{
|
|
static_print_info("BusinessCardTipView::BusinessCardTipView...");
|
|
g_BusinessCardTipView = this;
|
|
SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
|
|
if (OHOS::PageTransitionMgr::GetInstance().GetTopSlideBackImage() == nullptr) {
|
|
SetOnDragListener(TjdUiAppBusinesscardPresenter::GetInstance());
|
|
}
|
|
SetViewId("tipView");
|
|
// SetStyle(STYLE_BACKGROUND_OPA, 0);
|
|
// SetVisible(false);
|
|
|
|
// Add Label to App
|
|
|
|
title_.SetPosition(0, 16);
|
|
title_.Resize(466, 37);
|
|
// title_.SetViewId("lblTitle_");
|
|
title_.SetStyle(STYLE_TEXT_FONT, 28);
|
|
|
|
// title_.SetText("名片");
|
|
title_.SetTextId(STR_ID_22);
|
|
// title_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
|
|
title_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
|
|
title_.SetRollSpeed(0);
|
|
title_.SetFont(TJD_VECTOR_FONT_FILENAME, 28);
|
|
title_.SetVisible(true);
|
|
// Add to rootView
|
|
Add(&title_);
|
|
|
|
// Add Label to App
|
|
tip_.SetPosition(0, 218);
|
|
tip_.Resize(466, 45);
|
|
// lblTip_->SetViewId("lblTip_");
|
|
tip_.SetStyle(STYLE_TEXT_FONT, 32);
|
|
|
|
// Set additional property
|
|
// tip_.SetText("打开APP绑定后使用");//333
|
|
tip_.SetTextId(STR_ID_333);
|
|
// tip_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
|
|
tip_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
|
|
tip_.SetRollSpeed(0);
|
|
tip_.SetFont(TJD_VECTOR_FONT_FILENAME, 32);
|
|
tip_.SetVisible(true);
|
|
// Add to rootView
|
|
Add(&tip_);
|
|
|
|
/*-----------------------------Add imgReturn_ to AboutView_------------------------------*/
|
|
return_.SetPosition(187, 352);
|
|
return_.SetViewId("imgReturn_Return");
|
|
auto bgRes = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_BUSINESS_CARD_BJ, IMAGE_BIN_PATH);
|
|
if (bgRes != nullptr) {
|
|
return_.SetSrc(bgRes);
|
|
}
|
|
return_.SetTouchable(true);
|
|
return_.SetOnClickListener(TjdUiAppBusinesscardPresenter::GetInstance());
|
|
|
|
Add(&return_);
|
|
}
|
|
|
|
BusinessCardTipView::~BusinessCardTipView(void)
|
|
{
|
|
g_BusinessCardTipView = nullptr;
|
|
RemoveAll();
|
|
}
|
|
|
|
void BusinessCardTipView::ShowView() { SetVisible(true); }
|
|
|
|
void BusinessCardTipView::HideView() { SetVisible(false); }
|
|
|
|
BusinessCardTipView *BusinessCardTipView::GetInstance(void) { return g_BusinessCardTipView; }
|
|
|
|
BusinessCardListView::BusinessCardListView(void)
|
|
{
|
|
static_print_info("BusinessCardListView::BusinessCardListView...");
|
|
g_BusinessCardListView = this;
|
|
SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
|
|
if (OHOS::PageTransitionMgr::GetInstance().GetTopSlideBackImage() == nullptr) {
|
|
SetOnDragListener(TjdUiAppBusinesscardPresenter::GetInstance());
|
|
}
|
|
SetViewId("listView");
|
|
// SetStyle(STYLE_BACKGROUND_OPA, 0);
|
|
// SetVisible(false);
|
|
|
|
// Add Label to App
|
|
|
|
// if (businessCardListAdapter_ == nullptr) {
|
|
// businessCardListAdapter_ = new TjdUiAppBusinessCardAdapter();
|
|
// }
|
|
|
|
// businessCardList_.SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
|
|
// businessCardList_.SetAdapter(businessCardListAdapter_);
|
|
// businessCardList_.SetYScrollBarVisible(true);
|
|
// businessCardList_.SetStartIndex(0);
|
|
// Add(&businessCardList_);
|
|
listTitle_.SetFont(TJD_VECTOR_FONT_FILENAME, 28);
|
|
listTitle_.SetTextId(STR_ID_22);
|
|
// listTitle_.SetLineBreakMode(OHOS::UILabel::LINE_BREAK_ADAPT);
|
|
listTitle_.SetAlign(OHOS::TEXT_ALIGNMENT_CENTER, OHOS::TEXT_ALIGNMENT_TOP);
|
|
listTitle_.SetPosition(0, 17, 466, 100);
|
|
|
|
auto businessCardListInfo = TjdUiAppBusinessCardView::GetInstance()->GetBusinesscardItemList();
|
|
businessCardAdapterPtr_ =
|
|
new TjdUITransformListGroupAdapter<BusinessCardCaseInfo, BusinessCardCaseItemView,
|
|
std::list<BusinessCardCaseInfo>>(*businessCardListInfo);
|
|
businessCardListView = new TjdUITransformListGroup(businessCardAdapterPtr_);
|
|
businessCardListView->AddCustomView(&listTitle_, TjdUITransformListGroup::CustomViewPos::TOP);
|
|
|
|
Add(businessCardListView);
|
|
}
|
|
|
|
BusinessCardListView::~BusinessCardListView(void)
|
|
{
|
|
g_BusinessCardListView = nullptr;
|
|
RemoveAll();
|
|
if (businessCardAdapterPtr_ != nullptr) {
|
|
delete businessCardAdapterPtr_;
|
|
businessCardAdapterPtr_ = nullptr;
|
|
}
|
|
|
|
if (businessCardListView != nullptr) {
|
|
delete businessCardListView;
|
|
businessCardListView = nullptr;
|
|
}
|
|
}
|
|
|
|
void BusinessCardListView::ShowView() { SetVisible(true); }
|
|
|
|
void BusinessCardListView::HideView() { SetVisible(false); }
|
|
|
|
BusinessCardListView *BusinessCardListView::GetInstance(void) { return g_BusinessCardListView; }
|
|
|
|
// clang-format off
|
|
void BusinessCardListView::ChooseBusinesscardItem(BusinessCardItemIndex index)
|
|
{
|
|
if (index < 0 || index >= BUSINESSCARD_MAX_INDEX) {
|
|
return;
|
|
}
|
|
|
|
qrcode_type_t type;
|
|
switch(index){
|
|
case BUSINESSCARD_WECHAT_INDEX: type = QRCODE_WECHATCARD; break;
|
|
case BUSINESSCARD_QQ_INDEX: type = QRCODE_QQ; break;
|
|
case BUSINESSCARD_FACEBOOK_INDEX: type = QRCODE_FACEBOOK; break;
|
|
case BUSINESSCARD_INSTAGRAM_INDEX: type = QRCODE_INSTAGRAM; break;
|
|
case BUSINESSCARD_LINE_INDEX: type = QRCODE_LINE; break;
|
|
case BUSINESSCARD_TWITTER_INDEX: type = QRCODE_TWITTER; break;
|
|
case BUSINESSCARD_WHATSAPP_INDEX: type = QRCODE_WHATSAPP; break;
|
|
}
|
|
// listView_->SetVisible(false);
|
|
|
|
if(sql_bt_get_qrcode_exist(type))
|
|
{
|
|
uint8_t qrcode_data[256] = {0};
|
|
uint16_t qrcode_len = 0;
|
|
InitBusinesscardItemView(index);
|
|
if((sql_bt_get_qrcode_info(type, qrcode_data, &qrcode_len) == 0)){
|
|
|
|
BusinessCardCardView::GetInstance()->GetQrcode().SetQrcodeInfo(qrcode_data,qrcode_len);
|
|
}
|
|
TjdUiAppBusinessCardView::GetInstance()->ShowView(BusinessCardIndex::BUSINESSCARD_CARDVIEW);
|
|
|
|
}else{
|
|
// imgReturn_->SetViewId("imgReturn_listView");
|
|
// ChangedView(TIP_VIEW, LIST_VIEW);
|
|
TjdUiAppBusinessCardView::GetInstance()->ShowView(BusinessCardIndex::BUSINESSCARD_TIPVIEW);
|
|
BusinessCardTipView::GetInstance()->GetReturnBtn().SetViewId("imgReturn_cardView");
|
|
}
|
|
|
|
}
|
|
// clang-format on
|
|
|
|
BusinessCardCardView::BusinessCardCardView(void)
|
|
{
|
|
static_print_info("BusinessCardCardView::BusinessCardCardView...");
|
|
g_BusinessCardCardView = this;
|
|
SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
|
|
SetOnDragListener(TjdUiAppBusinesscardPresenter::GetInstance());
|
|
SetViewId("cardView");
|
|
|
|
// desc_.Resize(53, 27); // widget's width and height
|
|
desc_.SetViewId("lblTitle_cardView"); // Set style
|
|
desc_.SetStyle(STYLE_TEXT_FONT, 30);
|
|
// Set additional property
|
|
// desc_.SetText("微信");
|
|
desc_.SetTextId(STR_ID_334);
|
|
desc_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
|
|
desc_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
|
|
// desc_.SetRollSpeed(0);
|
|
desc_.SetFont(TJD_VECTOR_FONT_FILENAME, 30);
|
|
desc_.SetPosition(198, 28, 70, 34); // widget's left position and top position
|
|
TjdUiUtils::AutoAlignHorizontalCenter(desc_);
|
|
// desc_.SetVisible(true);
|
|
// Add to rootView
|
|
|
|
qrcode_.SetPosition(132, 95, 220, 220);
|
|
qrcode_.SetECCLevel(QrCode::Ecc::QUARTILE);
|
|
qrcode_.SetResizeMode(OHOS::UIImageView::ImageResizeMode::FILL);
|
|
// qrcode_.SetQrcodeInfo("https://h5.sz-tjd.com/download/cn");
|
|
// qrcode_.SetVisible(true);
|
|
Add(&qrcode_);
|
|
// Add Label to App
|
|
|
|
/*-----------------------------Add imgReturn_ to AboutView_------------------------------*/
|
|
|
|
bg_.SetPosition(187, 352);
|
|
bg_.SetViewId("imgReturn_cardView");
|
|
auto imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_BUSINESS_CARD_BJ, IMAGE_BIN_PATH);
|
|
if (imgInfo != nullptr) {
|
|
bg_.SetSrc(imgInfo);
|
|
}
|
|
bg_.SetTouchable(true);
|
|
bg_.SetOnClickListener(TjdUiAppBusinesscardPresenter::GetInstance());
|
|
// bg_.SetVisible(true);
|
|
Add(&desc_);
|
|
// Add(&descButtom_);
|
|
Add(&bg_);
|
|
}
|
|
|
|
BusinessCardCardView::~BusinessCardCardView(void)
|
|
{
|
|
g_BusinessCardCardView = nullptr;
|
|
RemoveAll();
|
|
}
|
|
|
|
void BusinessCardCardView::ShowView() { SetVisible(true); }
|
|
|
|
void BusinessCardCardView::HideView() { SetVisible(false); }
|
|
|
|
BusinessCardCardView *BusinessCardCardView::GetInstance(void) { return g_BusinessCardCardView; }
|
|
|
|
void BusinessCardListView::InitBusinesscardItemView(BusinessCardItemIndex index)
|
|
{
|
|
if (index < 0 || index >= BUSINESSCARD_MAX_INDEX) {
|
|
return;
|
|
}
|
|
|
|
OHOS::UILabel *tip_ = BusinessCardCardView::GetInstance()->GetTitle();
|
|
// clang-format off
|
|
switch (index) {
|
|
case BUSINESSCARD_WECHAT_INDEX:{
|
|
tip_->SetText("微信\n");
|
|
// qrcode_->SetQrcodeInfo("https://h5.sz-tjd.com/download/cn");
|
|
break;
|
|
}
|
|
case BUSINESSCARD_QQ_INDEX:{
|
|
tip_->SetText("QQ\n");
|
|
// qrcode_->SetQrcodeInfo("https://h5.sz-tjd.com/download/cn");
|
|
break;
|
|
}
|
|
case BUSINESSCARD_FACEBOOK_INDEX:{
|
|
tip_->SetText("Facebook\n");
|
|
break;
|
|
}
|
|
case BUSINESSCARD_WHATSAPP_INDEX:{
|
|
tip_->SetText("WhatsApp\n");
|
|
break;
|
|
}
|
|
case BUSINESSCARD_TWITTER_INDEX:{
|
|
tip_->SetText("Twitter\n");
|
|
break;
|
|
}
|
|
case BUSINESSCARD_INSTAGRAM_INDEX:{
|
|
tip_->SetText("Instagram\n");
|
|
break;
|
|
}
|
|
case BUSINESSCARD_LINE_INDEX:{
|
|
tip_->SetText("Line\n");
|
|
break;
|
|
}
|
|
default: break;
|
|
}
|
|
// clang-format on
|
|
BusinessCardCardView::GetInstance()->Invalidate();
|
|
}
|
|
|
|
} // namespace TJD
|