Example usage for android.animation PropertyValuesHolder ofObject

List of usage examples for android.animation PropertyValuesHolder ofObject

Introduction

In this page you can find the example usage for android.animation PropertyValuesHolder ofObject.

Prototype

public static <V> PropertyValuesHolder ofObject(Property<?, V> property, TypeConverter<PointF, V> converter,
        Path path) 

Source Link

Document

Constructs and returns a PropertyValuesHolder with a given property and a Path along which the values should be animated.

Usage

From source file:com.stasbar.knowyourself.alarms.AlarmActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final long instanceId = AlarmInstance.getId(getIntent().getData());
    mAlarmInstance = AlarmInstance.getInstance(getContentResolver(), instanceId);
    if (mAlarmInstance == null) {
        // The alarm was deleted before the activity got created, so just finish()
        LOGGER.e("Error displaying alarm for intent: %s", getIntent());
        finish();/*from   ww  w  . j a  v  a  2  s. c  om*/
        return;
    } else if (mAlarmInstance.mAlarmState != AlarmInstance.FIRED_STATE) {
        LOGGER.i("Skip displaying alarm for instance: %s", mAlarmInstance);
        finish();
        return;
    }

    LOGGER.i("Displaying alarm for instance: %s", mAlarmInstance);

    // Get the volume/camera button behavior setting
    mVolumeBehavior = Utils.getDefaultSharedPreferences(this).getString(SettingsActivity.KEY_VOLUME_BUTTONS,
            SettingsActivity.DEFAULT_VOLUME_BEHAVIOR);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);

    // Hide navigation bar to minimize accidental tap on Home key
    hideNavigationBar();

    // Close dialogs and window shade, so this is fully visible
    sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

    // Honor rotation on tablets; fix the orientation on phones.
    if (!getResources().getBoolean(R.bool.config_rotateAlarmAlert)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    }

    mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);

    setContentView(R.layout.alarm_activity);

    mAlertView = (ViewGroup) findViewById(R.id.alert);
    mAlertTitleView = (TextView) mAlertView.findViewById(R.id.alert_title);
    mAlertInfoView = (TextView) mAlertView.findViewById(R.id.alert_info);

    mContentView = (ViewGroup) findViewById(R.id.content);
    mAlarmButton = (ImageView) mContentView.findViewById(R.id.alarm);
    mSnoozeButton = (ImageView) mContentView.findViewById(R.id.snooze);
    mDismissButton = (ImageView) mContentView.findViewById(R.id.dismiss);
    mHintView = (TextView) mContentView.findViewById(R.id.hint);

    final TextView titleView = (TextView) mContentView.findViewById(R.id.title);
    final TextClock digitalClock = (TextClock) mContentView.findViewById(R.id.digital_clock);
    final CircleView pulseView = (CircleView) mContentView.findViewById(R.id.pulse);

    titleView.setText(mAlarmInstance.getLabelOrDefault(this));
    Utils.setTimeFormat(digitalClock);

    mCurrentHourColor = UiDataModel.getUiDataModel().getWindowBackgroundColor();
    getWindow().setBackgroundDrawable(new ColorDrawable(mCurrentHourColor));

    mAlarmButton.setOnTouchListener(this);
    mSnoozeButton.setOnClickListener(this);
    mDismissButton.setOnClickListener(this);

    mAlarmAnimator = AnimatorUtils.getScaleAnimator(mAlarmButton, 1.0f, 0.0f);
    mSnoozeAnimator = getButtonAnimator(mSnoozeButton, Color.WHITE);
    mDismissAnimator = getButtonAnimator(mDismissButton, mCurrentHourColor);
    mPulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView,
            PropertyValuesHolder.ofFloat(CircleView.RADIUS, 0.0f, pulseView.getRadius()),
            PropertyValuesHolder.ofObject(CircleView.FILL_COLOR, AnimatorUtils.ARGB_EVALUATOR,
                    ColorUtils.setAlphaComponent(pulseView.getFillColor(), 0)));
    mPulseAnimator.setDuration(PULSE_DURATION_MILLIS);
    mPulseAnimator.setInterpolator(PULSE_INTERPOLATOR);
    mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mPulseAnimator.start();
}

