@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); adjustBounds(); }
private void adjustBounds() { if (mCollapsingTextHelper == null || getEditText() == null) { return; } try { mBounds.left = getEditText().getLeft() + getEditText().getPaddingLeft(); mRecalculateMethod.invoke(mCollapsingTextHelper); } catch (InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { // No need to overreact here - this will result in the animation rendering differently e.printStackTrace(); } }
@Test public void init_successfullyFindsFields() { ActivityController<CardInputTestActivity> activityController = Robolectric.buildActivity(CardInputTestActivity.class).create().start(); IconTextInputLayout iconTextInputLayout = activityController.get().getCardMultilineWidget() .findViewById(R.id.tl_add_source_card_number_ml); assertTrue(iconTextInputLayout.hasObtainedCollapsingTextHelper()); } }