List of usage examples for android.view.animation AnimationUtils loadAnimation
public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException
From source file:com.devspark.progressfragment.ProgressFragment.java
/** * Control whether the content 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 content 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 av a 2 s . c o m */ private void setContentShown(boolean shown, boolean animate) { ensureContent(); if (mContentShown == shown) { return; } mContentShown = shown; if (shown) { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mContentContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mContentContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mContentContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mContentContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mContentContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mContentContainer.setVisibility(View.GONE); } }
From source file:com.devspark.progressfragment.ProgressListFragment.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. * * @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./* www . j ava 2 s .c o m*/ */ 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)); mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mListContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mListContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mListContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mListContainer.setVisibility(View.GONE); } }
From source file:com.grayfox.android.app.fragment.RecommendedRouteFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); FragmentManager fragmentManager = getChildFragmentManager(); SupportMapFragment fragment = (SupportMapFragment) fragmentManager.findFragmentByTag(MAP_FRAGMENT_TAG); if (fragment == null) { fragment = SupportMapFragment.newInstance(); fragmentManager.beginTransaction().replace(R.id.map_container, fragment, MAP_FRAGMENT_TAG).commit(); }/*w ww . j a v a 2 s.co m*/ directionsMenu.setIconAnimated(false); walkingDirectionsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { directionsMenu.close(true); if (routeBuilderTask != null && !routeBuilderTask.isActive()) recalculateRoute(TravelMode.WALKING); } }); transitDirectionsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { directionsMenu.close(true); if (routeBuilderTask != null && !routeBuilderTask.isActive()) recalculateRoute(TravelMode.TRANSIT); } }); drivingDirectionsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { directionsMenu.close(true); if (routeBuilderTask != null && !routeBuilderTask.isActive()) recalculateRoute(TravelMode.DRIVING); } }); bikeDirectionsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { directionsMenu.close(true); if (routeBuilderTask != null && !routeBuilderTask.isActive()) recalculateRoute(TravelMode.BICYCLING); } }); routeList.setLayoutManager(new LinearLayoutManager(getActivity())); routeList.setItemAnimator(null); poiRouteAdapter = new PoiRouteAdapter(getCurrentLocationArg()); poiRouteAdapter.setOnDeleteItemListener(new PoiRouteAdapter.OnDeleteItemListener() { @Override public void onDelete(Poi poi, int position) { onDeletePoiInRoute(position); } }); routeList.setAdapter(poiRouteAdapter); final DragSortRecycler dragSortRecycler = new DragSortRecycler(); dragSortRecycler.setViewHandleId(R.id.reorder_icon); dragSortRecycler.setOnItemMovedListener(new DragSortRecycler.OnItemMovedListener() { @Override public void onItemMoved(int from, int to) { onReorderPoisInRoute(from, to); } }); routeList.addItemDecoration(dragSortRecycler); routeList.addOnItemTouchListener(dragSortRecycler); verticalShowAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.vertical_show); verticalHideAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.vertical_hide); fragment.getMapAsync(this); }
From source file:com.hayukleung.app.BaseFragment.java
private void switchView(View shownView, View hiddenView, boolean animate) { if (animate) { shownView.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); hiddenView.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else {//from w w w. j a v a 2 s .c om shownView.clearAnimation(); hiddenView.clearAnimation(); } shownView.setVisibility(View.GONE); hiddenView.setVisibility(View.VISIBLE); }
From source file:com.initiativaromania.hartabanilorpublici.IRUserInterface.activities.MainActivity.java
/** * Initialize UI components// w ww . ja v a 2s . c o m */ private void initUI() { FacebookSdk.sdkInitialize(getApplicationContext()); /* Tab Bar */ tabSetup(); /* Seek bar */ seekBarValue = (TextView) findViewById(R.id.seekBarValue); /* SeekBar value animations */ animationFadeIn = AnimationUtils.loadAnimation(context, R.anim.fadein); animationFadeIn.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { seekBarValue.startAnimation(animationFadeOut); } @Override public void onAnimationRepeat(Animation animation) { } }); animationFadeOut = AnimationUtils.loadAnimation(context, R.anim.fadeout); animationFadeOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { seekBarValue.setVisibility(View.INVISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); seekBar = (SeekBar) findViewById(R.id.seekBar); seekBarListener = new IRSeekBarListener(circle); seekBar.setOnSeekBarChangeListener(seekBarListener); seekBar.setProgress( 100 * (CIRCLE_DEFAULT_RADIUS - CIRCLE_MIN_RADIUS) / (CIRCLE_MAX_RADIUS - CIRCLE_MIN_RADIUS)); /* Transparent layer with information */ initTransparentView(); /* Information button */ ImageButton imageButton = (ImageButton) findViewById(R.id.imageButton); if (imageButton != null) { imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /* Start the info activity */ Intent intent = new Intent(getBaseContext(), InfoActivity.class); startActivity(intent); } }); } /* Obtain the SupportMapFragment and get notified when the map is ready to be used. */ mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); mapFragment.getMapAsync(this); }
From source file:com.autburst.picture.MainActivity.java
/** Called when the activity is first created. */ @Override//from w w w .j av a 2s. c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "------ onCreate MainActivity ------"); setContentView(R.layout.main); albumsList = (ListView) findViewById(R.id.albumList); inflater = getLayoutInflater(); List<String> albumsAsList = Utilities.getAlbumsAsList(); adapter = new AlbumAdapter(inflater, this, R.layout.row, albumsAsList); adapter.sort(Utilities.getAlbumNameComparator()); albumsList.setAdapter(adapter); albumsList.setOnItemClickListener(this); cancelDeletion = (Button) findViewById(R.id.cancelDeletion); cancelDeletion.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { hideDeletionPanelAndCB(MainActivityController.DELETE_BUTTON_PRESSED); } }); deleteCheckedAlbums = (Button) findViewById(R.id.deleteCheckedAlbums); deleteCheckedAlbums.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { List<String> albums = Utilities.getAlbumsAsList(); Collections.sort(albums, Utilities.getAlbumNameComparator()); for (int i = 0; i < checkedAlbums.size(); i++) { // get checked rows int rowIndex = checkedAlbums.get(i); String albumName = albums.get(rowIndex); Log.d(TAG, "delete album: " + albumName + " at rowIndex: " + rowIndex + " decodedName: " + new String(Base64.decodeBase64(albumName.getBytes()))); // delete albums // remove files on sdcard File album = Utilities.getAlbumDirectory(albumName); File[] file = album.listFiles(); for (File file2 : file) { file2.delete(); Log.d(TAG, "deleted file: " + file2.getName()); } album.delete(); // remove shared preferences entry SharedPreferences preferences = getSharedPreferences(Utilities.PIC_STORE, 0); Editor edit = preferences.edit(); String pref0 = albumName + ".id"; String pref1 = albumName + ".portrait"; String pref2 = albumName + ".videoId"; String pref3 = albumName + ".frameRate"; if (preferences.contains(pref0)) { edit.remove(pref0); Log.d(TAG, "deleted pref .id"); } if (preferences.contains(pref1)) { edit.remove(pref1); Log.d(TAG, "deleted pref .portrait"); } if (preferences.contains(pref2)) { edit.remove(pref2); Log.d(TAG, "deleted pref .videoId"); } if (preferences.contains(pref3)) { edit.remove(pref3); Log.d(TAG, "deleted pref .frameRate"); } edit.commit(); adapter.remove(albumName); adapter.sort(Utilities.getAlbumNameComparator()); } // hide deletion panel and checkboxes hideDeletionPanelAndCB(MainActivityController.DELETED_ALBUMS); // reload list adapter.notifyDataSetChanged(); controller.transformGUI(MainActivityController.DELETED_ALBUMS); } }); deletionPanel = (LinearLayout) findViewById(R.id.deletionPanel); deleteButton = (ImageButton) findViewById(R.id.deleteButton); deleteButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { controller.transformGUI(MainActivityController.DELETE_BUTTON_PRESSED); if (deleteCheckboxesVisible) { // hide checkboxes deleteCheckboxesVisible = false; // make checkboxes invisible for (CheckBox cbToDelete : deleteAlbumCheckBoxes) { if (cbToDelete.getVisibility() == View.VISIBLE) { Animation myFadeInAnimation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.slight_left_cb); cbToDelete.startAnimation(myFadeInAnimation); cbToDelete.setVisibility(View.GONE); if (cbToDelete.isChecked()) cbToDelete.setChecked(false); Log.d(TAG, "set delete checkbox GONE"); } } } else { // show checkboxes deleteCheckboxesVisible = true; for (CheckBox cbToDelete : deleteAlbumCheckBoxes) { if (cbToDelete.getVisibility() == View.GONE) { // checkboxes Animation myFadeInAnimation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.slight_right_cb); cbToDelete.startAnimation(myFadeInAnimation); cbToDelete.setVisibility(View.VISIBLE); Log.d(TAG, "set delete checkbox visible"); } } } } }); openButton = (ImageButton) findViewById(R.id.openButton); openButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { if (openButtonsVisible) { // hide open Buttons AnimationHelper.fadeInFromLeftToRight(MainActivity.this, deleteButton); // make buttons gone for (Button openAlbum : openAlbumButtons) { if (openAlbum.getVisibility() == View.VISIBLE) { Animation myFadeInAnimation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.slight_right); openAlbum.startAnimation(myFadeInAnimation); openAlbum.setVisibility(View.GONE); } } openButtonsVisible = false; } else { // show open buttons AnimationHelper.fadeOutToLeftSide(MainActivity.this, deleteButton); // make buttons visible for (Button openAlbum : openAlbumButtons) { if (openAlbum.getVisibility() == View.GONE) { Animation myFadeInAnimation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.slight_left); openAlbum.startAnimation(myFadeInAnimation); openAlbum.setVisibility(View.VISIBLE); } } openButtonsVisible = true; } } }); controller = new MainActivityController(this, openButton, deleteButton, deletionPanel); }
From source file:com.mercandalli.android.apps.files.user.community.TalkFragment.java
public void updateAdapter() { if (mRecyclerView != null && this.isAdded()) { mCircularProgressBar.setVisibility(View.GONE); if (mConversationUserModels.isEmpty()) { mMessageTextView.setText(getString(R.string.no_talk)); mMessageTextView.setVisibility(View.VISIBLE); } else {/* w w w .java 2 s . com*/ mMessageTextView.setVisibility(View.GONE); } final AdapterModelConversationUser adapter = new AdapterModelConversationUser(mConversationUserModels, new IModelUserListener() { @Override public void execute(final UserModel userModel) { 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_MESSAGE + "/" + 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(); } }, "Cancel", null); } }); mRecyclerView.setAdapter(adapter); 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 TalkFragment Toast.makeText(getActivity(), getString(R.string.not_implemented), Toast.LENGTH_SHORT).show(); } }); adapter.setOnItemClickListener(new AdapterModelConversationUser.OnItemClickListener() { @Override public void onItemClick(View view, int position) { mConversationUserModels.get(position).open(getActivity()); } }); mSwipeRefreshLayout.setRefreshing(false); } }
From source file:org.bwgz.quotation.activity.QuotationActivity.java
private void startLoadAnimation() { if (menu != null) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_action_view, null); Animation rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_refresh); rotation.setRepeatCount(Animation.INFINITE); iv.startAnimation(rotation);/* w w w . j a va 2 s . co m*/ MenuItem item = menu.findItem(R.id.actionbar_new); item.setActionView(iv); item.setEnabled(false); } }
From source file:com.sutromedia.android.core.PhotoActivity.java
void handleFlingEvent(boolean left) { if (left) {//from w w w. j av a 2 s.c om mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_right)); mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_left)); mCurrentImage += 1; } else { mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_left)); mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_right)); mCurrentImage -= 1; } mCurrentImage = mCurrentImage % mSelectedPhotos.size(); if (mCurrentImage < 0) { mCurrentImage += mSelectedPhotos.size(); } setupDownload(); loadImagePreview(getCurrentPhoto()); }
From source file:com.hamsik2046.password.view.SingleInputFormActivity.java
private void setupTitle() { mTitleSwitcher.setInAnimation(AnimationUtils.loadAnimation(activity, R.anim.slide_in_to_bottom)); mTitleSwitcher.setOutAnimation(AnimationUtils.loadAnimation(activity, R.anim.slide_out_to_top)); mTitleSwitcher.setFactory(new ViewSwitcher.ViewFactory() { @Override//from w w w . ja v a 2 s . com public View makeView() { TextView view = (TextView) activity.getLayoutInflater().inflate(R.layout.view_title, null); if (view != null) { view.setTextColor(mTitleTextColor); } return view; } }); mTitleSwitcher.setText(""); }