From source file:com.android.deskclock.alarms.AlarmActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final long instanceId = AlarmInstance.getId(getIntent().getData());
    mAlarmInstance = AlarmInstance.getInstance(getContentResolver(), instanceId);
    if (mAlarmInstance == null) {
        // The alarm was deleted before the activity got created, so just finish()
        LogUtils.e(LOGTAG, "Error displaying alarm for intent: %s", getIntent());
        finish();//from   w  ww .  j ava 2s. c o m
        return;
    } else if (mAlarmInstance.mAlarmState != AlarmInstance.FIRED_STATE) {
        LogUtils.i(LOGTAG, "Skip displaying alarm for instance: %s", mAlarmInstance);
        finish();
        return;
    }

    LogUtils.i(LOGTAG, "Displaying alarm for instance: %s", mAlarmInstance);

    // Get the volume/camera button behavior setting
    mVolumeBehavior = Utils.getDefaultSharedPreferences(this).getString(SettingsActivity.KEY_VOLUME_BUTTONS,
            SettingsActivity.DEFAULT_VOLUME_BEHAVIOR);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);

    // Hide navigation bar to minimize accidental tap on Home key
    hideNavigationBar();

    // Close dialogs and window shade, so this is fully visible
    sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

    // In order to allow tablets to freely rotate and phones to stick
    // with "nosensor" (use default device orientation) we have to have
    // the manifest start with an orientation of unspecified" and only limit
    // to "nosensor" for phones. Otherwise we get behavior like in b/8728671
    // where tablets start off in their default orientation and then are
    // able to freely rotate.
    if (!getResources().getBoolean(R.bool.config_rotateAlarmAlert)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    }

    mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);

    setContentView(R.layout.alarm_activity);

    mAlertView = (ViewGroup) findViewById(R.id.alert);
    mAlertTitleView = (TextView) mAlertView.findViewById(R.id.alert_title);
    mAlertInfoView = (TextView) mAlertView.findViewById(R.id.alert_info);

    mContentView = (ViewGroup) findViewById(R.id.content);
    mAlarmButton = (ImageView) mContentView.findViewById(R.id.alarm);
    mSnoozeButton = (ImageView) mContentView.findViewById(R.id.snooze);
    mDismissButton = (ImageView) mContentView.findViewById(R.id.dismiss);
    mHintView = (TextView) mContentView.findViewById(R.id.hint);

    final TextView titleView = (TextView) mContentView.findViewById(R.id.title);
    final TextClock digitalClock = (TextClock) mContentView.findViewById(R.id.digital_clock);
    final CircleView pulseView = (CircleView) mContentView.findViewById(R.id.pulse);

    titleView.setText(mAlarmInstance.getLabelOrDefault(this));
    Utils.setTimeFormat(this, digitalClock);

    mCurrentHourColor = Utils.getCurrentHourColor();
    getWindow().setBackgroundDrawable(new ColorDrawable(mCurrentHourColor));

    mAlarmButton.setOnTouchListener(this);
    mSnoozeButton.setOnClickListener(this);
    mDismissButton.setOnClickListener(this);

    mAlarmAnimator = AnimatorUtils.getScaleAnimator(mAlarmButton, 1.0f, 0.0f);
    mSnoozeAnimator = getButtonAnimator(mSnoozeButton, Color.WHITE);
    mDismissAnimator = getButtonAnimator(mDismissButton, mCurrentHourColor);
    mPulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView,
            PropertyValuesHolder.ofFloat(CircleView.RADIUS, 0.0f, pulseView.getRadius()),
            PropertyValuesHolder.ofObject(CircleView.FILL_COLOR, AnimatorUtils.ARGB_EVALUATOR,
                    ColorUtils.setAlphaComponent(pulseView.getFillColor(), 0)));
    mPulseAnimator.setDuration(PULSE_DURATION_MILLIS);
    mPulseAnimator.setInterpolator(PULSE_INTERPOLATOR);
    mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mPulseAnimator.start();
}

