2 * Copyright (C) 2012 Andrew Neal Licensed under the Apache License, Version 2.0
3 * (the "License"); you may not use this file except in compliance with the
4 * License. You may obtain a copy of the License at
5 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
6 * or agreed to in writing, software distributed under the License is
7 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 * KIND, either express or implied. See the License for the specific language
9 * governing permissions and limitations under the License.
12 package com.andrew.apollo.ui.activities;
14 import android.app.ActionBar;
15 import android.os.Bundle;
16 import android.view.Menu;
17 import android.view.MenuItem;
19 import com.andrew.apollo.R;
20 import com.andrew.apollo.ui.fragments.ThemeFragment;
23 * A class the displays the {@link ThemeFragment}.
25 * @author Andrew Neal (andrewdneal@gmail.com)
27 public class ThemesActivity extends BaseActivity {
33 protected void onCreate(final Bundle savedInstanceState) {
34 super.onCreate(savedInstanceState);
36 // Set up the action bar
37 final ActionBar actionBar = getActionBar();
38 actionBar.setDisplayHomeAsUpEnabled(true);
39 actionBar.setTitle(getString(R.string.settings_theme_chooser_title));
41 // Transact the theme fragment
42 if (savedInstanceState == null) {
43 getSupportFragmentManager().beginTransaction()
44 .replace(R.id.activity_base_content, new ThemeFragment()).commit();
52 public boolean onPrepareOptionsMenu(final Menu menu) {
53 mResources.setShopIcon(menu);
54 return super.onPrepareOptionsMenu(menu);
61 public boolean onCreateOptionsMenu(final Menu menu) {
62 getMenuInflater().inflate(R.menu.theme_shop, menu);
63 return super.onCreateOptionsMenu(menu);
70 public boolean onOptionsItemSelected(final MenuItem item) {
71 switch (item.getItemId()) {
72 case android.R.id.home:
76 mResources.shopFor(this);
81 return super.onOptionsItemSelected(item);
88 public int setContentView() {
89 return R.layout.activity_base;