aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/examples/android
diff options
context:
space:
mode:
authorGravatar Yifei Feng <yifeif@google.com>2018-02-22 14:24:57 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-02-22 14:29:27 -0800
commitdce9a49c19f406ba45919e8c94474e55dc5ccd54 (patch)
tree928db8a52603e00aef76985cda16b8bceb9debb2 /tensorflow/examples/android
parentcb7e1963c625fd9713e7475d85621f95be6762f1 (diff)
Merge changes from github.
PiperOrigin-RevId: 186674197
Diffstat (limited to 'tensorflow/examples/android')
-rw-r--r--tensorflow/examples/android/res/animator/color_animation.xml30
-rw-r--r--tensorflow/examples/android/src/org/tensorflow/demo/SpeechActivity.java21
2 files changed, 39 insertions, 12 deletions
diff --git a/tensorflow/examples/android/res/animator/color_animation.xml b/tensorflow/examples/android/res/animator/color_animation.xml
new file mode 100644
index 0000000000..891d8cc1d4
--- /dev/null
+++ b/tensorflow/examples/android/res/animator/color_animation.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+ 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.
+-->
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:ordering="sequentially">
+ <objectAnimator
+ android:propertyName="backgroundColor"
+ android:duration="375"
+ android:valueFrom="0x00b3ccff"
+ android:valueTo="0xffb3ccff"
+ android:valueType="colorType"/>
+ <objectAnimator
+ android:propertyName="backgroundColor"
+ android:duration="375"
+ android:valueFrom="0xffb3ccff"
+ android:valueTo="0x00b3ccff"
+ android:valueType="colorType"/>
+</set>
diff --git a/tensorflow/examples/android/src/org/tensorflow/demo/SpeechActivity.java b/tensorflow/examples/android/src/org/tensorflow/demo/SpeechActivity.java
index 184df1bdb4..1cddf3dc55 100644
--- a/tensorflow/examples/android/src/org/tensorflow/demo/SpeechActivity.java
+++ b/tensorflow/examples/android/src/org/tensorflow/demo/SpeechActivity.java
@@ -31,7 +31,8 @@ the RecognizeCommands helper class.
package org.tensorflow.demo;
-import android.animation.ValueAnimator;
+import android.animation.AnimatorInflater;
+import android.animation.AnimatorSet;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.media.AudioFormat;
@@ -329,17 +330,13 @@ public class SpeechActivity extends Activity {
labelIndex = i;
}
}
- final View labelView = (View) labelsListView.getChildAt(labelIndex - 2);
- ValueAnimator colorAnimation =
- ValueAnimator.ofArgb(0x00b3ccff, 0xffb3ccff, 0x00b3ccff);
- colorAnimation.setDuration(750);
- colorAnimation.addUpdateListener(
- new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animator) {
- labelView.setBackgroundColor((int) animator.getAnimatedValue());
- }
- });
+ final View labelView = labelsListView.getChildAt(labelIndex - 2);
+
+ AnimatorSet colorAnimation =
+ (AnimatorSet)
+ AnimatorInflater.loadAnimator(
+ SpeechActivity.this, R.animator.color_animation);
+ colorAnimation.setTarget(labelView);
colorAnimation.start();
}
}