Merge "Add a bit more logging to LeanbackPreferenceDialogFragment"
diff --git a/api/25.3.0.txt b/api/25.3.0.txt
index 917fd00..ac4bf65 100644
--- a/api/25.3.0.txt
+++ b/api/25.3.0.txt
@@ -135,7 +135,9 @@
public class CustomTabsCallback {
ctor public CustomTabsCallback();
method public void extraCallback(java.lang.String, android.os.Bundle);
+ method public void onMessageChannelReady(android.os.Bundle);
method public void onNavigationEvent(int, android.os.Bundle);
+ method public void onPostMessage(java.lang.String, android.os.Bundle);
field public static final int NAVIGATION_ABORTED = 4; // 0x4
field public static final int NAVIGATION_FAILED = 3; // 0x3
field public static final int NAVIGATION_FINISHED = 2; // 0x2
@@ -215,10 +217,19 @@
method protected abstract boolean mayLaunchUrl(android.support.customtabs.CustomTabsSessionToken, android.net.Uri, android.os.Bundle, java.util.List<android.os.Bundle>);
method protected abstract boolean newSession(android.support.customtabs.CustomTabsSessionToken);
method public android.os.IBinder onBind(android.content.Intent);
+ method protected abstract int postMessage(android.support.customtabs.CustomTabsSessionToken, java.lang.String, android.os.Bundle);
+ method protected abstract boolean requestPostMessageChannel(android.support.customtabs.CustomTabsSessionToken, android.net.Uri);
method protected abstract boolean updateVisuals(android.support.customtabs.CustomTabsSessionToken, android.os.Bundle);
method protected abstract boolean warmup(long);
field public static final java.lang.String ACTION_CUSTOM_TABS_CONNECTION = "android.support.customtabs.action.CustomTabsService";
field public static final java.lang.String KEY_URL = "android.support.customtabs.otherurls.URL";
+ field public static final int RESULT_FAILURE_DISALLOWED = -1; // 0xffffffff
+ field public static final int RESULT_FAILURE_MESSAGING_ERROR = -3; // 0xfffffffd
+ field public static final int RESULT_FAILURE_REMOTE_ERROR = -2; // 0xfffffffe
+ field public static final int RESULT_SUCCESS = 0; // 0x0
+ }
+
+ public static abstract class CustomTabsService.Result implements java.lang.annotation.Annotation {
}
public abstract class CustomTabsServiceConnection implements android.content.ServiceConnection {
@@ -229,6 +240,8 @@
public final class CustomTabsSession {
method public boolean mayLaunchUrl(android.net.Uri, android.os.Bundle, java.util.List<android.os.Bundle>);
+ method public int postMessage(java.lang.String, android.os.Bundle);
+ method public boolean requestPostMessageChannel(android.net.Uri);
method public boolean setActionButton(android.graphics.Bitmap, java.lang.String);
method public boolean setSecondaryToolbarViews(android.widget.RemoteViews, int[], android.app.PendingIntent);
method public deprecated boolean setToolbarItem(int, android.graphics.Bitmap, java.lang.String);
@@ -237,6 +250,24 @@
public class CustomTabsSessionToken {
method public android.support.customtabs.CustomTabsCallback getCallback();
method public static android.support.customtabs.CustomTabsSessionToken getSessionTokenFromIntent(android.content.Intent);
+ method public boolean isAssociatedWith(android.support.customtabs.CustomTabsSession);
+ }
+
+ public class PostMessageService extends android.app.Service {
+ ctor public PostMessageService();
+ method public android.os.IBinder onBind(android.content.Intent);
+ }
+
+ public abstract class PostMessageServiceConnection implements android.content.ServiceConnection {
+ ctor public PostMessageServiceConnection(android.support.customtabs.CustomTabsSessionToken);
+ method public boolean bindSessionToPostMessageService(android.content.Context, java.lang.String);
+ method public final boolean notifyMessageChannelReady(android.os.Bundle);
+ method public void onPostMessageServiceConnected();
+ method public void onPostMessageServiceDisconnected();
+ method public final void onServiceConnected(android.content.ComponentName, android.os.IBinder);
+ method public final void onServiceDisconnected(android.content.ComponentName);
+ method public final boolean postMessage(java.lang.String, android.os.Bundle);
+ method public void unbindFromContext(android.content.Context);
}
}
@@ -874,7 +905,8 @@
method public java.lang.String getAttribute(java.lang.String);
method public double getAttributeDouble(java.lang.String, double);
method public int getAttributeInt(java.lang.String, int);
- method public boolean getLatLong(float[]);
+ method public deprecated boolean getLatLong(float[]);
+ method public double[] getLatLong();
method public byte[] getThumbnail();
method public android.graphics.Bitmap getThumbnailBitmap();
method public byte[] getThumbnailBytes();
@@ -883,6 +915,7 @@
method public boolean isThumbnailCompressed();
method public void saveAttributes() throws java.io.IOException;
method public void setAttribute(java.lang.String, java.lang.String);
+ method public void setLatLong(double, double);
field public static final int ORIENTATION_FLIP_HORIZONTAL = 2; // 0x2
field public static final int ORIENTATION_FLIP_VERTICAL = 4; // 0x4
field public static final int ORIENTATION_NORMAL = 1; // 0x1
@@ -1521,6 +1554,7 @@
method public final boolean isHeadersTransitionOnBackEnabled();
method public boolean isInHeadersTransition();
method public boolean isShowingHeaders();
+ method public android.support.v17.leanback.app.HeadersFragment onCreateHeadersFragment();
method protected void onEntranceTransitionEnd();
method protected void onEntranceTransitionPrepare();
method protected void onEntranceTransitionStart();
@@ -1625,6 +1659,7 @@
method public final boolean isHeadersTransitionOnBackEnabled();
method public boolean isInHeadersTransition();
method public boolean isShowingHeaders();
+ method public android.support.v17.leanback.app.HeadersSupportFragment onCreateHeadersSupportFragment();
method protected void onEntranceTransitionEnd();
method protected void onEntranceTransitionPrepare();
method protected void onEntranceTransitionStart();
@@ -2259,6 +2294,7 @@
method public void displayCompletions(android.view.inputmethod.CompletionInfo[]);
method public android.graphics.drawable.Drawable getBadgeDrawable();
method public android.content.Intent getRecognizerIntent();
+ method public android.support.v17.leanback.app.RowsFragment getRowsFragment();
method public java.lang.String getTitle();
method public static android.support.v17.leanback.app.SearchFragment newInstance(java.lang.String);
method public void setBadgeDrawable(android.graphics.drawable.Drawable);
@@ -2288,6 +2324,7 @@
method public void displayCompletions(android.view.inputmethod.CompletionInfo[]);
method public android.graphics.drawable.Drawable getBadgeDrawable();
method public android.content.Intent getRecognizerIntent();
+ method public android.support.v17.leanback.app.RowsSupportFragment getRowsSupportFragment();
method public java.lang.String getTitle();
method public static android.support.v17.leanback.app.SearchSupportFragment newInstance(java.lang.String);
method public void setBadgeDrawable(android.graphics.drawable.Drawable);
@@ -2575,6 +2612,7 @@
public static abstract class PlaybackGlueHost.HostCallback {
ctor public PlaybackGlueHost.HostCallback();
+ method public void onHostDestroy();
method public void onHostPause();
method public void onHostResume();
method public void onHostStart();
@@ -2902,6 +2940,7 @@
ctor public FocusHighlightHelper();
method public static void setupBrowseItemFocusHighlight(android.support.v17.leanback.widget.ItemBridgeAdapter, int, boolean);
method public static void setupHeaderItemFocusHighlight(android.support.v17.leanback.widget.VerticalGridView);
+ method public static void setupHeaderItemFocusHighlight(android.support.v17.leanback.widget.VerticalGridView, boolean);
}
public abstract interface FragmentAnimationProvider {
@@ -3303,6 +3342,7 @@
method public final void onViewRecycled(android.support.v7.widget.RecyclerView.ViewHolder);
method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
method public void setAdapterListener(android.support.v17.leanback.widget.ItemBridgeAdapter.AdapterListener);
+ method public void setPresenter(android.support.v17.leanback.widget.PresenterSelector);
method public void setPresenterMapper(java.util.ArrayList<android.support.v17.leanback.widget.Presenter>);
method public void setWrapper(android.support.v17.leanback.widget.ItemBridgeAdapter.Wrapper);
}
@@ -4228,6 +4268,18 @@
method public void setStaticLabels(java.lang.CharSequence[]);
}
+ public class TimePicker extends android.support.v17.leanback.widget.picker.Picker {
+ ctor public TimePicker(android.content.Context, android.util.AttributeSet);
+ ctor public TimePicker(android.content.Context, android.util.AttributeSet, int);
+ method public int getHour();
+ method public int getMinute();
+ method public boolean is24Hour();
+ method public boolean isPm();
+ method public void setHour(int);
+ method public void setIs24Hour(boolean);
+ method public void setMinute(int);
+ }
+
}
package android.support.v17.preference {
@@ -5651,6 +5703,7 @@
method public android.content.ComponentName getServiceComponent();
method public android.support.v4.media.session.MediaSessionCompat.Token getSessionToken();
method public boolean isConnected();
+ method public void search(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserCompat.SearchCallback);
method public void subscribe(java.lang.String, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback);
method public void subscribe(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback);
method public void unsubscribe(java.lang.String);
@@ -5688,6 +5741,12 @@
field public static final int FLAG_PLAYABLE = 2; // 0x2
}
+ public static abstract class MediaBrowserCompat.SearchCallback {
+ ctor public MediaBrowserCompat.SearchCallback();
+ method public void onError(java.lang.String, android.os.Bundle);
+ method public void onSearchResult(java.lang.String, android.os.Bundle, java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>);
+ }
+
public static abstract class MediaBrowserCompat.SubscriptionCallback {
ctor public MediaBrowserCompat.SubscriptionCallback();
method public void onChildrenLoaded(java.lang.String, java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>);
@@ -5708,6 +5767,7 @@
method public abstract void onLoadChildren(java.lang.String, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>);
method public void onLoadChildren(java.lang.String, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>, android.os.Bundle);
method public void onLoadItem(java.lang.String, android.support.v4.media.MediaBrowserServiceCompat.Result<android.support.v4.media.MediaBrowserCompat.MediaItem>);
+ method public void onSearch(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>);
method public void setSessionToken(android.support.v4.media.session.MediaSessionCompat.Token);
field public static final java.lang.String SERVICE_INTERFACE = "android.media.browse.MediaBrowserService";
}
@@ -5719,7 +5779,7 @@
field public static final java.lang.String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE";
field public static final java.lang.String EXTRA_RECENT = "android.service.media.extra.RECENT";
field public static final java.lang.String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";
- field public static final java.lang.String EXTRA_SUGGESTION_KEYWORDS = "android.service.media.extra.SUGGESTION_KEYWORDS";
+ field public static final deprecated java.lang.String EXTRA_SUGGESTION_KEYWORDS = "android.service.media.extra.SUGGESTION_KEYWORDS";
}
public static class MediaBrowserServiceCompat.Result<T> {
@@ -5780,6 +5840,7 @@
method public int size();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.support.v4.media.MediaMetadataCompat> CREATOR;
+ field public static final java.lang.String METADATA_KEY_ADVERTISEMENT = "android.media.metadata.ADVERTISEMENT";
field public static final java.lang.String METADATA_KEY_ALBUM = "android.media.metadata.ALBUM";
field public static final java.lang.String METADATA_KEY_ALBUM_ART = "android.media.metadata.ALBUM_ART";
field public static final java.lang.String METADATA_KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST";
@@ -5964,9 +6025,11 @@
method public java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem> getQueue();
method public java.lang.CharSequence getQueueTitle();
method public int getRatingType();
+ method public int getRepeatMode();
method public android.app.PendingIntent getSessionActivity();
method public android.support.v4.media.session.MediaSessionCompat.Token getSessionToken();
method public android.support.v4.media.session.MediaControllerCompat.TransportControls getTransportControls();
+ method public boolean isShuffleModeEnabled();
method public void registerCallback(android.support.v4.media.session.MediaControllerCompat.Callback);
method public void registerCallback(android.support.v4.media.session.MediaControllerCompat.Callback, android.os.Handler);
method public void sendCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
@@ -5984,8 +6047,10 @@
method public void onPlaybackStateChanged(android.support.v4.media.session.PlaybackStateCompat);
method public void onQueueChanged(java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem>);
method public void onQueueTitleChanged(java.lang.CharSequence);
+ method public void onRepeatModeChanged(int);
method public void onSessionDestroyed();
method public void onSessionEvent(java.lang.String, android.os.Bundle);
+ method public void onShuffleModeChanged(boolean);
}
public static final class MediaControllerCompat.PlaybackInfo {
@@ -6014,6 +6079,8 @@
method public abstract void sendCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction, android.os.Bundle);
method public abstract void sendCustomAction(java.lang.String, android.os.Bundle);
method public abstract void setRating(android.support.v4.media.RatingCompat);
+ method public abstract void setRepeatMode(int);
+ method public abstract void setShuffleModeEnabled(boolean);
method public abstract void skipToNext();
method public abstract void skipToPrevious();
method public abstract void skipToQueueItem(long);
@@ -6047,7 +6114,9 @@
method public void setQueue(java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem>);
method public void setQueueTitle(java.lang.CharSequence);
method public void setRatingType(int);
+ method public void setRepeatMode(int);
method public void setSessionActivity(android.app.PendingIntent);
+ method public void setShuffleModeEnabled(boolean);
field public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
field public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
}
@@ -6070,6 +6139,8 @@
method public void onRewind();
method public void onSeekTo(long);
method public void onSetRating(android.support.v4.media.RatingCompat);
+ method public void onSetRepeatMode(int);
+ method public void onSetShuffleModeEnabled(boolean);
method public void onSkipToNext();
method public void onSkipToPrevious();
method public void onSkipToQueueItem(long);
@@ -6122,6 +6193,7 @@
method public long getActiveQueueItemId();
method public long getBufferedPosition();
method public java.util.List<android.support.v4.media.session.PlaybackStateCompat.CustomAction> getCustomActions();
+ method public int getErrorCode();
method public java.lang.CharSequence getErrorMessage();
method public android.os.Bundle getExtras();
method public long getLastPositionUpdateTime();
@@ -6145,12 +6217,29 @@
field public static final long ACTION_REWIND = 8L; // 0x8L
field public static final long ACTION_SEEK_TO = 256L; // 0x100L
field public static final long ACTION_SET_RATING = 128L; // 0x80L
+ field public static final long ACTION_SET_REPEAT_MODE = 262144L; // 0x40000L
+ field public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 524288L; // 0x80000L
field public static final long ACTION_SKIP_TO_NEXT = 32L; // 0x20L
field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
field public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L; // 0x1000L
field public static final long ACTION_STOP = 1L; // 0x1L
field public static final android.os.Parcelable.Creator<android.support.v4.media.session.PlaybackStateCompat> CREATOR;
+ field public static final int ERROR_CODE_ACTION_ABORTED = 10; // 0xa
+ field public static final int ERROR_CODE_APP_ERROR = 1; // 0x1
+ field public static final int ERROR_CODE_AUTHENTICATION_EXPIRED = 3; // 0x3
+ field public static final int ERROR_CODE_CONCURRENT_STREAM_LIMIT = 5; // 0x5
+ field public static final int ERROR_CODE_CONTENT_ALREADY_PLAYING = 8; // 0x8
+ field public static final int ERROR_CODE_END_OF_QUEUE = 11; // 0xb
+ field public static final int ERROR_CODE_NOT_AVAILABLE_IN_REGION = 7; // 0x7
+ field public static final int ERROR_CODE_NOT_SUPPORTED = 2; // 0x2
+ field public static final int ERROR_CODE_PARENTAL_CONTROL_RESTRICTED = 6; // 0x6
+ field public static final int ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED = 4; // 0x4
+ field public static final int ERROR_CODE_SKIP_LIMIT_REACHED = 9; // 0x9
+ field public static final int ERROR_CODE_UNKNOWN_ERROR = 0; // 0x0
field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
+ field public static final int REPEAT_MODE_ALL = 2; // 0x2
+ field public static final int REPEAT_MODE_NONE = 0; // 0x0
+ field public static final int REPEAT_MODE_ONE = 1; // 0x1
field public static final int STATE_BUFFERING = 6; // 0x6
field public static final int STATE_CONNECTING = 8; // 0x8
field public static final int STATE_ERROR = 7; // 0x7
@@ -6174,7 +6263,8 @@
method public android.support.v4.media.session.PlaybackStateCompat.Builder setActions(long);
method public android.support.v4.media.session.PlaybackStateCompat.Builder setActiveQueueItemId(long);
method public android.support.v4.media.session.PlaybackStateCompat.Builder setBufferedPosition(long);
- method public android.support.v4.media.session.PlaybackStateCompat.Builder setErrorMessage(java.lang.CharSequence);
+ method public deprecated android.support.v4.media.session.PlaybackStateCompat.Builder setErrorMessage(java.lang.CharSequence);
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder setErrorMessage(int, java.lang.CharSequence);
method public android.support.v4.media.session.PlaybackStateCompat.Builder setExtras(android.os.Bundle);
method public android.support.v4.media.session.PlaybackStateCompat.Builder setState(int, long, float);
method public android.support.v4.media.session.PlaybackStateCompat.Builder setState(int, long, float, long);
@@ -10038,7 +10128,8 @@
method public int findLastVisibleItemPosition();
method public android.support.v7.widget.RecyclerView.LayoutParams generateDefaultLayoutParams();
method protected int getExtraLayoutSpace(android.support.v7.widget.RecyclerView.State);
- method public int getInitialItemPrefetchCount();
+ method public deprecated int getInitialItemPrefetchCount();
+ method public int getInitialPrefetchItemCount();
method public int getOrientation();
method public boolean getRecycleChildrenOnDetach();
method public boolean getReverseLayout();
@@ -10504,6 +10595,7 @@
method public boolean isLayoutHierarchical(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
method public boolean isMeasurementCacheEnabled();
method public boolean isSmoothScrolling();
+ method public boolean isViewPartiallyVisible(android.view.View, boolean, boolean);
method public void layoutDecorated(android.view.View, int, int, int, int);
method public void layoutDecoratedWithMargins(android.view.View, int, int, int, int);
method public void measureChild(android.view.View, int, int);
@@ -10548,6 +10640,7 @@
method public void removeView(android.view.View);
method public void removeViewAt(int);
method public boolean requestChildRectangleOnScreen(android.support.v7.widget.RecyclerView, android.view.View, android.graphics.Rect, boolean);
+ method public boolean requestChildRectangleOnScreen(android.support.v7.widget.RecyclerView, android.view.View, android.graphics.Rect, boolean, boolean);
method public void requestLayout();
method public void requestSimpleAnimationsInNextLayout();
method public int scrollHorizontallyBy(int, android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
diff --git a/api/current.txt b/api/current.txt
index 8716975..92c93d5 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -941,16 +941,34 @@
package android.support.graphics.drawable {
- public class AnimatedVectorDrawableCompat extends android.support.graphics.drawable.VectorDrawableCommon {
+ public abstract interface Animatable2Compat {
+ method public abstract void clearAnimationCallbacks();
+ method public abstract void registerAnimationCallback(android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
+ method public abstract boolean unregisterAnimationCallback(android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
+ }
+
+ public static abstract class Animatable2Compat.AnimationCallback {
+ ctor public Animatable2Compat.AnimationCallback();
+ method public void onAnimationEnd(android.graphics.drawable.Drawable);
+ method public void onAnimationStart(android.graphics.drawable.Drawable);
+ }
+
+ public class AnimatedVectorDrawableCompat extends android.support.graphics.drawable.VectorDrawableCommon implements android.support.graphics.drawable.Animatable2Compat {
+ method public void clearAnimationCallbacks();
+ method public static void clearAnimationCallbacks(android.graphics.drawable.Drawable);
method public static android.support.graphics.drawable.AnimatedVectorDrawableCompat create(android.content.Context, int);
method public static android.support.graphics.drawable.AnimatedVectorDrawableCompat createFromXmlInner(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public void draw(android.graphics.Canvas);
method public int getOpacity();
method public boolean isRunning();
+ method public void registerAnimationCallback(android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
+ method public static void registerAnimationCallback(android.graphics.drawable.Drawable, android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter);
method public void start();
method public void stop();
+ method public boolean unregisterAnimationCallback(android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
+ method public static boolean unregisterAnimationCallback(android.graphics.drawable.Drawable, android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
}
abstract class VectorDrawableCommon extends android.graphics.drawable.Drawable {
@@ -10795,7 +10813,8 @@
method public int findLastVisibleItemPosition();
method public android.support.v7.widget.RecyclerView.LayoutParams generateDefaultLayoutParams();
method protected int getExtraLayoutSpace(android.support.v7.widget.RecyclerView.State);
- method public int getInitialItemPrefetchCount();
+ method public deprecated int getInitialItemPrefetchCount();
+ method public int getInitialPrefetchItemCount();
method public int getOrientation();
method public boolean getRecycleChildrenOnDetach();
method public boolean getReverseLayout();
diff --git a/graphics/drawable/animated/src/android/support/graphics/drawable/Animatable2Compat.java b/graphics/drawable/animated/src/android/support/graphics/drawable/Animatable2Compat.java
new file mode 100644
index 0000000..d9d0f36
--- /dev/null
+++ b/graphics/drawable/animated/src/android/support/graphics/drawable/Animatable2Compat.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2017 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 android.support.graphics.drawable;
+
+import static android.os.Build.VERSION_CODES.M;
+
+import android.graphics.drawable.Animatable;
+import android.graphics.drawable.Animatable2;
+import android.graphics.drawable.Drawable;
+import android.support.annotation.NonNull;
+import android.support.annotation.RequiresApi;
+
+/**
+ * Abstract class that drawables supporting animations and callbacks should extend in support lib.
+ */
+public interface Animatable2Compat extends Animatable {
+
+ /**
+ * Adds a callback to listen to the animation events.
+ *
+ * @param callback Callback to add.
+ */
+ void registerAnimationCallback(@NonNull AnimationCallback callback);
+
+ /**
+ * Removes the specified animation callback.
+ *
+ * @param callback Callback to remove.
+ * @return {@code false} if callback didn't exist in the call back list, or {@code true} if
+ * callback has been removed successfully.
+ */
+ boolean unregisterAnimationCallback(@NonNull AnimationCallback callback);
+
+ /**
+ * Removes all existing animation callbacks.
+ */
+ void clearAnimationCallbacks();
+
+ /**
+ * Animation callback interface. Used to notify animation events.
+ */
+ abstract class AnimationCallback {
+ /**
+ * Called when the animation starts.
+ *
+ * @param drawable The drawable started the animation.
+ */
+ public void onAnimationStart(Drawable drawable) {};
+ /**
+ * Called when the animation ends.
+ *
+ * @param drawable The drawable finished the animation.
+ */
+ public void onAnimationEnd(Drawable drawable) {};
+
+ // Only when passing this Animatable2Compat.AnimationCallback to a frameworks' AVD, we need
+ // to bridge this compat version callback with the frameworks' callback.
+ Animatable2.AnimationCallback mPlatformCallback;
+
+ @RequiresApi(M)
+ Animatable2.AnimationCallback getPlatformCallback() {
+ if (mPlatformCallback == null) {
+ mPlatformCallback = new Animatable2.AnimationCallback() {
+ @Override
+ public void onAnimationStart(Drawable drawable) {
+ AnimationCallback.this.onAnimationStart(drawable);
+ }
+
+ @Override
+ public void onAnimationEnd(Drawable drawable) {
+ AnimationCallback.this.onAnimationEnd(drawable);
+ }
+ };
+ }
+ return mPlatformCallback;
+ }
+ }
+}
diff --git a/graphics/drawable/animated/src/android/support/graphics/drawable/AnimatedVectorDrawableCompat.java b/graphics/drawable/animated/src/android/support/graphics/drawable/AnimatedVectorDrawableCompat.java
index 33ff2c5..1a7b51e 100644
--- a/graphics/drawable/animated/src/android/support/graphics/drawable/AnimatedVectorDrawableCompat.java
+++ b/graphics/drawable/animated/src/android/support/graphics/drawable/AnimatedVectorDrawableCompat.java
@@ -16,6 +16,7 @@
import android.animation.Animator;
import android.animation.AnimatorInflater;
+import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
@@ -51,7 +52,8 @@
import java.util.List;
/**
- * For API 24 and above, this class is delegating to the framework's {@link AnimatedVectorDrawable}.
+ * For API 24 and above, this class is delegating to the framework's {@link
+ * AnimatedVectorDrawable}.
* For older API version, this class uses {@link android.animation.ObjectAnimator} and
* {@link android.animation.AnimatorSet} to animate the properties of a
* {@link VectorDrawableCompat} to create an animated drawable.
@@ -132,7 +134,8 @@
* </ul>
*/
@SuppressLint("NewApi")
-public class AnimatedVectorDrawableCompat extends VectorDrawableCommon implements Animatable {
+public class AnimatedVectorDrawableCompat extends VectorDrawableCommon
+ implements Animatable2Compat {
private static final String LOGTAG = "AnimatedVDCompat";
private static final String ANIMATED_VECTOR = "animated-vector";
@@ -148,6 +151,13 @@
AnimatedVectorDrawableDelegateState mCachedConstantStateDelegate;
+ // Use internal listener to support AVDC's callback.
+ private Animator.AnimatorListener mAnimatorListener = null;
+
+ // Use an array to keep track of multiple call back associated with one drawable.
+ private ArrayList<Animatable2Compat.AnimationCallback> mAnimationCallbacks = null;
+
+
AnimatedVectorDrawableCompat() {
this(null, null, null);
}
@@ -157,8 +167,8 @@
}
private AnimatedVectorDrawableCompat(@Nullable Context context,
- @Nullable AnimatedVectorDrawableCompatState state,
- @Nullable Resources res) {
+ @Nullable AnimatedVectorDrawableCompatState state,
+ @Nullable Resources res) {
mContext = context;
if (state != null) {
mAnimatedVectorState = state;
@@ -192,7 +202,7 @@
*/
@Nullable
public static AnimatedVectorDrawableCompat create(@NonNull Context context,
- @DrawableRes int resId) {
+ @DrawableRes int resId) {
if (Build.VERSION.SDK_INT >= 24) {
final AnimatedVectorDrawableCompat drawable = new AnimatedVectorDrawableCompat(context);
drawable.mDelegateDrawable = ResourcesCompat.getDrawable(context.getResources(), resId,
@@ -269,7 +279,7 @@
return;
}
mAnimatedVectorState.mVectorDrawable.draw(canvas);
- if (isStarted()) {
+ if (mAnimatedVectorState.mAnimatorSet.isStarted()) {
invalidateSelf();
}
}
@@ -474,9 +484,10 @@
a.recycle();
}
}
-
eventType = parser.next();
}
+
+ mAnimatedVectorState.setupAnimatorSet();
}
@Override
@@ -557,7 +568,9 @@
private static class AnimatedVectorDrawableCompatState extends ConstantState {
int mChangingConfigurations;
VectorDrawableCompat mVectorDrawable;
- ArrayList<Animator> mAnimators;
+ // Combining the array of Animators into a single AnimatorSet to hook up listener easier.
+ AnimatorSet mAnimatorSet;
+ private ArrayList<Animator> mAnimators;
ArrayMap<Animator, String> mTargetNameMap;
public AnimatedVectorDrawableCompatState(Context context,
@@ -589,6 +602,7 @@
mAnimators.add(animClone);
mTargetNameMap.put(animClone, targetName);
}
+ setupAnimatorSet();
}
}
}
@@ -607,6 +621,13 @@
public int getChangingConfigurations() {
return mChangingConfigurations;
}
+
+ public void setupAnimatorSet() {
+ if (mAnimatorSet == null) {
+ mAnimatorSet = new AnimatorSet();
+ }
+ mAnimatorSet.playTogether(mAnimators);
+ }
}
/**
@@ -657,30 +678,7 @@
if (mDelegateDrawable != null) {
return ((AnimatedVectorDrawable) mDelegateDrawable).isRunning();
}
- final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
- final int size = animators.size();
- for (int i = 0; i < size; i++) {
- final Animator animator = animators.get(i);
- if (animator.isRunning()) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isStarted() {
- final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
- if (animators == null) {
- return false;
- }
- final int size = animators.size();
- for (int i = 0; i < size; i++) {
- final Animator animator = animators.get(i);
- if (animator.isRunning()) {
- return true;
- }
- }
- return false;
+ return mAnimatedVectorState.mAnimatorSet.isRunning();
}
@Override
@@ -690,16 +688,11 @@
return;
}
// If any one of the animator has not ended, do nothing.
- if (isStarted()) {
+ if (mAnimatedVectorState.mAnimatorSet.isStarted()) {
return;
}
- // Otherwise, kick off every animator.
- final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
- final int size = animators.size();
- for (int i = 0; i < size; i++) {
- final Animator animator = animators.get(i);
- animator.start();
- }
+ // Otherwise, kick off animatorSet.
+ mAnimatedVectorState.mAnimatorSet.start();
invalidateSelf();
}
@@ -709,12 +702,7 @@
((AnimatedVectorDrawable) mDelegateDrawable).stop();
return;
}
- final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
- final int size = animators.size();
- for (int i = 0; i < size; i++) {
- final Animator animator = animators.get(i);
- animator.end();
- }
+ mAnimatedVectorState.mAnimatorSet.end();
}
final Callback mCallback = new Callback() {
@@ -733,4 +721,180 @@
unscheduleSelf(what);
}
};
+
+ /**
+ * A helper function to unregister the Animatable2Compat callback from the platform's
+ * Animatable2 callback, while keeping the internal array of callback up to date.
+ */
+ private static boolean unregisterPlatformCallback(AnimatedVectorDrawable dr,
+ Animatable2Compat.AnimationCallback callback) {
+ return dr.unregisterAnimationCallback(callback.getPlatformCallback());
+ }
+
+ @Override
+ public void registerAnimationCallback(@NonNull Animatable2Compat.AnimationCallback
+ callback) {
+ if (mDelegateDrawable != null) {
+ registerPlatformCallback((AnimatedVectorDrawable) mDelegateDrawable, callback);
+ return;
+ }
+
+ if (callback == null) {
+ return;
+ }
+
+ // Add listener accordingly.
+ if (mAnimationCallbacks == null) {
+ mAnimationCallbacks = new ArrayList<>();
+ }
+
+ if (mAnimationCallbacks.contains(callback)) {
+ // If this call back is already in, then don't need to append another copy.
+ return;
+ }
+
+ mAnimationCallbacks.add(callback);
+
+ if (mAnimatorListener == null) {
+ // Create a animator listener and trigger the callback events when listener is
+ // triggered.
+ mAnimatorListener = new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ ArrayList<Animatable2Compat.AnimationCallback> tmpCallbacks =
+ new ArrayList<>(mAnimationCallbacks);
+ int size = tmpCallbacks.size();
+ for (int i = 0; i < size; i++) {
+ tmpCallbacks.get(i).onAnimationStart(AnimatedVectorDrawableCompat.this);
+ }
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ ArrayList<Animatable2Compat.AnimationCallback> tmpCallbacks =
+ new ArrayList<>(mAnimationCallbacks);
+ int size = tmpCallbacks.size();
+ for (int i = 0; i < size; i++) {
+ tmpCallbacks.get(i).onAnimationEnd(AnimatedVectorDrawableCompat.this);
+ }
+ }
+ };
+ }
+ mAnimatedVectorState.mAnimatorSet.addListener(mAnimatorListener);
+ }
+
+ /**
+ * A helper function to register the Animatable2Compat callback on the platform's Animatable2
+ * callback.
+ */
+ private static void registerPlatformCallback(@NonNull AnimatedVectorDrawable avd,
+ @NonNull final Animatable2Compat.AnimationCallback callback) {
+ avd.registerAnimationCallback(callback.getPlatformCallback());
+ }
+
+ /**
+ * A helper function to clean up the animator listener in the mAnimatorSet.
+ */
+ private void removeAnimatorSetListener() {
+ if (mAnimatorListener != null) {
+ mAnimatedVectorState.mAnimatorSet.removeListener(mAnimatorListener);
+ mAnimatorListener = null;
+ }
+ }
+
+ @Override
+ public boolean unregisterAnimationCallback(
+ @NonNull Animatable2Compat.AnimationCallback callback) {
+ if (mDelegateDrawable != null) {
+ unregisterPlatformCallback((AnimatedVectorDrawable) mDelegateDrawable, callback);
+ }
+
+ if (mAnimationCallbacks == null || callback == null) {
+ // Nothing to be removed.
+ return false;
+ }
+ boolean removed = mAnimationCallbacks.remove(callback);
+
+ // When the last call back unregistered, remove the listener accordingly.
+ if (mAnimationCallbacks.size() == 0) {
+ removeAnimatorSetListener();
+ }
+ return removed;
+ }
+
+ @Override
+ public void clearAnimationCallbacks() {
+ if (mDelegateDrawable != null) {
+ ((AnimatedVectorDrawable) mDelegateDrawable).clearAnimationCallbacks();
+ return;
+ }
+ removeAnimatorSetListener();
+ if (mAnimationCallbacks == null) {
+ return;
+ }
+
+ mAnimationCallbacks.clear();
+ }
+
+ /**
+ * Utility function to register callback to Drawable, when the drawable is created from XML and
+ * referred in Java code, e.g: ImageView.getDrawable().
+ * From API 24 on, the drawable is treated as an AnimatedVectorDrawable.
+ * Otherwise, it is treated as AnimatedVectorDrawableCompat.
+ */
+ public static void registerAnimationCallback(Drawable dr,
+ Animatable2Compat.AnimationCallback callback) {
+ if (dr == null || callback == null) {
+ return;
+ }
+ if (!(dr instanceof Animatable)) {
+ return;
+ }
+
+ if (Build.VERSION.SDK_INT >= 24) {
+ registerPlatformCallback((AnimatedVectorDrawable) dr, callback);
+ } else {
+ ((AnimatedVectorDrawableCompat) dr).registerAnimationCallback(callback);
+ }
+ }
+
+ /**
+ * Utility function to unregister animation callback from Drawable, when the drawable is
+ * created from XML and referred in Java code, e.g: ImageView.getDrawable().
+ * From API 24 on, the drawable is treated as an AnimatedVectorDrawable.
+ * Otherwise, it is treated as AnimatedVectorDrawableCompat.
+ */
+ public static boolean unregisterAnimationCallback(Drawable dr,
+ Animatable2Compat.AnimationCallback callback) {
+ if (dr == null || callback == null) {
+ return false;
+ }
+ if (!(dr instanceof Animatable)) {
+ return false;
+ }
+
+ if (Build.VERSION.SDK_INT >= 24) {
+ return unregisterPlatformCallback((AnimatedVectorDrawable) dr, callback);
+ } else {
+ return ((AnimatedVectorDrawableCompat) dr).unregisterAnimationCallback(callback);
+ }
+ }
+
+ /**
+ * Utility function to clear animation callbacks from Drawable, when the drawable is
+ * created from XML and referred in Java code, e.g: ImageView.getDrawable().
+ * From API 24 on, the drawable is treated as an AnimatedVectorDrawable.
+ * Otherwise, it is treated as AnimatedVectorDrawableCompat.
+ */
+ public static void clearAnimationCallbacks(Drawable dr) {
+ if (dr == null || !(dr instanceof Animatable)) {
+ return;
+ }
+ if (Build.VERSION.SDK_INT >= 24) {
+ ((AnimatedVectorDrawable) dr).clearAnimationCallbacks();
+ } else {
+ ((AnimatedVectorDrawableCompat) dr).clearAnimationCallbacks();
+ }
+
+ }
}
diff --git a/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java b/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java
index 5b44b2a..7cae5e8 100644
--- a/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java
+++ b/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java
@@ -17,6 +17,7 @@
package android.support.graphics.drawable.tests;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -28,8 +29,10 @@
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.support.annotation.DrawableRes;
+import android.support.graphics.drawable.Animatable2Compat;
import android.support.graphics.drawable.AnimatedVectorDrawableCompat;
import android.support.graphics.drawable.animated.test.R;
import android.support.test.InstrumentationRegistry;
@@ -69,8 +72,9 @@
private static final int IMAGE_WIDTH = 64;
private static final int IMAGE_HEIGHT = 64;
- private static final @DrawableRes int DRAWABLE_RES_ID =
- R.drawable.animation_vector_drawable_grouping_1;
+
+ @DrawableRes
+ private static final int DRAWABLE_RES_ID = R.drawable.animation_vector_drawable_grouping_1;
private Context mContext;
private Resources mResources;
@@ -79,6 +83,26 @@
private Canvas mCanvas;
private static final boolean DBG_DUMP_PNG = false;
+ // States to check for animation callback tests.
+ private boolean mAnimationStarted = false;
+ private boolean mAnimationEnded = false;
+
+ // Animation callback used for all callback related tests.
+ private Animatable2Compat.AnimationCallback mAnimationCallback =
+ new Animatable2Compat.AnimationCallback() {
+ @Override
+ public void onAnimationStart(
+ Drawable drawable) {
+ mAnimationStarted = true;
+ }
+
+ @Override
+ public void onAnimationEnd(
+ Drawable drawable) {
+ mAnimationEnded = true;
+ }
+ };
+
public AnimatedVectorDrawableTest() {
mActivityTestRule = new ActivityTestRule<>(DrawableStubActivity.class);
}
@@ -389,4 +413,81 @@
assertEquals(d1.mutate(), d1);
}
}
+
+ /**
+ * A helper function to setup the AVDC for callback tests.
+ */
+ private AnimatedVectorDrawableCompat setupAnimatedVectorDrawableCompat() {
+ final ImageButton imageButton =
+ (ImageButton) mActivityTestRule.getActivity().findViewById(R.id.imageButton);
+ mAnimationStarted = false;
+ mAnimationEnded = false;
+
+ AnimatedVectorDrawableCompat avd = AnimatedVectorDrawableCompat.create(mContext,
+ R.drawable.animation_vector_drawable_grouping_1); // Duration is 50 ms.
+ ViewCompat.setBackground(imageButton, avd);
+ return avd;
+ }
+
+ @Test
+ /**
+ * Test show that callback is successfully registered.
+ * Note that this test requires screen is on.
+ */
+ public void testRegisterCallback() throws Throwable {
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ AnimatedVectorDrawableCompat avd = setupAnimatedVectorDrawableCompat();
+ avd.registerAnimationCallback(mAnimationCallback);
+ avd.start();
+ }
+ });
+ Thread.sleep(500);
+ assertTrue(mAnimationStarted);
+ assertTrue(mAnimationEnded);
+ }
+
+ @Test
+ /**
+ * Test show that callback is successfully removed.
+ * Note that this test requires screen is on.
+ */
+ public void testClearCallback() throws Throwable {
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ AnimatedVectorDrawableCompat avd =
+ setupAnimatedVectorDrawableCompat();
+ avd.registerAnimationCallback(mAnimationCallback);
+ avd.clearAnimationCallbacks();
+ avd.start();
+ }
+ });
+ Thread.sleep(500);
+ assertFalse(mAnimationStarted);
+ assertFalse(mAnimationEnded);
+ }
+
+ @Test
+ /**
+ * Test show that callback is successfully unregistered.
+ * Note that this test requires screen is on.
+ */
+ public void testUnregisterCallback() throws Throwable {
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ AnimatedVectorDrawableCompat avd =
+ setupAnimatedVectorDrawableCompat();
+
+ avd.registerAnimationCallback(mAnimationCallback);
+ avd.unregisterAnimationCallback(mAnimationCallback);
+ avd.start();
+ }
+ });
+ Thread.sleep(500);
+ assertFalse(mAnimationStarted);
+ assertFalse(mAnimationEnded);
+ }
}
diff --git a/samples/SupportVectorDrawable/animated/AndroidManifest.xml b/samples/SupportVectorDrawable/animated/AndroidManifest.xml
deleted file mode 100644
index 09a5dbb..0000000
--- a/samples/SupportVectorDrawable/animated/AndroidManifest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.support.vectordrawable" >
-
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23"/>
-
- <application android:icon="@drawable/app_sample_code" android:label="AnimatedVectorDrawableCompatTest" >
- <activity android:name="com.example.android.support.vectordrawable.app.AnimatedButtonBackground" />
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </application>
-
-</manifest>
diff --git a/samples/SupportVectorDrawable/animated/res/drawable/app_sample_code.png b/samples/SupportVectorDrawable/animated/res/drawable/app_sample_code.png
deleted file mode 100755
index 66a1984..0000000
--- a/samples/SupportVectorDrawable/animated/res/drawable/app_sample_code.png
+++ /dev/null
Binary files differ
diff --git a/samples/SupportVectorDrawable/animated/res/values/strings.xml b/samples/SupportVectorDrawable/animated/res/values/strings.xml
deleted file mode 100644
index c5451c8..0000000
--- a/samples/SupportVectorDrawable/animated/res/values/strings.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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.
--->
-
-<resources>
-
- <string name="twoLinePathData">"M 0,0 v 100 M 0,0 h 100"</string>
- <string name="triangle"> "M300,70 l 0,-70 70,70 0,0 -70,70z"</string>
- <string name="rectangle">"M300,70 l 0,-70 70,0 0,140 -70,0 z"</string>
- <string name="rectangle2">"M300,70 l 0,-70 70,0 0,70z M300,70 l 70,0 0,70 -70,0z"</string>
- <string name="equal2"> "M300,35 l 0,-35 70,0 0,35z M300,105 l 70,0 0,35 -70,0z"</string>
- <string name="round_box">"m2.10001,-6c-1.9551,0 -0.5,0.02499 -2.10001,0.02499c-1.575,0 0.0031,-0.02499 -1.95,-0.02499c-2.543,0 -4,2.2816 -4,4.85001c0,3.52929 0.25,6.25 5.95,6.25c5.7,0 6,-2.72071 6,-6.25c0,-2.56841 -1.35699,-4.85001 -3.89999,-4.85001"</string>
- <string name="heart"> "m4.5,-7c-1.95509,0 -3.83009,1.26759 -4.5,3c-0.66991,-1.73241 -2.54691,-3 -4.5,-3c-2.543,0 -4.5,1.93159 -4.5,4.5c0,3.5293 3.793,6.2578 9,11.5c5.207,-5.2422 9,-7.9707 9,-11.5c0,-2.56841 -1.957,-4.5 -4.5,-4.5"</string>
- <string name="rectangle200">"M 0,0 l 200,0 l 0, 200 l -200, 0 z"</string>
-</resources>
\ No newline at end of file
diff --git a/samples/SupportVectorDrawable/animated/rundemo.sh b/samples/SupportVectorDrawable/animated/rundemo.sh
deleted file mode 100755
index e5972f7..0000000
--- a/samples/SupportVectorDrawable/animated/rundemo.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-. $ANDROID_BUILD_TOP/build/envsetup.sh && \
-mmm -j20 . && \
-adb install -r $OUT/data/app/SupportAnimatedVectorDrawable/SupportAnimatedVectorDrawable.apk && \
-adb shell am start -n com.example.android.support.vectordrawable/com.example.android.support.vectordrawable.app.AnimatedButtonBackground
-
-
diff --git a/samples/SupportVectorDrawable/static/Android.mk b/samples/SupportVectorDrawable/static/Android.mk
deleted file mode 100644
index bdc102a..0000000
--- a/samples/SupportVectorDrawable/static/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_MODULE_TAGS := samples tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := SupportVectorDrawable
-
-LOCAL_STATIC_ANDROID_LIBRARIES := android-support-vectordrawable android-support-v4
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_MIN_SDK_VERSION := 7
-
-LOCAL_AAPT_FLAGS += --no-version-vectors
-
-include $(BUILD_PACKAGE)
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/samples/SupportVectorDrawable/static/AndroidManifest.xml b/samples/SupportVectorDrawable/static/AndroidManifest.xml
deleted file mode 100644
index 53fc9c2..0000000
--- a/samples/SupportVectorDrawable/static/AndroidManifest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.support.vectordrawable" >
-
- <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="23"/>
-
- <application android:icon="@drawable/app_sample_code" android:label="VectorDrawableCompatTest" >
- <activity android:name=".app.SimpleButtonBackground" />
-
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </application>
-
-</manifest>
diff --git a/samples/SupportVectorDrawable/static/rundemo.sh b/samples/SupportVectorDrawable/static/rundemo.sh
deleted file mode 100755
index 2695b53..0000000
--- a/samples/SupportVectorDrawable/static/rundemo.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-. $ANDROID_BUILD_TOP/build/envsetup.sh && \
-mmm -j20 . && \
-adb install -r $OUT/data/app/SupportVectorDrawable/SupportVectorDrawable.apk && \
-adb shell am start -n com.example.android.support.vectordrawable/com.example.android.support.vectordrawable.app.SimpleButtonBackground
-
-
diff --git a/samples/SupportVectorDrawable/animated/Android.mk b/samples/SupportVectorDrawableDemos/Android.mk
similarity index 88%
rename from samples/SupportVectorDrawable/animated/Android.mk
rename to samples/SupportVectorDrawableDemos/Android.mk
index ae01691..376f841 100644
--- a/samples/SupportVectorDrawable/animated/Android.mk
+++ b/samples/SupportVectorDrawableDemos/Android.mk
@@ -18,17 +18,18 @@
LOCAL_USE_AAPT2 := true
-LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_TAGS := samples tests
LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 11
+LOCAL_MIN_SDK_VERSION := 14
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PACKAGE_NAME := SupportAnimatedVectorDrawable
+LOCAL_PACKAGE_NAME := SupportVectorDrawableDemos
LOCAL_STATIC_ANDROID_LIBRARIES := \
+ android-support-v7-appcompat \
android-support-animatedvectordrawable \
android-support-vectordrawable \
android-support-v4
diff --git a/samples/SupportVectorDrawableDemos/AndroidManifest.xml b/samples/SupportVectorDrawableDemos/AndroidManifest.xml
new file mode 100644
index 0000000..1de3a5f
--- /dev/null
+++ b/samples/SupportVectorDrawableDemos/AndroidManifest.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.support.vectordrawable" >
+
+ <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="23"/>
+
+ <application android:icon="@drawable/app_sample_code" android:label="SupportVectorDrawableDemos" >
+ <activity android:name="com.example.android.support.vectordrawable.app.SupportVectorDrawableDemos">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name="com.example.android.support.vectordrawable.app.SimpleAnimatedVectorDrawable"
+ android:label="SimpleAnimatedVectorDrawable">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name="com.example.android.support.vectordrawable.app.SimpleStaticVectorDrawable"
+ android:label="SimpleVectorDrawable">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name="com.example.android.support.vectordrawable.app.AVDCListenerDemo"
+ android:label="AnimatedVectorDrawableCompatListener"
+ android:theme="@style/Theme.AppCompat.Light">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
\ No newline at end of file
diff --git a/samples/SupportVectorDrawableDemos/build.gradle b/samples/SupportVectorDrawableDemos/build.gradle
new file mode 100644
index 0000000..8557c6b
--- /dev/null
+++ b/samples/SupportVectorDrawableDemos/build.gradle
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+apply plugin: 'com.android.application'
+
+dependencies {
+ compile project(':support-vector-drawable')
+ compile project(':support-animated-vector-drawable')
+ compile project(':support-appcompat-v7')
+}
+
+android {
+ compileSdkVersion project.ext.currentSdk
+
+ defaultConfig {
+ minSdkVersion 14
+ vectorDrawables.useSupportLibrary = true
+ }
+
+ sourceSets {
+ main.manifest.srcFile 'AndroidManifest.xml'
+ main.java.srcDirs = ['src']
+ main.aidl.srcDirs = ['src']
+ main.res.srcDirs = ['res']
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
diff --git a/samples/SupportVectorDrawable/animated/res/anim/alpha_animation_progress_bar.xml b/samples/SupportVectorDrawableDemos/res/anim/alpha_animation_progress_bar.xml
similarity index 100%
rename from samples/SupportVectorDrawable/animated/res/anim/alpha_animation_progress_bar.xml
rename to samples/SupportVectorDrawableDemos/res/anim/alpha_animation_progress_bar.xml
diff --git a/samples/SupportVectorDrawable/animated/res/anim/animation_grouping_1_01.xml b/samples/SupportVectorDrawableDemos/res/anim/animation_grouping_1_01.xml
similarity index 75%
rename from samples/SupportVectorDrawable/animated/res/anim/animation_grouping_1_01.xml
rename to samples/SupportVectorDrawableDemos/res/anim/animation_grouping_1_01.xml
index 36c297f..9a89d63 100644
--- a/samples/SupportVectorDrawable/animated/res/anim/animation_grouping_1_01.xml
+++ b/samples/SupportVectorDrawableDemos/res/anim/animation_grouping_1_01.xml
@@ -16,7 +16,8 @@
-->
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
- android:duration="3300"
- android:propertyName="rotation"
- android:valueFrom="0"
- android:valueTo="450" />
+ android:duration="3300"
+ android:interpolator="@android:anim/linear_interpolator"
+ android:propertyName="rotation"
+ android:valueFrom="0"
+ android:valueTo="450"/>
diff --git a/samples/SupportVectorDrawable/animated/res/anim/trim_path_animation_progress_bar.xml b/samples/SupportVectorDrawableDemos/res/anim/trim_path_animation_progress_bar.xml
similarity index 100%
rename from samples/SupportVectorDrawable/animated/res/anim/trim_path_animation_progress_bar.xml
rename to samples/SupportVectorDrawableDemos/res/anim/trim_path_animation_progress_bar.xml
diff --git a/samples/SupportVectorDrawable/animated/res/drawable/animation_vector_drawable_grouping_1.xml b/samples/SupportVectorDrawableDemos/res/drawable/animation_vector_drawable_grouping_1.xml
similarity index 100%
rename from samples/SupportVectorDrawable/animated/res/drawable/animation_vector_drawable_grouping_1.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/animation_vector_drawable_grouping_1.xml
diff --git a/samples/SupportVectorDrawable/animated/res/drawable/animation_vector_progress_bar.xml b/samples/SupportVectorDrawableDemos/res/drawable/animation_vector_progress_bar.xml
similarity index 100%
rename from samples/SupportVectorDrawable/animated/res/drawable/animation_vector_progress_bar.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/animation_vector_progress_bar.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/app_sample_code.png b/samples/SupportVectorDrawableDemos/res/drawable/app_sample_code.png
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/app_sample_code.png
rename to samples/SupportVectorDrawableDemos/res/drawable/app_sample_code.png
Binary files differ
diff --git a/samples/SupportVectorDrawable/animated/res/drawable/btn_radio_on_to_off_bundle.xml b/samples/SupportVectorDrawableDemos/res/drawable/btn_radio_on_to_off_bundle.xml
similarity index 100%
rename from samples/SupportVectorDrawable/animated/res/drawable/btn_radio_on_to_off_bundle.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/btn_radio_on_to_off_bundle.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable01.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable01.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable01.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable01.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable02.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable02.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable02.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable02.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable03.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable03.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable03.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable03.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable04.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable04.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable04.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable04.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable05.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable05.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable05.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable05.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable06.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable06.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable06.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable06.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable07.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable07.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable07.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable07.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable08.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable08.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable08.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable08.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable09.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable09.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable09.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable09.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable10.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable10.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable10.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable10.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable11.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable11.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable11.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable11.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable12.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable12.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable12.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable12.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable13.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable13.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable13.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable13.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable14.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable14.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable14.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable14.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable15.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable15.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable15.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable15.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable16.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable16.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable16.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable16.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable17.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable17.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable17.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable17.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable18.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable18.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable18.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable18.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable19.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable19.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable19.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable19.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable20.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable20.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable20.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable20.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable21.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable21.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable21.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable21.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable22.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable22.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable22.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable22.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable23.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable23.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable23.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable23.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable24.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable24.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable24.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable24.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable25.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable25.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable25.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable25.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable26.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable26.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable26.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable26.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable27.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable27.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable27.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable27.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable28.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable28.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable28.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable28.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable29.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable29.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable29.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable29.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable30.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable30.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable30.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable30.xml
diff --git a/samples/SupportVectorDrawable/animated/res/drawable/vector_drawable_grouping_1.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_grouping_1.xml
similarity index 100%
rename from samples/SupportVectorDrawable/animated/res/drawable/vector_drawable_grouping_1.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_grouping_1.xml
diff --git a/samples/SupportVectorDrawable/animated/res/drawable/vector_drawable_progress_bar.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_progress_bar.xml
similarity index 100%
rename from samples/SupportVectorDrawable/animated/res/drawable/vector_drawable_progress_bar.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_progress_bar.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable_scale0.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_scale0.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable_scale0.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_scale0.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable_scale1.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_scale1.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable_scale1.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_scale1.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable_scale2.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_scale2.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable_scale2.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_scale2.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_drawable_scale3.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_scale3.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_drawable_scale3.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_drawable_scale3.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_test01.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_test01.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_test01.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_test01.xml
diff --git a/samples/SupportVectorDrawable/static/res/drawable/vector_test02.xml b/samples/SupportVectorDrawableDemos/res/drawable/vector_test02.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/drawable/vector_test02.xml
rename to samples/SupportVectorDrawableDemos/res/drawable/vector_test02.xml
diff --git a/samples/SupportVectorDrawableDemos/res/layout/avdc_listener.xml b/samples/SupportVectorDrawableDemos/res/layout/avdc_listener.xml
new file mode 100644
index 0000000..279a7cf
--- /dev/null
+++ b/samples/SupportVectorDrawableDemos/res/layout/avdc_listener.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" android:weightSum="1">
+
+ <android.support.v7.widget.AppCompatImageView
+ app:srcCompat="@drawable/animation_vector_drawable_grouping_1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" android:id="@+id/imageView"/>
+ <TextView
+ android:text="TextView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" android:id="@+id/textView"/>
+ <TextView
+ android:text="TextView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" android:id="@+id/textView2"/>
+ <android.support.v7.widget.AppCompatImageView
+ app:srcCompat="@drawable/btn_radio_on_to_off_bundle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" android:id="@+id/imageView2"/>
+ <TextView
+ android:text="TextView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" android:id="@+id/textView3"/>
+ <TextView
+ android:text="TextView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" android:id="@+id/textView4"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/SupportVectorDrawable/static/res/raw/vector_drawable01.xml b/samples/SupportVectorDrawableDemos/res/raw/vector_drawable01.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/raw/vector_drawable01.xml
rename to samples/SupportVectorDrawableDemos/res/raw/vector_drawable01.xml
diff --git a/samples/SupportVectorDrawable/static/res/values/colors.xml b/samples/SupportVectorDrawableDemos/res/values/colors.xml
similarity index 100%
rename from samples/SupportVectorDrawable/static/res/values/colors.xml
rename to samples/SupportVectorDrawableDemos/res/values/colors.xml
diff --git a/samples/SupportVectorDrawable/static/res/values/strings.xml b/samples/SupportVectorDrawableDemos/res/values/strings.xml
similarity index 99%
rename from samples/SupportVectorDrawable/static/res/values/strings.xml
rename to samples/SupportVectorDrawableDemos/res/values/strings.xml
index 065e7d9..a59ad14 100644
--- a/samples/SupportVectorDrawable/static/res/values/strings.xml
+++ b/samples/SupportVectorDrawableDemos/res/values/strings.xml
@@ -16,7 +16,6 @@
-->
<resources>
-
<string name="twoLinePathData">"M 0,0 v 100 M 0,0 h 100"</string>
<string name="triangle"> "M300,70 l 0,-70 70,70 0,0 -70,70z"</string>
<string name="rectangle">"M300,70 l 0,-70 70,0 0,140 -70,0 z"</string>
@@ -26,4 +25,4 @@
<string name="heart"> "m4.5,-7c-1.95509,0 -3.83009,1.26759 -4.5,3c-0.66991,-1.73241 -2.54691,-3 -4.5,-3c-2.543,0 -4.5,1.93159 -4.5,4.5c0,3.5293 3.793,6.2578 9,11.5c5.207,-5.2422 9,-7.9707 9,-11.5c0,-2.56841 -1.957,-4.5 -4.5,-4.5"</string>
<string name="rectangle200">"M 0,0 l 200,0 l 0, 200 l -200, 0 z"</string>
<string name="triangle100">"M 100, 0 l 0, 100, -100, 0 z"</string>
-</resources>
+</resources>
\ No newline at end of file
diff --git a/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/AVDCListenerDemo.java b/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/AVDCListenerDemo.java
new file mode 100644
index 0000000..f228a43
--- /dev/null
+++ b/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/AVDCListenerDemo.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2017 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.example.android.support.vectordrawable.app;
+
+import android.graphics.drawable.Animatable;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.support.graphics.drawable.Animatable2Compat;
+import android.support.graphics.drawable.AnimatedVectorDrawableCompat;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.AppCompatImageView;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.TextView;
+
+import com.example.android.support.vectordrawable.R;
+
+/**
+ * A demo for AnimatedVectorDrawableCompat's listener support.
+ */
+public class AVDCListenerDemo extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.avdc_listener);
+ final AppCompatImageView imageView1 = (AppCompatImageView) findViewById(R.id.imageView);
+ final AppCompatImageView imageView2 = (AppCompatImageView) findViewById(R.id.imageView2);
+
+ final TextView textView1 = (TextView) findViewById(R.id.textView);
+ textView1.setText("Should show start / end for first AVD");
+ final TextView textView2 = (TextView) findViewById(R.id.textView2);
+ textView2.setText("Not affected by AVD, b/c removed after register");
+ final TextView textView3 = (TextView) findViewById(R.id.textView3);
+ textView3.setText("Should show start / end for second AVD");
+ final TextView textView4 = (TextView) findViewById(R.id.textView4);
+ textView4.setText("Not affected by AVD, b/c unregistered after register");
+
+ final Drawable drawable1 = imageView1.getDrawable();
+ final Drawable drawable2 = imageView2.getDrawable();
+
+ Animatable2Compat.AnimationCallback textView1Callback = new
+ Animatable2Compat.AnimationCallback() {
+ @Override
+ public void onAnimationStart(Drawable drawable) {
+ textView1.setText("AVD 1 started");
+ }
+
+ @Override
+ public void onAnimationEnd(Drawable drawable) {
+ textView1.setText("AVD 1 Ended");
+ }
+ };
+ Animatable2Compat.AnimationCallback textView2Callback = new
+ Animatable2Compat.AnimationCallback() {
+ @Override
+ public void onAnimationStart(Drawable drawable) {
+ textView2.setText("AVD 1 started");
+ }
+
+ @Override
+ public void onAnimationEnd(Drawable drawable) {
+ textView2.setText("AVD 1 Ended");
+ }
+ };
+ AnimatedVectorDrawableCompat.registerAnimationCallback(drawable1, textView1Callback);
+ AnimatedVectorDrawableCompat.registerAnimationCallback(drawable1, textView2Callback);
+ AnimatedVectorDrawableCompat.clearAnimationCallbacks(drawable1);
+ AnimatedVectorDrawableCompat.registerAnimationCallback(drawable1, textView1Callback);
+
+ AnimatedVectorDrawableCompat.registerAnimationCallback(drawable2,
+ new Animatable2Compat.AnimationCallback() {
+ @Override
+ public void onAnimationStart(Drawable drawable) {
+ textView3.setText("AVD 2 started");
+ }
+
+ @Override
+ public void onAnimationEnd(Drawable drawable) {
+ textView3.setText("AVD 2 Ended");
+ }
+ });
+
+ Animatable2Compat.AnimationCallback textView4Callback = new
+ Animatable2Compat.AnimationCallback() {
+ @Override
+ public void onAnimationStart(Drawable drawable) {
+ textView4.setText("AVD 2 started");
+ }
+
+ @Override
+ public void onAnimationEnd(Drawable drawable) {
+ textView4.setText("AVD 2 Ended");
+ }
+ };
+
+ AnimatedVectorDrawableCompat.registerAnimationCallback(drawable2, textView4Callback);
+ AnimatedVectorDrawableCompat.unregisterAnimationCallback(drawable2, textView4Callback);
+
+ // Touch the imageView will run the AVD.
+ imageView1.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (!((Animatable) drawable1).isRunning()) {
+ ((Animatable) drawable1).start();
+ }
+ return true;
+ }
+ });
+
+ imageView2.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (!((Animatable) drawable2).isRunning()) {
+ ((Animatable) drawable2).start();
+ }
+ return true;
+ }
+ });
+ }
+}
diff --git a/samples/SupportVectorDrawable/animated/src/com/example/android/support/vectordrawable/app/AnimatedButtonBackground.java b/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/SimpleAnimatedVectorDrawable.java
similarity index 79%
rename from samples/SupportVectorDrawable/animated/src/com/example/android/support/vectordrawable/app/AnimatedButtonBackground.java
rename to samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/SimpleAnimatedVectorDrawable.java
index d8381d1..76f6770 100644
--- a/samples/SupportVectorDrawable/animated/src/com/example/android/support/vectordrawable/app/AnimatedButtonBackground.java
+++ b/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/SimpleAnimatedVectorDrawable.java
@@ -16,7 +16,6 @@
package com.example.android.support.vectordrawable.app;
-import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
@@ -26,24 +25,26 @@
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
+
import com.example.android.support.vectordrawable.R;
import java.text.DecimalFormat;
-public class AnimatedButtonBackground extends Activity implements View.OnClickListener{
+/**
+ * Simple demo for AnimatedVectorDrawableCompat.
+ */
+public class SimpleAnimatedVectorDrawable extends Activity implements View.OnClickListener {
private static final String LOG_TAG = "TestActivity";
private static final String LOGCAT = "VectorDrawable1";
- protected int[] icon = {
- R.drawable.animation_vector_drawable_grouping_1,
- R.drawable.animation_vector_progress_bar,
- R.drawable.btn_radio_on_to_off_bundle,
+ protected int[] mIcons = {
+ R.drawable.animation_vector_drawable_grouping_1,
+ R.drawable.animation_vector_progress_bar,
+ R.drawable.btn_radio_on_to_off_bundle,
};
-
@Override
protected void onCreate(Bundle savedInstanceState) {
- ObjectAnimator oa = new ObjectAnimator();
super.onCreate(savedInstanceState);
ScrollView scrollView = new ScrollView(this);
LinearLayout container = new LinearLayout(this);
@@ -51,15 +52,15 @@
container.setOrientation(LinearLayout.VERTICAL);
Resources res = this.getResources();
container.setBackgroundColor(0xFF888888);
- AnimatedVectorDrawableCompat []d = new AnimatedVectorDrawableCompat[icon.length];
- long time = android.os.SystemClock.currentThreadTimeMillis();
- for (int i = 0; i < icon.length; i++) {
- d[i] = AnimatedVectorDrawableCompat.create(this, icon[i]);
+ AnimatedVectorDrawableCompat[] d = new AnimatedVectorDrawableCompat[mIcons.length];
+ long time = android.os.SystemClock.currentThreadTimeMillis();
+ for (int i = 0; i < mIcons.length; i++) {
+ d[i] = AnimatedVectorDrawableCompat.create(this, mIcons[i]);
}
- time = android.os.SystemClock.currentThreadTimeMillis()-time;
+ time = android.os.SystemClock.currentThreadTimeMillis() - time;
TextView t = new TextView(this);
DecimalFormat df = new DecimalFormat("#.##");
- t.setText("avgL=" + df.format(time / (icon.length)) + " ms");
+ t.setText("avgL=" + df.format(time / (mIcons.length)) + " ms");
container.addView(t);
addDrawableButtons(container, d);
diff --git a/samples/SupportVectorDrawable/static/src/com/example/android/support/vectordrawable/app/SimpleButtonBackground.java b/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/SimpleStaticVectorDrawable.java
similarity index 86%
rename from samples/SupportVectorDrawable/static/src/com/example/android/support/vectordrawable/app/SimpleButtonBackground.java
rename to samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/SimpleStaticVectorDrawable.java
index 79a51ac..deee6c6 100644
--- a/samples/SupportVectorDrawable/static/src/com/example/android/support/vectordrawable/app/SimpleButtonBackground.java
+++ b/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/SimpleStaticVectorDrawable.java
@@ -26,15 +26,18 @@
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
+
import com.example.android.support.vectordrawable.R;
import java.text.DecimalFormat;
-public class SimpleButtonBackground extends Activity {
- private static final String LOG_TAG = "SimpleButtonBackground";
+/**
+ * Simple demo for VectorDrawableCompat.
+ */
+public class SimpleStaticVectorDrawable extends Activity {
+ private static final String LOG_TAG = "SimpleStaticVectorDrawable";
- private static final String LOGCAT = "VectorDrawable1";
- protected int[] icon = {
+ protected int[] mIcons = {
R.drawable.vector_drawable_scale0,
R.drawable.vector_drawable_scale1,
R.drawable.vector_drawable_scale2,
@@ -84,12 +87,12 @@
container.setOrientation(LinearLayout.VERTICAL);
Resources res = this.getResources();
container.setBackgroundColor(0xFF888888);
- VectorDrawableCompat []d = new VectorDrawableCompat[icon.length];
- long time = android.os.SystemClock.currentThreadTimeMillis();
- for (int i = 0; i < icon.length; i++) {
- d[i] = VectorDrawableCompat.create(res, icon[i], getTheme());
+ VectorDrawableCompat[] d = new VectorDrawableCompat[mIcons.length];
+ long time = android.os.SystemClock.currentThreadTimeMillis();
+ for (int i = 0; i < mIcons.length; i++) {
+ d[i] = VectorDrawableCompat.create(res, mIcons[i], getTheme());
}
- time = android.os.SystemClock.currentThreadTimeMillis()-time;
+ time = android.os.SystemClock.currentThreadTimeMillis() - time;
// Testing Tint on one particular case.
if (d.length > 3) {
@@ -99,7 +102,7 @@
// Testing Constant State like operation by creating the first 2 icons
// from the 3rd one's constant state.
- VectorDrawableCompat []extras = new VectorDrawableCompat[EXTRA_TESTS];
+ VectorDrawableCompat[] extras = new VectorDrawableCompat[EXTRA_TESTS];
ConstantState state = d[0].getConstantState();
extras[0] = (VectorDrawableCompat) state.newDrawable();
extras[1] = (VectorDrawableCompat) state.newDrawable();
@@ -113,7 +116,7 @@
// Just show the average create time as the first view.
TextView t = new TextView(this);
DecimalFormat df = new DecimalFormat("#.##");
- t.setText("avgL=" + df.format(time / (icon.length)) + " ms");
+ t.setText("avgL=" + df.format(time / (mIcons.length)) + " ms");
container.addView(t);
addDrawableButtons(container, extras);
diff --git a/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/SupportVectorDrawableDemos.java b/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/SupportVectorDrawableDemos.java
new file mode 100644
index 0000000..1bb3377
--- /dev/null
+++ b/samples/SupportVectorDrawableDemos/src/com/example/android/support/vectordrawable/app/SupportVectorDrawableDemos.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2017 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.example.android.support.vectordrawable.app;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.SimpleAdapter;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The root level activity for this demo. Showing a list of sub demos.
+ */
+public class SupportVectorDrawableDemos extends ListActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Intent intent = getIntent();
+ String path = intent.getStringExtra("com.example.android.apis.Path");
+
+ if (path == null) {
+ path = "";
+ }
+
+ setListAdapter(new SimpleAdapter(this, getData(path),
+ android.R.layout.simple_list_item_1, new String[]{"title"},
+ new int[]{android.R.id.text1}));
+ getListView().setTextFilterEnabled(true);
+ }
+
+ protected List<Map<String, Object>> getData(String prefix) {
+ List<Map<String, Object>> myData = new ArrayList<Map<String, Object>>();
+
+ Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
+ mainIntent.addCategory("android.intent.category.SAMPLE_CODE");
+
+ PackageManager pm = getPackageManager();
+ List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0);
+
+ if (null == list) {
+ return myData;
+ }
+
+ String[] prefixPath;
+ String prefixWithSlash = prefix;
+
+ if (prefix.equals("")) {
+ prefixPath = null;
+ } else {
+ prefixPath = prefix.split("/");
+ prefixWithSlash = prefix + "/";
+ }
+
+ int len = list.size();
+
+ Map<String, Boolean> entries = new HashMap<String, Boolean>();
+
+ for (int i = 0; i < len; i++) {
+ ResolveInfo info = list.get(i);
+ CharSequence labelSeq = info.loadLabel(pm);
+ String label = labelSeq != null
+ ? labelSeq.toString()
+ : info.activityInfo.name;
+
+ if (prefixWithSlash.length() == 0 || label.startsWith(prefixWithSlash)) {
+
+ String[] labelPath = label.split("/");
+
+ String nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.length];
+
+ if ((prefixPath != null ? prefixPath.length : 0) == labelPath.length - 1) {
+ addItem(myData, nextLabel, activityIntent(
+ info.activityInfo.applicationInfo.packageName,
+ info.activityInfo.name));
+ } else {
+ if (entries.get(nextLabel) == null) {
+ addItem(myData, nextLabel, browseIntent(
+ prefix.equals("") ? nextLabel : prefix + "/" + nextLabel));
+ entries.put(nextLabel, true);
+ }
+ }
+ }
+ }
+
+ Collections.sort(myData, sDisplayNameComparator);
+
+ return myData;
+ }
+
+ private static final Comparator<Map<String, Object>> sDisplayNameComparator =
+ new Comparator<Map<String, Object>>() {
+ private final Collator mCollator = Collator.getInstance();
+
+ @Override
+ public int compare(Map<String, Object> map1, Map<String, Object> map2) {
+ return mCollator.compare(map1.get("title"), map2.get("title"));
+ }
+ };
+
+ protected Intent activityIntent(String pkg, String componentName) {
+ Intent result = new Intent();
+ result.setClassName(pkg, componentName);
+ return result;
+ }
+
+ protected Intent browseIntent(String path) {
+ Intent result = new Intent();
+ result.setClass(this, SupportVectorDrawableDemos.class);
+ result.putExtra("com.example.android.apis.Path", path);
+ return result;
+ }
+
+ protected void addItem(List<Map<String, Object>> data, String name, Intent intent) {
+ Map<String, Object> temp = new HashMap<String, Object>();
+ temp.put("title", name);
+ temp.put("intent", intent);
+ data.add(temp);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ Map<String, Object> map = (Map<String, Object>) l.getItemAtPosition(position);
+
+ Intent intent = (Intent) map.get("intent");
+ startActivity(intent);
+ }
+}
diff --git a/settings.gradle b/settings.gradle
index 41d466e..1597c2e 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -132,6 +132,9 @@
include ':support-v13-demos'
project(':support-v13-demos').projectDir = new File(samplesRoot, 'Support13Demos')
+include ':support-vector-drawable-demos'
+project(':support-vector-drawable-demos').projectDir = new File(samplesRoot, 'SupportVectorDrawableDemos')
+
/////////////////////////////
//
// External
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/BaseGridView.java b/v17/leanback/src/android/support/v17/leanback/widget/BaseGridView.java
index b19458b..08c4b88 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/BaseGridView.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/BaseGridView.java
@@ -197,7 +197,7 @@
/**
* Number of items to prefetch when first coming on screen with new data.
*/
- int mInitialItemPrefetchCount = 4;
+ int mInitialPrefetchItemCount = 4;
public BaseGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
@@ -1063,12 +1063,12 @@
*
* @param itemCount Number of items to prefetch
*
- * @see #getInitialItemPrefetchCount()
+ * @see #getInitialPrefetchItemCount()
* @see RecyclerView.LayoutManager#isItemPrefetchEnabled()
* @see RecyclerView.LayoutManager#collectInitialPrefetchPositions(int, RecyclerView.LayoutManager.LayoutPrefetchRegistry)
*/
public void setInitialPrefetchItemCount(int itemCount) {
- mInitialItemPrefetchCount = itemCount;
+ mInitialPrefetchItemCount = itemCount;
}
/**
@@ -1083,7 +1083,7 @@
*
* @return number of items to prefetch.
*/
- public int getInitialItemPrefetchCount() {
- return mInitialItemPrefetchCount;
+ public int getInitialPrefetchItemCount() {
+ return mInitialPrefetchItemCount;
}
}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java b/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
index fc7c890..1b03462 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
@@ -2240,7 +2240,7 @@
@Override
public void collectInitialPrefetchPositions(int adapterItemCount,
LayoutPrefetchRegistry layoutPrefetchRegistry) {
- int numToPrefetch = mBaseGridView.mInitialItemPrefetchCount;
+ int numToPrefetch = mBaseGridView.mInitialPrefetchItemCount;
if (adapterItemCount != 0 && numToPrefetch != 0) {
// prefetch items centered around mFocusPosition
int initialPos = Math.max(0, Math.min(mFocusPosition - (numToPrefetch - 1)/ 2,
diff --git a/v17/leanback/tests/java/android/support/v17/leanback/widget/GridWidgetPrefetchTest.java b/v17/leanback/tests/java/android/support/v17/leanback/widget/GridWidgetPrefetchTest.java
index 4b075ea..fcb264e 100644
--- a/v17/leanback/tests/java/android/support/v17/leanback/widget/GridWidgetPrefetchTest.java
+++ b/v17/leanback/tests/java/android/support/v17/leanback/widget/GridWidgetPrefetchTest.java
@@ -248,11 +248,11 @@
view.setAdapter(createBoxAdapter());
// check default
- assertEquals(4, view.getInitialItemPrefetchCount());
+ assertEquals(4, view.getInitialPrefetchItemCount());
// check setter behavior
view.setInitialPrefetchItemCount(0);
- assertEquals(0, view.getInitialItemPrefetchCount());
+ assertEquals(0, view.getInitialPrefetchItemCount());
// check positions fetched, relative to focus
view.scrollToPosition(2);
diff --git a/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java b/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
index 47f7954..b4419cc 100644
--- a/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
+++ b/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
@@ -148,7 +148,7 @@
/**
* Number of items to prefetch when first coming on screen with new data.
*/
- private int mInitialItemPrefetchCount = 2;
+ private int mInitialPrefetchItemCount = 2;
/**
* Creates a vertical LinearLayoutManager
@@ -1229,7 +1229,7 @@
? LayoutState.ITEM_DIRECTION_HEAD
: LayoutState.ITEM_DIRECTION_TAIL;
int targetPos = anchorPos;
- for (int i = 0; i < mInitialItemPrefetchCount; i++) {
+ for (int i = 0; i < mInitialPrefetchItemCount; i++) {
if (targetPos >= 0 && targetPos < adapterItemCount) {
layoutPrefetchRegistry.addPosition(targetPos, 0);
} else {
@@ -1265,11 +1265,11 @@
* @param itemCount Number of items to prefetch
*
* @see #isItemPrefetchEnabled()
- * @see #getInitialItemPrefetchCount()
+ * @see #getInitialPrefetchItemCount()
* @see #collectInitialPrefetchPositions(int, LayoutPrefetchRegistry)
*/
public void setInitialPrefetchItemCount(int itemCount) {
- mInitialItemPrefetchCount = itemCount;
+ mInitialPrefetchItemCount = itemCount;
}
/**
@@ -1284,8 +1284,17 @@
*
* @return number of items to prefetch.
*/
+ public int getInitialPrefetchItemCount() {
+ return mInitialPrefetchItemCount;
+ }
+
+
+ /**
+ * @deprecated Use {@link #getInitialPrefetchItemCount()} instead.
+ */
+ @Deprecated
public int getInitialItemPrefetchCount() {
- return mInitialItemPrefetchCount;
+ return getInitialPrefetchItemCount();
}
@Override
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewCacheTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewCacheTest.java
index 2ef2783..1b85884 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewCacheTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewCacheTest.java
@@ -787,7 +787,7 @@
@Test
public void nestedPrefetchSimple() {
LinearLayoutManager llm = new LinearLayoutManager(getContext());
- assertEquals(2, llm.getInitialItemPrefetchCount());
+ assertEquals(2, llm.getInitialPrefetchItemCount());
mRecyclerView.setLayoutManager(llm);
mRecyclerView.setAdapter(new OuterAdapter());
@@ -1079,7 +1079,7 @@
@Test
public void nestedPrefetchDiscardStaleChildren() {
LinearLayoutManager llm = new LinearLayoutManager(getContext());
- assertEquals(2, llm.getInitialItemPrefetchCount());
+ assertEquals(2, llm.getInitialPrefetchItemCount());
mRecyclerView.setLayoutManager(llm);
OuterNotifyAdapter outerAdapter = new OuterNotifyAdapter();