Skip to content

Commit

Permalink
Style ActionBar
Browse files Browse the repository at this point in the history
Add Menu items to ActionBar
Add Menu resources
Update Strings and Colors
Update App icon
  • Loading branch information
michaelcarrano committed Nov 28, 2013
1 parent 1b658b2 commit ab84ad8
Show file tree
Hide file tree
Showing 18 changed files with 83 additions and 18 deletions.
4 changes: 1 addition & 3 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions 7 Minutes/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.michaelcarrano.seven_min_workout"
android:versionCode="1"
android:versionName="1.0" >
android:versionName="1.0">

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.michaelcarrano.seven_min_workout.WorkoutListActivity"
android:label="@string/app_name" >
android:theme="@style/AppTheme">
<activity android:name="com.michaelcarrano.seven_min_workout.WorkoutListActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -26,13 +24,15 @@
</activity>
<activity
android:name="com.michaelcarrano.seven_min_workout.WorkoutDetailActivity"
android:label="@string/title_workout_detail"
android:parentActivityName=".WorkoutListActivity" >
android:parentActivityName=".WorkoutListActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".WorkoutListActivity" />
</activity>
<meta-data android:name="com.crashlytics.ApiKey" android:value="3fb5327e30111ad3ebb87c0769045f97c142cf2c"/>

<meta-data
android:name="com.crashlytics.ApiKey"
android:value="3fb5327e30111ad3ebb87c0769045f97c142cf2c" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;


/**
Expand Down Expand Up @@ -44,6 +47,8 @@ protected void onCreate(Bundle savedInstanceState) {

setContentView(R.layout.activity_workout_list);

getActionBar().setTitle(getString(R.string.app_label));

}

/**
Expand All @@ -57,4 +62,30 @@ public void onItemSelected(String id) {
detailIntent.putExtra(WorkoutDetailFragment.ARG_ITEM_ID, id);
startActivity(detailIntent);
}

/**
* Add menu items to ActionBar
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu
getMenuInflater().inflate(R.menu.main_menu, menu);
return true;
}

/**
* Handle menu item clicks
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_about_app:
Toast.makeText(this, getString(R.string.menu_about_app), Toast.LENGTH_LONG).show();
break;
case R.id.menu_start_workout:
Toast.makeText(this, getString(R.string.menu_start_workout), Toast.LENGTH_LONG).show();
break;
}
return true;
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.michaelcarrano.seven_min_workout;

import com.michaelcarrano.seven_min_workout.adapter.WorkoutListAdapter;
import com.michaelcarrano.seven_min_workout.data.WorkoutContent;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.michaelcarrano.seven_min_workout.adapter.WorkoutListAdapter;
import com.michaelcarrano.seven_min_workout.data.WorkoutContent;

/**
* A list fragment representing a list of Workouts. This fragment
* also supports tablet devices by allowing list items to be given an
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 7 Minutes/src/main/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 7 Minutes/src/main/res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 7 Minutes/src/main/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 7 Minutes/src/main/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions 7 Minutes/src/main/res/menu/main_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/menu_start_workout"
android:icon="@drawable/ic_action_play"
android:showAsAction="always"
android:title="@string/menu_start_workout" />

<item
android:id="@+id/menu_about_app"
android:icon="@drawable/ic_action_help"
android:showAsAction="always"
android:title="@string/menu_about_app" />

</menu>
4 changes: 4 additions & 0 deletions 7 Minutes/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<!-- ActionBar colors-->
<color name="actionbar_text">#FFFFFF</color>
<color name="actionbar_background">#F39C12</color>

<!-- Workout colors -->
<color name="jumping_jacks_dark">#16A085</color>
<color name="jumping_jacks_light">#1ABC9C</color>
Expand Down
8 changes: 6 additions & 2 deletions 7 Minutes/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">7 Minutes</string>
<string name="title_workout_detail">Workout Detail</string>
<string name="app_name">7 Minute Workout</string>
<string name="app_label">Minute Workout</string>

<!-- ActionBar menu -->
<string name="menu_start_workout">Start workout</string>
<string name="menu_about_app">About</string>

<!-- Workout names -->
<string name="jumping_jacks">Jumping jacks</string>
Expand Down
13 changes: 13 additions & 0 deletions 7 Minutes/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>


<!-- ActionBar styles -->
<style name="MyActionBar" parent="android:style/Widget.Holo.ActionBar">
<item name="android:background">@color/actionbar_background</item>
<item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
</style>

<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/actionbar_text</item>
</style>

</resources>

0 comments on commit ab84ad8

Please sign in to comment.