List of usage examples for android.view.animation AlphaAnimation setDuration
public void setDuration(long durationMillis)
From source file:adventure_fragments.Kayaking.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.kayaking_fragment, container, false); this.rootView = rootView; db = new DataBaseHelper(getActivity()); list = db.getAllItemsKayaking();//from w w w.j a v a 2 s.co m adapt = new CustomAdapter3(getActivity(), R.layout.item_layout, list); listItem = (ListView) rootView.findViewById(R.id.listview_kayak); listItem.setAdapter(adapt); nothingtext = (TextView) rootView.findViewById(R.id.nothing_here_kayak); count = listItem.getCount(); if (count > 0) { nothingtext.setVisibility(View.GONE); } else if (count == 0) { nothingtext.setVisibility(View.VISIBLE); } final ImageButton imageButton = (ImageButton) rootView.findViewById(R.id.add_item_kayaking); listItem.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { // TODO Auto-generated method stub switch (scrollState) { case 2: // SCROLL_STATE_FLING //hide button here imageButton.setVisibility(View.GONE); break; case 1: // SCROLL_STATE_TOUCH_SCROLL //hide button here imageButton.setVisibility(View.GONE); break; case 0: // SCROLL_STATE_IDLE //show button here imageButton.setVisibility(View.VISIBLE); break; default: //show button here imageButton.setVisibility(View.VISIBLE); break; } } }); imageButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { CountDownTimer timer = new CountDownTimer(4000, 1000) { @Override public void onTick(long millisUntilFinished) { imageButton.setVisibility(View.GONE); } @Override public void onFinish() { imageButton.setVisibility(View.VISIBLE); } }; timer.start(); return true; } }); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddItemNow(); AlphaAnimation animation1 = new AlphaAnimation(0.2f, 1.0f); animation1.setDuration(500); imageButton.startAnimation(animation1); } }); return rootView; }
From source file:adventure_fragments.Swimming.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.swimming_fragment_layout, container, false); this.rootView = rootView; db = new DataBaseHelper(getActivity()); list = db.getAllItemsSwimming();/*from w w w.java 2 s . c o m*/ adapt = new CustomAdapter6(getActivity(), R.layout.item_layout, list); listItem = (ListView) rootView.findViewById(R.id.listview_swim); listItem.setAdapter(adapt); nothingtext = (TextView) rootView.findViewById(R.id.nothing_here_swim); count = listItem.getCount(); if (count > 0) { nothingtext.setVisibility(View.GONE); } else if (count == 0) { nothingtext.setVisibility(View.VISIBLE); } final ImageButton imageButton = (ImageButton) rootView.findViewById(R.id.add_item_swimming); listItem.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { // TODO Auto-generated method stub switch (scrollState) { case 2: // SCROLL_STATE_FLING //hide button here imageButton.setVisibility(View.GONE); break; case 1: // SCROLL_STATE_TOUCH_SCROLL //hide button here imageButton.setVisibility(View.GONE); break; case 0: // SCROLL_STATE_IDLE //show button here imageButton.setVisibility(View.VISIBLE); break; default: //show button here imageButton.setVisibility(View.VISIBLE); break; } } }); imageButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { CountDownTimer timer = new CountDownTimer(4000, 1000) { @Override public void onTick(long millisUntilFinished) { imageButton.setVisibility(View.GONE); } @Override public void onFinish() { imageButton.setVisibility(View.VISIBLE); } }; timer.start(); return true; } }); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddItemNow(); AlphaAnimation animation1 = new AlphaAnimation(0.2f, 1.0f); animation1.setDuration(500); imageButton.startAnimation(animation1); } }); return rootView; }
From source file:adventure_fragments.Camping.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.camping_fragment_layout, container, false); this.rootView = rootView; db = new DataBaseHelper(getActivity()); list = db.getAllItemsCamping();/* w w w . j av a 2 s . c om*/ adapt = new CustomAdapter1(getActivity(), R.layout.item_layout, list); listItem = (ListView) rootView.findViewById(R.id.listview_camp); listItem.setAdapter(adapt); nothingtext = (TextView) rootView.findViewById(R.id.nothing_here_camp); count = listItem.getCount(); if (count > 0) { nothingtext.setVisibility(View.GONE); } else if (count == 0) { nothingtext.setVisibility(View.VISIBLE); } final ImageButton imageButton = (ImageButton) rootView.findViewById(R.id.add_object_camping); listItem.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { // TODO Auto-generated method stub switch (scrollState) { case 2: // SCROLL_STATE_FLING //hide button here imageButton.setVisibility(View.GONE); break; case 1: // SCROLL_STATE_TOUCH_SCROLL //hide button here imageButton.setVisibility(View.GONE); break; case 0: // SCROLL_STATE_IDLE //show button here imageButton.setVisibility(View.VISIBLE); break; default: //show button here imageButton.setVisibility(View.VISIBLE); break; } } }); imageButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { CountDownTimer timer = new CountDownTimer(4000, 1000) { @Override public void onTick(long millisUntilFinished) { imageButton.setVisibility(View.GONE); } @Override public void onFinish() { imageButton.setVisibility(View.VISIBLE); } }; timer.start(); return true; } }); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddItemNow(); AlphaAnimation animation1 = new AlphaAnimation(0.2f, 1.0f); animation1.setDuration(500); imageButton.startAnimation(animation1); } }); return rootView; }
From source file:adventure_fragments.Climbing.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.climbing_fragment_layout, container, false); this.rootView = rootView; db = new DataBaseHelper(getActivity()); list = db.getAllItemsClimbing();//from www. j ava2 s .c o m adapt = new CustomAdapter1(getActivity(), R.layout.item_layout, list); listItem = (ListView) rootView.findViewById(R.id.listview_climb); listItem.setAdapter(adapt); nothingtext = (TextView) rootView.findViewById(R.id.nothing_here_climb); count = listItem.getCount(); if (count > 0) { nothingtext.setVisibility(View.GONE); } else if (count == 0) { nothingtext.setVisibility(View.VISIBLE); } final ImageButton imageButton = (ImageButton) rootView.findViewById(R.id.climb_button); listItem.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { // TODO Auto-generated method stub switch (scrollState) { case 2: // SCROLL_STATE_FLING //hide button here imageButton.setVisibility(View.GONE); break; case 1: // SCROLL_STATE_TOUCH_SCROLL //hide button here imageButton.setVisibility(View.GONE); break; case 0: // SCROLL_STATE_IDLE //show button here imageButton.setVisibility(View.VISIBLE); break; default: //show button here imageButton.setVisibility(View.VISIBLE); break; } } }); imageButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { CountDownTimer timer = new CountDownTimer(4000, 1000) { @Override public void onTick(long millisUntilFinished) { imageButton.setVisibility(View.GONE); } @Override public void onFinish() { imageButton.setVisibility(View.VISIBLE); } }; timer.start(); return true; } }); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddItemNow(); AlphaAnimation animation1 = new AlphaAnimation(0.2f, 1.0f); animation1.setDuration(500); imageButton.startAnimation(animation1); } }); return rootView; }
From source file:adventure_fragments.Biking.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.biking_fragment_layout, container, false); this.rootView = rootView; db = new DataBaseHelper(getActivity()); list = db.getAllItemsBiking();/*from w w w. j av a2 s. com*/ listItem = (ListView) rootView.findViewById(R.id.listview_bike); adapt = new CustomAdapter(getActivity(), R.layout.item_layout, list); listItem.setAdapter(adapt); nothingtext = (TextView) rootView.findViewById(R.id.nothing_here_bike); count = listItem.getCount(); if (count > 0) { nothingtext.setVisibility(View.GONE); } else if (count == 0) { nothingtext.setVisibility(View.VISIBLE); } Log.i("Count = ", "" + count); final ImageButton imageButton = (ImageButton) rootView.findViewById(R.id.refresh); listItem.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { // TODO Auto-generated method stub switch (scrollState) { case 2: // SCROLL_STATE_FLING //hide button here imageButton.setVisibility(View.GONE); break; case 1: // SCROLL_STATE_TOUCH_SCROLL //hide button here imageButton.setVisibility(View.GONE); break; case 0: // SCROLL_STATE_IDLE //show button here imageButton.setVisibility(View.VISIBLE); break; default: //show button here imageButton.setVisibility(View.VISIBLE); break; } } }); imageButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { CountDownTimer timer = new CountDownTimer(4000, 1000) { @Override public void onTick(long millisUntilFinished) { imageButton.setVisibility(View.GONE); } @Override public void onFinish() { imageButton.setVisibility(View.VISIBLE); } }; timer.start(); return true; } }); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddItemNow(); AlphaAnimation animation1 = new AlphaAnimation(0.2f, 1.0f); animation1.setDuration(500); imageButton.startAnimation(animation1); } }); return rootView; }
From source file:com.launcher.silverfish.launcher.appdrawer.TabbedAppDrawerFragment.java
private void showUninstallIndicator() { // Get the layout FrameLayout uninstall_indicator;//from www . j ava2 s. c om uninstall_indicator = (FrameLayout) rootView.findViewById(R.id.uninstall_indicator); // Make it visible uninstall_indicator.setVisibility(View.VISIBLE); // And start the animation AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(500); uninstall_indicator.startAnimation(animation); }
From source file:org.kiwix.kiwixmobile.ZimFileSelectActivity.java
private void setAlpha(boolean transparent) { float viewTransparency = transparent ? 0.4F : 1F; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mZimFileList.setAlpha(viewTransparency); } else {//from w w w.j av a 2s. co m AlphaAnimation alpha = new AlphaAnimation(viewTransparency, viewTransparency); alpha.setDuration(0); alpha.setFillAfter(true); mZimFileList.startAnimation(alpha); } }
From source file:org.digitalcampus.oppia.activity.CourseIndexActivity.java
private void initializeCourseIndex(boolean animate) { final ListView listView = (ListView) findViewById(R.id.section_list); if (listView == null) return;//w w w . j ava2s . c om ViewCompat.setNestedScrollingEnabled(listView, true); sla = new SectionListAdapter(CourseIndexActivity.this, course, sections, new SectionListAdapter.CourseClickListener() { @Override public void onActivityClicked(String activityDigest) { startCourseActivityByDigest(activityDigest); } }); if (animate) { AlphaAnimation fadeOutAnimation = new AlphaAnimation(1f, 0f); fadeOutAnimation.setDuration(700); fadeOutAnimation.setFillAfter(true); listView.setAlpha(0f); ValueAnimator animator = ValueAnimator.ofFloat(1f, 0f); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator valueAnimator) { listView.setTranslationX((Float) valueAnimator.getAnimatedValue() * 80); listView.setAlpha(1f - (Float) valueAnimator.getAnimatedValue()); } }); animator.setDuration(700); animator.start(); loadingCourseView.startAnimation(fadeOutAnimation); } else { loadingCourseView.setVisibility(View.GONE); listView.setVisibility(View.VISIBLE); } listView.setAdapter(sla); }
From source file:com.freshdigitable.udonroad.UserInfoActivity.java
private void setUpAppbar() { binding.userInfoToolbar.setTitle(""); final TextView toolbarTitle = binding.userInfoToolbarTitle; binding.userInfoAppbarLayout.addOnOffsetChangedListener(new OnOffsetChangedListener() { private boolean isTitleVisible = toolbarTitle.getVisibility() == View.VISIBLE; @Override//from w ww .j ava 2 s .c o m public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { final int totalScrollRange = appBarLayout.getTotalScrollRange(); final float percent = (float) Math.abs(verticalOffset) / (float) totalScrollRange; if (percent > 0.9) { if (!isTitleVisible) { startAnimation(toolbarTitle, View.VISIBLE); isTitleVisible = true; } } else { if (isTitleVisible) { startAnimation(toolbarTitle, View.INVISIBLE); isTitleVisible = false; } } } private void startAnimation(View v, int visibility) { AlphaAnimation animation = (visibility == View.VISIBLE) ? new AlphaAnimation(0f, 1f) : new AlphaAnimation(1f, 0f); animation.setDuration(200); animation.setFillAfter(true); v.startAnimation(animation); } }); }
From source file:org.sufficientlysecure.keychain.ui.ViewKeyAdvShareFragment.java
/** * Load QR Code asynchronously and with a fade in animation *//* w ww.j a v a 2s .co m*/ private void setFingerprint(byte[] fingerprintBlob) { mFingerprint = fingerprintBlob; final String fingerprint = KeyFormattingUtils.convertFingerprintToHex(fingerprintBlob); mFingerprintView.setText(KeyFormattingUtils.colorizeFingerprint(fingerprint)); if (mQrCodeBitmapCache != null) { return; } AsyncTask<Void, Void, Bitmap> loadTask = new AsyncTask<Void, Void, Bitmap>() { protected Bitmap doInBackground(Void... unused) { Uri uri = new Uri.Builder().scheme(Constants.FINGERPRINT_SCHEME).opaquePart(fingerprint).build(); // render with minimal size return QrCodeUtils.getQRCodeBitmap(uri, 0); } protected void onPostExecute(Bitmap qrCode) { // cache for later, and if we are attached request re-layout mQrCodeBitmapCache = qrCode; if (ViewKeyAdvShareFragment.this.isAdded()) { mQrCode.requestLayout(); // simple fade-in animation AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f); anim.setDuration(200); mQrCode.startAnimation(anim); } } }; loadTask.execute(); }