blob: a0ed871a40d2154d21a017015b7ee15c957ed8ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.libreoffice;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
public class DocumentPartViewListAdapter extends ArrayAdapter<DocumentPartView> {
private final Activity activity;
private final ThumbnailCreator thumbnailCollector;
public DocumentPartViewListAdapter(Activity activity, int resource, List<DocumentPartView> objects) {
super(activity, resource, objects);
this.activity = activity;
this.thumbnailCollector = new ThumbnailCreator();
}
@Override
public View getView(int position, View view, ViewGroup parent) {
if (view == null) {
LayoutInflater layoutInflater = activity.getLayoutInflater();
view = layoutInflater.inflate(R.layout.document_part_list_layout, null);
}
DocumentPartView documentPartView = getItem(position);
TextView textView = view.findViewById(R.id.text);
textView.setText(documentPartView.partName);
ImageView imageView = view.findViewById(R.id.image);
thumbnailCollector.createThumbnail(position, imageView);
return view;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|