diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..5d6f65c --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/.idea/markdown-navigator.xml b/.idea/markdown-navigator.xml new file mode 100644 index 0000000..940cf28 --- /dev/null +++ b/.idea/markdown-navigator.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/markdown-navigator/profiles_settings.xml b/.idea/markdown-navigator/profiles_settings.xml new file mode 100644 index 0000000..57927c5 --- /dev/null +++ b/.idea/markdown-navigator/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..aeca25b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + Android + + + Android > Lint > Correctness + + + Java + + + Java language level migration aidsJava + + + + + Android + + + + + + + + + + + + + + + + + + + + + + + + + 1.8 + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7e78688 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/GIF.gif b/GIF.gif new file mode 100644 index 0000000..1436e35 Binary files /dev/null and b/GIF.gif differ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..16c1fae --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,25 @@ + + The MIT License (MIT) + Copyright (c) 2017 Jenly Yu + https://github.com/jenly1314 + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a229e1 --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +# RadarView +[![Download](https://img.shields.io/badge/download-App-blue.svg)](https://raw.githubusercontent.com/jenly1314/RadarView/master/app/app-release.apk) +[![](https://jitpack.io/v/jenly1314/RadarView.svg)](https://jitpack.io/#jenly1314/RadarView) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/mit-license.php) +[![Blog](https://img.shields.io/badge/blog-Jenly-9933CC.svg)](http://blog.csdn.net/jenly121) + +RadarView for Android 是一个雷达扫描动画后,然后展示得分效果的控件。 + +## Gif 展示 +![Image](GIF.gif) + +## 引入 + +### Maven: +```maven + + com.king.view + radarview + 1.0.0 + pom + +``` +### Gradle: +```gradle +compile 'com.king.view:radarview:1.0.0' +``` +### Lvy: +```lvy + + + +``` + +###### 如果Gradle出现compile失败的情况,可以在Project的build.gradle里面添加如下:(也可以使用上面的GitPack来complie) +```gradle +allprojects { + repositories { + //... + maven { url 'https://dl.bintray.com/jenly/maven' } + } +} +``` + +## 示例 + +布局 +```Xml + +``` + +自定义属性 +```Xml + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +代码示例(核心调用代码) +```Java +//开始雷达扫描 +radarView.start(); +//停止雷达扫描 +radarView.stop(); +//设置雷达扫描区域的颜色,传多个色值表示渐变 +radarView.setScanColor(int... colors); +/** + * 显示分数 + * @param from 初始值 + * @param to 目标值(最终分数) + * @param duration 从初始值到目标值的动画持续时间 + * @param format + * @param isShowAnim 是否显示动画 + */ +radarView.showScore(float from, float to, int duration, final String format,boolean isShowAnim); + +``` + + +## 关于我 + Name: Jenly + + Email: jenly1314@gmail.com / jenly1314@vip.qq.com + + CSDN: http://blog.csdn.net/jenly121 + + Github: https://github.com/jenly1314 + + 微信公众号: + + ![公众号](http://olambmg9j.bkt.clouddn.com/jenly666.jpg) + + 加入QQ群: [20867961](http://shang.qq.com/wpa/qunwpa?idkey=8fcc6a2f88552ea44b1411582c94fd124f7bb3ec227e2a400dbbfaad3dc2f5ad) + + + diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/app-release.apk b/app/app-release.apk new file mode 100644 index 0000000..6cacfef Binary files /dev/null and b/app/app-release.apk differ diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..e99e147 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,36 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 25 + buildToolsVersion "25.0.2" + defaultConfig { + applicationId "com.king.radar" + minSdkVersion 11 + targetSdkVersion 25 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + lintOptions { + checkReleaseBuilds false + abortOnError false + } +} + +dependencies { + compile fileTree(include: ['*.jar'], dir: 'libs') + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:25.3.1' + compile 'com.android.support.constraint:constraint-layout:1.0.2' + testCompile 'junit:junit:4.12' + compile project(':lib') +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..e0476cf --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in D:\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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/king/radar/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/king/radar/ExampleInstrumentedTest.java new file mode 100644 index 0000000..5138893 --- /dev/null +++ b/app/src/androidTest/java/com/king/radar/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.king.radar; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.king.radar", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..499f440 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/king/radar/MainActivity.java b/app/src/main/java/com/king/radar/MainActivity.java new file mode 100644 index 0000000..29d8d41 --- /dev/null +++ b/app/src/main/java/com/king/radar/MainActivity.java @@ -0,0 +1,61 @@ +package com.king.radar; + +import android.graphics.Color; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +import com.king.view.radarview.RadarView; + +public class MainActivity extends AppCompatActivity implements View.OnClickListener { + + RadarView rv; + + Button btnStyle,btnRadar,btnScore; + + private boolean isAll; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + rv = (RadarView)findViewById(R.id.rv); + + btnStyle = (Button)findViewById(R.id.btnStyle); + btnRadar = (Button)findViewById(R.id.btnRadar); + btnScore = (Button)findViewById(R.id.btnScore); + +// btnStyle.setVisibility(View.GONE); + + btnStyle.setOnClickListener(this); + btnRadar.setOnClickListener(this); + btnScore.setOnClickListener(this); + } + + private void clickStyle(){ + if(isAll){ + rv.setScanColor(new int[]{Color.TRANSPARENT,Color.TRANSPARENT,rv.getCircleColor()}); + }else{ + rv.setScanColor(new int[]{Color.TRANSPARENT,rv.getCircleColor()}); + } + isAll = !isAll; + + } + + @Override + public void onClick(View v) { + switch (v.getId()){ + case R.id.btnStyle: + clickStyle(); + break; + case R.id.btnRadar: + rv.start(); + break; + case R.id.btnScore: + rv.showScore(98f); + break; + } + } +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..c45c14e --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,39 @@ + + + + +