All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.tidalwave.bluebill.mobile.android.taxonomy.factsheet.TaxonFactSheetAbstractActivity Maven / Gradle / Ivy

/***********************************************************************************************************************
 *
 * blueBill Mobile - open source birdwatching
 * ==========================================
 *
 * Copyright (C) 2009, 2010 by Tidalwave s.a.s. (http://www.tidalwave.it)
 * http://bluebill.tidalwave.it/mobile/
 *
 ***********************************************************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 ***********************************************************************************************************************
 *
 * $Id: TaxonFactSheetAbstractActivity.java,v 01c91f877854 2010/06/24 22:26:44 fabrizio $
 *
 **********************************************************************************************************************/
package it.tidalwave.bluebill.mobile.android.taxonomy.factsheet;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import it.tidalwave.util.NotFoundException;
import it.tidalwave.bluebill.taxonomy.Taxon;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import it.tidalwave.bluebill.mobile.android.R;
import it.tidalwave.bluebill.mobile.android.taxonomy.TaxonIntentHelper;
import it.tidalwave.bluebill.mobile.android.about.AboutActivity;
import it.tidalwave.bluebill.mobile.android.preferences.BlueBillPreferenceActivity;
import it.tidalwave.mobile.android.ui.AndroidCommonUITasks;
import it.tidalwave.mobile.ui.CommonUITasks;

/***********************************************************************************************************************
 *
 * @author  Fabrizio Giudici
 * @version $Id: $
 *
 **********************************************************************************************************************/
public abstract class TaxonFactSheetAbstractActivity extends Activity
  {
    @CheckForNull
    protected Taxon taxon;

    private final AndroidCommonUITasks androidUI = new AndroidCommonUITasks(this);

    /*******************************************************************************************************************
     *
     *
     ******************************************************************************************************************/
    @Nonnull
    public CommonUITasks getCommonUITasks()
      {
        return androidUI;
      }

    /*******************************************************************************************************************
     *
     *
     ******************************************************************************************************************/
    @Override
    public void onCreate (final @Nonnull Bundle savedInstanceState)
      {
        super.onCreate(savedInstanceState);

        try
          {
            taxon = TaxonIntentHelper.getTaxon(getIntent());
          }
        catch (NotFoundException e)
          {
          }
      }

    /*******************************************************************************************************************
     *
     *
     ******************************************************************************************************************/
    @Override
    public boolean onCreateOptionsMenu (final @Nonnull Menu menu)
      {
        getMenuInflater().inflate(R.menu.preferences_options_menu, menu);
        return true;
      }

    /*******************************************************************************************************************
     *
     *
     ******************************************************************************************************************/
    @Override
    public boolean onOptionsItemSelected (final @Nonnull MenuItem item)
      {
        switch (item.getItemId())
          {
            case R.id.preferences:
                startActivity(new Intent(getBaseContext(), BlueBillPreferenceActivity.class));
                return true;

            case R.id.about:
                startActivity(new Intent(getBaseContext(), AboutActivity.class));
                return true;

            default:
                return super.onOptionsItemSelected(item);
          }
      }
  }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy