public void setPressed(boolean pressed) { if (mGlowBG != null) { if (pressed != isPressed()) { if (mPressedAnim != null && mPressedAnim.isRunning()) { mPressedAnim.cancel(); } final AnimatorSet as = mPressedAnim = new AnimatorSet(); if (pressed) { if (mGlowScale < GLOW_MAX_SCALE_FACTOR) mGlowScale = GLOW_MAX_SCALE_FACTOR; if (mGlowAlpha < BUTTON_QUIESCENT_ALPHA) mGlowAlpha = BUTTON_QUIESCENT_ALPHA; setDrawingAlpha(1f); as.playTogether( ObjectAnimator.ofFloat(this, "glowAlpha", 1f), ObjectAnimator.ofFloat(this, "glowScale", GLOW_MAX_SCALE_FACTOR)); as.setDuration(50); } else { as.playTogether( ObjectAnimator.ofFloat(this, "glowAlpha", 0f), ObjectAnimator.ofFloat(this, "glowScale", 1f), ObjectAnimator.ofFloat(this, "drawingAlpha", BUTTON_QUIESCENT_ALPHA)); as.setDuration(500); } as.start(); } } super.setPressed(pressed); }
public void setPressed(boolean pressed) { if (mGlowBG != null) { if (pressed != isPressed()) { if (mPressedAnim != null && mPressedAnim.isRunning()) { mPressedAnim.cancel(); } final AnimatorSet as = mPressedAnim = new AnimatorSet(); if (pressed) { if (mGlowScale < GLOW_MAX_SCALE_FACTOR) mGlowScale = GLOW_MAX_SCALE_FACTOR; if (mGlowAlpha < mQuiescentAlpha) mGlowAlpha = mQuiescentAlpha; setDrawingAlpha(1f); as.playTogether( ObjectAnimator.ofFloat(this, "glowAlpha", 1f), ObjectAnimator.ofFloat(this, "glowScale", GLOW_MAX_SCALE_FACTOR)); as.setDuration(50); } else { mAnimateToQuiescent.cancel(); mAnimateToQuiescent = animateToQuiescent(); as.playTogether( ObjectAnimator.ofFloat(this, "glowAlpha", 0f), ObjectAnimator.ofFloat(this, "glowScale", 1f), mAnimateToQuiescent); as.setDuration(500); } as.start(); } } super.setPressed(pressed); }
/** @param v unused here but needed since this method is referenced from XML layout */ public void cgeoFindNearest(final View v) { if (app.currentGeo().getCoords() == null) { return; } nearestView.setPressed(true); CacheListActivity.startActivityNearest(this, app.currentGeo().getCoords()); }
@Override public void setPressed(boolean pressed) { // If the parent is pressed, do not set to pressed. if (pressed && ((View) getParent()).isPressed()) { return; } super.setPressed(pressed); }
public void testHotWaterTemperature() throws Exception { // check if the hot tap sets the right temperature boolean expected = true; imageView2.setPressed(true); TextView tv = (TextView) mainActivity.findViewById(R.id.textView1); String data = tv.getText().toString(); boolean actual = data.contains("50.0"); assertEquals(expected, actual); }
// test to check if the image view'state is same across screen rotation public void testHotWaterTapImageStateOnScreenOrientationChanged() { float angle_before = 0; float angle_after = 0; imageView1.setPressed(true); angle_before = imageView1.getRotation(); mainActivity.finish(); mainActivity = getActivity(); if (imageView1 != null) { angle_after = imageView1.getRotation(); } assertEquals("HOtTap ImageView is restored after rotation", angle_before, angle_after); }
@Override public void setPressed(boolean pressed) { super.setPressed(pressed); if (circlePaint != null) { circlePaint.setColor(pressed ? pressedColor : defaultColor); } if (pressed) { showPressedRing(); } else { hidePressedRing(); } }
void setState(int state) { text.setPressed(state == STATE_PRESSED); tab.setPressed(state == STATE_PRESSED); if (state == STATE_ACTIVE) { final int[] activeState = new int[] {com.android.internal.R.attr.state_active}; if (text.getBackground().isStateful()) { text.getBackground().setState(activeState); } if (tab.getBackground().isStateful()) { tab.getBackground().setState(activeState); } text.setTextAppearance(text.getContext(), R.style.TextAppearance_SlidingTabActive); } else { text.setTextAppearance(text.getContext(), R.style.TextAppearance_SlidingTabNormal); } currentState = state; }
/** @param v unused here but needed since this method is referenced from XML layout */ public void cgeoFilter(final View v) { filter.setPressed(true); filter.performClick(); }
/** @param v unused here but needed since this method is referenced from XML layout */ public void cgeoPoint(final View v) { any.setPressed(true); startActivity(new Intent(this, NavigateAnyPointActivity.class)); }
/** @param v unused here but needed since this method is referenced from XML layout */ public void cgeoSearch(final View v) { advanced.setPressed(true); startActivity(new Intent(this, SearchActivity.class)); }
/** @param v unused here but needed since this method is referenced from XML layout */ public void cgeoFindByOffline(final View v) { findByOffline.setPressed(true); CacheListActivity.startActivityOffline(this); }
/** @param v unused here but needed since this method is referenced from XML layout */ public void cgeoFindOnMap(final View v) { findOnMap.setPressed(true); CGeoMap.startActivityLiveMap(this); }