Skip to content

Commit 8dd042f

Browse files
author
sundyzlh
committed
1 parent 87bdfa6 commit 8dd042f

File tree

12 files changed

+223
-67
lines changed

12 files changed

+223
-67
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
34
<classpathentry kind="src" path="src"/>
45
<classpathentry kind="src" path="gen"/>
5-
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
66
<classpathentry kind="output" path="bin"/>
77
</classpath>
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
#Thu Apr 14 17:43:50 KST 2011
1+
#Mon Apr 18 19:20:14 KST 2011
22
eclipse.preferences.version=1
3+
encoding//src/sundy/android/demo/LauncherActivity.java=UTF-8
4+
encoding//src/sundy/android/demo/SundyAndroidDemoApplication.java=UTF-8
35
encoding//src/sundy/android/demo/configration/CommonConstants.java=UTF-8
6+
encoding//src/sundy/android/demo/processthread/ProcessLifecycleActivity.java=UTF-8
Lines changed: 54 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,55 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="sundy.android.demo"
4-
android:versionCode="1"
5-
android:versionName="1.0">
6-
7-
<uses-permission android:name="android.permission.READ_CONTACTS" />
8-
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
9-
<uses-permission android:name="android.permission.CAMERA" />
10-
<uses-permission android:name="android.permission.VIBRATE" />
11-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
12-
<uses-permission android:name="android.permission.INTERNET" />
13-
14-
<application android:icon="@drawable/icon" android:label="@string/app_name">
15-
<activity android:name=".LauncherActivity"
16-
android:label="@string/app_name">
17-
<intent-filter>
18-
<action android:name="android.intent.action.MAIN" />
19-
<category android:name="android.intent.category.DEFAULT" />
20-
<category android:name="android.intent.category.LAUNCHER" />
21-
</intent-filter>
22-
</activity>
23-
<activity android:name=".log.LogActivity" android:label="@string/subject_log">
24-
<intent-filter>
25-
<action android:name="android.intent.action.MAIN" />
26-
<category android:name="android.intent.category.SAMPLE_CODE" />
27-
</intent-filter>
28-
</activity>
29-
<activity android:name=".processthread.ProcessLifecycleActivity" android:label="@string/subject_process_lifecycle">
30-
<intent-filter>
31-
<action android:name="android.intent.action.MAIN" />
32-
<category android:name="android.intent.category.SAMPLE_CODE" />
33-
</intent-filter>
34-
</activity>
35-
</application>
36-
<uses-sdk android:minSdkVersion="3" />
37-
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="sundy.android.demo"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
7+
<uses-permission android:name="android.permission.READ_CONTACTS" />
8+
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
9+
<uses-permission android:name="android.permission.CAMERA" />
10+
<uses-permission android:name="android.permission.VIBRATE" />
11+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
12+
<uses-permission android:name="android.permission.INTERNET" />
13+
14+
<application android:icon="@drawable/icon" android:label="@string/app_name">
15+
<activity android:name=".LauncherActivity"
16+
android:label="@string/app_name">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
<category android:name="android.intent.category.DEFAULT" />
20+
<category android:name="android.intent.category.LAUNCHER" />
21+
</intent-filter>
22+
</activity>
23+
<activity android:name=".log.LogActivity" android:label="@string/subject_log">
24+
<intent-filter>
25+
<action android:name="android.intent.action.MAIN" />
26+
<category android:name="android.intent.category.SAMPLE_CODE" />
27+
</intent-filter>
28+
</activity>
29+
<activity android:name=".processthread.ProcessLifecycleActivity" android:label="@string/subject_process_lifecycle">
30+
<intent-filter>
31+
<action android:name="android.intent.action.MAIN" />
32+
<category android:name="android.intent.category.SAMPLE_CODE" />
33+
</intent-filter>
34+
</activity>
35+
36+
<activity android:name=".processthread.ActivityWindowViewRelationship" android:label="@string/subject_process_activityrelation">
37+
<intent-filter>
38+
<action android:name="android.intent.action.MAIN" />
39+
<category android:name="android.intent.category.SAMPLE_CODE" />
40+
</intent-filter>
41+
</activity>
42+
43+
<activity android:name=".activity.MainTestActivity" android:label="@string/process_activitymaintest">
44+
<intent-filter>
45+
<action android:name="android.intent.action.MAIN" />
46+
<category android:name="android.intent.category.SAMPLE_CODE" />
47+
</intent-filter>
48+
</activity>
49+
50+
<service android:name=".service.LauncherService">
51+
</service>
52+
</application>
53+
<uses-sdk android:minSdkVersion="3" />
54+
<uses-configuration android:reqTouchScreen="notouch" />
3855
</manifest>

