/* * Copyright (C) 2013 The WLANAudit project contributors. * * 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. */ package es.glasspixel.wlanaudit.activities; import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import android.support.v4.app.NavUtils; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockPreferenceActivity; import com.actionbarsherlock.view.MenuItem; import com.readystatesoftware.systembartint.SystemBarTintManager; import es.glasspixel.wlanaudit.R; /** * PreferenceActivity is a built-in Activity for preferences management * <p/> * To retrieve the values stored by this activity in other activities use the * following snippet: * <p/> * SharedPreferences sharedPreferences = * PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); * <Preference Type> preferenceValue = sharedPreferences.get<Preference * Type>("<Preference SavedKey>",<default value>); */ public class WLANAuditPreferencesActivity extends SherlockPreferenceActivity { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); addPreferencesFromResource(R.xml.app_preferences); // create our manager instance after the content view is set SystemBarTintManager tintManager = new SystemBarTintManager(this); // enable status bar tint tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(R.color.wlanaudit_material); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // app icon in action bar clicked; go home NavUtils.navigateUpFromSameTask(this); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); return true; default: return super.onOptionsItemSelected(item); } } @Override public void onBackPressed() { finish(); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); } }