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.example.mobilewebproxy.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); _behindView = new LogBehindView(this, null); _serverController = new ServerController(); setBehindContentView(_behindView);// ww w. ja va 2 s .c o m setContentView(R.layout.activity_main); _notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); logView = (TextView) _behindView.findViewById(R.id.log_view); _startButton = (Button) findViewById(R.id.start_button); _downloadedTextView = (TextView) findViewById(R.id.download_counter); _uploadedTextView = (TextView) findViewById(R.id.upload_counter); logView.setText(" ", TextView.BufferType.EDITABLE); logView.setEditableFactory(Editable.Factory.getInstance()); _editable = (Editable) logView.getText(); setTitle("Main"); PreferenceManager.setDefaultValues(getApplicationContext(), R.xml.preferences, false); SettingsActivity.initPrefs(getApplicationContext()); _indicatorView = (ImageView) findViewById(R.id.indicator); _indicatorAnimation = AnimationUtils.loadAnimation(this, R.anim.indicator_rotate); /* see the SlidingMenu documentation for details*/ SlidingMenu slideMenu = getSlidingMenu(); slideMenu.setShadowWidth(R.dimen.shadow_width); slideMenu.setShadowDrawable(R.drawable.shadow); slideMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset); slideMenu.setFadeDegree(0.35f); slideMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); /////////////////////////////////////////////////////////////// getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); setSlidingActionBarEnabled(true); }
From source file:com.ae.apps.messagecounter.fragments.MessageListFragment.java
/** * The callback method that will be invoked when the data is ready *///from ww w .j av a 2 s.c om @SuppressWarnings("unchecked") @Override public void onDataReady(Object objData) { List<ContactMessageVo> temp = (List<ContactMessageVo>) objData; if (temp != null && adapter != null) { adapter.updateList(temp); if (loadAnimationDone == false) { loadAnimationDone = true; // hide the progressbar mProgressBar.setVisibility(View.INVISIBLE); // Make some hidden views visible with some animation if (null != getActivity() && null != getActivity().getBaseContext()) { Animation slideInAnimation = AnimationUtils.loadAnimation(getActivity().getBaseContext(), R.animator.slide_in_top); // add a small delay before starting the animation slideInAnimation.setStartOffset(500); messageInfoLyout.startAnimation(slideInAnimation); } messageInfoLyout.setVisibility(View.VISIBLE); pageTitleText.setVisibility(View.VISIBLE); } } }
From source file:de.awisus.refugeeaidleipzig.views.map.FragmentKarte.java
/** * Automatically called method inflating the xml-layout * Sets actovoty title to Map//from w ww .j ava 2 s .c o m * @param inflater who cares * @param container who cares * @param savedInstanceState who cares * @return View inflated with the layout */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_karte, container, false); fabUpdate = (FloatingActionButton) view.findViewById(R.id.fabUpdate); fabUpdate.setOnClickListener(this); fabHide = AnimationUtils.loadAnimation(context, R.anim.bt_hide); fabShow = AnimationUtils.loadAnimation(context, R.anim.bt_show); getActivity().setTitle(R.string.app_name); return view; }
From source file:br.com.devfestsul.planetas.utils.ScrollAwareFABBehavior.java
private void animateIn(FloatingActionButton button) { button.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(null).start(); } else {/*from w w w.ja v a2s . co m*/ Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_in); anim.setDuration(200L); anim.setInterpolator(INTERPOLATOR); button.startAnimation(anim); } }
From source file:com.github.kaninohon.poi.ui.widget.ScrollAwareFABBehavior.java
private void animateIn(FloatingActionButton button) { button.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(null).start(); } else {/* ww w . j ava 2 s. c o m*/ Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.support.design.R.anim.fab_in); anim.setDuration(200L); anim.setInterpolator(INTERPOLATOR); button.startAnimation(anim); } }
From source file:com.syncedsynapse.kore2.ui.RemoteFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); hostManager = HostManager.getInstance(getActivity()); hostConnectionObserver = hostManager.getHostConnectionObserver(); buttonInAnim = AnimationUtils.loadAnimation(getActivity(), R.anim.button_in); buttonOutAnim = AnimationUtils.loadAnimation(getActivity(), R.anim.button_out); feedbackTouckListener = new View.OnTouchListener() { @Override/*from www . j a va2s . c o m*/ public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: buttonInAnim.setFillAfter(true); v.startAnimation(buttonInAnim); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: v.startAnimation(buttonOutAnim); break; } return false; } }; }
From source file:com.naman14.timber.adapters.SongsListAdapter.java
private void setAnimation(View viewToAnimate, int position) { // If the bound view wasn't previously displayed on screen, it's animated if (position > lastPosition) { Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.abc_slide_in_bottom); viewToAnimate.startAnimation(animation); lastPosition = position;//from w ww . j a v a2 s . c om } }
From source file:com.chromium.fontinstaller.util.ViewUtils.java
public static void animSlideInBottom(View view, Context context) { if (context == null || view == null) return;// www .j a v a 2s . c om view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.abc_slide_in_bottom)); }
From source file:com.amaze.filemanager.fragments.BookmarksManager.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(false);/* ww w.j a va2s . c o m*/ setRetainInstance(false); s = new Shortcuts(getActivity()); Calendar calendar = Calendar.getInstance(); Sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); int hour = calendar.get(Calendar.HOUR_OF_DAY); theme = Integer.parseInt(Sp.getString("theme", "0")); swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.activity_main_swipe_refresh_layout); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { refresh(); } }); theme1 = theme; if (theme == 2) { if (hour <= 6 || hour >= 18) { theme1 = 1; } else theme1 = 0; } if (theme1 == 1) { getActivity().getWindow().getDecorView().setBackgroundColor(Color.BLACK); listview.setBackgroundColor(Color.BLACK); } m = (MainActivity) getActivity(); m.supportInvalidateOptionsMenu(); Animation animation1 = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_newtab); FloatingActionButton floatingActionButton = (FloatingActionButton) rootView.findViewById(R.id.fab); floatingActionButton.show(true); floatingActionButton.setColorNormal(Color.parseColor(((MainActivity) getActivity()).skin)); floatingActionButton.setColorPressed(Color.parseColor(((MainActivity) getActivity()).skin)); floatingActionButton.setAnimation(animation1); //getActivity().findViewById(R.id.fab).setVisibility(View.VISIBLE); listview.setHasFixedSize(true); getActivity().findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final MaterialDialog.Builder ba1 = new MaterialDialog.Builder(getActivity()); ba1.title(utils.getString(getActivity(), R.string.addbook)); View v = getActivity().getLayoutInflater().inflate(R.layout.dialog, null); final EditText edir = (EditText) v.findViewById(R.id.newname); edir.setHint(utils.getString(getActivity(), R.string.enterpath)); ba1.customView(v, true); if (theme1 == 1) ba1.theme(Theme.DARK); ba1.negativeText(R.string.cancel); ba1.positiveText(R.string.create); String skin = Sp.getString("skin_color", "#03A9F4"); ba1.positiveColor(Color.parseColor(skin)); ba1.negativeColor(Color.parseColor(skin)); ba1.callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog materialDialog) { try { File a = new File(edir.getText().toString()); if (a.isDirectory()) { s.addS(a); b.items.add(a); b.notifyDataSetChanged(); Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.success), Toast.LENGTH_LONG).show(); } else { Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.invalid_dir), Toast.LENGTH_LONG).show(); } } catch (Exception e) { // TODO Auto-generated catch block Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.error), Toast.LENGTH_LONG).show(); } m.updateDrawer(); } @Override public void onNegative(MaterialDialog materialDialog) { } }); ba1.build().show(); } }); icons = new IconUtils(Sp, getActivity()); if (savedInstanceState == null) refresh(); else { bx = utils.toFileArray(savedInstanceState.getStringArrayList("bx")); refresh(bx); linearLayoutManager.scrollToPositionWithOffset(savedInstanceState.getInt("index"), savedInstanceState.getInt("top")); } }