1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 14 * limitations under the License. 15 */ 16 17 #include "bridge/declarative_frontend/jsview/models/loading_progress_model_impl.h" 18 19 #include "base/geometry/dimension.h" 20 #include "bridge/declarative_frontend/view_stack_processor.h" 21 #include "bridge/declarative_frontend/jsview/js_view_abstract.h" 22 23 namespace OHOS::Ace::Framework { Create()24void LoadingProgressModelImpl::Create() 25 { 26 RefPtr<LoadingProgressComponent> loadingProgressComponent = 27 AceType::MakeRefPtr<OHOS::Ace::LoadingProgressComponent>(); 28 ViewStackProcessor::GetInstance()->ClaimElementId(loadingProgressComponent); 29 ViewStackProcessor::GetInstance()->Push(loadingProgressComponent); 30 } 31 SetColor(const Color & value)32void LoadingProgressModelImpl::SetColor(const Color& value) 33 { 34 auto component = ViewStackProcessor::GetInstance()->GetMainComponent(); 35 auto loadingProgress = AceType::DynamicCast<LoadingProgressComponent>(component); 36 loadingProgress->SetProgressColor(value); 37 } 38 } // namespace OHOS::Ace::Framework 39