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 use case where device financing is not 26 * required any more. 27 */ 28 public final class DeviceFinancingProvisionNotRequiredViewModel extends 29 ProvisionInfoViewModel { 30 31 private static final int HEADER_DRAWABLE_ID = R.drawable.ic_check_circle_24px; 32 33 private static final int HEADER_TEXT_ID = R.string.device_paid; 34 35 private static final Integer[] DRAWABLE_IDS = new Integer[]{ 36 R.drawable.ic_block_24px, R.drawable.ic_lock_open_24px, 37 }; 38 39 private static final Integer[] TEXT_IDS = new Integer[]{ 40 R.string.device_removed_from_finance_program, R.string.restrictions_lifted, 41 }; 42 DeviceFinancingProvisionNotRequiredViewModel()43 DeviceFinancingProvisionNotRequiredViewModel() { 44 super(); 45 46 mHeaderDrawableIdLiveData.setValue(HEADER_DRAWABLE_ID); 47 mHeaderTextIdLiveData.setValue(HEADER_TEXT_ID); 48 49 List<ProvisionInfo> provisionInfoList = new ArrayList<>(); 50 for (int i = 0, size = DRAWABLE_IDS.length; i < size; ++i) { 51 provisionInfoList.add(new ProvisionInfo(DRAWABLE_IDS[i], TEXT_IDS[i])); 52 } 53 mProvisionInfoListLiveData.setValue(provisionInfoList); 54 } 55 } 56