Commit 75b780c2 authored by mengcuiguang's avatar mengcuiguang

样式修改

parent 3efb04ff
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
}
}
dependencies {
implementation 'androidx.core:core:1.0.0'
}
#
# Copyright (C) 2016 Jared Rummler
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
\ No newline at end of file
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
<manifest package="com.jaredrummler.android.animatedsvgview"/>
\ No newline at end of file
/*
* Copyright (C) 2016 Jared Rummler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jaredrummler.android.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.PointF;
import android.graphics.RectF;
import android.os.Build;
import androidx.annotation.ColorInt;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import com.jaredrummler.android.animatedsvgview.R;
/**
* Animated SVG Drawing for Android
*/
public class AnimatedSvgView extends View {
/** The animation has been reset or hasn't started yet. */
public static final int STATE_NOT_STARTED = 0;
/** The SVG is being traced */
public static final int STATE_TRACE_STARTED = 1;
/** The SVG has been traced and is now being filled */
public static final int STATE_FILL_STARTED = 2;
/** The animation has finished */
public static final int STATE_FINISHED = 3;
private static final String TAG = "AnimatedSvgView";
private static final Interpolator INTERPOLATOR = new DecelerateInterpolator();
private static float constrain(float min, float max, float v) {
return Math.max(min, Math.min(max, v));
}
private int mTraceTime = 2000;
private int mTraceTimePerGlyph = 1000;
private int mFillStart = 1200;
private int mFillTime = 1000;
private int[] mTraceResidueColors;
private int[] mTraceColors;
private float mViewportWidth;
private float mViewportHeight;
private PointF mViewport = new PointF(mViewportWidth, mViewportHeight);
private float aspectRatioWidth = 1;
private float aspectRatioHeight = 1;
private Paint mFillPaint;
private int[] mFillColors;
private GlyphData[] mGlyphData;
private String[] mGlyphStrings;
private float mMarkerLength;
private int mWidth;
private int mHeight;
private long mStartTime;
private int mState = STATE_NOT_STARTED;
private OnStateChangeListener mOnStateChangeListener;
public AnimatedSvgView(Context context) {
super(context);
init(context, null);
}
public AnimatedSvgView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public AnimatedSvgView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
mFillPaint = new Paint();
mFillPaint.setAntiAlias(true);
mFillPaint.setStyle(Paint.Style.FILL);
mTraceColors = new int[1];
mTraceColors[0] = Color.BLACK;
mTraceResidueColors = new int[1];
mTraceResidueColors[0] = 0x32000000;
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnimatedSvgView);
mViewportWidth = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeX, 512);
aspectRatioWidth = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeX, 512);
mViewportHeight = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeY, 512);
aspectRatioHeight = a.getInt(R.styleable.AnimatedSvgView_animatedSvgImageSizeY, 512);
mTraceTime = a.getInt(R.styleable.AnimatedSvgView_animatedSvgTraceTime, 2000);
mTraceTimePerGlyph = a.getInt(R.styleable.AnimatedSvgView_animatedSvgTraceTimePerGlyph, 1000);
mFillStart = a.getInt(R.styleable.AnimatedSvgView_animatedSvgFillStart, 1200);
mFillTime = a.getInt(R.styleable.AnimatedSvgView_animatedSvgFillTime, 1000);
int traceMarkerLength = a.getInt(R.styleable.AnimatedSvgView_animatedSvgTraceMarkerLength, 16);
mMarkerLength =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, traceMarkerLength, getResources().getDisplayMetrics());
int glyphStringsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgGlyphStrings, 0);
int traceResidueColorsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgTraceResidueColors, 0);
int traceColorsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgTraceColors, 0);
int fillColorsId = a.getResourceId(R.styleable.AnimatedSvgView_animatedSvgFillColors, 0);
a.recycle();
if (glyphStringsId != 0) {
setGlyphStrings(getResources().getStringArray(glyphStringsId));
setTraceResidueColor(Color.argb(50, 0, 0, 0));
setTraceColor(Color.BLACK);
}
if (traceResidueColorsId != 0) {
setTraceResidueColors(getResources().getIntArray(traceResidueColorsId));
}
if (traceColorsId != 0) {
setTraceColors(getResources().getIntArray(traceColorsId));
}
if (fillColorsId != 0) {
setFillColors(getResources().getIntArray(fillColorsId));
}
mViewport = new PointF(mViewportWidth, mViewportHeight);
}
// Note: using a software layer here is an optimization. This view works with hardware accelerated rendering but
// every time a path is modified (when the dash path effect is modified), the graphics pipeline will rasterize
// the path again in a new texture. Since we are dealing with dozens of paths, it is much more efficient to
// rasterize the entire view into a single re-usable texture instead. Ideally this should be toggled using a
// heuristic based on the number and or dimensions of paths to render.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
}
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mWidth = w;
mHeight = h;
rebuildGlyphData();
}
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = View.MeasureSpec.getSize(widthMeasureSpec);
int height = View.MeasureSpec.getSize(heightMeasureSpec);
int widthMode = View.MeasureSpec.getMode(widthMeasureSpec);
int heightMode = View.MeasureSpec.getMode(heightMeasureSpec);
if (height <= 0 && width <= 0 && heightMode == View.MeasureSpec.UNSPECIFIED &&
widthMode == View.MeasureSpec.UNSPECIFIED) {
width = 0;
height = 0;
} else if (height <= 0 && heightMode == View.MeasureSpec.UNSPECIFIED) {
height = (int) (width * aspectRatioHeight / aspectRatioWidth);
} else if (width <= 0 && widthMode == View.MeasureSpec.UNSPECIFIED) {
width = (int) (height * aspectRatioWidth / aspectRatioHeight);
} else if (width * aspectRatioHeight > aspectRatioWidth * height) {
width = (int) (height * aspectRatioWidth / aspectRatioHeight);
} else {
height = (int) (width * aspectRatioHeight / aspectRatioWidth);
}
super.onMeasure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
}
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (mState == STATE_NOT_STARTED || mGlyphData == null) {
return;
}
long t = System.currentTimeMillis() - mStartTime;
// Draw outlines (starts as traced)
for (int i = 0; i < mGlyphData.length; i++) {
float phase = constrain(0, 1,
(t - (mTraceTime - mTraceTimePerGlyph) * i * 1f / mGlyphData.length) * 1f / mTraceTimePerGlyph);
float distance = INTERPOLATOR.getInterpolation(phase) * mGlyphData[i].length;
mGlyphData[i].paint.setColor(mTraceResidueColors[i]);
mGlyphData[i].paint.setPathEffect(new DashPathEffect(
new float[]{distance, mGlyphData[i].length}, 0));
canvas.drawPath(mGlyphData[i].path, mGlyphData[i].paint);
mGlyphData[i].paint.setColor(mTraceColors[i]);
mGlyphData[i].paint.setPathEffect(new DashPathEffect(
new float[]{0, distance, phase > 0 ? mMarkerLength : 0, mGlyphData[i].length}, 0));
canvas.drawPath(mGlyphData[i].path, mGlyphData[i].paint);
}
if (t > mFillStart) {
if (mState < STATE_FILL_STARTED) {
changeState(STATE_FILL_STARTED);
}
// If after fill start, draw fill
float phase = constrain(0, 1, (t - mFillStart) * 1f / mFillTime);
for (int i = 0; i < mGlyphData.length; i++) {
GlyphData glyphData = mGlyphData[i];
int fillColor = mFillColors[i];
int a = (int) (phase * ((float) Color.alpha(fillColor) / (float) 255) * 255);
int r = Color.red(fillColor);
int g = Color.green(fillColor);
int b = Color.blue(fillColor);
mFillPaint.setARGB(a, r, g, b);
canvas.drawPath(glyphData.path, mFillPaint);
}
}
if (t < mFillStart + mFillTime) {
// draw next frame if animation isn't finished
ViewCompat.postInvalidateOnAnimation(this);
} else {
changeState(STATE_FINISHED);
}
}
/**
* If you set the SVG data paths more than once using {@link #setGlyphStrings(String...)} you should call this method
* before playing the animation.
*/
@SuppressWarnings("SuspiciousNameCombination")
public void rebuildGlyphData() {
float X = mWidth / mViewport.x;
float Y = mHeight / mViewport.y;
Matrix scaleMatrix = new Matrix();
RectF outerRect = new RectF(X, X, Y, Y);
scaleMatrix.setScale(X, Y, outerRect.centerX(), outerRect.centerY());
mGlyphData = new GlyphData[mGlyphStrings.length];
for (int i = 0; i < mGlyphStrings.length; i++) {
mGlyphData[i] = new GlyphData();
try {
mGlyphData[i].path = PathParser.createPathFromPathData(mGlyphStrings[i]);
mGlyphData[i].path.transform(scaleMatrix);
} catch (Exception e) {
mGlyphData[i].path = new Path();
Log.e(TAG, "Couldn't parse path", e);
}
PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
while (true) {
mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
if (!pm.nextContour()) {
break;
}
}
mGlyphData[i].paint = new Paint();
mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
mGlyphData[i].paint.setAntiAlias(true);
mGlyphData[i].paint.setColor(Color.WHITE);
mGlyphData[i].paint.setStrokeWidth(
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
}
}
/**
* Set the viewport width and height of the SVG. This can be found in the viewBox in the SVG. This is not the size
* of the view.
*
* @param viewportWidth
* the width
* @param viewportHeight
* the height
*/
public void setViewportSize(float viewportWidth, float viewportHeight) {
mViewportWidth = viewportWidth;
mViewportHeight = viewportHeight;
aspectRatioWidth = viewportWidth;
aspectRatioHeight = viewportHeight;
mViewport = new PointF(mViewportWidth, mViewportHeight);
requestLayout();
}
/**
* Set the SVG path data.
*
* @param glyphStrings
* The path strings found in the SVG.
*/
public void setGlyphStrings(@NonNull String... glyphStrings) {
mGlyphStrings = glyphStrings;
}
/**
* Set the colors used during tracing the SVG
*
* @param traceResidueColors
* the colors. Should be the same length as the SVG paths.
*/
public void setTraceResidueColors(@NonNull int[] traceResidueColors) {
mTraceResidueColors = traceResidueColors;
}
/**
* Set the colors used to trace the SVG.
*
* @param traceColors
* The colors. Should be the same length as the SVG paths.
*/
public void setTraceColors(@NonNull int[] traceColors) {
mTraceColors = traceColors;
}
/**
* Set the colors for the SVG. This corresponds with each data path.
*
* @param fillColors
* The colors for each SVG data path.
*/
public void setFillColors(@NonNull int[] fillColors) {
mFillColors = fillColors;
}
/**
* Set the color used for tracing. This will be applied to all data paths.
*
* @param color
* The color
*/
public void setTraceResidueColor(@ColorInt int color) {
if (mGlyphStrings == null) {
throw new RuntimeException("You need to set the glyphs first.");
}
int length = mGlyphStrings.length;
int[] colors = new int[length];
for (int i = 0; i < length; i++) {
colors[i] = color;
}
setTraceResidueColors(colors);
}
/**
* Set the color used for tracing. This will be applied to all data paths.
*
* @param color
* The color
*/
public void setTraceColor(@ColorInt int color) {
if (mGlyphStrings == null) {
throw new RuntimeException("You need to set the glyphs first.");
}
int length = mGlyphStrings.length;
int[] colors = new int[length];
for (int i = 0; i < length; i++) {
colors[i] = color;
}
setTraceColors(colors);
}
/**
* Set the color used for the icon. This will apply the color to all SVG data paths.
*
* @param color
* The color
*/
public void setFillColor(@ColorInt int color) {
if (mGlyphStrings == null) {
throw new RuntimeException("You need to set the glyphs first.");
}
int length = mGlyphStrings.length;
int[] colors = new int[length];
for (int i = 0; i < length; i++) {
colors[i] = color;
}
setFillColors(colors);
}
/**
* Set the animation trace time
*
* @param traceTime
* time in milliseconds
*/
public void setTraceTime(int traceTime) {
mTraceTime = traceTime;
}
/**
* Set the time used to trace each glyph
*
* @param traceTimePerGlyph
* time in milliseconds
*/
public void setTraceTimePerGlyph(int traceTimePerGlyph) {
mTraceTimePerGlyph = traceTimePerGlyph;
}
/**
* Set the time at which colors will start being filled after the tracing begins
*
* @param fillStart
* time in milliseconds
*/
public void setFillStart(int fillStart) {
mFillStart = fillStart;
}
/**
* Set the time it takes to fill colors
*
* @param fillTime
* time in milliseconds
*/
public void setFillTime(int fillTime) {
mFillTime = fillTime;
}
/**
* Start the animation
*/
public void start() {
mStartTime = System.currentTimeMillis();
changeState(STATE_TRACE_STARTED);
ViewCompat.postInvalidateOnAnimation(this);
}
/**
* Reset the animation
*/
public void reset() {
mStartTime = 0;
changeState(STATE_NOT_STARTED);
ViewCompat.postInvalidateOnAnimation(this);
}
/**
* Draw the SVG, skipping any animation.
*/
public void setToFinishedFrame() {
mStartTime = 1;
changeState(STATE_FINISHED);
ViewCompat.postInvalidateOnAnimation(this);
}
/**
* Get the animation state.
*
* @return Either {{@link #STATE_NOT_STARTED},
* {@link #STATE_TRACE_STARTED}},
* {@link #STATE_FILL_STARTED} or
* {@link #STATE_FINISHED}
*/
@State public int getState() {
return mState;
}
/**
* Get notified about the animation states.
*
* @param onStateChangeListener
* The {@link OnStateChangeListener}
*/
public void setOnStateChangeListener(OnStateChangeListener onStateChangeListener) {
mOnStateChangeListener = onStateChangeListener;
}
private void changeState(@State int state) {
if (mState == state) {
return;
}
mState = state;
if (mOnStateChangeListener != null) {
mOnStateChangeListener.onStateChange(state);
}
}
/**
* Callback for listening to animation state changes
*/
public interface OnStateChangeListener {
/**
* Called when the animation state changes.
*
* @param state
* The state of the animation.
* Either {{@link #STATE_NOT_STARTED},
* {@link #STATE_TRACE_STARTED}},
* {@link #STATE_FILL_STARTED} or
* {@link #STATE_FINISHED}
*/
void onStateChange(@State int state);
}
@IntDef({STATE_NOT_STARTED, STATE_TRACE_STARTED, STATE_FILL_STARTED, STATE_FINISHED})
public @interface State {
}
static final class GlyphData {
Path path;
Paint paint;
float length;
}
}
\ No newline at end of file
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jaredrummler.android.widget;
import android.graphics.Path;
import android.util.Log;
import java.util.ArrayList;
/**
* This class is a duplicate from the PathParser.java of frameworks/base, with slight
* update on incompatible API like copyOfRange().
*/
final class PathParser {
private static final String LOGTAG = "PathParser";
// Copy from Arrays.copyOfRange() which is only available from API level 9.
/**
* Copies elements from {@code original} into a new array, from indexes start (inclusive) to
* end (exclusive). The original order of elements is preserved.
* If {@code end} is greater than {@code original.length}, the result is padded
* with the value {@code 0.0f}.
*
* @param original
* the original array
* @param start
* the start index, inclusive
* @param end
* the end index, exclusive
* @return the new array
* @throws ArrayIndexOutOfBoundsException
* if {@code start < 0 || start > original.length}
* @throws IllegalArgumentException
* if {@code start > end}
* @throws NullPointerException
* if {@code original == null}
*/
static float[] copyOfRange(float[] original, int start, int end) {
if (start > end) {
throw new IllegalArgumentException();
}
int originalLength = original.length;
if (start < 0 || start > originalLength) {
throw new ArrayIndexOutOfBoundsException();
}
int resultLength = end - start;
int copyLength = Math.min(resultLength, originalLength - start);
float[] result = new float[resultLength];
System.arraycopy(original, start, result, 0, copyLength);
return result;
}
/**
* @param pathData
* The string representing a path, the same as "d" string in svg file.
* @return the generated Path object.
*/
public static Path createPathFromPathData(String pathData) {
Path path = new Path();
PathDataNode[] nodes = createNodesFromPathData(pathData);
if (nodes != null) {
try {
PathDataNode.nodesToPath(nodes, path);
} catch (RuntimeException e) {
throw new RuntimeException("Error in parsing " + pathData, e);
}
return path;
}
return null;
}
/**
* @param pathData
* The string representing a path, the same as "d" string in svg file.
* @return an array of the PathDataNode.
*/
public static PathDataNode[] createNodesFromPathData(String pathData) {
if (pathData == null) {
return null;
}
int start = 0;
int end = 1;
ArrayList<PathDataNode> list = new ArrayList<PathDataNode>();
while (end < pathData.length()) {
end = nextStart(pathData, end);
String s = pathData.substring(start, end).trim();
if (s.length() > 0) {
float[] val = getFloats(s);
addNode(list, s.charAt(0), val);
}
start = end;
end++;
}
if ((end - start) == 1 && start < pathData.length()) {
addNode(list, pathData.charAt(start), new float[0]);
}
return list.toArray(new PathDataNode[list.size()]);
}
/**
* @param source
* The array of PathDataNode to be duplicated.
* @return a deep copy of the <code>source</code>.
*/
public static PathDataNode[] deepCopyNodes(PathDataNode[] source) {
if (source == null) {
return null;
}
PathDataNode[] copy = new PathParser.PathDataNode[source.length];
for (int i = 0; i < source.length; i++) {
copy[i] = new PathDataNode(source[i]);
}
return copy;
}
/**
* @param nodesFrom
* The source path represented in an array of PathDataNode
* @param nodesTo
* The target path represented in an array of PathDataNode
* @return whether the <code>nodesFrom</code> can morph into <code>nodesTo</code>
*/
public static boolean canMorph(PathDataNode[] nodesFrom, PathDataNode[] nodesTo) {
if (nodesFrom == null || nodesTo == null) {
return false;
}
if (nodesFrom.length != nodesTo.length) {
return false;
}
for (int i = 0; i < nodesFrom.length; i++) {
if (nodesFrom[i].mType != nodesTo[i].mType
|| nodesFrom[i].mParams.length != nodesTo[i].mParams.length) {
return false;
}
}
return true;
}
/**
* Update the target's data to match the source.
* Before calling this, make sure canMorph(target, source) is true.
*
* @param target
* The target path represented in an array of PathDataNode
* @param source
* The source path represented in an array of PathDataNode
*/
public static void updateNodes(PathDataNode[] target, PathDataNode[] source) {
for (int i = 0; i < source.length; i++) {
target[i].mType = source[i].mType;
for (int j = 0; j < source[i].mParams.length; j++) {
target[i].mParams[j] = source[i].mParams[j];
}
}
}
private static int nextStart(String s, int end) {
char c;
while (end < s.length()) {
c = s.charAt(end);
// Note that 'e' or 'E' are not valid path commands, but could be
// used for floating point numbers' scientific notation.
// Therefore, when searching for next command, we should ignore 'e'
// and 'E'.
if ((((c - 'A') * (c - 'Z') <= 0) || ((c - 'a') * (c - 'z') <= 0))
&& c != 'e' && c != 'E') {
return end;
}
end++;
}
return end;
}
private static void addNode(ArrayList<PathDataNode> list, char cmd, float[] val) {
list.add(new PathDataNode(cmd, val));
}
private static class ExtractFloatResult {
// We need to return the position of the next separator and whether the
// next float starts with a '-' or a '.'.
int mEndPosition;
boolean mEndWithNegOrDot;
ExtractFloatResult() {
}
}
/**
* Parse the floats in the string.
* This is an optimized version of parseFloat(s.split(",|\\s"));
*
* @param s
* the string containing a command and list of floats
* @return array of floats
*/
private static float[] getFloats(String s) {
if (s.charAt(0) == 'z' || s.charAt(0) == 'Z') {
return new float[0];
}
try {
float[] results = new float[s.length()];
int count = 0;
int startPosition = 1;
int endPosition = 0;
ExtractFloatResult result = new ExtractFloatResult();
int totalLength = s.length();
// The startPosition should always be the first character of the
// current number, and endPosition is the character after the current
// number.
while (startPosition < totalLength) {
extract(s, startPosition, result);
endPosition = result.mEndPosition;
if (startPosition < endPosition) {
results[count++] = Float.parseFloat(
s.substring(startPosition, endPosition));
}
if (result.mEndWithNegOrDot) {
// Keep the '-' or '.' sign with next number.
startPosition = endPosition;
} else {
startPosition = endPosition + 1;
}
}
return copyOfRange(results, 0, count);
} catch (NumberFormatException e) {
throw new RuntimeException("error in parsing \"" + s + "\"", e);
}
}
/**
* Calculate the position of the next comma or space or negative sign
*
* @param s
* the string to search
* @param start
* the position to start searching
* @param result
* the result of the extraction, including the position of the
* the starting position of next number, whether it is ending with a '-'.
*/
private static void extract(String s, int start, ExtractFloatResult result) {
// Now looking for ' ', ',', '.' or '-' from the start.
int currentIndex = start;
boolean foundSeparator = false;
result.mEndWithNegOrDot = false;
boolean secondDot = false;
boolean isExponential = false;
for (; currentIndex < s.length(); currentIndex++) {
boolean isPrevExponential = isExponential;
isExponential = false;
char currentChar = s.charAt(currentIndex);
switch (currentChar) {
case ' ':
case ',':
foundSeparator = true;
break;
case '-':
// The negative sign following a 'e' or 'E' is not a separator.
if (currentIndex != start && !isPrevExponential) {
foundSeparator = true;
result.mEndWithNegOrDot = true;
}
break;
case '.':
if (!secondDot) {
secondDot = true;
} else {
// This is the second dot, and it is considered as a separator.
foundSeparator = true;
result.mEndWithNegOrDot = true;
}
break;
case 'e':
case 'E':
isExponential = true;
break;
}
if (foundSeparator) {
break;
}
}
// When there is nothing found, then we put the end position to the end
// of the string.
result.mEndPosition = currentIndex;
}
/**
* Each PathDataNode represents one command in the "d" attribute of the svg
* file.
* An array of PathDataNode can represent the whole "d" attribute.
*/
public static class PathDataNode {
/**
* @hide
*/
public char mType;
/**
* @hide
*/
public float[] mParams;
PathDataNode(char type, float[] params) {
this.mType = type;
this.mParams = params;
}
PathDataNode(PathDataNode n) {
mType = n.mType;
mParams = copyOfRange(n.mParams, 0, n.mParams.length);
}
/**
* Convert an array of PathDataNode to Path.
*
* @param node
* The source array of PathDataNode.
* @param path
* The target Path object.
*/
public static void nodesToPath(PathDataNode[] node, Path path) {
float[] current = new float[6];
char previousCommand = 'm';
for (int i = 0; i < node.length; i++) {
addCommand(path, current, previousCommand, node[i].mType, node[i].mParams);
previousCommand = node[i].mType;
}
}
/**
* The current PathDataNode will be interpolated between the
* <code>nodeFrom</code> and <code>nodeTo</code> according to the
* <code>fraction</code>.
*
* @param nodeFrom
* The start value as a PathDataNode.
* @param nodeTo
* The end value as a PathDataNode
* @param fraction
* The fraction to interpolate.
*/
public void interpolatePathDataNode(PathDataNode nodeFrom,
PathDataNode nodeTo, float fraction) {
for (int i = 0; i < nodeFrom.mParams.length; i++) {
mParams[i] = nodeFrom.mParams[i] * (1 - fraction)
+ nodeTo.mParams[i] * fraction;
}
}
private static void addCommand(Path path, float[] current,
char previousCmd, char cmd, float[] val) {
int incr = 2;
float currentX = current[0];
float currentY = current[1];
float ctrlPointX = current[2];
float ctrlPointY = current[3];
float currentSegmentStartX = current[4];
float currentSegmentStartY = current[5];
float reflectiveCtrlPointX;
float reflectiveCtrlPointY;
switch (cmd) {
case 'z':
case 'Z':
path.close();
// Path is closed here, but we need to move the pen to the
// closed position. So we cache the segment's starting position,
// and restore it here.
currentX = currentSegmentStartX;
currentY = currentSegmentStartY;
ctrlPointX = currentSegmentStartX;
ctrlPointY = currentSegmentStartY;
path.moveTo(currentX, currentY);
break;
case 'm':
case 'M':
case 'l':
case 'L':
case 't':
case 'T':
incr = 2;
break;
case 'h':
case 'H':
case 'v':
case 'V':
incr = 1;
break;
case 'c':
case 'C':
incr = 6;
break;
case 's':
case 'S':
case 'q':
case 'Q':
incr = 4;
break;
case 'a':
case 'A':
incr = 7;
break;
}
for (int k = 0; k < val.length; k += incr) {
switch (cmd) {
case 'm': // moveto - Start a new sub-path (relative)
currentX += val[k + 0];
currentY += val[k + 1];
if (k > 0) {
// According to the spec, if a moveto is followed by multiple
// pairs of coordinates, the subsequent pairs are treated as
// implicit lineto commands.
path.rLineTo(val[k + 0], val[k + 1]);
} else {
path.rMoveTo(val[k + 0], val[k + 1]);
currentSegmentStartX = currentX;
currentSegmentStartY = currentY;
}
break;
case 'M': // moveto - Start a new sub-path
currentX = val[k + 0];
currentY = val[k + 1];
if (k > 0) {
// According to the spec, if a moveto is followed by multiple
// pairs of coordinates, the subsequent pairs are treated as
// implicit lineto commands.
path.lineTo(val[k + 0], val[k + 1]);
} else {
path.moveTo(val[k + 0], val[k + 1]);
currentSegmentStartX = currentX;
currentSegmentStartY = currentY;
}
break;
case 'l': // lineto - Draw a line from the current point (relative)
path.rLineTo(val[k + 0], val[k + 1]);
currentX += val[k + 0];
currentY += val[k + 1];
break;
case 'L': // lineto - Draw a line from the current point
path.lineTo(val[k + 0], val[k + 1]);
currentX = val[k + 0];
currentY = val[k + 1];
break;
case 'h': // horizontal lineto - Draws a horizontal line (relative)
path.rLineTo(val[k + 0], 0);
currentX += val[k + 0];
break;
case 'H': // horizontal lineto - Draws a horizontal line
path.lineTo(val[k + 0], currentY);
currentX = val[k + 0];
break;
case 'v': // vertical lineto - Draws a vertical line from the current point (r)
path.rLineTo(0, val[k + 0]);
currentY += val[k + 0];
break;
case 'V': // vertical lineto - Draws a vertical line from the current point
path.lineTo(currentX, val[k + 0]);
currentY = val[k + 0];
break;
case 'c': // curveto - Draws a cubic Bézier curve (relative)
path.rCubicTo(val[k + 0], val[k + 1], val[k + 2], val[k + 3],
val[k + 4], val[k + 5]);
ctrlPointX = currentX + val[k + 2];
ctrlPointY = currentY + val[k + 3];
currentX += val[k + 4];
currentY += val[k + 5];
break;
case 'C': // curveto - Draws a cubic Bézier curve
path.cubicTo(val[k + 0], val[k + 1], val[k + 2], val[k + 3],
val[k + 4], val[k + 5]);
currentX = val[k + 4];
currentY = val[k + 5];
ctrlPointX = val[k + 2];
ctrlPointY = val[k + 3];
break;
case 's': // smooth curveto - Draws a cubic Bézier curve (reflective cp)
reflectiveCtrlPointX = 0;
reflectiveCtrlPointY = 0;
if (previousCmd == 'c' || previousCmd == 's'
|| previousCmd == 'C' || previousCmd == 'S') {
reflectiveCtrlPointX = currentX - ctrlPointX;
reflectiveCtrlPointY = currentY - ctrlPointY;
}
path.rCubicTo(reflectiveCtrlPointX, reflectiveCtrlPointY,
val[k + 0], val[k + 1],
val[k + 2], val[k + 3]);
ctrlPointX = currentX + val[k + 0];
ctrlPointY = currentY + val[k + 1];
currentX += val[k + 2];
currentY += val[k + 3];
break;
case 'S': // shorthand/smooth curveto Draws a cubic Bézier curve(reflective cp)
reflectiveCtrlPointX = currentX;
reflectiveCtrlPointY = currentY;
if (previousCmd == 'c' || previousCmd == 's'
|| previousCmd == 'C' || previousCmd == 'S') {
reflectiveCtrlPointX = 2 * currentX - ctrlPointX;
reflectiveCtrlPointY = 2 * currentY - ctrlPointY;
}
path.cubicTo(reflectiveCtrlPointX, reflectiveCtrlPointY,
val[k + 0], val[k + 1], val[k + 2], val[k + 3]);
ctrlPointX = val[k + 0];
ctrlPointY = val[k + 1];
currentX = val[k + 2];
currentY = val[k + 3];
break;
case 'q': // Draws a quadratic Bézier (relative)
path.rQuadTo(val[k + 0], val[k + 1], val[k + 2], val[k + 3]);
ctrlPointX = currentX + val[k + 0];
ctrlPointY = currentY + val[k + 1];
currentX += val[k + 2];
currentY += val[k + 3];
break;
case 'Q': // Draws a quadratic Bézier
path.quadTo(val[k + 0], val[k + 1], val[k + 2], val[k + 3]);
ctrlPointX = val[k + 0];
ctrlPointY = val[k + 1];
currentX = val[k + 2];
currentY = val[k + 3];
break;
case 't': // Draws a quadratic Bézier curve(reflective control point)(relative)
reflectiveCtrlPointX = 0;
reflectiveCtrlPointY = 0;
if (previousCmd == 'q' || previousCmd == 't'
|| previousCmd == 'Q' || previousCmd == 'T') {
reflectiveCtrlPointX = currentX - ctrlPointX;
reflectiveCtrlPointY = currentY - ctrlPointY;
}
path.rQuadTo(reflectiveCtrlPointX, reflectiveCtrlPointY,
val[k + 0], val[k + 1]);
ctrlPointX = currentX + reflectiveCtrlPointX;
ctrlPointY = currentY + reflectiveCtrlPointY;
currentX += val[k + 0];
currentY += val[k + 1];
break;
case 'T': // Draws a quadratic Bézier curve (reflective control point)
reflectiveCtrlPointX = currentX;
reflectiveCtrlPointY = currentY;
if (previousCmd == 'q' || previousCmd == 't'
|| previousCmd == 'Q' || previousCmd == 'T') {
reflectiveCtrlPointX = 2 * currentX - ctrlPointX;
reflectiveCtrlPointY = 2 * currentY - ctrlPointY;
}
path.quadTo(reflectiveCtrlPointX, reflectiveCtrlPointY,
val[k + 0], val[k + 1]);
ctrlPointX = reflectiveCtrlPointX;
ctrlPointY = reflectiveCtrlPointY;
currentX = val[k + 0];
currentY = val[k + 1];
break;
case 'a': // Draws an elliptical arc
// (rx ry x-axis-rotation large-arc-flag sweep-flag x y)
drawArc(path,
currentX,
currentY,
val[k + 5] + currentX,
val[k + 6] + currentY,
val[k + 0],
val[k + 1],
val[k + 2],
val[k + 3] != 0,
val[k + 4] != 0);
currentX += val[k + 5];
currentY += val[k + 6];
ctrlPointX = currentX;
ctrlPointY = currentY;
break;
case 'A': // Draws an elliptical arc
drawArc(path,
currentX,
currentY,
val[k + 5],
val[k + 6],
val[k + 0],
val[k + 1],
val[k + 2],
val[k + 3] != 0,
val[k + 4] != 0);
currentX = val[k + 5];
currentY = val[k + 6];
ctrlPointX = currentX;
ctrlPointY = currentY;
break;
}
previousCmd = cmd;
}
current[0] = currentX;
current[1] = currentY;
current[2] = ctrlPointX;
current[3] = ctrlPointY;
current[4] = currentSegmentStartX;
current[5] = currentSegmentStartY;
}
private static void drawArc(Path p,
float x0,
float y0,
float x1,
float y1,
float a,
float b,
float theta,
boolean isMoreThanHalf,
boolean isPositiveArc) {
/* Convert rotation angle from degrees to radians */
double thetaD = Math.toRadians(theta);
/* Pre-compute rotation matrix entries */
double cosTheta = Math.cos(thetaD);
double sinTheta = Math.sin(thetaD);
/* Transform (x0, y0) and (x1, y1) into unit space */
/* using (inverse) rotation, followed by (inverse) scale */
double x0p = (x0 * cosTheta + y0 * sinTheta) / a;
double y0p = (-x0 * sinTheta + y0 * cosTheta) / b;
double x1p = (x1 * cosTheta + y1 * sinTheta) / a;
double y1p = (-x1 * sinTheta + y1 * cosTheta) / b;
/* Compute differences and averages */
double dx = x0p - x1p;
double dy = y0p - y1p;
double xm = (x0p + x1p) / 2;
double ym = (y0p + y1p) / 2;
/* Solve for intersecting unit circles */
double dsq = dx * dx + dy * dy;
if (dsq == 0.0) {
Log.w(LOGTAG, " Points are coincident");
return; /* Points are coincident */
}
double disc = 1.0 / dsq - 1.0 / 4.0;
if (disc < 0.0) {
Log.w(LOGTAG, "Points are too far apart " + dsq);
float adjust = (float) (Math.sqrt(dsq) / 1.99999);
drawArc(p, x0, y0, x1, y1, a * adjust,
b * adjust, theta, isMoreThanHalf, isPositiveArc);
return; /* Points are too far apart */
}
double s = Math.sqrt(disc);
double sdx = s * dx;
double sdy = s * dy;
double cx;
double cy;
if (isMoreThanHalf == isPositiveArc) {
cx = xm - sdy;
cy = ym + sdx;
} else {
cx = xm + sdy;
cy = ym - sdx;
}
double eta0 = Math.atan2((y0p - cy), (x0p - cx));
double eta1 = Math.atan2((y1p - cy), (x1p - cx));
double sweep = (eta1 - eta0);
if (isPositiveArc != (sweep >= 0)) {
if (sweep > 0) {
sweep -= 2 * Math.PI;
} else {
sweep += 2 * Math.PI;
}
}
cx *= a;
cy *= b;
double tcx = cx;
cx = cx * cosTheta - cy * sinTheta;
cy = tcx * sinTheta + cy * cosTheta;
arcToBezier(p, cx, cy, a, b, x0, y0, thetaD, eta0, sweep);
}
/**
* Converts an arc to cubic Bezier segments and records them in p.
*
* @param p
* The target for the cubic Bezier segments
* @param cx
* The x coordinate center of the ellipse
* @param cy
* The y coordinate center of the ellipse
* @param a
* The radius of the ellipse in the horizontal direction
* @param b
* The radius of the ellipse in the vertical direction
* @param e1x
* E(eta1) x coordinate of the starting point of the arc
* @param e1y
* E(eta2) y coordinate of the starting point of the arc
* @param theta
* The angle that the ellipse bounding rectangle makes with horizontal plane
* @param start
* The start angle of the arc on the ellipse
* @param sweep
* The angle (positive or negative) of the sweep of the arc on the ellipse
*/
private static void arcToBezier(Path p,
double cx,
double cy,
double a,
double b,
double e1x,
double e1y,
double theta,
double start,
double sweep) {
// Taken from equations at: http://spaceroots.org/documents/ellipse/node8.html
// and http://www.spaceroots.org/documents/ellipse/node22.html
// Maximum of 45 degrees per cubic Bezier segment
int numSegments = (int) Math.ceil(Math.abs(sweep * 4 / Math.PI));
double eta1 = start;
double cosTheta = Math.cos(theta);
double sinTheta = Math.sin(theta);
double cosEta1 = Math.cos(eta1);
double sinEta1 = Math.sin(eta1);
double ep1x = (-a * cosTheta * sinEta1) - (b * sinTheta * cosEta1);
double ep1y = (-a * sinTheta * sinEta1) + (b * cosTheta * cosEta1);
double anglePerSegment = sweep / numSegments;
for (int i = 0; i < numSegments; i++) {
double eta2 = eta1 + anglePerSegment;
double sinEta2 = Math.sin(eta2);
double cosEta2 = Math.cos(eta2);
double e2x = cx + (a * cosTheta * cosEta2) - (b * sinTheta * sinEta2);
double e2y = cy + (a * sinTheta * cosEta2) + (b * cosTheta * sinEta2);
double ep2x = -a * cosTheta * sinEta2 - b * sinTheta * cosEta2;
double ep2y = -a * sinTheta * sinEta2 + b * cosTheta * cosEta2;
double tanDiff2 = Math.tan((eta2 - eta1) / 2);
double alpha =
Math.sin(eta2 - eta1) * (Math.sqrt(4 + (3 * tanDiff2 * tanDiff2)) - 1) / 3;
double q1x = e1x + alpha * ep1x;
double q1y = e1y + alpha * ep1y;
double q2x = e2x - alpha * ep2x;
double q2y = e2y - alpha * ep2y;
// Adding this no-op call to workaround a proguard related issue.
p.rLineTo(0, 0);
p.cubicTo((float) q1x,
(float) q1y,
(float) q2x,
(float) q2y,
(float) e2x,
(float) e2y);
eta1 = eta2;
e1x = e2x;
e1y = e2y;
ep1x = ep2x;
ep1y = ep2y;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Jared Rummler
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<resources>
<declare-styleable name="AnimatedSvgView">
<attr name="animatedSvgImageSizeX" format="integer"/>
<attr name="animatedSvgImageSizeY" format="integer"/>
<attr name="animatedSvgTraceTime" format="string"/>
<attr name="animatedSvgTraceTimePerGlyph" format="string"/>
<attr name="animatedSvgFillStart" format="string"/>
<attr name="animatedSvgFillTime" format="string"/>
<attr name="animatedSvgGlyphStrings" format="reference"/>
<attr name="animatedSvgTraceColors" format="reference"/>
<attr name="animatedSvgTraceResidueColors" format="reference"/>
<attr name="animatedSvgTraceMarkerLength" format="integer"/>
<attr name="animatedSvgFillColors" format="reference"/>
</declare-styleable>
</resources>
\ No newline at end of file
...@@ -251,6 +251,8 @@ dependencies { ...@@ -251,6 +251,8 @@ dependencies {
implementation(name: 'kssdk-ad-3.3.13', ext: 'aar') implementation(name: 'kssdk-ad-3.3.13', ext: 'aar')
// talkingdata已集成 // talkingdata已集成
implementation project(':animlibrary')
// 保活相关 // 保活相关
implementation 'me.weishu:free_reflection:2.2.0' implementation 'me.weishu:free_reflection:2.2.0'
implementation(name: 'alive-sdk-v3.1.5-release', ext: 'aar') implementation(name: 'alive-sdk-v3.1.5-release', ext: 'aar')
......
...@@ -40,7 +40,7 @@ class InitAppService : JobIntentService() { ...@@ -40,7 +40,7 @@ class InitAppService : JobIntentService() {
*/ */
private fun initApplication() { private fun initApplication() {
// 极光推送 // 极光推送
initJpush() // initJpush()
// PR下载附件 // PR下载附件
initPRDownloader() initPRDownloader()
......
...@@ -257,7 +257,6 @@ public class MintsApplication extends BaseApp { ...@@ -257,7 +257,6 @@ public class MintsApplication extends BaseApp {
AlarmManager.getInstance().isTimerTimeOut(Constant.CARRIER_CONNECT_WIFI); AlarmManager.getInstance().isTimerTimeOut(Constant.CARRIER_CONNECT_WIFI);
LogUtil.d(TAG, "mints ------------> wifi onWifiDisabled <------------");
if (WifiDataManager.INSTANCE.getWifiOff()) { if (WifiDataManager.INSTANCE.getWifiOff()) {
// 关闭 // 关闭
OutAppRouter.INSTANCE.showTriggerActivity(TriggerActivity.TRIGGER_TYPE_WIFI_DISCONNECT_TEST); OutAppRouter.INSTANCE.showTriggerActivity(TriggerActivity.TRIGGER_TYPE_WIFI_DISCONNECT_TEST);
...@@ -270,7 +269,6 @@ public class MintsApplication extends BaseApp { ...@@ -270,7 +269,6 @@ public class MintsApplication extends BaseApp {
AlarmManager.getInstance().isTimerTimeOut(Constant.CARRIER_DISCONNECT_WIFI); AlarmManager.getInstance().isTimerTimeOut(Constant.CARRIER_DISCONNECT_WIFI);
LogUtil.d(TAG, "mints ------------> wifi onWifiEnabled <------------");
if (WifiDataManager.INSTANCE.getWifiOn()) { if (WifiDataManager.INSTANCE.getWifiOn()) {
// 连接 // 连接
OutAppRouter.INSTANCE.showTriggerActivity(TriggerActivity.TRIGGER_TYPE_WIFI_BOOST); OutAppRouter.INSTANCE.showTriggerActivity(TriggerActivity.TRIGGER_TYPE_WIFI_BOOST);
......
...@@ -96,7 +96,7 @@ public class JpushManager { ...@@ -96,7 +96,7 @@ public class JpushManager {
switch (msg.what) { switch (msg.what) {
case MSG_SET_SERVICE: case MSG_SET_SERVICE:
TLog.d(TAG_LOG, "Set service in handler."); TLog.d(TAG_LOG, "Set service in handler.");
userBindingJpush((String) msg.obj); // userBindingJpush((String) msg.obj);
break; break;
case MSG_SET_ALIAS: case MSG_SET_ALIAS:
TLog.d(TAG_LOG, "Set alias in handler."); TLog.d(TAG_LOG, "Set alias in handler.");
...@@ -109,57 +109,6 @@ public class JpushManager { ...@@ -109,57 +109,6 @@ public class JpushManager {
} }
}; };
/**
* 绑定用户
*
* @param jsondata
*/
public void userBindingJpush(String jsondata) {
MintsApplication loanApplication = (MintsApplication) this.c;
LoanService loanService = loanApplication.getLoanService();
HashMap<String, Object> vo = new HashMap<>();
vo.put("uploadData", jsondata);
loanService.registerDevice(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new Subscriber<BaseResponse<JsonObject>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
if (NetUtils.isNetworkConnected(c) && NetCommon.httpErrorCode(e) != 500) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SET_SERVICE, jsondata), 1000 * 60);
} else {
TLog.d(TAG_LOG, "No network");
}
}
@Override
public void onNext(BaseResponse<JsonObject> baseResponse) {
int code = baseResponse.getStatus();
switch (code) {
case 200:
case 401:
case 404:
break;
default:
if (NetUtils.isNetworkConnected(c)) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SET_SERVICE, jsondata), 1000 * 60);
} else {
TLog.d(TAG_LOG, "No network");
}
break;
}
}
});
}
private final TagAliasCallback mAliasCallback = new TagAliasCallback() { private final TagAliasCallback mAliasCallback = new TagAliasCallback() {
......
...@@ -86,12 +86,6 @@ public class TrackManager { ...@@ -86,12 +86,6 @@ public class TrackManager {
} }
public void reportErrornterface(String url, String request) {
if (trackPresenter != null) {
trackPresenter.reportErrornterface(url, request);
}
}
public void setMinsActive() { public void setMinsActive() {
if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) { if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) {
HashMap<String, Object> vo = new HashMap<>(); HashMap<String, Object> vo = new HashMap<>();
......
...@@ -24,7 +24,8 @@ import java.util.Map; ...@@ -24,7 +24,8 @@ import java.util.Map;
*/ */
public class TTGroMoreAdManagerHolder { public class TTGroMoreAdManagerHolder {
public static final String TT_AD_APPID = "5221954"; // public static final String TT_AD_APPID = "5224123";
public static final String TT_AD_APPID = "5123456";
public static final String TT_AD_NAME = Constant.MINTS_APP_NAME; public static final String TT_AD_NAME = Constant.MINTS_APP_NAME;
public static boolean sInit; public static boolean sInit;
......
...@@ -6,7 +6,6 @@ import com.mints.fiveworld.common.Constant ...@@ -6,7 +6,6 @@ import com.mints.fiveworld.common.Constant
import com.mints.fiveworld.common.DeviceInfo import com.mints.fiveworld.common.DeviceInfo
import com.mints.fiveworld.manager.AppHttpManager import com.mints.fiveworld.manager.AppHttpManager
import com.mints.fiveworld.manager.AppPreferencesManager import com.mints.fiveworld.manager.AppPreferencesManager
import com.mints.fiveworld.manager.JpushManager
import com.mints.fiveworld.manager.UserManager import com.mints.fiveworld.manager.UserManager
import com.mints.fiveworld.mvp.model.BaseResponse import com.mints.fiveworld.mvp.model.BaseResponse
import com.mints.fiveworld.mvp.model.UserBean import com.mints.fiveworld.mvp.model.UserBean
...@@ -88,7 +87,7 @@ class MainPresenter : BasePresenter<MainView>() { ...@@ -88,7 +87,7 @@ class MainPresenter : BasePresenter<MainView>() {
if (isLinkView) return if (isLinkView) return
when (baseResponse.status) { when (baseResponse.status) {
200 -> { 200 -> {
JpushManager.getInstance().setJpushService(userId.toString()) // JpushManager.getInstance().setJpushService(userId.toString())
view.userLoginSuc() view.userLoginSuc()
} }
} }
......
...@@ -4,7 +4,6 @@ import android.text.TextUtils ...@@ -4,7 +4,6 @@ import android.text.TextUtils
import com.mints.fiveworld.MintsApplication import com.mints.fiveworld.MintsApplication
import com.mints.fiveworld.common.DeviceInfo import com.mints.fiveworld.common.DeviceInfo
import com.mints.fiveworld.manager.AppHttpManager import com.mints.fiveworld.manager.AppHttpManager
import com.mints.fiveworld.manager.JpushManager
import com.mints.fiveworld.manager.UserManager import com.mints.fiveworld.manager.UserManager
import com.mints.fiveworld.mvp.model.BaseResponse import com.mints.fiveworld.mvp.model.BaseResponse
import com.mints.fiveworld.mvp.model.SplashAppBean import com.mints.fiveworld.mvp.model.SplashAppBean
...@@ -120,7 +119,7 @@ class SplashPresenter : BasePresenter<SplashView>() { ...@@ -120,7 +119,7 @@ class SplashPresenter : BasePresenter<SplashView>() {
if (isLinkView) return if (isLinkView) return
when (baseResponse.status) { when (baseResponse.status) {
200 -> { 200 -> {
JpushManager.getInstance().setJpushService(userId.toString()) // JpushManager.getInstance().setJpushService(userId.toString())
} }
} }
} }
......
...@@ -215,28 +215,6 @@ public class TrackPresenter extends BaseTrackPresenter { ...@@ -215,28 +215,6 @@ public class TrackPresenter extends BaseTrackPresenter {
}); });
} }
public void reportErrornterface(String url, String request) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("url", url);
vo.put("request", request);
AppHttpManager.getInstance(loanApplication)
.call(loanService.reportErrornterface(vo),
new BaseSubscriber<BaseResponse<JsonObject>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<JsonObject> baseResponse) {
}
});
}
public void getOuterAdConfig() { public void getOuterAdConfig() {
HashMap<String, Object> vo = new HashMap<>(); HashMap<String, Object> vo = new HashMap<>();
vo.put("uid", UserManager.getInstance().getUserID()); vo.put("uid", UserManager.getInstance().getUserID());
......
...@@ -44,12 +44,6 @@ public interface LoanService { ...@@ -44,12 +44,6 @@ public interface LoanService {
@POST("api/visitorlogin") @POST("api/visitorlogin")
Observable<BaseResponse<UserBean>> visitorlogin(@Body Map<String, Object> vo); Observable<BaseResponse<UserBean>> visitorlogin(@Body Map<String, Object> vo);
/**
* 注册极光设备
*/
@POST("api/registerDevice")
Observable<BaseResponse<JsonObject>> registerDevice(@Body Map<String, Object> vo);
/** /**
* 提交设备信息、后台激活 * 提交设备信息、后台激活
*/ */
...@@ -68,12 +62,6 @@ public interface LoanService { ...@@ -68,12 +62,6 @@ public interface LoanService {
@POST("api/getHallBaseMsg/v121") @POST("api/getHallBaseMsg/v121")
Observable<BaseResponse<UserTaskMsgBean>> getHallBaseMsg121(@Body Map<String, Object> vo); Observable<BaseResponse<UserTaskMsgBean>> getHallBaseMsg121(@Body Map<String, Object> vo);
/**
* 临时使用-接口加密异常时调用
*/
@POST("common/reportErrornterface")
Observable<BaseResponse<JsonObject>> reportErrornterface(@Body Map<String, Object> vo);
/** /**
* groMore ECPM数据提交 * groMore ECPM数据提交
*/ */
......
...@@ -190,7 +190,6 @@ public class OkHttpInterceptor implements Interceptor { ...@@ -190,7 +190,6 @@ public class OkHttpInterceptor implements Interceptor {
} }
} catch (Exception e) { } catch (Exception e) {
LogUtil.d("OkHttpInterceptor", "json解密失败。url:" + response.request().url().toString() + "\n\n 响应报文:" + buffer.clone().readString(charset)); LogUtil.d("OkHttpInterceptor", "json解密失败。url:" + response.request().url().toString() + "\n\n 响应报文:" + buffer.clone().readString(charset));
TrackManager.getInstance().reportErrornterface(response.request().url().toString(), buffer.clone().readString(charset));
e.printStackTrace(); e.printStackTrace();
} }
ResponseBody responseBody = ResponseBody.create(contentType, rspString); ResponseBody responseBody = ResponseBody.create(contentType, rspString);
......
...@@ -192,19 +192,15 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener { ...@@ -192,19 +192,15 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
private fun startTimer() { private fun startTimer() {
var step = 0 var step = 0
containerAnim.setBackgroundColor(ContextCompat.getColor(this, R.color.color_main))
when (mIncreaseType) { when (mIncreaseType) {
INCREASE_SAVE_ELECTRICITY -> { INCREASE_SAVE_ELECTRICITY -> {
containerAnim.setBackgroundColor(ContextCompat.getColor(this, R.color.color_main))
// iv_gif.layoutParams.width = BubbleUtils.dp2px(200)
GlideUtils.loadImageViewGif(this, R.drawable.battery_optimize, iv_gif) GlideUtils.loadImageViewGif(this, R.drawable.battery_optimize, iv_gif)
} }
INCREASE_CLEAN -> { INCREASE_CLEAN -> {
containerAnim.setBackgroundColor(Color.parseColor("#906cf4"))
GlideUtils.loadImageViewGif(this, R.drawable.rubbish_optimize, iv_gif) GlideUtils.loadImageViewGif(this, R.drawable.rubbish_optimize, iv_gif)
} }
else -> { else -> {
containerAnim.setBackgroundColor(Color.parseColor("#906cf4"))
GlideUtils.loadImageViewGif(this, R.drawable.rocket_optimize,iv_gif) GlideUtils.loadImageViewGif(this, R.drawable.rocket_optimize,iv_gif)
tv_progress.text = "正在检测后台常驻软件..." tv_progress.text = "正在检测后台常驻软件..."
} }
......
...@@ -441,7 +441,6 @@ class OneCleanActivity : BaseActivity(), View.OnClickListener { ...@@ -441,7 +441,6 @@ class OneCleanActivity : BaseActivity(), View.OnClickListener {
} }
private fun initView() { private fun initView() {
headerContainer.setBackgroundColor(Color.parseColor("#8278DC"))
line.visibility = View.GONE line.visibility = View.GONE
if (scanMax == 1) { if (scanMax == 1) {
tv_title.text = "一键加速" tv_title.text = "一键加速"
......
...@@ -146,7 +146,7 @@ class SafeTestingActivity : BaseActivity(), View.OnClickListener { ...@@ -146,7 +146,7 @@ class SafeTestingActivity : BaseActivity(), View.OnClickListener {
containerAnim.setBackgroundColor(ContextCompat.getColor(this, R.color.color_main)) containerAnim.setBackgroundColor(ContextCompat.getColor(this, R.color.color_main))
GlideUtils.loadImageViewGif(this, R.drawable.wifi_speed, iv_gif) GlideUtils.loadImageViewGif(this, R.drawable.wifi_speed, iv_gif)
} else { } else {
containerAnim.setBackgroundColor(Color.parseColor("#8278DC")) containerAnim.setBackgroundColor(ContextCompat.getColor(this, R.color.color_main))
GlideUtils.loadImageViewGif(this, R.drawable.safe_check_optimize, iv_gif) GlideUtils.loadImageViewGif(this, R.drawable.safe_check_optimize, iv_gif)
NumAnimUtil.startAnim(tv_progress, 100f, (mTimerMax - 1) * STEP_Interval) NumAnimUtil.startAnim(tv_progress, 100f, (mTimerMax - 1) * STEP_Interval)
} }
......
...@@ -61,7 +61,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener { ...@@ -61,7 +61,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
item_invitedCode.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE item_invitedCode.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
item_invitedCode.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE item_invitedCode.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE
item_invitedCode.findViewById<TextView>(R.id.tv_right).text = item_invitedCode.findViewById<TextView>(R.id.tv_right).text =
"CL-${UserManager.getInstance().codeID}" "5G-${UserManager.getInstance().codeID}"
item_cleanCache.findViewById<TextView>(R.id.tv_title).text = "清理缓存" item_cleanCache.findViewById<TextView>(R.id.tv_title).text = "清理缓存"
val cleanCache = ContextCompat.getDrawable(this, R.mipmap.icon_settings_clean) val cleanCache = ContextCompat.getDrawable(this, R.mipmap.icon_settings_clean)
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
android:shape="rectangle"> android:shape="rectangle">
<gradient <gradient
android:angle="90" android:angle="90"
android:endColor="#8278DC" android:endColor="@color/color_main"
android:startColor="#A29CDF" android:startColor="@color/color_main_start"
android:type="linear" android:type="linear"
android:useLevel="true" /> android:useLevel="true" />
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<corners android:radius="5dip" /> <corners android:radius="5dip" />
<solid android:color="#25C7AD"/> <solid android:color="@color/color_main"/>
</shape> </shape>
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<!-- 渐变色 --> <!-- 渐变色 -->
<gradient <gradient
android:endColor="#9D97E0" android:endColor="@color/color_main"
android:startColor="#B2ADE7" /> android:startColor="@color/color_main_start" />
</shape> </shape>
\ No newline at end of file
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<include
<include layout="@layout/header_layout" /> android:visibility="gone"
layout="@layout/header_layout" />
<com.mints.fiveworld.ui.widgets.InterceptFrameLayout <com.mints.fiveworld.ui.widgets.InterceptFrameLayout
android:id="@+id/container" android:id="@+id/container"
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp" android:layout_marginTop="30dp"
android:src="@mipmap/ic_clean" android:src="@mipmap/ic_clean"
android:visibility="visible" /> android:visibility="visible" />
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="120dp" android:layout_marginTop="140dp"
android:gravity="center" android:gravity="center"
android:text="正在扫描您的手机..." android:text="正在扫描您的手机..."
android:textColor="@color/white" android:textColor="@color/white"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="280dp" android:layout_height="280dp"
android:background="#8275DF" /> android:background="@color/color_main" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<ImageView <ImageView
android:id="@+id/iv_gif" android:id="@+id/iv_gif"
android:layout_width="320dp" android:layout_width="280dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" /> android:layout_centerInParent="true" />
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#8E85DD" android:background="#4E95FA"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/header_layout" /> <include layout="@layout/header_layout" />
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:background="@drawable/shape_main" android:background="@drawable/shape_tv_gold"
android:text="信号增强" android:text="信号增强"
android:textColor="@color/white" android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="@+id/imageView2" app:layout_constraintBottom_toBottomOf="@+id/imageView2"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="color_main">#4089F2</color> <color name="color_main">#468df8</color>
<color name="color_main_start">#38A8F5</color>
<color name="white">#FFFFFF</color> <color name="white">#FFFFFF</color>
<color name="black">#000000</color> <color name="black">#000000</color>
......
...@@ -20,11 +20,11 @@ RELEASE_KEY_ALIAS=mints_world ...@@ -20,11 +20,11 @@ RELEASE_KEY_ALIAS=mints_world
RELEASE_STORE_PASSWORD=mints.world RELEASE_STORE_PASSWORD=mints.world
RELEASE_STORE_FILE=mints_fiveworld.jks RELEASE_STORE_FILE=mints_fiveworld.jks
#友盟 #友盟
RELEASE_UMENG_KEY= RELEASE_UMENG_KEY=616539dd14e22b6a4f1dae08
#JPush #JPush
RELEASE_JPUSH_KEY= RELEASE_JPUSH_KEY=
#TalkingData #TalkingData
RELEASE_TALKING_DATA_KEY= RELEASE_TALKING_DATA_KEY=E686A12C1CFE4B2AA9310D60366CB7AB
#Bugly #Bugly
RELEASE_BUGLY_KEY=aa4f79a8f4 RELEASE_BUGLY_KEY=aa4f79a8f4
......
include ':app' include ':app', ':animlibrary'
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment