Android Open Source - calendar Utils






From Project

Back to project page calendar.

License

The source code is released under:

GNU General Public License

If you think the Android project calendar listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.fourmob.datetimepicker;
//  w  ww . j  a v  a 2  s .  co  m
import android.annotation.SuppressLint;
import android.os.Build;
import android.view.View;
import android.view.accessibility.AccessibilityManager;

import com.nineoldandroids.animation.Keyframe;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.animation.PropertyValuesHolder;

import java.util.Calendar;


public class Utils {

    public static final int PULSE_ANIMATOR_DURATION = 544;

  public static int getDaysInMonth(int month, int year) {
        switch (month) {
            case Calendar.JANUARY:
            case Calendar.MARCH:
            case Calendar.MAY:
            case Calendar.JULY:
            case Calendar.AUGUST:
            case Calendar.OCTOBER:
            case Calendar.DECEMBER:
                return 31;
            case Calendar.APRIL:
            case Calendar.JUNE:
            case Calendar.SEPTEMBER:
            case Calendar.NOVEMBER:
                return 30;
            case Calendar.FEBRUARY:
                return (year % 4 == 0) ? 29 : 28;
            default:
                throw new IllegalArgumentException("Invalid Month");
        }
  }

  public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float increaseRatio) {
        Keyframe k0 = Keyframe.ofFloat(0f, 1f);
        Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
        Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
        Keyframe k3 = Keyframe.ofFloat(1f, 1f);

        PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
        PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
        ObjectAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY);
        pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);

        return pulseAnimator;
    }

  public static boolean isJellybeanOrLater() {
    return Build.VERSION.SDK_INT >= 16;
  }

    /**
     * Try to speak the specified text, for accessibility. Only available on JB or later.
     * @param text Text to announce.
     */
    @SuppressLint("NewApi")
    public static void tryAccessibilityAnnounce(View view, CharSequence text) {
        if (isJellybeanOrLater() && view != null && text != null) {
            view.announceForAccessibility(text);
        }
    }

    public static boolean isTouchExplorationEnabled(AccessibilityManager accessibilityManager) {
        if (Build.VERSION.SDK_INT >= 14) {
            return accessibilityManager.isTouchExplorationEnabled();
        } else {
            return false;
        }
    }
}




Java Source Code List

com.dorosh.calendar.creator.ideacalendar.app.AddActivity.java
com.dorosh.calendar.creator.ideacalendar.app.ArchiveListFragment.java
com.dorosh.calendar.creator.ideacalendar.app.DatabaseHelper.java
com.dorosh.calendar.creator.ideacalendar.app.MainActivity.java
com.dorosh.calendar.creator.ideacalendar.app.SettingsActivity.java
com.dorosh.calendar.creator.ideacalendar.app.SetupActivity.java
com.dorosh.calendar.creator.ideacalendar.app.StartAcitivity.java
com.dorosh.calendar.creator.ideacalendar.app.TODOListFragment.java
com.dorosh.calendar.creator.ideacalendar.app.Cursors.TODOCursorAdapter.java
com.fourmob.datetimepicker.BuildConfig.java
com.fourmob.datetimepicker.BuildConfig.java
com.fourmob.datetimepicker.Utils.java
com.fourmob.datetimepicker.date.AccessibleDateAnimator.java
com.fourmob.datetimepicker.date.DatePickerController.java
com.fourmob.datetimepicker.date.DatePickerDialog.java
com.fourmob.datetimepicker.date.DayPickerView.java
com.fourmob.datetimepicker.date.SimpleMonthAdapter.java
com.fourmob.datetimepicker.date.SimpleMonthView.java
com.fourmob.datetimepicker.date.TextViewWithCircularIndicator.java
com.fourmob.datetimepicker.date.YearPickerView.java
com.sleepbot.datetimepicker.AccessibleTextView.java
com.sleepbot.datetimepicker.time.AmPmCirclesView.java
com.sleepbot.datetimepicker.time.CircleView.java
com.sleepbot.datetimepicker.time.RadialPickerLayout.java
com.sleepbot.datetimepicker.time.RadialSelectorView.java
com.sleepbot.datetimepicker.time.RadialTextsView.java
com.sleepbot.datetimepicker.time.TimePickerDialog.java