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