Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding readme and updating file layouts

  • Loading branch information...
commit 8fe93ec1f044596f362a9df38fb280077671bb66 1 parent 46da518
@donnfelker authored
View
0  README.markdown
No changes.
View
43 res/layout/add.xml
@@ -1,24 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- >
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+
<TextView
- android:text="Color:"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="@android:style/TextAppearance.Medium"
- />
+ android:text="Color:"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="@android:style/TextAppearance.Medium"
+ />
+
<EditText
- android:id="@+id/color"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginLeft="4dip"
- android:width="160sp"
- android:inputType="text"
- android:imeActionId="1337"
- android:imeOptions="actionDone"
- android:hint="Red:#FF0000"
- />
+ android:id="@+id/color"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="4dip"
+ android:width="160sp"
+ android:inputType="text"
+ android:imeActionId="1337"
+ android:imeOptions="actionDone"
+ android:hint="Red:#FF0000"
+ />
+
</LinearLayout>
View
14 res/layout/main.xml
@@ -2,20 +2,22 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
+ android:layout_height="fill_parent">
- <fragment class="com.agilevent.colorssample.ColorsFragment"
+ <fragment
+ class="com.agilevent.colorssample.ColorsFragment"
android:id="@+id/colors"
android:layout_weight="30"
android:layout_width="0px"
android:layout_height="fill_parent"
- />
- <fragment class="com.agilevent.colorssample.ColorDetailFragment"
+ />
+
+ <fragment
+ class="com.agilevent.colorssample.ColorDetailFragment"
android:id="@+id/details"
android:layout_weight="70"
android:layout_width="0px"
android:layout_height="fill_parent"
- />
+ />
</LinearLayout>
View
22 res/menu/color_menu.xml
@@ -1,15 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/add"
+
+ <item
+ android:id="@+id/add"
android:title="Add"
android:icon="@drawable/ic_menu_add"
android:actionLayout="@layout/add"
- android:showAsAction="ifRoom"/>
- <item android:id="@+id/reset"
+ android:showAsAction="ifRoom"
+ />
+
+ <item
+ android:id="@+id/reset"
android:title="Reset"
android:icon="@drawable/ic_menu_refresh"
- android:showAsAction="ifRoom|withText"/>
- <item android:id="@+id/about"
+ android:showAsAction="ifRoom|withText"
+ />
+
+ <item
+ android:id="@+id/about"
android:title="About"
- android:icon="@drawable/ic_menu_info_details" />
+ android:icon="@drawable/ic_menu_info_details"
+ />
+
</menu>
View
11 src/com/agilevent/colorssample/ColorsActivity.java
@@ -32,6 +32,8 @@ public void onCreate(Bundle savedInstanceState) {
// 3. Set the listener of the ColorFragment to that of the ColorFragment
cf = (ColorsFragment)getFragmentManager().findFragmentById(R.id.colors);
cdf = (ColorDetailFragment)getFragmentManager().findFragmentById(R.id.details);
+
+ // Let the ColorsFragment know who to notify when the color changes.
cf.setColorChangedListener(cdf);
}
@@ -40,10 +42,8 @@ public void onCreate(Bundle savedInstanceState) {
public boolean onCreateOptionsMenu(Menu menu) {
new MenuInflater(this).inflate(R.menu.color_menu, menu);
- EditText add=(EditText)menu
- .findItem(R.id.add)
- .getActionView()
- .findViewById(R.id.color);
+ EditText add=(EditText)menu.findItem(R.id.add)
+ .getActionView().findViewById(R.id.color);
add.setOnEditorActionListener(onAdd);
@@ -83,8 +83,7 @@ private void addColor(String colorWithCode) {
private TextView.OnEditorActionListener onAdd=
new TextView.OnEditorActionListener() {
- public boolean onEditorAction(TextView v, int actionId,
- KeyEvent event) {
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (event==null || event.getAction()==KeyEvent.ACTION_UP) {
addColor(v.getText().toString());
Please sign in to comment.
Something went wrong with that request. Please try again.