sundyandroid/Demos/SundyAndroidDemo/gen/sundy/android/demo/R.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,21 @@ public static final class attr {
1313
public static final class drawable {
1414
public static final int icon=0x7f020000;
1515
}
16+
public static final class id {
17+
public static final int editTextState=0x7f050000;
18+
public static final int text1=0x7f050001;
19+
}
1620
public static final class layout {
17-
public static final int main=0x7f030000;
21+
public static final int layout_activitysavestate=0x7f030000;
22+
public static final int layout_inflater=0x7f030001;
23+
public static final int main=0x7f030002;
1824
}
1925
public static final class string {
2026
public static final int app_name=0x7f040001;
2127
public static final int hello=0x7f040000;
28+
public static final int process_activitymaintest=0x7f040005;
2229
public static final int subject_log=0x7f040002;
30+
public static final int subject_process_activityrelation=0x7f040004;
2331
public static final int subject_process_lifecycle=0x7f040003;
2432
}
2533
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:layout_width="wrap_content"
5+
android:layout_height="wrap_content">
6+
<EditText android:text="" android:id="@+id/editTextState" android:layout_width="wrap_content" android:layout_height="wrap_content"></EditText>
7+
</LinearLayout>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:layout_width="wrap_content"
5+
android:layout_height="wrap_content">
6+
<TextView android:id="@+id/text1" android:layout_width="fill_parent"
7+
android:layout_height="wrap_content" android:text="Activity load view by layout inflater"/>
8+
</LinearLayout>

sundyandroid/Demos/SundyAndroidDemo/res/values/strings.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<resources>
33
<string name="hello">Hello World, LauncherActivity!</string>
44
<string name="app_name">SundyAndroidDemo</string>
5-
<string name="subject_log">应用框架/其它/C11041401AAF_玩懂Log</string>
6-
<string name="subject_process_lifecycle">应用框架/进程和线程/C11041701AAF_进程生命周期</string>
5+
<string name="subject_log">应用框架/其它/玩懂Log</string>
6+
<string name="subject_process_lifecycle">应用框架/进程和线程/进程生命周期</string>
7+
<string name="subject_process_activityrelation">应用框架/Activity/Activity,Window,View的关系</string>
8+
<string name="process_activitymaintest">应用框架/Activity/Activity介绍及生命周期</string>
79
</resources>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package sundy.android.demo.activity;
2+
3+
import sundy.android.demo.configration.CommonConstants;
4+
import android.R;
5+
import android.app.Activity;
6+
import android.os.Bundle;
7+
import android.util.Log;
8+
import android.widget.EditText;
9+
10+
public class MainTestActivity extends Activity{
11+
12+
private final String SAVE_INSTANCE_TAG = "MainTestActivity.Saveinstancetag" ;
13+
EditText editText = null ;
14+
15+
@Override
16+
protected void onSaveInstanceState(Bundle outState) {
17+
// TODO Auto-generated method stub
18+
if(outState !=null)
19+
{
20+
outState.putString(this.SAVE_INSTANCE_TAG, "hello Sundy") ;
21+
}
22+
Log.i(CommonConstants.LOGCAT_TAG_NAME,"onSaveInstanceState") ;
23+
super.onSaveInstanceState(outState);
24+
}
25+
26+
@Override
27+
protected void onCreate(Bundle savedInstanceState) {
28+
// TODO Auto-generated method stub
29+
super.onCreate(savedInstanceState);
30+
this.setContentView(sundy.android.demo.R.layout.layout_activitysavestate) ;
31+
Log.i(CommonConstants.LOGCAT_TAG_NAME,"onCreate") ;
32+
editText = (EditText)this.findViewById(sundy.android.demo.R.id.editTextState) ;
33+
if(editText !=null && savedInstanceState != null)
34+
{
35+
editText.setText(savedInstanceState.getString(this.SAVE_INSTANCE_TAG)) ;
36+
}
37+
if(savedInstanceState != null)
38+
{
39+
Log.i(CommonConstants.LOGCAT_TAG_NAME,"savedInstanceState = "+savedInstanceState.getString(SAVE_INSTANCE_TAG)) ;
40+
}
41+
}
42+
43+
44+
@Override
45+
protected void onPause() {
46+
// TODO Auto-generated method stub
47+
super.onPause();
48+
this.getPreferences(MODE_PRIVATE).edit().putString(SAVE_INSTANCE_TAG, editText.getText().toString()).commit() ;
49+
}
50+
51+
@Override
52+
protected void onResume() {
53+
// TODO Auto-generated method stub
54+
super.onResume();
55+
editText.setText(this.getPreferences(MODE_PRIVATE).getString(SAVE_INSTANCE_TAG, "")) ;
56+
Log.i(CommonConstants.LOGCAT_TAG_NAME,"onResume") ;
57+
}
58+
59+
60+
61+
@Override
62+
protected void onRestoreInstanceState(Bundle savedInstanceState) {
63+
// TODO Auto-generated method stub
64+
super.onRestoreInstanceState(savedInstanceState);
65+
Log.i(CommonConstants.LOGCAT_TAG_NAME,"onRestoreInstanceState") ;
66+
}
67+
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package sundy.android.demo.processthread;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
import android.view.LayoutInflater;
6+
import sundy.android.demo.*;
7+
8+
public class ActivityWindowViewRelationship extends Activity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
// TODO Auto-generated method stub
13+
super.onCreate(savedInstanceState);
14+
getWindow().setContentView(LayoutInflater.from(this).inflate(R.layout.layout_inflater, null)) ;
15+
}
16+
17+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package sundy.android.demo.processthread;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
import android.view.KeyEvent;
6+
7+
public class ProcessExitMethodActivity extends Activity {
8+
9+
@Override
10+
protected void onCreate(Bundle savedInstanceState) {
11+
// TODO Auto-generated method stub
12+
super.onCreate(savedInstanceState);
13+
}
14+
15+
@Override
16+
public boolean onKeyDown(int keyCode, KeyEvent event) {
17+
// TODO Auto-generated method stub
18+
return super.onKeyDown(keyCode, event);
19+
}
20+
21+
}

sundyandroid/Demos/SundyAndroidDemo/src/sundy/android/demo/processthread/ProcessLifecycleActivity.java

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
import android.app.Dialog;
1414
import android.content.DialogInterface;
1515
import android.os.Bundle;
16-
import android.os.Handler;
1716
import android.util.Log;
18-
import android.view.KeyEvent;
1917
import android.view.Menu;
2018
import android.view.MenuItem;
2119

@@ -41,17 +39,6 @@ private void initCurProcess()
4139
}
4240
}
4341

