List of usage examples for android.widget LinearLayout setTranslationY
public void setTranslationY(float translationY)
From source file:com.geofbot.views.web.BottomBarBehavior.java
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, LinearLayout child, View dependency) { if (defaultDependencyTop == -1) { defaultDependencyTop = dependency.getTop(); }//from w w w. j a v a 2s . c o m child.setTranslationY(-dependency.getTop() + defaultDependencyTop); return true; }
From source file:com.sociablue.nanodegree_p1.MovieDetailPagerFragment.java
private void setupEnterAnimations() { int id = mMovieList.get(mCurrentPosition).getId(); View currentPage = mPager.findViewWithTag(id); FrameLayout imgContainer = (FrameLayout) currentPage.findViewById(R.id.details_img_container); imgContainer.setTranslationY(-imgContainer.getMeasuredHeight()); LinearLayout contentContainer = (LinearLayout) currentPage.findViewById(R.id.details_copy_container); contentContainer.setTranslationY(contentContainer.getMeasuredHeight()); }
From source file:com.woodblockwithoutco.quickcontroldock.ui.factory.ServiceViewFactory.java
@SuppressWarnings("deprecation") public View getServiceView() { boolean sameLayout = GeneralResolver.isSameLayoutForLandscape(mContext); int inflateId = 0; if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT || sameLayout) { inflateId = R.layout.panel_layout; } else {//from w w w . jav a 2 s . c o m inflateId = R.layout.panel_layout_land; } View view = LayoutInflater.from(mContext).inflate(inflateId, null, false); final DragViewGroup dragView = (DragViewGroup) view.findViewById(R.id.panel_drag_handler); dragView.setBackgroundDrawable(ColorsResolver.getBackgroundDrawable(mContext)); if (ConstantHolder.getIsDebug()) { initTestVersionText(dragView); } ViewGroup viewToHide; if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT || sameLayout) { LinearLayout panelsContainer = (LinearLayout) dragView.findViewById(R.id.panels_container); viewToHide = panelsContainer; if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT) { panelsContainer.setTranslationY(GeneralResolver.getPanelsOffset(mContext)); } List<String> panelsOrder = PanelsOrderResolver.getPanelsOrder(mContext); if (ShortcutsResolver.isShortcutsEnabled(mContext)) { ShortcutsViewFactory svFactory = new ShortcutsViewFactory(mContext); int id = getContainerIdForPanelType(panelsOrder, PanelType.SHORTCUTS.name()); FrameLayout section = (FrameLayout) view.findViewById(id); adjustPanelMargins(section); section.addView(svFactory.getShortcutsSectionView()); } if (MusicResolver.isMusicPanelEnabled(mContext)) { MusicViewFactory mvFactory = new MusicViewFactory(mContext); int id = getContainerIdForPanelType(panelsOrder, PanelType.MUSIC.name()); FrameLayout section = (FrameLayout) view.findViewById(id); adjustPanelMargins(section); section.addView(mvFactory.getMusicView()); } if (TogglesResolver.isTogglesEnabled(mContext)) { TogglesViewFactory tvFactory = new TogglesViewFactory(mContext); int id = getContainerIdForPanelType(panelsOrder, PanelType.TOGGLES.name()); FrameLayout section = (FrameLayout) view.findViewById(id); adjustPanelMargins(section); section.addView(tvFactory.getTogglesSectionView()); } if (InfoResolver.isInfoPanelEnabled(mContext)) { InfoViewFactory ivFactory = new InfoViewFactory(mContext); int id = getContainerIdForPanelType(panelsOrder, PanelType.INFO.name()); FrameLayout section = (FrameLayout) view.findViewById(id); adjustPanelMargins(section); section.addView(ivFactory.getInfoView()); } if (NotificationsResolver.isNotificationsEnabled(mContext)) { final ImageView fakeNotificationsButton = (ImageView) dragView .findViewById(R.id.notifications_button_fake); PressImageView notificationsButton = (PressImageView) dragView .findViewById(R.id.notifications_button); fakeNotificationsButton.setVisibility(View.VISIBLE); notificationsButton.setVisibility(View.VISIBLE); fakeNotificationsButton.setImageResource(R.drawable.ic_notification_switch); fakeNotificationsButton.setColorFilter(ColorsResolver.getActiveColor(mContext)); final float SCALE = 1.5f; fakeNotificationsButton.setScaleX(SCALE); fakeNotificationsButton.setScaleY(SCALE); notificationsButton.setOnPressedStateChangeListener(new OnPressedStateChangeListener() { private final int BG_COLOR = ColorsResolver.getPressedColor(mContext); @Override public void onPressedStateChange(ImageView v, boolean pressed) { if (pressed) { fakeNotificationsButton.setBackgroundColor(BG_COLOR); } else { fakeNotificationsButton.setBackgroundColor(0x00000000); } } }); NotificationViewFactory nvFactory = new NotificationViewFactory(mContext); ViewGroup notificationsView = nvFactory.getNotificationsView(); notificationsView.setAlpha(0.0f); notificationsView.setVisibility(View.INVISIBLE); FrameLayout notificationsContainer = (FrameLayout) dragView .findViewById(R.id.notifications_section); notificationsContainer.addView(notificationsView); notificationsButton .setOnClickListener(new NotificationButtonClickListener(viewToHide, notificationsView)); } } else { ViewPager pager = (ViewPager) view.findViewById(R.id.landscape_pager); viewToHide = pager; List<View> views = new ArrayList<View>(); if (NotificationsResolver.isNotificationsEnabled(mContext)) { NotificationViewFactory nvFactory = new NotificationViewFactory(mContext); ViewGroup notificationsView = nvFactory.getNotificationsView(); views.add(notificationsView); } List<String> panelsOrder = PanelsOrderResolver.getPanelsOrder(mContext); for (String t : panelsOrder) { PanelType type = PanelType.valueOf(t); View v = null; FrameLayout container = (FrameLayout) LayoutInflater.from(mContext) .inflate(R.layout.panel_section_land, null, false); switch (type) { case INFO: // if (InfoResolver.isInfoPanelEnabled(mContext)) { InfoViewFactory ivFactory = new InfoViewFactory(mContext); FrameLayout fourthSection = (FrameLayout) view.findViewById(R.id.fourth_section); fourthSection.addView(ivFactory.getInfoView()); } break; case MUSIC: if (MusicResolver.isMusicPanelEnabled(mContext)) { MusicViewFactory mvFactory = new MusicViewFactory(mContext); v = mvFactory.getMusicView(); } break; case SHORTCUTS: if (ShortcutsResolver.isShortcutsEnabled(mContext)) { ShortcutsViewFactory svFactory = new ShortcutsViewFactory(mContext); v = svFactory.getShortcutsSectionView(); } break; case TOGGLES: if (TogglesResolver.isTogglesEnabled(mContext)) { TogglesViewFactory tvFactory = new TogglesViewFactory(mContext); v = tvFactory.getTogglesSectionView(); } break; } if (v != null) { views.add(v); container.addView(v); } } LandscapePanelsAdapter adapter = new LandscapePanelsAdapter(views); pager.setAdapter(adapter); pager.setOverScrollMode(View.OVER_SCROLL_NEVER); pager.setOffscreenPageLimit(VIEW_PAGER_OFFSCREEN_PAGES_COUNT); pager.setPageMargin(mContext.getResources().getDimensionPixelSize(R.dimen.pager_margin)); } return view; }
From source file:org.mythtv.client.ui.BackendStatusFragment.java
private void animateCardLinearLayout(final LinearLayout linearLayout, long startDelay) { linearLayout.setAlpha(1);/*from www. j a v a 2 s . c om*/ // animator that translates linearlayout AnimatorUpdateListener translationAnimatorListener = new AnimatorUpdateListener() { /* (non-Javadoc) * @see android.animation.ValueAnimator.AnimatorUpdateListener#onAnimationUpdate(android.animation.ValueAnimator) */ @Override public void onAnimationUpdate(ValueAnimator animation) { Float w = (Float) animation.getAnimatedValue(); linearLayout.setTranslationY(w); } }; ValueAnimator scaleAnimator = ValueAnimator.ofFloat(linearLayout.getTranslationY(), 0f); scaleAnimator.setDuration(500); scaleAnimator.setRepeatCount(0); scaleAnimator.setStartDelay(startDelay); scaleAnimator.addUpdateListener(translationAnimatorListener); scaleAnimator.start(); }