List of usage examples for android.view View startAnimation
public void startAnimation(Animation animation)
From source file:com.yixia.zi.widget.crouton.Manager.java
/** * Adds a {@link Crouton} to the {@link ViewParent} of it's {@link Activity}. * * @param crouton/*from w w w . j a v a 2s . co m*/ * The {@link Crouton} that should be added. */ private void addCroutonToView(Crouton crouton) { // don't add if it is already showing if (crouton.isShowing()) { return; } View croutonView = crouton.getView(); if (null == croutonView.getParent()) { ViewGroup.LayoutParams params = croutonView.getLayoutParams(); if (null == params) { params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); } // display Crouton in ViewGroup is it has been supplied if (null != crouton.getViewGroup()) { // TODO implement add to last position feature (need to align with how this will be requested for activity) if (crouton.getViewGroup() instanceof FrameLayout) { crouton.getViewGroup().addView(croutonView, params); } else { crouton.getViewGroup().addView(croutonView, 0, params); } } else { Activity activity = crouton.getActivity(); if (null == activity || activity.isFinishing()) { return; } activity.addContentView(croutonView, params); } } croutonView.startAnimation(crouton.getInAnimation()); announceForAccessibilityCompat(crouton.getActivity(), crouton.getText()); if (Style.DURATION_INFINITE != crouton.getStyle().durationInMilliseconds) { sendMessageDelayed(crouton, Messages.REMOVE_CROUTON, crouton.getStyle().durationInMilliseconds + crouton.getInAnimation().getDuration()); } }
From source file:im.afterclass.android.fragment.ChatHistoryFragment.java
private void showRightPopupWindow(View v) { LayoutInflater inflater = LayoutInflater.from(getActivity()); View parent = getActivity().findViewById(R.id.main_button); View view = inflater.inflate(R.layout.half_popupwindow, null); String[] themes = new String[] { "?", "??", "" }; List<Map<String, Object>> listItems = new ArrayList<Map<String, Object>>(); for (int i = 0; i < themes.length; i++) { Map<String, Object> listItem = new HashMap<String, Object>(); listItem.put("theme", themes[i]); listItems.add(listItem);/*from w w w . j a va 2 s .c o m*/ } SimpleAdapter simpleAdapter = new SimpleAdapter(getActivity(), listItems, R.layout.theme_simple_item, new String[] { "theme" }, new int[] { R.id.theme }); ListView themelist = (ListView) view.findViewById(R.id.themeListView); themelist.setAdapter(simpleAdapter); themelist.setOnItemClickListener(new ItemClickListener()); mPopupWindow = new PopupWindow(view); view.startAnimation(animSlideRightin); DisplayMetrics dm = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); int screenHeight = dm.heightPixels; int[] location = new int[2]; parent.getLocationInWindow(location); Rect frame = new Rect(); getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); int statusBarHeight = frame.top; int width = frame.width(); mPopupWindow.setHeight(location[1] - getActivity().getActionBar().getHeight() - statusBarHeight); mPopupWindow.setWidth(width / 2); mPopupWindow.setTouchable(true); mPopupWindow.setFocusable(true); mPopupWindow.setOutsideTouchable(true); mPopupWindow.setBackgroundDrawable(new BitmapDrawable()); mPopupWindow.showAtLocation(getActivity().findViewById(R.id.main_bottom), Gravity.BOTTOM | Gravity.RIGHT, 0, screenHeight - location[1]); }
From source file:im.afterclass.android.fragment.ChatHistoryFragment.java
private void showLeftPopupWindow(View v) { LayoutInflater inflater = LayoutInflater.from(getActivity()); View parent = getActivity().findViewById(R.id.main_button); View view = inflater.inflate(R.layout.half_popupwindow, null); String[] themes = new String[] { "?", "??", "" }; List<Map<String, Object>> listItems = new ArrayList<Map<String, Object>>(); for (int i = 0; i < themes.length; i++) { Map<String, Object> listItem = new HashMap<String, Object>(); listItem.put("theme", themes[i]); listItems.add(listItem);// w ww .java 2 s . c om } SimpleAdapter simpleAdapter = new SimpleAdapter(getActivity(), listItems, R.layout.theme_simple_item, new String[] { "theme" }, new int[] { R.id.theme }); ListView themelist = (ListView) view.findViewById(R.id.themeListView); themelist.setAdapter(simpleAdapter); themelist.setOnItemClickListener(new ItemClickListener()); mPopupWindow = new PopupWindow(view); view.startAnimation(animSlideLeftin); DisplayMetrics dm = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); int screenHeight = dm.heightPixels; int[] location = new int[2]; parent.getLocationInWindow(location); Rect frame = new Rect(); getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); int statusBarHeight = frame.top; int width = frame.width(); mPopupWindow.setHeight(location[1] - getActivity().getActionBar().getHeight() - statusBarHeight); mPopupWindow.setWidth(width / 2); mPopupWindow.setTouchable(true); mPopupWindow.setFocusable(true); mPopupWindow.setOutsideTouchable(true); mPopupWindow.setBackgroundDrawable(new BitmapDrawable()); mPopupWindow.showAtLocation(getActivity().findViewById(R.id.main_bottom), Gravity.BOTTOM | Gravity.LEFT, 0, screenHeight - location[1]); }
From source file:com.saphion.stencilweather.activities.MainActivity.java
public void bounceScaleAnimation(View mView, int delay) { // YoYo.with(Techniques.ZoomIn).interpolate(new BounceInterpolator()).duration(180).delay(delay).playOn(mView); Animation pulse = AnimationUtils.loadAnimation(this, R.anim.pulse); pulse.setStartOffset(delay);//from ww w .j a v a 2 s. c o m mView.startAnimation(pulse); }
From source file:org.zywx.wbpalmstar.engine.EBrowserWidget.java
public boolean exitMySpace(View view) { if (view.getParent() == this) { mBroWindow.setVisibility(VISIBLE); TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 1.0f); anim.setDuration(300);/*www . ja va 2 s.c o m*/ DecelerateInterpolator di = new DecelerateInterpolator(); anim.setInterpolator(di); view.startAnimation(anim); removeView(view); return true; } return false; }
From source file:com.tdispatch.passenger.fragment.ControlCenterFragment.java
protected void hideAimPoint() { if (mAimPointVisible) { mAimPointVisible = false;/*from ww w . java 2 s . c o m*/ View v = mFragmentView.findViewById(R.id.map_aim_point_container); v.clearAnimation(); v.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.fade_out)); WebnetTools.setVisibility(mFragmentView, R.id.map_aim_point_minimal_container, View.VISIBLE); int[] ids = { R.id.button_set_as_pickup, R.id.button_set_as_dropoff }; for (int id : ids) { v = mFragmentView.findViewById(id); v.setClickable(false); v.setLongClickable(false); } } }
From source file:com.tdispatch.passenger.fragment.ControlCenterFragment.java
protected void showAimPoint(Boolean animate) { if (mAimPointVisible == false) { mAimPointVisible = true;//w ww . j a va 2 s . c om View v = mFragmentView.findViewById(R.id.map_aim_point_container); v.clearAnimation(); v.startAnimation( AnimationUtils.loadAnimation(mContext, (animate) ? R.anim.fade_in : R.anim.fade_in_instant)); WebnetTools.setVisibility(mFragmentView, R.id.map_aim_point_minimal_container, View.INVISIBLE); int[] ids = { R.id.button_set_as_pickup, R.id.button_set_as_dropoff }; for (int id : ids) { v = mFragmentView.findViewById(id); v.setClickable(true); v.setLongClickable(true); } } }
From source file:com.tdispatch.passenger.fragment.ControlCenterFragment.java
@Override protected void onPostCreateView() { initBusyIndicators();/*from w ww. j av a 2 s . c om*/ showAimPoint(true); // try to fix another GMaps v2 related issue // http://code.google.com/p/gmaps-api-issues/issues/detail?id=4639 ViewGroup mapHost = (ViewGroup) mFragmentView.findViewById(R.id.map_container); mapHost.requestTransparentRegion(mapHost); updateAddresses(); setUIControlsVisibility(true); // disable debug controls WebnetTools.setVisibility(mFragmentView, R.id.debug_container, TDApplication.isDebuggable() ? View.INVISIBLE : View.INVISIBLE); MapFragment mapFragment = (MapFragment) mFragmentManager.findFragmentById(R.id.map_fragment); if (mapFragment != null) { CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(15f); GoogleMap map = mapFragment.getMap(); Location currentPosition = map.getMyLocation(); if (currentPosition != null) { LatLng latLng = new LatLng(currentPosition.getLatitude(), currentPosition.getLongitude()); cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 15f); } map.moveCamera(cameraUpdate); map.setOnCameraChangeListener(mMapCameraListener); map.setOnMapClickListener(mOnMapClickListener); map.setOnMyLocationChangeListener(mOnMyLocationChangeListener); } else { throw new IllegalStateException("Map is not ready"); } WebnetTools.setVisibility(mFragmentView, R.id.price_box_container, View.INVISIBLE); int ids[] = { R.id.pickup_location, R.id.dropoff_location, R.id.button_mylocation, R.id.button_book, R.id.button_start_new_booking, R.id.left_menu_drag_handle, R.id.right_menu_drag_handle, R.id.button_set_as_pickup, R.id.button_set_as_dropoff, }; for (int id : ids) { View v = mFragmentView.findViewById(id); if (v != null) { v.setOnClickListener(mOnClickListener); } } ids = new int[] { R.id.button_set_as_pickup, R.id.button_set_as_dropoff, R.id.button_mylocation }; for (int id : ids) { View v = mFragmentView.findViewById(id); if (v != null) { v.setOnLongClickListener(mOnLongClickListener); } } // unveil map View mapCurtain = mFragmentView.findViewById(R.id.map_curtain); mapCurtain.startAnimation( AnimationUtils.loadAnimation(TDApplication.getAppContext(), R.anim.map_curtain_fade_out)); }
From source file:com.codefororlando.transport.MapsActivity.java
private void removeSelectableItemFragment() { final Fragment selectableItemFragment = getFragmentManager().findFragmentByTag(ISelectableItemFragment.TAG); if (selectableItemFragment != null) { final View view = selectableItemFragment.getView(); if (view == null) { return; }//from w w w. jav a 2 s. c om final int animationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime); { final Animation animation = new TranslateAnimation(0, 0, 0, view.getHeight()); animation.setDuration(animationDuration); animation.setInterpolator(new AccelerateDecelerateInterpolator()); filterView.startAnimation(animation); } { final FragmentManager fragmentManager = getFragmentManager(); final Animation animation = new TranslateAnimation(0, 0, 0, view.getHeight()); animation.setDuration(animationDuration); animation.setAnimationListener(new EmptyAnimationListener() { @Override public void onAnimationEnd(Animation animation) { try { fragmentManager.beginTransaction().remove(selectableItemFragment) .commitAllowingStateLoss(); } catch (Exception e) { e.printStackTrace(); } } }); view.startAnimation(animation); } } }
From source file:com.wit.and.dialog.LoginDialog.java
/** * Hides the view with the progress bar and shows the main login view. * // ww w .j ava 2 s . c o m * @param animated * <code>True</code> if hiding should be animated, <code>false</code> otherwise. */ private void hideLoading(boolean animated) { View loading = this.mLoadingView; View login = this.mEditView; View buttons = findViewByID(R.id.And_Dialog_Layout_Buttons); // Perform only if the loading view isn't already hided. if (loading.getVisibility() != View.VISIBLE) return; // Allow to dismiss dialog. setCancelable(true); login.setVisibility(View.VISIBLE); if (animated) { loading.startAnimation(ANIM_SLIDE_UP_FROM_TOP); login.startAnimation(ANIM_SLIDE_UP_FROM_BOTTOM); } else { loading.setVisibility(View.GONE); } // Show buttons view. if (buttons != null) { buttons.setVisibility(View.VISIBLE); } }