├── CardView
├── settings.gradle
├── .idea
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ ├── compiler.xml
│ └── misc.xml
├── app
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── dimens.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── drawable
│ │ │ │ │ ├── q1.png
│ │ │ │ │ ├── q2.png
│ │ │ │ │ ├── q3.png
│ │ │ │ │ ├── main1.png
│ │ │ │ │ └── backgound.xml
│ │ │ │ ├── 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-w820dp
│ │ │ │ │ └── dimens.xml
│ │ │ │ └── layout
│ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ └── layout_card.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── glh
│ │ │ │ │ └── cardview
│ │ │ │ │ ├── util
│ │ │ │ │ ├── ListUtil.java
│ │ │ │ │ └── DensityUtil.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── card
│ │ │ │ │ └── CardGroupView.java
│ │ │ └── AndroidManifest.xml
│ │ ├── test
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── glh
│ │ │ │ └── cardview
│ │ │ │ └── ExampleUnitTest.java
│ │ └── androidTest
│ │ │ └── java
│ │ │ └── com
│ │ │ └── glh
│ │ │ └── cardview
│ │ │ └── ExampleInstrumentedTest.java
│ ├── proguard-rules.pro
│ ├── build.gradle
│ └── .gitignore
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── build.gradle
├── gradle.properties
├── .gitignore
├── gradlew.bat
└── gradlew
└── README.md
/CardView/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/CardView/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/CardView/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CardView
3 |
4 |
--------------------------------------------------------------------------------
/CardView/app/src/main/res/drawable/q1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/app/src/main/res/drawable/q1.png
--------------------------------------------------------------------------------
/CardView/app/src/main/res/drawable/q2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/app/src/main/res/drawable/q2.png
--------------------------------------------------------------------------------
/CardView/app/src/main/res/drawable/q3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/app/src/main/res/drawable/q3.png
--------------------------------------------------------------------------------
/CardView/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/CardView/app/src/main/res/drawable/main1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/app/src/main/res/drawable/main1.png
--------------------------------------------------------------------------------
/CardView/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/CardView/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/CardView/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/CardView/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/CardView/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinhaiGu/CardView/HEAD/CardView/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/CardView/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/CardView/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/CardView/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 5dip
6 |
7 |
--------------------------------------------------------------------------------
/CardView/app/src/main/res/drawable/backgound.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/CardView/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CardView/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/CardView/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/CardView/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/CardView/app/src/test/java/com/glh/cardview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.glh.cardview;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/CardView/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/CardView/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/CardView/app/src/main/java/com/glh/cardview/util/ListUtil.java:
--------------------------------------------------------------------------------
1 | package com.glh.cardview.util;
2 |
3 | import java.util.List;
4 |
5 |
6 | /**
7 | * List工具类
8 | * Created by glh on 2016/7/21.
9 | *
10 | */
11 | public class ListUtil {
12 |
13 | private ListUtil() {
14 | throw new AssertionError();
15 | }
16 |
17 | /**
18 | * 数据源长度
19 | *
20 | * @param sourceList
21 | * 数据源
22 | * @return
23 | */
24 | public static int getSize(List sourceList) {
25 | return sourceList == null ? 0 : sourceList.size();
26 | }
27 |
28 | /**
29 | * 数据源是否为空
30 | *
31 | * @param sourceList
32 | * @return
33 | */
34 | public static boolean isEmpty(List sourceList) {
35 | return (sourceList == null || sourceList.size() == 0);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/CardView/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/CardView/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in F:\android\adt-bundle-windows-x86_64-20140702\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 |
--------------------------------------------------------------------------------
/CardView/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/CardView/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 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/CardView/app/src/androidTest/java/com/glh/cardview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.glh.cardview;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.glh.cardview", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/CardView/app/src/main/java/com/glh/cardview/util/DensityUtil.java:
--------------------------------------------------------------------------------
1 | package com.glh.cardview.util;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.util.DisplayMetrics;
6 |
7 | public class DensityUtil {
8 |
9 | /**
10 | * dp->px
11 | *
12 | * @param _context context
13 | * @param _dpValue dp
14 | * @return
15 | */
16 | public static float dip2px(Context _context, float _dpValue) {
17 | float scale = _context.getResources().getDisplayMetrics().density;
18 | return _dpValue * scale;
19 | }
20 |
21 | /**
22 | * 获取 DisplayMetrics
23 | *
24 | * @param _context context
25 | * @return DisplayMetrics
26 | */
27 | public static DisplayMetrics getDisplayMetrics(Context _context) {
28 | DisplayMetrics mDisplayMetrics = new DisplayMetrics();
29 | ((Activity) _context).getWindowManager().getDefaultDisplay().getMetrics(mDisplayMetrics);
30 | return mDisplayMetrics;
31 | }
32 |
33 |
34 | }
--------------------------------------------------------------------------------
/CardView/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.0"
6 | defaultConfig {
7 | applicationId "com.glh.cardview"
8 | minSdkVersion 17
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:24.2.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/CardView/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Built application files
3 | *.apk
4 | *.ap_
5 |
6 | # Files for the ART/Dalvik VM
7 | *.dex
8 |
9 | # Java class files
10 | *.class
11 |
12 | # Generated files
13 | bin/
14 | gen/
15 | out/
16 |
17 | # Gradle files
18 | .gradle/
19 | build/
20 |
21 | # Local configuration file (sdk path, etc)
22 | local.properties
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Log Files
28 | *.log
29 |
30 | # Android Studio Navigation editor temp files
31 | .navigation/
32 |
33 | # Android Studio captures folder
34 | captures/
35 |
36 | # Intellij
37 | *.iml
38 | .idea/workspace.xml
39 | .idea/tasks.xml
40 | .idea/gradle.xml
41 | .idea/dictionaries
42 | .idea/libraries
43 |
44 | # Keystore files
45 | *.jks
46 |
47 | # External native build folder generated in Android Studio 2.2 and later
48 | .externalNativeBuild
49 |
50 | # Google Services (e.g. APIs or Firebase)
51 | google-services.json
52 |
53 | # Freeline
54 | freeline.py
55 | freeline/
56 | freeline_project_description.json
--------------------------------------------------------------------------------
/CardView/app/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Built application files
3 | *.apk
4 | *.ap_
5 |
6 | # Files for the ART/Dalvik VM
7 | *.dex
8 |
9 | # Java class files
10 | *.class
11 |
12 | # Generated files
13 | bin/
14 | gen/
15 | out/
16 |
17 | # Gradle files
18 | .gradle/
19 | build/
20 |
21 | # Local configuration file (sdk path, etc)
22 | local.properties
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Log Files
28 | *.log
29 |
30 | # Android Studio Navigation editor temp files
31 | .navigation/
32 |
33 | # Android Studio captures folder
34 | captures/
35 |
36 | # Intellij
37 | *.iml
38 | .idea/workspace.xml
39 | .idea/tasks.xml
40 | .idea/gradle.xml
41 | .idea/dictionaries
42 | .idea/libraries
43 |
44 | # Keystore files
45 | *.jks
46 |
47 | # External native build folder generated in Android Studio 2.2 and later
48 | .externalNativeBuild
49 |
50 | # Google Services (e.g. APIs or Firebase)
51 | google-services.json
52 |
53 | # Freeline
54 | freeline.py
55 | freeline/
56 | freeline_project_description.json
--------------------------------------------------------------------------------
/CardView/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/CardView/app/src/main/res/layout/layout_card.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
18 |
19 |
26 |
27 |
36 |
37 |
45 |
46 |
55 |
56 |
57 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/CardView/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 |
--------------------------------------------------------------------------------
/CardView/app/src/main/java/com/glh/cardview/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.glh.cardview;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.widget.Toast;
8 |
9 | import com.glh.cardview.card.CardGroupView;
10 |
11 | public class MainActivity extends AppCompatActivity {
12 |
13 | private CardGroupView mCardGroupView;
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_main);
19 | initView();
20 | initEvent();
21 | addCard();
22 | }
23 |
24 |
25 | private void initView() {
26 | mCardGroupView = (CardGroupView) findViewById(R.id.card);
27 | mCardGroupView.setLoadSize(3);
28 | mCardGroupView.setMargin(0.15);
29 | }
30 |
31 | private void initEvent() {
32 | mCardGroupView.setLoadMoreListener(new CardGroupView.LoadMore() {
33 | @Override
34 | public void load() {
35 | mCardGroupView.addView(getCard());
36 | mCardGroupView.addView(getCard());
37 | mCardGroupView.addView(getCard());
38 | mCardGroupView.addView(getCard());
39 | mCardGroupView.addView(getCard());
40 | mCardGroupView.addView(getCard());
41 | mCardGroupView.addView(getCard());
42 | mCardGroupView.addView(getCard());
43 | }
44 | });
45 | mCardGroupView.setLeftOrRightListener(new CardGroupView.LeftOrRight() {
46 | @Override
47 | public void leftOrRight(boolean left) {
48 | if (left) {
49 | Toast.makeText(MainActivity.this, "向左滑喜欢!", Toast.LENGTH_SHORT).show();
50 | } else {
51 | Toast.makeText(MainActivity.this, "向右滑不喜欢!", Toast.LENGTH_SHORT).show();
52 | }
53 | }
54 | });
55 | }
56 |
57 | private void addCard() {
58 | mCardGroupView.addView(getCard());
59 | mCardGroupView.addView(getCard());
60 | mCardGroupView.addView(getCard());
61 | mCardGroupView.addView(getCard());
62 | mCardGroupView.addView(getCard());
63 | mCardGroupView.addView(getCard());
64 | mCardGroupView.addView(getCard());
65 | mCardGroupView.addView(getCard());
66 | }
67 |
68 | private View getCard() {
69 | View card = LayoutInflater.from(this).inflate(R.layout.layout_card, null);
70 | View view = card.findViewById(R.id.remove);
71 | view.setOnClickListener(new View.OnClickListener() {
72 | @Override
73 | public void onClick(View v) {
74 | mCardGroupView.removeTopCard(true);
75 | }
76 | });
77 | return card;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CardView
2 |
3 | http://img.blog.csdn.net/20170608203305743?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGFpX3FpbmdfeHVfa29uZw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast
4 |
5 | 
6 |
7 |
8 | CardGroupView控件提供了以下方法:
9 | ```
10 | /**
11 | * 移除顶部卡片(无动画)
12 | */
13 | public void removeTopCard()
14 |
15 | /**
16 | * 移除顶部卡片(有动画)
17 | *
18 | * @param left 向左吗
19 | */
20 | public void removeTopCard(boolean left)
21 |
22 | /**
23 | * 当剩余卡片等于size时,加载更多
24 | */
25 | public void setloadSize(int size)
26 |
27 | /**
28 | * 加载更多监听
29 | *
30 | * @param listener {@link LoadMore}
31 | */
32 | public void setLoadMoreListener(LoadMore listener)
33 |
34 | /**
35 | * 左右滑动监听
36 | *
37 | * @param listener {@link LeftOrRight}
38 | */
39 | public void setLeftOrRightListener(LeftOrRight listener)
40 |
41 |
42 | ```
43 |
44 |
45 | 在Activity中设置CardGroupView并添加卡片:
46 | ```
47 | package com.glh.cardview;
48 |
49 | import android.support.v7.app.AppCompatActivity;
50 | import android.os.Bundle;
51 | import android.view.LayoutInflater;
52 | import android.view.View;
53 | import android.widget.Toast;
54 |
55 | import com.glh.cardview.card.CardGroupView;
56 |
57 | public class MainActivity extends AppCompatActivity {
58 |
59 | private CardGroupView mCardGroupView;
60 |
61 | @Override
62 | protected void onCreate(Bundle savedInstanceState) {
63 | super.onCreate(savedInstanceState);
64 | setContentView(R.layout.activity_main);
65 | initView();
66 | initEvent();
67 | addCard();
68 | }
69 |
70 |
71 | private void initView() {
72 | mCardGroupView = (CardGroupView) findViewById(R.id.card);
73 | mCardGroupView.setloadSize(3);
74 | }
75 |
76 | private void initEvent() {
77 | mCardGroupView.setLoadMoreListener(new CardGroupView.LoadMore() {
78 | @Override
79 | public void load() {
80 | mCardGroupView.addView(getCard());
81 | mCardGroupView.addView(getCard());
82 | mCardGroupView.addView(getCard());
83 | mCardGroupView.addView(getCard());
84 | mCardGroupView.addView(getCard());
85 |
86 | }
87 | });
88 | mCardGroupView.setLeftOrRightListener(new CardGroupView.LeftOrRight() {
89 | @Override
90 | public void leftOrRight(boolean left) {
91 | if (left) {
92 | Toast.makeText(MainActivity.this, "向左滑喜欢!", Toast.LENGTH_SHORT).show();
93 | } else {
94 | Toast.makeText(MainActivity.this, "向右滑不喜欢!", Toast.LENGTH_SHORT).show();
95 | }
96 | }
97 | });
98 | }
99 |
100 | private void addCard() {
101 | mCardGroupView.addView(getCard());
102 | mCardGroupView.addView(getCard());
103 | mCardGroupView.addView(getCard());
104 | mCardGroupView.addView(getCard());
105 | mCardGroupView.addView(getCard());
106 |
107 | }
108 |
109 | private View getCard() {
110 | View card = LayoutInflater.from(this).inflate(R.layout.layout_card, null);
111 | View view = card.findViewById(R.id.remove);
112 | view.setOnClickListener(new View.OnClickListener() {
113 | @Override
114 | public void onClick(View v) {
115 | mCardGroupView.removeTopCard(true);
116 | }
117 | });
118 | return card;
119 | }
120 | }
121 | ```
122 |
--------------------------------------------------------------------------------
/CardView/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 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/CardView/app/src/main/java/com/glh/cardview/card/CardGroupView.java:
--------------------------------------------------------------------------------
1 | package com.glh.cardview.card;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.animation.TypeEvaluator;
6 | import android.animation.ValueAnimator;
7 | import android.content.Context;
8 | import android.util.AttributeSet;
9 | import android.view.MotionEvent;
10 | import android.view.View;
11 | import android.view.animation.AccelerateDecelerateInterpolator;
12 | import android.widget.RelativeLayout;
13 |
14 | import com.glh.cardview.R;
15 | import com.glh.cardview.util.DensityUtil;
16 | import com.glh.cardview.util.ListUtil;
17 |
18 | import java.util.ArrayList;
19 |
20 | /**
21 | * 卡片容器
22 | * Created by glh on 2017-06-08.
23 | */
24 | public class CardGroupView extends RelativeLayout {
25 |
26 | private Context mContext;
27 |
28 | //指定剩余卡片还剩下多少时加载更多
29 | private int mLoadSize = 2;
30 | //是否执行加载更多,加载更多时,卡片依次添加在后面的;而添加卡片时,卡片是依次添加在上面
31 | private boolean isLoadMore = false;
32 | //保存当前容器中的卡片
33 | private ArrayList mCardList = new ArrayList<>();
34 | //加载更多监听器
35 | private LoadMore mLoadMore;
36 | //左右滑动监听器
37 | private LeftOrRight mLeftOrRight;
38 | private double margin = 0.10;
39 |
40 | public CardGroupView(Context context) {
41 | this(context, null);
42 | }
43 |
44 | public CardGroupView(Context context, AttributeSet attrs) {
45 | this(context, attrs, 0);
46 | }
47 |
48 | public CardGroupView(Context context, AttributeSet attrs, int defStyleAttr) {
49 | super(context, attrs, defStyleAttr);
50 | this.mContext = context;
51 | }
52 |
53 | @Override
54 | public void addView(View card) {
55 | if (isLoadMore) {
56 | this.mCardList.add(ListUtil.getSize(mCardList), card);
57 | } else {
58 | this.mCardList.add(card);
59 | }
60 | LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
61 | layoutParams.addRule(RelativeLayout.CENTER_VERTICAL);
62 | this.addView(card, 0, layoutParams);
63 | card.setOnTouchListener(onTouchListener);
64 | if (!isLoadMore) {
65 | this.setLayoutParams(card, mCardList.size());
66 | }
67 |
68 | }
69 |
70 | /**
71 | * 设置卡片LayoutParams
72 | *
73 | * @param card 卡片
74 | */
75 | private void setLayoutParams(View card, int index) {
76 | LayoutParams params = new LayoutParams(card.getLayoutParams());
77 | params.topMargin = (int) (DensityUtil.getDisplayMetrics(mContext).heightPixels * margin) + getResources().getDimensionPixelSize(
78 | R.dimen.card_item_margin) * index;
79 | params.bottomMargin = (int) (DensityUtil.getDisplayMetrics(mContext).heightPixels * margin) - getResources().getDimensionPixelSize(
80 | R.dimen.card_item_margin) * index;
81 | params.leftMargin = (int) (DensityUtil.getDisplayMetrics(mContext).widthPixels * margin);
82 | params.rightMargin = (int) (DensityUtil.getDisplayMetrics(mContext).widthPixels * margin);
83 | card.setLayoutParams(params);
84 | }
85 |
86 | /**
87 | * 每次移除时需要重置剩余卡片的位置
88 | */
89 | private void resetLayoutParams() {
90 | for (int i = 0; i < mCardList.size(); i++) {
91 | setLayoutParams(mCardList.get(i), i);
92 | }
93 | }
94 |
95 | private int mLastY = 0;
96 | private int mLastX = 0;
97 | private int mCardLeft;
98 | private int mCardTop;
99 | private int mCardRight;
100 | private int mCardBottom;
101 | private boolean mLeftOut = false;
102 | private boolean mRightOut = false;
103 | private boolean mOnTouch = true;
104 |
105 | OnTouchListener onTouchListener = new OnTouchListener() {
106 | @Override
107 | public boolean onTouch(View v, MotionEvent event) {
108 | if (mOnTouch && v.equals(mCardList.get(0))) {
109 | int rawY = (int) event.getRawY();
110 | int rawX = (int) event.getRawX();
111 | switch (event.getAction()) {
112 | case MotionEvent.ACTION_DOWN:
113 | getLayout();
114 | mLastY = (int) event.getRawY();
115 | mLastX = (int) event.getRawX();
116 | break;
117 | case MotionEvent.ACTION_MOVE:
118 | int offsetY = rawY - mLastY;
119 | int offsetX = rawX - mLastX;
120 | mCardList.get(0).layout(mCardList.get(0).getLeft() + offsetX, mCardList.get(0).getTop() + offsetY, mCardList.get(0).getRight() + offsetX, mCardList.get(0).getBottom() + offsetY);
121 | mRightOut = mCardList.get(0).getLeft() > DensityUtil.getDisplayMetrics(mContext).widthPixels / 2;
122 | mLeftOut = mCardList.get(0).getRight() < DensityUtil.getDisplayMetrics(mContext).widthPixels / 2;
123 | mLastY = rawY;
124 | mLastX = rawX;
125 | break;
126 | case MotionEvent.ACTION_UP:
127 | change();
128 | break;
129 |
130 | }
131 | }
132 | return true;
133 | }
134 | };
135 |
136 | private void getLayout() {
137 | mCardLeft = mCardList.get(0).getLeft();
138 | mCardTop = mCardList.get(0).getTop();
139 | mCardRight = mCardList.get(0).getRight();
140 | mCardBottom = mCardList.get(0).getBottom();
141 | }
142 |
143 | private void change() {
144 | if (mLeftOut) {
145 | /*
146 | 往左边滑出
147 | */
148 | out(true);
149 | } else if (mRightOut) {
150 | /*
151 | 往右边滑出
152 | */
153 | out(false);
154 |
155 | } else {
156 | //复位
157 | reset();
158 | }
159 | }
160 |
161 | class CardIndex {
162 | int left;
163 | int top;
164 | int right;
165 | int bottom;
166 |
167 | CardIndex(int left, int top, int right, int bottom) {
168 | this.left = left;
169 | this.top = top;
170 | this.right = right;
171 | this.bottom = bottom;
172 | }
173 |
174 | int getLeft() {
175 | return left;
176 | }
177 |
178 | int getTop() {
179 | return top;
180 | }
181 |
182 | int getRight() {
183 | return right;
184 | }
185 |
186 | int getBottom() {
187 | return bottom;
188 | }
189 | }
190 |
191 | class PointEvaluator implements TypeEvaluator {
192 |
193 | @Override
194 | public Object evaluate(float fraction, Object startValue, Object endValue) {
195 | CardIndex startPoint = (CardIndex) startValue;
196 | CardIndex endPoint = (CardIndex) endValue;
197 | int left = (int) (startPoint.getLeft() + fraction * (endPoint.getLeft() - startPoint.getLeft()));
198 | int top = (int) (startPoint.getTop() + fraction * (endPoint.getTop() - startPoint.getTop()));
199 | int right = (int) (startPoint.getRight() + fraction * (endPoint.getRight() - startPoint.getRight()));
200 | int bottom = (int) (startPoint.getBottom() + fraction * (endPoint.getBottom() - startPoint.getBottom()));
201 | return new CardIndex(left, top, right, bottom);
202 | }
203 |
204 | }
205 |
206 | /**
207 | * 卡片复位
208 | */
209 | private void reset() {
210 | CardIndex oldCardIndex = new CardIndex(mCardLeft, mCardTop, mCardRight, mCardBottom);
211 | CardIndex newCardIndex = new CardIndex(mCardList.get(0).getLeft(), mCardList.get(0).getTop(), mCardList.get(0).getRight(), mCardList.get(0).getBottom());
212 | animator(newCardIndex, oldCardIndex);
213 | }
214 |
215 | /**
216 | * 卡片滑出
217 | *
218 | * @param left 是否向左滑出
219 | */
220 | private void out(boolean left) {
221 | if (left) {
222 | /*
223 | 向左滑出
224 | */
225 | leftOut();
226 | } else {
227 | /*
228 | 向右滑出
229 | */
230 | rightOut();
231 | }
232 | }
233 |
234 | /**
235 | * 左滑出
236 | */
237 | private void leftOut() {
238 | CardIndex oldCardIndex = new CardIndex(-mCardRight, mCardTop, 0, mCardBottom);
239 | CardIndex newCardIndex = new CardIndex(mCardList.get(0).getLeft(), mCardList.get(0).getTop(), mCardList.get(0).getRight(), mCardList.get(0).getBottom());
240 | animator(newCardIndex, oldCardIndex);
241 | }
242 |
243 | /**
244 | * 右滑出
245 | */
246 | private void rightOut() {
247 | CardIndex oldCardIndex = new CardIndex(DensityUtil.getDisplayMetrics(mContext).widthPixels, mCardTop, DensityUtil.getDisplayMetrics(mContext).widthPixels + (mCardRight - mCardLeft), mCardBottom);
248 | CardIndex newCardIndex = new CardIndex(mCardList.get(0).getLeft(), mCardList.get(0).getTop(), mCardList.get(0).getRight(), mCardList.get(0).getBottom());
249 | animator(newCardIndex, oldCardIndex);
250 | }
251 |
252 | private void animator(CardIndex newCard, CardIndex oldCard) {
253 |
254 | ValueAnimator animator = ValueAnimator.ofObject(new PointEvaluator(), newCard, oldCard);
255 | animator.setDuration(200);
256 | animator.setInterpolator(new AccelerateDecelerateInterpolator());
257 | animator
258 | .addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
259 | @Override
260 | public void onAnimationUpdate(ValueAnimator animation) {
261 | mOnTouch = false;
262 | CardIndex value = (CardIndex) animation.getAnimatedValue();
263 | mCardList.get(0).layout(value.left, value.top, value.right, value.bottom);
264 | }
265 | });
266 | animator.addListener(new AnimatorListenerAdapter() {
267 | @Override
268 | public void onAnimationEnd(Animator animation) {
269 | if (mRightOut || mLeftOut) {
270 | removeTopCard();
271 | if (mLeftOrRight != null) {
272 | mLeftOrRight.leftOrRight(mLeftOut);
273 | }
274 | }
275 | mOnTouch = true;
276 | }
277 | });
278 | animator.start();
279 | }
280 |
281 |
282 | /**
283 | * 移除顶部卡片(无动画)
284 | */
285 | public void removeTopCard() {
286 | if (!ListUtil.isEmpty(this.mCardList)) {
287 | removeView(this.mCardList.remove(0));
288 | if (mCardList.size() == mLoadSize) {
289 | if (mLoadMore != null) {
290 | this.isLoadMore = true;
291 | this.mLoadMore.load();
292 | this.isLoadMore = false;
293 | this.resetLayoutParams();
294 | }
295 | }
296 |
297 | }
298 | }
299 |
300 | /**
301 | * 移除顶部卡片(有动画)
302 | *
303 | * @param left 向左吗
304 | */
305 | public void removeTopCard(boolean left) {
306 | if (this.mOnTouch) {
307 | this.mLeftOut = left;
308 | this.mRightOut = !this.mLeftOut;
309 | this.getLayout();
310 | this.out(left);
311 | }
312 | }
313 |
314 | /**
315 | * 当剩余卡片等于size时,加载更多
316 | */
317 | public void setLoadSize(int size) {
318 | this.mLoadSize = size;
319 | }
320 |
321 | /**
322 | * 距离左右上下边距的边距(屏幕宽度的百分比)
323 | *
324 | * @param margin 屏幕宽度的百分比
325 | */
326 | public void setMargin(double margin) {
327 | this.margin = margin;
328 | }
329 |
330 | /**
331 | * 加载更多监听
332 | *
333 | * @param listener {@link LoadMore}
334 | */
335 | public void setLoadMoreListener(LoadMore listener) {
336 | this.mLoadMore = listener;
337 | }
338 |
339 | /**
340 | * 左右滑动监听
341 | *
342 | * @param listener {@link LeftOrRight}
343 | */
344 | public void setLeftOrRightListener(LeftOrRight listener) {
345 | this.mLeftOrRight = listener;
346 | }
347 |
348 | public interface LoadMore {
349 | void load();
350 | }
351 |
352 | public interface LeftOrRight {
353 | void leftOrRight(boolean left);
354 | }
355 |
356 | }
357 |
--------------------------------------------------------------------------------