├── .gitignore ├── README-zh.md ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro ├── release │ └── app-release.aab └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── Ntut │ │ └── ExampleInstrumentedTest.java │ ├── debug │ └── res │ │ └── values │ │ └── google_maps_api.xml │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── Ntut │ │ │ ├── BaseActivity.java │ │ │ ├── BaseFragment.java │ │ │ ├── CourseWidgetProvider.java │ │ │ ├── MainActivity.java │ │ │ ├── MainApplication.java │ │ │ ├── PortalActivity.java │ │ │ ├── about │ │ │ └── AboutActivity.java │ │ │ ├── account │ │ │ ├── AccountActivity.java │ │ │ └── AccountSettingFragment.java │ │ │ ├── calendar │ │ │ ├── CalendarFragment.java │ │ │ ├── CalendarListAdapter.java │ │ │ ├── CalendarPageAdapter.java │ │ │ └── MonthPickerDialog.java │ │ │ ├── club │ │ │ └── ClubActivity.java │ │ │ ├── course │ │ │ ├── CourseBlock.java │ │ │ ├── CourseDetailActivity.java │ │ │ ├── CourseFragment.java │ │ │ ├── CourseTableLayout.java │ │ │ ├── SemesterSelector.java │ │ │ └── task │ │ │ │ ├── CourseDetailTask.java │ │ │ │ ├── QuerySemesterTask.java │ │ │ │ └── SearchCourseTask.java │ │ │ ├── credit │ │ │ ├── CreditActivity.java │ │ │ ├── CreditGeneralView.java │ │ │ ├── CreditGroupView.java │ │ │ ├── CreditStandardDialog.java │ │ │ ├── CreditTypeListActivity.java │ │ │ ├── MenuSpinner.java │ │ │ └── RadarChartView.java │ │ │ ├── etc │ │ │ └── EtcActivity.java │ │ │ ├── event │ │ │ ├── EventAdapter.java │ │ │ ├── EventDetailActivity.java │ │ │ └── EventFragment.java │ │ │ ├── feedback │ │ │ └── FeedbackActivity.java │ │ │ ├── firebase │ │ │ ├── FirebaseMessaging.java │ │ │ └── FirebaseService.java │ │ │ ├── model │ │ │ ├── ActivityInfo.java │ │ │ ├── ActivityList.java │ │ │ ├── CalendarInfo.java │ │ │ ├── CourseInfo.java │ │ │ ├── CreditInfo.java │ │ │ ├── EventInfo.java │ │ │ ├── EventList.java │ │ │ ├── GeneralCredit.java │ │ │ ├── GeneralCreditInfo.java │ │ │ ├── GiphyGlideModule.java │ │ │ ├── Model.java │ │ │ ├── OtherInfo.java │ │ │ ├── Semester.java │ │ │ ├── SemesterCredit.java │ │ │ ├── SemesterRank.java │ │ │ ├── StandardCredit.java │ │ │ ├── StudentCourse.java │ │ │ ├── StudentCredit.java │ │ │ └── YearCalendar.java │ │ │ ├── other │ │ │ ├── OtherAdapter.java │ │ │ └── OtherFragment.java │ │ │ ├── portal │ │ │ └── PortalFragment.java │ │ │ ├── runnable │ │ │ ├── AccountRunnable.java │ │ │ ├── BaseRunnable.java │ │ │ ├── CalendarRunnable.java │ │ │ ├── ClassmateRunnable.java │ │ │ ├── CourseDetailRunnable.java │ │ │ ├── CourseLoginRunnable.java │ │ │ ├── CourseRunnable.java │ │ │ ├── CourseTableSearchRunnable.java │ │ │ ├── CreditLoginRunnable.java │ │ │ ├── CreditRunnable.java │ │ │ ├── CreditStandardRunnable.java │ │ │ ├── EventRunnable.java │ │ │ ├── LoginNportalRunnable.java │ │ │ ├── StandardDepartmentRunnable.java │ │ │ ├── StandardDivisionRunnable.java │ │ │ └── StandardYearRunnable.java │ │ │ ├── schoolmap │ │ │ └── MapActivity.java │ │ │ ├── store │ │ │ └── StoreActivity.java │ │ │ └── utility │ │ │ ├── BitmapUtility.java │ │ │ ├── CalendarConnector.java │ │ │ ├── Connector.java │ │ │ ├── Constants.java │ │ │ ├── CookieManager.java │ │ │ ├── CourseConnector.java │ │ │ ├── CreditConnector.java │ │ │ ├── HttpHelper.java │ │ │ ├── NportalConnector.java │ │ │ ├── OCRUtility.java │ │ │ ├── SlideAnimator.java │ │ │ ├── Utility.java │ │ │ └── WifiUtility.java │ └── res │ │ ├── anim │ │ ├── slide_down.xml │ │ └── slide_up.xml │ │ ├── drawable-hdpi │ │ ├── account_icon.png │ │ ├── calendar_icon.png │ │ ├── course_icon.png │ │ ├── credit_icon.png │ │ ├── darken_orange_text_selector.xml │ │ ├── event_icon.png │ │ ├── feedback_icon.png │ │ ├── info_icon.png │ │ ├── left_icon.png │ │ ├── left_pressed_icon.png │ │ ├── left_selector.xml │ │ ├── logo_darken_icon.png │ │ ├── map_icon.png │ │ ├── nportal_icon.png │ │ ├── orange_color_selector.xml │ │ ├── orange_selector.xml │ │ ├── other_icon.png │ │ ├── purple_color_selector.xml │ │ ├── red_house.png │ │ ├── right_icon.png │ │ ├── right_pressed_icon.png │ │ ├── right_selector.xml │ │ ├── setting_icon.png │ │ ├── store_icon.png │ │ ├── taipei_tech_logo.png │ │ └── white_block_background.xml │ │ ├── drawable-mdpi │ │ ├── account_icon.png │ │ ├── calendar_icon.png │ │ ├── course_icon.png │ │ ├── credit_icon.png │ │ ├── dot.png │ │ ├── event_icon.png │ │ ├── feedback_icon.png │ │ ├── info_icon.png │ │ ├── map_icon.png │ │ ├── nportal_icon.png │ │ ├── other_icon.png │ │ ├── red_house.png │ │ ├── setting_icon.png │ │ └── store_icon.png │ │ ├── drawable-xhdpi │ │ ├── account_icon.png │ │ ├── calendar_icon.png │ │ ├── course_icon.png │ │ ├── course_widget_preview.png │ │ ├── credit_icon.png │ │ ├── event_icon.png │ │ ├── feedback_icon.png │ │ ├── info_icon.png │ │ ├── map_icon.png │ │ ├── nportal_icon.png │ │ ├── other_icon.png │ │ ├── red_house.png │ │ ├── setting_icon.png │ │ └── store_icon.png │ │ ├── drawable-xxhdpi │ │ ├── account_icon.png │ │ ├── calendar_icon.png │ │ ├── course_icon.png │ │ ├── credit_icon.png │ │ ├── event_icon.png │ │ ├── feedback_icon.png │ │ ├── info_icon.png │ │ ├── map_icon.png │ │ ├── nportal_icon.png │ │ ├── other_icon.png │ │ ├── red_house.png │ │ ├── setting_icon.png │ │ └── store_icon.png │ │ ├── drawable-xxxhdpi │ │ ├── account_icon.png │ │ ├── calendar_icon.png │ │ ├── course_icon.png │ │ ├── credit_icon.png │ │ ├── event_icon.png │ │ ├── feedback_icon.png │ │ ├── info_icon.png │ │ ├── map_icon.png │ │ ├── nportal_icon.png │ │ ├── other_icon.png │ │ ├── red_house.png │ │ ├── setting_icon.png │ │ └── store_icon.png │ │ ├── drawable │ │ ├── button_shape.xml │ │ ├── placeholder.png │ │ └── red_color_selector.xml │ │ ├── layout │ │ ├── activity_about.xml │ │ ├── activity_account.xml │ │ ├── activity_club.xml │ │ ├── activity_credit.xml │ │ ├── activity_etc.xml │ │ ├── activity_event_detail.xml │ │ ├── activity_feedback.xml │ │ ├── activity_main.xml │ │ ├── activity_maps.xml │ │ ├── activity_portal.xml │ │ ├── activity_store.xml │ │ ├── calendar_item.xml │ │ ├── calendar_listview.xml │ │ ├── classmate_item.xml │ │ ├── course_detail.xml │ │ ├── course_item.xml │ │ ├── course_table_layout.xml │ │ ├── course_widget.xml │ │ ├── credit_group.xml │ │ ├── credit_item.xml │ │ ├── credit_standard_dialog.xml │ │ ├── credit_textview.xml │ │ ├── credit_type_list.xml │ │ ├── credit_type_textview.xml │ │ ├── event_item.xml │ │ ├── fragment_calendar.xml │ │ ├── fragment_course.xml │ │ ├── fragment_event.xml │ │ ├── fragment_other.xml │ │ ├── fragment_portal.xml │ │ ├── month_picker_dialog.xml │ │ ├── other_item.xml │ │ └── toolbar.xml │ │ ├── menu │ │ ├── menu_calendar.xml │ │ ├── menu_course.xml │ │ └── menu_credit.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-ja │ │ └── strings.xml │ │ ├── values-zh-rTW │ │ └── strings.xml │ │ ├── values-zh │ │ └── strings.xml │ │ ├── values │ │ ├── arrays.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ids.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ ├── backup_descriptor.xml │ │ └── coursewidget_provider.xml │ ├── release │ └── res │ │ └── values │ │ └── google_maps_api.xml │ └── test │ └── java │ └── com │ └── Ntut │ └── ExampleUnitTest.java ├── bfg-1.13.0.jar ├── build.gradle ├── circle.yml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | ### Android template 2 | # Built application files 3 | *.apk 4 | *.ap_ 5 | 6 | # Files for the ART/Dalvik VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | # Generated files 13 | bin/ 14 | gen/ 15 | out/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | 33 | # Android Studio captures folder 34 | captures/ 35 | 36 | # IntelliJ 37 | *.iml 38 | .idea 39 | 40 | # Keystore files 41 | # Uncomment the following line if you do not want to check your keystore files in. 42 | #*.jks 43 | 44 | # External native build folder generated in Android Studio 2.2 and later 45 | .externalNativeBuild 46 | 47 | # Google Services (e.g. APIs or Firebase) 48 | app/google-services.json 49 | 50 | # Freeline 51 | freeline.py 52 | freeline/ 53 | freeline_project_description.json 54 | 55 | # fastlane 56 | fastlane/report.xml 57 | fastlane/Preview.html 58 | fastlane/screenshots 59 | fastlane/test_output 60 | fastlane/readme.md 61 | 62 | -------------------------------------------------------------------------------- /README-zh.md: -------------------------------------------------------------------------------- 1 | # TaipeiTechStudent 2 | README: [English](https://github.com/yaoandy107/TaipeiTechStudent/blob/master/README.md) | [中文](https://github.com/yaoandy107/TaipeiTechStudent/blob/master/README-zh.md) 3 | 4 | 這是給臺北科技大學學生專用的 Android App 5 | 6 | 7 | Get it on Google Play 8 | 9 | 10 | ## 功能 11 | 1. 查詢北科學生課表 12 | 2. 查詢北科當學年行事曆 13 | 3. 獲得北科相關活動資訊 14 | 4. 瀏覽北科入口網站 15 | 5. 查詢北科學生學分資訊 16 | 6. 提供北科詳細校園地圖 17 | 7. 提供特約商店資訊地圖 18 | 8. 介面支援中文、英文、日文顯示 19 | 9. 課表資訊支援中文及英文顯示 20 | 10. 全域推播 21 | ## 更新日誌 22 | ### v2.1 23 | - 新增課表小工具 24 | ## 待辦事項列表 25 | - 重製行事曆介面 26 | - 客製化全域推播 27 | - 增加更多客製化設定 28 | - 允許新增自訂課程於課表上 29 | - 優化活動頁面 30 | ## 需求環境 31 | - Android Studio 3 32 | - Android 5.0+ 33 | ## 貢獻者 34 | - [Wei-Cheng Yao](https://github.com/yaoandy107) 35 | - [Long-Jun](https://github.com/Long-Jun) 36 | - [神崎秀吉](https://github.com/kamisakihideyoshi) 37 | ## 授權 38 | 這項專案使用 Apache 2.0 授權 - 詳情請參閱 [LICENSE](https://github.com/yaoandy107/TaipeiTechStudent/blob/master/LICENSE) 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TaipeiTechStudent 2 | README: [English](https://github.com/yaoandy107/TaipeiTechStudent/blob/master/README.md) | [中文](https://github.com/yaoandy107/TaipeiTechStudent/blob/master/README-zh.md) 3 | 4 | An App for Taipei Tech students 5 | 6 | 7 | Get it on Google Play 8 | 9 | 10 | ## Features 11 | 1. Search Taipei Tech student's curriculum 12 | 2. Display Taipei Tech calendar 13 | 3. Display Taipei Tech event 14 | 4. Browse Taipei Tech portal 15 | 5. Display Taipei Tech student's credit 16 | 6. Display Taipei Tech map 17 | 7. Display Taipei Tech authorized store map 18 | 8. Support Chinese, English and Japanese UI 19 | 9. Support Chinese and English course searching 20 | 10. Push Notification 21 | 22 | ## Requirements 23 | - Android Studio 3 24 | - Android 5.0+ 25 | ## Contributor 26 | - [Wei-Cheng Yao](https://github.com/yaoandy107) 27 | - [Long-Jun](https://github.com/Long-Jun) 28 | - [神崎秀吉](https://github.com/kamisakihideyoshi) 29 | - [Chien Ju](https://github.com/a1573595) 30 | ## License 31 | This project is licensed under the Apache 2.0 License - see the [LICENSE](https://github.com/yaoandy107/TaipeiTechStudent/blob/master/LICENSE) file for details 32 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'io.fabric' 4 | 5 | android { 6 | compileSdkVersion 28 7 | buildToolsVersion '28.0.3' 8 | defaultConfig { 9 | applicationId "com.Ntut" 10 | minSdkVersion 19 11 | targetSdkVersion 28 12 | versionCode 36 13 | versionName "2.1.21" 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled true 19 | shrinkResources true 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | lintOptions { 24 | abortOnError false 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation 'com.google.firebase:firebase-database:16.0.6' 34 | implementation 'com.google.firebase:firebase-core:16.0.7' 35 | implementation 'com.google.firebase:firebase-messaging:17.3.4' 36 | implementation 'com.google.firebase:firebase-appindexing:17.1.0' 37 | implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9' 38 | 39 | implementation fileTree(include: ['*.jar'], dir: 'libs') 40 | androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { 41 | exclude group: 'com.android.support', module: 'support-annotations' 42 | }) 43 | implementation 'androidx.appcompat:appcompat:1.0.2' 44 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 45 | implementation 'com.google.android.material:material:1.1.0-alpha07' 46 | implementation 'com.github.bumptech.glide:glide:4.9.0' 47 | annotationProcessor 'androidx.annotation:annotation:1.1.0' 48 | annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' 49 | implementation 'com.github.bumptech.glide:okhttp3-integration:1.5.0@aar' 50 | implementation 'com.squareup.okhttp3:okhttp:3.14.1' 51 | implementation 'com.github.Triggertrap:SeekArc:v1.1' 52 | implementation 'com.google.code.gson:gson:2.8.5' 53 | implementation 'net.sourceforge.htmlcleaner:htmlcleaner:2.18' 54 | implementation 'org.jsoup:jsoup:1.11.3' 55 | implementation 'com.ashokvarma.android:bottom-navigation-bar:2.1.0' 56 | testImplementation 'junit:junit:4.12' 57 | implementation 'com.google.android.gms:play-services-maps:16.1.0' 58 | } 59 | 60 | configurations.all { 61 | resolutionStrategy.eachDependency { details -> 62 | def requested = details.requested 63 | if (requested.group == 'com.android.support') { 64 | if (!requested.name.startsWith("multidex")) { 65 | details.useVersion '28.0.0' 66 | } 67 | } 68 | } 69 | } 70 | 71 | 72 | apply plugin: 'com.google.gms.google-services' 73 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/blackmaple/Android/Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | -keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | public *; 17 | } 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | 27 | # Firebase realtime database 28 | -keepattributes Signature 29 | -keepclassmembers class com.yourcompany.models.** { 30 | *; 31 | } 32 | -ignorewarnings 33 | -keep class * { 34 | public private *; 35 | } 36 | 37 | # Crashlytics 38 | -keepattributes *Annotation* 39 | -keepattributes SourceFile,LineNumberTable 40 | -keep public class * extends java.lang.Exception 41 | -keep class com.crashlytics.** { *; } 42 | -dontwarn com.crashlytics.** -------------------------------------------------------------------------------- /app/release/app-release.aab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/release/app-release.aab -------------------------------------------------------------------------------- /app/src/androidTest/java/com/Ntut/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.Ntut; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.Ntut", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/debug/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | AIzaSyDf_uUIAF46xkSdYhdD3ZB1lUXpPUXe5nI 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.Ntut; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.os.PersistableBundle; 6 | 7 | import androidx.annotation.Nullable; 8 | import androidx.appcompat.app.AlertDialog; 9 | import androidx.appcompat.app.AppCompatActivity; 10 | 11 | /** 12 | * Created by blackmaple on 2017/7/15. 13 | */ 14 | 15 | public class BaseActivity extends AppCompatActivity { 16 | 17 | @Override 18 | public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) { 19 | super.onCreate(savedInstanceState, persistentState); 20 | } 21 | 22 | protected void showAlertMessage(String message) { 23 | AlertDialog.Builder builder = new AlertDialog.Builder(this); 24 | builder.setPositiveButton("返回", null); 25 | builder.setTitle("提示"); 26 | builder.setMessage(message); 27 | builder.create().show(); 28 | } 29 | 30 | protected void showAlertMessage(String title, String message) { 31 | AlertDialog.Builder builder = new AlertDialog.Builder(this); 32 | builder.setPositiveButton("返回", null); 33 | builder.setTitle(title); 34 | builder.setMessage(message); 35 | builder.create().show(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.Ntut; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.view.animation.Animation; 10 | import android.view.inputmethod.InputMethodManager; 11 | 12 | import androidx.annotation.Nullable; 13 | import androidx.appcompat.app.AlertDialog; 14 | import androidx.fragment.app.Fragment; 15 | 16 | /** 17 | * Created by Andy on 2017/4/28. 18 | */ 19 | 20 | public abstract class BaseFragment extends Fragment { 21 | 22 | private View rootView; 23 | protected Context context; 24 | private Boolean hasInitData = false; 25 | 26 | @Override 27 | public void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | context = getActivity(); 30 | } 31 | 32 | @Nullable 33 | @Override 34 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 35 | if (rootView != null) { 36 | return rootView; 37 | } 38 | return super.onCreateView(inflater, container, savedInstanceState); 39 | } 40 | 41 | protected void showAlertMessage(String message) { 42 | Activity activity = getActivity(); 43 | if (activity != null) { 44 | AlertDialog.Builder builder = new AlertDialog.Builder(activity); 45 | builder.setPositiveButton("返回", null); 46 | builder.setTitle("提示"); 47 | builder.setMessage(message); 48 | builder.create().show(); 49 | } 50 | } 51 | 52 | 53 | public void closeSoftKeyboard() { 54 | Activity activity = getActivity(); 55 | if (activity != null && activity.getCurrentFocus() != null) { 56 | InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); 57 | inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus() 58 | .getWindowToken(), 0); 59 | } 60 | } 61 | 62 | 63 | 64 | public void setAnimationListener(Animation.AnimationListener listener) { 65 | Animation.AnimationListener mAnimationListener = listener; 66 | } 67 | 68 | public abstract int getTitleColorId(); 69 | 70 | public abstract int getTitleStringId(); 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.Ntut; 2 | 3 | import android.app.Application; 4 | import android.content.SharedPreferences; 5 | 6 | import com.Ntut.model.Model; 7 | 8 | import java.net.*; 9 | 10 | /** 11 | * Created by blackmaple on 2017/5/8. 12 | */ 13 | 14 | public class MainApplication extends Application { 15 | private static MainApplication singleton; 16 | public static String SETTING_NAME = "TaipeiTech"; 17 | public static MainApplication getInstance() { 18 | return singleton; 19 | } 20 | 21 | @Override 22 | public void onCreate() { 23 | super.onCreate(); 24 | CookieHandler.setDefault(new java.net.CookieManager(null, CookiePolicy.ACCEPT_ALL)); 25 | singleton = this; 26 | Model.getInstance(); 27 | } 28 | 29 | public static String readSetting(String settingName) { 30 | SharedPreferences settings = singleton.getSharedPreferences( 31 | SETTING_NAME, MODE_PRIVATE); 32 | return settings.getString(settingName, ""); 33 | } 34 | 35 | public static void writeSetting(String settingName, String value) { 36 | SharedPreferences settings = singleton.getSharedPreferences( 37 | SETTING_NAME, MODE_PRIVATE); 38 | settings.edit().putString(settingName, value).apply(); 39 | } 40 | 41 | public static void clearSettings(String settingName) { 42 | SharedPreferences settings = singleton.getSharedPreferences( 43 | SETTING_NAME, MODE_PRIVATE); 44 | settings.edit().remove(settingName).apply(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/about/AboutActivity.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.about; 2 | 3 | import android.graphics.drawable.ColorDrawable; 4 | import android.os.Bundle; 5 | import android.view.KeyEvent; 6 | import android.view.MotionEvent; 7 | import android.webkit.WebSettings; 8 | import android.webkit.WebView; 9 | import android.webkit.WebViewClient; 10 | 11 | import androidx.annotation.Nullable; 12 | import androidx.appcompat.app.ActionBar; 13 | import androidx.appcompat.app.AppCompatActivity; 14 | import androidx.appcompat.widget.Toolbar; 15 | 16 | import com.Ntut.R; 17 | import com.Ntut.utility.Utility; 18 | import com.Ntut.utility.WifiUtility; 19 | 20 | /** 21 | * Created by Andy on 2017/7/23. 22 | */ 23 | 24 | public class AboutActivity extends AppCompatActivity { 25 | 26 | private Toolbar mToolbar; 27 | private WebView webview; 28 | private final static String CACHE_DIRNAME = "about_webview"; 29 | 30 | @Override 31 | protected void onCreate(@Nullable Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_about); 34 | mToolbar = findViewById(R.id.main_toolbar); 35 | setSupportActionBar(mToolbar); 36 | setActionBar(); 37 | webview = findViewById(R.id.about_webview); 38 | webview.setWebViewClient(new WebViewClient()); 39 | webview.setOnKeyListener((v, keyCode, event) -> { 40 | if (keyCode == KeyEvent.KEYCODE_BACK 41 | && event.getAction() == MotionEvent.ACTION_UP 42 | && webview.canGoBack()) { 43 | webview.goBack(); 44 | return true; 45 | } 46 | 47 | return false; 48 | }); 49 | initWebViewSettings(); 50 | webview.loadUrl("https://www.ntut.edu.tw/~ntutsu/tts/2.0/about.html"); 51 | } 52 | 53 | private void initWebViewSettings() { 54 | WebSettings webSetting = webview.getSettings(); 55 | webSetting.setJavaScriptEnabled(true); 56 | webSetting.setUseWideViewPort(true); 57 | webSetting.setLoadWithOverviewMode(true); 58 | webSetting.setSupportZoom(true); 59 | webSetting.setBuiltInZoomControls(true); 60 | webSetting.setDisplayZoomControls(false); 61 | webSetting.setAllowFileAccess(true); 62 | webSetting.setJavaScriptCanOpenWindowsAutomatically(true); 63 | webSetting.setLoadsImagesAutomatically(true); 64 | webSetting.setDefaultTextEncodingName("utf-8"); 65 | if (WifiUtility.isConnected(this)) { 66 | webSetting.setCacheMode(WebSettings.LOAD_DEFAULT); 67 | } else { 68 | webSetting.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); 69 | } 70 | webSetting.setDomStorageEnabled(true); 71 | webSetting.setDatabaseEnabled(true); 72 | webSetting.setAppCacheEnabled(true); 73 | String cacheDirPath = getFilesDir().getAbsolutePath() + CACHE_DIRNAME; 74 | webSetting.setAppCachePath(cacheDirPath); 75 | } 76 | 77 | public void setActionBar() { 78 | ActionBar actionBar = getSupportActionBar(); 79 | if (actionBar != null) { 80 | actionBar.setDisplayHomeAsUpEnabled(true); 81 | mToolbar.setNavigationOnClickListener(v -> finish()); 82 | actionBar.setTitle(R.string.about_text); 83 | actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.about_color))); 84 | } 85 | Utility.setStatusBarColor(this, getResources().getColor(R.color.about_color)); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/calendar/CalendarPageAdapter.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.calendar; 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.ListView; 8 | 9 | import androidx.viewpager.widget.PagerAdapter; 10 | 11 | import com.Ntut.R; 12 | import com.Ntut.model.CalendarInfo; 13 | import com.Ntut.model.Model; 14 | 15 | import java.util.ArrayList; 16 | import java.util.Calendar; 17 | 18 | /** 19 | * Created by blackmaple on 2017/5/12. 20 | */ 21 | 22 | public class CalendarPageAdapter extends PagerAdapter { 23 | private Model model = Model.getInstance(); 24 | private Context context; 25 | private Calendar calendar; 26 | private LayoutInflater inflater; 27 | 28 | public CalendarPageAdapter(Context context, Calendar calendar) { 29 | this.context = context; 30 | this.calendar = calendar; 31 | inflater = LayoutInflater.from(context); 32 | } 33 | 34 | @Override 35 | public int getCount() { 36 | return 3; 37 | } 38 | 39 | @Override 40 | public boolean isViewFromObject(View view, Object obj) { 41 | return view.equals(obj); 42 | } 43 | 44 | @Override 45 | public Object instantiateItem(ViewGroup container, int position) { 46 | ListView listView = (ListView) inflater.inflate( 47 | R.layout.calendar_listview, container, false); 48 | String year; 49 | String month; 50 | Calendar temp_calendar = (Calendar) calendar.clone(); 51 | temp_calendar.add(Calendar.MONTH, position - 1); 52 | year = String.valueOf(temp_calendar.get(Calendar.YEAR)); 53 | month = String.valueOf(temp_calendar.get(Calendar.MONTH) + 1); 54 | ArrayList event_list = model.getYearCalendar() 55 | .getMonthEventList(year, month); 56 | listView.setAdapter(new CalendarListAdapter(context, event_list)); 57 | container.addView(listView); 58 | return listView; 59 | } 60 | 61 | @Override 62 | public void destroyItem(ViewGroup container, int position, Object object) { 63 | container.removeView((View) object); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/calendar/MonthPickerDialog.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.calendar; 2 | 3 | import android.app.AlertDialog; 4 | import android.content.Context; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.widget.TextView; 8 | 9 | import com.Ntut.R; 10 | import com.triggertrap.seekarc.SeekArc; 11 | 12 | import java.util.Calendar; 13 | import java.util.Locale; 14 | 15 | /** 16 | * Created by blackmaple on 2017/5/12. 17 | */ 18 | 19 | public class MonthPickerDialog extends AlertDialog implements SeekArc.OnSeekArcChangeListener { 20 | private Context mContext; 21 | private Calendar calendar; 22 | private TextView month_text; 23 | private final static int[] months = {5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4}; 24 | private int startYear; 25 | 26 | public MonthPickerDialog(Context context, Calendar calendar, int start_year) { 27 | super(context); 28 | mContext = context; 29 | this.calendar = (Calendar) calendar.clone(); 30 | this.calendar.set(Calendar.DAY_OF_MONTH, 15); 31 | if (calendar.get(Calendar.MONTH) < 7 32 | && calendar.get(Calendar.YEAR) <= start_year) { 33 | this.calendar.set(Calendar.MONTH, 7); 34 | this.calendar.set(Calendar.YEAR, start_year); 35 | } else if (calendar.get(Calendar.MONTH) > 6 36 | && calendar.get(Calendar.YEAR) >= start_year + 1) { 37 | this.calendar.set(Calendar.MONTH, 6); 38 | this.calendar.set(Calendar.YEAR, start_year + 1); 39 | } 40 | startYear = start_year; 41 | setTitle(String.format(Locale.TAIWAN, "%d 學年度行事曆", start_year - 1911)); 42 | setDialog(); 43 | } 44 | 45 | private void setDialog() { 46 | 47 | setCancelable(true); 48 | View content = LayoutInflater.from(mContext).inflate( 49 | R.layout.month_picker_dialog, null); 50 | setView(content); 51 | month_text = content.findViewById(R.id.month_text); 52 | SeekArc monthSeekArc = content.findViewById(R.id.month_seekarc); 53 | monthSeekArc.setTouchInSide(true); 54 | monthSeekArc.setSweepAngle(300); 55 | monthSeekArc.setClockwise(false); 56 | monthSeekArc.setArcRotation(30); 57 | monthSeekArc.setOnSeekArcChangeListener(this); 58 | int index = months[calendar.get(Calendar.MONTH)]; 59 | int progress = ((index == 11) ? 100 : (int) (index * (100.8 / 12))); 60 | monthSeekArc.setProgress(progress); 61 | updateMonthText(); 62 | } 63 | 64 | public void setOnNegativeButtonClickListener(OnClickListener onClickListener) { 65 | setButton(BUTTON_POSITIVE, "確定", onClickListener); 66 | setButton(BUTTON_NEGATIVE, "取消", (OnClickListener) null); 67 | } 68 | 69 | public int getMonth() { 70 | return calendar.get(Calendar.MONTH) + 1; 71 | } 72 | 73 | public int getYear() { 74 | return calendar.get(Calendar.YEAR); 75 | } 76 | 77 | private void updateMonthText() { 78 | month_text.setText(String.format(Locale.US, "%tB %tY", calendar, 79 | calendar)); 80 | } 81 | 82 | @Override 83 | public void onProgressChanged(SeekArc seekArc, int progress, 84 | boolean fromUser) { 85 | if (fromUser) { 86 | int index = (int) (progress / (100.8 / 12)); 87 | if (index < 5) { 88 | this.calendar.set(Calendar.MONTH, index + 7); 89 | this.calendar.set(Calendar.YEAR, startYear); 90 | } else { 91 | this.calendar.set(Calendar.MONTH, index - 5); 92 | this.calendar.set(Calendar.YEAR, startYear + 1); 93 | } 94 | updateMonthText(); 95 | } 96 | } 97 | 98 | @Override 99 | public void onStartTrackingTouch(SeekArc seekArc) { 100 | 101 | } 102 | 103 | @Override 104 | public void onStopTrackingTouch(SeekArc seekArc) { 105 | 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/club/ClubActivity.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.club; 2 | 3 | import android.graphics.drawable.ColorDrawable; 4 | import android.os.Bundle; 5 | import android.view.KeyEvent; 6 | import android.view.MotionEvent; 7 | import android.webkit.WebSettings; 8 | import android.webkit.WebView; 9 | import android.webkit.WebViewClient; 10 | 11 | import androidx.annotation.Nullable; 12 | import androidx.appcompat.app.ActionBar; 13 | import androidx.appcompat.app.AppCompatActivity; 14 | import androidx.appcompat.widget.Toolbar; 15 | 16 | import com.Ntut.R; 17 | import com.Ntut.utility.Utility; 18 | import com.Ntut.utility.WifiUtility; 19 | 20 | /** 21 | * Created by Andy on 2017/7/23. 22 | */ 23 | 24 | public class ClubActivity extends AppCompatActivity { 25 | 26 | private Toolbar mToolbar; 27 | private WebView webview; 28 | private final static String CACHE_DIRNAME = "club_webview"; 29 | 30 | @Override 31 | protected void onCreate(@Nullable Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_club); 34 | mToolbar = findViewById(R.id.main_toolbar); 35 | setSupportActionBar(mToolbar); 36 | setActionBar(); 37 | webview = findViewById(R.id.club_webview); 38 | webview.setWebViewClient(new WebViewClient()); 39 | webview.setOnKeyListener((v, keyCode, event) -> { 40 | if (keyCode == KeyEvent.KEYCODE_BACK 41 | && event.getAction() == MotionEvent.ACTION_UP 42 | && webview.canGoBack()) { 43 | webview.goBack(); 44 | return true; 45 | } 46 | 47 | return false; 48 | }); 49 | initWebViewSettings(); 50 | webview.loadUrl("https://www.google.com.tw/search?q=android+webview&rlz=1C1CHZL_zh-TWTW722TW722&oq=android+webview&aqs=chrome..69i57j69i65j35i39l2j0l2.5582j0j7&sourceid=chrome&ie=UTF-8"); 51 | } 52 | 53 | private void initWebViewSettings() { 54 | WebSettings webSetting = webview.getSettings(); 55 | webSetting.setJavaScriptEnabled(true); 56 | webSetting.setUseWideViewPort(true); 57 | webSetting.setLoadWithOverviewMode(true); 58 | webSetting.setSupportZoom(true); 59 | webSetting.setBuiltInZoomControls(true); 60 | webSetting.setDisplayZoomControls(false); 61 | webSetting.setAllowFileAccess(true); 62 | webSetting.setJavaScriptCanOpenWindowsAutomatically(true); 63 | webSetting.setLoadsImagesAutomatically(true); 64 | webSetting.setDefaultTextEncodingName("utf-8"); 65 | if (WifiUtility.isConnected(this)) { 66 | webSetting.setCacheMode(WebSettings.LOAD_DEFAULT); 67 | } else { 68 | webSetting.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); 69 | } 70 | webSetting.setDomStorageEnabled(true); 71 | webSetting.setDatabaseEnabled(true); 72 | webSetting.setAppCacheEnabled(true); 73 | String cacheDirPath = getFilesDir().getAbsolutePath() + CACHE_DIRNAME; 74 | webSetting.setAppCachePath(cacheDirPath); 75 | } 76 | 77 | public void setActionBar() { 78 | ActionBar actionBar = getSupportActionBar(); 79 | if (actionBar != null) { 80 | actionBar.setDisplayHomeAsUpEnabled(true); 81 | mToolbar.setNavigationOnClickListener(v -> finish()); 82 | actionBar.setTitle(R.string.club_text); 83 | actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.blue))); 84 | } 85 | Utility.setStatusBarColor(this, getResources().getColor(R.color.blue)); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/course/CourseBlock.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.course; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.graphics.drawable.ColorDrawable; 6 | import android.graphics.drawable.StateListDrawable; 7 | import android.view.Gravity; 8 | 9 | import androidx.appcompat.widget.AppCompatTextView; 10 | import androidx.core.content.ContextCompat; 11 | 12 | import com.Ntut.R; 13 | 14 | /** 15 | * Created by blackmaple on 2017/5/9. 16 | */ 17 | 18 | public class CourseBlock extends AppCompatTextView { 19 | public CourseBlock(Context context) { 20 | super(context); 21 | setTextColor(ContextCompat.getColor(context, R.color.darken)); 22 | setGravity(Gravity.CENTER); 23 | setPadding(2, 0, 2, 0); 24 | setTextSize(12); 25 | } 26 | 27 | @Override 28 | public void setBackgroundColor(int color) { 29 | StateListDrawable background_drawable = new StateListDrawable(); 30 | background_drawable.addState( 31 | new int[]{android.R.attr.state_pressed}, new ColorDrawable( 32 | getResources().getColor(R.color.silver))); 33 | background_drawable.addState( 34 | new int[]{android.R.attr.state_enabled}, new ColorDrawable( 35 | color)); 36 | setBackgroundDrawable(background_drawable); 37 | } 38 | 39 | public void resetBlock() { 40 | setText(null); 41 | setTag(null); 42 | super.setBackgroundColor(Color.TRANSPARENT); 43 | setOnClickListener(null); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/course/SemesterSelector.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.course; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | 7 | import androidx.appcompat.app.AlertDialog; 8 | import androidx.appcompat.widget.AppCompatButton; 9 | 10 | import com.Ntut.model.Semester; 11 | 12 | import java.util.ArrayList; 13 | 14 | /** 15 | * Created by blackmaple on 2017/5/9. 16 | */ 17 | 18 | public class SemesterSelector extends AppCompatButton implements View.OnClickListener { 19 | private OnSemesterSelectedListener mOnSemesterSelectedListener; 20 | private ArrayList mSemesterList = new ArrayList<>(); 21 | private String[] mSemesterArray; 22 | 23 | public SemesterSelector(Context context, AttributeSet attrs) { 24 | super(context, attrs, androidx.appcompat.R.attr.spinnerStyle); 25 | } 26 | 27 | public SemesterSelector(Context context, AttributeSet attrs, int defStyleAttr) { 28 | super(context, attrs, defStyleAttr); 29 | super.setOnClickListener(this); 30 | } 31 | 32 | @Override 33 | protected void onFinishInflate() { 34 | super.onFinishInflate(); 35 | super.setOnClickListener(this); 36 | } 37 | 38 | public void setOnSemesterSelectedListener(OnSemesterSelectedListener listener) { 39 | mOnSemesterSelectedListener = listener; 40 | } 41 | 42 | @Override 43 | public void setOnClickListener(View.OnClickListener l) { 44 | } 45 | 46 | public void setSemesterList(ArrayList list) { 47 | mSemesterList.clear(); 48 | mSemesterList.addAll(list); 49 | mSemesterArray = new String[list.size()]; 50 | for (int i = list.size() - 1; i >= 0; i--) { 51 | mSemesterArray[i] = list.get(i).toString(); 52 | } 53 | } 54 | 55 | public void setText(Semester semester) { 56 | if (semester != null) { 57 | setText(semester.toString()); 58 | } else { 59 | setText(""); 60 | } 61 | } 62 | 63 | @Override 64 | public void onClick(View v) { 65 | if (mSemesterArray == null) { 66 | return; 67 | } 68 | AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); 69 | builder.setTitle("學期"); 70 | builder.setItems(mSemesterArray, (dialog, which) -> { 71 | if (mOnSemesterSelectedListener != null) { 72 | mOnSemesterSelectedListener.onSemesterSelected(mSemesterList.get(which)); 73 | } 74 | }); 75 | builder.show(); 76 | } 77 | 78 | public interface OnSemesterSelectedListener { 79 | void onSemesterSelected(Semester semester); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/course/task/CourseDetailTask.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.course.task; 2 | 3 | import android.app.ProgressDialog; 4 | import android.os.AsyncTask; 5 | 6 | import com.Ntut.course.CourseFragment; 7 | import com.Ntut.model.Model; 8 | import com.Ntut.utility.NportalConnector; 9 | 10 | import java.lang.ref.WeakReference; 11 | 12 | /** 13 | * Created by blackmaple on 2017/5/9. 14 | */ 15 | 16 | public class CourseDetailTask extends AsyncTask { 17 | private WeakReference mCourseFragmentWeakReference; 18 | private WeakReference mProgressDialogWeakReference; 19 | 20 | public CourseDetailTask(CourseFragment fragment) { 21 | mCourseFragmentWeakReference = new WeakReference<>(fragment); 22 | } 23 | 24 | @Override 25 | protected void onPreExecute() { 26 | super.onPreExecute(); 27 | CourseFragment fragment = mCourseFragmentWeakReference.get(); 28 | if (fragment != null && !NportalConnector.isLogin()) { 29 | ProgressDialog progressDialog = ProgressDialog.show(fragment.getContext(), null, "登入校園入口網站中…"); 30 | mProgressDialogWeakReference = new WeakReference<>(progressDialog); 31 | } 32 | } 33 | 34 | @Override 35 | protected Object doInBackground(String... params) { 36 | Object result; 37 | try { 38 | if (!NportalConnector.isLogin()) { 39 | String account = Model.getInstance().getAccount(); 40 | String password = Model.getInstance().getPassword(); 41 | NportalConnector.login(account, password); 42 | } 43 | result = true; 44 | } catch (Exception e) { 45 | e.printStackTrace(); 46 | result = e.getMessage(); 47 | } 48 | return result; 49 | } 50 | 51 | @Override 52 | protected void onPostExecute(Object object) { 53 | super.onPostExecute(object); 54 | if (mProgressDialogWeakReference != null) { 55 | ProgressDialog progressDialog = mProgressDialogWeakReference.get(); 56 | if (progressDialog != null) { 57 | progressDialog.dismiss(); 58 | } 59 | } 60 | CourseFragment fragment = mCourseFragmentWeakReference.get(); 61 | if (fragment != null) { 62 | fragment.startCourseDetail(object); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/course/task/QuerySemesterTask.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.course.task; 2 | 3 | import android.app.ProgressDialog; 4 | import android.os.AsyncTask; 5 | 6 | import com.Ntut.course.CourseFragment; 7 | import com.Ntut.model.Model; 8 | import com.Ntut.utility.Constants; 9 | import com.Ntut.utility.CourseConnector; 10 | import com.Ntut.utility.NportalConnector; 11 | 12 | import java.lang.ref.WeakReference; 13 | 14 | /** 15 | * Created by blackmaple on 2017/5/9. 16 | */ 17 | 18 | public class QuerySemesterTask extends AsyncTask { 19 | private WeakReference mCourseFragmentWeakReference; 20 | private WeakReference mProgressDialogWeakReference; 21 | 22 | public QuerySemesterTask(CourseFragment fragment) { 23 | mCourseFragmentWeakReference = new WeakReference<>(fragment); 24 | } 25 | 26 | @Override 27 | protected void onPreExecute() { 28 | super.onPreExecute(); 29 | CourseFragment fragment = mCourseFragmentWeakReference.get(); 30 | if (fragment != null) { 31 | ProgressDialog progressDialog = ProgressDialog.show(fragment.getContext(), null, "學期清單查詢中…"); 32 | mProgressDialogWeakReference = new WeakReference<>(progressDialog); 33 | } else { 34 | cancel(true); 35 | } 36 | } 37 | 38 | @Override 39 | protected Object doInBackground(String... params) { 40 | int retryCount = 0; 41 | Object result; 42 | do { 43 | try { 44 | if (!NportalConnector.isLogin()) { 45 | String account = Model.getInstance().getAccount(); 46 | String password = Model.getInstance().getPassword(); 47 | NportalConnector.login(account, password); 48 | } 49 | if (!CourseConnector.isLogin()) { 50 | CourseConnector.loginCourse(); 51 | } 52 | result = CourseConnector.getCourseSemesters(params[0]); 53 | break; 54 | } catch (Exception e) { 55 | e.printStackTrace(); 56 | result = e.getMessage(); 57 | retryCount++; 58 | } 59 | } while (retryCount <= Constants.RETRY_MAX_COUNT_INT); 60 | return result; 61 | } 62 | 63 | @Override 64 | protected void onPostExecute(Object object) { 65 | super.onPostExecute(object); 66 | 67 | ProgressDialog progressDialog = mProgressDialogWeakReference.get(); 68 | if (progressDialog != null && progressDialog.isShowing()) { 69 | progressDialog.dismiss(); 70 | } 71 | CourseFragment fragment = mCourseFragmentWeakReference.get(); 72 | if (fragment != null) { 73 | fragment.obtainSemesterList(object); 74 | } 75 | } 76 | 77 | @Override 78 | protected void onCancelled() { 79 | super.onCancelled(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/course/task/SearchCourseTask.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.course.task; 2 | 3 | import android.app.ProgressDialog; 4 | import android.os.AsyncTask; 5 | 6 | import com.Ntut.course.CourseFragment; 7 | import com.Ntut.model.Model; 8 | import com.Ntut.utility.Constants; 9 | import com.Ntut.utility.CourseConnector; 10 | import com.Ntut.utility.NportalConnector; 11 | 12 | import java.lang.ref.WeakReference; 13 | 14 | /** 15 | * Created by blackmaple on 2017/5/9. 16 | */ 17 | 18 | public class SearchCourseTask extends AsyncTask { 19 | private WeakReference mCourseFragmentWeakReference; 20 | private WeakReference mProgressDialogWeakReference; 21 | 22 | public SearchCourseTask(CourseFragment fragment) { 23 | mCourseFragmentWeakReference = new WeakReference<>(fragment); 24 | } 25 | 26 | @Override 27 | protected void onPreExecute() { 28 | super.onPreExecute(); 29 | CourseFragment fragment = mCourseFragmentWeakReference.get(); 30 | if (fragment != null) { 31 | ProgressDialog progressDialog = ProgressDialog.show(fragment.getContext(), null, "課表查詢中…"); 32 | mProgressDialogWeakReference = new WeakReference<>(progressDialog); 33 | } else { 34 | cancel(true); 35 | } 36 | } 37 | 38 | @Override 39 | protected Object doInBackground(String... params) { 40 | int retryCount = 0; 41 | Object result; 42 | do { 43 | try { 44 | if (!NportalConnector.isLogin()) { 45 | String account = Model.getInstance().getAccount(); 46 | String password = Model.getInstance().getPassword(); 47 | NportalConnector.login(account, password); 48 | } 49 | if (!CourseConnector.isLogin()) { 50 | CourseConnector.loginCourse(); 51 | } 52 | result = CourseConnector.getStudentCourse(params[0], params[1], 53 | params[2]); 54 | break; 55 | } catch (Exception e) { 56 | e.printStackTrace(); 57 | result = e.getMessage(); 58 | retryCount++; 59 | } 60 | } while (retryCount <= Constants.RETRY_MAX_COUNT_INT); 61 | return result; 62 | } 63 | 64 | @Override 65 | protected void onPostExecute(Object object) { 66 | super.onPostExecute(object); 67 | ProgressDialog progressDialog = mProgressDialogWeakReference.get(); 68 | if (progressDialog != null) { 69 | progressDialog.dismiss(); 70 | } 71 | CourseFragment fragment = mCourseFragmentWeakReference.get(); 72 | if (fragment != null) { 73 | fragment.obtainStudentCourse(object); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/credit/CreditGeneralView.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.credit; 2 | 3 | import android.content.Context; 4 | import android.graphics.Typeface; 5 | import android.view.LayoutInflater; 6 | import android.view.ViewGroup; 7 | import android.widget.LinearLayout; 8 | import android.widget.ScrollView; 9 | import android.widget.TextView; 10 | 11 | import com.Ntut.R; 12 | import com.Ntut.model.GeneralCredit; 13 | import com.Ntut.model.GeneralCreditInfo; 14 | import com.Ntut.model.StudentCredit; 15 | 16 | /** 17 | * Created by blackmaple on 2017/5/15. 18 | */ 19 | 20 | public class CreditGeneralView extends ScrollView { 21 | StudentCredit studentCredit; 22 | LinearLayout container; 23 | 24 | public CreditGeneralView(Context context) { 25 | super(context); 26 | } 27 | 28 | public CreditGeneralView(Context context, StudentCredit studentCredit) { 29 | this(context); 30 | this.studentCredit = studentCredit; 31 | ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( 32 | LayoutParams.MATCH_PARENT, 33 | CreditActivity.CONTENT_ROW_HEIGHT * 8); 34 | setLayoutParams(params); 35 | init(); 36 | } 37 | 38 | private void init() { 39 | container = new LinearLayout(getContext()); 40 | container.setOrientation(LinearLayout.VERTICAL); 41 | container.setBackgroundResource(R.color.credit_bar); 42 | for (GeneralCredit general : studentCredit.getGeneralCredits()) { 43 | LayoutInflater inflater = LayoutInflater.from(getContext()); 44 | TextView title_text = (TextView) inflater.inflate( 45 | R.layout.credit_textview, this, false); 46 | title_text.setBackgroundResource(R.color.white); 47 | title_text.setTypeface(title_text.getTypeface(), Typeface.BOLD); 48 | title_text.setText(general.getTypeName()); 49 | container.addView(title_text); 50 | TextView text = (TextView) inflater.inflate( 51 | R.layout.credit_textview, this, false); 52 | text.setBackgroundResource(R.color.white); 53 | String credit_text = getContext().getString(R.string.credit_essential_core) + general.getMustCoreCredit() 54 | + " "+getContext().getString(R.string.credit_general_core) + general.getHadCoreCredit() + " " + getContext().getString(R.string.credit_general_elective) 55 | + general.getHadCommonCredit(); 56 | text.setText(credit_text); 57 | container.addView(text); 58 | addData(general); 59 | } 60 | addView(container); 61 | } 62 | 63 | private void addData(GeneralCredit general) { 64 | for (GeneralCreditInfo course : general.getGenerals()) { 65 | LayoutInflater inflater = LayoutInflater.from(getContext()); 66 | TextView text = (TextView) inflater.inflate( 67 | R.layout.credit_textview, this, false); 68 | text.setBackgroundResource(R.color.white); 69 | String course_text = course.getYear() + "-" + course.getSem() 70 | + " " + course.getCourseName(); 71 | text.setText(course_text); 72 | if (course.isCore()) { 73 | text.setTextColor(getResources().getColor(R.color.red)); 74 | } 75 | container.addView(text); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/credit/CreditGroupView.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.credit; 2 | 3 | import android.content.Context; 4 | import android.widget.LinearLayout; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | 8 | import com.Ntut.R; 9 | import com.Ntut.utility.SlideAnimator; 10 | 11 | /** 12 | * Created by blackmaple on 2017/5/15. 13 | */ 14 | 15 | public class CreditGroupView extends LinearLayout implements View.OnClickListener { 16 | private SlideAnimator animator; 17 | 18 | public CreditGroupView(Context context) { 19 | super(context); 20 | inflate(context, R.layout.credit_group, this); 21 | View title_background = findViewById(R.id.title_background); 22 | title_background.setOnClickListener(this); 23 | LinearLayout container = findViewById(R.id.container); 24 | container.setVisibility(View.GONE); 25 | animator = new SlideAnimator(context, container); 26 | } 27 | 28 | public void setSlideAnimationListener(SlideAnimator.SlideAnimationListener listener) { 29 | animator.setSlideAnimationListener(listener); 30 | } 31 | 32 | public void setGroupTitle(String title) { 33 | TextView group_title = findViewById(R.id.group_title); 34 | group_title.setText(title); 35 | } 36 | 37 | public void setGroupPS(String ps) { 38 | TextView group_ps = findViewById(R.id.group_ps); 39 | group_ps.setText(ps); 40 | } 41 | 42 | @Override 43 | public void addView(View v) { 44 | LinearLayout container = findViewById(R.id.container); 45 | container.addView(v); 46 | } 47 | 48 | @Override 49 | public void removeAllViews() { 50 | LinearLayout container = findViewById(R.id.container); 51 | container.removeAllViews(); 52 | } 53 | 54 | @Override 55 | public void onClick(View v) { 56 | switch (v.getId()) { 57 | case R.id.title_background: 58 | animator.toggle(); 59 | break; 60 | 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/credit/CreditTypeListActivity.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.credit; 2 | 3 | import android.content.Intent; 4 | import android.graphics.drawable.ColorDrawable; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.widget.ArrayAdapter; 9 | import android.widget.LinearLayout; 10 | import android.widget.Spinner; 11 | import android.widget.TextView; 12 | 13 | import androidx.appcompat.app.ActionBar; 14 | import androidx.appcompat.app.AppCompatActivity; 15 | import androidx.appcompat.widget.Toolbar; 16 | 17 | import com.Ntut.R; 18 | import com.Ntut.model.CreditInfo; 19 | import com.Ntut.model.Model; 20 | import com.Ntut.model.SemesterCredit; 21 | import com.Ntut.utility.Utility; 22 | 23 | import java.util.ArrayList; 24 | 25 | /** 26 | * Created by blackmaple on 2017/5/15. 27 | */ 28 | 29 | public class CreditTypeListActivity extends AppCompatActivity { 30 | private Toolbar mToolbar; 31 | private int type; 32 | private LinearLayout credit; 33 | 34 | @Override 35 | protected void onCreate(Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | setContentView(R.layout.credit_type_list); 38 | mToolbar = findViewById(R.id.main_toolbar); 39 | setSupportActionBar(mToolbar); 40 | Intent i = getIntent(); 41 | type = i.getIntExtra("type", 0); 42 | String type_text = getResources().getStringArray(R.array.type_name)[type - 1]; 43 | setActionBar(type_text + " "+getString(R.string.credit_sum) 44 | + Model.getInstance().getStudentCredit().getTypeCredits(type)); 45 | credit = findViewById(R.id.credit); 46 | createSemesterGroups(); 47 | } 48 | 49 | private void createSemesterGroups() { 50 | LayoutInflater inflater = getLayoutInflater(); 51 | for (SemesterCredit semesterCredit : Model.getInstance().getStudentCredit() 52 | .getSemesterCredits()) { 53 | CreditGroupView group = new CreditGroupView(this); 54 | group.setGroupTitle(semesterCredit.getYear() + "-" 55 | + semesterCredit.getSemester()); 56 | group.setGroupPS("小計:" + semesterCredit.getTypeCredits(type)); 57 | ArrayList credits = semesterCredit.getCredits(); 58 | int i = 0; 59 | for (CreditInfo credit : credits) { 60 | if (credit.getType() == type) { 61 | View item = inflater.inflate(R.layout.credit_item, null, 62 | false); 63 | item.setBackgroundResource(R.color.white); 64 | TextView courseNo = item.findViewById(R.id.courseNo); 65 | courseNo.setText(credit.getCourseNo()); 66 | TextView courseName = item.findViewById(R.id.courseName); 67 | courseName.setText(credit.getCourseName()); 68 | TextView credit_text = item.findViewById(R.id.credit); 69 | credit_text.setText(String.valueOf(credit.getCredit())); 70 | Spinner type = item.findViewById(R.id.type); 71 | ArrayAdapter dataAdapter = new ArrayAdapter<>( 72 | this, R.layout.credit_type_textview, getResources() 73 | .getStringArray(R.array.credit_type)); 74 | dataAdapter 75 | .setDropDownViewResource(R.layout.credit_type_textview); 76 | type.setAdapter(dataAdapter); 77 | type.setSelection(credit.getType()); 78 | type.setClickable(false); 79 | type.setEnabled(false); 80 | TextView score = item.findViewById(R.id.score); 81 | score.setText(credit.getScore()); 82 | group.addView(item); 83 | i++; 84 | } 85 | } 86 | if (i > 0) { 87 | credit.addView(group); 88 | } 89 | } 90 | } 91 | 92 | public void setActionBar(String title) { 93 | ActionBar actionBar = getSupportActionBar(); 94 | if (actionBar != null) { 95 | actionBar.setDisplayHomeAsUpEnabled(true); 96 | mToolbar.setNavigationOnClickListener(v -> onBackPressed()); 97 | actionBar.setTitle(title); 98 | actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.credit_color))); 99 | } 100 | Utility.setStatusBarColor(this, getResources().getColor(R.color.credit_color)); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/credit/MenuSpinner.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.credit; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import androidx.appcompat.widget.AppCompatSpinner; 7 | 8 | /** 9 | * Created by blackmaple on 2017/5/15. 10 | */ 11 | 12 | public class MenuSpinner extends AppCompatSpinner { 13 | 14 | OnItemSelectedListener listener; 15 | 16 | public MenuSpinner(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | } 19 | 20 | @Override 21 | public void setSelection(int position) { 22 | super.setSelection(position); 23 | if (listener != null) { 24 | listener.onItemSelected(null, null, position, 0); 25 | } 26 | } 27 | 28 | public void setOnItemSelectedEvenIfUnchangedListener( 29 | OnItemSelectedListener listener) { 30 | this.listener = listener; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/event/EventAdapter.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.event; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.ImageView; 11 | import android.widget.TextView; 12 | 13 | import androidx.core.app.ActivityOptionsCompat; 14 | import androidx.core.util.Pair; 15 | import androidx.recyclerview.widget.RecyclerView; 16 | 17 | import com.Ntut.MainActivity; 18 | import com.Ntut.R; 19 | import com.Ntut.model.EventInfo; 20 | import com.Ntut.model.Model; 21 | 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * Created by blackmaple on 2017/5/15. 27 | */ 28 | 29 | public class EventAdapter extends RecyclerView.Adapter { 30 | 31 | private MainActivity context; 32 | private List eventList; 33 | 34 | EventAdapter(List eventList, Context context) { 35 | this.context = (MainActivity) context; 36 | this.eventList = eventList; 37 | } 38 | 39 | static class ViewHolder extends RecyclerView.ViewHolder { 40 | ImageView image; 41 | TextView title; 42 | TextView date; 43 | TextView location; 44 | 45 | ViewHolder(View itemView) { 46 | super(itemView); 47 | image = itemView.findViewById(R.id.event_image); 48 | title = itemView.findViewById(R.id.event_title); 49 | date = itemView.findViewById(R.id.event_date); 50 | location = itemView.findViewById(R.id.event_location); 51 | } 52 | } 53 | 54 | @Override 55 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 56 | View contactView = LayoutInflater.from(context).inflate(R.layout.event_item, parent, false); 57 | return new ViewHolder(contactView); 58 | } 59 | 60 | @Override 61 | public void onBindViewHolder(final ViewHolder holder, final int position) { 62 | final EventInfo event = eventList.get(position); 63 | final ImageView image = holder.image; 64 | event.getImage(context).into(image); 65 | final TextView title = holder.title; 66 | title.setText(event.getTitle()); 67 | TextView date = holder.date; 68 | date.setText(event.getStartDate()); 69 | TextView location = holder.location; 70 | location.setText(event.getLocation()); 71 | holder.itemView.setOnClickListener(v -> { 72 | Intent intent = new Intent(context, EventDetailActivity.class); 73 | intent.putExtra("detail", event); 74 | Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(context 75 | , new Pair<>(image, "event_image") 76 | , new Pair<>(title, "event_title")).toBundle(); 77 | context.startActivity(intent, bundle); 78 | }); 79 | } 80 | 81 | @Override 82 | public int getItemCount() { 83 | return eventList == null ? 0 : eventList.size(); 84 | } 85 | 86 | public void add(EventInfo eventInfo) { 87 | eventList.add(eventInfo); 88 | } 89 | 90 | void saveData() { 91 | Model.getInstance().setEventArray(eventList); 92 | Model.getInstance().saveEventArray(); 93 | } 94 | 95 | void clear() { 96 | eventList.clear(); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/feedback/FeedbackActivity.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.feedback; 2 | 3 | import android.graphics.drawable.ColorDrawable; 4 | import android.os.Bundle; 5 | import android.view.KeyEvent; 6 | import android.view.MotionEvent; 7 | import android.webkit.WebSettings; 8 | import android.webkit.WebView; 9 | import android.webkit.WebViewClient; 10 | 11 | import androidx.annotation.Nullable; 12 | import androidx.appcompat.app.ActionBar; 13 | import androidx.appcompat.app.AppCompatActivity; 14 | import androidx.appcompat.widget.Toolbar; 15 | 16 | import com.Ntut.R; 17 | import com.Ntut.utility.Utility; 18 | import com.Ntut.utility.WifiUtility; 19 | 20 | /** 21 | * Created by Andy on 2017/7/27. 22 | */ 23 | 24 | public class FeedbackActivity extends AppCompatActivity { 25 | 26 | private Toolbar mToolbar; 27 | private WebView webview; 28 | private final static String CACHE_DIRNAME = "feedback_webview"; 29 | 30 | @Override 31 | protected void onCreate(@Nullable Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_feedback); 34 | mToolbar = findViewById(R.id.main_toolbar); 35 | setSupportActionBar(mToolbar); 36 | setActionBar(); 37 | webview = findViewById(R.id.feedback_webview); 38 | webview.setWebViewClient(new WebViewClient()); 39 | webview.setOnKeyListener((v, keyCode, event) -> { 40 | if (keyCode == KeyEvent.KEYCODE_BACK 41 | && event.getAction() == MotionEvent.ACTION_UP 42 | && webview.canGoBack()) { 43 | webview.goBack(); 44 | return true; 45 | } 46 | 47 | return false; 48 | }); 49 | initWebViewSettings(); 50 | webview.loadUrl("https://www.ntut.edu.tw/~ntutsu/tts/2.0/feedback.html"); 51 | } 52 | 53 | private void initWebViewSettings() { 54 | WebSettings webSetting = webview.getSettings(); 55 | webSetting.setJavaScriptEnabled(true); 56 | webSetting.setUseWideViewPort(true); 57 | webSetting.setLoadWithOverviewMode(true); 58 | webSetting.setSupportZoom(true); 59 | webSetting.setBuiltInZoomControls(true); 60 | webSetting.setDisplayZoomControls(false); 61 | webSetting.setAllowFileAccess(true); 62 | webSetting.setJavaScriptCanOpenWindowsAutomatically(true); 63 | webSetting.setLoadsImagesAutomatically(true); 64 | webSetting.setDefaultTextEncodingName("utf-8"); 65 | if (WifiUtility.isConnected(this)) { 66 | webSetting.setCacheMode(WebSettings.LOAD_DEFAULT); 67 | } else { 68 | webSetting.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); 69 | } 70 | webSetting.setDomStorageEnabled(true); 71 | webSetting.setDatabaseEnabled(true); 72 | webSetting.setAppCacheEnabled(true); 73 | String cacheDirPath = getFilesDir().getAbsolutePath() + CACHE_DIRNAME; 74 | webSetting.setAppCachePath(cacheDirPath); 75 | } 76 | 77 | public void setActionBar() { 78 | ActionBar actionBar = getSupportActionBar(); 79 | if (actionBar != null) { 80 | actionBar.setDisplayHomeAsUpEnabled(true); 81 | mToolbar.setNavigationOnClickListener(v -> finish()); 82 | actionBar.setTitle(R.string.feedback_text); 83 | actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.feedback_color))); 84 | } 85 | Utility.setStatusBarColor(this, getResources().getColor(R.color.feedback_color)); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/firebase/FirebaseMessaging.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.firebase; 2 | 3 | import android.app.Notification; 4 | import android.app.NotificationManager; 5 | import android.app.PendingIntent; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.util.Log; 9 | 10 | import androidx.core.app.NotificationCompat; 11 | 12 | import com.Ntut.MainActivity; 13 | import com.Ntut.R; 14 | import com.google.firebase.messaging.RemoteMessage; 15 | 16 | import java.util.Map; 17 | 18 | import static android.content.ContentValues.TAG; 19 | 20 | public class FirebaseMessaging extends com.google.firebase.messaging.FirebaseMessagingService { 21 | @Override 22 | public void onMessageReceived(RemoteMessage remoteMessage) { 23 | // ... 24 | 25 | // TODO(developer): Handle FCM messages here. 26 | // Not getting messages here? See why this may be: https://goo.gl/39bRNJ 27 | Log.d(TAG, "From: " + remoteMessage.getFrom()); 28 | 29 | // Check if message contains a data payload. 30 | if (remoteMessage.getData().size() > 0) { 31 | Log.d(TAG, "Message data payload: " + remoteMessage.getData()); 32 | } 33 | 34 | // Check if message contains a notification payload. 35 | if (remoteMessage.getNotification() != null) { 36 | Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody()); 37 | } 38 | 39 | // Also if you intend on generating your own notifications as a result of a received FCM 40 | // message, here is where that should be initiated. See sendNotification method below. 41 | sendNotification(remoteMessage); 42 | } 43 | 44 | private void sendNotification(RemoteMessage remoteMessage) { 45 | Map data = remoteMessage.getData(); 46 | String message = data.get("message"); 47 | String id = data.get("id"); 48 | String title = data.get("title"); 49 | int notifyID = Integer.parseInt(id); // 通知的識別號碼 50 | final boolean autoCancel = true; // 點擊通知後是否要自動移除掉通知 51 | final Intent intent = new Intent(getApplicationContext(), MainActivity.class); 52 | intent.putExtra("from", getClass().getSimpleName()); 53 | Log.e("123", getClass().getSimpleName()); 54 | final int flags = PendingIntent.FLAG_CANCEL_CURRENT; 55 | long[] vibrate_effect = 56 | {1000, 500, 1000, 400, 1000, 300, 1000, 200, 1000, 100}; 57 | // ONE_SHOT:PendingIntent只使用一次; 58 | // CANCEL_CURRENT:PendingIntent執行前會先結束掉之前的; 59 | // NO_CREATE:沿用先前的PendingIntent,不建立新的PendingIntent; 60 | // UPDATE_CURRENT:更新先前PendingIntent所帶的額外資料,並繼續沿用 61 | final PendingIntent pendingIntent = PendingIntent 62 | .getActivity(getApplicationContext(), notifyID, intent, flags); // 取得PendingIntent 63 | final NotificationManager notificationManager = 64 | (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // 取得系統的通知服務 65 | final Notification notification = new NotificationCompat.Builder(getApplicationContext()) 66 | .setSmallIcon(R.mipmap.ic_launcher) 67 | .setContentTitle(title) 68 | .setContentText(message) 69 | .setVibrate(vibrate_effect) 70 | .setContentIntent(pendingIntent) 71 | .setAutoCancel(autoCancel).build(); // 建立通知 72 | notificationManager.notify(notifyID, notification); // 發送通知 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/firebase/FirebaseService.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.firebase; 2 | 3 | import com.google.firebase.iid.FirebaseInstanceId; 4 | import com.google.firebase.iid.FirebaseInstanceIdService; 5 | 6 | /** 7 | * Created by blackmaple on 2017/5/1. 8 | */ 9 | 10 | public class FirebaseService extends FirebaseInstanceIdService { 11 | @Override 12 | public void onTokenRefresh() { 13 | // Get updated InstanceID token. 14 | String refreshedToken = FirebaseInstanceId.getInstance().getToken(); 15 | 16 | // If you want to send messages to this application instance or 17 | // manage this apps subscriptions on the server side, send the 18 | // Instance ID token to your app server. 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/ActivityInfo.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | import java.util.Locale; 6 | 7 | /** 8 | * Created by blackmaple on 2017/5/9. 9 | */ 10 | 11 | public class ActivityInfo { 12 | private static final SimpleDateFormat sdf = new SimpleDateFormat( 13 | "yyyy/MM/dd", Locale.TAIWAN); 14 | private Date start; 15 | private Date end; 16 | private String name; 17 | private String image; 18 | private String host; 19 | private String content; 20 | private String url; 21 | private String location; 22 | 23 | public Date getStartDate() { 24 | return start; 25 | } 26 | 27 | public void setStart(Date start) { 28 | this.start = start; 29 | } 30 | 31 | public String getEnd() { 32 | return sdf.format(end); 33 | } 34 | 35 | public Date getEndDate() { 36 | return end; 37 | } 38 | 39 | public void setEnd(Date end) { 40 | this.end = end; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | 51 | public String getImage() { 52 | return image; 53 | } 54 | 55 | public void setImage(String image) { 56 | this.image = image; 57 | } 58 | 59 | public String getHost() { 60 | return host; 61 | } 62 | 63 | public void setHost(String host) { 64 | this.host = host; 65 | } 66 | 67 | public String getContent() { 68 | return content; 69 | } 70 | 71 | public void setContent(String content) { 72 | this.content = content; 73 | } 74 | 75 | public String getUrl() { 76 | return url; 77 | } 78 | 79 | public String getLocation() { 80 | return location; 81 | } 82 | 83 | public void setLocation(String location) { 84 | this.location = location; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/ActivityList.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by blackmaple on 2017/5/9. 7 | */ 8 | 9 | public class ActivityList extends ArrayList { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/CalendarInfo.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by blackmaple on 2017/5/9. 7 | */ 8 | 9 | public class CalendarInfo { 10 | private String event; 11 | private Date startDate; 12 | private Date endDate; 13 | 14 | public CalendarInfo(String event, Date startDate, Date endDate) { 15 | this.event = event; 16 | this.startDate = startDate; 17 | this.endDate = endDate; 18 | } 19 | 20 | public CalendarInfo(String event, Date startDate) { 21 | this.event = event; 22 | this.startDate = startDate; 23 | this.endDate = startDate; 24 | } 25 | 26 | public String getEvent() { 27 | return event; 28 | } 29 | 30 | public Date getStartDate() { 31 | return startDate; 32 | } 33 | 34 | public Date getEndDate() { 35 | return endDate; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/CourseInfo.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | /** 4 | * Created by blackmaple on 2017/5/4. 5 | */ 6 | 7 | public class CourseInfo { 8 | private String courseNo = null; 9 | private String courseName = null; 10 | private String courseTeacher = null; 11 | private String[] courseTimes = null; 12 | private String courseRoom = null; 13 | 14 | public String getCourseNo() { 15 | return courseNo; 16 | } 17 | 18 | public void setCourseNo(String courseNo) { 19 | this.courseNo = courseNo; 20 | } 21 | 22 | public String getCourseName() { 23 | return courseName; 24 | } 25 | 26 | public void setCourseName(String courseName) { 27 | this.courseName = courseName; 28 | } 29 | 30 | public String getCourseTeacher() { 31 | return courseTeacher; 32 | } 33 | 34 | public void setCourseTeacher(String courseTeacher) { 35 | this.courseTeacher = courseTeacher; 36 | } 37 | 38 | public String[] getCourseTimes() { 39 | return courseTimes; 40 | } 41 | 42 | public void setCourseTime(String[] courseTimes) { 43 | this.courseTimes = courseTimes; 44 | } 45 | 46 | public String getCourseRoom() { 47 | return courseRoom; 48 | } 49 | 50 | public void setCourseRoom(String courseRoom) { 51 | this.courseRoom = courseRoom; 52 | } 53 | } -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/CreditInfo.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | /** 4 | * Created by blackmaple on 2017/5/9. 5 | */ 6 | 7 | public class CreditInfo { 8 | private String courseNo = null; 9 | private String courseName = null; 10 | private int credit = 0; 11 | private int type = 0; 12 | private String score = null; 13 | 14 | public String getCourseNo() { 15 | return courseNo; 16 | } 17 | 18 | public void setCourseNo(String courseNo) { 19 | this.courseNo = courseNo; 20 | } 21 | 22 | public String getCourseName() { 23 | return courseName; 24 | } 25 | 26 | public void setCourseName(String courseName) { 27 | this.courseName = courseName; 28 | } 29 | 30 | public int getCredit() { 31 | return credit; 32 | } 33 | 34 | public void setCredit(int credit) { 35 | this.credit = credit; 36 | } 37 | 38 | public int getType() { 39 | return type; 40 | } 41 | 42 | public void setType(int type) { 43 | this.type = type; 44 | } 45 | 46 | public String getScore() { 47 | return score; 48 | } 49 | 50 | public void setScore(String score) { 51 | this.score = score; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/EventInfo.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | 4 | import android.content.Context; 5 | import android.graphics.drawable.Drawable; 6 | import android.os.Parcel; 7 | import android.os.Parcelable; 8 | 9 | import com.Ntut.R; 10 | import com.bumptech.glide.Glide; 11 | import com.bumptech.glide.RequestBuilder; 12 | 13 | /** 14 | * Created by blackmaple on 2017/5/15. 15 | */ 16 | 17 | public class EventInfo implements Parcelable { 18 | private String image; 19 | private String title; 20 | private String startDate; 21 | private String endDate; 22 | private String location; 23 | private String host; 24 | private String content; 25 | private String url; 26 | 27 | 28 | 29 | protected EventInfo(Parcel in) { 30 | image = in.readString(); 31 | title = in.readString(); 32 | startDate = in.readString(); 33 | endDate = in.readString(); 34 | location = in.readString(); 35 | host = in.readString(); 36 | content = in.readString(); 37 | url = in.readString(); 38 | } 39 | 40 | public static final Creator CREATOR = new Creator() { 41 | @Override 42 | public EventInfo createFromParcel(Parcel source) { 43 | return new EventInfo(source); 44 | } 45 | 46 | @Override 47 | public EventInfo[] newArray(int size) { 48 | return new EventInfo[size]; 49 | } 50 | }; 51 | 52 | @Override 53 | public int describeContents() { 54 | return 0; 55 | } 56 | 57 | @Override 58 | public void writeToParcel(Parcel dest, int flags) { 59 | dest.writeString(image); 60 | dest.writeString(title); 61 | dest.writeString(startDate); 62 | dest.writeString(endDate); 63 | dest.writeString(location); 64 | dest.writeString(host); 65 | dest.writeString(content); 66 | dest.writeString(url); 67 | } 68 | 69 | public EventInfo(String image, String title, String startDate, String endDate, String location, String host, String content, String url) { 70 | this.image = image; 71 | this.title = title; 72 | this.startDate = startDate; 73 | this.endDate = endDate; 74 | this.location = location; 75 | this.host = host; 76 | this.content = content; 77 | this.url = url; 78 | } 79 | 80 | public RequestBuilder getImage(Context context) { 81 | return Glide.with(context).load(image).placeholder(R.drawable.placeholder).override(600, 400).centerCrop(); 82 | } 83 | 84 | public void setImage(String image) { 85 | this.image = image; 86 | } 87 | 88 | public String getTitle() { 89 | return title; 90 | } 91 | 92 | public void setTitle(String title) { 93 | this.title = title; 94 | } 95 | 96 | public String getLocation() { 97 | return location; 98 | } 99 | 100 | public void setLocation(String location) { 101 | this.location = location; 102 | } 103 | 104 | public String getContent() { 105 | return content; 106 | } 107 | 108 | public void setContent(String content) { 109 | this.content = content; 110 | } 111 | 112 | public String getUrl() { 113 | return url; 114 | } 115 | 116 | public void setUrl(String url) { 117 | this.url = url; 118 | } 119 | 120 | public String getHost() { 121 | return host; 122 | } 123 | 124 | public void setHost(String host) { 125 | this.host = host; 126 | } 127 | 128 | public String getStartDate() { 129 | return startDate; 130 | } 131 | 132 | public void setStartDate(String startDate) { 133 | this.startDate = startDate; 134 | } 135 | 136 | public String getEndDate() { 137 | return endDate; 138 | } 139 | 140 | public void setEndDate(String endDate) { 141 | this.endDate = endDate; 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/EventList.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by blackmaple on 2017/5/18. 7 | */ 8 | 9 | public class EventList extends ArrayList { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/GeneralCredit.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by blackmaple on 2017/5/9. 7 | */ 8 | 9 | public class GeneralCredit { 10 | private String typeName = null;// 向度 11 | private int mustCoreCredit = 0; 12 | private ArrayList generals = new ArrayList<>(); 13 | 14 | public String getTypeName() { 15 | return typeName; 16 | } 17 | 18 | public void setTypeName(String typeName) { 19 | this.typeName = typeName; 20 | } 21 | 22 | public int getMustCoreCredit() { 23 | return mustCoreCredit; 24 | } 25 | 26 | public void setMustCoreCredit(int mustCoreCredit) { 27 | this.mustCoreCredit = mustCoreCredit; 28 | } 29 | 30 | public int getHadCoreCredit() { // 已修核心 31 | int credit = 0; 32 | for (GeneralCreditInfo general : this.generals) { 33 | if (general.isCore()) { 34 | credit += general.getCredit(); 35 | } 36 | } 37 | return credit; 38 | } 39 | 40 | public int getHadCommonCredit() { // 已修選修 41 | int credit = 0; 42 | for (GeneralCreditInfo general : this.generals) { 43 | if (!general.isCore()) { 44 | credit += general.getCredit(); 45 | } 46 | } 47 | return credit; 48 | } 49 | 50 | public ArrayList getGenerals() { 51 | return this.generals; 52 | } 53 | 54 | public void addGeneral(GeneralCreditInfo general) { 55 | this.generals.add(general); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/GeneralCreditInfo.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | /** 4 | * Created by blackmaple on 2017/5/9. 5 | */ 6 | 7 | public class GeneralCreditInfo { 8 | private String courseName = null; 9 | private String year = null; 10 | private String sem = null; 11 | private boolean isCore = false; 12 | private int credit = 0; 13 | 14 | public String getCourseName() { 15 | return courseName; 16 | } 17 | 18 | public void setCourseName(String courseName) { 19 | this.courseName = courseName; 20 | } 21 | 22 | public String getYear() { 23 | return year; 24 | } 25 | 26 | public void setYear(String year) { 27 | this.year = year; 28 | } 29 | 30 | public String getSem() { 31 | return sem; 32 | } 33 | 34 | public void setSem(String sem) { 35 | this.sem = sem; 36 | } 37 | 38 | public boolean isCore() { 39 | return isCore; 40 | } 41 | 42 | public void setCore(boolean isCore) { 43 | this.isCore = isCore; 44 | } 45 | 46 | public int getCredit() { 47 | return credit; 48 | } 49 | 50 | public void setCredit(int credit) { 51 | this.credit = credit; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/GiphyGlideModule.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import android.content.Context; 4 | 5 | import com.bumptech.glide.GlideBuilder; 6 | import com.bumptech.glide.annotation.GlideModule; 7 | import com.bumptech.glide.load.engine.cache.LruResourceCache; 8 | import com.bumptech.glide.module.AppGlideModule; 9 | 10 | @GlideModule 11 | public class GiphyGlideModule extends AppGlideModule { 12 | @Override 13 | public void applyOptions(Context context, GlideBuilder builder) { 14 | builder.setMemoryCache(new LruResourceCache(10 * 1024 * 1024)); 15 | } 16 | 17 | @Override 18 | public boolean isManifestParsingEnabled() { 19 | return false; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/OtherInfo.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | /** 4 | * Created by blackmaple on 2017/5/14. 5 | */ 6 | 7 | public class OtherInfo { 8 | private String title; 9 | private int iconId; 10 | 11 | public OtherInfo(String title, int iconId) { 12 | this.title = title; 13 | this.iconId = iconId; 14 | } 15 | 16 | 17 | public String getTitle() { 18 | return title; 19 | } 20 | 21 | public void setTitle(String title) { 22 | this.title = title; 23 | } 24 | 25 | public int getIconId() { 26 | return iconId; 27 | } 28 | 29 | public void setIconId(int iconId) { 30 | this.iconId = iconId; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/Semester.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | /** 4 | * Created by blackmaple on 2017/5/4. 5 | */ 6 | 7 | public class Semester { 8 | private String year; 9 | private String semester; 10 | 11 | public Semester(String year, String semester) { 12 | this.year = year; 13 | this.semester = semester; 14 | } 15 | 16 | public String getYear() { 17 | return year; 18 | } 19 | 20 | public String getSemester() { 21 | return semester; 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return String.format("%s - %s", year, semester); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/SemesterCredit.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by blackmaple on 2017/5/9. 7 | */ 8 | 9 | public class SemesterCredit { 10 | private ArrayList credits = new ArrayList<>(); 11 | private String year = null; 12 | private String sem = null; 13 | private String score = null; 14 | private String conduct_score = null; 15 | 16 | public String getYear() { 17 | return year; 18 | } 19 | 20 | public void setYear(String year) { 21 | this.year = year; 22 | } 23 | 24 | public String getSemester() { 25 | return sem; 26 | } 27 | 28 | public void setSemester(String sem) { 29 | this.sem = sem; 30 | } 31 | 32 | public ArrayList getCredits() { 33 | return credits; 34 | } 35 | 36 | public void setCreditInfoType(int index, int type) { 37 | credits.get(index).setType(type); 38 | } 39 | 40 | public void addCreditInfo(CreditInfo credit) { 41 | this.credits.add(credit); 42 | } 43 | 44 | public int getTypeCredits(int type) { 45 | int sum_credit = 0; 46 | for (CreditInfo credit : credits) { 47 | if (credit.getType() == type) { 48 | sum_credit += credit.getCredit(); 49 | } 50 | } 51 | return sum_credit; 52 | } 53 | 54 | public int getTotalCredits() { 55 | int sum_credit = 0; 56 | for (CreditInfo credit : credits) { 57 | if (credit.getType() != 0) { // 0表示不計算,包含撤選、不及格、缺考 58 | sum_credit += credit.getCredit(); 59 | } 60 | } 61 | return sum_credit; 62 | } 63 | 64 | public String getScore() { 65 | return score; 66 | } 67 | 68 | public void setScore(String score) { 69 | this.score = score; 70 | } 71 | 72 | public String getConductScore() { 73 | return conduct_score; 74 | } 75 | 76 | public void setConductScore(String conduct_score) { 77 | this.conduct_score = conduct_score; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/SemesterRank.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | /** 4 | * Created by blackmaple on 2017/5/9. 5 | */ 6 | 7 | public class SemesterRank { 8 | private String year; 9 | private String Semester; 10 | private String classRank; 11 | private String classTotal; 12 | private String classSumRank; 13 | private String classSumTotal; 14 | private String groupRank; 15 | private String groupTotal; 16 | private String groupSumRank; 17 | private String groupSumTotal; 18 | private String departmentRank; 19 | private String departmentTotal; 20 | private String departmentSumRank; 21 | private String departmentSumTotal; 22 | 23 | public String getYear() { 24 | return year; 25 | } 26 | 27 | public void setYear(String year) { 28 | this.year = year; 29 | } 30 | 31 | public String getSemester() { 32 | return Semester; 33 | } 34 | 35 | public void setSemester(String semester) { 36 | Semester = semester; 37 | } 38 | 39 | public String getClassRank() { 40 | return classRank; 41 | } 42 | 43 | public void setClassRank(String classRank) { 44 | this.classRank = classRank; 45 | } 46 | 47 | public String getClassTotal() { 48 | return classTotal; 49 | } 50 | 51 | public void setClassTotal(String classTotal) { 52 | this.classTotal = classTotal; 53 | } 54 | 55 | public String getClassSumRank() { 56 | return classSumRank; 57 | } 58 | 59 | public void setClassSumRank(String classSumRank) { 60 | this.classSumRank = classSumRank; 61 | } 62 | 63 | public String getClassSumTotal() { 64 | return classSumTotal; 65 | } 66 | 67 | public void setClassSumTotal(String classSumTotal) { 68 | this.classSumTotal = classSumTotal; 69 | } 70 | 71 | public String getGroupRank() { 72 | return groupRank; 73 | } 74 | 75 | public void setGroupRank(String groupRank) { 76 | this.groupRank = groupRank; 77 | } 78 | 79 | public String getGroupSumRank() { 80 | return groupSumRank; 81 | } 82 | 83 | public void setGroupSumRank(String groupSumRank) { 84 | this.groupSumRank = groupSumRank; 85 | } 86 | 87 | public String getGroupSumTotal() { 88 | return groupSumTotal; 89 | } 90 | 91 | public void setGroupSumTotal(String groupSumTotal) { 92 | this.groupSumTotal = groupSumTotal; 93 | } 94 | 95 | public String getGroupTotal() { 96 | return groupTotal; 97 | } 98 | 99 | public void setGroupTotal(String groupTotal) { 100 | this.groupTotal = groupTotal; 101 | } 102 | 103 | public String getDepartmentRank() { 104 | return departmentRank; 105 | } 106 | 107 | public void setDepartmentRank(String departmentRank) { 108 | this.departmentRank = departmentRank; 109 | } 110 | 111 | public String getDepartmentTotal() { 112 | return departmentTotal; 113 | } 114 | 115 | public void setDepartmentTotal(String departmentTotal) { 116 | this.departmentTotal = departmentTotal; 117 | } 118 | 119 | public String getDepartmentSumRank() { 120 | return departmentSumRank; 121 | } 122 | 123 | public void setDepartmentSumRank(String departmentSumRank) { 124 | this.departmentSumRank = departmentSumRank; 125 | } 126 | 127 | public String getDepartmentSumTotal() { 128 | return departmentSumTotal; 129 | } 130 | 131 | public void setDepartmentSumTotal(String departmentSumTotal) { 132 | this.departmentSumTotal = departmentSumTotal; 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/StandardCredit.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by blackmaple on 2017/5/9. 7 | */ 8 | 9 | public class StandardCredit { 10 | private ArrayList credits = null; 11 | private String year_text; 12 | private String division_text; 13 | private String department_text; 14 | 15 | public void setCredits(ArrayList credits) { 16 | this.credits = credits; 17 | } 18 | 19 | public ArrayList getCredits() { 20 | return credits; 21 | } 22 | 23 | public String getYearText() { 24 | return year_text; 25 | } 26 | 27 | public void setYearText(String year_text) { 28 | this.year_text = year_text; 29 | } 30 | 31 | public String getDivisionText() { 32 | return division_text; 33 | } 34 | 35 | public void setDivisionText(String division_text) { 36 | this.division_text = division_text; 37 | } 38 | 39 | public String getDepartmentText() { 40 | return department_text; 41 | } 42 | 43 | public void setDepartmentText(String department_text) { 44 | this.department_text = department_text; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/StudentCourse.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by blackmaple on 2017/5/4. 7 | */ 8 | 9 | public class StudentCourse { 10 | 11 | private String sid = null; 12 | private String year = null; 13 | private String semester = null; 14 | private ArrayList courseList = null; 15 | 16 | public String getSid() { 17 | return sid; 18 | } 19 | 20 | public void setSid(String sid) { 21 | this.sid = sid; 22 | } 23 | 24 | public String getYear() { 25 | return year; 26 | } 27 | 28 | public void setYear(String year) { 29 | this.year = year; 30 | } 31 | 32 | public String getSemester() { 33 | return semester; 34 | } 35 | 36 | public void setSemester(String semester) { 37 | this.semester = semester; 38 | } 39 | 40 | public ArrayList getCourseList() { 41 | return courseList; 42 | } 43 | 44 | public void setCourseList(ArrayList courseList) { 45 | this.courseList = courseList; 46 | } 47 | 48 | 49 | } -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/StudentCredit.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.Comparator; 6 | 7 | /** 8 | * Created by blackmaple on 2017/5/9. 9 | */ 10 | 11 | public class StudentCredit { 12 | private ArrayList semesters = new ArrayList<>(); 13 | private ArrayList generals = new ArrayList<>(); 14 | private ArrayList ranks = new ArrayList<>(); 15 | 16 | public ArrayList getSemesterCredits() { 17 | return semesters; 18 | } 19 | 20 | public void addSemesterCredit(SemesterCredit semesterCredit) { 21 | this.semesters.add(semesterCredit); 22 | } 23 | 24 | public ArrayList getGeneralCredits() { 25 | return generals; 26 | } 27 | 28 | public void addGeneralCredit(GeneralCredit generalCredit) { 29 | this.generals.add(generalCredit); 30 | } 31 | 32 | public ArrayList getRnakList() { 33 | Collections.sort(this.ranks, new Comparator() { 34 | @Override 35 | public int compare(SemesterRank o1, SemesterRank o2) { 36 | if (Integer.parseInt(o1.getYear()) == Integer.parseInt(o2 37 | .getYear())) { 38 | return Integer.parseInt(o1.getSemester()) 39 | - Integer.parseInt(o2.getSemester()); 40 | } else { 41 | return Integer.parseInt(o1.getYear()) 42 | - Integer.parseInt(o2.getYear()); 43 | } 44 | 45 | } 46 | }); 47 | return ranks; 48 | } 49 | 50 | public void addRnak(SemesterRank rank) { 51 | this.ranks.add(rank); 52 | } 53 | 54 | public int getGeneralCoreCredits() { 55 | int sum_credit = 0; 56 | for (GeneralCredit general : generals) { 57 | sum_credit += general.getHadCoreCredit(); 58 | } 59 | return sum_credit; 60 | } 61 | 62 | public int getGeneralCommonCredits() { 63 | int sum_credit = 0; 64 | for (GeneralCredit general : generals) { 65 | sum_credit += general.getHadCommonCredit(); 66 | } 67 | return sum_credit; 68 | } 69 | 70 | public int getTypeCredits(int type) { 71 | int sum_credit = 0; 72 | for (SemesterCredit credit : semesters) { 73 | sum_credit += credit.getTypeCredits(type); 74 | } 75 | return sum_credit; 76 | } 77 | 78 | public int getTotalCredits() { 79 | int sum_credit = 0; 80 | for (SemesterCredit credit : semesters) { 81 | sum_credit += credit.getTotalCredits(); 82 | } 83 | return sum_credit; 84 | } 85 | 86 | public String getSemesterName(int index) { 87 | return semesters.get(index).getYear() + "-" 88 | + semesters.get(index).getSemester(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/model/YearCalendar.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.model; 2 | 3 | import com.Ntut.utility.Utility; 4 | 5 | import java.text.ParseException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.ArrayList; 8 | import java.util.Calendar; 9 | import java.util.Date; 10 | import java.util.Locale; 11 | 12 | /** 13 | * Created by blackmaple on 2017/5/9. 14 | */ 15 | 16 | public class YearCalendar { 17 | private ArrayList eventList = null; 18 | private String semester = null; 19 | 20 | public ArrayList getEventList() { 21 | return eventList; 22 | } 23 | 24 | public void setEventList(ArrayList eventList) { 25 | this.eventList = eventList; 26 | } 27 | 28 | public int getYear() { 29 | return Integer.parseInt(semester) + 1911; 30 | } 31 | 32 | public String getSemesterYear() { 33 | return semester; 34 | } 35 | 36 | public void setSemester(String semester) { 37 | this.semester = semester; 38 | } 39 | 40 | public ArrayList searchEventList(String keyword) { 41 | ArrayList resultList = new ArrayList<>(); 42 | if (eventList != null && keyword != null) { 43 | for (CalendarInfo calendarInfo : eventList) { 44 | if (calendarInfo.getEvent().contains(keyword)) { 45 | resultList.add(calendarInfo); 46 | } 47 | } 48 | } 49 | return resultList; 50 | } 51 | 52 | public ArrayList getMonthEventList(String year, String month) { 53 | ArrayList resultList = new ArrayList<>(); 54 | if (eventList != null && month != null) { 55 | for (CalendarInfo calendarInfo : eventList) { 56 | if (Utility.getMonth(calendarInfo.getStartDate()).equals(month) 57 | && Utility.getYear(calendarInfo.getStartDate()).equals( 58 | year)) { 59 | resultList.add(calendarInfo); 60 | } 61 | } 62 | } 63 | return resultList; 64 | } 65 | 66 | public static Date getDate(int year, int month, int day) { 67 | Calendar cal = Calendar.getInstance(); 68 | cal.set(year, month + 1, day, 0, 0, 0); 69 | Date date = cal.getTime(); 70 | return date; 71 | } 72 | 73 | public static Date getDate(String date_string) throws ParseException { 74 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.TAIWAN); 75 | Date date = sdf.parse(date_string); 76 | return date; 77 | } 78 | 79 | public ArrayList findEvents(Date date) { 80 | ArrayList resultList = new ArrayList<>(); 81 | if (eventList != null && date != null) { 82 | for (CalendarInfo calendarInfo : eventList) { 83 | if (calendarInfo.getStartDate().equals(date)) { 84 | resultList.add(calendarInfo.getEvent()); 85 | } 86 | } 87 | } 88 | return resultList; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/other/OtherFragment.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.other; 2 | 3 | import android.os.Bundle; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | 8 | import androidx.annotation.Nullable; 9 | import androidx.recyclerview.widget.LinearLayoutManager; 10 | import androidx.recyclerview.widget.RecyclerView; 11 | 12 | import com.Ntut.BaseFragment; 13 | import com.Ntut.R; 14 | import com.Ntut.model.OtherInfo; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | /** 20 | * Created by Andy on 2017/4/28. 21 | */ 22 | 23 | public class OtherFragment extends BaseFragment { 24 | 25 | private List otherInfoList; 26 | 27 | @Nullable 28 | @Override 29 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 30 | View fragmentView = inflater.inflate(R.layout.fragment_other, container, false); 31 | RecyclerView recyclerView = fragmentView.findViewById(R.id.other_list); 32 | initListData(); 33 | OtherAdapter adapter = new OtherAdapter(otherInfoList, getContext()); 34 | recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); 35 | recyclerView.setAdapter(adapter); 36 | return fragmentView; 37 | } 38 | 39 | private void initListData() { 40 | otherInfoList = new ArrayList<>(); 41 | //添加項目 42 | otherInfoList.add(new OtherInfo(getString(R.string.credit_text), R.drawable.credit_icon)); 43 | otherInfoList.add(new OtherInfo(getString(R.string.account_setting_text), R.drawable.account_icon)); 44 | otherInfoList.add(new OtherInfo(getString(R.string.school_map_text), R.drawable.map_icon)); 45 | otherInfoList.add(new OtherInfo(getString(R.string.store_text), R.drawable.store_icon)); 46 | otherInfoList.add(new OtherInfo(getString(R.string.feedback_text), R.drawable.feedback_icon)); 47 | otherInfoList.add(new OtherInfo(getString(R.string.etc_text), R.drawable.setting_icon)); 48 | otherInfoList.add(new OtherInfo(getString(R.string.about_text), R.drawable.info_icon)); 49 | } 50 | 51 | @Override 52 | public int getTitleColorId() { 53 | return R.color.other_color; 54 | } 55 | 56 | @Override 57 | public int getTitleStringId() { 58 | return R.string.other_text; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/AccountRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Handler; 6 | 7 | import com.Ntut.MainActivity; 8 | import com.Ntut.account.AccountActivity; 9 | import com.Ntut.model.Model; 10 | 11 | /** 12 | * Created by blackmaple on 2017/5/13. 13 | */ 14 | 15 | public class AccountRunnable extends BaseRunnable { 16 | private final AccountActivity context; 17 | 18 | public AccountRunnable(Handler handler, Context context) { 19 | super(handler); 20 | this.context = (AccountActivity) context; 21 | } 22 | 23 | @Override 24 | public void run() { 25 | Model.getInstance().deleteStudentCourse(); 26 | Intent intent = new Intent(context, MainActivity.class); 27 | context.startActivity(intent); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/BaseRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | /** 6 | * Created by blackmaple on 2017/5/9. 7 | */ 8 | 9 | public abstract class BaseRunnable implements Runnable { 10 | public static final int REFRESH = 1; 11 | public static final int ERROR = -1; 12 | protected Handler handler; 13 | 14 | public BaseRunnable(Handler handler) { 15 | this.handler = handler; 16 | } 17 | 18 | @Override 19 | public abstract void run(); 20 | 21 | protected void sendRefreshMessage(Object obj) { 22 | handler.obtainMessage(REFRESH, obj).sendToTarget(); 23 | } 24 | 25 | protected void sendErrorMessage(Object obj) { 26 | handler.obtainMessage(ERROR, obj).sendToTarget(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/CalendarRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.model.YearCalendar; 6 | import com.Ntut.utility.CalendarConnector; 7 | 8 | /** 9 | * Created by blackmaple on 2017/5/12. 10 | */ 11 | 12 | public class CalendarRunnable extends BaseRunnable { 13 | public CalendarRunnable(Handler handler) { 14 | super(handler); 15 | } 16 | 17 | @Override 18 | public void run() { 19 | try { 20 | YearCalendar result = CalendarConnector.getEventList(); 21 | sendRefreshMessage(result); 22 | } catch (Exception e) { 23 | sendErrorMessage(e.getMessage()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/ClassmateRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.utility.CourseConnector; 6 | 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * Created by blackmaple on 2017/5/9. 11 | */ 12 | 13 | public class ClassmateRunnable extends BaseRunnable { 14 | private String courseNo; 15 | 16 | public ClassmateRunnable(Handler handler, String courseNo) { 17 | super(handler); 18 | this.courseNo = courseNo; 19 | } 20 | 21 | @Override 22 | public void run() { 23 | try { 24 | ArrayList result = CourseConnector.GetClassmate(courseNo); 25 | sendRefreshMessage(result); 26 | } catch (Exception e) { 27 | sendErrorMessage(e.getMessage()); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/CourseDetailRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.utility.CourseConnector; 6 | 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * Created by blackmaple on 2017/5/9. 11 | */ 12 | 13 | public class CourseDetailRunnable extends BaseRunnable { 14 | private String courseNo; 15 | 16 | public CourseDetailRunnable(Handler handler, String courseNo) { 17 | super(handler); 18 | this.courseNo = courseNo; 19 | } 20 | 21 | @Override 22 | public void run() { 23 | try { 24 | ArrayList result = CourseConnector 25 | .GetCourseDetail(courseNo); 26 | sendRefreshMessage(result); 27 | } catch (Exception e) { 28 | sendErrorMessage(e.getMessage()); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/CourseLoginRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.utility.CourseConnector; 6 | 7 | /** 8 | * Created by blackmaple on 2017/5/9. 9 | */ 10 | 11 | public class CourseLoginRunnable extends BaseRunnable { 12 | public CourseLoginRunnable(Handler handler) { 13 | super(handler); 14 | } 15 | 16 | @Override 17 | public void run() { 18 | try { 19 | String result = CourseConnector.loginCourse(); 20 | sendRefreshMessage(result); 21 | } catch (Exception e) { 22 | sendErrorMessage(e.getMessage()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/CourseRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.model.StudentCourse; 6 | import com.Ntut.utility.CourseConnector; 7 | 8 | /** 9 | * Created by blackmaple on 2017/5/9. 10 | */ 11 | 12 | public class CourseRunnable extends BaseRunnable { 13 | private String sid; 14 | private String year; 15 | private String semester; 16 | 17 | public CourseRunnable(Handler handler, String sid, String year, 18 | String semester) { 19 | super(handler); 20 | this.sid = sid; 21 | this.year = year; 22 | this.semester = semester; 23 | } 24 | 25 | @Override 26 | public void run() { 27 | try { 28 | StudentCourse result = CourseConnector.getStudentCourse(sid, year, 29 | semester); 30 | sendRefreshMessage(result); 31 | } catch (Exception e) { 32 | sendErrorMessage(e.getMessage()); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/CourseTableSearchRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | /** 6 | * Created by blackmaple on 2017/5/9. 7 | */ 8 | 9 | public class CourseTableSearchRunnable extends BaseRunnable { 10 | 11 | public CourseTableSearchRunnable(Handler handler, String sid, String year, 12 | String semester) { 13 | super(handler); 14 | String sid1 = sid; 15 | String year1 = year; 16 | String semester1 = semester; 17 | } 18 | 19 | @Override 20 | public void run() { 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/CreditLoginRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.utility.CreditConnector; 6 | 7 | /** 8 | * Created by blackmaple on 2017/5/15. 9 | */ 10 | 11 | public class CreditLoginRunnable extends BaseRunnable { 12 | public CreditLoginRunnable(Handler handler) { 13 | super(handler); 14 | } 15 | 16 | @Override 17 | public void run() { 18 | try { 19 | String result = CreditConnector.loginCredit(); 20 | sendRefreshMessage(result); 21 | } catch (Exception e) { 22 | sendErrorMessage(e.getMessage()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/CreditRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | import android.util.Log; 5 | 6 | import com.Ntut.model.StudentCredit; 7 | import com.Ntut.utility.CreditConnector; 8 | 9 | /** 10 | * Created by blackmaple on 2017/5/15. 11 | */ 12 | 13 | public class CreditRunnable extends BaseRunnable { 14 | Handler progressHandler; 15 | 16 | public CreditRunnable(Handler handler, Handler progressHandler) { 17 | super(handler); 18 | this.progressHandler = progressHandler; 19 | } 20 | 21 | @Override 22 | public void run() { 23 | try { 24 | StudentCredit result = CreditConnector.getCredits(progressHandler); 25 | sendRefreshMessage(result); 26 | } catch (Exception e) { 27 | sendErrorMessage(e.getMessage()); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/CreditStandardRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.utility.CreditConnector; 6 | 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * Created by blackmaple on 2017/5/15. 11 | */ 12 | 13 | public class CreditStandardRunnable extends BaseRunnable { 14 | private String year; 15 | private String department; 16 | private int index; 17 | 18 | public CreditStandardRunnable(Handler handler, String year, int index, 19 | String department) { 20 | super(handler); 21 | this.year = year; 22 | this.index = index; 23 | this.department = department; 24 | } 25 | 26 | @Override 27 | public void run() { 28 | try { 29 | ArrayList result = CreditConnector.getStandardCredit(year, 30 | index, department); 31 | sendRefreshMessage(result); 32 | } catch (Exception e) { 33 | sendErrorMessage(e.getMessage()); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/EventRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.content.Context; 4 | import android.os.Handler; 5 | 6 | /** 7 | * Created by blackmaple on 2017/5/17. 8 | */ 9 | 10 | public class EventRunnable extends BaseRunnable { 11 | 12 | public EventRunnable(Handler handler, Context context) { 13 | super(handler); 14 | Context context1 = context; 15 | } 16 | 17 | @Override 18 | public void run() { 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/LoginNportalRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.graphics.Bitmap; 4 | import android.os.Handler; 5 | 6 | import com.Ntut.utility.NportalConnector; 7 | import com.Ntut.utility.OCRUtility; 8 | 9 | /** 10 | * Created by blackmaple on 2017/5/9. 11 | */ 12 | 13 | public class LoginNportalRunnable extends BaseRunnable { 14 | String account; 15 | String password; 16 | 17 | public LoginNportalRunnable(String account, String password, Handler handler) { 18 | super(handler); 19 | this.account = account; 20 | this.password = password; 21 | } 22 | 23 | @Override 24 | public void run() { 25 | try { 26 | Bitmap bmp = NportalConnector.loadAuthcodeImage(); 27 | String authcode = OCRUtility.authOCR( 28 | OCRUtility.bitmap2grayByteArry(bmp), bmp.getWidth(), 29 | bmp.getHeight()); 30 | String result = NportalConnector.login(account, password, authcode); 31 | sendRefreshMessage(result); 32 | } catch (Exception e) { 33 | sendErrorMessage(e.getMessage()); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/StandardDepartmentRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.utility.CreditConnector; 6 | 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * Created by blackmaple on 2017/5/15. 11 | */ 12 | 13 | public class StandardDepartmentRunnable extends BaseRunnable { 14 | private String year; 15 | private int index; 16 | 17 | public StandardDepartmentRunnable(Handler handler, String year, int index) { 18 | super(handler); 19 | this.year = year; 20 | this.index = index; 21 | } 22 | 23 | @Override 24 | public void run() { 25 | try { 26 | ArrayList result = CreditConnector.getDepartmentList(year, 27 | index); 28 | sendRefreshMessage(result); 29 | } catch (Exception e) { 30 | sendErrorMessage(e.getMessage()); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/StandardDivisionRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.utility.CreditConnector; 6 | 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * Created by blackmaple on 2017/5/15. 11 | */ 12 | 13 | public class StandardDivisionRunnable extends BaseRunnable { 14 | private String year; 15 | 16 | public StandardDivisionRunnable(Handler handler, String year) { 17 | super(handler); 18 | this.year = year; 19 | } 20 | 21 | @Override 22 | public void run() { 23 | try { 24 | ArrayList result = CreditConnector.getDivisionList(year); 25 | sendRefreshMessage(result); 26 | } catch (Exception e) { 27 | sendErrorMessage(e.getMessage()); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/runnable/StandardYearRunnable.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.runnable; 2 | 3 | import android.os.Handler; 4 | 5 | import com.Ntut.utility.CreditConnector; 6 | 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * Created by blackmaple on 2017/5/15. 11 | */ 12 | 13 | public class StandardYearRunnable extends BaseRunnable { 14 | public StandardYearRunnable(Handler handler) { 15 | super(handler); 16 | } 17 | 18 | @Override 19 | public void run() { 20 | try { 21 | ArrayList result = CreditConnector.getYearList(); 22 | sendRefreshMessage(result); 23 | } catch (Exception e) { 24 | sendErrorMessage(e.getMessage()); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/store/StoreActivity.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.store; 2 | 3 | import android.graphics.drawable.ColorDrawable; 4 | import android.os.Bundle; 5 | 6 | import androidx.appcompat.app.ActionBar; 7 | import androidx.appcompat.app.AppCompatActivity; 8 | import androidx.appcompat.widget.Toolbar; 9 | 10 | import com.Ntut.R; 11 | import com.Ntut.utility.Utility; 12 | import com.google.android.gms.maps.CameraUpdateFactory; 13 | import com.google.android.gms.maps.GoogleMap; 14 | import com.google.android.gms.maps.OnMapReadyCallback; 15 | import com.google.android.gms.maps.SupportMapFragment; 16 | import com.google.android.gms.maps.model.LatLng; 17 | import com.google.android.gms.maps.model.MarkerOptions; 18 | import com.google.firebase.database.DataSnapshot; 19 | import com.google.firebase.database.DatabaseError; 20 | import com.google.firebase.database.DatabaseReference; 21 | import com.google.firebase.database.FirebaseDatabase; 22 | import com.google.firebase.database.ValueEventListener; 23 | 24 | public class StoreActivity extends AppCompatActivity implements OnMapReadyCallback { 25 | 26 | private GoogleMap mMap; 27 | private Toolbar mToolbar; 28 | 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.activity_store); 33 | // Obtain the SupportMapFragment and get notified when the map is ready to be used. 34 | SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() 35 | .findFragmentById(R.id.map); 36 | mapFragment.getMapAsync(this); 37 | mToolbar = findViewById(R.id.main_toolbar); 38 | setSupportActionBar(mToolbar); 39 | setActionBar(); 40 | FirebaseDatabase database = FirebaseDatabase.getInstance(); 41 | DatabaseReference ref = database.getReference("store"); 42 | ref.addValueEventListener(new ValueEventListener() { 43 | @Override 44 | public void onDataChange(DataSnapshot dataSnapshot) { 45 | for (DataSnapshot ds : dataSnapshot.getChildren()) { 46 | mMap.addMarker(new MarkerOptions() 47 | .position(new LatLng((Double) ds.child("latitude").getValue(), (Double) ds.child("longitude").getValue())) 48 | .title(ds.child("title").getValue().toString()) 49 | .snippet(ds.child("subTitle").getValue().toString())); 50 | } 51 | } 52 | 53 | @Override 54 | public void onCancelled(DatabaseError databaseError) { 55 | 56 | } 57 | }); 58 | } 59 | 60 | 61 | /** 62 | * Manipulates the map once available. 63 | * This callback is triggered when the map is ready to be used. 64 | * This is where we can add markers or lines, add listeners or move the camera. In this case, 65 | * we just add a marker near Sydney, Australia. 66 | * If Google Play services is not installed on the device, the user will be prompted to install 67 | * it inside the SupportMapFragment. This method will only be triggered once the user has 68 | * installed Google Play services and returned to the app. 69 | */ 70 | @Override 71 | public void onMapReady(GoogleMap googleMap) { 72 | mMap = googleMap; 73 | 74 | // Add a marker in Sydney and move the camera 75 | LatLng init = new LatLng(25.042848, 121.534447); 76 | mMap.moveCamera(CameraUpdateFactory.newLatLng(init)); 77 | 78 | } 79 | 80 | public void setActionBar() { 81 | ActionBar actionBar = getSupportActionBar(); 82 | if (actionBar != null) { 83 | actionBar.setDisplayHomeAsUpEnabled(true); 84 | mToolbar.setNavigationOnClickListener(v -> finish()); 85 | actionBar.setTitle(R.string.store_text); 86 | actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.store_color))); 87 | } 88 | Utility.setStatusBarColor(this, getResources().getColor(R.color.store_color)); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/utility/BitmapUtility.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.utility; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | 7 | /** 8 | * Created by blackmaple on 2017/5/8. 9 | */ 10 | 11 | public class BitmapUtility { 12 | private static int calculateInSampleSize(BitmapFactory.Options options, 13 | int reqWidth, int reqHeight) { 14 | int height = options.outHeight; 15 | int width = options.outWidth; 16 | int inSampleSize = 1; 17 | if (height > reqHeight || width > reqWidth) { 18 | int halfHeight = height / 2; 19 | int halfWidth = width / 2; 20 | while ((halfHeight / inSampleSize) > reqHeight 21 | && (halfWidth / inSampleSize) > reqWidth) { 22 | inSampleSize *= 2; 23 | } 24 | } 25 | return inSampleSize; 26 | } 27 | 28 | public static Bitmap loadBitmap(Context context, int resId) { 29 | BitmapFactory.Options options = new BitmapFactory.Options(); 30 | options.inJustDecodeBounds = true; 31 | options.inPurgeable = true; 32 | options.inInputShareable = true; 33 | BitmapFactory.decodeResource(context.getResources(), resId, options); 34 | options.inSampleSize = calculateInSampleSize(options, 35 | Utility.getScreenWidth(context), 36 | Utility.getScreenHeight(context)); 37 | options.inJustDecodeBounds = false; 38 | return BitmapFactory.decodeResource(context.getResources(), resId, 39 | options); 40 | } 41 | 42 | public static Bitmap loadBitmap(Context context, String file_path) { 43 | BitmapFactory.Options options = new BitmapFactory.Options(); 44 | options.inJustDecodeBounds = true; 45 | options.inPurgeable = true; 46 | options.inInputShareable = true; 47 | BitmapFactory.decodeFile(file_path, options); 48 | options.inSampleSize = calculateInSampleSize(options, 49 | Utility.getScreenWidth(context), 50 | Utility.getScreenHeight(context)); 51 | options.inJustDecodeBounds = false; 52 | return BitmapFactory.decodeFile(file_path, options); 53 | } 54 | 55 | public static Bitmap loadEmptyBitmap(Context context, String file_path) { 56 | BitmapFactory.Options options = new BitmapFactory.Options(); 57 | options.inJustDecodeBounds = true; 58 | BitmapFactory.decodeFile(file_path, options); 59 | Bitmap empty_bitmap = Bitmap.createBitmap(options.outWidth, 60 | options.outHeight, Bitmap.Config.ALPHA_8); 61 | return empty_bitmap; 62 | } 63 | 64 | public static Bitmap loadEmptyBitmap(Context context, int resId) { 65 | BitmapFactory.Options options = new BitmapFactory.Options(); 66 | options.inJustDecodeBounds = true; 67 | BitmapFactory.decodeResource(context.getResources(), resId, options); 68 | Bitmap empty_bitmap = Bitmap.createBitmap(options.outWidth, 69 | options.outHeight, Bitmap.Config.ALPHA_8); 70 | return empty_bitmap; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/utility/CalendarConnector.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.utility; 2 | 3 | import com.Ntut.model.YearCalendar; 4 | import com.google.gson.Gson; 5 | import com.google.gson.GsonBuilder; 6 | 7 | import org.json.JSONObject; 8 | 9 | /** 10 | * Created by blackmaple on 2017/5/12. 11 | */ 12 | 13 | public class CalendarConnector { 14 | private final static String CALENDAR_URI = HttpHelper.SERVER_HOST + "calendar.json"; 15 | 16 | public static YearCalendar getEventList() throws Exception { 17 | try { 18 | String result = Connector.getDataByGet(CALENDAR_URI, "utf-8"); 19 | JSONObject jObject = new JSONObject(result); 20 | Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create(); 21 | YearCalendar yearCalendar = gson.fromJson(jObject 22 | .toString(), YearCalendar.class); 23 | return yearCalendar; 24 | } catch (Exception e) { 25 | e.printStackTrace(); 26 | throw new Exception("行事曆讀取時發生錯誤"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/utility/Constants.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.utility; 2 | 3 | /** 4 | * Created by blackmaple on 2017/5/9. 5 | */ 6 | 7 | public class Constants { 8 | public static final String ACTION_COURSEWIDGET_UPDATE_STR = "com.taipeitech.action.COURSEWIDGET_UPDATE"; 9 | 10 | public static final int RETRY_MAX_COUNT_INT = 1; 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/utility/CookieManager.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.utility; 2 | 3 | 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import okhttp3.Cookie; 8 | import okhttp3.CookieJar; 9 | import okhttp3.HttpUrl; 10 | 11 | /** 12 | * Created by blackmaple on 2017/5/2. 13 | */ 14 | 15 | public class CookieManager implements CookieJar { 16 | 17 | private static List cookies; 18 | 19 | @Override 20 | public void saveFromResponse(HttpUrl httpUrl, List cookies) { 21 | CookieManager.cookies = cookies; 22 | } 23 | 24 | @Override 25 | public List loadForRequest(HttpUrl httpUrl) { 26 | if (null != cookies) { 27 | return cookies; 28 | } else { 29 | return new ArrayList<>(); 30 | } 31 | } 32 | 33 | public static void resetCookies() { 34 | cookies = null; 35 | } 36 | 37 | // How to use: 38 | // OkHttpClient.Builder mOkHttpClientBuilder = new OkHttpClient.Builder(); 39 | // mOkHttpClientBuilder.cookieJar(new MyCookieJar()); 40 | // OkHttpClient mOkHttpClient = mOkHttpClientBuilder.build(); 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/utility/HttpHelper.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.utility; 2 | 3 | /** 4 | * Created by blackmaple on 2017/5/12. 5 | */ 6 | 7 | public class HttpHelper { 8 | public static final String SERVER_HOST = "https://raw.githubusercontent.com/kamisakihideyoshi/TaipeiTechRefined/master/crawler/"; 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/Ntut/utility/SlideAnimator.java: -------------------------------------------------------------------------------- 1 | package com.Ntut.utility; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | import android.view.animation.Animation; 6 | import android.view.animation.AnimationUtils; 7 | 8 | import com.Ntut.R; 9 | 10 | /** 11 | * Created by blackmaple on 2017/5/15. 12 | */ 13 | 14 | public class SlideAnimator { 15 | private Context context; 16 | private View v; 17 | private SlideAnimationListener listener; 18 | 19 | public SlideAnimator(Context context, View v) { 20 | this.context = context; 21 | this.v = v; 22 | } 23 | 24 | public void setSlideAnimationListener(SlideAnimationListener listener) { 25 | this.listener = listener; 26 | } 27 | 28 | public void toggle() { 29 | if (v.isShown()) { 30 | slide_up(); 31 | } else { 32 | v.setVisibility(View.VISIBLE); 33 | slide_down(); 34 | } 35 | } 36 | 37 | private void slide_down() { 38 | Animation a = AnimationUtils.loadAnimation(context, R.anim.slide_down); 39 | if (a != null) { 40 | a.setAnimationListener(new Animation.AnimationListener() { 41 | @Override 42 | public void onAnimationStart(Animation arg0) { 43 | } 44 | 45 | @Override 46 | public void onAnimationRepeat(Animation arg0) { 47 | } 48 | 49 | @Override 50 | public void onAnimationEnd(Animation arg0) { 51 | if (listener != null) { 52 | listener.onSlidedDown(v); 53 | } 54 | } 55 | }); 56 | a.reset(); 57 | if (v != null) { 58 | v.clearAnimation(); 59 | v.startAnimation(a); 60 | } 61 | } 62 | } 63 | 64 | private void slide_up() { 65 | Animation a = AnimationUtils.loadAnimation(context, R.anim.slide_up); 66 | if (a != null) { 67 | a.setAnimationListener(new Animation.AnimationListener() { 68 | @Override 69 | public void onAnimationStart(Animation arg0) { 70 | } 71 | 72 | @Override 73 | public void onAnimationRepeat(Animation arg0) { 74 | } 75 | 76 | @Override 77 | public void onAnimationEnd(Animation arg0) { 78 | v.setVisibility(View.GONE); 79 | if (listener != null) { 80 | listener.onSlidedUp(v); 81 | } 82 | } 83 | }); 84 | a.reset(); 85 | if (v != null) { 86 | v.clearAnimation(); 87 | v.startAnimation(a); 88 | } 89 | } 90 | } 91 | 92 | public interface SlideAnimationListener { 93 | void onSlidedUp(View v); 94 | 95 | void onSlidedDown(View v); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_down.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_up.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/account_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/account_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/calendar_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/calendar_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/course_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/course_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/credit_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/credit_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/darken_orange_text_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/event_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/event_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/feedback_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/feedback_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/info_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/info_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/left_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/left_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/left_pressed_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/left_pressed_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/left_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/logo_darken_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/logo_darken_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/map_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/map_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/nportal_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/nportal_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/orange_color_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/orange_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/other_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/other_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/purple_color_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/red_house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/red_house.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/right_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/right_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/right_pressed_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/right_pressed_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/right_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/setting_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/setting_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/store_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/store_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/taipei_tech_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-hdpi/taipei_tech_logo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/white_block_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/account_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/account_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/calendar_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/calendar_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/course_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/course_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/credit_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/credit_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/dot.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/event_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/event_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/feedback_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/feedback_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/info_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/info_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/map_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/map_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/nportal_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/nportal_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/other_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/other_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/red_house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/red_house.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/setting_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/setting_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/store_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-mdpi/store_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/account_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/account_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/calendar_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/calendar_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/course_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/course_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/course_widget_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/course_widget_preview.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/credit_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/credit_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/event_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/event_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/feedback_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/feedback_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/info_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/info_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/map_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/map_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/nportal_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/nportal_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/other_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/other_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/red_house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/red_house.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/setting_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/setting_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/store_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xhdpi/store_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/account_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/account_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/calendar_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/calendar_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/course_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/course_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/credit_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/credit_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/event_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/event_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/feedback_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/feedback_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/info_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/info_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/map_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/map_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/nportal_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/nportal_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/other_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/other_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/red_house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/red_house.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/setting_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/setting_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/store_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxhdpi/store_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/account_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/account_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/calendar_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/calendar_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/course_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/course_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/credit_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/credit_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/event_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/event_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/feedback_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/feedback_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/info_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/info_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/map_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/map_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/nportal_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/nportal_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/other_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/other_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/red_house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/red_house.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/setting_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/setting_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/store_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable-xxxhdpi/store_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NTUT-NPC/TaipeiTechStudent/8bce8576b771a6e1b1c28a5b03d2755ab6f3eea9/app/src/main/res/drawable/placeholder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/red_color_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_club.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_credit.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 14 | 15 | 20 | 21 | 22 | 23 | 31 | 32 | 38 | 39 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_feedback.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_maps.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 9 | 10 | 11 | 14 | 15 | 33 | 34 | 35 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_portal.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_store.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 10 | 11 | 12 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/calendar_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 25 | 26 | 36 | 37 | 38 | 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/res/layout/calendar_listview.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/classmate_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 20 | 21 | 30 | 31 | 40 | 41 |