List of usage examples for android.view View setAlpha
public void setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)
From source file:com.artemchep.horario.ui.fragments.details.SubjectFragment.java
@Override public void transformPage(View page, float position) { page.setAlpha(position); }
From source file:org.projectbuendia.client.ui.ProgressFragment.java
private void crossfade(View inView, final View outView) { // Set the content view to 0% opacity but visible, so that it is visible // (but fully transparent) during the animation. inView.setAlpha(0f); inView.setVisibility(View.VISIBLE); // Animate the content view to 100% opacity, and clear any animation // listener set on the view. inView.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null); // Animate the loading view to 0% opacity. After the animation ends, // set its visibility to GONE as an optimization step (it won't // participate in layout passes, etc.) if (outView != null) { outView.animate().alpha(0f).setDuration(mShortAnimationDuration) .setListener(new AnimatorListenerAdapter() { @Override//w w w . j a v a2 s . c om public void onAnimationEnd(Animator animation) { outView.setVisibility(View.GONE); } }); } }
From source file:com.bluros.music.activities.BaseActivity.java
public void setPanelSlideListeners(SlidingUpPanelLayout panelLayout) { panelLayout.setPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { @Override//from w w w . j a va2 s .c om public void onPanelSlide(View panel, float slideOffset) { View nowPlayingCard = QuickControlsFragment.topContainer; nowPlayingCard.setAlpha(1 - slideOffset); } @Override public void onPanelCollapsed(View panel) { View nowPlayingCard = QuickControlsFragment.topContainer; nowPlayingCard.setAlpha(1); } @Override public void onPanelExpanded(View panel) { View nowPlayingCard = QuickControlsFragment.topContainer; nowPlayingCard.setAlpha(0); } @Override public void onPanelAnchored(View panel) { } @Override public void onPanelHidden(View panel) { } }); }
From source file:com.willowtreeapps.spurceexampleapp.fragments.ControlsFragment.java
private void resetChildViewsAndStartSort() { if (spruceAnimator != null) { spruceAnimator.cancel();/*from www . j a v a 2 s . co m*/ } for (View view : children) { view.setAlpha(0); } setupSort(); }
From source file:cn.androidy.materialdesignsample.animations.CrossfadeActivity.java
/** * Cross-fades between {@link #mContentView} and {@link #mLoadingView}. *///from w ww.ja va 2 s . co m private void showContentOrLoadingIndicator(boolean contentLoaded) { // Decide which view to hide and which to show. final View showView = contentLoaded ? mContentView : mLoadingView; final View hideView = contentLoaded ? mLoadingView : mContentView; // Set the "show" view to 0% opacity but visible, so that it is visible // (but fully transparent) during the animation. showView.setAlpha(0f); showView.setVisibility(View.VISIBLE); // Animate the "show" view to 100% opacity, and clear any animation listener set on // the view. Remember that listeners are not limited to the specific animation // describes in the chained method calls. Listeners are set on the // ViewPropertyAnimator object for the view, which persists across several // animations. showView.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null); // Animate the "hide" view to 0% opacity. After the animation ends, set its visibility // to GONE as an optimization step (it won't participate in layout passes, etc.) hideView.animate().alpha(0f).setDuration(mShortAnimationDuration) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { hideView.setVisibility(View.GONE); } }); }
From source file:pl.mrwojtek.sensrec.app.RecordsActivity.java
private void animateShow(View view, boolean animate) { view.setVisibility(View.VISIBLE); view.setAlpha(1.0f); }
From source file:com.technologx.firebirddesigns.MainInterface.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bottom_interface); View main = findViewById(R.id.main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (main != null) { main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); }// w w w. j a v a 2 s . c o m } AppCompatActivity activity = this; activity.setSupportActionBar(toolbar); activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); activity.getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_toolbar); activity.getSupportActionBar().setTitle("Fire Bird Designs"); activity.getSupportActionBar().setSubtitle("News, Content and More"); UpdateChecker checker = new UpdateChecker(this); UpdateChecker.setStore(Store.GOOGLE_PLAY); UpdateChecker.setNoticeIcon(R.mipmap.ic_launcher); UpdateChecker.start(); result = new DrawerBuilder(this).withToolbar(toolbar).withDisplayBelowStatusBar(false) .withTranslucentStatusBar(false).withActionBarDrawerToggleAnimated(true) .withDrawerLayout(R.layout.material_drawer_fits_not).withHeader(R.layout.settings_header) .addDrawerItems(new SectionDrawerItem().withName("Application"), new PrimaryDrawerItem().withName("Notifications").withIdentifier(1), new PrimaryDrawerItem().withName("Homepage").withIdentifier(2), new ExpandableDrawerItem().withName("More").withSubItems( new PrimaryDrawerItem().withName("Settings").withIdentifier(3), new PrimaryDrawerItem().withName("License").withIdentifier(4), new PrimaryDrawerItem().withName("Contact").withIdentifier(5))) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { long id = drawerItem.getIdentifier(); if (id == 1) { Intent intent = new Intent(MainInterface.this, NewsfeedActivity.class); startActivity(intent); } else if (id == 2) { Intent intent = new Intent(MainInterface.this, WebViewActivity.class); startActivity(intent); } else if (id == 3) { Intent intent = new Intent(MainInterface.this, SettingsActivity.class); startActivity(intent); } else if (id == 4) { new LicensesDialog.Builder(MainInterface.this).setNotices(R.raw.licenses).build() .show(); } else if (id == 5) { AlertDialog alertDialog = new AlertDialog.Builder(MainInterface.this).create(); alertDialog.setTitle(getResources().getString(R.string.feedback_title)); alertDialog.setMessage(getResources().getString(R.string.feedback_summary)); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.email), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { sendEmail(); } }); alertDialog.setButton(DialogInterface.BUTTON_NEUTRAL, getResources().getString(R.string.hangout), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { startHangout(); } }); alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(android.R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alertDialog.show(); } return false; } }).withSavedInstance(savedInstanceState).build(); // Setup the viewPager ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(pagerAdapter); viewPager.setCurrentItem(1); viewPager.setPageTransformer(false, new ViewPager.PageTransformer() { @Override public void transformPage(View page, float position) { final float normalizedposition = Math.abs(Math.abs(position) - 1); page.setAlpha(normalizedposition); } }); mTabLayout = (TabLayout) findViewById(R.id.tab_layout); if (mTabLayout != null) { mTabLayout.setupWithViewPager(viewPager); for (int i = 0; i < mTabLayout.getTabCount(); i++) { TabLayout.Tab tab = mTabLayout.getTabAt(i); if (tab != null) tab.setCustomView(pagerAdapter.getTabView(i)); } mTabLayout.getTabAt(0).getCustomView().setSelected(true); } }
From source file:org.getlantern.firetweet.fragment.support.SearchFragment.java
private void updateTabOffset() { final int controlBarHeight = getControlBarHeight(); final int translationY = controlBarHeight - mControlBarOffsetPixels; final FragmentActivity activity = getActivity(); if (activity instanceof LinkHandlerActivity) { final View view = activity.getWindow().findViewById(android.support.v7.appcompat.R.id.action_bar); if (view != null && controlBarHeight != 0) { view.setAlpha(translationY / (float) controlBarHeight); }// ww w . jav a 2s. c o m } mPagerIndicator.setTranslationY(translationY); mPagerWindowOverlay.setTranslationY(translationY); }
From source file:com.mvcoding.financius.feature.RevealTransition.java
@Override public Animator onAppear(ViewGroup sceneRoot, final View view, TransitionValues startValues, TransitionValues endValues) {//from ww w.java2 s .c o m float radius = calculateMaxRadius(view); final float originalAlpha = 1; // TODO: For some reason this returns 0 view.getAlpha(); view.setAlpha(0f); Animator reveal = createAnimator(view, 0, radius); reveal.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { view.setAlpha(originalAlpha); } }); return reveal; }
From source file:com.devilyang.musicstation.swinginadapters.AnimationAdapter.java
private void animateView(int position, ViewGroup parent, View view) { if (mAnimationStartMillis == -1) { mAnimationStartMillis = System.currentTimeMillis(); }//from www. java 2s. c o m // ViewDragHelper.setAlpha(view, 0); view.setAlpha(0); Animator[] childAnimators; if (mDecoratedBaseAdapter instanceof AnimationAdapter) { childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view); } else { childAnimators = new Animator[0]; } Animator[] animators = getAnimators(parent, view); Animator alphaAnimator = ObjectAnimator.ofFloat(view, "alpha", 0, 1); AnimatorSet set = new AnimatorSet(); set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator)); set.setStartDelay(calculateAnimationDelay()); set.setDuration(getAnimationDurationMillis()); set.start(); mAnimators.put(view.hashCode(), set); }