+/* CampusApp.java
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package de.dhbwloe.campusapp;
import android.content.Context;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_campus_app);
+ // Erstelle neuen AppContext, wenn keiner existiert
AppContext = CampusAppContext.getInstance();
if(AppContext == null)
AppContext = new CampusAppContext(this, R.id.fragment_container);
else
AppContext.setMainActivity(this);
+ // Wenn die App aus dem Ruhezustand (oder auch Orientation change) reaktiviert wird soll nicht zuerst der Splashscreen angezeigt werden.
boolean instantRestore = false;
if(savedInstanceState != null) {
long lastrun = savedInstanceState.getLong("lastrun");
if(lastrun < 30) {
instantRestore = true;
+ // restore previous Title
AppContext.setTitle(savedInstanceState.getString("activetitle"));
}
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
Log.i("CampusApp", "Event: onSaveInstanceState");
+
// Save instance state during "restarts" due to orientation changes.
// We don't want to see the splash screen everytime the orientation changes ;)
savedInstanceState.putLong("lastrun", (new Date()).getTime() / 1000);
// Always call the superclass so it can save the view hierarchy state
super.onSaveInstanceState(savedInstanceState);
-
- AppContext = null; // simulate GC
}
public void prepareMainUi() {
EditText edtSearchInput = (EditText) findViewById(R.id.search_input);
TextView txtTitle = (TextView) findViewById(R.id.title);
+ // EventListener für Suchfunktion
btnOpenSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {