2297fc257965555494f5ddfdf98e328cd7a7005d
2 * ownCloud Android client application
5 * Copyright (C) 2015 ownCloud Inc.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2,
9 * as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 package com
.owncloud
.android
.ui
.adapter
;
23 import android
.content
.Context
;
24 import android
.view
.LayoutInflater
;
25 import android
.view
.View
;
26 import android
.view
.ViewGroup
;
27 import android
.widget
.ArrayAdapter
;
28 import android
.widget
.BaseAdapter
;
29 import android
.widget
.TextView
;
31 import com
.owncloud
.android
.R
;
32 import com
.owncloud
.android
.lib
.resources
.shares
.OCShare
;
33 import com
.owncloud
.android
.lib
.resources
.shares
.ShareType
;
36 import java
.util
.ArrayList
;
39 * Adapter to show a user/group in Share With List
41 public class ShareUserListAdapter
extends ArrayAdapter
{
43 private Context mContext
;
44 private ArrayList
<OCShare
> mShares
;
46 public ShareUserListAdapter(Context context
, int resource
, ArrayList
<OCShare
>shares
) {
47 super(context
, resource
);
53 public int getCount() {
54 return mShares
.size();
58 public Object
getItem(int position
) {
59 return mShares
.get(position
);
63 public long getItemId(int position
) {
68 public View
getView(int position
, View convertView
, ViewGroup parent
) {
69 LayoutInflater inflator
= (LayoutInflater
) mContext
70 .getSystemService(Context
.LAYOUT_INFLATER_SERVICE
);
71 // View rowView = inflater.inflate(R.layout.row_estacion, parent, false);
72 View view
= inflator
.inflate(R
.layout
.share_user_item
, parent
, false
);
74 if (mShares
!= null
&& mShares
.size() > position
) {
75 OCShare share
= mShares
.get(position
);
77 TextView userName
= (TextView
) view
.findViewById(R
.id
.userOrGroupName
);
78 String name
= share
.getSharedWithDisplayName();
79 if (share
.getShareType() == ShareType
.GROUP
){
80 name
= name
+ "(group)";
82 userName
.setText(name
);