From source file:com.onyx.deskclock.deskclock.alarms.AlarmActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final long instanceId = AlarmInstance.getId(getIntent().getData());
    mAlarmInstance = AlarmInstance.getInstance(getContentResolver(), instanceId);
    if (mAlarmInstance == null) {
        // The alarm was deleted before the activity got created, so just finish()
        LogUtils.e(LOGTAG, "Error displaying alarm for intent: %s", getIntent());
        finish();//  ww  w  .ja  v a2 s .co  m
        return;
    } else if (mAlarmInstance.mAlarmState != AlarmInstance.FIRED_STATE) {
        LogUtils.i(LOGTAG, "Skip displaying alarm for instance: %s", mAlarmInstance);
        finish();
        return;
    }

    LogUtils.i(LOGTAG, "Displaying alarm for instance: %s", mAlarmInstance);

    // Get the volume/camera button behavior setting
    mVolumeBehavior = PreferenceManager.getDefaultSharedPreferences(this)
            .getString(SettingsActivity.KEY_VOLUME_BUTTONS, SettingsActivity.DEFAULT_VOLUME_BEHAVIOR);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);

    // Hide navigation bar to minimize accidental tap on Home key
    hideNavigationBar();

    // Close dialogs and window shade, so this is fully visible
    sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

    // In order to allow tablets to freely rotate and phones to stick
    // with "nosensor" (use default device orientation) we have to have
    // the manifest start with an orientation of unspecified" and only limit
    // to "nosensor" for phones. Otherwise we get behavior like in b/8728671
    // where tablets start off in their default orientation and then are
    // able to freely rotate.
    if (!getResources().getBoolean(R.bool.config_rotateAlarmAlert)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    }

    mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);

    setContentView(R.layout.alarm_activity);

    mAlertView = (ViewGroup) findViewById(R.id.alert);
    mAlertTitleView = (TextView) mAlertView.findViewById(R.id.alert_title);
    mAlertInfoView = (TextView) mAlertView.findViewById(R.id.alert_info);

    mContentView = (ViewGroup) findViewById(R.id.content);
    mAlarmButton = (ImageView) mContentView.findViewById(R.id.alarm);
    mSnoozeButton = (ImageView) mContentView.findViewById(R.id.snooze);
    mDismissButton = (ImageView) mContentView.findViewById(R.id.dismiss);
    mHintView = (TextView) mContentView.findViewById(R.id.hint);

    final TextView titleView = (TextView) mContentView.findViewById(R.id.title);
    //        final TextClock digitalClock = (TextClock) mContentView.findViewById(R.id.digital_clock);
    final TextTime digitalClock = (TextTime) mContentView.findViewById(R.id.digital_clock);
    final CircleView pulseView = (CircleView) mContentView.findViewById(R.id.pulse);

    titleView.setText(mAlarmInstance.getLabelOrDefault(this));
    Utils.setTimeFormat(this, digitalClock);

    mCurrentHourColor = Utils.getCurrentHourColor();
    getWindow().setBackgroundDrawable(new ColorDrawable(mCurrentHourColor));

    mAlarmButton.setOnTouchListener(this);
    mSnoozeButton.setOnClickListener(this);
    mDismissButton.setOnClickListener(this);

    mAlarmAnimator = AnimatorUtils.getScaleAnimator(mAlarmButton, 1.0f, 0.0f);
    mSnoozeAnimator = getButtonAnimator(mSnoozeButton, Color.WHITE);
    mDismissAnimator = getButtonAnimator(mDismissButton, mCurrentHourColor);
    mPulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView,
            PropertyValuesHolder.ofFloat(CircleView.RADIUS, 0.0f, pulseView.getRadius()),
            PropertyValuesHolder.ofObject(CircleView.FILL_COLOR, AnimatorUtils.ARGB_EVALUATOR,
                    ColorUtils.setAlphaComponent(pulseView.getFillColor(), 0)));
    mPulseAnimator.setDuration(PULSE_DURATION_MILLIS);
    mPulseAnimator.setInterpolator(PULSE_INTERPOLATOR);
    mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mPulseAnimator.start();
}

