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.engine.privatefood.activity.ImagePreviewActivity.java
@Override public void onImageSingleTap(MotionEvent e) { View topBar = findViewById(R.id.top_bar); View bottomBar = findViewById(R.id.bottom_bar); if (topBar.getVisibility() == View.VISIBLE) { topBar.setAnimation(AnimationUtils.loadAnimation(ImagePreviewActivity.this, R.anim.top_out)); bottomBar.setAnimation(AnimationUtils.loadAnimation(ImagePreviewActivity.this, R.anim.fade_out)); topBar.setVisibility(View.GONE); bottomBar.setVisibility(View.GONE); } else {//from w w w.j a va 2 s.com topBar.setAnimation(AnimationUtils.loadAnimation(ImagePreviewActivity.this, R.anim.top_in)); bottomBar.setAnimation(AnimationUtils.loadAnimation(ImagePreviewActivity.this, R.anim.fade_in)); topBar.setVisibility(View.VISIBLE); bottomBar.setVisibility(View.VISIBLE); } }
From source file:jp.mixi.android.sdk.MixiDialog.java
private void hideLoading() { View progress = findViewById(R.id.progress); progress.setVisibility(View.GONE); progress.startAnimation(AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_out)); View webView = findViewById(R.id.webview); webView.setVisibility(View.VISIBLE); webView.requestFocus(View.FOCUS_DOWN); webView.startAnimation(AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_in)); }
From source file:com.fangzp.daily.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 {/*from w w w . j av a 2 s.c om*/ Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.design_fab_in); anim.setDuration(200L); anim.setInterpolator(INTERPOLATOR); button.startAnimation(anim); } }
From source file:cn.lingox.android.share.view.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 {/*w ww . j a va2s.co m*/ Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.support.design.R.anim.design_fab_in); anim.setDuration(200L); anim.setInterpolator(INTERPOLATOR); button.startAnimation(anim); } }
From source file:by.gravity.expensemanager.fragments.SherlockProgressFragment.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. * //from ww w. ja v a2 s .c o m * @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. */ private void setContentShown(boolean shown, boolean animate) { ensureContent(); if (mContentShown == shown && !isContentEmpty()) { 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)); if (mEmptyView != null && mEmptyView.getVisibility() == View.VISIBLE) { mEmptyView.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } } else { mProgressContainer.clearAnimation(); mContentContainer.clearAnimation(); mEmptyView.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mContentContainer.setVisibility(View.VISIBLE); if (mEmptyView != null && mEmptyView.getVisibility() == View.VISIBLE) { mEmptyView.setVisibility(View.GONE); } } else { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mContentContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); if (mEmptyView != null && mEmptyView.getVisibility() == View.VISIBLE) { mEmptyView.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } } else { mProgressContainer.clearAnimation(); mContentContainer.clearAnimation(); mEmptyView.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mContentContainer.setVisibility(View.GONE); if (mEmptyView != null && mEmptyView.getVisibility() == View.VISIBLE) { mEmptyView.setVisibility(View.GONE); } } }
From source file:com.orangemoo.com.beta.widget.ScrollFABBehavior.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).setDuration(Utils.SWIPE_BEHAVIOR_ANIMATION_TIME).start(); } else {/*from www .j av a 2s . c o m*/ Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.support.design.R.anim.design_fab_in); anim.setDuration(Utils.SWIPE_BEHAVIOR_ANIMATION_TIME); anim.setInterpolator(INTERPOLATOR); button.startAnimation(anim); } }
From source file:samples.piggate.com.piggateInfoDemo.Activity_Logged.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); _piggate = new Piggate(this, null); //Initialize the Piggate object setContentView(R.layout.activity_logged); getSupportActionBar().setTitle(PiggateUser.getEmail()); startService(new Intent(getApplicationContext(), Service_Notify.class)); //Start the service //Initialize recycler view mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); newBeaconsLayout = (LinearLayout) findViewById(R.id.newBeaconsLayout); //Initialize swipe layout mSwipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container); mSwipeLayout.setOnRefreshListener(this); errorDialog = new AlertDialog.Builder(this).create(); errorDialog.setTitle("Logout error"); errorDialog.setMessage("There is an error with the logout"); errorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override/*from w w w . j av a2s.c om*/ public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); networkErrorDialog = new AlertDialog.Builder(this).create(); networkErrorDialog.setTitle("Network error"); networkErrorDialog.setMessage("There is an error with the network connection"); networkErrorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); fadeIn = AnimationUtils.loadAnimation(Activity_Logged.this, R.anim.fadein); fadeOut = AnimationUtils.loadAnimation(Activity_Logged.this, R.anim.fadeout); //Check if the bluetooth is switched on BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (!mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT); } }
From source file:net.amdroid.metrosp.MetroSP.java
/** Called when the activity is first created. */ @Override// w ww. ja va 2s . c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); /* Select the configured Theme */ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String themeStr = prefs.getString(Preferences.PREF_THEME, "White.Theme"); int theme = getResources().getIdentifier(themeStr, "style", "net.amdroid.metrosp"); setTheme(theme); setContentView(R.layout.main); AdView adView = new AdView(this, AdSize.BANNER, "a14d8821cfdf925"); LinearLayout layout = (LinearLayout) findViewById(R.id.addsLayout); layout.addView(adView); AdRequest adrequest = new AdRequest(); adView.loadAd(adrequest); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title); metroLines = new ArrayList<MetroLine>(); int resID = R.layout.list_item; adapter = new MetroLineAdapter(this, resID, metroLines); listview = (ListView) findViewById(R.id.metroList); title = (TextView) findViewById(R.id.app_title); refresh_btn = (Button) findViewById(R.id.refresh_button); listview.setAdapter(adapter); refresh_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.d("MetroSP", "Refresh"); refreshData(); } }); /* Setup the viewFlipper to do the slidding tab */ viewFlipper = (ViewFlipper) findViewById(R.id.flipper); slideLeftIn = AnimationUtils.loadAnimation(this, R.anim.slide_left_in); slideLeftOut = AnimationUtils.loadAnimation(this, R.anim.slide_left_out); slideRightIn = AnimationUtils.loadAnimation(this, R.anim.slide_right_in); slideRightOut = AnimationUtils.loadAnimation(this, R.anim.slide_right_out); firsttab = true; /* Set listview OnClick Handler to show package status */ listview.setOnItemClickListener(listviewOnClick); refreshData(); }
From source file:com.chromium.fontinstaller.util.ViewUtils.java
public static void animSlideUp(View view, Context context) { if (context == null || view == null) return;// w w w . j a v a 2 s . co m view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.abc_slide_out_top)); }
From source file:com.amaze.filemanager.adapters.TabSpinnerAdapter.java
@Override public View getDropDownView(final int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.spinner_dropdown_layout, parent, false); ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame)); final TextView textView = (TextView) row.findViewById(R.id.spinnerText); LinearLayout linearLayout = (LinearLayout) row.findViewById(R.id.textParent); final SharedPreferences sharedPreferences1 = PreferenceManager.getDefaultSharedPreferences(context); String skin = sharedPreferences1.getString("skin_color", "#5677fc"); final int spinner_current = sharedPreferences1.getInt("spinner_selected", 0); ImageButton imageButton = (ImageButton) row.findViewById(R.id.spinnerButton); if (items.get(position).equals("/")) textView.setText(R.string.rootdirectory); else/*from w w w .ja v a 2s.c o m*/ textView.setText(new File(items.get(position)).getName()); imageButton.setBackgroundColor(Color.parseColor(skin)); if (position == spinner_current) { textView.setTextColor(Color.parseColor(skin)); textView.setTypeface(null, Typeface.BOLD); } linearLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { hideSpinnerDropDown(spinner); if (position == spinner_current) { } else { TabHandler tabHandler1 = new TabHandler(context, null, null, 1); Tab tab = tabHandler1.findTab(position); String name = tab.getPath(); //Toast.makeText(getActivity(), name, Toast.LENGTH_SHORT).show(); sharedPreferences1.edit().putString("current", name).apply(); sharedPreferences1.edit().putInt("spinner_selected", position).apply(); Main ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame)); ma.loadlist(new File(tab.getPath()), false); Animation animationLeft = AnimationUtils.loadAnimation(getContext(), R.anim.tab_selection_left); Animation animationRight = AnimationUtils.loadAnimation(getContext(), R.anim.tab_selection_right); if (position < spinner_current) { ma.listView.setAnimation(animationLeft); ma.gridView.setAnimation(animationLeft); } else { ma.listView.setAnimation(animationRight); ma.gridView.setAnimation(animationRight); } } } }); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TabHandler tabHandler = new TabHandler(context, null, null, 1); Tab tab = tabHandler.findTab(position); if (position > spinner_current) { //Toast.makeText(getContext(), "Closed", Toast.LENGTH_SHORT).show(); items.remove(position); int old_tab = tab.getTab(); int a; for (a = old_tab; a < tabHandler.getTabsCount() - 1; a++) { int new_tab = a + 1; Tab tab1 = tabHandler.findTab(new_tab); String next_label = tab1.getLabel(); String next_path = tab1.getPath(); tabHandler.updateTab(new Tab(a, next_label, next_path)); } tabHandler.deleteTab(tabHandler.getTabsCount() - 1); hideSpinnerDropDown(spinner); } else if (position < spinner_current) { // Toast.makeText(getContext(), "Closed", Toast.LENGTH_SHORT).show(); items.remove(position); int old_tab = tab.getTab(); int a; for (a = old_tab; a < tabHandler.getTabsCount() - 1; a++) { int new_tab = a + 1; Tab tab1 = tabHandler.findTab(new_tab); String next_label = tab1.getLabel(); String next_path = tab1.getPath(); tabHandler.updateTab(new Tab(a, next_label, next_path)); } tabHandler.deleteTab(tabHandler.getTabsCount() - 1); int older_spinner_selected = sharedPreferences1.getInt("spinner_selected", 0); older_spinner_selected--; sharedPreferences1.edit().putInt("spinner_selected", older_spinner_selected).apply(); hideSpinnerDropDown(spinner); } else if (position == spinner_current) { if (tabHandler.getTabsCount() == 1) { // Toast.makeText(getContext(), "exits the app", Toast.LENGTH_SHORT).show(); ma.home(); } else if (tabHandler.getTabsCount() - 1 > position) { items.remove(position); int old_tab = tab.getTab(); int a; for (a = old_tab; a < tabHandler.getTabsCount() - 1; a++) { int new_tab = a + 1; Tab tab1 = tabHandler.findTab(new_tab); String next_label = tab1.getLabel(); String next_path = tab1.getPath(); tabHandler.updateTab(new Tab(a, next_label, next_path)); } tabHandler.deleteTab(tabHandler.getTabsCount() - 1); Tab tab1 = tabHandler.findTab(spinner_current); ma.loadlist(new File(tab1.getPath()), false); } else if (tabHandler.getTabsCount() - 1 == position) { items.remove(position); tabHandler.deleteTab(tabHandler.getTabsCount() - 1); int older_spinner_selected = sharedPreferences1.getInt("spinner_selected", 0); older_spinner_selected--; sharedPreferences1.edit().putInt("spinner_selected", older_spinner_selected).apply(); Tab tab1 = tabHandler.findTab(older_spinner_selected); Main ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame)); ma.loadlist(new File(tab1.getPath()), false); } } } }); return row; }