/* * The contents of this file are subject to the OpenMRS Public License * Version 1.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://license.openmrs.org * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * Copyright (C) OpenMRS, LLC. All Rights Reserved. */ package org.openmrs.mobile.activities.settings; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.view.Menu; import android.view.MenuItem; import org.openmrs.mobile.R; import org.openmrs.mobile.activities.ACBaseActivity; public class SettingsActivity extends ACBaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setDisplayHomeAsUpEnabled(true); } // Create fragment SettingsFragment settingsFragment = (SettingsFragment) getSupportFragmentManager().findFragmentById(R.id.settingsContentFrame); if (settingsFragment == null) { settingsFragment = SettingsFragment.newInstance(); } if (!settingsFragment.isActive()) { addFragmentToActivity(getSupportFragmentManager(), settingsFragment, R.id.settingsContentFrame); } // Create the presenter new SettingsPresenter(settingsFragment, mOpenMRSLogger); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); //Disable Settings Option in Menu MenuItem settingsItem = menu.findItem(R.id.actionSettings); settingsItem.setVisible(false); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: this.finish(); return true; default: return super.onOptionsItemSelected(item); } } }