List of usage examples for android.app ActionBar setDisplayHomeAsUpEnabled
public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);
From source file:com.vonglasow.michael.satstat.SettingsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); // Show the Up button in the action bar. ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // Display the fragment as the main content. getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit(); mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); // some logic to use the pre-1.7 setting KEY_PREF_UPDATE_WIFI as a // fallback if KEY_PREF_UPDATE_NETWORKS is not set if (!mSharedPreferences.contains(KEY_PREF_UPDATE_NETWORKS)) { Set<String> fallbackUpdateNetworks = new HashSet<String>(); if (mSharedPreferences.getBoolean(KEY_PREF_UPDATE_WIFI, false)) { fallbackUpdateNetworks.add(KEY_PREF_UPDATE_NETWORKS_WIFI); }/*w w w. j a v a 2 s.c om*/ SharedPreferences.Editor spEditor = mSharedPreferences.edit(); spEditor.putStringSet(KEY_PREF_UPDATE_NETWORKS, fallbackUpdateNetworks); spEditor.commit(); } // by default, show GPS and network location in map if (!mSharedPreferences.contains(KEY_PREF_LOC_PROV)) { Set<String> defaultLocProvs = new HashSet<String>( Arrays.asList(new String[] { LocationManager.GPS_PROVIDER, LocationManager.NETWORK_PROVIDER })); SharedPreferences.Editor spEditor = mSharedPreferences.edit(); spEditor.putStringSet(KEY_PREF_LOC_PROV, defaultLocProvs); spEditor.commit(); } }
From source file:org.mythtv.client.ui.AbstractMythtvFragmentActivity.java
protected void setupActionBar() { Log.v(TAG, "setupActionBar : enter"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(getResources().getString(R.string.app_name)); }/* ww w. java 2 s. co m*/ Log.v(TAG, "setupActionBar : exit"); }
From source file:cc.echonet.coolmicapp.AboutActivity.java
/** * Set up the {@link android.app.ActionBar}, if the API is available. *//*from w w w. j ava2 s . co m*/ private void setupActionBar() { ActionBar actionBar = getActionBar(); if (actionBar != null) { // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); } }
From source file:com.nks.nksmod.otaupdater.SettingsActivity.java
@Override @SuppressWarnings("deprecation") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ActionBar bar = getActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); }//from w ww .j a v a2 s.c o m cfg = Config.getInstance(getApplicationContext()); addPreferencesFromResource(R.xml.settings); notifPref = (CheckBoxPreference) findPreference("notif_pref"); notifPref.setChecked(cfg.getShowNotif()); wifidlPref = (CheckBoxPreference) findPreference("wifidl_pref"); wifidlPref.setChecked(cfg.getWifiOnlyDl()); autodlPref = (CheckBoxPreference) findPreference("autodl_pref"); autodlPref.setChecked(cfg.getAutoDlState()); }
From source file:fi.aalto.legroup.achso.browsing.DetailActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); UUID videoId = (UUID) getIntent().getSerializableExtra(ARG_VIDEO_ID); try {//from w w w.j ava 2 s. c om video = App.videoRepository.get(videoId); } catch (IOException e) { e.printStackTrace(); Toast.makeText(this, R.string.storage_error, Toast.LENGTH_LONG).show(); finish(); return; } setContentView(R.layout.activity_information); ActionBar bar = getActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); } SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.mapFragment); Location location = video.getLocation(); if (location != null) { LatLng position = new LatLng(location.getLatitude(), location.getLongitude()); GoogleMap map = mapFragment.getMap(); map.addCircle(new CircleOptions().center(position).radius(location.getAccuracy()).strokeWidth(3.0f) .strokeColor(Color.WHITE).fillColor(Color.parseColor("#80ffffff"))); map.addMarker(new MarkerOptions().position(position) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))); map.moveCamera(CameraUpdateFactory.newLatLngZoom(position, 14.5f)); findViewById(R.id.unknownLocationText).setVisibility(View.GONE); } }
From source file:fi.aalto.legroup.zop.browsing.DetailActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); UUID videoId = (UUID) getIntent().getSerializableExtra(ARG_VIDEO_ID); try {/*from w w w . j a va 2s . com*/ video = App.videoRepository.getVideo(videoId).inflate(); } catch (IOException e) { e.printStackTrace(); SnackbarManager.show(Snackbar.with(this).text(R.string.storage_error)); finish(); return; } setContentView(R.layout.activity_information); ActionBar bar = getActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); } SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.mapFragment); Location location = video.getLocation(); if (location != null) { LatLng position = new LatLng(location.getLatitude(), location.getLongitude()); GoogleMap map = mapFragment.getMap(); map.addCircle(new CircleOptions().center(position).radius(location.getAccuracy()).strokeWidth(3.0f) .strokeColor(Color.WHITE).fillColor(Color.parseColor("#80ffffff"))); map.addMarker(new MarkerOptions().position(position) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))); map.moveCamera(CameraUpdateFactory.newLatLngZoom(position, 14.5f)); findViewById(R.id.unknownLocationText).setVisibility(View.GONE); } }
From source file:org.ounl.lifelonglearninghub.nfcecology.db.CreateGoalActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_goal); Bundle extras = getIntent().getExtras(); if (extras != null) { sTagId = extras.getString(Tag.KEY_ID_TAG); sColor = extras.getString(TagColours.TAG_COLOR); }//from w w w . ja va 2s . c om etGoalName = (EditText) findViewById(R.id.etGoalName); etGoalDesc = (EditText) findViewById(R.id.etGoalDesc); etGoalDailyTime = (EditText) findViewById(R.id.etGoalTimeDaily); tvTagId = (TextView) findViewById(R.id.tvNFCTag); tvTagId.setText(sTagId); llBanner = (LinearLayout) findViewById(R.id.llBannerCreateGoal); llBanner.setBackgroundColor(Color.parseColor("#" + sColor)); setCurrentDateOnView(); // Enable home button final ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); }
From source file:app.hacked.ScheduleListItemDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_schedule_detail); final ActionBar actionBar = getActionBar(); actionBar.setSubtitle("This app is UNOFFICIAL use at your own risk"); actionBar.setDisplayHomeAsUpEnabled(true); // savedInstanceState is non-null when there is fragment state // saved from previous configurations of this activity // (e.g. when rotating the screen from portrait to landscape). // In this case, the fragment will automatically be re-added // to its container so we don't need to manually add it. // For more information, see the Fragments API guide at: ////from w w w. j av a 2 s . co m // http://developer.android.com/guide/components/fragments.html // if (savedInstanceState == null) { // Create the detail fragment and add it to the activity // using a fragment transaction. Bundle arguments = new Bundle(); arguments.putString(ScheduleItemDetailFragment.SCHEDULETITLE, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULETITLE)); arguments.putString(ScheduleItemDetailFragment.SCHEDULEID, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEID)); arguments.putString(ScheduleItemDetailFragment.SCHEDULEFULLDATAHTML, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEFULLDATAHTML)); arguments.putString(ScheduleItemDetailFragment.SCHEDULESTARTTIME, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULESTARTTIME)); arguments.putString(ScheduleItemDetailFragment.SCHEDULEDESC, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEDESC)); arguments.putBoolean(ScheduleItemDetailFragment.ISDAYTITLE, getIntent().getBooleanExtra(ScheduleItemDetailFragment.ISDAYTITLE, false)); arguments.putString(ScheduleItemDetailFragment.SCHEDULEENDTIME, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEENDTIME)); arguments.putBoolean(ScheduleItemDetailFragment.ARG_2PANE, getIntent().getBooleanExtra(ScheduleItemDetailFragment.ARG_2PANE, false)); ScheduleItemDetailFragment fragment = new ScheduleItemDetailFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction().replace(R.id.ScheduleDetails, fragment).commit(); } }
From source file:com.pdj.client.screen.ardoise.ArdoiseNavActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ardoise_nav); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // Set up the ViewPager, attaching the adapter. mViewPager = (ViewPager) findViewById(R.id.pager); if (restaurant == null) { restaurant = (RestaurantBO) this.getIntent().getSerializableExtra(RestosFragment.RESTO); }//from w w w. j av a2s . c om actionBar.setTitle(restaurant.getName()); final Restaurant resto = Restaurant.newRestaurantWithoutData(restaurant.getId()); ParseQuery<Ardoise> query = Ardoise.getFullQuery(resto, null, 20); query.findInBackground(new FindCallback<Ardoise>() { @Override public void done(List<Ardoise> ardoises, ParseException e) { if (e == null) { setArdoises(ardoises); if (ardoises.size() == 0) { msgZeroArdoise(); } else { mArdoiseNavPagerAdapter = new ArdoiseNavPagerAdapter(getSupportFragmentManager(), ardoises); mViewPager.setAdapter(mArdoiseNavPagerAdapter); } } else { showErrorTechnique(e); } } }); }
From source file:com.keithandthegirl.ui.activity.HomeActivity.java
@TargetApi(11) private void setupActionBar() { Log.v(TAG, "setupActionBar : enter"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); }//ww w. j a v a 2s. c o m Log.v(TAG, "setupActionBar : exit"); }