2021-02-16 13:42:49 +01:00
|
|
|
package com.jens.automation2;
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
import android.app.TabActivity;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.widget.TabHost;
|
|
|
|
import android.widget.TabHost.TabSpec;
|
|
|
|
|
|
|
|
import com.jens.automation2.receivers.NfcReceiver;
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("NewApi")
|
|
|
|
public class ActivityMainTabLayout extends TabActivity
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState)
|
|
|
|
{
|
|
|
|
super.onCreate(savedInstanceState);
|
2021-07-08 17:57:33 +02:00
|
|
|
|
|
|
|
Settings.readFromPersistentStorage(ActivityMainTabLayout.this);
|
|
|
|
|
|
|
|
if(Settings.tabsPlacement == 1)
|
|
|
|
setContentView(R.layout.main_tab_layout_tabs_at_bottom);
|
|
|
|
else
|
|
|
|
setContentView(R.layout.main_tab_layout_tabs_at_top);
|
2021-02-16 13:42:49 +01:00
|
|
|
|
|
|
|
TabHost tabHost = getTabHost();
|
|
|
|
|
|
|
|
TabSpec specOverview = tabHost.newTabSpec("overview");
|
|
|
|
specOverview.setIndicator(getResources().getString(R.string.overview), getResources().getDrawable(R.drawable.icon_overview_tab));
|
|
|
|
Intent overviewIntent = new Intent(this, ActivityMainScreen.class);
|
|
|
|
specOverview.setContent(overviewIntent);
|
|
|
|
|
|
|
|
TabSpec specPoi = tabHost.newTabSpec("pois");
|
|
|
|
specPoi.setIndicator(getResources().getString(R.string.pois), getResources().getDrawable(R.drawable.map));
|
|
|
|
Intent mainPoiIntent = new Intent(this, ActivityMainPoi.class);
|
|
|
|
specPoi.setContent(mainPoiIntent);
|
|
|
|
|
|
|
|
TabSpec specRules = tabHost.newTabSpec("rules");
|
|
|
|
specRules.setIndicator(getResources().getString(R.string.rules), getResources().getDrawable(R.drawable.gear));
|
|
|
|
Intent mainRulesIntent = new Intent(this, ActivityMainRules.class);
|
|
|
|
specRules.setContent(mainRulesIntent);
|
|
|
|
|
|
|
|
TabSpec specProfiles = tabHost.newTabSpec("profiles");
|
|
|
|
specProfiles.setIndicator(getResources().getString(R.string.profiles), getResources().getDrawable(R.drawable.sound));
|
|
|
|
Intent mainProfilesIntent = new Intent(this, ActivityMainProfiles.class);
|
|
|
|
specProfiles.setContent(mainProfilesIntent);
|
|
|
|
|
|
|
|
tabHost.addTab(specOverview);
|
|
|
|
tabHost.addTab(specPoi);
|
|
|
|
tabHost.addTab(specRules);
|
|
|
|
tabHost.addTab(specProfiles);
|
|
|
|
|
|
|
|
tabHost.setCurrentTab(Settings.startScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onResume()
|
|
|
|
{
|
|
|
|
super.onResume();
|
|
|
|
// Miscellaneous.logEvent("i", "NFC", "ActivityMainTabLayout.onResume().", 5);
|
|
|
|
NfcReceiver.checkIntentForNFC(this, getIntent());
|
|
|
|
// NfcReceiver.checkIntentForNFC(this, new Intent(this.getApplicationContext(), this.getClass()));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onNewIntent(Intent intent)
|
|
|
|
{
|
|
|
|
// Miscellaneous.logEvent("i", "NFC", "ActivityMainTabLayout.onNewIntent().", 5);
|
|
|
|
// setIntent(intent);
|
|
|
|
NfcReceiver.checkIntentForNFC(this, intent);
|
|
|
|
}
|
2021-11-26 19:26:42 +01:00
|
|
|
}
|