Skip to content

Commit

Permalink
Added switching wallpaper.
Browse files Browse the repository at this point in the history
  • Loading branch information
learnopengles committed Jul 14, 2012
1 parent 562cfd8 commit 7ce73ce
Show file tree
Hide file tree
Showing 13 changed files with 1,301 additions and 5 deletions.
19 changes: 19 additions & 0 deletions android/AndroidOpenGLESLessons/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,25 @@
android:name="android.service.wallpaper"
android:resource="@xml/wallpaper" />
</service>
<service
android:name=".switchinglivewallpaper.LessonThreeWallpaperService"
android:label="@string/lesson_three_wallpaper_3"
android:permission="android.permission.BIND_WALLPAPER" >
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>

<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/switching_wallpaper" />
</service>
<activity
android:name=".switchinglivewallpaper.WallpaperSettings"
android:exported="true"
android:label="@string/lesson_three_wallpaper_3"
android:permission="android.permission.BIND_WALLPAPER"
android:theme="@style/WallpaperSettingsLight" >
</activity>
</application>

</manifest>
2 changes: 1 addition & 1 deletion android/AndroidOpenGLESLessons/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
# project structure.

# Project target.
target=android-8
target=android-16
26 changes: 26 additions & 0 deletions android/AndroidOpenGLESLessons/res/values-v11/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<!--
Theme for a wallpaper's setting activity that is designed to be on
top of a dark background.
-->
<style name="WallpaperSettings" parent="@android:style/Theme.Holo">
<item name="android:windowBackground">@android:drawable/screen_background_dark_transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>

<!--
Theme for a wallpaper's setting activity that is designed to be on
top of a light background.
-->
<style name="WallpaperSettingsLight" parent="@android:style/Theme.Holo.Light">
<item name="android:windowBackground">@android:drawable/screen_background_light_transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>

</resources>
Expand Down
26 changes: 26 additions & 0 deletions android/AndroidOpenGLESLessons/res/values-v14/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<!--
Theme for a wallpaper's setting activity that is designed to be on
top of a dark background.
-->
<style name="WallpaperSettings" parent="@android:style/Theme.Holo">
<item name="android:windowBackground">@android:drawable/screen_background_dark_transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>

<!--
Theme for a wallpaper's setting activity that is designed to be on
top of a light background.
-->
<style name="WallpaperSettingsLight" parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:windowBackground">@android:drawable/screen_background_light_transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>

</resources>
Expand Down
5 changes: 3 additions & 2 deletions android/AndroidOpenGLESLessons/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<string name="lesson_two_subtitle">Learn about ambient and diffuse lighting in this lesson.</string>
<string name="lesson_three">Lesson Three: Adding Per-Pixel Lighting</string>
<string name="lesson_three_subtitle">This builds on lesson two by adding per-pixel lighting.</string>
<string name="lesson_three_wallpaper_1">Lesson 3: GLSurfaceView</string>
<string name="lesson_three_wallpaper_2">Lesson 3: Re-implementation of GLSurfaceView</string>
<string name="lesson_three_wallpaper_1">Using GLSurfaceView</string>
<string name="lesson_three_wallpaper_2">Using re-implementation of GLSurfaceView</string>
<string name="lesson_three_wallpaper_3">Switching implementations</string>
<string name="lesson_four">Lesson Four: Basic Texturing</string>
<string name="lesson_four_subtitle">This builds on lesson three by adding basic texturing.</string>
<string name="lesson_five">Lesson Five: An Intro to Blending</string>
Expand Down
26 changes: 26 additions & 0 deletions android/AndroidOpenGLESLessons/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<!--
Theme for a wallpaper's setting activity that is designed to be on
top of a dark background.
-->
<style name="WallpaperSettings" parent="@android:style/Theme">
<item name="android:windowBackground">@android:drawable/screen_background_dark_transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>

<!--
Theme for a wallpaper's setting activity that is designed to be on
top of a light background.
-->
<style name="WallpaperSettingsLight" parent="@android:style/Theme.Light">
<item name="android:windowBackground">@android:drawable/screen_background_light_transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>

</resources>
Expand Down
7 changes: 7 additions & 0 deletions android/AndroidOpenGLESLessons/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:key="use_gl_surface_view"
android:title="Use GLSurfaceView"
android:defaultValue="true"/>
</PreferenceScreen>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.learnopengles.android.switchinglivewallpaper.WallpaperSettings"
android:thumbnail="@drawable/ic_lesson_three" />
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public void run() {
mLessonSevenActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(mLessonSevenActivity, "Out of memory; Dalvik takes a while to clean up the memory. Please try again.\nExternal bytes allocated=" + dalvik.system.VMRuntime.getRuntime().getExternalBytesAllocated(), Toast.LENGTH_LONG).show();
// Toast.makeText(mLessonSevenActivity, "Out of memory; Dalvik takes a while to clean up the memory. Please try again.\nExternal bytes allocated=" + dalvik.system.VMRuntime.getRuntime().getExternalBytesAllocated(), Toast.LENGTH_LONG).show();
}
});
}
Expand All @@ -385,7 +385,7 @@ public void run() {
mLessonSevenActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(mLessonSevenActivity, "Out of memory; Dalvik takes a while to clean up the memory. Please try again.\nExternal bytes allocated=" + dalvik.system.VMRuntime.getRuntime().getExternalBytesAllocated(), Toast.LENGTH_LONG).show();
// Toast.makeText(mLessonSevenActivity, "Out of memory; Dalvik takes a while to clean up the memory. Please try again.\nExternal bytes allocated=" + dalvik.system.VMRuntime.getRuntime().getExternalBytesAllocated(), Toast.LENGTH_LONG).show();
}
});
}
Expand Down
Loading

0 comments on commit 7ce73ce

Please sign in to comment.