1 package eu
.alefzero
.owncloud
.ui
.adapter
;
3 import android
.content
.Context
;
4 import android
.content
.Intent
;
5 import android
.view
.LayoutInflater
;
6 import android
.view
.View
;
7 import android
.view
.ViewGroup
;
8 import android
.widget
.BaseAdapter
;
9 import android
.widget
.ImageView
;
10 import android
.widget
.TextView
;
11 import eu
.alefzero
.owncloud
.R
;
12 import eu
.alefzero
.owncloud
.ui
.FileDisplayActivity
;
13 import eu
.alefzero
.owncloud
.ui
.Preferences
;
16 * Populates the landing screen icons.
20 public class LandingScreenAdapter
extends BaseAdapter
{
22 private Context mContext
;
24 private final Integer
[] mLandingScreenIcons
= { R
.drawable
.home
,
25 R
.drawable
.music
, R
.drawable
.contacts
,
27 android
.R
.drawable
.ic_menu_agenda
,
28 R
.drawable
.settings
};
30 private final Integer
[] mLandingScreenTexts
= { R
.string
.main_files
,
31 R
.string
.main_music
, R
.string
.main_contacts
,
32 R
.string
.main_calendar
, R
.string
.main_bookmarks
,
33 R
.string
.main_settings
};
35 public LandingScreenAdapter(Context context
) {
40 public int getCount() {
41 return mLandingScreenIcons
.length
;
46 * Returns the Intent associated with this object
47 * or null if the functionality is not yet implemented
49 public Object
getItem(int position
) {
50 Intent intent
= new Intent();
53 intent
.setClass(mContext
, FileDisplayActivity
.class);
56 intent
.setClass(mContext
, Preferences
.class);
65 public long getItemId(int position
) {
70 public View
getView(int position
, View convertView
, ViewGroup parent
) {
71 if (convertView
== null
) {
72 LayoutInflater inflator
= LayoutInflater
.from(mContext
);
73 convertView
= inflator
74 .inflate(R
.layout
.landing_page_item
, null
);
76 ImageView icon
= (ImageView
) convertView
77 .findViewById(R
.id
.gridImage
);
78 TextView iconText
= (TextView
) convertView
79 .findViewById(R
.id
.gridText
);
81 icon
.setImageResource(mLandingScreenIcons
[position
]);
82 iconText
.setText(mLandingScreenTexts
[position
]);