Back to project page frc-notebook.
The source code is released under:
GNU General Public License
If you think the Android project frc-notebook listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.plnyyanks.frcnotebook.activities; /*from w ww. j a v a 2 s .c o m*/ import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.NavUtils; import android.view.Menu; import android.view.MenuItem; import android.widget.ListView; import com.plnyyanks.frcnotebook.R; import com.plnyyanks.frcnotebook.database.PreferenceHandler; import com.plnyyanks.frcnotebook.datafeed.EventListFetcher; /** * File created by phil on 3/1/14. * Copyright 2014, Phil Lopreiato * This file is part of FRC Notebook. * FRC Notebook 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. * FRC Notebook 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 FRC Notebook. If not, see http://www.gnu.org/licenses/. */ public class EventDownloadActivity extends Activity { SharedPreferences prefs; String currentYear; @Override protected void onCreate(Bundle savedInstanceState) { setTheme(PreferenceHandler.getTheme()); super.onCreate(savedInstanceState); setContentView(R.layout.activity_event_download); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .commit(); } if(prefs == null) prefs = PreferenceManager.getDefaultSharedPreferences(this); currentYear = prefs.getString("competition_season","2014"); getActionBar().setDisplayHomeAsUpEnabled(true); new EventListFetcher().execute(this); } @Override protected void onResume() { StartActivity.checkThemeChanged(EventDownloadActivity.class); super.onResume(); if(prefs == null) prefs = PreferenceManager.getDefaultSharedPreferences(this); if(!currentYear.equals(prefs.getString("competition_season","2014"))){ ListView eventList = (ListView) findViewById(R.id.event_list); currentYear = prefs.getString("competition_season","2014"); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.event_download, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); switch(id){ case R.id.action_settings: Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent); return true; case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } }