├── TestApp ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── layout │ │ │ ├── item_multilevel1.xml │ │ │ └── activity_main.xml │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ └── drawable │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ └── com │ │ │ └── ljx │ │ │ └── test │ │ │ ├── model │ │ │ ├── ClassC.java │ │ │ ├── ClassB.java │ │ │ ├── ClassA.java │ │ │ └── ClassD.java │ │ │ ├── adapter │ │ │ └── MultiLevelTestAdapter.java │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml ├── build.gradle └── proguard-rules.pro ├── multilevellist_lib ├── .gitignore ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── lijianxun │ │ └── multilevellist │ │ ├── model │ │ └── MultiLevelModel.java │ │ ├── adapter │ │ └── MultiLevelAdapter.java │ │ └── util │ │ └── MultiLevelHelper.java ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── multilevellist-v1.0.jar ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── image ├── MultiLevelLibrary讨论群群二维码.png ├── 329A5551F8D475A0BAF7F2036B85046B.jpg ├── 5B1D355AA5E1DAFFC1CDE98A9F9E0E59.jpg ├── 80377AD8D54B09D5574FFF0DA75B61F7.png └── C1D99830DC2142387181396BF25B1C59.png ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /TestApp/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /multilevellist_lib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':multilevellist_lib', ':TestApp' 2 | -------------------------------------------------------------------------------- /multilevellist-v1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/multilevellist-v1.0.jar -------------------------------------------------------------------------------- /TestApp/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 测试app 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /multilevellist_lib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 多级列表库 3 | 4 | -------------------------------------------------------------------------------- /image/MultiLevelLibrary讨论群群二维码.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/image/MultiLevelLibrary讨论群群二维码.png -------------------------------------------------------------------------------- /image/329A5551F8D475A0BAF7F2036B85046B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/image/329A5551F8D475A0BAF7F2036B85046B.jpg -------------------------------------------------------------------------------- /image/5B1D355AA5E1DAFFC1CDE98A9F9E0E59.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/image/5B1D355AA5E1DAFFC1CDE98A9F9E0E59.jpg -------------------------------------------------------------------------------- /image/80377AD8D54B09D5574FFF0DA75B61F7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/image/80377AD8D54B09D5574FFF0DA75B61F7.png -------------------------------------------------------------------------------- /image/C1D99830DC2142387181396BF25B1C59.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/image/C1D99830DC2142387181396BF25B1C59.png -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /multilevellist_lib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JianxunMaster/MultiLevelLibrary/HEAD/TestApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TestApp/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Nov 01 14:42:27 CST 2017 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-4.1-all.zip 7 | -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TestApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TestApp/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /TestApp/src/main/res/layout/item_multilevel1.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 | -------------------------------------------------------------------------------- /TestApp/src/main/java/com/ljx/test/model/ClassC.java: -------------------------------------------------------------------------------- 1 | package com.ljx.test.model; 2 | 3 | import com.lijianxun.multilevellist.model.MultiLevelModel; 4 | 5 | /** 6 | * Created by windows on 2017/12/28. 7 | */ 8 | 9 | public class ClassC extends MultiLevelModel { 10 | private String name; 11 | 12 | public ClassC(String name) { 13 | this.name = name; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /TestApp/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /multilevellist_lib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | group='com.github.JianxunMaster' 4 | android { 5 | compileSdkVersion 26 6 | buildToolsVersion "26" 7 | 8 | 9 | defaultConfig { 10 | minSdkVersion 15 11 | targetSdkVersion 26 12 | versionCode 2 13 | versionName "1.02" 14 | } 15 | 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | compile fileTree(dir: 'libs', include: ['*.jar']) 26 | } 27 | -------------------------------------------------------------------------------- /TestApp/src/main/java/com/ljx/test/model/ClassB.java: -------------------------------------------------------------------------------- 1 | package com.ljx.test.model; 2 | 3 | import com.lijianxun.multilevellist.model.MultiLevelModel; 4 | 5 | /** 6 | * Created by windows on 2017/12/28. 7 | */ 8 | 9 | public class ClassB extends MultiLevelModel { 10 | private int id; 11 | private String label; 12 | 13 | public ClassB(int id, String label) { 14 | this.id = id; 15 | this.label = label; 16 | } 17 | 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | public String getLabel() { 27 | return label; 28 | } 29 | 30 | public void setLabel(String label) { 31 | this.label = label; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /TestApp/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | buildToolsVersion "26.0.0" 6 | 7 | defaultConfig { 8 | applicationId "com.ljx.test" 9 | minSdkVersion 15 10 | targetSdkVersion 26 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 | compile project(':multilevellist_lib') 26 | compile 'com.android.support:appcompat-v7:26.0.0-alpha1' 27 | } 28 | -------------------------------------------------------------------------------- /TestApp/src/main/java/com/ljx/test/model/ClassA.java: -------------------------------------------------------------------------------- 1 | package com.ljx.test.model; 2 | 3 | import com.lijianxun.multilevellist.model.MultiLevelModel; 4 | 5 | /** 6 | * Created by windows on 2017/12/28. 7 | */ 8 | 9 | public class ClassA extends MultiLevelModel { 10 | private int id; 11 | private String name; 12 | 13 | public ClassA(int id, String name) { 14 | this.id = id; 15 | this.name = name; 16 | } 17 | 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /TestApp/src/main/java/com/ljx/test/model/ClassD.java: -------------------------------------------------------------------------------- 1 | package com.ljx.test.model; 2 | 3 | import com.lijianxun.multilevellist.model.MultiLevelModel; 4 | 5 | /** 6 | * Created by windows on 2017/12/28. 7 | */ 8 | 9 | public class ClassD extends MultiLevelModel { 10 | private String name; 11 | private String label; 12 | 13 | public ClassD(String name, String label) { 14 | this.name = name; 15 | this.label = label; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | 26 | public String getLabel() { 27 | return label; 28 | } 29 | 30 | public void setLabel(String label) { 31 | this.label = label; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /TestApp/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /TestApp/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /multilevellist_lib/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /multilevellist_lib/src/main/java/com/lijianxun/multilevellist/model/MultiLevelModel.java: -------------------------------------------------------------------------------- 1 | package com.lijianxun.multilevellist.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * 多级列表模型 8 | * Created by windows on 2017/12/28. 9 | */ 10 | 11 | public class MultiLevelModel { 12 | private boolean isExpand;//是否展开 13 | private List children;//子类 14 | private int level;//层级 15 | private String label; 16 | public int getLevel() { 17 | return level; 18 | } 19 | 20 | public void setLevel(int level) { 21 | this.level = level; 22 | } 23 | 24 | public boolean isExpand() { 25 | return isExpand; 26 | } 27 | 28 | public void setExpand(boolean expand) { 29 | isExpand = expand; 30 | } 31 | 32 | public List getChildren() { 33 | if (children == null) { 34 | children = new ArrayList<>(); 35 | } 36 | return children; 37 | } 38 | 39 | public void setChildren(List children) { 40 | this.children = children; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /TestApp/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /TestApp/src/main/java/com/ljx/test/adapter/MultiLevelTestAdapter.java: -------------------------------------------------------------------------------- 1 | package com.ljx.test.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.TextView; 7 | 8 | import com.lijianxun.multilevellist.adapter.MultiLevelAdapter; 9 | import com.lijianxun.multilevellist.model.MultiLevelModel; 10 | import com.ljx.test.R; 11 | import com.ljx.test.model.ClassA; 12 | import com.ljx.test.model.ClassB; 13 | import com.ljx.test.model.ClassC; 14 | import com.ljx.test.model.ClassD; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * Created by windows on 2017/12/29. 20 | */ 21 | 22 | public class MultiLevelTestAdapter extends MultiLevelAdapter { 23 | 24 | 25 | public MultiLevelTestAdapter(Context context, boolean isExpandable, boolean isExpandAll 26 | , int expandLevel) { 27 | super(context, isExpandable, isExpandAll, expandLevel); 28 | } 29 | 30 | @Override 31 | public View onCreateView(int position, View convertView, ViewGroup parent) { 32 | Holder v = null; 33 | if (convertView == null) { 34 | convertView = mInflater.inflate(R.layout.item_multilevel1, null); 35 | v = new Holder(convertView); 36 | convertView.setTag(v); 37 | } else { 38 | v = (Holder) convertView.getTag(); 39 | } 40 | MultiLevelModel model = (MultiLevelModel) getItem(position); 41 | switch (model.getLevel()) { 42 | case 0: 43 | ClassA a = (ClassA) model; 44 | v.tv.setText(position + a.getName()); 45 | break; 46 | case 1: 47 | ClassB b = (ClassB) model; 48 | v.tv.setText(position + b.getLabel()); 49 | break; 50 | case 2: 51 | ClassC c = (ClassC) model; 52 | v.tv.setText(position + c.getName()); 53 | break; 54 | case 3: 55 | ClassD d = (ClassD) model; 56 | v.tv.setText(position + d.getName()); 57 | break; 58 | } 59 | convertView.setPadding(10 + model.getLevel() * 50, 10, 10, 10); 60 | return convertView; 61 | } 62 | 63 | class Holder { 64 | TextView tv; 65 | 66 | public Holder(View view) { 67 | tv = (TextView) view.findViewById(R.id.tv); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /TestApp/src/main/java/com/ljx/test/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.ljx.test; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.View; 7 | import android.widget.AdapterView; 8 | import android.widget.ListView; 9 | import android.widget.Toast; 10 | 11 | import com.lijianxun.multilevellist.adapter.MultiLevelAdapter; 12 | import com.lijianxun.multilevellist.model.MultiLevelModel; 13 | import com.ljx.test.adapter.MultiLevelTestAdapter; 14 | import com.ljx.test.model.ClassA; 15 | import com.ljx.test.model.ClassB; 16 | import com.ljx.test.model.ClassC; 17 | import com.ljx.test.model.ClassD; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | public class MainActivity extends AppCompatActivity { 23 | ListView listView; 24 | List list = new ArrayList<>(); 25 | MultiLevelTestAdapter adapter; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.activity_main); 31 | listView = (ListView) findViewById(R.id.listView); 32 | int count = 0; 33 | for (int i = 0; i < 3; i++) { 34 | ClassA a = new ClassA(i, " A" + i); 35 | a.setChildren(new ArrayList()); 36 | list.add(a); 37 | count += 1; 38 | Log.e("TAG 1", a.getName()); 39 | for (int j = 0; j < 3; j++) { 40 | ClassB b = new ClassB(j, " A" + i + " B" + j); 41 | a.getChildren().add(b); 42 | count += 1; 43 | Log.e("TAG 2", b.getLabel()); 44 | for (int k = 0; k < 3; k++) { 45 | ClassC c = new ClassC(" A" + i + " B" + j + " C" + k); 46 | b.getChildren().add(c); 47 | count += 1; 48 | Log.e("TAG 3", c.getName()); 49 | for (int l = 0; l < 3; l++) { 50 | ClassD d = new ClassD(" A" + i + " B" + j + " C" + k + " D" + l 51 | , "D"); 52 | c.getChildren().add(d); 53 | count += 1; 54 | Log.e("TAG 4", d.getName()); 55 | } 56 | } 57 | } 58 | } 59 | Log.e("count", "= " + count); 60 | adapter = new MultiLevelTestAdapter(this, true, false 61 | , 1); 62 | adapter.setOnMultiLevelListener(new MultiLevelAdapter.OnMultiLevelListener() { 63 | @Override 64 | public void onItemClick(AdapterView parent, View view, int position, long id 65 | , MultiLevelModel current, MultiLevelModel max) { 66 | Toast.makeText(MainActivity.this, "position = " + position + "" + 67 | " , current level = " + current.getLevel() + " , outside level = " 68 | + max.getLevel() 69 | , Toast.LENGTH_SHORT).show(); 70 | } 71 | }); 72 | listView.setOnItemClickListener(adapter); 73 | listView.setAdapter(adapter); 74 | adapter.setList(list); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /multilevellist_lib/src/main/java/com/lijianxun/multilevellist/adapter/MultiLevelAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lijianxun.multilevellist.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.AdapterView; 8 | import android.widget.AdapterView.OnItemClickListener; 9 | import android.widget.BaseAdapter; 10 | 11 | import com.lijianxun.multilevellist.model.MultiLevelModel; 12 | import com.lijianxun.multilevellist.util.MultiLevelHelper; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * 安卓多级列表适配器 18 | * 1级列表、2级列表、3级列表、4级列表、5级列表、多级列表 19 | * 一级列表、二级列表、三级列表、四级列表、五级列表、多级列表 20 | * android multilevel adapter 21 | * 可伸缩可展开 22 | * Created by windows on 2017/12/28. 23 | */ 24 | 25 | public abstract class MultiLevelAdapter extends BaseAdapter 26 | implements OnItemClickListener { 27 | protected Context mContext; 28 | protected LayoutInflater mInflater; 29 | protected List mList; 30 | protected boolean mExpandable;//是否能伸展 31 | protected boolean mExpandAll;//是否全部展开 32 | protected int mExpandLevel; 33 | protected OnMultiLevelListener mListener; 34 | /** 35 | *@param context 上下文 36 | *@param isExpandable 子列表能否伸展、伸缩 37 | *@param isExpandAll 是否展开所有 38 | *@param expandLevel 展开层级数 39 | */ 40 | public MultiLevelAdapter(Context context, boolean isExpandable, boolean isExpandAll 41 | , int expandLevel) { 42 | mContext = context; 43 | mExpandable = isExpandable; 44 | mExpandAll = isExpandAll; 45 | mExpandLevel = expandLevel < 0 ? 0 : expandLevel; 46 | mInflater = LayoutInflater.from(context); 47 | } 48 | 49 | public void setList(List list) { 50 | if (list == null) return; 51 | mList = list; 52 | MultiLevelHelper.setLevel(mList, 0); 53 | if (!mExpandable || mExpandAll) {//如果不能伸展,展开全部 54 | MultiLevelHelper.setExpandAll(mList); 55 | } else { 56 | MultiLevelHelper.setExpandableByLevel(mList, 0, mExpandLevel); 57 | } 58 | notifyDataSetChanged(); 59 | } 60 | 61 | @Override 62 | public int getCount() { 63 | return mList == null ? 0 : MultiLevelHelper.getCount(mList); 64 | } 65 | 66 | 67 | @Override 68 | public Object getItem(int position) { 69 | return MultiLevelHelper.getItem(mList, 0, position); 70 | } 71 | 72 | @Override 73 | public long getItemId(int position) { 74 | return position; 75 | } 76 | 77 | @Override 78 | public View getView(int position, View convertView, ViewGroup parent) { 79 | return onCreateView(position, convertView, parent); 80 | } 81 | 82 | public abstract View onCreateView(int position, View convertView, ViewGroup parent); 83 | 84 | 85 | /** 86 | * ListView实现此监听才能伸展。eg:listView.setOnItemClickListener(adapter); 87 | */ 88 | @Override 89 | public void onItemClick(AdapterView parent, View view, int position, long id) { 90 | T item = (T) getItem(position); 91 | if (mListener != null) { 92 | T outside = (T) MultiLevelHelper.getItemOutside(mList, 0, position); 93 | mListener.onItemClick(parent, view, position, id, item, outside); 94 | } 95 | if (!mExpandable) {//如果不能伸展,不需要处理 96 | return; 97 | } 98 | item.setExpand(!item.isExpand()); 99 | notifyDataSetChanged(); 100 | } 101 | 102 | public void setOnMultiLevelListener(OnMultiLevelListener listener) { 103 | mListener = listener; 104 | } 105 | 106 | public interface OnMultiLevelListener { 107 | void onItemClick(AdapterView parent, View view, int position, long id 108 | , MultiLevelModel current, MultiLevelModel outside); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /multilevellist_lib/src/main/java/com/lijianxun/multilevellist/util/MultiLevelHelper.java: -------------------------------------------------------------------------------- 1 | package com.lijianxun.multilevellist.util; 2 | 3 | import com.lijianxun.multilevellist.model.MultiLevelModel; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 多级列表工具类 9 | * Created by windows on 2017/12/28. 10 | */ 11 | 12 | public class MultiLevelHelper { 13 | 14 | /** 15 | * 递归算法,求所有子对象的总和 16 | * 17 | * @param list 18 | * @return 19 | */ 20 | public static int getCount(List list) { 21 | int count = 0; 22 | for (int i = 0; i < list.size(); i++) { 23 | T t = list.get(i); 24 | count++; 25 | if (t.isExpand()) { 26 | count += getCount(t.getChildren()); 27 | } 28 | } 29 | return count; 30 | } 31 | 32 | 33 | /** 34 | * 递归算法,求第n个位置的对象 35 | * 36 | * @param list 37 | * @param curPosition 起始位置 38 | * @param tarPosition 所求位置 39 | * @param 40 | * @return position相等时返回对象,否则返回数量 41 | */ 42 | public static Object getItem(List list, int curPosition 43 | , int tarPosition) { 44 | int count = 0; 45 | for (int i = 0; i < list.size(); i++) { 46 | T t = list.get(i); 47 | if (count + curPosition == tarPosition) {//位置相同,返回 48 | return t; 49 | } 50 | count++; 51 | if (t.isExpand()) {//可展开,执行下一个循环 52 | Object result = getItem(t.getChildren(), count + curPosition, tarPosition);//递归 53 | if (result instanceof Integer) { 54 | count += (int) result; 55 | } else { 56 | return result; 57 | } 58 | } 59 | } 60 | return count;//所有循环结束,如果还没有position相等,返回空给上一级。 61 | } 62 | 63 | /** 64 | * 递归算法,求第n个位置最外层的对象 65 | * 66 | * @param list 67 | * @param curPosition 起始位置 68 | * @param tarPositon 所求位置 69 | * @param 70 | * @return 71 | */ 72 | public static Object getItemOutside(List list, int curPosition 73 | , int tarPositon) { 74 | int count = 0; 75 | for (int i = 0; i < list.size(); i++) { 76 | T t = list.get(i); 77 | if (count + curPosition == tarPositon) {//位置相同,返回 78 | return t; 79 | } 80 | count++; 81 | if (t.isExpand()) {//可展开,执行下一个循环 82 | Object result = getItem(t.getChildren(), count + curPosition, tarPositon);//递归 83 | if (result instanceof Integer) { 84 | count += (int) result; 85 | } else { 86 | return t; 87 | } 88 | } 89 | } 90 | return count;//所有循环结束,如果还没有position相等,返回空给上一级。 91 | } 92 | 93 | /** 94 | * 展开层级 95 | * 96 | * @param list 97 | * @param expandLevel 98 | * @param 99 | */ 100 | public static void setExpandableByLevel(List list, int curLevel 101 | , int expandLevel) { 102 | for (int i = 0; i < list.size(); i++) { 103 | T t = list.get(i); 104 | t.setExpand(curLevel < expandLevel); 105 | setExpandableByLevel(t.getChildren(), curLevel + 1, expandLevel); 106 | } 107 | } 108 | 109 | /** 110 | * 展开所有层级 111 | * 112 | * @param list 113 | * @param 114 | */ 115 | public static void setExpandAll(List list) { 116 | for (int i = 0; i < list.size(); i++) { 117 | T t = list.get(i); 118 | t.setExpand(true); 119 | setExpandAll(t.getChildren()); 120 | } 121 | } 122 | 123 | /** 124 | * 设置层级 125 | * 126 | * @param list 127 | * @param curLevel 128 | * @param 129 | */ 130 | public static void setLevel(List list, int curLevel) { 131 | for (int i = 0; i < list.size(); i++) { 132 | T t = list.get(i); 133 | t.setLevel(curLevel); 134 | setLevel(t.getChildren(), curLevel + 1); 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MultiLevelLibrary 2 | RecyclerView适配器请移步我的另一个仓库[TreeNodeLibrary](https://github.com/JianxunMaster/TreeNodeLibrary) 3 | ## ※github新手上路,如果不能下载,请加群讨论更新。 4 | ## ※新添加multilevellist-v1.0.jar可直接使用(包含treenode和multilevel) 5 | ## 思路 6 | 普通列表:ListView适配器包含四个重写方法。其中,getCount指列表长度或,getView指item的布局和显示,一般列表写好这两个就ok。 7 | 多级列表:数据对象一般是大数据集合,大数据包含小数据集合,小数据包含小小数据集合···  一般情况的处理方式有这几种:   8 | ### 1)使用二级列表,子项通过addView的方式添加三级数据布局 9 | (缺点:此方法每次滑动都要重新加载布局,影响性能,且只适用于3级列表,越多级越难写。)   10 | ### 2)使用二级列表,子项设置子列表 11 | (缺点:二级列表嵌套列表,增加了数据处理难度,适配器难设置,二级列表设置易出问题,且只适用于3级列表) 12 | ### 3)使用一级列表,树节点结构模式,通过对象父类、对象子集、对象层级设置 13 | (优点:可适用于多级列表,适配器易于维护,数据结构清晰。缺点:数据结构需要指定类型,如:父类id,自己id。)网上有封装好的库,比较好用,数据结构合适的推荐使用。 14 | ### 4)使用一级列表:数据嵌套计算结构模式,通过计算设置getcount和getView对应对象进行适配 15 | (优点:数据无需处理,操作简单。缺点:计算复杂)本文强烈推荐使用,已经封装,可直接使用。 16 | ## 对比: 17 | 1和2都差不多,不好用。3和4高大上,3需要满足树节点:有父类id和自己id,4需要满足嵌套,比较通用(一般数据都是嵌套,除非后台够叼,已经帮你算好) 18 | ## 总结: 19 | 简单的三级列表,无差别,推进使用4方法,操作简单。树节点模式使用3方法。嵌套结构使用4方法。 20 | ## (*╹▽╹*): 21 | 担心算错?不用怕,已经算好了并封装。本文详细介绍4方法及使用。 22 | ## 先上图   23 | 截屏1 截屏2 25 | 26 | ## 简单使用 27 | 28 | ### 1.引用依赖库 29 | 30 | #### 1)源码下载 31 | 32 | 下载压缩包解压到本地,导入开发工具 33 | 34 | #### 2)快速导入 35 | [![](https://jitpack.io/v/JianxunMaster/MultiLevelLibrary.svg)](https://jitpack.io/#JianxunMaster/MultiLevelLibrary) 36 | ##### 1.2.1 在project的build.gradle文件中添加 37 | 38 | allprojects { 39 | repositories { 40 | ... 41 | maven { url 'https://jitpack.io' } 42 | } 43 | } 44 | 45 | ##### 1.2.2 在module的build.gradle中添加version以最新版本为准,例如当前version为1.0.2 46 | 47 | dependencies { 48 | compile 'com.github.JianxunMaster:MultiLevelLibrary:version' 49 | } 50 | 51 | ### 2.在xml中使用ListView 52 | 53 | v1.0.0版还没有RecyclerView的适配 54 | 55 | ### 3.数据bean继承MultiLevelModel使得相互嵌套 56 | 57 | public class ClassA extends MultiLevelModel 58 | 59 | ### 4.适配器继承MultiLevelAdapter重写onCreateView方法 60 | 61 | public class MultiLevelTestAdapter extends MultiLevelAdapter 62 | 63 | 64 | ### 5.设置适配器 65 | 66 | adapter = new MultiLevelTestAdapter(this, true, false 67 | , 1); 68 | adapter.setOnMultiLevelListener(new MultiLevelAdapter.OnMultiLevelListener() { 69 | @Override 70 | public void onItemClick(AdapterView parent, View view, int position, long id 71 | , MultiLevelModel current, MultiLevelModel max) { 72 | Toast.makeText(MainActivity.this, "position = " + position + "" + 73 | " , current level = " + current.getLevel() + " , outside level = " 74 | + max.getLevel() 75 | , Toast.LENGTH_SHORT).show(); 76 | } 77 | }); 78 | listView.setOnItemClickListener(adapter); 79 | listView.setAdapter(adapter); 80 | adapter.setList(list); 81 | 82 | ### 6.数据结构嵌套  83 | 84 | #### 1)继承MultiLevelModel,添加泛型,字段赋值使用@JSONField(name = "json字段")<建议使用fastjson可以快速解析,把json字段解析成children字段> 85 | 86 | public class Model extends MultiLevelModel<子集泛型>{ 87 | @JSONField(name = "json字段名") 88 | @Override 89 | public void setChildren(List<子集泛型> children) { 90 | super.setChildren(children); 91 | } 92 | } 93 | 94 | 95 | #### 2)示例数据如下: 96 | 97 | for (int i = 0; i < 3; i++) { 98 | ClassA classA = new ClassA(i, " A" + i); 99 | classA.setChildren(new ArrayList()); 100 | list.add(classA); 101 | count += 1; 102 | for (int j = 0; j < 3; j++) { 103 | ClassB classB = new ClassB(j, " A" + i + " B" + j); 104 | classA.getChildren().add(classB); 105 | count += 1; 106 | for (int k = 0; k < 3; k++) { 107 | ClassC classC = new ClassC(" A" + i + " B" + j + " C" + k); 108 | classB.getChildren().add(classC); 109 | count += 1; 110 | for (int l = 0; l < 3; l++) { 111 | ClassD classD = new ClassD(" A" + i + " B" + j + " C" + k + " D" + l 112 | , "D"); 113 | classC.getChildren().add(classD); 114 | count += 1; 115 | } 116 | } 117 | } 118 | } 119 | ## 已添加jar包multilevellist-v1.0.jar,可出来treenode和multilevel两种数据格式 120 | 121 | ## QQ群464635057 欢迎加群讨论 扫码加群,群文件有jar包,jar包包含treenode 122 |
群二维码
123 | 124 | ## 大哥大姐觉得好用的打点赏,一点心意作鼓励 125 | 126 |
127 | 微信扫码打赏 128 | 支付宝扫码打赏 129 |
130 | 131 | ## 此库持续更新中···加油~~~~(>_<)~~~~ 132 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /TestApp/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 16 | 21 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 172 | --------------------------------------------------------------------------------