├── .gitattributes
├── .gitignore
├── AndroidManifest.xml
├── README.md
├── device-2012-11-27-193805.png
├── gen
└── com
│ └── halzhang
│ └── android
│ └── verticalprogressbar
│ ├── BuildConfig.java
│ └── R.java
├── ic_launcher-web.png
├── libs
└── android-support-v4.jar
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ ├── ic_action_search.png
│ └── ic_launcher.png
├── drawable-ldpi
│ └── ic_launcher.png
├── drawable-mdpi
│ ├── ic_action_search.png
│ └── ic_launcher.png
├── drawable-xhdpi
│ ├── ic_action_search.png
│ └── ic_launcher.png
├── layout
│ └── activity_main.xml
├── menu
│ └── activity_main.xml
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
└── values
│ ├── strings.xml
│ └── styles.xml
└── src
└── com
└── halzhang
└── android
└── verticalprogressbar
├── MainActivity.java
├── VerticalProgressBar.java
└── VerticalSeekBar.java
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 |
19 | # External tool builders
20 | .externalToolBuilders/
21 |
22 | # Locally stored "Eclipse launch configurations"
23 | *.launch
24 |
25 | # CDT-specific
26 | .cproject
27 |
28 | # PDT-specific
29 | .buildpath
30 |
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | ## Ignore Visual Studio temporary files, build results, and
37 | ## files generated by popular Visual Studio add-ons.
38 |
39 | # User-specific files
40 | *.suo
41 | *.user
42 | *.sln.docstates
43 |
44 | # Build results
45 | [Dd]ebug/
46 | [Rr]elease/
47 | *_i.c
48 | *_p.c
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.vspscc
63 | .builds
64 | *.dotCover
65 |
66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this
67 | #packages/
68 |
69 | # Visual C++ cache files
70 | ipch/
71 | *.aps
72 | *.ncb
73 | *.opensdf
74 | *.sdf
75 |
76 | # Visual Studio profiler
77 | *.psess
78 | *.vsp
79 |
80 | # ReSharper is a .NET coding add-in
81 | _ReSharper*
82 |
83 | # Installshield output folder
84 | [Ee]xpress
85 |
86 | # DocProject is a documentation generator add-in
87 | DocProject/buildhelp/
88 | DocProject/Help/*.HxT
89 | DocProject/Help/*.HxC
90 | DocProject/Help/*.hhc
91 | DocProject/Help/*.hhk
92 | DocProject/Help/*.hhp
93 | DocProject/Help/Html2
94 | DocProject/Help/html
95 |
96 | # Click-Once directory
97 | publish
98 |
99 | # Others
100 | [Bb]in
101 | [Oo]bj
102 | sql
103 | TestResults
104 | *.Cache
105 | ClientBin
106 | stylecop.*
107 | ~$*
108 | *.dbmdl
109 | Generated_Code #added for RIA/Silverlight projects
110 |
111 | # Backup & report files from converting an old project file to a newer
112 | # Visual Studio version. Backup files are not needed, because we have git ;-)
113 | _UpgradeReport_Files/
114 | Backup*/
115 | UpgradeLog*.XML
116 |
117 |
118 |
119 | ############
120 | ## Windows
121 | ############
122 |
123 | # Windows image file caches
124 | Thumbs.db
125 |
126 | # Folder config file
127 | Desktop.ini
128 |
129 |
130 | #############
131 | ## Python
132 | #############
133 |
134 | *.py[co]
135 |
136 | # Packages
137 | *.egg
138 | *.egg-info
139 | dist
140 | build
141 | eggs
142 | parts
143 | bin
144 | var
145 | sdist
146 | develop-eggs
147 | .installed.cfg
148 |
149 | # Installer logs
150 | pip-log.txt
151 |
152 | # Unit test / coverage reports
153 | .coverage
154 | .tox
155 |
156 | #Translations
157 | *.mo
158 |
159 | #Mr Developer
160 | .mr.developer.cfg
161 |
162 | # Mac crap
163 | .DS_Store
164 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Android-VerticalProgressBar
2 | ===
3 | 垂直的ProgressBar和Seekbar
4 |
5 | Author
6 | ===
7 | [Halzhang][1]
8 | Email:[ghanguo@gmail.com](mailto:ghanguo@gmail.com)
9 |
10 | Overview
11 | ===
12 | 垂直方向的ProgressBar和SeekBar
13 | 
14 |
15 | Usage
16 | ===
17 | #### Layout
18 |
19 |
24 |
25 |
33 |
34 |
43 |
44 |
45 | License
46 | ===
47 | [WTFPL][2], although attribution would be nice.
48 |
49 | [1]: http://weibo.com/halzhang
50 | [2]: http://sam.zoy.org/wtfpl/
51 |
--------------------------------------------------------------------------------
/device-2012-11-27-193805.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/device-2012-11-27-193805.png
--------------------------------------------------------------------------------
/gen/com/halzhang/android/verticalprogressbar/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.halzhang.android.verticalprogressbar;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/gen/com/halzhang/android/verticalprogressbar/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.halzhang.android.verticalprogressbar;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int ic_action_search=0x7f020000;
15 | public static final int ic_launcher=0x7f020001;
16 | }
17 | public static final class id {
18 | public static final int menu_settings=0x7f070002;
19 | public static final int verticalProgressBar=0x7f070001;
20 | public static final int verticalSeekBar=0x7f070000;
21 | }
22 | public static final class layout {
23 | public static final int activity_main=0x7f030000;
24 | }
25 | public static final class menu {
26 | public static final int activity_main=0x7f060000;
27 | }
28 | public static final class string {
29 | public static final int app_name=0x7f040000;
30 | public static final int hello_world=0x7f040001;
31 | public static final int menu_settings=0x7f040002;
32 | public static final int title_activity_main=0x7f040003;
33 | }
34 | public static final class style {
35 | public static final int AppTheme=0x7f050000;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/ic_launcher-web.png
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-15
15 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_action_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/res/drawable-hdpi/ic_action_search.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_action_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/res/drawable-mdpi/ic_action_search.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_action_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/res/drawable-xhdpi/ic_action_search.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/halzhang/Android-VerticalProgressBar/3e8e0d8c9d18443739512b1e55acd4b531b2506e/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
15 |
16 |
25 |
26 |
--------------------------------------------------------------------------------
/res/menu/activity_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Android-VerticalProgressBar
4 | Hello world!
5 | Settings
6 | VerticalProgressBar
7 |
8 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/com/halzhang/android/verticalprogressbar/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.halzhang.android.verticalprogressbar;
2 |
3 | import android.os.Bundle;
4 | import android.app.Activity;
5 | import android.view.Menu;
6 |
7 | public class MainActivity extends Activity {
8 |
9 | @Override
10 | public void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_main);
13 | }
14 |
15 | @Override
16 | public boolean onCreateOptionsMenu(Menu menu) {
17 | getMenuInflater().inflate(R.menu.activity_main, menu);
18 | return true;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/com/halzhang/android/verticalprogressbar/VerticalProgressBar.java:
--------------------------------------------------------------------------------
1 | package com.halzhang.android.verticalprogressbar;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.util.AttributeSet;
6 | import android.widget.ProgressBar;
7 |
8 | /**
9 | * 垂直{@link ProgressBar}
10 | * Android-VerticalProgressBar
11 | *
12 | * @author Hal
13 | * @version Nov 27, 2012 7:30:27 PM
14 | */
15 | public class VerticalProgressBar extends ProgressBar {
16 |
17 | public VerticalProgressBar(Context context, AttributeSet attrs, int defStyle) {
18 | super(context, attrs, defStyle);
19 | }
20 |
21 | public VerticalProgressBar(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public VerticalProgressBar(Context context) {
26 | super(context);
27 | }
28 |
29 | @Override
30 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
31 | super.onSizeChanged(h, w, oldh, oldw);
32 | }
33 |
34 | @Override
35 | protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
36 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
37 | // setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth());
38 | }
39 |
40 | @Override
41 | protected synchronized void onDraw(Canvas canvas) {
42 | canvas.rotate(-90);
43 | canvas.translate(-getHeight(), 0);
44 | super.onDraw(canvas);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/com/halzhang/android/verticalprogressbar/VerticalSeekBar.java:
--------------------------------------------------------------------------------
1 |
2 | package com.halzhang.android.verticalprogressbar;
3 |
4 | import android.content.Context;
5 | import android.graphics.Canvas;
6 | import android.util.AttributeSet;
7 | import android.view.MotionEvent;
8 | import android.widget.SeekBar;
9 |
10 | /**
11 | * 垂直{@link SeekBar}
12 | * Android-VerticalProgressBar
13 | *
14 | * @author Hal
15 | * @version Nov 27, 2012 6:59:27 PM
16 | * @Thank HACKSKRIEG
17 | */
18 | public class VerticalSeekBar extends SeekBar {
19 |
20 | private int mLastProgress = 0;
21 |
22 | private OnSeekBarChangeListener mOnChangeListener;
23 |
24 | public VerticalSeekBar(Context context) {
25 | super(context);
26 | }
27 |
28 | public VerticalSeekBar(Context context, AttributeSet attrs) {
29 | super(context, attrs);
30 | }
31 |
32 | public VerticalSeekBar(Context context, AttributeSet attrs, int defStyle) {
33 | super(context, attrs, defStyle);
34 | }
35 |
36 | public synchronized int getMaximum() {
37 | return getMax();
38 | }
39 |
40 | @Override
41 | protected void onDraw(Canvas c) {
42 | c.rotate(-90);
43 | c.translate(-getHeight(), 0);
44 | super.onDraw(c);
45 | }
46 |
47 | @Override
48 | protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
49 | super.onMeasure(heightMeasureSpec, widthMeasureSpec);
50 | setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth());
51 | }
52 |
53 | @Override
54 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
55 | super.onSizeChanged(h, w, oldh, oldw);
56 | }
57 |
58 | @Override
59 | public boolean onTouchEvent(MotionEvent event) {
60 | if (!isEnabled()) {
61 | return false;
62 | }
63 |
64 | switch (event.getAction()) {
65 | case MotionEvent.ACTION_DOWN:
66 | if(mOnChangeListener !=null){
67 | mOnChangeListener.onStartTrackingTouch(this);
68 | }
69 | setPressed(true);
70 | setSelected(true);
71 | break;
72 | case MotionEvent.ACTION_MOVE:
73 | super.onTouchEvent(event);
74 | int progress = getMax() - (int) (getMax() * event.getY() / getHeight());
75 |
76 | // Ensure progress stays within boundaries
77 | if (progress < 0) {
78 | progress = 0;
79 | }
80 | if (progress > getMax()) {
81 | progress = getMax();
82 | }
83 | setProgress(progress); // Draw progress
84 | if (progress != mLastProgress) {
85 | // Only enact listener if the progress has actually changed
86 | mLastProgress = progress;
87 | if(mOnChangeListener != null){
88 | mOnChangeListener.onProgressChanged(this, progress, true);
89 | }
90 | }
91 |
92 | onSizeChanged(getWidth(), getHeight(), 0, 0);
93 | setPressed(true);
94 | setSelected(true);
95 | break;
96 | case MotionEvent.ACTION_UP:
97 | if(mOnChangeListener != null){
98 | mOnChangeListener.onStopTrackingTouch(this);
99 | }
100 | setPressed(false);
101 | setSelected(false);
102 | break;
103 | case MotionEvent.ACTION_CANCEL:
104 | super.onTouchEvent(event);
105 | setPressed(false);
106 | setSelected(false);
107 | break;
108 | }
109 | return true;
110 | }
111 |
112 | public synchronized void setMaximum(int maximum) {
113 | setMax(maximum);
114 | }
115 |
116 | @Override
117 | public void setOnSeekBarChangeListener(OnSeekBarChangeListener onChangeListener) {
118 | this.mOnChangeListener = onChangeListener;
119 | }
120 |
121 | public synchronized void setProgressAndThumb(int progress) {
122 | setProgress(progress);
123 | onSizeChanged(getWidth(), getHeight(), 0, 0);
124 | if (progress != mLastProgress) {
125 | mLastProgress = progress;
126 | if(mOnChangeListener != null){
127 | mOnChangeListener.onProgressChanged(this, progress, true);
128 | }
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------