• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.devicelockcontroller.activities;
18 
19 import com.android.devicelockcontroller.R;
20 
21 import java.util.ArrayList;
22 import java.util.List;
23 
24 /**
25  * This class provides resources and data used for the deferred provisioning flow of the device
26  * subsidy use case.
27  */
28 public final class DeviceSubsidyDeferredProvisionInfoViewModel extends ProvisionInfoViewModel {
29 
30     private static final int HEADER_DRAWABLE_ID = R.drawable.ic_info_24px;
31 
32     private static final int HEADER_TEXT_ID = R.string.enroll_your_device_header;
33 
34     private static final int SUBHEADER_TEXT_ID = R.string.enroll_your_device_subsidy_subheader;
35 
36     private static final Integer[] DRAWABLE_IDS = new Integer[]{
37             R.drawable.ic_file_download_24px, R.drawable.ic_lock_outline_24px,
38     };
39 
40     private static final Integer[] TEXT_IDS = new Integer[]{
41             R.string.download_kiosk_app, R.string.restrict_device_if_dont_make_payment,
42     };
43 
DeviceSubsidyDeferredProvisionInfoViewModel()44     public DeviceSubsidyDeferredProvisionInfoViewModel() {
45         super();
46 
47         mHeaderDrawableIdLiveData.setValue(HEADER_DRAWABLE_ID);
48         mHeaderTextIdLiveData.setValue(HEADER_TEXT_ID);
49         mSubheaderTextIdLiveData.setValue(SUBHEADER_TEXT_ID);
50         List<ProvisionInfo> provisionInfoList = new ArrayList<>();
51         for (int i = 0, size = DRAWABLE_IDS.length; i < size; ++i) {
52             provisionInfoList.add(new ProvisionInfo(DRAWABLE_IDS[i], TEXT_IDS[i]));
53         }
54         mProvisionInfoListLiveData.setValue(provisionInfoList);
55     }
56 }
57