Finish adding Makefiles for the Notepad tutorial.

Add the missing makefiles for the non-solution versions of the tutorial
code.  Required providing missing imports in Notepadv2.  Also standardized
white spaces using Source > Correct Indentation in Eclipse and a few
manual changes.  This was done to minimize differences such as:

diff -r Notepadv1 Notepadv1Solution
diff -r Notepadv1Solution/src/com/android/demo/notepad1/ Notepadv2/src/com/android/demo/notepad2/

Change-Id: Ie8b10efd61f2200b3c741ea500a6924710ab54ed
This commit is contained in:
Tom O'Neill
2009-12-15 11:27:15 -08:00
parent 7a41627710
commit 77560fc704
25 changed files with 319 additions and 222 deletions

View File

@@ -0,0 +1,31 @@
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
LOCAL_MODULE_TAGS := optional
# Only compile source java files in this apk.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := Notepadv1
# Make the app build against the current SDK
LOCAL_SDK_VERSION := current
include $(BUILD_PACKAGE)

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.demo.notepad1">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.demo.notepad1">
<application android:icon="@drawable/icon">
<activity android:name=".Notepadv1" android:label="@string/app_name">
<intent-filter>

View File

@@ -17,6 +17,7 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
LOCAL_MODULE_TAGS := optional
# Only compile source java files in this apk.

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView android:id="@+id/text1"
xmlns:android="http://schemas.android.com/apk/res/android"
<TextView android:id="@+id/text1" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

View File

@@ -0,0 +1,31 @@
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
LOCAL_MODULE_TAGS := optional
# Only compile source java files in this apk.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := Notepadv2
# Make the app build against the current SDK
LOCAL_SDK_VERSION := current
include $(BUILD_PACKAGE)

View File

@@ -20,9 +20,11 @@ import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

View File

@@ -17,6 +17,7 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
LOCAL_MODULE_TAGS := optional
# Only compile source java files in this apk.

View File

@@ -7,6 +7,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".NoteEdit"></activity>
<activity android:name=".NoteEdit" />
</application>
</manifest>

View File

@@ -9,7 +9,7 @@
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.savedInstanceState
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@@ -70,7 +70,7 @@ public class Notepadv2 extends ListActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(0, INSERT_ID,0, R.string.menu_insert);
menu.add(0, INSERT_ID, 0, R.string.menu_insert);
return true;
}
@@ -81,6 +81,7 @@ public class Notepadv2 extends ListActivity {
createNote();
return true;
}
return super.onMenuItemSelected(featureId, item);
}

View File

@@ -0,0 +1,31 @@
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
LOCAL_MODULE_TAGS := optional
# Only compile source java files in this apk.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := Notepadv3
# Make the app build against the current SDK
LOCAL_SDK_VERSION := current
include $(BUILD_PACKAGE)

View File

@@ -7,6 +7,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".NoteEdit"/>
<activity android:name=".NoteEdit" />
</application>
</manifest>

View File

@@ -1,7 +1,7 @@
/*
* Copyright (C) 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")savedInstanceState;
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*

View File

@@ -17,6 +17,7 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
LOCAL_MODULE_TAGS := optional
# Only compile source java files in this apk.

View File

@@ -7,6 +7,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".NoteEdit"/>
<activity android:name=".NoteEdit" />
</application>
</manifest>

View File

@@ -42,7 +42,6 @@ public class NoteEdit extends Activity {
mBodyText = (EditText) findViewById(R.id.body);
Button confirmButton = (Button) findViewById(R.id.confirm);
mRowId = (savedInstanceState == null) ? null :
(Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID);
if (mRowId == null) {

View File

@@ -1,7 +1,7 @@
/*
* Copyright (C) 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")savedInstanceState;
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -116,8 +116,7 @@ public class Notepadv3 extends ListActivity {
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
fillData();
}