• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.TextView;
22  
23  import com.android.settings.R;
24  
25  /**
26   * View holder for {@link BlobInfoListView}.
27   */
28  class BlobInfoViewHolder {
29      View rootView;
30      TextView blobLabel;
31      TextView blobId;
32      TextView blobExpiry;
33      TextView blobSize;
34  
createOrRecycle(LayoutInflater inflater, View convertView)35      static BlobInfoViewHolder createOrRecycle(LayoutInflater inflater, View convertView) {
36          if (convertView != null) {
37              return (BlobInfoViewHolder) convertView.getTag();
38          }
39          convertView = inflater.inflate(R.layout.blob_list_item_view, null);
40  
41          final BlobInfoViewHolder holder = new BlobInfoViewHolder();
42          holder.rootView = convertView;
43          holder.blobLabel = convertView.findViewById(R.id.blob_label);
44          holder.blobId = convertView.findViewById(R.id.blob_id);
45          holder.blobExpiry = convertView.findViewById(R.id.blob_expiry);
46          holder.blobSize = convertView.findViewById(R.id.blob_size);
47          convertView.setTag(holder);
48          return holder;
49      }
50  }
51