From source file:com.androidinspain.deskclock.alarms.AlarmActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setVolumeControlStream(AudioManager.STREAM_ALARM);
    final long instanceId = AlarmInstance.getId(getIntent().getData());
    mAlarmInstance = AlarmInstance.getInstance(getContentResolver(), instanceId);
    if (mAlarmInstance == null) {
        // The alarm was deleted before the activity got created, so just finish()
        LOGGER.e("Error displaying alarm for intent: %s", getIntent());
        finish();// w  w w .j  a  v a2s.  co m
        return;
    } else if (mAlarmInstance.mAlarmState != AlarmInstance.FIRED_STATE) {
        LOGGER.i("Skip displaying alarm for instance: %s", mAlarmInstance);
        finish();
        return;
    }

    LOGGER.i("Displaying alarm for instance: %s", mAlarmInstance);

    // Get the volume/camera button behavior setting
    mVolumeBehavior = DataModel.getDataModel().getAlarmVolumeButtonBehavior();

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
            | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);

    // Hide navigation bar to minimize accidental tap on Home key
    hideNavigationBar();

    // Close dialogs and window shade, so this is fully visible
    sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

    // Honor rotation on tablets; fix the orientation on phones.
    if (!getResources().getBoolean(com.androidinspain.deskclock.R.bool.rotateAlarmAlert)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    }

    mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);

    setContentView(com.androidinspain.deskclock.R.layout.alarm_activity);

    mAlertView = (ViewGroup) findViewById(com.androidinspain.deskclock.R.id.alert);
    mAlertTitleView = (TextView) mAlertView.findViewById(com.androidinspain.deskclock.R.id.alert_title);
    mAlertInfoView = (TextView) mAlertView.findViewById(com.androidinspain.deskclock.R.id.alert_info);

    mContentView = (ViewGroup) findViewById(com.androidinspain.deskclock.R.id.content);
    mAlarmButton = (ImageView) mContentView.findViewById(com.androidinspain.deskclock.R.id.alarm);
    mSnoozeButton = (ImageView) mContentView.findViewById(com.androidinspain.deskclock.R.id.snooze);
    mDismissButton = (ImageView) mContentView.findViewById(com.androidinspain.deskclock.R.id.dismiss);
    mHintView = (TextView) mContentView.findViewById(com.androidinspain.deskclock.R.id.hint);

    final TextView titleView = (TextView) mContentView.findViewById(com.androidinspain.deskclock.R.id.title);
    final TextClock digitalClock = (TextClock) mContentView
            .findViewById(com.androidinspain.deskclock.R.id.digital_clock);
    final CircleView pulseView = (CircleView) mContentView
            .findViewById(com.androidinspain.deskclock.R.id.pulse);

    titleView.setText(mAlarmInstance.getLabelOrDefault(this));
    Utils.setTimeFormat(digitalClock, false);

    mCurrentHourColor = ThemeUtils.resolveColor(this, android.R.attr.windowBackground);
    getWindow().setBackgroundDrawable(new ColorDrawable(mCurrentHourColor));

    mAlarmButton.setOnTouchListener(this);
    mSnoozeButton.setOnClickListener(this);
    mDismissButton.setOnClickListener(this);

    mAlarmAnimator = AnimatorUtils.getScaleAnimator(mAlarmButton, 1.0f, 0.0f);
    mSnoozeAnimator = getButtonAnimator(mSnoozeButton, Color.WHITE);
    mDismissAnimator = getButtonAnimator(mDismissButton, mCurrentHourColor);
    mPulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView,
            PropertyValuesHolder.ofFloat(CircleView.RADIUS, 0.0f, pulseView.getRadius()),
            PropertyValuesHolder.ofObject(CircleView.FILL_COLOR, AnimatorUtils.ARGB_EVALUATOR,
                    ColorUtils.setAlphaComponent(pulseView.getFillColor(), 0)));
    mPulseAnimator.setDuration(PULSE_DURATION_MILLIS);
    mPulseAnimator.setInterpolator(PULSE_INTERPOLATOR);
    mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mPulseAnimator.start();
}

