├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── libraries │ ├── appcompat_v7_19_1_0.xml │ ├── support_v4_19_1_0.xml │ └── gson_2_3_1.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml ├── misc.xml └── workspace.xml ├── settings.gradle ├── 软件截图 ├── 2016_2_22.1.png ├── 2016_2_22.3.png └── SurperTableUI2.gif ├── app ├── src │ └── main │ │ ├── res │ │ ├── drawable │ │ │ ├── bg.jpg │ │ │ ├── Thumbs.db │ │ │ ├── name.png │ │ │ ├── type.png │ │ │ ├── week.png │ │ │ ├── address.png │ │ │ ├── teacher.png │ │ │ ├── arrow_down.png │ │ │ ├── pop_bg.9.png │ │ │ ├── course.xml │ │ │ ├── shape_progress.xml │ │ │ ├── boder.xml │ │ │ ├── listbg.xml │ │ │ └── listtext.xml │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── layout │ │ │ ├── font_color.xml │ │ │ ├── changweek_layout.xml │ │ │ ├── item.xml │ │ │ ├── details_layout.xml │ │ │ └── supertable.xml │ │ ├── values │ │ │ ├── font_color.xml │ │ │ ├── dimens.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── values-v11 │ │ │ └── styles.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ ├── values-v14 │ │ │ └── styles.xml │ │ └── menu │ │ │ └── main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── jay │ │ └── surpertableui │ │ ├── CourseBean.java │ │ └── MainActivity.java └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── .gitignore ├── gradlew.bat ├── gradlew └── import-summary.txt /.idea/.name: -------------------------------------------------------------------------------- 1 | SurperTableUI -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /软件截图/2016_2_22.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/软件截图/2016_2_22.1.png -------------------------------------------------------------------------------- /软件截图/2016_2_22.3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/软件截图/2016_2_22.3.png -------------------------------------------------------------------------------- /软件截图/SurperTableUI2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/软件截图/SurperTableUI2.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable/bg.jpg -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable/Thumbs.db -------------------------------------------------------------------------------- /app/src/main/res/drawable/name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable/name.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable/type.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/week.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable/week.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/address.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable/address.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/teacher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable/teacher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable/arrow_down.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/pop_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable/pop_bg.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CB2Git/ScheduleUI/HEAD/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/course.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/font_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6291B4 4 | #A6CEDA 5 | #ffffff 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/font_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6291B4 4 | #A6CEDA 5 | #ffffff 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/boder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 21 11:34:03 PDT 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.8-all.zip 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/listbg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/listtext.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/changweek_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 25dp 7 | 25dp 8 | 55dp 9 | 500dp 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_19_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_19_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/libraries/gson_2_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.jay.surpertableui" 9 | minSdkVersion 8 10 | targetSdkVersion 19 11 | } 12 | 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.android.support:support-v4:19.1.0' 23 | compile 'com.google.code.gson:gson:2.3.1' 24 | compile 'com.android.support:appcompat-v7:19.1.0' 25 | } 26 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 仿超级课程表UI 2 | > 仿照超级课程表UI,实现课程的表格布局与切换,课程数据来自string.xml中的课程json字符串 3 | 4 | ### 软件截图 5 | 6 | - 图片一 7 | 8 | ![软件UI1][1] 9 | 10 | - 图片二 11 | 12 | ![软件UI2][2] 13 | 14 | - 图片三 15 | 16 | ![UI动态图][3] 17 | 18 | ### 具体实现+获取教务处课程数据 19 | [博客地址][4] 20 | 21 | ### 关于我 22 | 23 | [我的网址][5] 24 | 25 | 26 | [1]: https://github.com/CB2Git/ScheduleUI/blob/master/%E8%BD%AF%E4%BB%B6%E6%88%AA%E5%9B%BE/2016_2_22.1.png?raw=true 27 | [2]: https://github.com/CB2Git/ScheduleUI/blob/master/%E8%BD%AF%E4%BB%B6%E6%88%AA%E5%9B%BE/2016_2_22.3.png?raw=true 28 | [3]: https://github.com/CB2Git/ScheduleUI/blob/master/%E8%BD%AF%E4%BB%B6%E6%88%AA%E5%9B%BE/SurperTableUI2.gif?raw=true 29 | [4]: http://www.27house.cn/tag/%E8%B6%85%E7%BA%A7%E8%AF%BE%E7%A8%8B%E8%A1%A8/ 30 | [5]: http://www.27house.cn 31 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### Android template 2 | # Built application files 3 | 4 | # Files for the Dalvik VM 5 | 6 | # Java class files 7 | 8 | # Generated files 9 | 10 | # Gradle files 11 | 12 | # Local configuration file (sdk path, etc) 13 | 14 | # Proguard folder generated by Eclipse 15 | 16 | # Log Files 17 | 18 | # Android Studio Navigation editor temp files 19 | 20 | # Android Studio captures folder 21 | 22 | # Intellij 23 | 24 | # Keystore files 25 | ### Android template 26 | # Built application files 27 | *.apk 28 | *.ap_ 29 | 30 | # Files for the Dalvik VM 31 | *.dex 32 | 33 | # Java class files 34 | *.class 35 | 36 | # Generated files 37 | bin/ 38 | gen/ 39 | out/ 40 | 41 | # Gradle files 42 | .gradle/ 43 | build/ 44 | 45 | # Local configuration file (sdk path, etc) 46 | local.properties 47 | 48 | # Proguard folder generated by Eclipse 49 | proguard/ 50 | 51 | # Log Files 52 | *.log 53 | 54 | # Android Studio Navigation editor temp files 55 | .navigation/ 56 | 57 | # Android Studio captures folder 58 | captures/ 59 | 60 | # Intellij 61 | *.iml 62 | 63 | # Keystore files 64 | *.jks 65 | 66 | ### Android template 67 | # Built application files 68 | *.apk 69 | *.ap_ 70 | 71 | # Files for the Dalvik VM 72 | *.dex 73 | 74 | # Java class files 75 | *.class 76 | 77 | # Generated files 78 | bin/ 79 | gen/ 80 | out/ 81 | 82 | # Gradle files 83 | .gradle/ 84 | build/ 85 | 86 | # Local configuration file (sdk path, etc) 87 | local.properties 88 | 89 | # Proguard folder generated by Eclipse 90 | proguard/ 91 | 92 | # Log Files 93 | *.log 94 | 95 | # Android Studio Navigation editor temp files 96 | .navigation/ 97 | 98 | # Android Studio captures folder 99 | captures/ 100 | 101 | # Intellij 102 | *.iml 103 | 104 | # Keystore files 105 | *.jks 106 | 107 | ### Android template 108 | # Built application files 109 | *.apk 110 | *.ap_ 111 | 112 | # Files for the Dalvik VM 113 | *.dex 114 | 115 | # Java class files 116 | *.class 117 | 118 | # Generated files 119 | bin/ 120 | gen/ 121 | out/ 122 | 123 | # Gradle files 124 | .gradle/ 125 | build/ 126 | 127 | # Local configuration file (sdk path, etc) 128 | local.properties 129 | 130 | # Proguard folder generated by Eclipse 131 | proguard/ 132 | 133 | # Log Files 134 | *.log 135 | 136 | # Android Studio Navigation editor temp files 137 | .navigation/ 138 | 139 | # Android Studio captures folder 140 | captures/ 141 | 142 | # Intellij 143 | *.iml 144 | 145 | # Keystore files 146 | *.jks 147 | 148 | # Created by .ignore support plugin (hsz.mobi) 149 | -------------------------------------------------------------------------------- /app/src/main/res/layout/details_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 21 | 22 | 33 | 34 | 45 | 46 | 57 | 58 | 69 | 70 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 1.7 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SurperTableUI 5 | Hello world! 6 | Settings 7 | 8 | 9 | [{\"Course_address\":\"J1-205\",\"Course_name\":\"Unity3D应用开发\",\"Course_teacher\":\"靳延安\",\"Course_type\":\"专选\",\"Course_week\":\"周二第1,2节{第11-19周}\"},{\"Course_address\":\"J1-308\",\"Course_name\":\"3G网络应用开发\",\"Course_teacher\":\"白朔天\",\"Course_type\":\"专选\",\"Course_week\":\"周三第1,2节{第1-9周}\"},{\"Course_address\":\"J1-509\",\"Course_name\":\"TCP/IP协议分析\",\"Course_teacher\":\"胡长坤\",\"Course_type\":\"专业\",\"Course_week\":\"周四第1,2节{第1-19周}\"},{\"Course_address\":\"J1-212\",\"Course_name\":\"Unity3D应用开发\",\"Course_teacher\":\"靳延安\",\"Course_type\":\"专选\",\"Course_week\":\"周五第1,2节{第11-11周|单周}\"},{\"Course_address\":\"J1-212\",\"Course_name\":\"Unity3D应用开发\",\"Course_teacher\":\"靳延安\",\"Course_type\":\"专选\",\"Course_week\":\"周五第1,2节{第19-19周|单周}\"},{\"Course_address\":\"J1-202\",\"Course_name\":\"3G网络应用开发\",\"Course_teacher\":\"白朔天\",\"Course_type\":\"专选\",\"Course_week\":\"周五第1,2节{第8-9周}\"},{\"Course_address\":\"J1-202\",\"Course_name\":\"3G网络应用开发\",\"Course_teacher\":\"白朔天\",\"Course_type\":\"专选\",\"Course_week\":\"周五第1,2节{第1-2周}\"},{\"Course_address\":\"S2-507软件工程实验室\",\"Course_name\":\"Unity3D应用开发\",\"Course_teacher\":\"靳延安\",\"Course_type\":\"专选\",\"Course_week\":\"周五第1,2节{第12-18周}\"},{\"Course_address\":\"S2-407网络工程实验室\",\"Course_name\":\"3G网络应用开发\",\"Course_teacher\":\"白朔天\",\"Course_type\":\"专选\",\"Course_week\":\"周五第1,2节{第3-7周}\"},{\"Course_address\":\"J1-107\",\"Course_name\":\"Java EE网络编程技术\",\"Course_teacher\":\"戴志锋(戴志锋)\",\"Course_type\":\"专选\",\"Course_week\":\"周一第3,4节{第11-19周}\"},{\"Course_address\":\"S2-407网络工程实验室\",\"Course_name\":\"TCP/IP协议分析\",\"Course_teacher\":\"胡长坤\",\"Course_type\":\"专业\",\"Course_week\":\"周二第3,4节{第3-17周|单周}\"},{\"Course_address\":\"S2-407网络工程实验室\",\"Course_name\":\"网络性能测试与分析\",\"Course_teacher\":\"孙宝林\",\"Course_type\":\"专业\",\"Course_week\":\"周三第3,4节{第2-18周|双周}\"},{\"Course_address\":\"J1-103\",\"Course_name\":\"毛泽东思想和中国特色社会主义(2)\",\"Course_teacher\":\"肖春艳/丁银河/颜红霞/巨英/罗运洪/包蕾/易成/董大敏/吕梦醒\",\"Course_type\":\"通必\",\"Course_week\":\"周一第7,8节{第1-18周}\"},{\"Course_address\":\"S2-407网络工程实验室\",\"Course_name\":\"网络性能测试与分析\",\"Course_teacher\":\"孙宝林\",\"Course_type\":\"专业\",\"Course_week\":\"周二第7,8节{第1-19周}\"},{\"Course_address\":\"S2-412软件实验室\",\"Course_name\":\"网络程序设计\",\"Course_teacher\":\"曾长军\",\"Course_type\":\"专业\",\"Course_week\":\"周三第7,8节{第3-19周|单周}\"},{\"Course_address\":\"J2-210\",\"Course_name\":\"网络程序设计\",\"Course_teacher\":\"曾长军\",\"Course_type\":\"专业\",\"Course_week\":\"周五第7,8节{第1-19周}\"},{\"Course_address\":\"S2-407网络工程实验室\",\"Course_name\":\"Java EE网络编程技术\",\"Course_teacher\":\"戴志锋(戴志锋)\",\"Course_type\":\"专选\",\"Course_week\":\"周二第9,10节{第11-19周}\"},{\"Course_address\":\"J1-404\",\"Course_name\":\"网络管理\",\"Course_teacher\":\"王桐\",\"Course_type\":\"专选\",\"Course_week\":\"周四第9,10节{第1-19周|单周}\"},{\"Course_address\":\"S2-407网络工程实验室\",\"Course_name\":\"网络管理\",\"Course_teacher\":\"王桐\",\"Course_type\":\"专选\",\"Course_week\":\"周四第9,10节{第2-18周|双周}\"}] 10 | 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /import-summary.txt: -------------------------------------------------------------------------------- 1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY 2 | ====================================== 3 | 4 | Manifest Merging: 5 | ----------------- 6 | Your project uses libraries that provide manifests, and your Eclipse 7 | project did not explicitly turn on manifest merging. In Android Gradle 8 | projects, manifests are always merged (meaning that contents from your 9 | libraries' manifests will be merged into the app manifest. If you had 10 | manually copied contents from library manifests into your app manifest 11 | you may need to remove these for the app to build correctly. 12 | 13 | Ignored Files: 14 | -------------- 15 | The following files were *not* copied into the new Gradle project; you 16 | should evaluate whether these are still needed in your project and if 17 | so manually move them: 18 | 19 | * .metadata\ 20 | * .metadata\.lock 21 | * .metadata\.plugins\ 22 | * .metadata\.plugins\org.eclipse.cdt.core\ 23 | * .metadata\.plugins\org.eclipse.cdt.core\.log 24 | * .metadata\.plugins\org.eclipse.cdt.make.core\ 25 | * .metadata\.plugins\org.eclipse.cdt.make.core\specs.c 26 | * .metadata\.plugins\org.eclipse.cdt.make.core\specs.cpp 27 | * .metadata\.plugins\org.eclipse.core.resources\ 28 | * .metadata\.plugins\org.eclipse.core.resources\.root\ 29 | * .metadata\.plugins\org.eclipse.core.resources\.root\.indexes\ 30 | * .metadata\.plugins\org.eclipse.core.resources\.root\.indexes\history.version 31 | * .metadata\.plugins\org.eclipse.core.resources\.root\.indexes\properties.index 32 | * .metadata\.plugins\org.eclipse.core.resources\.root\.indexes\properties.version 33 | * .metadata\.plugins\org.eclipse.core.resources\.root\1.tree 34 | * .metadata\.plugins\org.eclipse.core.resources\.safetable\ 35 | * .metadata\.plugins\org.eclipse.core.resources\.safetable\org.eclipse.core.resources 36 | * .metadata\.plugins\org.eclipse.core.runtime\ 37 | * .metadata\.plugins\org.eclipse.core.runtime\.settings\ 38 | * .metadata\.plugins\org.eclipse.core.runtime\.settings\com.android.ide.eclipse.adt.prefs 39 | * .metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.cdt.ui.prefs 40 | * .metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.core.resources.prefs 41 | * .metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.debug.ui.prefs 42 | * .metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.ui.prefs 43 | * .metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.ide.prefs 44 | * .metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.prefs 45 | * .metadata\.plugins\org.eclipse.e4.workbench\ 46 | * .metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi 47 | * .metadata\.plugins\org.eclipse.jdt.core\ 48 | * .metadata\.plugins\org.eclipse.jdt.core\invalidArchivesCache 49 | * .metadata\.plugins\org.eclipse.jdt.core\nonChainingJarsCache 50 | * .metadata\.plugins\org.eclipse.jdt.core\variablesAndContainers.dat 51 | * .metadata\.plugins\org.eclipse.jdt.ui\ 52 | * .metadata\.plugins\org.eclipse.jdt.ui\OpenTypeHistory.xml 53 | * .metadata\.plugins\org.eclipse.jdt.ui\QualifiedTypeNameHistory.xml 54 | * .metadata\.plugins\org.eclipse.jdt.ui\dialog_settings.xml 55 | * .metadata\.plugins\org.eclipse.ui.workbench\ 56 | * .metadata\.plugins\org.eclipse.ui.workbench\dialog_settings.xml 57 | * .metadata\.plugins\org.eclipse.ui.workbench\workingsets.xml 58 | * .metadata\version.ini 59 | * ic_launcher-web.png 60 | * proguard-project.txt 61 | 62 | Replaced Jars with Dependencies: 63 | -------------------------------- 64 | The importer recognized the following .jar files as third party 65 | libraries and replaced them with Gradle dependencies instead. This has 66 | the advantage that more explicit version information is known, and the 67 | libraries can be updated automatically. However, it is possible that 68 | the .jar file in your project was of an older version than the 69 | dependency we picked, which could render the project not compileable. 70 | You can disable the jar replacement in the import wizard and try again: 71 | 72 | android-support-v4.jar => com.android.support:support-v4:19.1.0 73 | android-support-v7-appcompat.jar => com.android.support:appcompat-v7:19.1.0 74 | gson-2.3.1.jar => com.google.code.gson:gson:2.3.1 75 | 76 | Replaced Libraries with Dependencies: 77 | ------------------------------------- 78 | The importer recognized the following library projects as third party 79 | libraries and replaced them with Gradle dependencies instead. This has 80 | the advantage that more explicit version information is known, and the 81 | libraries can be updated automatically. However, it is possible that 82 | the source files in your project were of an older version than the 83 | dependency we picked, which could render the project not compileable. 84 | You can disable the library replacement in the import wizard and try 85 | again: 86 | 87 | android-support-v7-appcompat => [com.android.support:appcompat-v7:19.1.0] 88 | 89 | Moved Files: 90 | ------------ 91 | Android Gradle projects use a different directory structure than ADT 92 | Eclipse projects. Here's how the projects were restructured: 93 | 94 | * AndroidManifest.xml => app\src\main\AndroidManifest.xml 95 | * assets\ => app\src\main\assets 96 | * res\ => app\src\main\res\ 97 | * src\ => app\src\main\java\ 98 | 99 | Next Steps: 100 | ----------- 101 | You can now build the project. The Gradle project needs network 102 | connectivity to download dependencies. 103 | 104 | Bugs: 105 | ----- 106 | If for some reason your project does not build, and you determine that 107 | it is due to a bug or limitation of the Eclipse to Gradle importer, 108 | please file a bug at http://b.android.com with category 109 | Component-Tools. 110 | 111 | (This import summary is for your information only, and can be deleted 112 | after import once you are satisfied with the results.) 113 | -------------------------------------------------------------------------------- /app/src/main/java/com/jay/surpertableui/CourseBean.java: -------------------------------------------------------------------------------- 1 | package com.jay.surpertableui; 2 | 3 | import android.util.Log; 4 | 5 | import java.io.Serializable; 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | /** 10 | * 课程描述类,包含课程的基本信息 11 | * 12 | * @author Jay 13 | * 14 | */ 15 | public class CourseBean implements Serializable { 16 | 17 | private static final long serialVersionUID = -2080529292063641408L; 18 | private String Course_name; // 课程名 19 | private String Course_address; // 上课地点 20 | private String Course_teacher; // 课程老师 21 | private String Course_type; // 课程种类 专业/专选/选修/实验 22 | private String Course_week; // 课程周数 23 | 24 | public CourseBean() { 25 | 26 | } 27 | 28 | public CourseBean(String course_name, String course_address, 29 | String course_teacher, String course_type, String course_week) { 30 | Course_name = course_name; 31 | Course_address = course_address; 32 | Course_teacher = course_teacher; 33 | Course_type = course_type; 34 | Course_week = course_week; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return "课程信息 [课程名=" + Course_name + ", 上课地点=" + Course_address 40 | + ", 课程老师=" + Course_teacher + ", 课程种类=" + Course_type 41 | + ", 课程周数=" + Course_week + "]"; 42 | } 43 | 44 | //courses_name=算法设计与分析, courses_type=专选, courses_time=1-9(5,6), courses_address=J2-208, courses_id=0, courses_year=0, courses_object=计算机类Q1541 45 | /** 46 | * 47 | * 周二第1,2节{第11-19周} 获取这节课是星期几 48 | * 49 | * @return 返回值为一二三四五六日 50 | */ 51 | public char getDayOfWeek() { 52 | return getCourse_week().charAt(1); 53 | } 54 | 55 | /** 56 | * 周二第1,2节{第11-19周} 57 | * 58 | * @return 返回值为这节课从第几节课开始 59 | */ 60 | public int getMinCourse() { 61 | Pattern pattern = Pattern.compile("\\d+"); 62 | Matcher matcher = pattern.matcher(getCourse_week()); 63 | matcher.find(); 64 | return Integer.parseInt(matcher.group(0)); 65 | } 66 | 67 | /** 68 | * 周二第1,2节{第11-19周} 69 | * 70 | * @return 返回值为这节课从在几节课结束 71 | */ 72 | public int getMaxCourse() { 73 | Pattern pattern = Pattern.compile("\\d+"); 74 | Matcher matcher = pattern.matcher(getCourse_week()); 75 | matcher.find(); 76 | matcher.find(); 77 | return Integer.parseInt(matcher.group()); 78 | } 79 | 80 | /** 81 | * @return 返回课程的长度 82 | */ 83 | public int getStep() { 84 | return getMaxCourse() - getMinCourse() + 1; 85 | } 86 | 87 | /** 88 | * 获取本节课程从第几周开始 89 | * 90 | * 周五第1,2节{第19-19周|单周} 91 | * 92 | * @return 开始周 93 | */ 94 | public int getMinWeek() { 95 | Pattern pattern = Pattern.compile("\\d+"); 96 | Matcher matcher = pattern.matcher(getCourse_week()); 97 | matcher.find(); 98 | matcher.find(); 99 | matcher.find(); 100 | return Integer.parseInt(matcher.group()); 101 | } 102 | 103 | /** 104 | * 获取本节课程在第几周结束 105 | * 106 | * 周五第1,2节{第19-19周|单周} 107 | * 108 | * @return 结束周 109 | */ 110 | public int getMaxWeek() { 111 | Pattern pattern = Pattern.compile("\\d+"); 112 | Matcher matcher = pattern.matcher(getCourse_week()); 113 | matcher.find(); 114 | matcher.find(); 115 | matcher.find(); 116 | matcher.find(); 117 | return Integer.parseInt(matcher.group()); 118 | 119 | } 120 | 121 | /** 122 | * 判断是否为单周 123 | * 124 | * 周五第1,2节{第19-19周|单周} 125 | * 126 | * @return true 如果为单周 127 | */ 128 | public Boolean isSingleWeek() { 129 | Boolean result = false; 130 | String week = getCourse_week(); 131 | int begin = week.indexOf("|"); 132 | if (begin != -1) { 133 | Character isWeek = week.charAt(begin + 1); 134 | Log.v("xxxx", isWeek + ""); 135 | if (isWeek.equals('单')) { 136 | result = true; 137 | } 138 | } 139 | return result; 140 | } 141 | 142 | /** 143 | * 判断是否为双周 144 | * 145 | * 周五第1,2节{第19-19周|单周} 146 | * 147 | * @return true 如果为双周 148 | */ 149 | public Boolean isDoubleWeek() { 150 | Boolean result = false; 151 | String week = getCourse_week(); 152 | int begin = week.indexOf("|"); 153 | if (begin != -1) { 154 | Character isWeek = week.charAt(begin + 1); 155 | if (isWeek.equals('双')) { 156 | result = true; 157 | } 158 | } 159 | return result; 160 | } 161 | 162 | /** 163 | * 判断是否为单双周一起上 164 | */ 165 | public Boolean isAllWeek() { 166 | return !isSingleWeek() && !isDoubleWeek(); 167 | } 168 | 169 | /** 170 | * 判断本节课是否在指定周上 171 | * 172 | * @param week 173 | * 指定周 174 | * @return ture 是 175 | */ 176 | public Boolean inThisWeek(int week) { 177 | Boolean result = false; 178 | // 在最大最小周之间 179 | if (week <= this.getMaxWeek() && week >= this.getMinWeek()) { 180 | if (this.isAllWeek()) 181 | result = true; 182 | if (this.isSingleWeek() && week % 2 == 1) { 183 | result = true; 184 | } 185 | if (this.isDoubleWeek() && week % 2 == 0) { 186 | result = true; 187 | } 188 | } 189 | return result; 190 | } 191 | 192 | /* 193 | * // 获取节数 public int getTime() { Pattern pattern = Pattern.compile("\\d"); 194 | * Matcher matcher = pattern.matcher(getCourse_week()); matcher.find(); 195 | * String result = matcher.group(); int r = -1; if (result != null) { r = 196 | * Integer.parseInt(result); } return r; } 197 | */ 198 | 199 | public String getCourse_name() { 200 | return Course_name; 201 | } 202 | 203 | public void setCourse_name(String course_name) { 204 | Course_name = course_name; 205 | } 206 | 207 | public String getCourse_address() { 208 | return Course_address; 209 | } 210 | 211 | public void setCourse_address(String course_address) { 212 | Course_address = course_address; 213 | } 214 | 215 | public String getCourse_teacher() { 216 | return Course_teacher; 217 | } 218 | 219 | public void setCourse_teacher(String course_teacher) { 220 | Course_teacher = course_teacher; 221 | } 222 | 223 | public String getCourse_type() { 224 | return Course_type; 225 | } 226 | 227 | public void setCourse_type(String course_type) { 228 | Course_type = course_type; 229 | } 230 | 231 | public String getCourse_week() { 232 | return Course_week; 233 | } 234 | 235 | public void setCourse_week(String course_week) { 236 | Course_week = course_week; 237 | } 238 | 239 | } 240 | -------------------------------------------------------------------------------- /app/src/main/res/layout/supertable.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | 38 | 39 | 47 | 48 | 59 | 60 | 71 | 72 | 83 | 84 | 95 | 96 | 107 | 108 | 119 | 120 | 131 | 132 | 133 | 138 | 139 | 140 | 141 | 145 | 146 | 147 | 148 | 154 | 155 | 156 | 157 | 158 | 164 | 165 | 166 | 172 | 173 | 174 | 180 | 181 | 182 | 188 | 189 | 190 | 196 | 197 | 198 | 204 | 205 | 206 | 212 | 213 | 214 | 215 | 216 | -------------------------------------------------------------------------------- /app/src/main/java/com/jay/surpertableui/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.jay.surpertableui; 2 | 3 | import android.app.Activity; 4 | import android.app.AlertDialog; 5 | import android.app.AlertDialog.Builder; 6 | import android.content.Context; 7 | import android.content.SharedPreferences; 8 | import android.content.SharedPreferences.Editor; 9 | import android.graphics.drawable.ColorDrawable; 10 | import android.os.Bundle; 11 | import android.view.Gravity; 12 | import android.view.View; 13 | import android.view.View.OnClickListener; 14 | import android.widget.AdapterView; 15 | import android.widget.AdapterView.OnItemClickListener; 16 | import android.widget.ArrayAdapter; 17 | import android.widget.LinearLayout; 18 | import android.widget.LinearLayout.LayoutParams; 19 | import android.widget.ListView; 20 | import android.widget.PopupWindow; 21 | import android.widget.TextView; 22 | 23 | import com.google.gson.Gson; 24 | import com.google.gson.reflect.TypeToken; 25 | 26 | import java.util.ArrayList; 27 | 28 | public class MainActivity extends Activity { 29 | private ArrayList mCourse; 30 | private SharedPreferences mShaerPreferences; 31 | // 每天有多少节课 32 | private int mMaxCouese; 33 | // 一共有多少周 34 | private int mMaxWeek; 35 | // 现在是第几周 36 | private int mNowWeek; 37 | // 左边一节课的高度 38 | private float mLeftHeight; 39 | // 左边一节课的宽度 40 | private float mLeftWidth; 41 | 42 | private TextView mChangeWeek; 43 | private LinearLayout mLeftNo; 44 | private LinearLayout mMonday; 45 | private LinearLayout mTuesday; 46 | private LinearLayout mWednesday; 47 | private LinearLayout mThursday; 48 | private LinearLayout mFirday; 49 | private LinearLayout mSaturday; 50 | private LinearLayout mWeekend; 51 | 52 | @Override 53 | protected void onCreate(Bundle savedInstanceState) { 54 | super.onCreate(savedInstanceState); 55 | setContentView(R.layout.supertable); 56 | // 实例化所有对象 57 | initCtrl(); 58 | // 初始化数据 59 | initData(); 60 | 61 | // 绘制左边的课程节数 62 | drawLeftNo(); 63 | // 绘制当前周 64 | drawNowWeek(); 65 | // 绘制所有课程 其实可以使用redrawAll替代三步 66 | drawAllCourse(); 67 | } 68 | 69 | /** 70 | * 实例化所有对象 71 | */ 72 | private void initCtrl() { 73 | mChangeWeek = (TextView) findViewById(R.id.changeWeek); 74 | mLeftNo = (LinearLayout) findViewById(R.id.leftNo); 75 | mMonday = (LinearLayout) findViewById(R.id.monday); 76 | mTuesday = (LinearLayout) findViewById(R.id.tuesday); 77 | mWednesday = (LinearLayout) findViewById(R.id.wednesday); 78 | mThursday = (LinearLayout) findViewById(R.id.thursday); 79 | mFirday = (LinearLayout) findViewById(R.id.firday); 80 | mSaturday = (LinearLayout) findViewById(R.id.saturday); 81 | mWeekend = (LinearLayout) findViewById(R.id.weekend); 82 | } 83 | 84 | /** 85 | * 初始化所有数据 86 | */ 87 | private void initData() { 88 | // 初始化课表 89 | praseJson(); 90 | // 读取配置信息 91 | readIniFile(); 92 | 93 | // 点击选择切换周 94 | mChangeWeek.setOnClickListener(new OnClickListener() { 95 | 96 | @Override 97 | public void onClick(View v) { 98 | showChangeWeekDlg(v); 99 | } 100 | }); 101 | } 102 | 103 | /** 104 | * 绘制左边的课程节数 105 | */ 106 | private void drawLeftNo() { 107 | mLeftHeight = getResources().getDimension(R.dimen.left_height); 108 | mLeftWidth = getResources().getDimension(R.dimen.left_width); 109 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( 110 | (int) mLeftWidth, (int) mLeftHeight); 111 | for (int i = 1; i <= mMaxCouese; i++) { 112 | TextView tv = new TextView(this); 113 | tv.setText(i + ""); 114 | tv.setGravity(Gravity.CENTER); 115 | tv.setTextColor(getResources().getColor(R.color.font)); 116 | tv.setBackgroundResource(R.drawable.boder); 117 | mLeftNo.addView(tv, lp); 118 | } 119 | } 120 | 121 | /** 122 | * 绘制课表 123 | * 124 | * @param ll 125 | * 绘制课表到哪一个LinearLayout上 126 | * @param dayOfWeek 127 | * 绘制的数据来自周几 一二三四五六七 128 | */ 129 | private void drawCourse(LinearLayout ll, char dayOfWeek) { 130 | // 删除所有子View 131 | ll.removeAllViews(); 132 | // 上一节课结束是第几节 133 | int perCourse = -1; 134 | for (CourseBean course : mCourse) { 135 | // 判断是否显示这节课 136 | // 是不是同一天 是不是这一周 137 | if (course.getDayOfWeek() != dayOfWeek 138 | || !course.inThisWeek(mNowWeek)) 139 | continue; 140 | 141 | // 设置TextView的属性样式 142 | TextView tv = new TextView(this); 143 | tv.setText(course.getCourse_name() + "\n@" 144 | + course.getCourse_address()); 145 | tv.setBackgroundResource(R.drawable.course); 146 | tv.setTextColor(getResources().getColor(R.color.course_font_color)); 147 | 148 | // 将数据绑定到TextView上 149 | tv.setTag(course); 150 | tv.setOnClickListener(new OnClickListener() { 151 | 152 | @Override 153 | public void onClick(View v) { 154 | CourseBean tag = (CourseBean) v.getTag(); 155 | showCouseDetails(tag); 156 | } 157 | }); 158 | 159 | // 设置TextView的位置 160 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( 161 | LayoutParams.MATCH_PARENT, 162 | (int) (course.getStep() * mLeftHeight)); 163 | // 说明这节课为第一节课 164 | if (perCourse == -1) { 165 | lp.setMargins(1, 166 | (int) ((course.getMinCourse() - 1) * mLeftHeight), 1, 0); 167 | // useHeight = (int) ((course.getMaxCourse()-1) * mLeftHeight); 168 | } else { 169 | lp.setMargins(1, (course.getMinCourse() - perCourse - 1) 170 | * (int) mLeftHeight, 1, 0); 171 | // useHeight = useHeight + (course.getMaxCourse() - perCourse - 172 | // 1)* (int) mLeftHeight; 173 | } 174 | perCourse = course.getMaxCourse(); 175 | ll.addView(tv, lp); 176 | } 177 | } 178 | 179 | /** 180 | * 绘制当前周 181 | */ 182 | private void drawNowWeek() { 183 | mChangeWeek.setText("第" + mNowWeek + "周"); 184 | } 185 | 186 | /** 187 | * 重新绘制所有,不包括标题栏和星期几 在修改每天的节数后调用 188 | */ 189 | /*private void redrawAll() { 190 | drawLeftNo(); 191 | drawNowWeek(); 192 | drawAllCourse(); 193 | }*/ 194 | 195 | /** 196 | * 绘制课程,用于周数切换以后 197 | */ 198 | private void drawAllCourse() { 199 | drawCourse(mMonday, '一'); 200 | drawCourse(mTuesday, '二'); 201 | drawCourse(mWednesday, '三'); 202 | drawCourse(mThursday, '四'); 203 | drawCourse(mFirday, '五'); 204 | drawCourse(mSaturday, '六'); 205 | drawCourse(mWeekend, '日'); 206 | } 207 | 208 | /** 209 | * 读取配置信息 210 | */ 211 | private void readIniFile() { 212 | mShaerPreferences = getSharedPreferences("iniFile", 213 | Context.MODE_PRIVATE); 214 | mMaxCouese = mShaerPreferences.getInt("mMaxCouese", -1); 215 | mMaxWeek = mShaerPreferences.getInt("mMaxWeek", -1); 216 | mNowWeek = mShaerPreferences.getInt("mNowWeek", -1); 217 | 218 | Editor edit = mShaerPreferences.edit(); 219 | // 默认12节课 220 | if (mMaxCouese == -1) { 221 | edit.putInt("mMaxCouese", 12); 222 | } 223 | 224 | // 默认20周 225 | if (mMaxWeek == -1) { 226 | edit.putInt("mMaxWeek", 20); 227 | } 228 | 229 | // 默认第一周 230 | if (mNowWeek == -1) { 231 | edit.putInt("mNowWeek", 1); 232 | } 233 | edit.commit(); 234 | } 235 | 236 | /** 237 | * 解析来自strings.xml里面的Json课表数据 238 | */ 239 | private void praseJson() { 240 | String json = getResources().getString(R.string.kb); 241 | Gson gson = new Gson(); 242 | mCourse = gson.fromJson(json, new TypeToken>() { 243 | }.getType()); 244 | } 245 | 246 | /** 247 | * 弹出窗口,显示课程详细信息 248 | * 249 | */ 250 | public void showCouseDetails(CourseBean bean) { 251 | AlertDialog.Builder builder = new Builder(this); 252 | AlertDialog dialog = builder.create(); 253 | dialog.show(); 254 | dialog.setContentView(R.layout.details_layout); 255 | TextView textView = (TextView) dialog.findViewById(R.id.name); 256 | textView.setText(bean.getCourse_name()); 257 | textView = (TextView) dialog.findViewById(R.id.type); 258 | textView.setText(bean.getCourse_type()); 259 | textView = (TextView) dialog.findViewById(R.id.teacher); 260 | textView.setText(bean.getCourse_teacher()); 261 | textView = (TextView) dialog.findViewById(R.id.address); 262 | textView.setText(bean.getCourse_address()); 263 | textView = (TextView) dialog.findViewById(R.id.week); 264 | textView.setText(bean.getCourse_week()); 265 | } 266 | 267 | /** 268 | * 显示切换当前周的窗口 269 | */ 270 | public void showChangeWeekDlg(View v) { 271 | View view = View.inflate(this, R.layout.changweek_layout, null); 272 | ListView weekList = (ListView) view.findViewById(R.id.weekList); 273 | 274 | ArrayList strList = new ArrayList(); 275 | for (int i = 1; i < mMaxWeek; i++) { 276 | strList.add("第" + i + "周"); 277 | } 278 | 279 | ArrayAdapter adapter = new ArrayAdapter(this, 280 | R.layout.item, strList); 281 | 282 | weekList.setAdapter(adapter); 283 | view.measure(0, 0); 284 | final PopupWindow pop = new PopupWindow(view, 300, 500, true); 285 | pop.setBackgroundDrawable(new ColorDrawable(0x00000000)); 286 | int xOffSet = -(pop.getWidth() - v.getWidth()) / 2; 287 | pop.showAsDropDown(v, xOffSet, 0); 288 | 289 | weekList.setOnItemClickListener(new OnItemClickListener() { 290 | 291 | @Override 292 | public void onItemClick(AdapterView adapter, View view, 293 | int positon, long id) { 294 | mNowWeek = positon + 1; 295 | pop.dismiss(); 296 | drawNowWeek(); 297 | drawAllCourse(); 298 | } 299 | }); 300 | } 301 | 302 | } 303 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | 57 | 58 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 88 | 89 | 113 | 1251 | 1257 | 1606 | 1609 | 1610 | 1611 | 1617 | 1618 | 1619 | 1620 | 1621 | 1622 | 1627 | 1628 | 1629 | 1630 | 1631 | 1632 | 1633 | 1634 | 1635 | 1636 | 1637 | 1638 | 1639 | 1640 | 1641 | 1642 | 1643 | 1644 | 1645 | 1646 | 1647 | 1648 | 1649 | 1650 | 1651 | 1652 | 1653 | 1654 | 1655 | 1656 | 1657 | 1658 | 1659 | 1662 | 1663 | 1664 | 1665 | 1668 | 1669 | 1672 | 1673 | 1676 | 1677 | 1678 | 1679 | 1682 | 1683 | 1686 | 1687 | 1688 | 1689 | 1690 | 1691 | 1692 | 1693 | 1694 | 1695 | 1696 | 1697 | 1698 | 1699 | 1700 | 1701 | 1702 | 1703 | 1704 | 1705 | 1724 | 1725 | 1726 | 1744 | 1745 | 1746 | 1759 | 1760 | 1761 | 1762 | 1776 | 1777 | 1778 | 1779 | 1782 | 1783 | 1784 | 1785 | 1786 | 1787 | 1788 | 1789 | 1796 | 1797 | 1798 | 1799 | 1817 | 1824 | 1825 | 1826 | 1845 | 1846 | 1847 | 1848 | 1849 | 1857 | 1858 | 1860 | 1861 | 1862 | 1863 | 1864 | 1865 | 1866 | 1867 | 1868 | 1467970688269 1869 | 1872 | 1873 | 1874 | 1875 | 1876 | 1877 | 1878 | 1879 | 1880 | 1881 | 1882 | 1883 | 1884 | 1885 | 1886 | 1887 | 1888 | 1889 | 1890 | 1891 | 1892 | 1893 | 1894 | 1895 | 1896 | 1897 | 1898 | 1899 | 1900 | 1901 | 1902 | 1903 | 1904 | 1905 | 1906 | 1907 | 1908 | 1909 | 1910 | 1912 | 1913 | 1914 | 1916 | 1917 | 1918 | 1919 | 1920 | 1921 | 1922 | 1923 | 1924 | 1925 | 1926 | 1927 | 1928 | 1929 | 1930 | 1931 | 1932 | 1933 | 1934 | 1935 | 1936 | 1937 | 1938 | 1939 | 1940 | 1941 | 1942 | 1943 | 1944 | 1945 | 1946 | 1947 | 1948 | 1949 | 1950 | 1951 | 1952 | 1953 | 1954 | --------------------------------------------------------------------------------