
it.tidalwave.bluebill.mobile.android.taxonomy.factsheet.TaxonFactSheetActivity Maven / Gradle / Ivy
The newest version!
/***********************************************************************************************************************
*
* blueBill Mobile - Android - open source birding
* Copyright (C) 2009-2011 by Tidalwave s.a.s. (http://www.tidalwave.it)
*
***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************
*
* WWW: http://bluebill.tidalwave.it/mobile
* SCM: https://java.net/hg/bluebill-mobile~android-src
*
**********************************************************************************************************************/
package it.tidalwave.bluebill.mobile.android.taxonomy.factsheet;
import javax.annotation.Nonnull;
import it.tidalwave.util.NotFoundException;
import it.tidalwave.bluebill.taxonomy.mobile.Taxon;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import it.tidalwave.bluebill.mobile.android.R;
import it.tidalwave.bluebill.mobile.android.taxonomy.TaxonIntentHelper;
import it.tidalwave.bluebill.mobile.android.taxonomy.factsheet.commonnames.TaxonCommonNamesFactSheetActivity;
import it.tidalwave.bluebill.mobile.android.taxonomy.factsheet.main.TaxonMainFactSheetActivity;
import it.tidalwave.bluebill.mobile.android.taxonomy.factsheet.movingimage.TaxonMovingImageFactSheetActivity;
import it.tidalwave.bluebill.mobile.android.taxonomy.factsheet.sound.TaxonSoundFactSheetActivity;
import it.tidalwave.bluebill.mobile.android.taxonomy.factsheet.stillimage.TaxonStillImageFactSheetActivity;
import lombok.extern.slf4j.Slf4j;
import static org.openide.util.NbBundle.*;
/***********************************************************************************************************************
*
* @stereotype View
* @stereotype Activity
*
* @author Fabrizio Giudici
* @version $Id$
*
**********************************************************************************************************************/
@Slf4j
public class TaxonFactSheetActivity extends TabActivity
{
public static final Class TaxonFactSheetContainerActivity = TaxonFactSheetActivity.class;
private static final Class _ = TaxonFactSheetActivity.class;
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Override
public void onCreate (final @Nonnull Bundle savedInstanceState)
{
log.info("onCreate()");
super.onCreate(savedInstanceState);
setContentView(R.layout.view_taxon_fact_sheet);
try
{
final Taxon taxon = TaxonIntentHelper.getTaxon(getIntent());
createTab(taxon, TaxonMainFactSheetActivity.class, "facts", R.drawable.ic_tab_fact_sheet_main);
createTab(taxon, TaxonStillImageFactSheetActivity.class, "photo", R.drawable.ic_tab_fact_sheet_photo);
createTab(taxon, TaxonMovingImageFactSheetActivity.class, "video", R.drawable.ic_tab_fact_sheet_video);
createTab(taxon, TaxonSoundFactSheetActivity.class, "sound", R.drawable.ic_tab_fact_sheet_sound);
createTab(taxon, TaxonCommonNamesFactSheetActivity.class, "name", R.drawable.ic_tab_fact_sheet_name);
getTabHost().setCurrentTab(0);
}
catch (NotFoundException e)
{
throw new RuntimeException(e);
}
}
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
private void createTab (final @Nonnull Taxon taxon,
final @Nonnull Class extends Activity> activityClass,
final @Nonnull String id,
final int iconResourceId)
throws NotFoundException
{
final TabHost tabHost = getTabHost();
final Intent intent = TaxonIntentHelper.intentFor(taxon, activityClass);
final Resources resources = getResources();
final String indicator = getMessage(_, "tab_" + id);
tabHost.addTab(tabHost.newTabSpec(id)
.setIndicator(indicator, resources.getDrawable(iconResourceId))
.setContent(intent));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy