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 android.os.Bundle;
18 import android.support.v4.app.Fragment;
19 import android.view.LayoutInflater;
20 import android.view.View;
21 import android.view.ViewGroup;
22 import android.widget.Button;
23 import android.widget.EditText;
25 import de.dhbwloe.campusapp.CampusAppFragment;
26 import de.dhbwloe.campusapp.R;
29 * A simple {@link Fragment} subclass.
31 public class FirstRun extends CampusAppFragment {
35 public View onCreateView(LayoutInflater inflater, ViewGroup container,
36 Bundle savedInstanceState) {
37 view = inflater.inflate(R.layout.fragment_first_run, container, false);
38 AppContext.setTitle("Campus App");
39 final FirstRun that = this;
41 Button startAppBtn = (Button)view.findViewById(R.id.startAppBtn);
42 startAppBtn.setOnClickListener(new View.OnClickListener() {
44 public void onClick(View v) {
49 Button courseSendBtn = (Button)view.findViewById(R.id.courseSubmitBtn);
50 courseSendBtn.setOnClickListener(new View.OnClickListener() {
52 public void onClick(View v) {
61 private void startApp() {
62 AppContext.getDatabaseManager().setRuntimeCache("AppStartCounter", "1");
63 AppContext.getNavigationManager().navigatePage("SplashScreen", null, false);
66 private boolean setCourse() {
67 EditText courseInput = (EditText)view.findViewById(R.id.courseInput);
68 String courseName = courseInput.getText().toString();
69 if(courseName.length() <= 3)
72 AppContext.getDatabaseManager().setRuntimeCache("CourseName", courseName);