44-
@Override
45-
public boolean onKeyUp(int keyCode, KeyEvent event) {
46-
// TODO Auto-generated method stub
47-
if(keyCode == KeyEvent.KEYCODE_HOME)
48-
{
49-
Log.i(CommonConstants.LOGCAT_TAG_NAME, "convertImportance(curRunningProcessInfo.importance)") ;
50-
}
51-
52-
return super.onKeyUp(keyCode, event);
53-
}
54-
5542
/**
5643
* 转换进程当前Level显示方式,讲int转为String
5744
* @param imp
@@ -77,6 +64,8 @@ protected String convertImportance(int imp)
7764
case RunningAppProcessInfo.IMPORTANCE_EMPTY:
7865
returnStr = "IMPORTANCE_EMPTY" ;
7966
break ;
67+
default:
68+
break ;
8069

8170
}
8271
return returnStr ;
@@ -108,8 +97,7 @@ public void onClick(DialogInterface dialog, int id) {
10897
dialog.cancel();
10998
}
11099
});
111-
AlertDialog alert = builder.create();
112-
return alert ;
100+
//AlertDialog alert = builder.create();
113101
}
114102

115103
return super.onCreateDialog(id);
@@ -138,22 +126,14 @@ public boolean onOptionsItemSelected(MenuItem item) {
138126
protected void onPause() {
139127
// TODO Auto-generated method stub
140128
super.onPause();
141-
//Log.i(CommonConstants.LOGCAT_TAG_NAME, convertImportance(curRunningProcessInfo.importance)) ;
129+
Log.i(CommonConstants.LOGCAT_TAG_NAME, convertImportance(curRunningProcessInfo.importance)) ;
142130
}
143131

144132
@Override
145133
protected void onStop() {
146134
// TODO Auto-generated method stub
147135
super.onStop();
148-
Handler handler = new Handler() ;
149-
handler.postDelayed(new Runnable(){
150-
151-
public void run() {
152-
// TODO Auto-generated method stub
153-
Log.i(CommonConstants.LOGCAT_TAG_NAME, convertImportance(RunningAppProcessInfo.IMPORTANCE_BACKGROUND)) ;
154-
}
155-
156-
}, 3000) ;
136+
Log.i(CommonConstants.LOGCAT_TAG_NAME, convertImportance(curRunningProcessInfo.importance)) ;
157137
}
158138

159139
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package sundy.android.demo.service;
2+
3+
import sundy.android.demo.configration.CommonConstants;
4+
import android.app.Service;
5+
import android.content.Intent;
6+
import android.os.IBinder;
7+
import android.util.Log;
8+
9+
public class LauncherService extends Service {
10+
11+
@Override
12+
public IBinder onBind(Intent arg0) {
13+
// TODO Auto-generated method stub
14+
Log.i(CommonConstants.LOGCAT_TAG_NAME,"onBind") ;
15+
return null;
16+
}
17+
18+
@Override
19+
public void onStart(Intent intent, int startId) {
20+
// TODO Auto-generated method stub
21+
super.onStart(intent, startId);
22+
Log.i(CommonConstants.LOGCAT_TAG_NAME,"onStart") ;
23+
}
24+
25+
}

0 commit comments

Comments
 (0)