From source file:com.wizardsofm.deskclock.alarms.AlarmActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final long instanceId = AlarmInstance.getId(getIntent().getData());
    mAlarmInstance = AlarmInstance.getInstance(getContentResolver(), instanceId);
    if (mAlarmInstance == null) {
        // The alarm was deleted before the activity got created, so just finish()
        LOGGER.e("Error displaying alarm for intent: %s", getIntent());
        finish();// w w w . j av  a2s  . c  om
        return;
    } else if (mAlarmInstance.mAlarmState != AlarmInstance.FIRED_STATE) {
        LOGGER.i("Skip displaying alarm for instance: %s", mAlarmInstance);
        finish();
        return;
    }

    LOGGER.i("Displaying alarm for instance: %s", mAlarmInstance);

    // Get the volume/camera button behavior setting
    mVolumeBehavior = Utils.getDefaultSharedPreferences(this).getString(SettingsActivity.KEY_VOLUME_BUTTONS,
            SettingsActivity.DEFAULT_VOLUME_BEHAVIOR);

    getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED | FLAG_DISMISS_KEYGUARD | FLAG_KEEP_SCREEN_ON
            | FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);

    // Hide navigation bar to minimize accidental tap on Home key
    hideNavigationBar();

    // Close dialogs and window shade, so this is fully visible
    sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

    // Honor rotation on tablets; fix the orientation on phones.
    if (!getResources().getBoolean(R.bool.config_rotateAlarmAlert)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    }

    mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);

    setContentView(R.layout.alarm_activity);

    mAlertView = (ViewGroup) findViewById(R.id.alert);
    mAlertTitleView = (TextView) mAlertView.findViewById(R.id.alert_title);
    mAlertInfoView = (TextView) mAlertView.findViewById(R.id.alert_info);

    mContentView = (ViewGroup) findViewById(R.id.content);
    mAlarmButton = (ImageView) mContentView.findViewById(R.id.alarm);
    mSnoozeButton = (ImageView) mContentView.findViewById(R.id.snooze);
    mDismissButton = (ImageView) mContentView.findViewById(R.id.dismiss);
    mHintView = (TextView) mContentView.findViewById(R.id.hint);

    final TextView titleView = (TextView) mContentView.findViewById(R.id.title);
    final TextClock digitalClock = (TextClock) mContentView.findViewById(R.id.digital_clock);
    final CircleView pulseView = (CircleView) mContentView.findViewById(R.id.pulse);

    //        PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
    //        PowerManager.WakeLock wakeLock = pm.newWakeLock((PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "TAG");
    //        wakeLock.acquire();
    //
    //
    //
    //        KeyguardManager keyguardManager = (KeyguardManager) getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE);
    //        KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("TAG");
    //        keyguardLock.disableKeyguard();

    titleView.setText(mAlarmInstance.getLabelOrDefault(this));
    Utils.setTimeFormat(digitalClock);

    mCurrentHourColor = UiDataModel.getUiDataModel().getWindowBackgroundColor();
    getWindow().setBackgroundDrawable(new ColorDrawable(mCurrentHourColor));

    mAlarmButton.setOnTouchListener(this);
    mSnoozeButton.setOnClickListener(this);
    mDismissButton.setOnClickListener(this);

    mAlarmAnimator = AnimatorUtils.getScaleAnimator(mAlarmButton, 1.0f, 0.0f);
    mSnoozeAnimator = getButtonAnimator(mSnoozeButton, Color.WHITE);
    mDismissAnimator = getButtonAnimator(mDismissButton, mCurrentHourColor);
    mPulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView,
            PropertyValuesHolder.ofFloat(CircleView.RADIUS, 0.0f, pulseView.getRadius()),
            PropertyValuesHolder.ofObject(CircleView.FILL_COLOR, AnimatorUtils.ARGB_EVALUATOR,
                    ColorUtils.setAlphaComponent(pulseView.getFillColor(), 0)));
    mPulseAnimator.setDuration(PULSE_DURATION_MILLIS);
    mPulseAnimator.setInterpolator(PULSE_INTERPOLATOR);
    mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mPulseAnimator.start();

    if (DataModel.getDataModel().getSnoozeByVoice()) {
        startListening();

    }

    //        if (DataModel.getDataModel().getSnoozeByVoice()) {
    //            thisContext = this;
    //            Thread t1 = new Thread(new Runnable() {
    //                public void run() {
    //                    mSpeechRecognizerManager =  SpeechRecognizerManager.getInstance(thisContext);   //new SpeechRecognizerManager(thisContext);
    //                }
    //            });
    //            t1.start();
    //
    //        }
}

