package org.jorge.cmp.ui.activity; import android.content.Context; import android.os.Bundle; import android.support.v4.app.NavUtils; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import org.jorge.cmp.LoLin1Application; import org.jorge.cmp.R; import org.jorge.cmp.ui.fragment.SettingsPreferenceFragment; /* * This file is part of LoLin1. * * LoLin1 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. * * LoLin1 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 LoLin1. If not, see <http://www.gnu.org/licenses/>. * * Created by Jorge Antonio Diaz-Benito Soriano. */ public class SettingsActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); setSupportActionBar(toolbar); final Context context = LoLin1Application.getInstance().getContext(); final ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(Boolean.TRUE); actionBar.setTitle(context.getString(R.string .nav_drawer_aux_entry_settings)); getFragmentManager().beginTransaction().replace(R.id.settings_container, SettingsPreferenceFragment.instantiate(context, SettingsPreferenceFragment.class.getName())) .commitAllowingStateLoss(); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); overridePendingTransition(R.anim.move_in_from_bottom, R.anim.move_out_to_bottom); return Boolean.TRUE; } return super.onOptionsItemSelected(item); } @Override public void onBackPressed() { super.onBackPressed(); overridePendingTransition(R.anim.move_in_from_bottom, R.anim.move_out_to_bottom); } }