├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.txt └── src │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ └── com │ │ └── github │ │ └── snowdream │ │ └── android │ │ └── apps │ │ └── imageviewer │ │ ├── ImageViewerActivity.java │ │ ├── ImageViewerPagerAdapter.java │ │ └── MainApplication.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── layout │ ├── activity_main.xml │ └── viewpager_item.xml │ ├── menu │ └── main.xml │ ├── values-w820dp │ └── dimens.xml │ ├── values-zh-rCN │ └── strings.xml │ └── values │ ├── analytics.xml │ ├── color.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── config ├── android-library.gradle ├── android.gradle ├── maven_push.gradle └── sign.gradle ├── docs └── preview │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 7.png │ ├── top.png │ └── top.psd ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.txt └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── github │ │ └── snowdream │ │ └── android │ │ └── template │ │ └── library │ │ └── HelloWorldLib.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ └── values │ └── strings.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by http://gitignore.io 2 | 3 | ### Windows ### 4 | # Windows image file caches 5 | Thumbs.db 6 | ehthumbs.db 7 | 8 | # Folder config file 9 | Desktop.ini 10 | 11 | # Recycle Bin used on file shares 12 | $RECYCLE.BIN/ 13 | 14 | ### Linux ### 15 | .* 16 | !.gitignore 17 | !.git* 18 | *~ 19 | 20 | 21 | ### Eclipse ### 22 | *.pydevproject 23 | .project 24 | .metadata 25 | bin/** 26 | tmp/** 27 | tmp/**/* 28 | *.tmp 29 | *.bak 30 | *.swp 31 | *~.nib 32 | local.properties 33 | .classpath 34 | .settings/ 35 | .loadpath 36 | 37 | # External tool builders 38 | .externalToolBuilders/ 39 | 40 | # Locally stored "Eclipse launch configurations" 41 | *.launch 42 | 43 | # CDT-specific 44 | .cproject 45 | 46 | # PDT-specific 47 | .buildpath 48 | 49 | ### Android ### 50 | # built application files 51 | *.apk 52 | *.ap_ 53 | 54 | # files for the dex VM 55 | *.dex 56 | 57 | # Java class files 58 | *.class 59 | 60 | # generated files 61 | bin/ 62 | gen/ 63 | 64 | # Local configuration file (sdk path, etc) 65 | local.properties 66 | 67 | # Eclipse project files 68 | .classpath 69 | .project 70 | 71 | # Proguard folder generated by Eclipse 72 | proguard/ 73 | 74 | # Proguard folder generated by Intellij 75 | proguard_logs/ 76 | 77 | # Intellij project files 78 | *.iml 79 | *.ipr 80 | *.iws 81 | .idea/ 82 | 83 | adt-bundle-windows-x86_64/ 84 | 85 | ### Gradle ### 86 | # Exclude Folder List # 87 | .gradle/ 88 | build/ 89 | 90 | ### Maven ### 91 | target/ 92 | 93 | ### Java ### 94 | *.class 95 | 96 | # Package Files # 97 | *.jar 98 | *.war 99 | *.ear 100 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "[]" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Snowdream ImageViewer 2 | [![Build Status](https://travis-ci.org/snowdream/android-imageviewer.svg?branch=master)](https://travis-ci.org/snowdream/android-imageviewer) 3 | 4 | ##Introduction 5 | It is a simple image viewer,but powerful. 6 | 7 | ##System requirements 8 | android 2.2+ 9 | 10 | ##Download 11 | Google Play : [![Get it on Google Play](https://developer.android.com/images/brand/en_generic_rgb_wo_60.png "Get it on Google Play")][1] 12 | Github : [https://github.com/snowdream/android-imageviewer/releases/download/v1.0.5/imageviewer-v1.0.5-release.apk][2] 13 | 14 | ##Preview 15 | ![1.png](https://raw.github.com/snowdream/android-imageviewer/master/docs/preview/1.png "1.png") 16 | ![2.png](https://raw.github.com/snowdream/android-imageviewer/master/docs/preview/2.png "2.png") 17 | ![3.png](https://raw.github.com/snowdream/android-imageviewer/master/docs/preview/3.png "3.png") 18 | ![4.png](https://raw.github.com/snowdream/android-imageviewer/master/docs/preview/4.png "4.png") 19 | ![5.png](https://raw.github.com/snowdream/android-imageviewer/master/docs/preview/5.png "5.png") 20 | ![6.png](https://raw.github.com/snowdream/android-imageviewer/master/docs/preview/6.png "6.png") 21 | ![7.png](https://raw.github.com/snowdream/android-imageviewer/master/docs/preview/7.png "7.png") 22 | 23 | ##Supported Formats 24 | JPEG (.jpg) 25 | GIF (.gif) 26 | PNG (.png) 27 | BMP (.bmp) 28 | WebP (.webp) (Android 4.0+) 29 | SVG (.svg) 30 | 31 | ##Features 32 | 1. Double tap to zoom in or zoom out 33 | 2. Flip pages with horizontal scroll 34 | 3. Share the image to email,bluetooth,hangouts,qq,weixin,google+ etc 35 | 4. Set the image as the wallpaper or the icon of the contacts 36 | 5. Animated Gif image supported 37 | 6. Svg image supported 38 | 39 | ##ChangeLog 40 | v1.05: 41 | Added: support for gif images with animation. 42 | Added: support for svg images 43 | Optimized: show the subtitle with the filename of the image. 44 | 45 | v1.04: 46 | Fixed: when the image path contains chinese characters,the image can not be shown. 47 | 48 | ##License 49 | ``` 50 | Copyright (C) 2014 Snowdream Mobile 51 | 52 | Licensed under the Apache License, Version 2.0 (the "License"); 53 | you may not use this file except in compliance with the License. 54 | You may obtain a copy of the License at 55 | 56 | http://www.apache.org/licenses/LICENSE-2.0 57 | 58 | Unless required by applicable law or agreed to in writing, software 59 | distributed under the License is distributed on an "AS IS" BASIS, 60 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 61 | See the License for the specific language governing permissions and 62 | limitations under the License. 63 | ``` 64 | 65 | [1]:https://play.google.com/store/apps/details?id=com.github.snowdream.android.apps.imageview 66 | [2]:https://github.com/snowdream/android-imageviewer/releases/download/v1.0.5/imageviewer-v1.0.5-release.apk 67 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'eclipse' 2 | apply plugin: 'idea' 3 | apply from: '../config/android.gradle' 4 | 5 | 6 | dependencies { 7 | //compile project(':lib') 8 | compile "com.android.support:support-v4:19.0.1+" 9 | compile 'com.android.support:appcompat-v7:19.0.1+' 10 | compile 'com.google.android.gms:play-services:6.5.87' 11 | compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1' 12 | compile 'com.github.snowdream.android.util:log:1.0.4' 13 | compile 'com.github.chrisbanes.photoview:library:1.2.2' 14 | compile 'pl.droidsonroids.gif:android-gif-drawable:1.0.5@aar' 15 | compile 'com.caverock:androidsvg:1.2.1' 16 | // compile 'com.larvalabs:svgandroid:1.2@aar' 17 | //compile 'org.apache.commons:commons-imaging:1.0-SNAPSHOT' 18 | } 19 | -------------------------------------------------------------------------------- /app/gradle.properties: -------------------------------------------------------------------------------- 1 | PACKAGE_NAME=com.github.snowdream.apps.imageview 2 | POM_GROUP_ID=com.github.snowdream.apps 3 | POM_ARTIFACT_ID=imageview 4 | POM_NAME=imageview 5 | POM_PACKAGING=apk 6 | -------------------------------------------------------------------------------- /app/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/snowdream/bin/android-sdk-linux/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 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 | 19 | -keep public class com.google.android.gms.ads.**{ 20 | public *; 21 | } 22 | 23 | -keep public class com.google.ads.**{ 24 | public *; 25 | } 26 | 27 | -keep class com.nostra13.universalimageloader.** { *; } 28 | -keep class pl.droidsonroids.gif.** { *; } 29 | -keep class com.caverock.** { *; } 30 | -keep class com.github.chrisbanes.photoview.** { *; } 31 | 32 | -dontwarn com.nostra13.universalimageloader.** 33 | -dontwarn pl.droidsonroids.gif.** 34 | -dontwarn com.caverock.** 35 | -dontwarn com.github.chrisbanes.photoview.** 36 | 37 | -keep class android.support.v7.internal.** { *; } 38 | -keep interface android.support.v7.internal.** { *; } 39 | -keep class android.support.v7.** { *; } 40 | -keep interface android.support.v7.** { *; } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/github/snowdream/android/apps/imageviewer/ImageViewerActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Snowdream Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.github.snowdream.android.apps.imageviewer; 18 | 19 | import android.content.Intent; 20 | import android.graphics.Bitmap; 21 | import android.net.Uri; 22 | import android.os.Bundle; 23 | import android.support.v4.view.MenuItemCompat; 24 | import android.support.v4.view.ViewPager; 25 | import android.support.v7.app.ActionBar; 26 | import android.support.v7.app.ActionBarActivity; 27 | import android.support.v7.widget.ShareActionProvider; 28 | import android.text.TextUtils; 29 | import android.view.Menu; 30 | import android.view.MenuItem; 31 | import android.view.View; 32 | import android.webkit.MimeTypeMap; 33 | import com.github.snowdream.android.util.Log; 34 | import com.nostra13.universalimageloader.core.DisplayImageOptions; 35 | import com.nostra13.universalimageloader.core.ImageLoader; 36 | import com.nostra13.universalimageloader.core.assist.ImageScaleType; 37 | import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; 38 | import uk.co.senab.photoview.PhotoViewAttacher; 39 | 40 | import java.io.File; 41 | import java.io.FileFilter; 42 | import java.util.ArrayList; 43 | import java.util.List; 44 | 45 | 46 | public class ImageViewerActivity extends ActionBarActivity implements ViewPager.OnPageChangeListener 47 | , PhotoViewAttacher.OnViewTapListener { 48 | private String imageUri = null; 49 | private List imageUrls = null; 50 | private String fileName = null; 51 | private ImageLoader imageLoader = null; 52 | private ShareActionProvider shareActionProvider = null; 53 | private int imageMode = 0; //0 multiple, 1,single 54 | private int imagePosition = 0; 55 | ViewPager viewPager = null; 56 | 57 | public static class Extra { 58 | public static final String IMAGES = "com.github.snowdream.android.apps.imageviewer.IMAGES"; 59 | public static final String IMAGE_POSITION = "com.github.snowdream.android.apps.imageviewer.IMAGE_POSITION"; 60 | public static final String IMAGE_MODE = "com.github.snowdream.android.apps.imageviewer.IMAGE_MODE"; 61 | } 62 | 63 | @Override 64 | protected void onCreate(Bundle savedInstanceState) { 65 | super.onCreate(savedInstanceState); 66 | setContentView(R.layout.activity_main); 67 | initUI(); 68 | initData(); 69 | loadData(); 70 | } 71 | 72 | @Override 73 | protected void onStart() { 74 | super.onStart(); 75 | // EasyTracker.getInstance().activityStart(this); // Add this method. 76 | } 77 | 78 | @Override 79 | protected void onStop() { 80 | super.onStop(); 81 | // EasyTracker.getInstance().activityStop(this); // Add this method. 82 | } 83 | 84 | public void initUI() { 85 | ActionBar actionBar = getSupportActionBar(); 86 | actionBar.setDisplayHomeAsUpEnabled(true); 87 | viewPager = (ViewPager) findViewById(R.id.viewpager); 88 | viewPager.setOnPageChangeListener(this); 89 | } 90 | 91 | public void initData() { 92 | imageLoader = ImageLoader.getInstance(); 93 | imageUrls = new ArrayList(); 94 | 95 | Intent intent = getIntent(); 96 | if (intent != null) { 97 | Bundle bundle = intent.getExtras(); 98 | if (bundle != null) { 99 | imageUrls = bundle.getStringArrayList(Extra.IMAGES); 100 | imagePosition = bundle.getInt(Extra.IMAGE_POSITION, 0); 101 | imageMode = bundle.getInt(Extra.IMAGE_MODE, 0); 102 | Log.i("The snowdream bundle path of the image is: " + imageUri); 103 | } 104 | 105 | Uri uri = (Uri) intent.getData(); 106 | if (uri != null) { 107 | imageUri = uri.getPath(); 108 | fileName = uri.getLastPathSegment(); 109 | getSupportActionBar().setSubtitle(fileName); 110 | Log.i("The path of the image is: " + imageUri); 111 | 112 | File file = new File(imageUri); 113 | 114 | imageUri = "file://" + imageUri; 115 | File dir = file.getParentFile(); 116 | if (dir != null) { 117 | FileFilter fileFilter = new FileFilter() { 118 | @Override 119 | public boolean accept(File f) { 120 | if (f != null) { 121 | String extension = MimeTypeMap.getFileExtensionFromUrl(Uri.encode(f.getAbsolutePath())); 122 | if (!TextUtils.isEmpty(extension)) { 123 | String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); 124 | if (!TextUtils.isEmpty(mimeType) && mimeType.contains("image")) { 125 | return true; 126 | } 127 | } 128 | } 129 | return false; 130 | } 131 | } ; 132 | 133 | File[] files = dir.listFiles(fileFilter); 134 | 135 | if (files != null && files.length > 0) { 136 | int size = files.length; 137 | 138 | for (int i = 0; i < size; i++) { 139 | imageUrls.add("file://" + files[i].getAbsolutePath()); 140 | } 141 | imagePosition = imageUrls.indexOf(imageUri); 142 | imageMode = 1; 143 | Log.i("Image Position:" + imagePosition); 144 | } 145 | 146 | } else { 147 | imageUrls.add("file://" + imageUri); 148 | imagePosition = 0; 149 | imageMode = 0; 150 | } 151 | } 152 | } 153 | 154 | else 155 | 156 | { 157 | Log.w("The intent is null!"); 158 | } 159 | 160 | } 161 | 162 | public void loadData() { 163 | DisplayImageOptions options = new DisplayImageOptions.Builder() 164 | .resetViewBeforeLoading(true) 165 | .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) 166 | .bitmapConfig(Bitmap.Config.RGB_565) 167 | .cacheInMemory(false) 168 | .considerExifParams(true) 169 | .displayer(new FadeInBitmapDisplayer(300)) 170 | .build(); 171 | viewPager.setAdapter(new ImageViewerPagerAdapter(this, imageUrls, options)); 172 | viewPager.setCurrentItem(imagePosition); 173 | } 174 | 175 | public void onViewTap(View view, float x, float y) { 176 | ActionBar actionBar = getSupportActionBar(); 177 | if (actionBar.isShowing()) { 178 | actionBar.hide(); 179 | } else { 180 | actionBar.show(); 181 | } 182 | } 183 | 184 | @Override 185 | public boolean onCreateOptionsMenu(Menu menu) { 186 | getMenuInflater().inflate(R.menu.main, menu); 187 | // Locate MenuItem with ShareActionProvider 188 | MenuItem itemShare = menu.findItem(R.id.action_share); 189 | // Get the provider and hold onto it to set/change the share intent. 190 | shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(itemShare); 191 | // Set history different from the default before getting the action 192 | // view since a call to MenuItemCompat.getActionView() calls 193 | // onCreateActionView() which uses the backing file name. Omit this 194 | // line if using the default share history file is desired. 195 | shareActionProvider.setShareHistoryFileName("snowdream_android_imageviewer_share_history.xml"); 196 | Intent shareIntent = createShareIntent(); 197 | if (shareIntent != null) { 198 | doShare(shareIntent); 199 | } 200 | return true; 201 | } 202 | 203 | @Override 204 | public boolean onOptionsItemSelected(MenuItem item) { 205 | int id = item.getItemId(); 206 | if (id == android.R.id.home) { 207 | finish(); 208 | return true; 209 | } else if (id == R.id.action_edit) { 210 | doEdit(); 211 | } else if (id == R.id.action_share) { 212 | Intent shareIntent = createShareIntent(); 213 | if (shareIntent != null) { 214 | doShare(shareIntent); 215 | } 216 | return true; 217 | } else if (id == R.id.action_settings) { 218 | doSettings(); 219 | return true; 220 | } 221 | return super.onOptionsItemSelected(item); 222 | } 223 | 224 | private Intent createShareIntent() { 225 | Intent shareIntent = null; 226 | 227 | if (!TextUtils.isEmpty(imageUri)) { 228 | shareIntent = new Intent(Intent.ACTION_SEND); 229 | shareIntent.setType("image/*"); 230 | Uri uri = Uri.parse(imageUri); 231 | shareIntent.putExtra(Intent.EXTRA_STREAM, uri); 232 | } 233 | 234 | return shareIntent; 235 | } 236 | 237 | public void doShare(Intent shareIntent) { 238 | if (shareActionProvider != null) { 239 | shareActionProvider.setShareIntent(shareIntent); 240 | } 241 | } 242 | 243 | public void doSettings() { 244 | if (!TextUtils.isEmpty(imageUri)) { 245 | Uri uri = Uri.parse(imageUri); 246 | Intent intent = new Intent(Intent.ACTION_ATTACH_DATA); 247 | intent.setDataAndType(uri, "image/jpg"); 248 | intent.putExtra("mimeType", "image/jpg"); 249 | startActivityForResult(Intent.createChooser(intent, getText(R.string.action_settings)), 200); 250 | } 251 | } 252 | 253 | public void doEdit() { 254 | 255 | } 256 | 257 | 258 | @Override 259 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 260 | Log.i("onPageScrolled"); 261 | } 262 | 263 | @Override 264 | public void onPageSelected(int position) { 265 | Log.i("onPageSelected position:" + position); 266 | if (imageUrls != null && imageUrls.size() > position) { 267 | imageUri = imageUrls.get(position); 268 | 269 | Uri uri = Uri.parse(imageUri); 270 | fileName = uri.getLastPathSegment(); 271 | getSupportActionBar().setSubtitle(fileName); 272 | Log.i("The path of the image is: " + imageUri); 273 | } 274 | 275 | 276 | Intent shareIntent = createShareIntent(); 277 | if (shareIntent != null) { 278 | doShare(shareIntent); 279 | } 280 | Log.i("onPageSelected imageUri:" + imageUri); 281 | } 282 | 283 | @Override 284 | public void onPageScrollStateChanged(int state) { 285 | Log.i("onPageScrollStateChanged state:" + state); 286 | } 287 | 288 | } 289 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/snowdream/android/apps/imageviewer/ImageViewerPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.github.snowdream.android.apps.imageviewer; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.graphics.Bitmap; 6 | import android.graphics.drawable.Drawable; 7 | import android.graphics.drawable.PictureDrawable; 8 | import android.net.Uri; 9 | import android.os.Build; 10 | import android.support.v4.view.PagerAdapter; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.widget.ImageView; 15 | import android.widget.ProgressBar; 16 | import com.caverock.androidsvg.SVG; 17 | import com.caverock.androidsvg.SVGParseException; 18 | import com.github.snowdream.android.util.Log; 19 | import com.nostra13.universalimageloader.core.DisplayImageOptions; 20 | import com.nostra13.universalimageloader.core.ImageLoader; 21 | import com.nostra13.universalimageloader.core.assist.FailReason; 22 | import com.nostra13.universalimageloader.core.assist.ImageLoadingListener; 23 | import com.nostra13.universalimageloader.core.assist.ImageLoadingProgressListener; 24 | import pl.droidsonroids.gif.GifDrawable; 25 | import uk.co.senab.photoview.PhotoViewAttacher; 26 | 27 | import java.io.File; 28 | import java.io.FileInputStream; 29 | import java.io.FileNotFoundException; 30 | import java.io.IOException; 31 | import java.util.List; 32 | 33 | /** 34 | * Created by snowdream on 2/5/14. 35 | */ 36 | public class ImageViewerPagerAdapter extends PagerAdapter { 37 | private DisplayImageOptions options = null; 38 | private List list = null; 39 | private ImageLoader imageLoader = null; 40 | private Context context = null; 41 | 42 | private ImageViewerPagerAdapter() { 43 | } 44 | 45 | ImageViewerPagerAdapter(Context context, List list, DisplayImageOptions options) { 46 | this.list = list; 47 | this.options = options; 48 | this.context = context; 49 | imageLoader = ImageLoader.getInstance(); 50 | } 51 | 52 | @Override 53 | public int getCount() { 54 | if (list != null) { 55 | return list.size(); 56 | } 57 | 58 | return 0; 59 | } 60 | 61 | @Override 62 | public boolean isViewFromObject(View view, Object object) { 63 | return view.equals(object); 64 | } 65 | 66 | @Override 67 | public void destroyItem(ViewGroup container, int position, Object object) { 68 | container.removeView((View) object); 69 | } 70 | 71 | @Override 72 | public Object instantiateItem(ViewGroup container, int position) { 73 | String imageUri = list.get(position); 74 | View view = null; 75 | view = LayoutInflater.from(context).inflate(R.layout.viewpager_item, container, false); 76 | final ImageView imageView = (ImageView) view.findViewById(R.id.imageView); 77 | 78 | // if (imageUri.endsWith("gif")) { 79 | // try { 80 | // GifDrawable gifDrawable = new GifDrawable( "/path/anim.gif" ); 81 | // imageView.setImageDrawable(gifDrawable); 82 | // } catch (IOException e) { 83 | // e.printStackTrace(); 84 | // } 85 | // }else 86 | { 87 | final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progressBar); 88 | 89 | final PhotoViewAttacher attacher = new PhotoViewAttacher(imageView); 90 | 91 | imageLoader.displayImage(imageUri, imageView, options, new ImageLoadingListener() { 92 | @Override 93 | public void onLoadingStarted(String imageUri, View view) { 94 | Log.i("onLoadingStarted"); 95 | progressBar.setVisibility(View.VISIBLE); 96 | } 97 | 98 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 99 | @Override 100 | public void onLoadingFailed(String imageUri, View view, FailReason failReason) { 101 | String message = null; 102 | switch (failReason.getType()) { 103 | case IO_ERROR: 104 | message = "Input/Output error"; 105 | break; 106 | case DECODING_ERROR: 107 | message = "Image can't be decoded"; 108 | break; 109 | case NETWORK_DENIED: 110 | message = "Downloads are denied"; 111 | break; 112 | case OUT_OF_MEMORY: 113 | message = "Out Of Memory error"; 114 | break; 115 | case UNKNOWN: 116 | message = "Unknown error"; 117 | break; 118 | } 119 | Log.e("onLoadingFailed:" + message); 120 | if (imageUri.endsWith("gif")) { 121 | try { 122 | Uri uri = Uri.parse(imageUri); 123 | GifDrawable gifDrawable = new GifDrawable(uri.getPath()); 124 | imageView.setImageDrawable(gifDrawable); 125 | } catch (IOException e) { 126 | e.printStackTrace(); 127 | } 128 | } else if (imageUri.endsWith("svg")) { 129 | imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); 130 | try { 131 | Uri uri = Uri.parse(imageUri); 132 | File svgFile = new File(uri.getPath()); 133 | 134 | SVG svg = SVG.getFromInputStream(new FileInputStream(svgFile)); 135 | Drawable svgDrawable = new PictureDrawable(svg.renderToPicture()); 136 | imageView.setImageDrawable(svgDrawable); 137 | } catch (FileNotFoundException e) { 138 | e.printStackTrace(); 139 | } catch (SVGParseException e) { 140 | e.printStackTrace(); 141 | } 142 | } 143 | attacher.update(); 144 | progressBar.setVisibility(View.GONE); 145 | } 146 | 147 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 148 | @Override 149 | public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { 150 | Log.i("onLoadingComplete"); 151 | if (imageUri.endsWith("gif")) { 152 | try { 153 | Uri uri = Uri.parse(imageUri); 154 | GifDrawable gifDrawable = new GifDrawable(uri.getPath()); 155 | imageView.setImageDrawable(gifDrawable); 156 | } catch (IOException e) { 157 | e.printStackTrace(); 158 | } 159 | } else if (imageUri.endsWith("svg")) { 160 | imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); 161 | try { 162 | Uri uri = Uri.parse(imageUri); 163 | File svgFile = new File(uri.getPath()); 164 | 165 | SVG svg = SVG.getFromInputStream(new FileInputStream(svgFile)); 166 | Drawable svgDrawable = new PictureDrawable(svg.renderToPicture()); 167 | imageView.setImageDrawable(svgDrawable); 168 | } catch (FileNotFoundException e) { 169 | e.printStackTrace(); 170 | } catch (SVGParseException e) { 171 | e.printStackTrace(); 172 | } 173 | } 174 | attacher.update(); 175 | progressBar.setVisibility(View.GONE); 176 | } 177 | 178 | @Override 179 | public void onLoadingCancelled(String imageUri, View view) { 180 | Log.w("onLoadingCancelled"); 181 | progressBar.setVisibility(View.GONE); 182 | } 183 | }, new ImageLoadingProgressListener() { 184 | @Override 185 | public void onProgressUpdate(String imageUri, View view, int current, int total) { 186 | Log.i("onProgressUpdate " + current + "/" + "total"); 187 | } 188 | } 189 | ); 190 | container.addView(view); 191 | } 192 | return view; 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/snowdream/android/apps/imageviewer/MainApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Snowdream Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.github.snowdream.android.apps.imageviewer; 18 | 19 | import android.app.Application; 20 | import android.content.Context; 21 | import android.graphics.Bitmap; 22 | 23 | import android.os.Build; 24 | import android.os.StrictMode; 25 | import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; 26 | import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; 27 | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; 28 | import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache; 29 | import com.nostra13.universalimageloader.core.DisplayImageOptions; 30 | import com.nostra13.universalimageloader.core.ImageLoader; 31 | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; 32 | import com.nostra13.universalimageloader.core.assist.QueueProcessingType; 33 | import com.nostra13.universalimageloader.core.decode.BaseImageDecoder; 34 | import com.nostra13.universalimageloader.core.download.BaseImageDownloader; 35 | import com.nostra13.universalimageloader.utils.StorageUtils; 36 | 37 | import java.io.File; 38 | 39 | /** 40 | * Created by yanghui07 on 14-1-16. 41 | */ 42 | public class MainApplication extends Application { 43 | /** 44 | * Called when the application is starting, before any activity, service, 45 | * or receiver objects (excluding content providers) have been created. 46 | * Implementations should be as quick as possible (for example using 47 | * lazy initialization of state) since the time spent in this function 48 | * directly impacts the performance of starting the first activity, 49 | * service, or receiver in a process. 50 | * If you override this method, be sure to call super.onCreate(). 51 | */ 52 | @Override 53 | public void onCreate() { 54 | super.onCreate(); 55 | 56 | // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { 57 | // StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyDialog().build()); 58 | // StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build()); 59 | // } 60 | 61 | initImageLoader(getApplicationContext()); 62 | } 63 | 64 | 65 | public static void initImageLoader(Context context) { 66 | File cacheDir = StorageUtils.getCacheDirectory(context); 67 | ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) 68 | .memoryCacheExtraOptions(480, 800) // default = device screen dimensions 69 | .denyCacheImageMultipleSizesInMemory() 70 | .discCacheExtraOptions(480, 800, Bitmap.CompressFormat.JPEG, 75, null) 71 | .threadPriority(Thread.NORM_PRIORITY - 2) // default 72 | .tasksProcessingOrder(QueueProcessingType.FIFO) // default 73 | .denyCacheImageMultipleSizesInMemory() 74 | .memoryCache(new LruMemoryCache(2 * 1024 * 1024)) 75 | .memoryCacheSize(2 * 1024 * 1024) 76 | .memoryCacheSizePercentage(13) // default 77 | .discCache(new UnlimitedDiscCache(cacheDir)) // default 78 | .discCacheSize(50 * 1024 * 1024) 79 | .discCacheFileCount(100) 80 | .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default 81 | .imageDownloader(new BaseImageDownloader(context)) // default 82 | .imageDecoder(new BaseImageDecoder(true)) // default 83 | .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default 84 | .writeDebugLogs() 85 | .build(); 86 | 87 | ImageLoader.getInstance().init(config); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 29 | 30 | 39 | 40 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/viewpager_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 27 | 33 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 21 | 64dp 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh-rCN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 雪梦图片浏览器 21 | Hello world! 22 | 设置为 23 | 分享 24 | 编辑 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/analytics.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UA-47545124-2 6 | 7 | 8 | true 9 | 10 | 11 | true 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #64000000 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 16dp 20 | 16dp 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | Snowdream ImageViewer 21 | Hello world! 22 | Set As 23 | Share 24 | Edit 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:1.1.1' 8 | } 9 | } 10 | 11 | allprojects { 12 | group = POM_GROUP_ID 13 | version = POM_VERSION 14 | 15 | repositories { 16 | mavenLocal() 17 | mavenCentral() 18 | maven { url "http://oss.sonatype.org/content/repositories/snapshots/" } 19 | maven { url "file:///home/snowdream/workspace/git/mvn-repo/releases/" } 20 | maven { url "file:///home/snowdream/workspace/git/mvn-repo/snapshots/" } 21 | maven { url "http://snowdream.github.io/mvn-repo/releases/" } 22 | maven { url "http://snowdream.github.io/mvn-repo/snapshots/" } 23 | maven { url "http://repository.apache.org/snapshots/" } 24 | } 25 | 26 | tasks.withType(JavaCompile) { 27 | options.encoding = "UTF-8" 28 | } 29 | } 30 | 31 | 32 | task wrapper(type: Wrapper) { 33 | gradleVersion = '2.2.1' 34 | } 35 | 36 | 37 | -------------------------------------------------------------------------------- /config/android-library.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android-library' 2 | 3 | archivesBaseName = POM_NAME 4 | 5 | dependencies { 6 | } 7 | 8 | android { 9 | compileSdkVersion Integer.parseInt(project.COMPILE_SDK_VERSION) 10 | buildToolsVersion project.BUILD_TOOLS_VERSION 11 | 12 | defaultConfig { 13 | versionCode Integer.parseInt(project.VERSION_CODE) 14 | versionName project.VERSION_NAME 15 | minSdkVersion Integer.parseInt(project.MIN_SDK_VERSION) 16 | targetSdkVersion Integer.parseInt(project.TARGET_SDK_VERSION) 17 | 18 | testApplicationId project.PACKAGE_NAME+".test" 19 | testInstrumentationRunner "android.test.InstrumentationTestRunner" 20 | testHandleProfiling true 21 | testFunctionalTest true 22 | } 23 | 24 | buildTypes { 25 | release { 26 | minifyEnabled true 27 | shrinkResources true 28 | proguardFiles getDefaultProguardFile('proguard-android-lib-optimize.txt'), 'proguard-rules.txt' 29 | //signingConfig signingConfigs.release 30 | } 31 | } 32 | 33 | packagingOptions { 34 | exclude 'META-INF/DEPENDENCIES' 35 | exclude 'META-INF/NOTICE' 36 | exclude 'META-INF/LICENSE' 37 | exclude 'META-INF/LICENSE.txt' 38 | exclude 'META-INF/NOTICE.txt' 39 | } 40 | 41 | lintOptions { 42 | abortOnError false 43 | } 44 | } 45 | 46 | android.libraryVariants.all { variant -> 47 | 48 | task("generate${variant.name}Javadoc", type: Javadoc) { 49 | title = "android lib - $POM_NAME $version API" 50 | description "Generates Javadoc for $variant.name." 51 | source = variant.javaCompile.source 52 | ext.androidJar = 53 | "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" 54 | classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) 55 | options { 56 | locale = 'en_US' 57 | encoding = 'UTF-8' 58 | charSet = 'UTF-8' 59 | links("http://docs.oracle.com/javase/7/docs/api/"); 60 | linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"); 61 | links("http://ormlite.com/javadoc/ormlite-core/"); 62 | links("http://ormlite.com/javadoc/ormlite-android/"); 63 | } 64 | exclude '**/BuildConfig.java' 65 | exclude '**/R.java' 66 | exclude '**/Log2File.java' 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /config/android.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'android' 2 | 3 | dependencies { 4 | } 5 | 6 | android { 7 | compileSdkVersion Integer.parseInt(project.COMPILE_SDK_VERSION) 8 | buildToolsVersion project.BUILD_TOOLS_VERSION 9 | 10 | defaultConfig { 11 | versionCode Integer.parseInt(project.VERSION_CODE) 12 | versionName project.VERSION_NAME 13 | minSdkVersion Integer.parseInt(project.MIN_SDK_VERSION) 14 | targetSdkVersion Integer.parseInt(project.TARGET_SDK_VERSION) 15 | applicationId project.PACKAGE_NAME 16 | 17 | testApplicationId project.PACKAGE_NAME+".test" 18 | testInstrumentationRunner "android.test.InstrumentationTestRunner" 19 | testHandleProfiling true 20 | testFunctionalTest true 21 | } 22 | 23 | signingConfigs { 24 | release { 25 | storeFile file(System.getenv("KEYSTORE")) 26 | storePassword System.getenv("KEYSTORE_PASSWORD") 27 | keyAlias System.getenv("KEY_ALIAS") 28 | keyPassword System.getenv("KEY_PASSWORD") 29 | } 30 | } 31 | 32 | buildTypes { 33 | release { 34 | minifyEnabled true 35 | shrinkResources true 36 | proguardFiles getDefaultProguardFile('proguard-android-app-optimize.txt'), 'proguard-rules.txt' 37 | signingConfig signingConfigs.release 38 | } 39 | } 40 | 41 | packagingOptions { 42 | exclude 'META-INF/DEPENDENCIES' 43 | exclude 'META-INF/NOTICE' 44 | exclude 'META-INF/LICENSE' 45 | exclude 'META-INF/LICENSE.txt' 46 | exclude 'META-INF/NOTICE.txt' 47 | } 48 | 49 | lintOptions { 50 | abortOnError false 51 | } 52 | } 53 | 54 | android.applicationVariants.all { variant -> 55 | def apk = variant.outputs[0].outputFile; 56 | def newName = ""; 57 | 58 | newName = apk.name.replace(project.name, POM_NAME + "-v" + android.defaultConfig.versionName); 59 | newName = newName.replace("-" + variant.buildType.name, ""); 60 | newName = newName.replace(".apk", "-" + variant.buildType.name.toLowerCase() + ".apk"); 61 | 62 | variant.outputs[0].outputFile = new File(apk.parentFile, newName); 63 | if (variant.outputs[0].zipAlign) { 64 | variant.outputs[0].zipAlign.outputFile = new File(apk.parentFile, newName.replace("-unaligned", "")); 65 | } 66 | } 67 | 68 | android.applicationVariants.all { variant -> 69 | 70 | task("generate${variant.name}Javadoc", type: Javadoc) { 71 | title = "android lib - $POM_NAME $version API" 72 | description "Generates Javadoc for $variant.name." 73 | source = variant.javaCompile.source 74 | ext.androidJar = 75 | "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" 76 | classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) 77 | options { 78 | locale = 'en_US' 79 | encoding = 'UTF-8' 80 | charSet = 'UTF-8' 81 | links("http://docs.oracle.com/javase/7/docs/api/"); 82 | linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"); 83 | } 84 | exclude '**/BuildConfig.java' 85 | exclude '**/R.java' 86 | exclude '**/Log2File.java' 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /config/maven_push.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven' 2 | apply plugin: 'signing' 3 | 4 | configurations { 5 | archives { 6 | extendsFrom configurations.default 7 | } 8 | } 9 | 10 | def isReleaseBuild() { 11 | return version.contains("SNAPSHOT") == false 12 | } 13 | 14 | def sonatypeRepositoryUrl 15 | if (isReleaseBuild()) { 16 | println 'Sonatype RELEASE BUILD' 17 | sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 18 | } else { 19 | println 'Sonatype SNAPSHOT BUILD' 20 | sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/" 21 | } 22 | 23 | def githubRepositoryUrl 24 | if (isReleaseBuild()) { 25 | println 'GITHUB RELEASE BUILD' 26 | githubRepositoryUrl = "file:///home/snowdream/workspace/git/mvn-repo/releases" 27 | } else { 28 | println 'GITHUB SNAPSHOT BUILD' 29 | githubRepositoryUrl = "file:///home/snowdream/workspace/git/mvn-repo/snapshots" 30 | } 31 | 32 | if (ext.properties.containsKey('signing.keyId') && 33 | !ext.properties.containsKey('signing.password')) { 34 | if (System.console()) { 35 | ext.set('signing.password', 36 | System.console().readPassword("\n\$ Type in GPG key password: ")) 37 | } else { 38 | ext.set('signing.password', 'snowdream') 39 | } 40 | } 41 | 42 | if (!ext.properties.containsKey('nexusUsername')) { 43 | if (System.console()) { 44 | ext.set('nexusUsername', new String(System.console().readPassword( 45 | "\n\$ Type in username for Sonatype nexus account ${nexusUsername}: "))) 46 | } else { 47 | ext.set('nexusUsername', 'snowdream') 48 | } 49 | } 50 | 51 | if (!ext.properties.containsKey('nexusPassword')) { 52 | if (System.console()) { 53 | ext.set('nexusPassword', new String(System.console().readPassword( 54 | "\n\$ Type in password for Sonatype nexus account ${nexusUsername}: "))) 55 | } else { 56 | ext.set('nexusPassword', 'snowdream') 57 | } 58 | } 59 | 60 | afterEvaluate { project -> 61 | uploadArchives { 62 | repositories { 63 | mavenDeployer { 64 | configurePOM(pom) 65 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 66 | 67 | repository(url: sonatypeRepositoryUrl) { 68 | authentication(userName: nexusUsername, password: nexusPassword) 69 | } 70 | } 71 | 72 | mavenDeployer { 73 | configurePOM(pom) 74 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 75 | 76 | repository(url: githubRepositoryUrl) 77 | } 78 | } 79 | } 80 | 81 | signing { 82 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 83 | sign configurations.archives 84 | } 85 | 86 | task androidReleaseJar(type: Jar, dependsOn: assembleRelease) { 87 | from "$buildDir/intermediates/classes/release/" 88 | exclude '**/BuildConfig.class' 89 | exclude '**/R.class' 90 | exclude '**/R$*.class' 91 | } 92 | 93 | task androidJavadocsJar(type: Jar) { 94 | classifier = 'javadoc' 95 | from "generateReleaseJavadoc.destinationDir" 96 | } 97 | 98 | task androidSourcesJar(type: Jar) { 99 | classifier = 'sources' 100 | from android.sourceSets.main.java.srcDirs 101 | } 102 | 103 | 104 | artifacts { 105 | archives androidReleaseJar 106 | archives androidSourcesJar 107 | archives androidJavadocsJar 108 | } 109 | } 110 | 111 | private configurePOM(def pom) { 112 | pom.project { 113 | groupId POM_GROUP_ID 114 | artifactId POM_ARTIFACT_ID 115 | version POM_VERSION 116 | name POM_NAME 117 | packaging POM_PACKAGING 118 | description POM_DESCRIPTION 119 | url POM_URL 120 | inceptionYear POM_INCEPTION_YEAR 121 | 122 | scm { 123 | url POM_SCM_URL 124 | connection POM_SCM_CONNECTION 125 | developerConnection POM_SCM_DEV_CONNECTION 126 | } 127 | 128 | licenses { 129 | license { 130 | name POM_LICENCE_NAME 131 | url POM_LICENCE_URL 132 | distribution POM_LICENCE_DIST 133 | comments POM_LICENCE_COMMENTS 134 | } 135 | } 136 | 137 | developers { 138 | developer { 139 | id POM_DEVELOPER_ID 140 | name POM_DEVELOPER_NAME 141 | email POM_DEVELOPER_EMAIL 142 | url POM_DEVELOPER_URL 143 | } 144 | } 145 | 146 | issueManagement { 147 | system POM_ISSUE_MANAGEMENT_SYSTEM 148 | url POM_ISSUE_MANAGEMENT_URL 149 | } 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /config/sign.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'signing' 2 | 3 | 4 | signing { 5 | sign configurations.archives 6 | } -------------------------------------------------------------------------------- /docs/preview/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/docs/preview/1.png -------------------------------------------------------------------------------- /docs/preview/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/docs/preview/2.png -------------------------------------------------------------------------------- /docs/preview/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/docs/preview/3.png -------------------------------------------------------------------------------- /docs/preview/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/docs/preview/4.png -------------------------------------------------------------------------------- /docs/preview/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/docs/preview/7.png -------------------------------------------------------------------------------- /docs/preview/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/docs/preview/top.png -------------------------------------------------------------------------------- /docs/preview/top.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/docs/preview/top.psd -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Set Gradle settings which apply to all modules here. 2 | PACKAGE_NAME=com.github.snowdream.app.imageviewer 3 | VERSION_NAME=1.0.5 4 | VERSION_CODE=6 5 | MIN_SDK_VERSION=8 6 | TARGET_SDK_VERSION=21 7 | COMPILE_SDK_VERSION=21 8 | BUILD_TOOLS_VERSION=21.1.2 9 | 10 | POM_GROUP_ID=com.github.snowdream.app 11 | POM_ARTIFACT_ID=imageviewer 12 | POM_VERSION=1.0.5 13 | POM_NAME=android-imageviewer 14 | POM_PACKAGING=pom 15 | POM_DESCRIPTION=android-imageviewer 16 | POM_URL=https://github.com/snowdream/android-imageviewer 17 | POM_INCEPTION_YEAR=2014 18 | 19 | POM_SCM_URL=git@github.com:snowdream/android-imageviewer.git 20 | POM_SCM_CONNECTION=scm:git:git@github.com:snowdream/android-imageviewer.git 21 | POM_SCM_DEV_CONNECTION=scm:git:git@github.com:snowdream/android-imageviewer.git 22 | 23 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 24 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 25 | POM_LICENCE_DIST=repo 26 | POM_LICENCE_COMMENTS=A business-friendly OSS license 27 | 28 | POM_DEVELOPER_ID=snowdream 29 | POM_DEVELOPER_NAME=YangHui 30 | POM_DEVELOPER_EMAIL=yanghui1986527@gmail.com 31 | POM_DEVELOPER_URL=http://snowdream.github.io 32 | 33 | POM_ISSUE_MANAGEMENT_SYSTEM=Github 34 | POM_ISSUE_MANAGEMENT_URL=https://github.com/snowdream/android-imageviewer/issues 35 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014 Snowdream Mobile 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | #Sun Jan 26 13:56:12 CST 2014 18 | distributionBase=GRADLE_USER_HOME 19 | distributionPath=wrapper/dists 20 | zipStoreBase=GRADLE_USER_HOME 21 | zipStorePath=wrapper/dists 22 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip 23 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /lib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'eclipse' 2 | apply plugin: 'idea' 3 | apply from: '../config/android-library.gradle' 4 | apply from: '../config/maven_push.gradle' 5 | 6 | dependencies { 7 | } 8 | 9 | -------------------------------------------------------------------------------- /lib/gradle.properties: -------------------------------------------------------------------------------- 1 | PACKAGE_NAME=com.github.snowdream.android.template.library 2 | POM_GROUP_ID=com.github.snowdream.android.template 3 | POM_ARTIFACT_ID=library 4 | POM_NAME=library 5 | POM_PACKAGING=aar 6 | -------------------------------------------------------------------------------- /lib/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/snowdream/bin/android-sdk-linux/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 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 | -keepclasseswithmembers class com.github.snowdream.android.template.library.HelloWorldLib { 19 | public static ** get*(); 20 | } -------------------------------------------------------------------------------- /lib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /lib/src/main/java/com/github/snowdream/android/template/library/HelloWorldLib.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Snowdream Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.github.snowdream.android.template.library; 18 | 19 | /** 20 | * Created by snowdream on 11/17/13. 21 | */ 22 | public class HelloWorldLib { 23 | 24 | public static String getHelloWorld(){ 25 | return "Hello World From HelloWorldLib!"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/lib/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/lib/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/lib/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snowdream/android-imageviewer/8fe0591dc0a794fbf8e6bca209c12495dc3b4117/lib/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | My Module 19 | 20 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Snowdream Mobile 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | include ':app' --------------------------------------------------------------------------------