Java Code Examples for android.util.Property#set()
The following examples show how to use
android.util.Property#set() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Workspace.java From LaunchEnr with GNU General Public License v3.0 | 6 votes |
/** * Moves the workspace UI in the provided direction. * @param direction the direction to move the workspace * @param translation the amount of shift. * @param alpha the alpha for the workspace page */ private void setWorkspaceTranslationAndAlpha(Direction direction, float translation, float alpha) { Property<View, Float> property = direction.viewProperty; mPageAlpha[direction.ordinal()] = alpha; float finalAlpha = mPageAlpha[0] * mPageAlpha[1]; View currentChild = getChildAt(getCurrentPage()); if (currentChild != null) { property.set(currentChild, translation); currentChild.setAlpha(finalAlpha); } // When the animation finishes, reset all pages, just in case we missed a page. if (Float.compare(translation, 0) == 0) { for (int i = getChildCount() - 1; i >= 0; i--) { View child = getChildAt(i); property.set(child, translation); child.setAlpha(finalAlpha); } } }
Example 2
Source File: ViewAnimationBuilder.java From scene with Apache License 2.0 | 5 votes |
protected void onProgress(float progress) { Set<Property<View, Float>> set = hashMap.keySet(); for (Property<View, Float> property : set) { Pair<Float, Float> value = hashMap.get(property); property.set(mView, value.first + (value.second * progress)); } }
Example 3
Source File: DrawableAnimationBuilder.java From scene with Apache License 2.0 | 5 votes |
public InteractionAnimation build() { return new InteractionAnimation(this.mEndProgress) { @Override public void onProgress(float progress) { Set<Property> set = hashMap.keySet(); for (Property property : set) { Holder value = hashMap.get(property); property.set(mDrawable, value.typeEvaluator.evaluate(progress, value.fromValue, value.toValue)); } } }; }
Example 4
Source File: ViewOtherAnimationBuilder.java From scene with Apache License 2.0 | 5 votes |
@Override protected void onProgress(float progress) { super.onProgress(progress); Set<Property> set = hashMap.keySet(); for (Property property : set) { Holder value = hashMap.get(property); property.set(mView, value.typeEvaluator.evaluate(progress, value.fromValue, value.toValue)); } }
Example 5
Source File: InteractionAnimationBuilder.java From scene with Apache License 2.0 | 5 votes |
public InteractionAnimation build() { return new InteractionAnimation(mEndProgress) { @Override public void onProgress(float progress) { Set<Property<View, Float>> set = hashMap.keySet(); for (Property<View, Float> property : set) { Pair<Float, Float> value = hashMap.get(property); property.set(mView, value.first + (value.second * progress)); } } }; }
Example 6
Source File: ImageViewAnimationBuilder.java From scene with Apache License 2.0 | 5 votes |
@Override protected void onProgress(float progress) { super.onProgress(progress); Set<Property> set = hashMap.keySet(); for (Property property : set) { Holder value = hashMap.get(property); property.set(mView, value.typeEvaluator.evaluate(progress, value.fromValue, value.toValue)); } }
Example 7
Source File: Workspace.java From LaunchEnr with GNU General Public License v3.0 | 5 votes |
/** * Moves the Hotseat UI in the provided direction. * @param direction the direction to move the workspace * @param translation the amount of shift. * @param alpha the alpha for the hotseat page */ public void setHotseatTranslationAndAlpha(Direction direction, float translation, float alpha) { Property<View, Float> property = direction.viewProperty; // Skip the page indicator movement in the vertical bar layout if (direction != Direction.Y || !mLauncher.getDeviceProfile().isVerticalBarLayout()) { property.set(mPageIndicator, translation); } property.set(mLauncher.getHotseat(), translation); setHotseatAlphaAtIndex(alpha, direction.ordinal()); }
Example 8
Source File: ViewRouter.java From android-router with MIT License | 5 votes |
private <T extends View> T createView(Class<T> cls, Map<String, String> props) { try { T v = cls.getConstructor(Context.class).newInstance(mParent.getContext()); // copy parsed uri params into the view properties for (Map.Entry<String, String> p : props.entrySet()) { Property<T, String> property = Property.of(cls, String.class, p.getKey()); property.set(v, p.getValue()); } return v; } catch (NoSuchMethodException|InstantiationException| IllegalAccessException|InvocationTargetException e) { throw new RuntimeException(e); } }
Example 9
Source File: AnimatorUtils.java From Transitions-Everywhere with Apache License 2.0 | 5 votes |
@Override @Nullable public ObjectAnimator ofFloat(@Nullable View view, @NonNull Property<View, Float> property, float startFraction, float endFraction) { float start = property.get(view) * startFraction; float end = property.get(view) * endFraction; if (start == end) { return null; } property.set(view, start); return ObjectAnimator.ofFloat(view, property, end); }
Example 10
Source File: AnimatorUtils.java From Transitions-Everywhere with Apache License 2.0 | 5 votes |
@Override @Nullable public ObjectAnimator ofInt(@Nullable View view, @NonNull Property<View, Integer> property, float startFraction, float endFraction) { int start = (int) (property.get(view) * startFraction); int end = (int) (property.get(view) * endFraction); if (start == end) { return null; } property.set(view, start); return ObjectAnimator.ofInt(view, property, end); }
Example 11
Source File: ViewCollections.java From butterknife with Apache License 2.0 | 5 votes |
/** * Apply the specified {@code value} across the {@code list} of views using the {@code property}. */ @UiThread public static <T extends View, V> void set(@NonNull List<T> list, @NonNull Property<? super T, V> setter, @Nullable V value) { //noinspection ForLoopReplaceableByForEach for (int i = 0, count = list.size(); i < count; i++) { setter.set(list.get(i), value); } }
Example 12
Source File: ViewCollections.java From butterknife with Apache License 2.0 | 5 votes |
/** * Apply the specified {@code value} across the {@code array} of views using the {@code property}. */ @UiThread public static <T extends View, V> void set(@NonNull T[] array, @NonNull Property<? super T, V> setter, @Nullable V value) { //noinspection ForLoopReplaceableByForEach for (int i = 0, count = array.length; i < count; i++) { setter.set(array[i], value); } }
Example 13
Source File: ViewCollections.java From butterknife with Apache License 2.0 | 4 votes |
/** Apply {@code value} to {@code view} using {@code property}. */ @UiThread public static <T extends View, V> void set(@NonNull T view, @NonNull Property<? super T, V> setter, @Nullable V value) { setter.set(view, value); }