List of usage examples for android.view.animation AnimationSet addAnimation
public void addAnimation(Animation a)
From source file:org.videolan.vlc.gui.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle("VLC " + BuildConfig.VERSION_NAME); View v = inflater.inflate(R.layout.about, container, false); View aboutMain = v.findViewById(R.id.about_main); WebView t = (WebView) v.findViewById(R.id.webview); String revision = getString(R.string.build_revision); t.loadData(Util.readAsset("licence.htm", "").replace("!COMMITID!", revision), "text/html", "UTF8"); TextView link = (TextView) v.findViewById(R.id.main_link); link.setText(Html.fromHtml(this.getString(R.string.about_link))); String builddate = getString(R.string.build_time); String builder = getString(R.string.build_host); TextView compiled = (TextView) v.findViewById(R.id.main_compiled); compiled.setText(builder + " (" + builddate + ")"); TextView textview_rev = (TextView) v.findViewById(R.id.main_revision); textview_rev.setText(getResources().getString(R.string.revision) + " " + revision + " (" + builddate + ")"); final ImageView logo = (ImageView) v.findViewById(R.id.logo); logo.setOnClickListener(new OnClickListener() { @Override//from ww w .j a v a 2 s.co m public void onClick(View v) { AnimationSet anim = new AnimationSet(true); RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(800); rotate.setInterpolator(new DecelerateInterpolator()); anim.addAnimation(rotate); logo.startAnimation(anim); } }); List<View> lists = Arrays.asList(aboutMain, t); String[] titles = new String[] { getString(R.string.about), getString(R.string.licence) }; mViewPager = (ViewPager) v.findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(MODE_TOTAL - 1); mViewPager.setAdapter(new AudioPagerAdapter(lists, titles)); mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs); mTabLayout.setupWithViewPager(mViewPager); return v; }
From source file:it.imwatch.nfclottery.dialogs.InsertContactDialog.java
/** * Shows the name error textfield with the appropriate * error message.//from ww w.ja va2s . c o m */ private void showNameError() { mNameErrorState = 1; // Disable the positive button of the dialog setFormIsValidated(false); if (mNameErrorTextView.getVisibility() == View.VISIBLE) { return; // No need to animate in the textview, it's already visible } mNameErrorTextView.setVisibility(View.VISIBLE); AnimationSet fadeInSet = new AnimationSet(true); fadeInSet.addAnimation(new AlphaAnimation(0f, 1f)); fadeInSet.addAnimation(new TranslateAnimation(0f, 0f, -mErrorAnimTranslateY, 0f)); fadeInSet.setDuration(300); mNameErrorTextView.startAnimation(fadeInSet); }
From source file:it.imwatch.nfclottery.dialogs.InsertContactDialog.java
/** * Shows the email error textfield with the appropriate * error message./* w ww . java2s . c o m*/ * * @param message The error message to show */ private void showEmailError(CharSequence message, int errState) { mEmailErrorTextView.setText(message); mEmailErrorState = errState; // Disable the positive button of the dialog setFormIsValidated(false); if (mEmailErrorTextView.getVisibility() == View.VISIBLE) { return; // No need to animate in the textview, it's already visible } mEmailErrorTextView.setVisibility(View.VISIBLE); AnimationSet fadeInSet = new AnimationSet(true); fadeInSet.addAnimation(new AlphaAnimation(0f, 1f)); fadeInSet.addAnimation(new TranslateAnimation(0f, 0f, -mErrorAnimTranslateY, 0f)); fadeInSet.setDuration(300); mEmailErrorTextView.startAnimation(fadeInSet); }
From source file:it.imwatch.nfclottery.dialogs.InsertContactDialog.java
/** * Hides the email error textview./*from www. j a v a2 s . com*/ */ private void hideEmailError() { mEmailErrorState = 0; // Re-enable the positive button of the dialog iif the name is also valid setFormIsValidated(mNameErrorState == 0); if (mEmailErrorTextView.getVisibility() == View.GONE) { return; // No need to animate out the textview, it's already gone } AnimationSet fadeOutSet = new AnimationSet(true); fadeOutSet.addAnimation(new AlphaAnimation(1f, 0f)); fadeOutSet.addAnimation(new TranslateAnimation(0f, 0f, 0f, -mErrorAnimTranslateY)); fadeOutSet.setDuration(300); fadeOutSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { // Don't care } @Override public void onAnimationEnd(Animation animation) { mEmailErrorTextView.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { // Don't care } }); mEmailErrorTextView.startAnimation(fadeOutSet); }
From source file:it.imwatch.nfclottery.dialogs.InsertContactDialog.java
/** * Hides the name error textview./* w w w. ja v a 2s . c om*/ */ private void hideNameError() { mNameErrorState = 0; // Re-enable the positive button of the dialog iif the name is also valid setFormIsValidated(mEmailErrorState == 0); if (mNameErrorTextView.getVisibility() == View.GONE) { return; // No need to animate out the textview, it's already gone } AnimationSet fadeOutSet = new AnimationSet(true); fadeOutSet.addAnimation(new AlphaAnimation(1f, 0f)); fadeOutSet.addAnimation(new TranslateAnimation(0f, 0f, 0f, -mErrorAnimTranslateY)); fadeOutSet.setDuration(300); fadeOutSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { // Don't care } @Override public void onAnimationEnd(Animation animation) { mNameErrorTextView.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { // Don't care } }); mNameErrorTextView.startAnimation(fadeOutSet); }
From source file:uk.org.ngo.squeezer.itemlist.AlarmView.java
private View getAdapterView(View convertView, final ViewGroup parent) { AlarmViewHolder currentViewHolder = (convertView != null && convertView.getTag() instanceof AlarmViewHolder) ? (AlarmViewHolder) convertView.getTag() : null;// ww w. ja v a2 s. c o m if (currentViewHolder == null) { convertView = getLayoutInflater().inflate(R.layout.list_item_alarm, parent, false); final View alarmView = convertView; final AlarmViewHolder viewHolder = new AlarmViewHolder(); viewHolder.is24HourFormat = DateFormat.is24HourFormat(getActivity()); viewHolder.timeFormat = viewHolder.is24HourFormat ? "%02d:%02d" : "%d:%02d"; String[] amPmStrings = new DateFormatSymbols().getAmPmStrings(); viewHolder.am = amPmStrings[0]; viewHolder.pm = amPmStrings[1]; viewHolder.time = (TextView) convertView.findViewById(R.id.time); viewHolder.amPm = (TextView) convertView.findViewById(R.id.am_pm); viewHolder.amPm.setVisibility(viewHolder.is24HourFormat ? View.GONE : View.VISIBLE); viewHolder.enabled = new CompoundButtonWrapper((CompoundButton) convertView.findViewById(R.id.enabled)); viewHolder.enabled.setOncheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (getActivity().getService() != null) { viewHolder.alarm.setEnabled(b); getActivity().getService().alarmEnable(viewHolder.alarm.getId(), b); } } }); viewHolder.repeat = new CompoundButtonWrapper((CompoundButton) convertView.findViewById(R.id.repeat)); viewHolder.repeat.setOncheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (getActivity().getService() != null) { viewHolder.alarm.setRepeat(b); getActivity().getService().alarmRepeat(viewHolder.alarm.getId(), b); viewHolder.dowHolder.setVisibility(b ? View.VISIBLE : View.GONE); } } }); viewHolder.repeat.getButton().setText(ServerString.ALARM_ALARM_REPEAT.getLocalizedString()); viewHolder.delete = (ImageView) convertView.findViewById(R.id.delete); viewHolder.playlist = (Spinner) convertView.findViewById(R.id.playlist); viewHolder.dowHolder = (LinearLayout) convertView.findViewById(R.id.dow); for (int day = 0; day < 7; day++) { ViewGroup dowButton = (ViewGroup) viewHolder.dowHolder.getChildAt(day); final int finalDay = day; dowButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getActivity().getService() != null) { final Alarm alarm = viewHolder.alarm; boolean wasChecked = alarm.isDayActive(finalDay); if (wasChecked) { alarm.clearDay(finalDay); getActivity().getService().alarmRemoveDay(alarm.getId(), finalDay); } else { alarm.setDay(finalDay); getActivity().getService().alarmAddDay(alarm.getId(), finalDay); } setDowText(viewHolder, finalDay); } } }); viewHolder.dowTexts[day] = (TextView) dowButton.getChildAt(0); } viewHolder.delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { final AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(new ScaleAnimation(1F, 1F, 1F, 0.5F)); animationSet.addAnimation(new AlphaAnimation(1F, 0F)); animationSet.setDuration(ANIMATION_DURATION); animationSet.setAnimationListener(new AnimationEndListener() { @Override public void onAnimationEnd(Animation animation) { mActivity.getItemAdapter().removeItem(viewHolder.position); UndoBarController.show(getActivity(), ServerString.ALARM_DELETING.getLocalizedString(), new UndoListener(viewHolder.position, viewHolder.alarm)); } }); alarmView.startAnimation(animationSet); } }); viewHolder.playlist.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { final AlarmPlaylist selectedAlarmPlaylist = mAlarmPlaylists.get(position); final Alarm alarm = viewHolder.alarm; if (getActivity().getService() != null && selectedAlarmPlaylist.getId() != null && !selectedAlarmPlaylist.getId().equals(alarm.getUrl())) { alarm.setUrl(selectedAlarmPlaylist.getId()); getActivity().getService().alarmSetPlaylist(alarm.getId(), selectedAlarmPlaylist); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); convertView.setTag(viewHolder); } return convertView; }
From source file:com.glabs.homegenie.StartActivity.java
public void hideLogo() { _islogovisible = false;/* w w w . j a v a 2 s . c o m*/ runOnUiThread(new Runnable() { @Override public void run() { Animation fadeOut = new AlphaAnimation(0.8f, 0); fadeOut.setInterpolator(new AccelerateInterpolator()); //and this fadeOut.setStartOffset(0); fadeOut.setDuration(500); // AnimationSet animation = new AnimationSet(false); //change to false animation.addAnimation(fadeOut); animation.setFillAfter(true); RelativeLayout ivlogo = (RelativeLayout) findViewById(R.id.logo); ivlogo.startAnimation(animation); } }); }
From source file:com.glabs.homegenie.StartActivity.java
public void showLogo() { _islogovisible = true;/*ww w . j a v a 2 s . c o m*/ runOnUiThread(new Runnable() { @Override public void run() { Animation fadeIn = new AlphaAnimation(0, 0.8f); fadeIn.setInterpolator(new AccelerateInterpolator()); //and this fadeIn.setStartOffset(0); fadeIn.setDuration(500); // AnimationSet animation = new AnimationSet(false); //change to false animation.addAnimation(fadeIn); animation.setFillAfter(true); RelativeLayout ivlogo = (RelativeLayout) findViewById(R.id.logo); ivlogo.startAnimation(animation); } }); }
From source file:org.videolan.vlc2.gui.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle("VLC " + getVersion(getActivity())); View v = inflater.inflate(R.layout.about, container, false); mTabHost = (TabHost) v.findViewById(android.R.id.tabhost); mFlingViewGroup = (FlingViewGroup) v.findViewById(R.id.fling_view_group); WebView t = (WebView) v.findViewById(R.id.webview); String revision = Util.readAsset("revision.txt", "Unknown revision"); t.loadData(Util.readAsset("licence.htm", "").replace("!COMMITID!", revision), "text/html", "UTF8"); TextView link = (TextView) v.findViewById(R.id.main_link); link.setText(Html.fromHtml(this.getString(R.string.about_link))); String builddate = Util.readAsset("builddate.txt", "Unknown"); String builder = Util.readAsset("builder.txt", "unknown"); TextView compiled = (TextView) v.findViewById(R.id.main_compiled); compiled.setText(builder + " (" + builddate + ")"); TextView textview_rev = (TextView) v.findViewById(R.id.main_revision); textview_rev.setText(getResources().getString(R.string.revision) + " " + revision + " (" + builddate + ")"); final ImageView logo = (ImageView) v.findViewById(R.id.logo); logo.setOnClickListener(new OnClickListener() { @Override//from w w w . j a va2s.c om public void onClick(View v) { AnimationSet anim = new AnimationSet(true); RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(800); rotate.setInterpolator(new DecelerateInterpolator()); anim.addAnimation(rotate); logo.startAnimation(anim); } }); mTabHost.setup(); addNewTab(mTabHost, "about", getResources().getString(R.string.about)); addNewTab(mTabHost, "licence", getResources().getString(R.string.licence)); mTabHost.setCurrentTab(mCurrentTab); mFlingViewGroup.snapToScreen(mCurrentTab); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String tabId) { mCurrentTab = mTabHost.getCurrentTab(); mFlingViewGroup.smoothScrollTo(mCurrentTab); } }); mFlingViewGroup.setOnViewSwitchedListener(new FlingViewGroup.ViewSwitchListener() { @Override public void onSwitching(float progress) { } @Override public void onSwitched(int position) { mTabHost.setCurrentTab(position); } @Override public void onTouchDown() { } @Override public void onTouchUp() { } @Override public void onTouchClick() { } @Override public void onBackSwitched() { MainActivity activity = (MainActivity) getActivity(); activity.popSecondaryFragment(); } }); return v; }
From source file:com.money.manager.ex.fragment.HomeFragment.java
public LayoutAnimationController setAnimationView(View view) { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(250);/*from ww w . j a v a 2s .c om*/ set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(150); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f); return controller; }