android.view.View#setHasTransientState ( )源码实例Demo

下面列出了android.view.View#setHasTransientState ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: Transition.java
static void addViewValues(TransitionValuesMaps transitionValuesMaps,
        View view, TransitionValues transitionValues) {
    transitionValuesMaps.viewValues.put(view, transitionValues);
    int id = view.getId();
    if (id >= 0) {
        if (transitionValuesMaps.idValues.indexOfKey(id) >= 0) {
            // Duplicate IDs cannot match by ID.
            transitionValuesMaps.idValues.put(id, null);
        } else {
            transitionValuesMaps.idValues.put(id, view);
        }
    }
    String name = view.getTransitionName();
    if (name != null) {
        if (transitionValuesMaps.nameValues.containsKey(name)) {
            // Duplicate transitionNames: cannot match by transitionName.
            transitionValuesMaps.nameValues.put(name, null);
        } else {
            transitionValuesMaps.nameValues.put(name, view);
        }
    }
    if (view.getParent() instanceof ListView) {
        ListView listview = (ListView) view.getParent();
        if (listview.getAdapter().hasStableIds()) {
            int position = listview.getPositionForView(view);
            long itemId = listview.getItemIdAtPosition(position);
            if (transitionValuesMaps.itemIdValues.indexOfKey(itemId) >= 0) {
                // Duplicate item IDs: cannot match by item ID.
                View alreadyMatched = transitionValuesMaps.itemIdValues.get(itemId);
                if (alreadyMatched != null) {
                    alreadyMatched.setHasTransientState(false);
                    transitionValuesMaps.itemIdValues.put(itemId, null);
                }
            } else {
                view.setHasTransientState(true);
                transitionValuesMaps.itemIdValues.put(itemId, view);
            }
        }
    }
}
 
源代码2 项目: litho   文件: VisibilityEventsTest.java
@Test
public void
    visibilityOutputs_setTransientStateFalse_parentInTransientState_processVisibilityOutputs() {
  final TestComponent content = create(mContext).build();
  final EventHandler<VisibleEvent> visibleEventHandler = new EventHandler<>(content, 2);
  final Component root =
      Column.create(mContext)
          .child(
              Wrapper.create(mContext)
                  .delegate(content)
                  .visibleHandler(visibleEventHandler)
                  .widthPx(10)
                  .heightPx(10))
          .build();

  final View view = (View) mLithoView.getParent();
  view.setHasTransientState(true);

  mLithoViewRule
      .useComponentTree(ComponentTree.create(mContext).build())
      .setRoot(root)
      .attachToWindow()
      .setSizeSpecs(makeSizeSpec(100, EXACTLY), makeSizeSpec(100, EXACTLY))
      .measure()
      .layout();

  mLithoView.notifyVisibleBoundsChanged(new Rect(0, -10, 10, -5), true);
  content.getDispatchedEventHandlers().clear();

  mLithoView.setHasTransientState(true);
  assertThat(content.getDispatchedEventHandlers()).doesNotContain(visibleEventHandler);

  mLithoView.setMountStateDirty();
  mLithoView.notifyVisibleBoundsChanged(new Rect(0, -10, 10, -5), true);
  assertThat(content.getDispatchedEventHandlers()).doesNotContain(visibleEventHandler);

  mLithoView.setHasTransientState(false);
  assertThat(content.getDispatchedEventHandlers()).contains(visibleEventHandler);
  view.setHasTransientState(false);
}
 
源代码3 项目: Noyze   文件: CircleVolumePanel.java
protected Animator shuffle(View target) {
    LOGI(TAG, "shuffle()");
    final int duration = Resources.getSystem().getInteger(android.R.integer.config_mediumAnimTime);
    ObjectAnimator rotation = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0);
    rotation.setDuration(duration);
    rotation.setStartDelay(duration / 4);
    target.setHasTransientState(true);
    return rotation;
}
 
源代码4 项目: Noyze   文件: CircleVolumePanel.java
protected Animator wiggle(View target) {
    LOGI(TAG, "wiggle()");
    final int duration = Resources.getSystem().getInteger(android.R.integer.config_mediumAnimTime);
    ObjectAnimator rotation = ObjectAnimator.ofFloat(target, View.ROTATION, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0);
    rotation.setDuration(duration);
    rotation.setStartDelay(duration / 4);
    target.setHasTransientState(true);
    return rotation;
}
 
