Back to project page tazDownloader.
The source code is released under:
GNU General Public License
If you think the Android project tazDownloader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/******************************************************************************* * Copyright (c) 2012 Olaf Sebelin./* www . j av a 2s . c o m*/ * * 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 read.taz; import java.util.Calendar; import android.content.Intent; import android.os.Bundle; import android.text.method.LinkMovementMethod; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class TazReaderActivity extends AbstractTazReaderMainActivity implements OnClickListener { private Button downloadAndDisplayButton; private DatePicker tazDatePicker; private int count = 1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.d(TAG, "onCreate " + getClass().getSimpleName() + " " + (count++)); TextView appInfo = (TextView) findViewById(R.id.appInfo); appInfo.setMovementMethod(LinkMovementMethod.getInstance()); tazDatePicker = (DatePicker) findViewById(R.id.tazDatePicker); downloadAndDisplayButton = (Button) findViewById(R.id.button_downloadAndDisplay); downloadAndDisplayButton.setOnClickListener(this); } protected void startDownloadAndDisplay() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, tazDatePicker.getYear()); cal.set(Calendar.MONTH, tazDatePicker.getMonth()); cal.set(Calendar.DAY_OF_MONTH, tazDatePicker.getDayOfMonth()); startDownloadAndDisplay(adjust(cal)); } @Override public void onClick(View button) { if (button == downloadAndDisplayButton) { startDownloadAndDisplay(); } else { Log.e(TAG, "Unhandled button " + button); } } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { Log.e("TazReaderActivity", "onCreateContextMenu"); super.onCreateContextMenu(menu, v, menuInfo); } @Override public boolean onCreateOptionsMenu(Menu menu) { Log.e("TazReaderActivity", "onCreateOptionsMenu"); MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.options_menu, menu); return true; } public void onSettingsClicked(MenuItem settingsMenu) { startActivity(new Intent(this, SettingsActivity.class)); } }