1 /* 2 * Copyright (C) 2020 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.settings.development.storage; 18 19 import android.view.LayoutInflater; 20 import android.view.View; 21 import android.widget.ImageView; 22 import android.widget.TextView; 23 24 import com.android.settings.R; 25 26 /** 27 * View holder for {@link LeaseInfoListView}. 28 */ 29 class LeaseInfoViewHolder { 30 View rootView; 31 ImageView appIcon; 32 TextView leasePackageName; 33 TextView leaseDescription; 34 TextView leaseExpiry; 35 createOrRecycle(LayoutInflater inflater, View convertView)36 static LeaseInfoViewHolder createOrRecycle(LayoutInflater inflater, View convertView) { 37 if (convertView != null) { 38 return (LeaseInfoViewHolder) convertView.getTag(); 39 } 40 convertView = inflater.inflate(R.layout.lease_list_item_view, null); 41 42 final LeaseInfoViewHolder holder = new LeaseInfoViewHolder(); 43 holder.rootView = convertView; 44 holder.appIcon = convertView.findViewById(R.id.app_icon); 45 holder.leasePackageName = convertView.findViewById(R.id.lease_package); 46 holder.leaseDescription = convertView.findViewById(R.id.lease_desc); 47 holder.leaseExpiry = convertView.findViewById(R.id.lease_expiry); 48 convertView.setTag(holder); 49 return holder; 50 } 51 } 52