3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 package de.dhbwloe.campusapp.fragments;
17 import de.dhbwloe.campusapp.CampusAppFragment;
19 import android.os.Bundle;
20 import android.support.v4.app.Fragment;
21 import android.support.v4.app.FragmentTransaction;
22 import android.support.v7.widget.CardView;
23 import android.view.InflateException;
24 import android.view.LayoutInflater;
25 import android.view.View;
26 import android.view.ViewGroup;
27 import android.widget.ImageView;
29 import de.dhbwloe.campusapp.R;
30 import de.dhbwloe.campusapp.search.SearchIndices;
32 public class Dashboard extends CampusAppFragment {
33 private static View view;
34 /* implement this for search results ;) */
35 public static SearchIndices[] GetSearchIndices() {
36 return new SearchIndices[] {
37 new SearchIndices("Dashboard", true) {{
39 setTarget("#Dashboard");
40 setTitle(R.string.search_dashboard_title);
41 setDescription(R.string.search_dashboard_description);
42 addKeyWord(R.string.search_dashboard_keywords);
49 public void onCreate(Bundle savedInstanceState) {
50 super.onCreate(savedInstanceState);
54 public View onCreateView(LayoutInflater inflater, ViewGroup container,
55 Bundle savedInstanceState) {
57 ViewGroup parent = (ViewGroup) view.getParent();
59 parent.removeView(view);
63 view = inflater.inflate(R.layout.fragment_dashboard, container, false);
64 } catch (InflateException e) {
68 AppContext.setTitle(AppContext.getResString(R.string.dashboard_title));
70 String kursTag = AppContext.getDatabaseManager().getRuntimeCache("CourseName");
71 if(kursTag == null || kursTag.isEmpty()) {
72 CardView timetable = (CardView) view.findViewById(R.id.card_timetable);
73 timetable.setVisibility(View.GONE);
77 image = (ImageView)view.findViewById(R.id.timetable_image);
78 image.setOnClickListener(new View.OnClickListener() {
80 public void onClick(View v) {
81 AppContext.getNavigationManager().navigatePage("Vorlesungsplan");
85 image = (ImageView)view.findViewById(R.id.mensa_image);
86 image.setOnClickListener(new View.OnClickListener() {
88 public void onClick(View v) {
89 AppContext.getNavigationManager().navigatePage("Mensa");
93 image = (ImageView)view.findViewById(R.id.news_dhbw_image);
94 image.setOnClickListener(new View.OnClickListener() {
96 public void onClick(View v) {
97 AppContext.getNavigationManager().navigatePage("News");
101 image = (ImageView)view.findViewById(R.id.news_stuv_image);
102 image.setOnClickListener(new View.OnClickListener() {
104 public void onClick(View v) {
105 AppContext.getNavigationManager().navigatePage("News");