當前位置: 首頁>>代碼示例>>Java>>正文


Java Property類代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:27,代碼來源:Workspace.java

示例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;
}
 
開發者ID:resourcepool,項目名稱:dashboard,代碼行數:18,代碼來源:AnimatorFactory.java

示例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);
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:21,代碼來源:gyo.java

示例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;
    }
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:18,代碼來源:gyo.java

示例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;
}
 
開發者ID:Tombarr,項目名稱:Noyze,代碼行數:30,代碼來源:SettingsHelper.java

示例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;
}
 
開發者ID:ccliu2015,項目名稱:love,代碼行數:30,代碼來源:SqlBuilder.java

示例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;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:18,代碼來源:VsActivityAnimationHelper.java

示例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;
}
 
開發者ID:kingargyle,項目名稱:adt-leanback-support,代碼行數:18,代碼來源:Slide.java

示例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);
    }
}
 
開發者ID:plusCubed,項目名稱:plusTimer,代碼行數:26,代碼來源:CurrentSessionTimerFragment.java

示例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);
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:ButterKnife.java

示例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;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:8,代碼來源:LauncherAnimUtils.java

示例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());
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:16,代碼來源:Workspace.java

示例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;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:11,代碼來源:WXAnimationBean.java

示例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)));
  }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:9,代碼來源:WXAnimationBean.java

示例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;
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:10,代碼來源:WXAnimationBean.java


注:本文中的android.util.Property類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。