Java Code Examples for android.view.View#setHasTransientState()

The following examples show how to use android.view.View#setHasTransientState() . 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: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example 2
Source File: AdapterViewAnimator.java    From adapterviewanimator with Apache License 2.0 5 votes vote down vote up
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);
  }
}
 
Example 3
Source File: CircleVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: CircleVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example 6
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example 7
Source File: Transition.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
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);
            }
        }
    }
}
 
Example 8
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example 9
Source File: CircleVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: CircleVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 11
Source File: VisibilityEventsTest.java    From litho with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 12
Source File: ViewCompatJB.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
Example 13
Source File: ViewCompatJB.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
Example 14
Source File: am.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public static void a(View view, boolean flag)
{
    view.setHasTransientState(flag);
}
 
Example 15
Source File: AcceleratedTransitionListener.java    From Noyze with Apache License 2.0 4 votes vote down vote up
public static void setTransientState(List<View> views, boolean hasState) {
    for (View view : views)
        view.setHasTransientState(hasState);
}
 
Example 16
Source File: AcceleratedTransitionListener.java    From Noyze with Apache License 2.0 4 votes vote down vote up
public static void setTransientState(List<View> views, boolean hasState) {
    for (View view : views)
        view.setHasTransientState(hasState);
}
 
Example 17
Source File: ViewCompatJB.java    From letv with Apache License 2.0 4 votes vote down vote up
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
Example 18
Source File: ViewCompatJB.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
Example 19
Source File: ViewCompatJB.java    From guideshow with MIT License 4 votes vote down vote up
public static void setHasTransientState(View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}
 
Example 20
Source File: ViewUtils.java    From Transitions-Everywhere with Apache License 2.0 4 votes vote down vote up
@Override
public void setHasTransientState(@NonNull View view, boolean hasTransientState) {
    view.setHasTransientState(hasTransientState);
}