Search in sources :

Example 1 with MapWrapperFragment

use of com.omkarmoghe.pokemap.views.map.MapWrapperFragment in project Pokemap by omkarmoghe.

the class MainActivity method onCreate.

//region Lifecycle Methods
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    sharedPref = this.getSharedPreferences(getString(R.string.pref_file_key), Context.MODE_PRIVATE);
    themeId = sharedPref.getInt(getString(R.string.pref_theme_no_action_bar), R.style.AppTheme_NoActionBar);
    setTheme(themeId);
    setContentView(R.layout.activity_main);
    pref = new PokemapSharedPreferences(this);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    FragmentManager fragmentManager = getSupportFragmentManager();
    MapWrapperFragment mapWrapperFragment = (MapWrapperFragment) fragmentManager.findFragmentByTag(MAP_FRAGMENT_TAG);
    if (mapWrapperFragment == null) {
        mapWrapperFragment = MapWrapperFragment.newInstance();
    }
    fragmentManager.beginTransaction().replace(R.id.main_container, mapWrapperFragment, MAP_FRAGMENT_TAG).commit();
    if (pref.isServiceEnabled()) {
        startNotificationService();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) MapWrapperFragment(com.omkarmoghe.pokemap.views.map.MapWrapperFragment) PokemapSharedPreferences(com.omkarmoghe.pokemap.controllers.app_preferences.PokemapSharedPreferences) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

FragmentManager (android.support.v4.app.FragmentManager)1 Toolbar (android.support.v7.widget.Toolbar)1 PokemapSharedPreferences (com.omkarmoghe.pokemap.controllers.app_preferences.PokemapSharedPreferences)1 MapWrapperFragment (com.omkarmoghe.pokemap.views.map.MapWrapperFragment)1