small optimization for ocfile
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / ui / adapter / LandingScreenAdapter.java
index e31c65f..914ed43 100644 (file)
@@ -26,6 +26,7 @@ import android.widget.BaseAdapter;
 import android.widget.ImageView;\r
 import android.widget.TextView;\r
 import eu.alefzero.owncloud.R;\r
+import eu.alefzero.owncloud.authenticator.AuthUtils;\r
 import eu.alefzero.owncloud.ui.activity.FileDisplayActivity;\r
 import eu.alefzero.owncloud.ui.activity.Preferences;\r
 \r
@@ -53,19 +54,27 @@ public class LandingScreenAdapter extends BaseAdapter {
                mContext = context;\r
        }\r
 \r
+       @Override\r
        public int getCount() {\r
                return mLandingScreenIcons.length;\r
        }\r
 \r
+       @Override\r
        /**\r
         * Returns the Intent associated with this object\r
         * or null if the functionality is not yet implemented\r
         */\r
        public Object getItem(int position) {\r
                Intent intent = new Intent();\r
+               \r
                switch (position) {\r
                case 0:\r
-                       intent.setClass(mContext, FileDisplayActivity.class);\r
+                       /* \r
+                        * The FileDisplayActivity requires the ownCloud account as an parcableExtra.\r
+                        * We will put in the one that is selected in the preferences\r
+                        */\r
+                       intent.setClass(mContext, FileDisplayActivity.class);   \r
+                       intent.putExtra("ACCOUNT", AuthUtils.getCurrentOwnCloudAccount(mContext));\r
                        break;\r
                case 5:\r
                        intent.setClass(mContext, Preferences.class);\r
@@ -76,10 +85,12 @@ public class LandingScreenAdapter extends BaseAdapter {
                return intent;\r
        }\r
 \r
+       @Override\r
        public long getItemId(int position) {\r
                return position;\r
        }\r
 \r
+       @Override\r
        public View getView(int position, View convertView, ViewGroup parent) {\r
                if (convertView == null) {\r
                        LayoutInflater inflator = LayoutInflater.from(mContext);\r
@@ -96,5 +107,4 @@ public class LandingScreenAdapter extends BaseAdapter {
                }\r
                return convertView;\r
        }\r
-\r
 }\r