本文整理汇总了Java中android.util.Property类的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Property类属于android.util包,在下文中一共展示了Property类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setWorkspaceTranslationAndAlpha
import android.util.Property; //导入依赖的package包/类
/**
* 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);
}
}
}
示例2: createTranslateAnimatorWithScaling
import android.util.Property; //导入依赖的package包/类
private static AnimatorSet createTranslateAnimatorWithScaling(View view, Property<View, Float> translateProperty, Property<View, Float> scaleProperty, float start, float end, float scale, int duration) {
Animator translateAnimator = ObjectAnimator.ofFloat(view, translateProperty, start, end);
translateAnimator.setDuration(duration);
Animator scaleAnimator1 = ObjectAnimator.ofFloat(view, scaleProperty, 1, scale);
scaleAnimator1.setDuration(duration / 2);
Animator scaleAnimator2 = ObjectAnimator.ofFloat(view, scaleProperty, scale, 1);
scaleAnimator2.setDuration(duration / 2);
AnimatorSet scaleAnimatorSet = new AnimatorSet();
scaleAnimatorSet.playSequentially(scaleAnimator1, scaleAnimator2);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(translateAnimator, scaleAnimatorSet);
return animatorSet;
}
示例3: gyo
import android.util.Property; //导入依赖的package包/类
public gyo()
{
Map localMap1 = this.c;
Property[] arrayOfProperty1 = new Property[2];
arrayOfProperty1[0] = gyt.a;
arrayOfProperty1[1] = gyt.b;
localMap1.put("position", arrayOfProperty1);
this.d.put("position", new String[] { "x", "y" });
Map localMap2 = this.c;
Property[] arrayOfProperty2 = new Property[2];
arrayOfProperty2[0] = View.SCALE_X;
arrayOfProperty2[1] = View.SCALE_Y;
localMap2.put("scale", arrayOfProperty2);
this.d.put("scale", new String[] { "sx", "sy" });
Map localMap3 = this.c;
Property[] arrayOfProperty3 = new Property[1];
arrayOfProperty3[0] = View.ALPHA;
localMap3.put("opacity", arrayOfProperty3);
this.d.put("opacity", null);
}
示例4: a
import android.util.Property; //导入依赖的package包/类
static float a(gyp paramgyp, Property<?, ?> paramProperty, double paramDouble)
{
if (!paramgyp.a(paramProperty)) {
throw new bm("Cannot animate position if stage size was not defined");
}
float f = 1.0F;
if (paramProperty == gyt.a) {
f = paramgyp.a;
}
for (;;)
{
return f * (float)paramDouble;
if (paramProperty == gyt.b) {
f = paramgyp.b;
}
}
}
示例5: getProperty
import android.util.Property; //导入依赖的package包/类
/**
* Retrieves the value stored in {@link android.content.SharedPreferences} for a
* given {@link android.util.Property} associated with a VolumePanel.
* @return The given value, {@code defVal} if none was set, or null is the
* value could not be retrieved.
* @throws ClassCastException If a type error occurred between SP and Property.
*/
@SuppressWarnings("unchecked")
public <T, E> E getProperty(Class<T> clazz, Property<T, E> property, E defVal)
throws ClassCastException {
Class<E> type = property.getType();
String name = getName(clazz, property);
// Handle all types supported by SharedPreferences.
if (type.equals(Integer.TYPE) || type.equals(Integer.class))
return (E) Integer.valueOf(mPreferences.getInt(name, (Integer) defVal));
else if (type.equals(String.class) || type.equals(CharSequence.class))
return (E) mPreferences.getString(name, ((defVal == null) ? (String) defVal : defVal.toString()));
else if (type.equals(Boolean.TYPE) || type.equals(Boolean.class))
return (E) Boolean.valueOf(mPreferences.getBoolean(name, (Boolean) defVal));
else if (type.equals(Long.TYPE) || type.equals(Long.class))
return (E) Long.valueOf(mPreferences.getLong(name, (Long) defVal));
else if (type.equals(Float.TYPE) || type.equals(Float.class))
return (E) Float.valueOf(mPreferences.getFloat(name, (Float) defVal));
else if (type.getClass().isAssignableFrom(Set.class))
return (E) mPreferences.getStringSet(name, (Set<String>) defVal);
return defVal;
}
示例6: cursor2Entity
import android.util.Property; //导入依赖的package包/类
/**
* 将游标转换为业务实体
* @param cursor
* @param table
* @return
*/
public static <T> T cursor2Entity(Cursor cursor, String table){
try {
if(cursor!=null ){
Class<?> clazz = ReflectBeanUtil.getClazzByBeanName(geneClassName(table));
T entity = (T) clazz.newInstance();
Map<String, Field> fields = ReflectBeanUtil.getFields(geneClassName(table));
int columnCount = cursor.getColumnCount();
if(columnCount>0){
for(int i=0;i<columnCount;i++){
String column = cursor.getColumnName(i);
String value = cursor.getString(i);
Field field = fields.get(column);
Property property = Property.of(clazz, field.getType(), column);
property.set(entity, value);
}
return entity;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
示例7: getOpponentSlideOutAnimator
import android.util.Property; //导入依赖的package包/类
private static AnimatorSet getOpponentSlideOutAnimator(Activity paramActivity, Point paramPoint)
{
AnimatorSet localAnimatorSet = new AnimatorSet();
View localView1 = paramActivity.findViewById(2131296583);
Property localProperty1 = View.TRANSLATION_X;
float[] arrayOfFloat1 = new float[2];
arrayOfFloat1[0] = 0.0F;
arrayOfFloat1[1] = paramPoint.x;
ObjectAnimator localObjectAnimator = ObjectAnimator.ofFloat(localView1, localProperty1, arrayOfFloat1);
View localView2 = paramActivity.findViewById(2131296272);
Property localProperty2 = View.TRANSLATION_X;
float[] arrayOfFloat2 = new float[2];
arrayOfFloat2[0] = 0.0F;
arrayOfFloat2[1] = paramPoint.x;
localAnimatorSet.playTogether(new Animator[] { localObjectAnimator, ObjectAnimator.ofFloat(localView2, localProperty2, arrayOfFloat2) });
return localAnimatorSet;
}
示例8: createAnimation
import android.util.Property; //导入依赖的package包/类
private Animator createAnimation(final View view, Property<View, Float> property,
float start, float end, float terminalValue, TimeInterpolator interpolator,
int finalVisibility) {
float[] startPosition = (float[]) view.getTag(R.id.lb_slide_transition_value);
if (startPosition != null) {
start = View.TRANSLATION_Y == property ? startPosition[1] : startPosition[0];
view.setTag(R.id.lb_slide_transition_value, null);
}
final ObjectAnimator anim = ObjectAnimator.ofFloat(view, property, start, end);
SlideAnimatorListener listener = new SlideAnimatorListener(view, property, terminalValue, end,
finalVisibility);
anim.addListener(listener);
anim.addPauseListener(listener);
anim.setInterpolator(interpolator);
return anim;
}
示例9: invalidateScrambleShadow
import android.util.Property; //导入依赖的package包/类
private void invalidateScrambleShadow(final boolean overrideShowShadow) {
Runnable animate = () -> {
if (mScrambleElevationAnimator != null) {
mScrambleElevationAnimator.cancel();
}
Property<View, Float> property;
View view;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
property = View.TRANSLATION_Z;
view = mScrambleText;
} else {
property = View.ALPHA;
view = mScrambleTextShadow;
}
mScrambleElevationAnimator = ObjectAnimator.ofFloat(view,
property, getScrambleTextElevationOrShadowAlpha(overrideShowShadow));
mScrambleElevationAnimator.setDuration(150);
mScrambleElevationAnimator.start();
};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mScrambleText.postOnAnimation(animate);
} else {
mScrambleText.post(animate);
}
}
示例10: apply
import android.util.Property; //导入依赖的package包/类
/**
* Apply the specified {@code value} across the {@code list} of views using the {@code property}.
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) // http://b.android.com/213630
@RequiresApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@UiThread
public static <T extends View, V> void apply(@NonNull List<T> list,
@NonNull Property<? super T, V> setter, V value) {
//noinspection ForLoopReplaceableByForEach
for (int i = 0, count = list.size(); i < count; i++) {
setter.set(list.get(i), value);
}
}
示例11: ofFloat
import android.util.Property; //导入依赖的package包/类
public static ObjectAnimator ofFloat(View target, Property<View, Float> property,
float... values) {
ObjectAnimator anim = ObjectAnimator.ofFloat(target, property, values);
cancelOnDestroyActivity(anim);
new FirstFrameAnimatorHelper(anim, target);
return anim;
}
示例12: setHotseatTranslationAndAlpha
import android.util.Property; //导入依赖的package包/类
/**
* 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());
}
示例13: createDefaultTransform
import android.util.Property; //导入依赖的package包/类
private static @NonNull Map<Property<View, Float>, Float> createDefaultTransform(){
Map<Property<View, Float>, Float> defaultMap=
WXDataStructureUtil.newHashMapWithExpectedSize(5);
defaultMap.put(View.TRANSLATION_X, 0f);
defaultMap.put(View.TRANSLATION_Y, 0f);
defaultMap.put(View.SCALE_X, 1f);
defaultMap.put(View.SCALE_Y, 1f);
defaultMap.put(View.ROTATION, 0f);
return defaultMap;
}
示例14: initHolders
import android.util.Property; //导入依赖的package包/类
private void initHolders(){
for (Map.Entry<Property<View, Float>, Float> entry : transformMap.entrySet()) {
holders.add(PropertyValuesHolder.ofFloat(entry.getKey(), entry.getValue()));
}
if (!TextUtils.isEmpty(opacity)) {
holders.add(PropertyValuesHolder.ofFloat(View.ALPHA, WXUtils.fastGetFloat(opacity, 3)));
}
}
示例15: createDefaultTransform
import android.util.Property; //导入依赖的package包/类
private static @NonNull Map<Property<View, Float>, Float> createDefaultTransform(){
Map<Property<View, Float>, Float> defaultMap= new ArrayMap<>(5);
defaultMap.put(View.TRANSLATION_X, 0f);
defaultMap.put(View.TRANSLATION_Y, 0f);
defaultMap.put(View.SCALE_X, 1f);
defaultMap.put(View.SCALE_Y, 1f);
defaultMap.put(View.ROTATION, 0f);
return defaultMap;
}