• 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 device financing use case.
26  */
27 public class DeviceFinancingProvisionInfoViewModel extends ProvisionInfoViewModel {
28 
29     private static final int HEADER_DRAWABLE_ID = R.drawable.ic_info_24px;
30 
31     private static final int HEADER_TEXT_ID = R.string.device_provided_by_provider;
32 
33     private static final Integer[] DRAWABLE_IDS = new Integer[]{
34             R.drawable.ic_file_download_24px, R.drawable.ic_lock_outline_24px,
35     };
36 
37     private static final Integer[] TEXT_IDS = new Integer[]{
38             R.string.download_kiosk_app, R.string.restrict_device_if_missing_payment,
39     };
40 
DeviceFinancingProvisionInfoViewModel()41     public DeviceFinancingProvisionInfoViewModel() {
42         super();
43 
44         mHeaderDrawableIdLiveData.setValue(HEADER_DRAWABLE_ID);
45         mHeaderTextIdLiveData.setValue(HEADER_TEXT_ID);
46 
47         List<ProvisionInfo> provisionInfoList = new ArrayList<>();
48         for (int i = 0, size = DRAWABLE_IDS.length; i < size; ++i) {
49             provisionInfoList.add(new ProvisionInfo(DRAWABLE_IDS[i], TEXT_IDS[i]));
50         }
51         mProvisionInfoListLiveData.setValue(provisionInfoList);
52     }
53 }
54