Skip to content

Commit a57abf0

Browse files
committed
lesson 4
1 parent fe7ebf6 commit a57abf0

File tree

37 files changed

+552
-0
lines changed

37 files changed

+552
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ AndroidTestingFun/Lesson2/bin
1010
AndroidTestingFun/Lesson2Test/bin
1111
AndroidTestingFun/Lesson3/bin
1212
AndroidTestingFun/Lesson3Test/bin
13+
AndroidTestingFun/Lesson4/bin
14+
AndroidTestingFun/Lesson4Test/bin
1315
AndroidTestingFun/Lesson5/bin
1416
AndroidTestingFun/Lesson5Test/bin
1517

AndroidTestingFun/Lesson4/.classpath

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
8+
<classpathentry kind="output" path="bin/classes"/>
9+
</classpath>

AndroidTestingFun/Lesson4/.project

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Lesson4</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.lesson4"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<uses-sdk
8+
android:minSdkVersion="14"
9+
android:targetSdkVersion="21" />
10+
11+
<application
12+
android:allowBackup="true"
13+
android:icon="@drawable/ic_launcher"
14+
android:label="@string/app_name"
15+
android:theme="@style/AppTheme" >
16+
<activity
17+
android:name=".LaunchActivity"
18+
android:label="@string/app_name" >
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
</activity>
25+
<activity
26+
android:name=".NextActivity"
27+
android:label="@string/next_activity"
28+
/>
29+
30+
</application>
31+
32+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** Automatically generated file. DO NOT MODIFY */
2+
package com.example.lesson4;
3+
4+
public final class BuildConfig {
5+
public final static boolean DEBUG = true;
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* AUTO-GENERATED FILE. DO NOT MODIFY.
2+
*
3+
* This class was automatically generated by the
4+
* aapt tool from the resource data it found. It
5+
* should not be modified by hand.
6+
*/
7+
8+
package com.example.lesson4;
9+
10+
public final class R {
11+
public static final class attr {
12+
}
13+
public static final class dimen {
14+
/** Default screen margins, per the Android Design guidelines.
15+
16+
Example customization of dimensions originally defined in res/values/dimens.xml
17+
(such as screen margins) for screens with more than 820dp of available width. This
18+
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
19+
20+
*/
21+
public static final int activity_horizontal_margin=0x7f040000;
22+
public static final int activity_vertical_margin=0x7f040001;
23+
}
24+
public static final class drawable {
25+
public static final int ic_launcher=0x7f020000;
26+
}
27+
public static final class id {
28+
public static final int action_settings=0x7f080002;
29+
public static final int launch_next_activity_button=0x7f080000;
30+
public static final int next_activity_info_text_view=0x7f080001;
31+
}
32+
public static final class layout {
33+
public static final int activity_launch_next=0x7f030000;
34+
public static final int activity_next=0x7f030001;
35+
}
36+
public static final class menu {
37+
public static final int launch=0x7f070000;
38+
}
39+
public static final class string {
40+
public static final int action_settings=0x7f050002;
41+
public static final int app_name=0x7f050000;
42+
public static final int hello_world=0x7f050001;
43+
public static final int label_launch_next=0x7f050003;
44+
public static final int next_activity=0x7f050004;
45+
}
46+
public static final class style {
47+
/**
48+
Base application theme, dependent on API level. This theme is replaced
49+
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
50+
51+
52+
Theme customizations available in newer API levels can go in
53+
res/values-vXX/styles.xml, while customizations related to
54+
backward-compatibility can go here.
55+
56+
57+
Base application theme for API 11+. This theme completely replaces
58+
AppBaseTheme from res/values/styles.xml on API 11+ devices.
59+
60+
API 11 theme customizations can go here.
61+
62+
Base application theme for API 14+. This theme completely replaces
63+
AppBaseTheme from BOTH res/values/styles.xml and
64+
res/values-v11/styles.xml on API 14+ devices.
65+
66+
API 14 theme customizations can go here.
67+
*/
68+
public static final int AppBaseTheme=0x7f060000;
69+
/** Application theme.
70+
All customizations that are NOT specific to a particular API-level can go here.
71+
*/
72+
public static final int AppTheme=0x7f060001;
73+
}
74+
}
50.2 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To enable ProGuard in your project, edit project.properties
2+
# to define the proguard.config property as described in that file.
3+
#
4+
# Add project specific ProGuard rules here.
5+
# By default, the flags in this file are appended to flags specified
6+
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7+
# You can edit the include path and order by changing the ProGuard
8+
# include property in project.properties.
9+
#
10+
# For more details, see
11+
# http://developer.android.com/guide/developing/tools/proguard.html
12+
13+
# Add any project specific keep options here:
14+
15+
# If your project uses WebView with JS, uncomment the following
16+
# and specify the fully qualified class name to the JavaScript interface
17+
# class:
18+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19+
# public *;
20+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=android-19
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:paddingBottom="@dimen/activity_vertical_margin"
6+
android:paddingLeft="@dimen/activity_horizontal_margin"
7+
android:paddingRight="@dimen/activity_horizontal_margin"
8+
android:paddingTop="@dimen/activity_vertical_margin"
9+
tools:context="com.example.lesson4.LaunchActivity" >
10+
11+
<Button
12+
android:id="@+id/launch_next_activity_button"
13+
android:layout_height="wrap_content"
14+
android:layout_width="match_parent"
15+
android:text="@string/label_launch_next"
16+
/>
17+
18+
</RelativeLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:orientation="vertical" >
6+
7+
<TextView
8+
android:id="@+id/next_activity_info_text_view"
9+
android:layout_width="match_parent"
10+
android:layout_height="wrap_content"
11+
/>
12+
13+
14+
</LinearLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
tools:context="com.example.lesson4.LaunchActivity" >
4+
5+
<item
6+
android:id="@+id/action_settings"
7+
android:orderInCategory="100"
8+
android:showAsAction="never"
9+
android:title="@string/action_settings"/>
10+
11+
</menu>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme for API 11+. This theme completely replaces
5+
AppBaseTheme from res/values/styles.xml on API 11+ devices.
6+
-->
7+
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
8+
<!-- API 11 theme customizations can go here. -->
9+
</style>
10+
11+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme for API 14+. This theme completely replaces
5+
AppBaseTheme from BOTH res/values/styles.xml and
6+
res/values-v11/styles.xml on API 14+ devices.
7+
-->
8+
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
9+
<!-- API 14 theme customizations can go here. -->
10+
</style>
11+
12+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<resources>
2+
3+
<!--
4+
Example customization of dimensions originally defined in res/values/dimens.xml
5+
(such as screen margins) for screens with more than 820dp of available width. This
6+
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
7+
-->
8+
<dimen name="activity_horizontal_margin">64dp</dimen>
9+
10+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<resources>
2+
3+
<!-- Default screen margins, per the Android Design guidelines. -->
4+
<dimen name="activity_horizontal_margin">16dp</dimen>
5+
<dimen name="activity_vertical_margin">16dp</dimen>
6+
7+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<string name="app_name">Lesson4</string>
5+
<string name="hello_world">Hello world!</string>
6+
<string name="action_settings">Settings</string>
7+
<string name="label_launch_next">Launch Next</string>
8+
<string name="next_activity">Next Activity</string>
9+
10+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme, dependent on API level. This theme is replaced
5+
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
6+
-->
7+
<style name="AppBaseTheme" parent="android:Theme.Light">
8+
<!--
9+
Theme customizations available in newer API levels can go in
10+
res/values-vXX/styles.xml, while customizations related to
11+
backward-compatibility can go here.
12+
-->
13+
</style>
14+
15+
<!-- Application theme. -->
16+
<style name="AppTheme" parent="AppBaseTheme">
17+
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
18+
</style>
19+
20+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.example.lesson4;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
import android.view.Menu;
6+
import android.view.MenuItem;
7+
import android.view.View;
8+
import android.widget.Button;
9+
10+
public class LaunchActivity extends Activity {
11+
12+
public final static String STRING_PAYLOAD = "Started from LaunchActivity";
13+
14+
@Override
15+
protected void onCreate(Bundle savedInstanceState) {
16+
super.onCreate(savedInstanceState);
17+
setContentView(R.layout.activity_launch_next);
18+
Button launchNextButton = (Button)findViewById(R.id.launch_next_activity_button);
19+
launchNextButton.setOnClickListener(new View.OnClickListener() {
20+
21+
@Override
22+
public void onClick(View v) {
23+
// TODO Auto-generated method stub
24+
startActivity(NextActivity.makeIntent(LaunchActivity.this,STRING_PAYLOAD));
25+
finish();
26+
}
27+
});
28+
}
29+
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.example.lesson4;
2+
3+
import android.app.Activity;
4+
import android.content.Context;
5+
import android.content.Intent;
6+
import android.os.Bundle;
7+
import android.widget.TextView;
8+
9+
public class NextActivity extends Activity{
10+
11+
public final static String EXTRA_PAYLOAD_KEY
12+
= "com.example.lesson4.EXTRA_PAYLOAD_KEY";
13+
14+
public static Intent makeIntent(Context context, String payload){
15+
return new Intent(context, NextActivity.class).putExtra(EXTRA_PAYLOAD_KEY, payload);
16+
}
17+
18+
protected void onCreate(Bundle savedInstanceState){
19+
super.onCreate(savedInstanceState);
20+
setContentView(R.layout.activity_next);
21+
22+
final String stringPayload = getIntent().getStringExtra(EXTRA_PAYLOAD_KEY);
23+
if (stringPayload != null){
24+
((TextView)findViewById(R.id.next_activity_info_text_view)).setText(stringPayload);
25+
}
26+
}
27+
28+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry combineaccessrules="false" kind="src" path="/Lesson4"/>
6+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
7+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
8+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
9+
<classpathentry kind="output" path="bin/classes"/>
10+
</classpath>

0 commit comments

Comments
 (0)