From source file:io.plaidapp.core.ui.transitions.ReflowText.java

/**
 * Create Animators to transition each run of text from start to end position and size.
 *//*from w  w w  . j  av a 2 s. com*/
@NonNull
private List<Animator> createRunAnimators(View view, ReflowData startData, ReflowData endData, Bitmap startText,
        Bitmap endText, List<Run> runs) {
    List<Animator> animators = new ArrayList<>(runs.size());
    int dx = startData.bounds.left - endData.bounds.left;
    int dy = startData.bounds.top - endData.bounds.top;
    long startDelay = 0L;
    // move text closest to the destination first i.e. loop forward or backward over the runs
    boolean upward = startData.bounds.centerY() > endData.bounds.centerY();
    boolean first = true;
    boolean lastRightward = true;
    LinearInterpolator linearInterpolator = new LinearInterpolator();

    for (int i = upward ? 0 : runs.size() - 1; ((upward && i < runs.size())
            || (!upward && i >= 0)); i += (upward ? 1 : -1)) {
        Run run = runs.get(i);

        // skip text runs which aren't visible in either state
        if (!run.startVisible && !run.endVisible)
            continue;

        // create & position the drawable which displays the run; add it to the overlay.
        SwitchDrawable drawable = new SwitchDrawable(startText, run.start, startData.textSize, endText, run.end,
                endData.textSize);
        drawable.setBounds(run.start.left + dx, run.start.top + dy, run.start.right + dx,
                run.start.bottom + dy);
        view.getOverlay().add(drawable);

        PropertyValuesHolder topLeft = PropertyValuesHolder.ofObject(SwitchDrawable.TOP_LEFT, null,
                getPathMotion().getPath(run.start.left + dx, run.start.top + dy, run.end.left, run.end.top));
        PropertyValuesHolder width = PropertyValuesHolder.ofInt(SwitchDrawable.WIDTH, run.start.width(),
                run.end.width());
        PropertyValuesHolder height = PropertyValuesHolder.ofInt(SwitchDrawable.HEIGHT, run.start.height(),
                run.end.height());
        // the progress property drives the switching behaviour
        PropertyValuesHolder progress = PropertyValuesHolder.ofFloat(SwitchDrawable.PROGRESS, 0f, 1f);
        Animator runAnim = ObjectAnimator.ofPropertyValuesHolder(drawable, topLeft, width, height, progress);

        boolean rightward = run.start.centerX() + dx < run.end.centerX();
        if ((run.startVisible && run.endVisible) && !first && rightward != lastRightward) {
            // increase the start delay (by a decreasing amount) for the next run
            // (if it's visible throughout) to stagger the movement and try to minimize overlaps
            startDelay += staggerDelay;
            staggerDelay *= STAGGER_DECAY;
        }
        lastRightward = rightward;
        first = false;

        runAnim.setStartDelay(startDelay);
        long animDuration = Math.max(minDuration, duration - (startDelay / 2));
        runAnim.setDuration(animDuration);
        animators.add(runAnim);

        if (run.startVisible != run.endVisible) {
            // if run is appearing/disappearing then fade it in/out
            ObjectAnimator fade = ObjectAnimator.ofInt(drawable, SwitchDrawable.ALPHA,
                    run.startVisible ? OPAQUE : TRANSPARENT, run.endVisible ? OPAQUE : TRANSPARENT);
            fade.setDuration((duration + startDelay) / 2);
            if (!run.startVisible) {
                drawable.setAlpha(TRANSPARENT);
                fade.setStartDelay((duration + startDelay) / 2);
            } else {
                fade.setStartDelay(startDelay);
            }
            animators.add(fade);
        } else {
            // slightly fade during transition to minimize movement
            ObjectAnimator fade = ObjectAnimator.ofInt(drawable, SwitchDrawable.ALPHA, OPAQUE,
                    OPACITY_MID_TRANSITION, OPAQUE);
            fade.setStartDelay(startDelay);
            fade.setDuration(duration + startDelay);
            fade.setInterpolator(linearInterpolator);
            animators.add(fade);
        }
    }
    return animators;
}