List of usage examples for android.view.animation AnimationUtils loadAnimation
public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException
From source file:net.naonedbus.fragment.CustomListFragment.java
/** * Afficher le contenu./* w ww . j av a 2 s. com*/ */ protected void showContent() { if (State.CONTENT == mCurrentState) { return; } if (DBG) Log.d(LOG_TAG + "$" + getClass().getSimpleName(), "showContent"); mCurrentState = State.CONTENT; mFragmentView.findViewById(R.id.fragmentLoading).setVisibility(View.GONE); if (mFragmentView.findViewById(R.id.fragmentMessage) != null) { mFragmentView.findViewById(R.id.fragmentMessage).setVisibility(View.GONE); } final View content = mFragmentView.findViewById(android.R.id.list); if (content.getVisibility() != View.VISIBLE) { content.setVisibility(View.VISIBLE); content.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } // View message = mFragmentView.findViewById(R.id.fragmentMessage); // if (message != null) { // message.setVisibility(View.GONE); // } }
From source file:com.hackvg.android.views.activities.MoviesActivity.java
private void hideToolbar() { mToolbar.startAnimation(AnimationUtils.loadAnimation(this, R.anim.translate_up_on)); }
From source file:cc.softwarefactory.lokki.android.fragments.MapViewFragment.java
private void hideAddPlaceButtons() { Animation slideDown = AnimationUtils.loadAnimation(this.getActivity().getApplicationContext(), R.anim.add_place_buttons_hide); slideDown.setAnimationListener(new Animation.AnimationListener() { @Override/*from w w w.ja v a 2s . c o m*/ public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { getView().findViewById(R.id.add_place_overlay).setVisibility(View.INVISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); getView().findViewById(R.id.add_place_buttons).startAnimation(slideDown); }
From source file:by.istin.android.xcore.fragment.AdapterViewFragment.java
/** * Control whether the list is being displayed. You can make it not * displayed if you are waiting for the initial data to show in it. During * this time an indeterminant progress indicator will be shown instead. * // w w w. j av a 2 s . c om * @param shown If true, the list view is shown; if false, the progress * indicator. The initial value is true. * @param animate If true, an animation will be used to transition to the * new state. */ private void setListShown(boolean shown, boolean animate) { ensureList(); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mListShown == shown) { return; } mListShown = shown; if (shown) { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mAdapterViewContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mAdapterViewContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mAdapterViewContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mAdapterViewContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mAdapterViewContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mAdapterViewContainer.setVisibility(View.GONE); } }
From source file:com.sim2dial.dialer.HistoryFragment.java
private void hideDeleteAllButton() { if (deleteAll == null || deleteAll.getVisibility() != View.VISIBLE) { return;/* ww w.ja va2s.co m*/ } if (LinphoneActivity.instance().isAnimationDisabled()) { deleteAll.setVisibility(View.INVISIBLE); } else { Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_out_right_to_left); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { deleteAll.setVisibility(View.INVISIBLE); animation.setAnimationListener(null); } }); deleteAll.startAnimation(animation); } }
From source file:com.amaze.filemanager.adapters.ZipAdapter.java
@Override public void onBindViewHolder(RecyclerView.ViewHolder vholder, final int position1) { final ZipAdapter.ViewHolder holder = ((ZipAdapter.ViewHolder) vholder); if (!this.stoppedAnimation) { animate(holder);/*from ww w .j av a 2s . c o m*/ } if (position1 == 0) { holder.rl.setMinimumHeight(zipViewer.paddingTop); return; } final ZipObj rowItem = enter.get(position1 - 1); final int p = position1 - 1; GradientDrawable gradientDrawable = (GradientDrawable) holder.imageView.getBackground(); if (rowItem.getEntry() == null) { holder.imageView.setImageResource(R.drawable.abc_ic_ab_back_mtrl_am_alpha); gradientDrawable.setColor(Color.parseColor("#757575")); holder.txtTitle.setText(".."); holder.txtDesc.setText(""); holder.date.setText(R.string.goback); } else { holder.imageView.setImageDrawable( Icons.loadMimeIcon(zipViewer.getActivity(), rowItem.getName(), false, zipViewer.res)); final StringBuilder stringBuilder = new StringBuilder(rowItem.getName()); if (zipViewer.showLastModified) holder.date.setText(new Futils().getdate(rowItem.getTime(), "MMM dd, yyyy", zipViewer.year)); if (rowItem.isDirectory()) { holder.imageView.setImageDrawable(folder); gradientDrawable.setColor(Color.parseColor(zipViewer.iconskin)); if (stringBuilder.toString().length() > 0) { stringBuilder.deleteCharAt(rowItem.getName().length() - 1); try { holder.txtTitle.setText( stringBuilder.toString().substring(stringBuilder.toString().lastIndexOf("/") + 1)); } catch (Exception e) { holder.txtTitle.setText(rowItem.getName().substring(0, rowItem.getName().lastIndexOf("/"))); } } } else { if (zipViewer.showSize) holder.txtDesc.setText(new Futils().readableFileSize(rowItem.getSize())); holder.txtTitle.setText(rowItem.getName().substring(rowItem.getName().lastIndexOf("/") + 1)); if (zipViewer.coloriseIcons) { if (Icons.isVideo(rowItem.getName()) || Icons.isPicture(rowItem.getName())) gradientDrawable.setColor(Color.parseColor("#f06292")); else if (Icons.isAudio(rowItem.getName())) gradientDrawable.setColor(Color.parseColor("#9575cd")); else if (Icons.isPdf(rowItem.getName())) gradientDrawable.setColor(Color.parseColor("#da4336")); else if (Icons.isCode(rowItem.getName())) gradientDrawable.setColor(Color.parseColor("#00bfa5")); else if (Icons.isText(rowItem.getName())) gradientDrawable.setColor(Color.parseColor("#e06055")); else if (Icons.isArchive(rowItem.getName())) gradientDrawable.setColor(Color.parseColor("#f9a825")); else if (Icons.isApk(rowItem.getName())) gradientDrawable.setColor(Color.parseColor("#a4c439")); else if (Icons.isgeneric(rowItem.getName())) gradientDrawable.setColor(Color.parseColor("#9e9e9e")); else gradientDrawable.setColor(Color.parseColor(zipViewer.iconskin)); } else gradientDrawable.setColor(Color.parseColor(zipViewer.iconskin)); } } holder.rl.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { if (rowItem.getEntry() != null) { final Animation animation = AnimationUtils.loadAnimation(zipViewer.getActivity(), R.anim.holder_anim); holder.imageView.setAnimation(animation); toggleChecked(p); } System.out.println("onLongClick"); return true; } }); holder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (rowItem.getEntry() != null) { final Animation animation = AnimationUtils.loadAnimation(zipViewer.getActivity(), R.anim.holder_anim); holder.imageView.setAnimation(animation); toggleChecked(p); } } }); Boolean checked = myChecked.get(p); if (checked != null) { if (zipViewer.mainActivity.theme1 == 0) { holder.rl.setBackgroundResource(R.drawable.safr_ripple_white); } else { holder.rl.setBackgroundResource(R.drawable.safr_ripple_black); } holder.rl.setSelected(false); if (checked) { holder.imageView.setImageDrawable( zipViewer.getResources().getDrawable(R.drawable.abc_ic_cab_done_holo_dark)); gradientDrawable.setColor(Color.parseColor("#757575")); holder.rl.setSelected(true); } } holder.rl.setOnClickListener(new View.OnClickListener() { public void onClick(View p1) { if (rowItem.getEntry() == null) zipViewer.goBack(); else { if (zipViewer.selection) { final Animation animation = AnimationUtils.loadAnimation(zipViewer.getActivity(), R.anim.holder_anim); holder.imageView.setAnimation(animation); toggleChecked(p); } else { final StringBuilder stringBuilder = new StringBuilder(rowItem.getName()); if (rowItem.isDirectory()) stringBuilder.deleteCharAt(rowItem.getName().length() - 1); if (rowItem.isDirectory()) { new ZipHelperTask(zipViewer, stringBuilder.toString()).execute(zipViewer.f); } else { String x = rowItem.getName().substring(rowItem.getName().lastIndexOf("/") + 1); File file = new File(c.getCacheDir().getAbsolutePath() + "/" + x); zipViewer.files.clear(); zipViewer.files.add(0, file); try { ZipFile zipFile = new ZipFile(zipViewer.f); new ZipExtractTask(zipFile, c.getCacheDir().getAbsolutePath(), zipViewer.getActivity(), x, true, rowItem.getEntry()).execute(); } catch (IOException e) { e.printStackTrace(); } } } } } }); }
From source file:com.mercandalli.android.apps.files.user.community.UserFragment.java
public void updateAdapter() { if (mRecyclerView != null && isAdded()) { mCircularProgressBar.setVisibility(View.GONE); if (mUserModels.size() == 0) { mMessageTextView.setText(getString(R.string.no_user)); mMessageTextView.setVisibility(View.VISIBLE); } else {/*from w w w. ja v a2s.com*/ mMessageTextView.setVisibility(View.GONE); } final AdapterModelUser adapterModelUser = new AdapterModelUser(mUserModels, new IModelUserListener() { @Override public void execute(final UserModel userModel) { final AlertDialog.Builder menuAlert = new AlertDialog.Builder(getContext()); String[] menuList = { getString(R.string.talk) }; if (Config.isUserAdmin()) { menuList = new String[] { getString(R.string.talk), getString(R.string.delete) }; } menuAlert.setTitle(getString(R.string.action)); menuAlert.setItems(menuList, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { switch (item) { case 0: DialogUtils.prompt(getContext(), "Send Message", "Write your message", "Send", new DialogUtils.OnDialogUtilsStringListener() { @Override public void onDialogUtilsStringCalledBack(String text) { String url = Constants.URL_DOMAIN + Config.ROUTE_USER_CONVERSATION + "/" + userModel.getId(); List<StringPair> parameters = new ArrayList<>(); parameters.add(new StringPair("message", "" + text)); new TaskPost(getActivity(), url, new IPostExecuteListener() { @Override public void onPostExecute(JSONObject json, String body) { } }, parameters).execute(); } }, getString(android.R.string.cancel), null); break; case 1: DialogUtils.alert(getContext(), "Delete " + userModel.username + "?", "This process cannot be undone.", getString(R.string.delete), new DialogUtils.OnDialogUtilsListener() { @Override public void onDialogUtilsCalledBack() { if (Config.isUserAdmin()) { userModel.delete(getActivity(), new IPostExecuteListener() { @Override public void onPostExecute(JSONObject json, String body) { UserFragment.this.refreshList(); } }); } else { Toast.makeText(getActivity(), "Not permitted.", Toast.LENGTH_SHORT).show(); } } }, getString(android.R.string.cancel), null); break; } } }); AlertDialog menuDrop = menuAlert.create(); menuDrop.show(); } }); mRecyclerView.setAdapter(adapterModelUser); if ((mRootView.findViewById(R.id.circle)).getVisibility() == View.GONE) { (mRootView.findViewById(R.id.circle)).setVisibility(View.VISIBLE); Animation animOpen = AnimationUtils.loadAnimation(getContext(), R.anim.circle_button_bottom_open); (mRootView.findViewById(R.id.circle)).startAnimation(animOpen); } (mRootView.findViewById(R.id.circle)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Fab UserFragment Toast.makeText(getActivity(), getString(R.string.not_implemented), Toast.LENGTH_SHORT).show(); } }); adapterModelUser.setOnItemClickListener(new AdapterModelUser.OnItemClickListener() { @Override public void onItemClick(View view, int position) { } }); mSwipeRefreshLayout.setRefreshing(false); } }
From source file:ch.arnab.simplelauncher.GridFragment.java
/** * Control whether the grid is being displayed. You can make it not * displayed if you are waiting for the initial data to show in it. During * this time an indeterminant progress indicator will be shown instead. * * @param shown If true, the grid view is shown; if false, the progress * indicator. The initial value is true. * @param animate If true, an animation will be used to transition to the * new state./*from w w w .j a va 2s . c o m*/ */ private void setGridShown(boolean shown, boolean animate) { ensureGrid(); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mGridShown == shown) { return; } mGridShown = shown; if (shown) { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mGridContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mGridContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mGridContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mGridContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mGridContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mGridContainer.setVisibility(View.GONE); } }
From source file:at.alladin.rmbt.android.main.RMBTMainMenuFragment.java
/** * /*from ww w.j a v a 2 s . c o m*/ * @param view * @param inflater * @param savedInstanceState * @return */ private View createView(View view, LayoutInflater inflater, Bundle savedInstanceState) { startButton = view.findViewById(R.id.title_page_start_button); startButtonText = (TextView) view.findViewById(R.id.title_page_start_button_text); if (startButton != null) { startButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { ((RMBTMainActivity) getActivity()).checkPermissionsAndStartTest(); } }); } final View startButtonLayout = view.findViewById(R.id.title_page_start_button_layout); if (startButtonLayout != null) { final Animation delayedPulseAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.delayed_pulse); delayedPulseAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { startButtonLayout.startAnimation(animation); } }); startButtonLayout.startAnimation(delayedPulseAnimation); } //infoLocation = (TextView) view.findViewById(R.id.info_gps_location); //infoLocation.setVisibility(View.GONE); infoNetwork = (TextView) view.findViewById(R.id.info_network_name); setViewVisibility(infoNetwork, View.GONE); infoNetworkLabel = (TextView) view.findViewById(R.id.info_network_name_label); setViewVisibility(infoNetworkLabel, View.GONE); infoNetworkType = (TextView) view.findViewById(R.id.info_network_type); setViewVisibility(infoNetworkType, View.GONE); infoSignalStrength = (TextView) view.findViewById(R.id.info_signal_strength); setViewVisibility(infoSignalStrength, View.GONE); infoSignalStrengthExtra = (TextView) view.findViewById(R.id.info_signal_strength_extra); setViewVisibility(infoSignalStrengthExtra, View.INVISIBLE); locationView = (ImageView) view.findViewById(R.id.location_image); setViewVisibility(locationView, View.INVISIBLE); locationButton = view.findViewById(R.id.title_page_location_button); if (locationButton != null) { locationButton.setOnClickListener(detailShowOnClickListener); } ipv4View = (ImageView) view.findViewById(R.id.ipv4_status); ipv4Button = view.findViewById(R.id.title_page_ipv4_button); if (ipv4Button != null) { ipv4Button.setOnClickListener(detailShowOnClickListener); } ipv6View = (ImageView) view.findViewById(R.id.ipv6_status); ipv6Button = view.findViewById(R.id.title_page_ipv6_button); if (ipv6Button != null) { ipv6Button.setOnClickListener(detailShowOnClickListener); } trafficButton = view.findViewById(R.id.title_page_traffic_button); if (trafficButton != null) { trafficButton.setOnClickListener(detailShowOnClickListener); } infoOverlayList = (ListView) view.findViewById(R.id.info_overlay_list); if (infoOverlayList != null) { infoValueListAdapterMap.put(OverlayType.TRAFFIC, new InfoArrayAdapter(getActivity(), OverlayType.TRAFFIC, InfoOverlayEnum.DL_TRAFFIC, InfoOverlayEnum.UL_TRAFFIC)); infoValueListAdapterMap.put(OverlayType.IPV4, new InfoArrayAdapter(getActivity(), OverlayType.IPV4, InfoOverlayEnum.IPV4, InfoOverlayEnum.IPV4_PUB)); infoValueListAdapterMap.put(OverlayType.IPV6, new InfoArrayAdapter(getActivity(), OverlayType.IPV6, InfoOverlayEnum.IPV6, InfoOverlayEnum.IPV6_PUB)); infoValueListAdapterMap.put(OverlayType.LOCATION, new InfoArrayAdapter(getActivity(), OverlayType.LOCATION, InfoOverlayEnum.LOCATION)); } infoOverlayTitle = (TextView) view.findViewById(R.id.info_overlay_title); infoOverlay = (RelativeLayout) view.findViewById(R.id.info_overlay); if (infoOverlay != null) { if (infoOverlay.getVisibility() == View.GONE) { infoOverlay.setOnClickListener(detailHideOnClickListener); infoOverlayList.setOnItemClickListener(detailHideOnItemClickListener); } } captivePortalWarning = (ImageView) view.findViewById(R.id.captive_portal_image); antennaView = (ImageView) view.findViewById(R.id.antenne_image); if (antennaView != null) { //antennaView.setOnClickListener(detailShowOnClickListener); if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_INFO_LAST_ANTENNA_IMAGE)) { int antennaImageId = savedInstanceState.getInt(BUNDLE_INFO_LAST_ANTENNA_IMAGE); antennaView.setImageResource(antennaImageId); antennaView.setTag(antennaImageId); } } ulSpeedView = (ImageView) view.findViewById(R.id.traffic_ul_image); dlSpeedView = (ImageView) view.findViewById(R.id.traffic_dl_image); developerCodeInfoView = (TextView) view.findViewById(R.id.developerCodeInfo); return view; }
From source file:com.nerderylabs.android.nerdalert.ui.fragment.MainFragment.java
private void startProgressIndicator() { if (!isProgressIndicatorShowing) { fab.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.progress_indicator)); Animation rotate = AnimationUtils.loadAnimation(getContext(), R.anim.rotate); rotate.setRepeatCount(Animation.INFINITE); fab.startAnimation(rotate);//from www . j av a2 s. c o m isProgressIndicatorShowing = true; } }