├── .gitignore
├── AndroidManifest.xml
├── LICENSE
├── Makefile
├── README.md
├── ant.properties
├── checkstyle
└── android_checks.xml
├── custom_rules.xml
├── git-pre-commit
├── libs
├── android-support-v4.jar
├── armeabi
│ └── libbspatch.so
└── umeng_sdk.jar
├── project.properties
├── release.keystore
├── res
├── drawable-hdpi
│ ├── ic_launcher.png
│ ├── umeng_update_btn_check_off_focused_holo_light.png
│ ├── umeng_update_btn_check_off_holo_light.png
│ ├── umeng_update_btn_check_off_pressed_holo_light.png
│ ├── umeng_update_btn_check_on_focused_holo_light.png
│ ├── umeng_update_btn_check_on_holo_light.png
│ ├── umeng_update_btn_check_on_pressed_holo_light.png
│ ├── umeng_update_close_bg_normal.png
│ └── umeng_update_close_bg_tap.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── drawable
│ ├── umeng_common_gradient_green.xml
│ ├── umeng_common_gradient_orange.xml
│ ├── umeng_common_gradient_red.xml
│ ├── umeng_update_button_cancel_bg_focused.xml
│ ├── umeng_update_button_cancel_bg_normal.xml
│ ├── umeng_update_button_cancel_bg_selector.xml
│ ├── umeng_update_button_cancel_bg_tap.xml
│ ├── umeng_update_button_check_selector.xml
│ ├── umeng_update_button_close_bg_selector.xml
│ ├── umeng_update_button_ok_bg_focused.xml
│ ├── umeng_update_button_ok_bg_normal.xml
│ ├── umeng_update_button_ok_bg_selector.xml
│ ├── umeng_update_button_ok_bg_tap.xml
│ ├── umeng_update_dialog_bg.xml
│ ├── umeng_update_title_bg.xml
│ └── umeng_update_wifi_disable.png
├── layout-v9
│ └── umeng_common_download_notification.xml
├── layout
│ ├── activity_main.xml
│ ├── umeng_common_download_notification.xml
│ └── umeng_update_dialog.xml
├── menu
│ └── main.xml
├── values-sw600dp
│ └── dimens.xml
├── values-sw720dp-land
│ └── dimens.xml
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
├── values-zh-rCN
│ ├── strings.xml
│ ├── umeng_common_strings.xml
│ └── umeng_update_string.xml
└── values
│ ├── dimens.xml
│ ├── strings.xml
│ ├── styles.xml
│ ├── umeng_common_strings.xml
│ └── umeng_update_string.xml
└── src
└── io
└── github
└── sinkcup
└── ant
└── MainActivity.java
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | build.xml
13 | proguard-project.txt
14 | bin/
15 | gen/
16 |
17 | # Local configuration file (sdk path, etc)
18 | local.properties
19 |
20 | # Eclipse project files
21 | .classpath
22 | .project
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Intellij project files
28 | *.iml
29 | *.ipr
30 | *.iws
31 | .idea/
32 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
36 |
37 |
38 |
41 |
44 |
45 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014, sinkcup
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification,
5 | are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice, this
11 | list of conditions and the following disclaimer in the documentation and/or
12 | other materials provided with the distribution.
13 |
14 | * Neither the name of the {organization} nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | SHELL := /bin/bash
2 | target = $(shell egrep -m 1 "^target=" project.properties | sed -n -e 's/^target=\(.*\)/\1/p')
3 | this_dir = $(shell cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
4 | libs = $(shell grep 'android.library.reference' project.properties | sed -e "s/android.library.reference.*=//g")
5 | timestamp = $(shell date +%s)
6 |
7 | #安装本地开发环境
8 | install:
9 | @for lib in $(libs); do \
10 | echo $$lib; \
11 | cp Makefile $$lib; cd $$lib; make; \
12 | cd $(this_dir); \
13 | done
14 | @mv build.xml build.xml-bak-$(timestamp) 2>/dev/null; android update project -p . -s -t "$(target)"; ant clean;
15 | @if [ -d ".git" ]; then \
16 | if [ -a "git-pre-commit" ]; then \
17 | cp git-pre-commit .git/hooks/pre-commit; \
18 | fi; \
19 | fi
20 | review:
21 | @checkstyle -c checkstyle/android_checks.xml -r src
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | AntDemo
2 | =======
3 |
4 | ant auto build Android Package
5 |
6 | Android ant 自动打包脚本:自动替换友盟渠道、版本号、包名,而不影响代码(修改的是临时目录中的代码)。
7 |
8 |
9 | 如何集成到我的项目里
10 | --------------------
11 |
12 | 前提:了解android官方文档,在项目目录中执行官方命令能打包,比如常见的打包步骤:
13 |
14 | android update project -p . -s -t "android-21"
15 | ant debug
16 |
17 | 如果是用Linux系统,则不用记上面这么长的命令,下载本项目中的`Makefile`,放到项目目录中,然后执行:
18 |
19 | make
20 | ant debug
21 |
22 | 如果ant debug打包能通过,则可以使用下面的自动打包。
23 |
24 | 下载`custom_rules.xml`,放到项目目录中,然后执行:
25 |
26 | ant auto-debug -Dversion=time
27 |
28 | 即可自动打包,生成的包在`./bin/`中。
29 |
30 | 如果想打release包,下载`ant.properties`,修改其中的密码等配置,然后执行:
31 |
32 | ant auto-release -DUMENG_CHANNEL=googlePlayStore -Dpackage=com.example.ant.beta
33 |
34 | 即可。
35 |
36 |
37 | 打包时自动更换友盟渠道
38 | ----------------------
39 |
40 | 确认`AndroidManifest.xml`中已添加了友盟节点:
41 |
42 |
45 |
46 | 然后执行:
47 |
48 | ant auto-release -DUMENG_CHANNEL=googlePlayStore
49 |
50 | 即会把AndroidManifest.xml中的友盟渠道替换成googlePlayStore,然后打包。而执行:
51 |
52 | ant auto-release -DUMENG_CHANNEL=smartisanAppStore
53 |
54 | 即会打出锤子应用商店的包。
55 |
56 |
57 | 打包时自动更换包名
58 | ------------------
59 |
60 | ant auto-release -Dpackage=com.example.ant.beta
61 |
62 | 即会把包名自动改成com.example.ant.beta。
63 |
64 |
65 | 打包时使用时间作为版本号
66 | ------------------
67 |
68 | ant auto-debug -Dversion=time
69 |
70 | 把版本号改成时间,然后打包,效果:
71 |
72 | versionCode是时间戳,比如1390969254
73 |
74 | versionName是日期,比如14.1.29.1220
75 |
76 |
77 | 多个参数任意组合
78 | ------------
79 |
80 | ant auto-release -DUMENG_CHANNEL=googlePlayStore -Dpackage=com.example.ant.beta -Dversion=time
81 |
82 | 即打出google play的beta包,使用时间作为版本号
83 |
84 |
85 | debug与release签名
86 | ------------------
87 |
88 | ant auto-debug
89 |
90 | 即使用debug签名打包(路径`~/.android/debug.keystore`),请参考http://developer.android.com/tools/publishing/app-signing.html#debugmode
91 |
92 | ant auto-release
93 |
94 | 即使用release签名打包,请下载本项目中的`ant.properties`,修改其中的路径、密码等等,参考http://developer.android.com/tools/building/building-cmdline.html#ReleaseMode
95 |
--------------------------------------------------------------------------------
/ant.properties:
--------------------------------------------------------------------------------
1 | # This file is created by you.
2 | # Customizable properties for the build system. You can edit this file to override default build settings used by Ant and also provide the location of your keystore and key alias so that the build tools can sign your application when building in release mode. This file is integral to the project, so maintain it in a source revision control system. If you use Eclipse, this file is not used.
3 | #
4 | # http://developer.android.com/tools/projects/index.html
5 | #
6 | # SDK Tools, Revision 14 (October 2011) Changed default.properties to project.properties and build.properties to ant.properties.
7 | #
8 | # This file must be checked in Version Control Systems.
9 | #
10 | key.store=release.keystore
11 | key.alias=demo
12 | key.store.password=123456
13 | key.alias.password=111111
14 |
--------------------------------------------------------------------------------
/checkstyle/android_checks.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
32 |
33 |
34 |
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 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
--------------------------------------------------------------------------------
/custom_rules.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 |
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 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
104 |
105 |
106 |
110 |
111 |
116 |
117 |
119 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
132 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
--------------------------------------------------------------------------------
/git-pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # An example hook script to verify what is about to be committed.
4 | # Called by "git commit" with no arguments. The hook should
5 | # exit with non-zero status after issuing an appropriate message if
6 | # it wants to stop the commit.
7 | #
8 | # To enable this hook, rename this file to "pre-commit".
9 |
10 | if git rev-parse --verify HEAD >/dev/null 2>&1
11 | then
12 | against=HEAD
13 | else
14 | # Initial commit: diff against an empty tree object
15 | against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
16 | fi
17 |
18 | # If you want to allow non-ASCII filenames set this variable to true.
19 | allownonascii=$(git config --bool hooks.allownonascii)
20 |
21 | # Redirect output to stderr.
22 | exec 1>&2
23 |
24 | # Cross platform projects tend to avoid non-ASCII filenames; prevent
25 | # them from being added to the repository. We exploit the fact that the
26 | # printable range starts at the space character and ends with tilde.
27 | if [ "$allownonascii" != "true" ] &&
28 | # Note that the use of brackets around a tr range is ok here, (it's
29 | # even required, for portability to Solaris 10's /usr/bin/tr), since
30 | # the square bracket bytes happen to fall in the designated range.
31 | test $(git diff --cached --name-only --diff-filter=A -z $against |
32 | LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
33 | then
34 | cat <<\EOF
35 | Error: Attempt to add a non-ASCII file name.
36 |
37 | This can cause problems if you want to work with people on other platforms.
38 |
39 | To be portable it is advisable to rename the file.
40 |
41 | If you know what you are doing you can disable this check using:
42 |
43 | git config hooks.allownonascii true
44 | EOF
45 | exit 1
46 | fi
47 |
48 | # If there are whitespace errors, print the offending file names and fail.
49 | #exec git diff-index --check --cached $against --
50 |
51 | # linter java : checkstyle
52 | # this is the magic:
53 | # retrieve all files in staging area that are added, modified or renamed
54 | # but no deletions etc
55 | FILES=$(git diff-index --name-only --cached --diff-filter=ACMR $against -- | grep .java)
56 | #todo android_checks
57 | CHECK_CONF_FILE="$(git rev-parse --show-toplevel)/checkstyle/android_checks.xml"
58 | if [ "$FILES" = "" ]; then
59 | exit 0
60 | fi
61 | FILES_TO_CHECK=""
62 | for FILE in $FILES
63 | do
64 | FILES_TO_CHECK="$FILES_TO_CHECK $FILE"
65 | done
66 | if [ "$FILES_TO_CHECK" = "" ]; then
67 | exit 0
68 | fi
69 |
70 | CHECK_RESULT=$(checkstyle -c $CHECK_CONF_FILE $FILES_TO_CHECK)
71 | r=$?
72 | if [ $r -ne 0 ]; then
73 | echo "$CHECK_RESULT"
74 | echo '------------------------------------------------'
75 | echo '------------------git commit失败----------------'
76 | echo '------------------------------------------------'
77 | echo '代码不规范。请遵守Java官方规范和Android官方补充规范:'
78 | echo 'Java官方规范:'
79 | echo '英文:http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html'
80 | echo '汉字翻译:http://www.huihoo.org/code/java_code_conventions.html'
81 | echo 'Android官方补充规范:'
82 | echo '英文:https://source.android.com/source/code-style.html'
83 | echo '汉字翻译:http://blog.sina.com.cn/s/blog_48d491300100zwzg.html'
84 | echo '修改后,请重新git add'
85 | fi
86 |
87 | exit $r
88 |
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/libs/armeabi/libbspatch.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/libs/armeabi/libbspatch.so
--------------------------------------------------------------------------------
/libs/umeng_sdk.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/libs/umeng_sdk.jar
--------------------------------------------------------------------------------
/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-21
15 |
--------------------------------------------------------------------------------
/release.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/release.keystore
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/umeng_update_btn_check_off_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-hdpi/umeng_update_btn_check_off_focused_holo_light.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/umeng_update_btn_check_off_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-hdpi/umeng_update_btn_check_off_holo_light.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/umeng_update_btn_check_off_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-hdpi/umeng_update_btn_check_off_pressed_holo_light.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/umeng_update_btn_check_on_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-hdpi/umeng_update_btn_check_on_focused_holo_light.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/umeng_update_btn_check_on_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-hdpi/umeng_update_btn_check_on_holo_light.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/umeng_update_btn_check_on_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-hdpi/umeng_update_btn_check_on_pressed_holo_light.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/umeng_update_close_bg_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-hdpi/umeng_update_close_bg_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/umeng_update_close_bg_tap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-hdpi/umeng_update_close_bg_tap.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable/umeng_common_gradient_green.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/umeng_common_gradient_orange.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/umeng_common_gradient_red.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_cancel_bg_focused.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_cancel_bg_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_cancel_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_cancel_bg_tap.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_check_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
9 |
10 |
13 |
16 |
17 |
20 |
23 |
24 |
27 |
30 |
31 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_close_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_ok_bg_focused.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_ok_bg_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_ok_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_button_ok_bg_tap.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_dialog_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_title_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/umeng_update_wifi_disable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaunthegeek/AntDemo/e586840f6c7c3a6709399d2c359e25f7f6c2f19b/res/drawable/umeng_update_wifi_disable.png
--------------------------------------------------------------------------------
/res/layout-v9/umeng_common_download_notification.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
19 |
20 |
27 |
28 |
29 |
35 |
36 |
46 |
47 |
55 |
56 |
66 |
67 |
68 |
78 |
79 |
85 |
86 |
92 |
93 |
94 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
20 |
21 |
26 |
27 |
32 |
33 |
34 |
37 |
38 |
43 |
44 |
49 |
50 |
51 |
54 |
55 |
60 |
61 |
66 |
67 |
68 |
71 |
72 |
77 |
78 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/res/layout/umeng_common_download_notification.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
19 |
20 |
27 |
28 |
29 |
35 |
36 |
46 |
47 |
55 |
56 |
66 |
67 |
68 |
78 |
79 |
87 |
88 |
95 |
96 |
97 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/res/layout/umeng_update_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
15 |
16 |
19 |
20 |
28 |
29 |
36 |
37 |
47 |
48 |
49 |
50 |
51 |
57 |
58 |
59 |
64 |
65 |
69 |
70 |
79 |
80 |
81 |
82 |
83 |
84 |
91 |
92 |
93 |
94 |
97 |
98 |
110 |
111 |
123 |
124 |
137 |
138 |
139 |
140 |
--------------------------------------------------------------------------------
/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Ant Demo
5 | 设置
6 | 包名
7 | 友盟渠道
8 | 版本数字
9 | 版本名
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values-zh-rCN/umeng_common_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 正在下载中.
5 | 下载出错啦,请检查网络后继续。
6 | 暂停
7 | 继续
8 | 取消
9 | 正在下载:
10 | 正在下载应用
11 | 正在更新安装包
12 | 请连接网络后再尝试!
13 | 下载失败
14 | 下载完成,请点击安装
15 | 更新完成,请点击安装
16 |
17 |
18 |
--------------------------------------------------------------------------------
/res/values-zh-rCN/umeng_update_string.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 未联网
5 | 发现新版本
6 | 最新版本:
7 | 更新内容
8 | 仅需要下载:
9 | 新版本大小:
10 | (提示:非WIFI环境)
11 | 立即更新
12 | 应用更新
13 | 以后再说
14 | 忽略该版
15 | 正在更新中....
16 | 最新版本已下载,是否安装?
17 |
18 |
19 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Ant Demo
5 | Settings
6 | Package
7 | umeng channel
8 | Version code
9 | Version name
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/res/values/umeng_common_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The app is already in downloading list.
5 | dowload interrupted.
6 | Pause
7 | Continue
8 | Cancel
9 | Downloading:
10 | Download start.
11 | Patch start.
12 | Please make sure you are connected to internet, download failed
13 | Download Failed!
14 | Download finished,click to install it.
15 | Patch finished,click to install it.
16 | icon
17 |
18 |
19 |
--------------------------------------------------------------------------------
/res/values/umeng_update_string.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Please make sure you are connected to internet,update failed
5 | New version found
6 | Latest version:
7 | Update Content
8 | Update size:
9 | Target size:
10 | (Warning: Not WIFI Condition)
11 | Update now
12 | App updating
13 | Not now
14 | Ingore this
15 | Updating....
16 | The lastest version has been downloaded, install now ?
17 | 2.4.0.20131230
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/io/github/sinkcup/ant/MainActivity.java:
--------------------------------------------------------------------------------
1 | package io.github.sinkcup.ant;
2 |
3 | import com.umeng.analytics.MobclickAgent;
4 | import com.umeng.update.UmengUpdateAgent;
5 |
6 | import android.os.Bundle;
7 | import android.app.Activity;
8 | import android.content.pm.ApplicationInfo;
9 | import android.content.pm.PackageManager;
10 | import android.content.pm.PackageManager.NameNotFoundException;
11 | import android.view.Menu;
12 | import android.widget.TextView;
13 |
14 | /**
15 | * main
16 | */
17 | public class MainActivity extends Activity {
18 |
19 | @Override
20 | protected final void onCreate(final Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | UmengUpdateAgent.update(this);
23 | setContentView(R.layout.activity_main);
24 |
25 | try {
26 | String packageName = getPackageName();
27 | ((TextView) findViewById(R.id.package_name)).setText(packageName);
28 |
29 | String versionCode = Integer.toString(getPackageManager()
30 | .getPackageInfo(getPackageName(), 0).versionCode);
31 | ((TextView) findViewById(R.id.version_code)).setText(versionCode);
32 |
33 | String versionName = getPackageManager().getPackageInfo(
34 | getPackageName(), 0).versionName;
35 | ((TextView) findViewById(R.id.version_name)).setText(versionName);
36 |
37 | ApplicationInfo ai = getPackageManager().getApplicationInfo(
38 | getPackageName(), PackageManager.GET_META_DATA);
39 | String umengChannel = ai.metaData.get("UMENG_CHANNEL").toString();
40 | ((TextView) findViewById(R.id.umeng_channel)).setText(umengChannel);
41 |
42 | } catch (NameNotFoundException e) {
43 | // TODO Auto-generated catch block
44 | e.printStackTrace();
45 | }
46 |
47 | }
48 |
49 | @Override
50 | public final boolean onCreateOptionsMenu(final Menu menu) {
51 | // Inflate the menu; this adds items to the action bar if it is present.
52 | getMenuInflater().inflate(R.menu.main, menu);
53 | return true;
54 | }
55 |
56 | public final void onPause() {
57 | super.onPause();
58 | MobclickAgent.onPause(this);
59 | }
60 |
61 | public final void onResume() {
62 | super.onResume();
63 | MobclickAgent.onResume(this);
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------