├── .gitattributes
├── .gitignore
├── .gradle
└── 2.4
│ └── taskArtifacts
│ ├── cache.properties
│ ├── cache.properties.lock
│ ├── fileHashes.bin
│ ├── fileSnapshots.bin
│ ├── outputFileStates.bin
│ └── taskArtifacts.bin
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── dictionaries
│ └── zhangzhenzhong1.xml
├── encodings.xml
├── gradle.xml
├── libraries
│ ├── appcompat_v7_22_2_1.xml
│ ├── nineoldandroids_2_4_0.xml
│ ├── support_annotations_22_2_1.xml
│ └── support_v4_22_2_1.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── workspace.xml
├── DiscView-master.iml
├── DiscView.iml
├── README.md
├── app
├── .gitignore
├── app.iml
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── xinlan
│ │ └── circleviewdemo
│ │ ├── MainActivity.java
│ │ └── SubFragment.java
│ └── res
│ ├── drawable-hdpi
│ ├── arrow.png
│ └── indicator.png
│ ├── layout
│ ├── activity_main.xml
│ ├── fragment_1.xml
│ ├── fragment_2.xml
│ ├── fragment_3.xml
│ └── fragment_4.xml
│ ├── menu
│ └── menu_main.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── build
└── intermediates
│ └── dex-cache
│ └── cache.xml
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
├── .gitignore
├── build.gradle
├── library.iml
├── libs
│ └── nineoldandroids-2.4.0.jar
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── xinlan
│ │ └── discview
│ │ ├── CircleView.java
│ │ ├── DiscView.java
│ │ └── DiscViewUtils.java
│ └── res
│ ├── anim
│ └── scale_animation.xml
│ ├── layout
│ └── view_disc_layout.xml
│ └── values
│ ├── attr.xml
│ └── strings.xml
├── local.properties
├── screens
├── 1.png
├── 2.png
├── 3.png
├── 4.png
└── show.gif
└── settings.gradle
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear in the root of a volume
35 | .DocumentRevisions-V100
36 | .fseventsd
37 | .Spotlight-V100
38 | .TemporaryItems
39 | .Trashes
40 | .VolumeIcon.icns
41 |
42 | # Directories potentially created on remote AFP share
43 | .AppleDB
44 | .AppleDesktop
45 | Network Trash Folder
46 | Temporary Items
47 | .apdisk
48 |
--------------------------------------------------------------------------------
/.gradle/2.4/taskArtifacts/cache.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 13 12:04:11 CST 2016
2 |
--------------------------------------------------------------------------------
/.gradle/2.4/taskArtifacts/cache.properties.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/.gradle/2.4/taskArtifacts/cache.properties.lock
--------------------------------------------------------------------------------
/.gradle/2.4/taskArtifacts/fileHashes.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/.gradle/2.4/taskArtifacts/fileHashes.bin
--------------------------------------------------------------------------------
/.gradle/2.4/taskArtifacts/fileSnapshots.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/.gradle/2.4/taskArtifacts/fileSnapshots.bin
--------------------------------------------------------------------------------
/.gradle/2.4/taskArtifacts/outputFileStates.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/.gradle/2.4/taskArtifacts/outputFileStates.bin
--------------------------------------------------------------------------------
/.gradle/2.4/taskArtifacts/taskArtifacts.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/.gradle/2.4/taskArtifacts/taskArtifacts.bin
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | DiscView-master
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/dictionaries/zhangzhenzhong1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
26 |
27 |
--------------------------------------------------------------------------------
/.idea/libraries/appcompat_v7_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/nineoldandroids_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/support_annotations_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/support_v4_22_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | Android Lint
43 |
44 |
45 | Compiler issuesJava
46 |
47 |
48 | GPath inspectionsGroovy
49 |
50 |
51 | Groovy
52 |
53 |
54 | Internationalization issuesJava
55 |
56 |
57 | JSON
58 |
59 |
60 | Java
61 |
62 |
63 | Performance issuesJava
64 |
65 |
66 | Properties Files
67 |
68 |
69 | Properties FilesJava
70 |
71 |
72 |
73 |
74 | Android
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 | 1.7
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/DiscView-master.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/DiscView.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
圆盘显示控件 动画展示数据
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 使用方式:
16 |
17 | xml布局:
18 | 《com.xinlan.discview.DiscView
19 | xmlns:app="http://schemas.android.com/apk/res-auto"
20 | app:dvStrokenWidth="10dp"
21 | app:dvStrokenColor="#000000"
22 | app:dvOuterCircleShow="true"
23 | app:dvOuterCirclePad="5dp"
25 | app:dvInnerCirclePad="4dp"
26 | app:dvBottomCircleIsShow="true"
27 | app:dvIndicatorDraw="@drawable/icon"
28 | app:dvStartRotateAngle="10"
29 | app:dvAngleRotateSpan="320"
30 | app:dvCircleMode="dot"
31 | android:layout_width="fill_parent"
32 | android:layout_height="220dp" />
33 |
34 | code:
35 | mDiscView.setValue(int value);//设置数值
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 22
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.xinlan.circleviewdemo"
9 | minSdkVersion 9
10 | targetSdkVersion 22
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile 'com.android.support:appcompat-v7:22.2.1'
25 | compile project(':library')
26 | }
27 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xinlan/circleviewdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.circleviewdemo;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentManager;
6 | import android.support.v4.app.FragmentStatePagerAdapter;
7 | import android.support.v4.view.ViewPager;
8 | import android.support.v7.app.AppCompatActivity;
9 |
10 | public class MainActivity extends AppCompatActivity {
11 | int[] layouts = {R.layout.fragment_1, R.layout.fragment_2, R.layout.fragment_3, R.layout.fragment_4};
12 | private ViewPager mGallery;
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 | mGallery = (ViewPager) findViewById(R.id.gallery);
19 | mGallery.setOffscreenPageLimit(4);
20 | mGallery.setAdapter(new GalleryAdapter(this.getSupportFragmentManager()));
21 | }
22 |
23 | private final class GalleryAdapter extends FragmentStatePagerAdapter {
24 |
25 | public GalleryAdapter(FragmentManager fm) {
26 | super(fm);
27 | }
28 |
29 | @Override
30 | public Fragment getItem(int position) {
31 | return SubFragment.newInstance(layouts[position]);
32 | }
33 |
34 | @Override
35 | public int getCount() {
36 | return layouts.length;
37 | }
38 | }//end inner class
39 | }//end class
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xinlan/circleviewdemo/SubFragment.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.circleviewdemo;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.Button;
9 |
10 | import com.xinlan.discview.DiscView;
11 |
12 | /**
13 | * Created by panyi on 2015/8/6.
14 | */
15 | public class SubFragment extends Fragment implements View.OnClickListener {
16 |
17 | private int mLayoutId;
18 | private Button testBtn;
19 | private DiscView mDiscView;
20 |
21 | public static SubFragment newInstance(int layoutId) {
22 | SubFragment frg = new SubFragment();
23 | frg.mLayoutId = layoutId;
24 | return frg;
25 | }
26 |
27 | @Override
28 | public void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | }
31 |
32 | @Override
33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
34 | View mainView = inflater.inflate(mLayoutId,null);
35 | testBtn = (Button)mainView.findViewById(R.id.btn);
36 | mDiscView = (DiscView)mainView.findViewById(R.id.disc_view);
37 | testBtn.setOnClickListener(this);
38 | return mainView;
39 | }
40 |
41 | @Override
42 | public void onClick(View v) {
43 | mDiscView.setValue(330);
44 | }
45 | }//end class
46 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/app/src/main/res/drawable-hdpi/arrow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/app/src/main/res/drawable-hdpi/indicator.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_1.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
14 |
15 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_2.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
14 |
15 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_3.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
15 |
16 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_4.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
16 |
17 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 5dp
4 | 5dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CircleViewDemo
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/build/intermediates/dex-cache/cache.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
9 |
10 |
11 | -
16 |
17 |
18 | -
23 |
24 |
25 | -
30 |
31 |
32 | -
37 |
38 |
39 | -
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Aug 04 12:53:10 CST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 22
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 9
9 | targetSdkVersion 22
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | compile 'com.android.support:appcompat-v7:22.2.1'
24 | compile files('libs/nineoldandroids-2.4.0.jar')
25 | }
26 |
--------------------------------------------------------------------------------
/library/library.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/library/libs/nineoldandroids-2.4.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/library/libs/nineoldandroids-2.4.0.jar
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/library/src/main/java/com/xinlan/discview/CircleView.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.discview;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.graphics.Bitmap;
6 | import android.graphics.Canvas;
7 | import android.graphics.Color;
8 | import android.graphics.DashPathEffect;
9 | import android.graphics.Paint;
10 | import android.graphics.PathEffect;
11 | import android.graphics.Rect;
12 | import android.graphics.RectF;
13 | import android.os.Build;
14 | import android.util.AttributeSet;
15 | import android.view.View;
16 |
17 | /**
18 | * Created by panyi on 2015/8/4.
19 | */
20 | public class CircleView extends View {
21 | public static final int PAD = 30;
22 | public static final int MIN_VALUE = 0;
23 | public static final int MAX_VALUE = 360;
24 |
25 | private Context mContext;
26 |
27 | //圆环模式
28 | private static final int CIRCLE_MODE_NORMAL = 1;//普通模式
29 | private static final int CIRCLE_MODE_ROUND = 2;//圆角模式(文艺模式)
30 | private static final int CIRCLE_MODE_DOT = 3;//虚线模式(2B模式)
31 | protected int mCircleMode = CIRCLE_MODE_NORMAL;//圆环模式 默认为普通模式
32 |
33 | private static final int EXTRA_CIRCLE_WIDTH = 1;
34 | protected boolean mOuterCircleIsShow = false;//外部圆环是否显示 默认不显示
35 | protected int mOuterCirclePad = 20;//外部圆环距离主圆环边距
36 | private Paint extraCirclePaint = new Paint();
37 |
38 | protected boolean mInnerCircleIsShow = false;//内装饰圆是否显示
39 | protected int mInnerCirclePad = 20;
40 |
41 | protected int stokenWidth = 20;//圆环宽度
42 | private int angle = 0;
43 | private Paint paint = new Paint();//绘制主圆环画笔
44 | private RectF ovalRect = new RectF();
45 | protected int mRadiusColor = Color.WHITE;//圆环颜色
46 |
47 | protected boolean isBottomCircleShow = false;//底部圆是否显示 默认不显示
48 | private Paint bottomPaint = new Paint();
49 |
50 | private Bitmap indicatorBitmap;//圆形指示器Bitmap
51 | private RectF bitDistRect;
52 | private Rect bitSrcRect;
53 |
54 | protected int startRotateAngle = MIN_VALUE;//圆盘开始角度 默认为最底部0度
55 | protected int angleRotateSpan = MAX_VALUE;//圆盘可旋转角度范围
56 |
57 | private RectF tempRect = new RectF();
58 |
59 | public CircleView(Context context) {
60 | super(context);
61 | initView(context, null);
62 | }
63 |
64 | public CircleView(Context context, AttributeSet attrs) {
65 | super(context, attrs);
66 | initView(context, attrs);
67 | }
68 |
69 | public CircleView(Context context, AttributeSet attrs, int defStyleAttr) {
70 | super(context, attrs, defStyleAttr);
71 | initView(context, attrs);
72 | }
73 |
74 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
75 | public CircleView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
76 | super(context, attrs, defStyleAttr, defStyleRes);
77 | initView(context, attrs);
78 | }
79 |
80 | private void initView(Context mContext, AttributeSet attrs) {
81 | this.mContext = mContext;
82 |
83 | paint.setColor(mRadiusColor);//圆圈颜色
84 | paint.setStyle(Paint.Style.STROKE);//设置空心
85 | paint.setStrokeWidth(stokenWidth);//圆圈宽度设置
86 | paint.setAntiAlias(true);//反锯齿
87 |
88 | bottomPaint.setStyle(Paint.Style.STROKE);//设置空心
89 | bottomPaint.setStrokeWidth(stokenWidth);//圆圈宽度设置
90 |
91 | setCircleMode(mCircleMode);//设置圆环模式
92 |
93 | //装饰圆形 Paint
94 | extraCirclePaint.setColor(mRadiusColor);//圆为白色
95 | extraCirclePaint.setStyle(Paint.Style.STROKE);//设置空心
96 | extraCirclePaint.setStrokeWidth(EXTRA_CIRCLE_WIDTH);//圆圈宽度设置
97 | extraCirclePaint.setAntiAlias(true);//反锯齿
98 | }
99 |
100 | protected void setIndicatorBit(Bitmap bit) {
101 | indicatorBitmap = bit;
102 | if (indicatorBitmap != null) {
103 | bitSrcRect = new Rect(0, 0, indicatorBitmap.getWidth(), indicatorBitmap.getHeight());
104 | bitDistRect = new RectF(0, 0, bitSrcRect.width(), bitSrcRect.height());
105 | }//end if
106 | }
107 |
108 | //内圆设置
109 | protected void setInnerCircle(boolean isShow, int pad) {
110 | this.mInnerCircleIsShow = isShow;
111 | mInnerCirclePad = mInnerCircleIsShow ? pad : 0;
112 | }
113 |
114 | //外圆设置
115 | protected void setOuterCircle(boolean isShow, int pad) {
116 | this.mOuterCircleIsShow = isShow;
117 | mOuterCirclePad = mOuterCircleIsShow ? pad : 0;
118 | }
119 |
120 | //设置圆圈颜色
121 | public void setRadiusColor(int color) {
122 | this.mRadiusColor = color;
123 | paint.setColor(mRadiusColor);
124 | setBottomCircleShow(isBottomCircleShow);
125 | }
126 |
127 | //设置圆环模式
128 | protected void setCircleMode(int mode) {
129 | mCircleMode = mode;
130 | switch (mCircleMode) {
131 | case CIRCLE_MODE_ROUND:
132 | paint.setStrokeJoin(Paint.Join.ROUND);
133 | paint.setStrokeCap(Paint.Cap.ROUND); //设置圆角
134 | bottomPaint.setStrokeJoin(Paint.Join.ROUND);
135 | bottomPaint.setStrokeCap(Paint.Cap.ROUND); //设置圆角
136 | break;
137 | case CIRCLE_MODE_DOT:
138 | PathEffect effects = new DashPathEffect(new float[]{5, 5, 5, 5}, 10);
139 | paint.setPathEffect(effects);
140 | bottomPaint.setPathEffect(effects);
141 | break;
142 | default:
143 | }//end switch
144 | }
145 |
146 | //设置底部圆是否显示
147 | protected void setBottomCircleShow(boolean isShow) {
148 | isBottomCircleShow = isShow;
149 | if (isBottomCircleShow) {//修改绘制Paint参数
150 | bottomPaint.setColor(paint.getColor());
151 | bottomPaint.setAlpha(0x33);
152 | }//end if
153 | }
154 |
155 | @Override
156 | protected void onDraw(Canvas canvas) {
157 | super.onDraw(canvas);
158 |
159 | int w = getWidth();
160 | int h = getHeight();
161 |
162 | //圆心点坐标
163 | int centerX = w >> 1;
164 | int centerY = h >> 1;
165 |
166 | canvas.save();
167 | canvas.rotate(90 + startRotateAngle, centerX, centerY);//坐标系旋转
168 |
169 | int outerCircleRadius = (Math.min(w, h) >> 1) - PAD;//外圆半径
170 | if (mOuterCircleIsShow) {//外装饰圆显示
171 | //canvas.drawCircle(centerX, centerY, outerCircleRadius, extraCirclePaint);
172 | tempRect.set(centerX - outerCircleRadius, centerY - outerCircleRadius,
173 | centerX + outerCircleRadius, centerY + outerCircleRadius);
174 | canvas.drawArc(tempRect, 0, angleRotateSpan, false, extraCirclePaint);
175 | }
176 |
177 | //draw Main
178 | int radius = outerCircleRadius - mOuterCirclePad - (stokenWidth >> 1);
179 | int left = (w >> 1) - radius;
180 | int top = (h >> 1) - radius;
181 | ovalRect.set(left, top,
182 | left + radius + radius, top + radius + radius);
183 | //绘制底部圆
184 | if (isBottomCircleShow) {//底部圆显示
185 | canvas.drawArc(ovalRect, 0, angleRotateSpan, false, bottomPaint);
186 | }
187 | //主圆绘制
188 | canvas.drawArc(ovalRect, 0, angle, false, paint);
189 |
190 | //内圆绘制
191 | if (mInnerCircleIsShow) {//内圆显示
192 | int innerRadius = radius - (stokenWidth >> 1) - mInnerCirclePad - EXTRA_CIRCLE_WIDTH;
193 | //canvas.drawCircle(centerX, centerY, innerRadius, extraCirclePaint);
194 | tempRect.set(centerX - innerRadius, centerY - innerRadius,
195 | centerX + innerRadius, centerY + innerRadius);
196 | canvas.drawArc(tempRect, 0, angleRotateSpan, false, extraCirclePaint);
197 | }
198 |
199 | //绘制指示器
200 | if (indicatorBitmap != null) {
201 | int bitWidth = indicatorBitmap.getWidth();
202 | int bitHeight = indicatorBitmap.getHeight();
203 |
204 | //角度制转弧度制
205 | double radAngle = Math.toRadians(angle);
206 | //圆的参数方程确定坐标点 极坐标
207 | int x = (int) (radius * Math.cos(radAngle)) + centerX - (int) (bitDistRect.width() / 2);
208 | int y = (int) (radius * Math.sin(radAngle)) + centerY - (int) (bitDistRect.height() / 2);
209 | bitDistRect.set(x, y, x + bitDistRect.width(), y + bitDistRect.height());
210 | canvas.drawBitmap(indicatorBitmap, bitSrcRect, bitDistRect, null);
211 | }//end if
212 |
213 | canvas.restore();
214 | }
215 |
216 |
217 | public void setStrokenWidth(int size) {
218 | if (size <= 0)
219 | throw new IllegalStateException("size can not be zero or -1");
220 | stokenWidth = size;
221 | paint.setStrokeWidth(stokenWidth);//圆圈宽度设置
222 | bottomPaint.setStrokeWidth(stokenWidth);//底部圆圈宽度 应与主圆保持一致
223 | }
224 |
225 | public int getStartRotateAngle() {
226 | return startRotateAngle;
227 | }
228 |
229 | public void setStartRotateAngle(int startRotateAngle) {
230 | this.startRotateAngle = startRotateAngle;
231 | }
232 |
233 | public int getAngleRotateSpan() {
234 | return angleRotateSpan;
235 | }
236 |
237 | public void setAngleRotateSpan(int angleRotateSpan) {
238 | this.angleRotateSpan = angleRotateSpan;
239 | }
240 |
241 | /**
242 | * 设置数值
243 | *
244 | * @param value
245 | */
246 | public void setValue(int value) {
247 | angle = Math.min(value, angleRotateSpan);
248 | invalidate();//重新设置数值
249 | }
250 | }//end class
251 |
--------------------------------------------------------------------------------
/library/src/main/java/com/xinlan/discview/DiscView.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.discview;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.content.res.TypedArray;
6 | import android.graphics.Bitmap;
7 | import android.graphics.drawable.Drawable;
8 | import android.os.Build;
9 | import android.util.AttributeSet;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewAnimationUtils;
13 | import android.view.animation.AccelerateDecelerateInterpolator;
14 | import android.view.animation.Animation;
15 | import android.view.animation.AnimationUtils;
16 | import android.widget.FrameLayout;
17 | import android.widget.TextView;
18 |
19 | import com.nineoldandroids.animation.Animator;
20 | import com.nineoldandroids.animation.AnimatorListenerAdapter;
21 | import com.nineoldandroids.animation.ValueAnimator;
22 | import com.nineoldandroids.view.ViewHelper;
23 |
24 | /**
25 | * Created by panyi on 2015/8/4.
26 | */
27 | public class DiscView extends FrameLayout {
28 | public static final int ANIMATION_DURING = 1100;
29 |
30 | private Context mContext;
31 | private CircleView mCircleView;
32 | private ValueAnimator animator;
33 | private TextView headText;//头部Text
34 | private TextView contentValueText;//属性Text
35 | private TextView bottomText;//底部Text
36 |
37 | private Animation afterAnimation;//设值完毕后动画
38 |
39 | public DiscView(Context context) {
40 | super(context);
41 | initView(context, null);
42 | }
43 |
44 | public DiscView(Context context, AttributeSet attrs) {
45 | super(context, attrs);
46 | initView(context, attrs);
47 | }
48 |
49 | public DiscView(Context context, AttributeSet attrs, int defStyleAttr) {
50 | super(context, attrs, defStyleAttr);
51 | initView(context, attrs);
52 | }
53 |
54 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
55 | public DiscView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
56 | super(context, attrs, defStyleAttr, defStyleRes);
57 | initView(context, attrs);
58 | }
59 |
60 | private void initView(Context context, AttributeSet attrs) {
61 | this.mContext = context;
62 | animator = ValueAnimator.ofInt(0, 0);//属性动画差值器
63 |
64 | final LayoutInflater inflater = LayoutInflater.from(context);
65 | final View v = inflater.inflate(R.layout.view_disc_layout, this, true);
66 | mCircleView = (CircleView) v.findViewById(R.id.circle_view);
67 | headText = (TextView) v.findViewById(R.id.head_title);
68 | contentValueText = (TextView) v.findViewById(R.id.value_content);
69 | bottomText = (TextView) v.findViewById(R.id.bottom_title);
70 |
71 | readAttributeAndSet(context, attrs);
72 |
73 | afterAnimation = AnimationUtils.loadAnimation(mContext, R.anim.scale_animation);
74 | }
75 |
76 | //配置属性读取并配置
77 | private void readAttributeAndSet(Context context, AttributeSet attrs) {
78 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscView);
79 | mCircleView.stokenWidth = a.getDimensionPixelSize(R.styleable.DiscView_dvStrokenWidth,
80 | mCircleView.stokenWidth);//宽度属性读取
81 | mCircleView.mCircleMode = a.getInt(R.styleable.DiscView_dvCircleMode, mCircleView.mCircleMode);//读取圆环模式
82 |
83 | //读取外装饰圆圈是否显示
84 | mCircleView.mOuterCircleIsShow = a.getBoolean(R.styleable.DiscView_dvOuterCircleShow, mCircleView.mOuterCircleIsShow);
85 | mCircleView.mOuterCirclePad = a.getDimensionPixelSize(R.styleable.DiscView_dvOuterCirclePad, mCircleView.mOuterCirclePad);//外圆边距
86 |
87 | //读取圆圈颜色设置
88 | mCircleView.mRadiusColor = a.getColor(R.styleable.DiscView_dvStrokenColor, mCircleView.mRadiusColor);
89 |
90 | //读取外装饰圆圈是否显示
91 | mCircleView.mInnerCircleIsShow = a.getBoolean(R.styleable.DiscView_dvInnerCircleShow, mCircleView.mInnerCircleIsShow);
92 | mCircleView.mInnerCirclePad = a.getDimensionPixelSize(R.styleable.DiscView_dvInnerCirclePad, mCircleView.mInnerCirclePad);//外圆边距
93 | mCircleView.isBottomCircleShow = a.getBoolean(R.styleable.DiscView_dvBottomCircleIsShow, false);
94 | Drawable bitDrawable = a.getDrawable(R.styleable.DiscView_dvIndicatorDraw);
95 | Bitmap indicatorBit = null;
96 | if (bitDrawable != null) {
97 | indicatorBit = DiscViewUtils.drawableToBitmap(bitDrawable);
98 | }
99 |
100 | //读取开始角度偏移量
101 | mCircleView.startRotateAngle = a.getInteger(R.styleable.DiscView_dvStartRotateAngle, CircleView.MIN_VALUE);
102 | //读取圆盘可旋转范围
103 | mCircleView.angleRotateSpan = a.getInteger(R.styleable.DiscView_dvAngleRotateSpan, CircleView.MAX_VALUE);
104 | a.recycle();
105 |
106 | mCircleView.setStrokenWidth(mCircleView.stokenWidth);
107 | mCircleView.setCircleMode(mCircleView.mCircleMode);
108 | mCircleView.setOuterCircle(mCircleView.mOuterCircleIsShow, mCircleView.mOuterCirclePad);
109 | mCircleView.setRadiusColor(mCircleView.mRadiusColor);
110 | mCircleView.setInnerCircle(mCircleView.mInnerCircleIsShow, mCircleView.mInnerCirclePad);
111 | mCircleView.setBottomCircleShow(mCircleView.isBottomCircleShow);
112 | mCircleView.setIndicatorBit(indicatorBit);
113 |
114 | mCircleView.setStartRotateAngle(mCircleView.startRotateAngle);
115 | mCircleView.setAngleRotateSpan(mCircleView.angleRotateSpan);
116 | }
117 |
118 |
119 | public void setValue(int value) {
120 | setValue(value, ANIMATION_DURING);
121 | }
122 |
123 | /**
124 | * 设置指示器的值 min - max之间
125 | *
126 | * @param value
127 | */
128 | public void setValue(int value, int duration) {
129 | if (animator.isRunning()) {//上次动画未结束
130 | animator.cancel();//取消上次动画
131 | mCircleView.clearAnimation();
132 | }
133 |
134 | animator = ValueAnimator.ofInt(0, value);
135 | animator.setInterpolator(new AccelerateDecelerateInterpolator());//先加速 后减速差值
136 | animator.setDuration(duration);
137 | animator.start();
138 | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
139 | @Override
140 | public void onAnimationUpdate(ValueAnimator animation) {
141 | int value = (int) animation.getAnimatedValue();
142 | mCircleView.setValue(value);
143 | contentValueText.setText("" + value);
144 | }
145 | });
146 |
147 | animator.addListener(new AnimatorListenerAdapter() {
148 | @Override
149 | public void onAnimationEnd(Animator animation) {
150 | mCircleView.startAnimation(afterAnimation);
151 | }
152 |
153 | public void onAnimationCancel(Animator animation) {
154 | }
155 | });
156 | }
157 | }//end class
158 |
--------------------------------------------------------------------------------
/library/src/main/java/com/xinlan/discview/DiscViewUtils.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.discview;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Canvas;
5 | import android.graphics.PixelFormat;
6 | import android.graphics.drawable.BitmapDrawable;
7 | import android.graphics.drawable.Drawable;
8 | import android.graphics.drawable.NinePatchDrawable;
9 |
10 | /**
11 | * Created by panyi on 2015/8/5.
12 | */
13 | public class DiscViewUtils {
14 |
15 | //drawable转Bitamp
16 | public static Bitmap drawableToBitmap(Drawable drawable) {
17 | if (drawable instanceof BitmapDrawable) {
18 | return ((BitmapDrawable) drawable).getBitmap();
19 | } else if (drawable instanceof NinePatchDrawable) {
20 | Bitmap bitmap = Bitmap
21 | .createBitmap(
22 | drawable.getIntrinsicWidth(),
23 | drawable.getIntrinsicHeight(),
24 | drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
25 | : Bitmap.Config.RGB_565);
26 | Canvas canvas = new Canvas(bitmap);
27 | drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
28 | drawable.getIntrinsicHeight());
29 | drawable.draw(canvas);
30 | return bitmap;
31 | } else {
32 | return null;
33 | }
34 | }
35 | }//end class
36 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/scale_animation.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/view_disc_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
16 |
17 |
24 |
25 |
35 |
36 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/library/src/main/res/values/attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DiscView
3 |
4 |
--------------------------------------------------------------------------------
/local.properties:
--------------------------------------------------------------------------------
1 | ## This file is automatically generated by Android Studio.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must *NOT* be checked into Version Control Systems,
5 | # as it contains information specific to your local configuration.
6 | #
7 | # Location of the SDK. This is only used by Gradle.
8 | # For customization when using a Version Control System, please read the
9 | # header note.
10 | #Wed Apr 13 12:02:42 CST 2016
11 | sdk.dir=F\:\\JavaIDE\\android_sdk
12 |
--------------------------------------------------------------------------------
/screens/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/screens/1.png
--------------------------------------------------------------------------------
/screens/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/screens/2.png
--------------------------------------------------------------------------------
/screens/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/screens/3.png
--------------------------------------------------------------------------------
/screens/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/screens/4.png
--------------------------------------------------------------------------------
/screens/show.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyunwan/DiscView-master/dfd07341eeaab1e83e72875421d3f007e2b19ed7/screens/show.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':library'
2 |
--------------------------------------------------------------------------------