public void setState(int i) { WeavingState weavingState = currentState; if (weavingState != null && weavingState.currentState == i) { return; } //if (VoIPService.getSharedInstance() == null && this.currentState == null) //{ // this.currentState = this.pausedState; // return; //} WeavingState weavingState2 = currentState; previousState = weavingState2; currentState = states[i]; if (weavingState2 != null) { progressToState = 0.0f; } else { progressToState = 1.0f; } }
public FragmentContextViewWavesDrawable(CanvasDrawingSession canvas) { for (int i = 0; i < 2; i++) { states[i] = new WeavingState(canvas, i); } }
public void removeParent(CanvasControl view) { parents.Remove(view); if (parents.IsEmpty()) { pausedState = currentState; currentState = null; previousState = null; } }
public void draw(float x, float y, float width, float height, CanvasDrawingSession canvas, CanvasControl view, float f5) { bool z; int i; float f6; CanvasControl view2 = view; checkColors(); if (view2 == null) { z = false; } else { z = parents.Count > 0 && view2 == parents[0]; } //if (f2 <= f4) { long j = 0; if (z) { long elapsedRealtime = Environment.TickCount; long j2 = elapsedRealtime - lastUpdateTime; lastUpdateTime = elapsedRealtime; j = j2 > 20 ? 17 : j2; float f7 = animateToAmplitude; float f8 = amplitude; if (f7 != f8) { float f9 = animateAmplitudeDiff; float f10 = f8 + j * f9; amplitude = f10; if (f9 > 0.0f) { if (f10 > f7) { amplitude = f7; } } else if (f10 < f7) { amplitude = f7; } //view.Invalidate(); } float f11 = animateToAmplitude; float f12 = amplitude2; if (f11 != f12) { float f13 = animateAmplitudeDiff2; float f14 = f12 + j * f13; amplitude2 = f14; if (f13 > 0.0f) { if (f14 > f11) { amplitude2 = f11; } } else if (f14 < f11) { amplitude2 = f11; } //view.Invalidate(); } if (previousState != null) { float f15 = progressToState + j / 250.0f; progressToState = f15; if (f15 > 1.0f) { progressToState = 1.0f; previousState = null; } //view.Invalidate(); } } long j3 = j; int i2 = 0; while (i2 < 2) { if (i2 == 0 && previousState == null) { i = i2; } else { if (i2 == 0) { f6 = 1.0f - progressToState; if (z) { previousState.update((int)(height - y), (int)(width - x), j3, amplitude); } //this.paint.setShader(this.previousState.shader); shader = previousState.shader; } else { WeavingState weavingState = currentState; if (weavingState != null) { f6 = previousState != null ? progressToState : 1.0f; if (z) { weavingState.update((int)(height - y), (int)(width - x), j3, amplitude); } //this.paint.setShader(this.currentState.shader); shader = currentState.shader; } else { return; } } float f16 = f6; lineBlobDrawable.minRadius = 0.0f; lineBlobDrawable.maxRadius = 2.0f + 2.0f * amplitude; lineBlobDrawable1.minRadius = 0.0f; lineBlobDrawable1.maxRadius = 3.0f + 9.0f * amplitude; lineBlobDrawable2.minRadius = 0.0f; lineBlobDrawable2.maxRadius = 3.0f + 9.0f * amplitude; lineBlobDrawable.update(amplitude, 0.3f); lineBlobDrawable1.update(amplitude, 0.7f); lineBlobDrawable2.update(amplitude, 0.7f); if (i2 == 1) { paint.A = (byte)(255.0f * f16); } else { paint.A = 255; } i = i2; if (target == null || target.Size.Width != width) { target = new CanvasRenderTarget(canvas, width, height); } using (var session = target.CreateDrawingSession()) { session.Clear(Colors.Transparent); lineBlobDrawable.Draw(x, y, width, height, session, paint, y, f5); paint.A = (byte)(f16 * 76.0f); float dp = (float)6.0f * amplitude2; float dp2 = (float)6.0f * amplitude2; float f22 = x; lineBlobDrawable1.Draw(f22, y - dp, width, height, session, paint, y, f5); lineBlobDrawable2.Draw(f22, y - dp2, width, height, session, paint, y, f5); } using (var layer = canvas.CreateLayer(new CanvasImageBrush(canvas, target))) { canvas.FillRectangle(0, 0, width, height, shader); } } i2 = i + 1; } } }