diff --git a/.gitignore b/.gitignore index f93878a..3365260 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ .idea/vcs.xml .idea/runConfigurations.xml + +projectFilesBackup/.idea/workspace.xml diff --git a/app/src/main/java/io/netopen/hotbitmapgg/creditsesameringview/Fragment1.java b/app/src/main/java/io/netopen/hotbitmapgg/creditsesameringview/Fragment1.java index 0cb0481..0c2b80e 100644 --- a/app/src/main/java/io/netopen/hotbitmapgg/creditsesameringview/Fragment1.java +++ b/app/src/main/java/io/netopen/hotbitmapgg/creditsesameringview/Fragment1.java @@ -2,6 +2,7 @@ import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; +import android.annotation.SuppressLint; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; @@ -11,6 +12,8 @@ import android.widget.ImageView; import android.widget.RelativeLayout; +import java.util.Random; + import io.netopen.hotbitmapgg.view.NewCreditSesameView; /** @@ -29,10 +32,9 @@ public class Fragment1 extends Fragment private RelativeLayout mLayout; - private ImageView mButton; - private NewCreditSesameView newCreditSesameView; + private Random random = new Random(); public static Fragment1 newInstance() { @@ -43,12 +45,13 @@ public static Fragment1 newInstance() @Nullable @Override + @SuppressLint("InflateParams") public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_1, null); mLayout = (RelativeLayout) view.findViewById(R.id.layout); - mButton = (ImageView) view.findViewById(R.id.btn); + ImageView mButton = (ImageView) view.findViewById(R.id.btn); newCreditSesameView = (NewCreditSesameView) view.findViewById(R.id.sesame_view); mLayout.setBackgroundColor(mColors[0]); mButton.setOnClickListener(new View.OnClickListener() @@ -58,7 +61,8 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, public void onClick(View view) { - newCreditSesameView.setSesameValues(639); + int i = random.nextInt(950); + newCreditSesameView.setSesameValues(i); startColorChangeAnim(); } }); diff --git a/app/src/main/java/io/netopen/hotbitmapgg/creditsesameringview/Fragment2.java b/app/src/main/java/io/netopen/hotbitmapgg/creditsesameringview/Fragment2.java index 2b6b522..1977a61 100644 --- a/app/src/main/java/io/netopen/hotbitmapgg/creditsesameringview/Fragment2.java +++ b/app/src/main/java/io/netopen/hotbitmapgg/creditsesameringview/Fragment2.java @@ -1,5 +1,6 @@ package io.netopen.hotbitmapgg.creditsesameringview; +import android.annotation.SuppressLint; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; @@ -8,6 +9,8 @@ import android.view.ViewGroup; import android.widget.ImageView; +import java.util.Random; + import io.netopen.hotbitmapgg.view.OldCreditSesameView; /** @@ -19,7 +22,7 @@ public class Fragment2 extends Fragment private OldCreditSesameView oldCreditSesameView; - private ImageView mButton; + private Random random = new Random(); public static Fragment2 newInstance() { @@ -30,12 +33,13 @@ public static Fragment2 newInstance() @Nullable @Override + @SuppressLint("InflateParams") public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_2, null); oldCreditSesameView = (OldCreditSesameView) view.findViewById(R.id.sesame_view); - mButton = (ImageView) view.findViewById(R.id.btn); + ImageView mButton = (ImageView) view.findViewById(R.id.btn); mButton.setOnClickListener(new View.OnClickListener() { @@ -43,7 +47,8 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, public void onClick(View view) { - oldCreditSesameView.setSesameValues(639); + int i = random.nextInt(950); + oldCreditSesameView.setSesameValues(i); } }); diff --git a/build.gradle b/build.gradle index 77ce66e..53f4fad 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.3' + classpath 'com.android.tools.build:gradle:2.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/view/src/main/java/io/netopen/hotbitmapgg/view/NewCreditSesameView.java b/view/src/main/java/io/netopen/hotbitmapgg/view/NewCreditSesameView.java index a4bb7f2..c28c660 100644 --- a/view/src/main/java/io/netopen/hotbitmapgg/view/NewCreditSesameView.java +++ b/view/src/main/java/io/netopen/hotbitmapgg/view/NewCreditSesameView.java @@ -437,14 +437,16 @@ public void setSesameValues(int values) if (values > 550 && values <= 600) { sesameLevel = "信用中等"; + mTotalAngle = (values - 550) * 120 / 150f + 43; } else if (values > 600 && values <= 650) { sesameLevel = "信用良好"; + mTotalAngle = (values - 550) * 120 / 150f + 45; } else { sesameLevel = "信用优秀"; + mTotalAngle = (values - 550) * 120 / 150f + 48; } - mTotalAngle = (values - 550) * 120 / 150f + 43; evaluationTime = "评估时间:" + getCurrentTime(); } else if (values <= 950) { diff --git a/view/src/main/java/io/netopen/hotbitmapgg/view/OldCreditSesameView.java b/view/src/main/java/io/netopen/hotbitmapgg/view/OldCreditSesameView.java index 0273c6f..9e40fa9 100644 --- a/view/src/main/java/io/netopen/hotbitmapgg/view/OldCreditSesameView.java +++ b/view/src/main/java/io/netopen/hotbitmapgg/view/OldCreditSesameView.java @@ -19,7 +19,7 @@ import android.graphics.SweepGradient; import android.util.AttributeSet; import android.view.View; -import android.view.animation.BounceInterpolator; +import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.LinearInterpolator; import java.text.SimpleDateFormat; @@ -466,14 +466,16 @@ public void setSesameValues(int num) if (num > 550 && num <= 600) { sesameLevel = "信用中等"; + mTotalAngle = (num - 550) * 120 / 150f + 43; } else if (num > 600 && num <= 650) { sesameLevel = "信用良好"; + mTotalAngle = (num - 550) * 120 / 150f + 45; } else { sesameLevel = "信用优秀"; + mTotalAngle = (num - 550) * 120 / 150f + 48; } - mTotalAngle = (num - 550) * 120 / 150f + 45; evaluationTime = "评估时间:" + getCurrentTime(); } else if (num <= 950) { @@ -497,7 +499,7 @@ public void startRotateAnim() { ValueAnimator mAngleAnim = ValueAnimator.ofFloat(mCurrentAngle, mTotalAngle); - mAngleAnim.setInterpolator(new BounceInterpolator()); + mAngleAnim.setInterpolator(new AccelerateDecelerateInterpolator()); mAngleAnim.setDuration(3000); mAngleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {