OC-1508: App crashes when changing the orientation
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / fragment / LandingPageFragment.java
1 /* ownCloud Android client application
2 * Copyright (C) 2011 Bartek Przybylski
3 * Copyright (C) 2012-2013 ownCloud Inc.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2,
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18 package com.owncloud.android.ui.fragment;
19
20 import com.actionbarsherlock.app.SherlockFragment;
21 import com.owncloud.android.ui.activity.LandingActivity;
22 import com.owncloud.android.ui.adapter.LandingScreenAdapter;
23
24 import android.os.Bundle;
25 import android.view.LayoutInflater;
26 import android.view.View;
27 import android.view.ViewGroup;
28 import android.widget.ListView;
29 import com.owncloud.android.R;
30
31 /**
32 * Used on the Landing page to display what Components of the ownCloud there
33 * are. Like Files, Music, Contacts, etc.
34 *
35 * @author Lennart Rosam
36 *
37 */
38 public class LandingPageFragment extends SherlockFragment {
39
40 @Override
41 public View onCreateView(LayoutInflater inflater, ViewGroup container,
42 Bundle savedInstanceState) {
43 View root = inflater.inflate(R.layout.landing_page_fragment, container);
44 return root;
45 }
46
47 @Override
48 public void onActivityCreated(Bundle savedInstanceState) {
49 super.onActivityCreated(savedInstanceState);
50
51 ListView landingScreenItems = (ListView) getView().findViewById(
52 R.id.homeScreenList);
53 landingScreenItems.setAdapter(new LandingScreenAdapter(getActivity()));
54 landingScreenItems
55 .setOnItemClickListener((LandingActivity) getActivity());
56 }
57
58 }