summaryrefslogtreecommitdiffstats
path: root/framesequence/samples
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-01-06 12:43:42 -0800
committerChris Craik <ccraik@google.com>2014-01-13 17:56:03 +0000
commita3ac0a2df64dcfb8b0b01f1cf05e9afd1439e1f4 (patch)
treea46a47658126ecf2f3365eab0c944b80bead0dd3 /framesequence/samples
parent58ce8de3fbb0cfed369b6a38d0f5c92104745eb4 (diff)
downloadandroid_frameworks_ex-a3ac0a2df64dcfb8b0b01f1cf05e9afd1439e1f4.tar.gz
android_frameworks_ex-a3ac0a2df64dcfb8b0b01f1cf05e9afd1439e1f4.tar.bz2
android_frameworks_ex-a3ac0a2df64dcfb8b0b01f1cf05e9afd1439e1f4.zip
Import FrameSequence
Change-Id: I09b668925366a22e8e7e80e4abeae24b3a98c639 (cherry picked from commit a1265c3d8a20e805e0c45083d5c7d728d4b70009)
Diffstat (limited to 'framesequence/samples')
-rw-r--r--framesequence/samples/RastermillSamples/Android.mk40
-rw-r--r--framesequence/samples/RastermillSamples/AndroidManifest.xml26
-rw-r--r--framesequence/samples/RastermillSamples/build.xml99
-rw-r--r--framesequence/samples/RastermillSamples/proguard.flags3
-rw-r--r--framesequence/samples/RastermillSamples/project.properties14
-rw-r--r--framesequence/samples/RastermillSamples/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--framesequence/samples/RastermillSamples/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--framesequence/samples/RastermillSamples/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--framesequence/samples/RastermillSamples/res/layout/basic_test_activity.xml38
-rw-r--r--framesequence/samples/RastermillSamples/res/raw/animated.gifbin0 -> 34978 bytes
-rw-r--r--framesequence/samples/RastermillSamples/res/values/strings.xml12
-rw-r--r--framesequence/samples/RastermillSamples/res/values/styles.xml7
-rw-r--r--framesequence/samples/RastermillSamples/src/com/android/rastermill/samples/AnimatedGifTest.java66
-rw-r--r--framesequence/samples/RastermillSamples/src/com/android/rastermill/samples/SamplesList.java61
14 files changed, 366 insertions, 0 deletions
diff --git a/framesequence/samples/RastermillSamples/Android.mk b/framesequence/samples/RastermillSamples/Android.mk
new file mode 100644
index 0000000..bb8920f
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/Android.mk
@@ -0,0 +1,40 @@
+# Copyright (C) 2014 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)
+
+LOCAL_PACKAGE_NAME := FrameSequenceSample
+
+# java dependency
+LOCAL_STATIC_JAVA_LIBRARIES += android-common-framesequence
+
+# native dependency
+ifneq (,$(TARGET_BUILD_APPS))
+ LOCAL_JNI_SHARED_LIBRARIES := libframesequence
+else
+ LOCAL_REQUIRED_MODULES := libframesequence
+endif
+
+# proguard for framesequence library code
+LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+
+LOCAL_SDK_VERSION := 19
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, res)
+LOCAL_AAPT_FLAGS := --auto-add-overlay
+LOCAL_AAPT_FLAGS += --extra-packages com.android.rastermill.samples
+
+include $(BUILD_PACKAGE)
diff --git a/framesequence/samples/RastermillSamples/AndroidManifest.xml b/framesequence/samples/RastermillSamples/AndroidManifest.xml
new file mode 100644
index 0000000..b554021
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.rastermill.samples"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="15"
+ android:targetSdkVersion="18" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name" >
+ <activity
+ android:name=".SamplesList"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name=".AnimatedGifTest" />
+ </application>
+
+</manifest>
diff --git a/framesequence/samples/RastermillSamples/build.xml b/framesequence/samples/RastermillSamples/build.xml
new file mode 100644
index 0000000..5e55b4e
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/build.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="RastermillSamples" default="help">
+
+ <!-- The local.properties file is created and updated by the 'android' tool.
+ It contains the path to the SDK. It should *NOT* be checked into
+ Version Control Systems. -->
+ <property file="local.properties" />
+
+ <!-- The ant.properties file can be created by you. It is only edited by the
+ 'android' tool to add properties to it.
+ This is the place to change some Ant specific build properties.
+ Here are some properties you may want to change/update:
+
+ source.dir
+ The name of the source directory. Default is 'src'.
+ out.dir
+ The name of the output directory. Default is 'bin'.
+
+ For other overridable properties, look at the beginning of the rules
+ files in the SDK, at tools/ant/build.xml
+
+ Properties related to the SDK location or the project target should
+ be updated using the 'android' tool with the 'update' action.
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems.
+
+ -->
+ <property file="ant.properties" />
+
+ <!-- if sdk.dir was not set from one of the property file, then
+ get it from the ANDROID_HOME env var.
+ This must be done before we load project.properties since
+ the proguard config can use sdk.dir -->
+ <property environment="env" />
+ <condition property="sdk.dir" value="${env.ANDROID_HOME}">
+ <isset property="env.ANDROID_HOME" />
+ </condition>
+
+ <!-- The project.properties file is created and updated by the 'android'
+ tool, as well as ADT.
+
+ This contains project specific properties such as project target, and library
+ dependencies. Lower level build properties are stored in ant.properties
+ (or in .classpath for Eclipse projects).
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems. -->
+ <loadproperties srcFile="project.properties" />
+
+ <!-- quick check on sdk.dir -->
+ <fail
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
+ unless="sdk.dir"
+ />
+
+ <target name="-pre-build">
+ <ant dir="../../" target="release" inheritAll="false" />
+ <copy todir="libs">
+ <fileset dir="../../exported_libs" />
+ </copy>
+ </target>
+
+ <!--
+ Import per project custom build rules if present at the root of the project.
+ This is the place to put custom intermediary targets such as:
+ -pre-build
+ -pre-compile
+ -post-compile (This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir})
+ -post-package
+ -post-build
+ -pre-clean
+ -->
+ <import file="custom_rules.xml" optional="true" />
+
+ <!-- Import the actual build file.
+
+ To customize existing targets, there are two options:
+ - Customize only one target:
+ - copy/paste the target into this file, *before* the
+ <import> task.
+ - customize it to your needs.
+ - Customize the whole content of build.xml
+ - copy/paste the content of the rules files (minus the top node)
+ into this file, replacing the <import> task.
+ - customize to your needs.
+
+ ***********************
+ ****** IMPORTANT ******
+ ***********************
+ In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+ in order to avoid having your file be overridden by tools such as "android update project"
+ -->
+ <!-- version-tag: 1 -->
+ <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>
diff --git a/framesequence/samples/RastermillSamples/proguard.flags b/framesequence/samples/RastermillSamples/proguard.flags
new file mode 100644
index 0000000..4acde2d
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/proguard.flags
@@ -0,0 +1,3 @@
+-keep class android.support.rastermill.** {
+ *;
+}
diff --git a/framesequence/samples/RastermillSamples/project.properties b/framesequence/samples/RastermillSamples/project.properties
new file mode 100644
index 0000000..ce39f2d
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-18
diff --git a/framesequence/samples/RastermillSamples/res/drawable-hdpi/ic_launcher.png b/framesequence/samples/RastermillSamples/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/framesequence/samples/RastermillSamples/res/drawable-mdpi/ic_launcher.png b/framesequence/samples/RastermillSamples/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/framesequence/samples/RastermillSamples/res/drawable-xhdpi/ic_launcher.png b/framesequence/samples/RastermillSamples/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/framesequence/samples/RastermillSamples/res/layout/basic_test_activity.xml b/framesequence/samples/RastermillSamples/res/layout/basic_test_activity.xml
new file mode 100644
index 0000000..0b9a2df
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/res/layout/basic_test_activity.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <ImageView
+ android:id="@+id/imageview"
+ android:layout_width="match_parent"
+ android:layout_height="300dp" />
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+ <Button
+ android:id="@+id/start"
+ android:text="@string/start"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <Button
+ android:id="@+id/stop"
+ android:text="@string/stop"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <Button
+ android:id="@+id/vis"
+ android:text="@string/vis"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <Button
+ android:id="@+id/invis"
+ android:text="@string/invis"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ </LinearLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/framesequence/samples/RastermillSamples/res/raw/animated.gif b/framesequence/samples/RastermillSamples/res/raw/animated.gif
new file mode 100644
index 0000000..51baf15
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/res/raw/animated.gif
Binary files differ
diff --git a/framesequence/samples/RastermillSamples/res/values/strings.xml b/framesequence/samples/RastermillSamples/res/values/strings.xml
new file mode 100644
index 0000000..8b85b8e
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/res/values/strings.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="app_name">Rastermill Samples</string>
+ <string name="action_settings">Settings</string>
+
+ <string name="start">start</string>
+ <string name="stop">stop</string>
+ <string name="vis">vis</string>
+ <string name="invis">invis</string>
+
+</resources>
diff --git a/framesequence/samples/RastermillSamples/res/values/styles.xml b/framesequence/samples/RastermillSamples/res/values/styles.xml
new file mode 100644
index 0000000..737bdc3
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/res/values/styles.xml
@@ -0,0 +1,7 @@
+<resources>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ </style>
+
+</resources>
diff --git a/framesequence/samples/RastermillSamples/src/com/android/rastermill/samples/AnimatedGifTest.java b/framesequence/samples/RastermillSamples/src/com/android/rastermill/samples/AnimatedGifTest.java
new file mode 100644
index 0000000..45d3415
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/src/com/android/rastermill/samples/AnimatedGifTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+package com.android.rastermill.samples;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.rastermill.FrameSequence;
+import android.support.rastermill.FrameSequenceDrawable;
+import android.view.View;
+import android.widget.ImageView;
+
+import java.io.InputStream;
+
+public class AnimatedGifTest extends Activity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.basic_test_activity);
+ ImageView imageView = (ImageView) findViewById(R.id.imageview);
+
+ InputStream is = getResources().openRawResource(R.raw.animated);
+
+ FrameSequence fs = FrameSequence.decodeStream(is);
+ final FrameSequenceDrawable drawable = new FrameSequenceDrawable(fs);
+ imageView.setImageDrawable(drawable);
+
+ findViewById(R.id.start).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ drawable.start();
+ }
+ });
+ findViewById(R.id.stop).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ drawable.stop();
+ }
+ });
+ findViewById(R.id.vis).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ drawable.setVisible(true, true);
+ }
+ });
+ findViewById(R.id.invis).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ drawable.setVisible(false, true);
+ }
+ });
+ }
+}
diff --git a/framesequence/samples/RastermillSamples/src/com/android/rastermill/samples/SamplesList.java b/framesequence/samples/RastermillSamples/src/com/android/rastermill/samples/SamplesList.java
new file mode 100644
index 0000000..0447537
--- /dev/null
+++ b/framesequence/samples/RastermillSamples/src/com/android/rastermill/samples/SamplesList.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package com.android.rastermill.samples;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.SimpleAdapter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public class SamplesList extends ListActivity {
+
+ static final String KEY_NAME = "name";
+ static final String KEY_CLASS = "clazz";
+
+ static Map<String,?> makeSample(String name, Class<?> activity) {
+ Map<String,Object> ret = new HashMap<String,Object>();
+ ret.put(KEY_NAME, name);
+ ret.put(KEY_CLASS, activity);
+ return ret;
+ }
+
+ @SuppressWarnings("serial")
+ static final ArrayList<Map<String,?>> SAMPLES = new ArrayList<Map<String,?>>() {{
+ add(makeSample("Animation Test", AnimatedGifTest.class));
+ }};
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setListAdapter(new SimpleAdapter(this, SAMPLES,
+ android.R.layout.simple_list_item_1, new String[] { KEY_NAME },
+ new int[] { android.R.id.text1 }));
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ Class<?> clazz = (Class<?>) SAMPLES.get(position).get(KEY_CLASS);
+ startActivity(new Intent(this, clazz));
+ }
+
+}