源代码5 项目: Pimp_my_Z1   文件: Card.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public View getView(Context context, boolean swipable) {

    View view = LayoutInflater.from(context).inflate(getCardLayout(), null);

    mCardLayout = view;

    try {
        if (view != null) ((FrameLayout) view.findViewById(R.id.cardContent))
                .addView(getCardContent(context));
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

    // ((TextView) view.findViewById(R.id.title)).setText(this.title);

    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    int bottom = Utils.convertDpToPixelInt(context, 12);
    lp.setMargins(0, 0, 0, bottom);

    if (view != null) {
        view.setLayoutParams(lp);
        view.setHasTransientState(true);
    }

    return view;
}
 
源代码6 项目: Pimp_my_Z1   文件: Card.java
@SuppressLint("NewApi")
@Override
public View getView(Context context) {

    View view = LayoutInflater.from(context).inflate(getCardLayout(), null);

    mCardLayout = view;

    try {
        if (view != null) ((FrameLayout) view.findViewById(R.id.cardContent))
                .addView(getCardContent(context));
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

    // ((TextView) view.findViewById(R.id.title)).setText(this.title);

    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    int bottom = Utils.convertDpToPixelInt(context, 12);
    lp.setMargins(0, 0, 0, bottom);

    if (view != null) {
        view.setLayoutParams(lp);
        view.setHasTransientState(true);
    }

    return view;
}
 
源代码7 项目: Pimp_my_Z1   文件: Card.java
@SuppressLint("NewApi")
public View getViewLast(Context context) {

    View view = LayoutInflater.from(context).inflate(getLastCardLayout(),
            null);

    mCardLayout = view;

    try {
        if (view != null) ((FrameLayout) view.findViewById(R.id.cardContent))
                .addView(getCardContent(context));
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

    // ((TextView) view.findViewById(R.id.title)).setText(this.title);

    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    int bottom = Utils.convertDpToPixelInt(context, 12);
    lp.setMargins(0, 0, 0, bottom);

    if (view != null) {
        view.setLayoutParams(lp);
        view.setHasTransientState(true);
    }
    return view;
}
 
源代码8 项目: Pimp_my_Z1   文件: Card.java
@SuppressLint("NewApi")
public View getViewFirst(Context context) {

    View view = LayoutInflater.from(context).inflate(getFirstCardLayout(),
            null);

    mCardLayout = view;

    try {
        if (view != null) ((FrameLayout) view.findViewById(R.id.cardContent))
                .addView(getCardContent(context));
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

    // ((TextView) view.findViewById(R.id.title)).setText(this.title);

    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    int bottom = Utils.convertDpToPixelInt(context, 12);
    lp.setMargins(0, 0, 0, bottom);

    if (view != null) {
        view.setLayoutParams(lp);
        view.setHasTransientState(true);
    }

    return view;
}
 
源代码9 项目: Noyze   文件: CircleVolumePanel.java
protected Animator shuffle(View target) {
    LOGI(TAG, "shuffle()");
    final int duration = Resources.getSystem().getInteger(android.R.integer.config_mediumAnimTime);
    ObjectAnimator rotation = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0);
    rotation.setDuration(duration);
    rotation.setStartDelay(duration / 4);
    target.setHasTransientState(true);
    return rotation;
}
 
源代码10 项目: Noyze   文件: CircleVolumePanel.java
protected Animator wiggle(View target) {
    LOGI(TAG, "wiggle()");
    final int duration = Resources.getSystem().getInteger(android.R.integer.config_mediumAnimTime);
    ObjectAnimator rotation = ObjectAnimator.ofFloat(target, View.ROTATION, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0, -5, 0, 5, 0);
    rotation.setDuration(duration);
    rotation.setStartDelay(duration / 4);
    target.setHasTransientState(true);
    return rotation;
}
 
源代码11 项目: adapterviewanimator   文件: AdapterViewAnimator.java
private void beforeDataSetChanged() {
  Adapter adapter = adapterView.getAdapter();
  final int firstVisiblePosition = adapterView.getFirstVisiblePosition();
  for (int i = 0, childCount = adapterView.getChildCount(); i < childCount; i++) {
    final int position = firstVisiblePosition + i;
    final long id = adapter.getItemId(position);
    final View child = adapterView.getChildAt(i);
    Rect r = new Rect(child.getLeft(), child.getTop(), child.getRight(), child.getBottom());
    child.setHasTransientState(true);
    viewBounds.put(id, r);
    idToViewMap.put(id, child);
  }
}
 
源代码12 项目: letv   文件: ViewCompatJB.java
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
源代码13 项目: Noyze   文件: AcceleratedTransitionListener.java
public static void setTransientState(List<View> views, boolean hasState) {
    for (View view : views)
        view.setHasTransientState(hasState);
}
 
源代码14 项目: MiBandDecompiled   文件: am.java
public static void a(View view, boolean flag)
{
    view.setHasTransientState(flag);
}
 
源代码15 项目: CodenameOne   文件: ViewCompatJB.java
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
源代码16 项目: adt-leanback-support   文件: ViewCompatJB.java
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
源代码17 项目: Noyze   文件: AcceleratedTransitionListener.java
public static void setTransientState(List<View> views, boolean hasState) {
    for (View view : views)
        view.setHasTransientState(hasState);
}
 
源代码18 项目: V.FlyoutTest   文件: ViewCompatJB.java
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
源代码19 项目: guideshow   文件: ViewCompatJB.java
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
源代码20 项目: Transitions-Everywhere   文件: ViewUtils.java
@Override
public void setHasTransientState(@NonNull View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
 方法所在类
 同类方法