├── sample ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_icon.png │ │ │ │ └── ic_default_image.png │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── layout │ │ │ │ ├── item_single_image.xml │ │ │ │ ├── activity_recycler.xml │ │ │ │ ├── item_post_fill_style.xml │ │ │ │ ├── item_post_grid_style.xml │ │ │ │ └── activity_main.xml │ │ │ └── drawable │ │ │ │ └── bg_btn_shape.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── jaeger │ │ │ │ └── ninegridimgdemo │ │ │ │ ├── activity │ │ │ │ ├── BaseActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── GridStyleActivity.java │ │ │ │ └── FillStyleActivity.java │ │ │ │ ├── entity │ │ │ │ └── Post.java │ │ │ │ ├── adapter │ │ │ │ └── PostAdapter.java │ │ │ │ └── ViewServer.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── jaeger │ │ │ └── ninegridimgdemo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── jaeger │ │ └── ninegridimgdemo │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── library ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── attrs.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── jaeger │ │ │ └── ninegridimageview │ │ │ ├── ItemImageLongClickListener.java │ │ │ ├── ItemImageClickListener.java │ │ │ ├── NineGridImageViewAdapter.java │ │ │ ├── GridImageView.java │ │ │ └── NineGridImageView.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── jaeger │ │ │ └── ninegridimageview │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── jaeger │ │ └── ninegridimageview │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew.bat ├── gradlew ├── README.md └── LICENSE /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':library', ':sample' 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/ 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laobie/NineGridImageView/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | NineGridImageView 3 | 4 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laobie/NineGridImageView/HEAD/sample/src/main/res/drawable-xhdpi/ic_icon.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laobie/NineGridImageView/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laobie/NineGridImageView/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laobie/NineGridImageView/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laobie/NineGridImageView/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laobie/NineGridImageView/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xhdpi/ic_default_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laobie/NineGridImageView/HEAD/sample/src/main/res/drawable-xhdpi/ic_default_image.png -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | NineGridImgDemo 3 | Fill Style 4 | Grid Style 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Dec 29 22:06:46 CST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6c6c6c 4 | #3a3b3b 5 | #FF4081 6 | #ffffff 7 | 8 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /sample/src/test/java/com/jaeger/ninegridimgdemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimgdemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /library/src/test/java/com/jaeger/ninegridimageview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimageview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /sample/src/androidTest/java/com/jaeger/ninegridimgdemo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimgdemo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /library/src/androidTest/java/com/jaeger/ninegridimageview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimageview; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /library/src/main/java/com/jaeger/ninegridimageview/ItemImageLongClickListener.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimageview; 2 | 3 | import android.content.Context; 4 | import android.widget.ImageView; 5 | import java.util.List; 6 | 7 | /** 8 | * @author yueban 9 | * Date: 2017/9/19 10 | * Email: fbzhh007@gmail.com 11 | */ 12 | public interface ItemImageLongClickListener { 13 | boolean onItemImageLongClick(Context context, ImageView imageView, int index, List list); 14 | } 15 | -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library/src/main/java/com/jaeger/ninegridimageview/ItemImageClickListener.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimageview; 2 | 3 | import android.content.Context; 4 | import android.widget.ImageView; 5 | import java.util.List; 6 | 7 | /** 8 | * Created by Jaeger on 2016/12/29. 9 | * 10 | * Email: chjie.jaeger@gmail.com 11 | * GitHub: https://github.com/laobie 12 | */ 13 | 14 | public interface ItemImageClickListener { 15 | void onItemImageClick(Context context, ImageView imageView, int index, List list); 16 | } 17 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/item_single_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/bg_btn_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Jaeger/Develop/android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Jaeger/Develop/android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/src/main/java/com/jaeger/ninegridimgdemo/activity/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimgdemo.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import com.jaeger.ninegridimgdemo.ViewServer; 6 | 7 | /** 8 | * Created by Jaeger on 16/9/7. 9 | * 10 | * Email: chjie.jaeger@gmail.com 11 | * GitHub: https://github.com/laobie 12 | */ 13 | public class BaseActivity extends AppCompatActivity { 14 | 15 | public void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | ViewServer.get(this).addWindow(this); 18 | } 19 | 20 | public void onDestroy() { 21 | super.onDestroy(); 22 | ViewServer.get(this).removeWindow(this); 23 | } 24 | 25 | public void onResume() { 26 | super.onResume(); 27 | ViewServer.get(this).setFocusedWindow(this); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.jaeger.ninegridimgdemo" 9 | minSdkVersion 14 10 | targetSdkVersion 25 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(include: ['*.jar'], dir: 'libs') 25 | testCompile 'junit:junit:4.12' 26 | compile 'com.android.support:appcompat-v7:25.3.1' 27 | compile 'com.android.support:recyclerview-v7:25.3.1' 28 | compile 'com.squareup.picasso:picasso:2.5.2' 29 | compile 'com.jaeger.ninegridimageview:library:1.1.1' 30 | // compile project(':library') 31 | } 32 | 33 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_recycler.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/java/com/jaeger/ninegridimageview/NineGridImageViewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimageview; 2 | 3 | import android.content.Context; 4 | import android.widget.ImageView; 5 | import java.util.List; 6 | 7 | /** 8 | * Created by Jaeger on 16/2/24. 9 | * 10 | * Email: chjie.jaeger@gmail.com 11 | * GitHub: https://github.com/laobie 12 | */ 13 | public abstract class NineGridImageViewAdapter { 14 | protected abstract void onDisplayImage(Context context, ImageView imageView, T t); 15 | 16 | protected void onItemImageClick(Context context, ImageView imageView, int index, List list) { 17 | } 18 | 19 | protected boolean onItemImageLongClick(Context context, ImageView imageView, int index, List list) { 20 | return false; 21 | } 22 | 23 | protected ImageView generateImageView(Context context) { 24 | GridImageView imageView = new GridImageView(context); 25 | imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); 26 | return imageView; 27 | } 28 | } -------------------------------------------------------------------------------- /sample/src/main/res/layout/item_post_fill_style.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 18 | 19 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/item_post_grid_style.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 20 | 21 | 28 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /sample/src/main/java/com/jaeger/ninegridimgdemo/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimgdemo.activity; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.View; 7 | import com.jaeger.ninegridimgdemo.R; 8 | 9 | public class MainActivity extends BaseActivity { 10 | 11 | @Override 12 | public void onCreate(Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | setContentView(R.layout.activity_main); 15 | setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); 16 | findViewById(R.id.btn_fill_style).setOnClickListener(new View.OnClickListener() { 17 | @Override 18 | public void onClick(View v) { 19 | Intent intent = new Intent(MainActivity.this, FillStyleActivity.class); 20 | startActivity(intent); 21 | } 22 | }); 23 | 24 | findViewById(R.id.btn_grid_style).setOnClickListener(new View.OnClickListener() { 25 | @Override 26 | public void onClick(View v) { 27 | Intent intent = new Intent(MainActivity.this, GridStyleActivity.class); 28 | startActivity(intent); 29 | } 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /sample/src/main/java/com/jaeger/ninegridimgdemo/entity/Post.java: -------------------------------------------------------------------------------- 1 | package com.jaeger.ninegridimgdemo.entity; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by Jaeger on 16/2/24. 7 | * 8 | * Email: chjie.jaeger@gmail.com 9 | * GitHub: https://github.com/laobie 10 | */ 11 | public class Post { 12 | private String mContent; 13 | private int mSpanType; 14 | private List mImgUrlList; 15 | 16 | public Post() { 17 | } 18 | 19 | public Post(String content, List imgUrlList) { 20 | mContent = content; 21 | mImgUrlList = imgUrlList; 22 | } 23 | public Post(String content,int spanType, List imgUrlList) { 24 | mContent = content; 25 | mSpanType = spanType; 26 | mImgUrlList = imgUrlList; 27 | } 28 | 29 | public String getContent() { 30 | return mContent; 31 | } 32 | 33 | public void setContent(String content) { 34 | mContent = content; 35 | } 36 | 37 | public int getmSpanType() { 38 | return mSpanType; 39 | } 40 | 41 | public void setmSpanType(int mSpanType) { 42 | this.mSpanType = mSpanType; 43 | } 44 | 45 | public List getImgUrlList() { 46 | return mImgUrlList; 47 | } 48 | 49 | public void setImgUrlList(List imgUrlList) { 50 | mImgUrlList = imgUrlList; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 22 | 23 |