├── .gitignore ├── DBHistory ├── CoursesDBHistory.txt └── ReminderDBHistory.txt ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── YC2010 │ │ └── MyClass │ │ ├── callbacks │ │ ├── AsyncTaskCallbackInterface.java │ │ └── SimpleItemTouchHelperCallback.java │ │ ├── data │ │ ├── Connections.java │ │ ├── CoursesDBHandler.java │ │ ├── ReminderDBHandler.java │ │ └── fetchtasks │ │ │ ├── CatalogNumFetchTask.java │ │ │ ├── FinalsFetchTask.java │ │ │ ├── SearchFetchTask.java │ │ │ └── SubjectFetchTask.java │ │ ├── model │ │ ├── CourseInfo.java │ │ ├── FinalObject.java │ │ ├── LectureSectionObject.java │ │ ├── NavigationItem.java │ │ ├── Reminder_item.java │ │ ├── TestObject.java │ │ └── TutorialObject.java │ │ ├── ui │ │ ├── ItemTouchHelperViewHolder.java │ │ ├── activities │ │ │ └── MainActivity.java │ │ ├── adapters │ │ │ ├── CourseDetailPagerAdapter.java │ │ │ ├── Course_Adapter.java │ │ │ ├── FinalsListAdapter.java │ │ │ ├── ItemTouchHelperAdapter.java │ │ │ ├── Reminder_Adapter.java │ │ │ ├── SectionListAdapter.java │ │ │ ├── TstListAdapter.java │ │ │ └── TutListAdapter.java │ │ ├── controls │ │ │ ├── FABScrollBehavior.java │ │ │ └── MyFloatingActionButton.java │ │ └── fragments │ │ │ ├── CalendarFragment.java │ │ │ ├── CatalogNumFragment.java │ │ │ ├── CoursesFragment.java │ │ │ ├── ReminderFragment.java │ │ │ ├── SearchExamFragment.java │ │ │ ├── SearchFragment.java │ │ │ ├── SearchInfoFragment.java │ │ │ ├── SearchScheduleFragment.java │ │ │ ├── SettingFragment.java │ │ │ └── SubjectsFragment.java │ │ └── utils │ │ └── Constants.java │ └── res │ ├── animator │ └── fab_anim.xml │ ├── drawable-hdpi │ ├── ic_add_white_24dp.png │ ├── ic_calendar_grey600_24dp.png │ ├── ic_clear_white_24dp.png │ ├── ic_cloud_off_black_36dp.png │ ├── ic_delete_white_24dp.png │ ├── ic_format_list_numbers_grey600_24dp.png │ ├── ic_menu_check.png │ ├── ic_playlist_plus_grey600_24dp.png │ ├── ic_report_black_36dp.png │ ├── ic_school_grey600_24dp.png │ ├── ic_search_white_24dp.png │ └── ic_settings_grey600_24dp.png │ ├── drawable-mdpi │ ├── ic_add_white_24dp.png │ ├── ic_calendar_grey600_24dp.png │ ├── ic_clear_white_24dp.png │ ├── ic_cloud_off_black_36dp.png │ ├── ic_delete_white_24dp.png │ ├── ic_format_list_numbers_grey600_24dp.png │ ├── ic_menu_check.png │ ├── ic_playlist_plus_grey600_24dp.png │ ├── ic_report_black_36dp.png │ ├── ic_school_grey600_24dp.png │ ├── ic_search_white_24dp.png │ └── ic_settings_grey600_24dp.png │ ├── drawable-nodpi │ ├── guide_01.jpg │ ├── guide_02.jpg │ ├── guide_03.jpg │ ├── guide_04.jpg │ ├── guide_5.jpg │ ├── guide_6.jpg │ └── guide_7.jpg │ ├── drawable-xhdpi │ ├── ic_add_white_24dp.png │ ├── ic_calendar_grey600_24dp.png │ ├── ic_clear_white_24dp.png │ ├── ic_cloud_off_black_36dp.png │ ├── ic_delete_white_24dp.png │ ├── ic_format_list_numbers_grey600_24dp.png │ ├── ic_menu_check.png │ ├── ic_playlist_plus_grey600_24dp.png │ ├── ic_report_black_36dp.png │ ├── ic_school_grey600_24dp.png │ ├── ic_search_white_24dp.png │ └── ic_settings_grey600_24dp.png │ ├── drawable-xxhdpi │ ├── fab_background.xml │ ├── fab_icons.xml │ ├── ic_add.png │ ├── ic_add_white_24dp.png │ ├── ic_calendar_grey600_24dp.png │ ├── ic_clear_white_24dp.png │ ├── ic_cloud_off_black_36dp.png │ ├── ic_delete_white_24dp.png │ ├── ic_format_list_numbers_grey600_24dp.png │ ├── ic_menu_check.png │ ├── ic_playlist_plus_grey600_24dp.png │ ├── ic_report_black_36dp.png │ ├── ic_school_grey600_24dp.png │ ├── ic_search_white_24dp.png │ ├── ic_settings_grey600_24dp.png │ └── ic_tick.png │ ├── drawable-xxxhdpi │ ├── ic_add_white_24dp.png │ ├── ic_clear_white_24dp.png │ ├── ic_cloud_off_black_36dp.png │ ├── ic_delete_white_24dp.png │ ├── ic_format_list_numbers_grey600_24dp.png │ ├── ic_playlist_plus_grey600_24dp.png │ ├── ic_report_black_36dp.png │ ├── ic_school_grey600_24dp.png │ ├── ic_search_white_24dp.png │ └── ic_settings_grey600_24dp.png │ ├── drawable │ ├── avatar.jpg │ ├── playlist_plus.xml │ ├── row_selector.xml │ └── wallpaper.jpg │ ├── layout │ ├── activity_main.xml │ ├── course_cardview.xml │ ├── dialog_add_event.xml │ ├── dialog_add_event_date_picker.xml │ ├── dialog_add_event_time_picker.xml │ ├── drawer_header.xml │ ├── facebook_login_dialog.xml │ ├── fragment_courses.xml │ ├── fragment_main.xml │ ├── fragment_reminder.xml │ ├── fragment_search.xml │ ├── fragment_search_exam.xml │ ├── fragment_search_info.xml │ ├── fragment_search_schedule.xml │ ├── fragment_select_item.xml │ ├── fragment_select_list.xml │ ├── fragment_setting.xml │ ├── reminderitem_cardview.xml │ ├── section_item.xml │ └── toolbar_default.xml │ ├── menu │ ├── calendar_menu.xml │ ├── calender_action_overflow.xml │ ├── drawer_menu.xml │ ├── main_activity_actions.xml │ └── reminder_menu.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── values-v21 │ └── styles.xml │ ├── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml │ └── xml │ ├── preferences.xml │ └── searchable.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Built application files 4 | *.apk 5 | *.ap_ 6 | 7 | # Files for the Dalvik VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | 17 | # Local configuration file (sdk path, etc) 18 | local.properties 19 | 20 | # Proguard folder generated by Eclipse 21 | proguard/ 22 | 23 | # Log Files 24 | *.log 25 | 26 | # Android Studio 27 | *.iml 28 | .idea 29 | .idea/workspace.xml - remove # and delete .idea if it better suit your needs. 30 | .gradle 31 | build/ 32 | app/src/main/java/com/YC2010/MyClass/utils/Tools.java 33 | -------------------------------------------------------------------------------- /DBHistory/CoursesDBHistory.txt: -------------------------------------------------------------------------------- 1 | // Note: 2 | // *** indicates changes compare to previous version 3 | 4 | Version 3,4,5: 5 | KEY_NUM STRING PRIMARY KEY 6 | KEY_NAME TEXT 7 | KEY_SECTION TEXT 8 | KEY_TIME TEXT 9 | KEY_LOC TEXT 10 | KEY_PROF TEXT 11 | KEY_NAME_TUT TEXT 12 | KEY_NUM_TUT TEXT 13 | KEY_TIME_TUT TEXT 14 | KEY_LOC_TUT TEXT 15 | KEY_SEC_TUT TEXT 16 | KEY_ONLINE INTEGER 17 | 18 | Version 6: 19 | KEY_NUM STRING PRIMARY KEY 20 | KEY_NAME TEXT 21 | KEY_SECTION TEXT 22 | KEY_TIME TEXT 23 | KEY_LOC TEXT 24 | KEY_PROF TEXT 25 | KEY_NAME_TUT TEXT 26 | KEY_NUM_TUT TEXT 27 | KEY_TIME_TUT TEXT 28 | KEY_LOC_TUT TEXT 29 | KEY_SEC_TUT TEXT 30 | KEY_ONLINE INTEGER 31 | KEY_TAKING_TERM INTEGER *** -------------------------------------------------------------------------------- /DBHistory/ReminderDBHistory.txt: -------------------------------------------------------------------------------- 1 | // Note: 2 | // *** indicates changes compare to previous version 3 | 4 | Version 3: 5 | KEY_ID STRING PRIMARY KEY 6 | KEY_TITLE TEXT 7 | KEY_LOCATION TEXT 8 | KEY_UNIX_TIME TEXT 9 | KEY_TYPE TEXT -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MyClass 2 | 3 | Get it on Google Play 4 | 5 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | signingConfigs { 5 | } 6 | compileSdkVersion 23 7 | buildToolsVersion '21.1.2' 8 | defaultConfig { 9 | applicationId 'com.YC2010.MyClass' 10 | minSdkVersion 19 11 | targetSdkVersion 23 12 | versionCode 1020399 13 | versionName "1.2.3" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | zipAlignEnabled true 20 | } 21 | } 22 | productFlavors { 23 | } 24 | } 25 | 26 | repositories { mavenCentral() } 27 | 28 | dependencies { 29 | compile fileTree(dir: 'libs', include: ['*.jar']) 30 | compile 'com.android.support:appcompat-v7:23.1.1' 31 | compile 'com.android.support:support-v13:23.1.1' 32 | compile 'com.android.support:recyclerview-v7:23.1.1' 33 | compile 'com.android.support:cardview-v7:23.1.1' 34 | compile 'com.android.support:design:23.1.1' 35 | compile 'com.github.alamkanak:android-week-view:1.2.3' 36 | // compile 'com.facebook.android:facebook-android-sdk:4.0.0' 37 | } 38 | -------------------------------------------------------------------------------- /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 C:\Users\Jason\AppData\Local\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 | -keep class android.support.design.widget.** { *; } 20 | -keep interface android.support.design.widget.** { *; } 21 | -dontwarn android.support.design.** 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/callbacks/AsyncTaskCallbackInterface.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.callbacks; 2 | 3 | import android.os.Bundle; 4 | 5 | /** 6 | * Created by Sai on 2015/2/12. 7 | */ 8 | public interface AsyncTaskCallbackInterface { 9 | public void onOperationComplete(Bundle bundle); 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/callbacks/SimpleItemTouchHelperCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Paul Burke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.YC2010.MyClass.callbacks; 18 | 19 | import android.support.design.widget.Snackbar; 20 | import android.support.v7.widget.RecyclerView; 21 | import android.support.v7.widget.helper.ItemTouchHelper; 22 | import android.view.View; 23 | 24 | import com.YC2010.MyClass.ui.adapters.ItemTouchHelperAdapter; 25 | 26 | 27 | public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback { 28 | 29 | private final ItemTouchHelperAdapter mAdapter; 30 | private final View mView; 31 | 32 | public SimpleItemTouchHelperCallback(ItemTouchHelperAdapter adapter, View view) { 33 | mAdapter = adapter; 34 | mView = view; 35 | } 36 | 37 | @Override 38 | public boolean isLongPressDragEnabled() { 39 | return true; 40 | } 41 | 42 | @Override 43 | public boolean isItemViewSwipeEnabled() { 44 | return true; 45 | } 46 | 47 | @Override 48 | public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { 49 | int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; 50 | int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; 51 | return makeMovementFlags(dragFlags, swipeFlags); 52 | } 53 | 54 | @Override 55 | public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, 56 | RecyclerView.ViewHolder target) { 57 | return true; 58 | } 59 | 60 | @Override 61 | public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { 62 | mAdapter.onItemDismiss(viewHolder.getAdapterPosition()); 63 | 64 | 65 | // show snackBar Event updated 66 | Snackbar.make(mView, "Event Removed", Snackbar.LENGTH_SHORT) 67 | .show(); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/data/Connections.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.data; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | 9 | import com.YC2010.MyClass.utils.Constants; 10 | import com.YC2010.MyClass.utils.Tools; 11 | 12 | import org.json.JSONArray; 13 | import org.json.JSONObject; 14 | 15 | import java.io.BufferedReader; 16 | import java.io.InputStreamReader; 17 | import java.net.HttpURLConnection; 18 | import java.net.URL; 19 | import java.util.ArrayList; 20 | import java.util.HashMap; 21 | import java.util.Iterator; 22 | 23 | /** 24 | * Created by Danny on 2015/10/25. 25 | */ 26 | public class Connections { 27 | 28 | // /courses/{subject}/{catalog_number} 29 | 30 | public static String getCourseInfoURL(String input) { 31 | String subject = ""; 32 | String cataNum = ""; 33 | boolean isCoursePrefix = true; 34 | 35 | input = input.replaceAll("\\s+",""); 36 | 37 | for (int i = 0; i < input.length(); i++) { 38 | if(isCoursePrefix && Character.isDigit(input.charAt(i))) 39 | isCoursePrefix = false; 40 | if(isCoursePrefix){ 41 | subject += input.charAt(i); 42 | } 43 | else{ 44 | cataNum += input.charAt(i); 45 | } 46 | } 47 | 48 | return Constants.UWAPIROOT + "courses/" + subject + "/" + cataNum + ".json" + URLEnding(); 49 | } 50 | 51 | public static boolean isNetworkAvailable(Context context) { 52 | ConnectivityManager connectivityManager 53 | = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 54 | NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); 55 | return activeNetworkInfo != null && activeNetworkInfo.isConnected(); 56 | } 57 | 58 | 59 | // /courses/{subject}/{catalog_number}/schedule 60 | public static String getScheduleURL(String input) { 61 | String subject = ""; 62 | String cataNum = ""; 63 | boolean isCoursePrefix = true; 64 | input = input.replaceAll("\\s+",""); 65 | 66 | for (int i = 0; i < input.length(); i++) { 67 | if(isCoursePrefix && Character.isDigit(input.charAt(i))) 68 | isCoursePrefix = false; 69 | if(isCoursePrefix){ 70 | subject += input.charAt(i); 71 | } 72 | else{ 73 | cataNum += input.charAt(i); 74 | } 75 | } 76 | return Constants.UWAPIROOT + "courses/" + subject + "/" + cataNum + "/schedule.json" + URLEnding(); 77 | } 78 | 79 | // /terms/{term}/{subject}/{catalog_number}/schedule 80 | public static String getScheduleURL(String input, Integer term) { 81 | String subject = ""; 82 | String cataNum = ""; 83 | boolean isCoursePrefix = true; 84 | input = input.replaceAll("\\s+",""); 85 | 86 | for (int i = 0; i < input.length(); i++) { 87 | if (isCoursePrefix && Character.isDigit(input.charAt(i))) 88 | isCoursePrefix = false; 89 | if (isCoursePrefix){ 90 | subject += input.charAt(i); 91 | } 92 | else { 93 | cataNum += input.charAt(i); 94 | } 95 | } 96 | return Constants.UWAPIROOT + "terms/" + term + "/" + subject + "/" + cataNum + "/schedule.json" + URLEnding(); 97 | } 98 | 99 | public static Integer getCurrentTerm() throws Exception { 100 | String term; 101 | String termList_url = Constants.UWAPIROOT + "terms/list.json" + URLEnding(); 102 | JSONObject termList = getJSON_from_url(termList_url); 103 | try { 104 | term = termList.getJSONObject("data").getString("current_term"); 105 | } 106 | catch (Exception e){ 107 | e.printStackTrace(); 108 | return null; 109 | } 110 | return Integer.parseInt(term); 111 | } 112 | 113 | 114 | /* return a list of term num and a list of term name */ 115 | /* index 0: previous term */ 116 | /* index 1: current term */ 117 | /* index 2: next term */ 118 | public static Bundle getTerms() { 119 | Bundle mbundle = new Bundle(); 120 | ArrayList termNumList = new ArrayList<>(); 121 | ArrayList termNameList = new ArrayList<>(); 122 | String termList_url = Constants.UWAPIROOT + "terms/list.json" + URLEnding(); 123 | try { 124 | JSONObject termData = getJSON_from_url(termList_url).getJSONObject("data"); 125 | termNumList.add(0, Integer.parseInt(termData.getString("previous_term"))); 126 | termNumList.add(1, Integer.parseInt(termData.getString("current_term"))); 127 | termNumList.add(2,Integer.parseInt(termData.getString("next_term"))); 128 | 129 | JSONObject termYear = termData.getJSONObject("listings"); 130 | Iterator years = termYear.keys(); 131 | JSONArray termTermList; 132 | HashMap termMap = new HashMap<>(); 133 | while (years.hasNext()){ 134 | String key = (String) years.next(); 135 | termTermList = termYear.getJSONArray(key); 136 | for (int j = 0; j < termTermList.length(); j++){ 137 | termMap.put(termTermList.getJSONObject(j).getInt("id"), termTermList.getJSONObject(j).getString("name")); 138 | } 139 | } 140 | 141 | for (int i = 0; i < termNumList.size(); i++){ 142 | termNameList.add(i, termMap.get(termNumList.get(i))); 143 | } 144 | } 145 | catch (Exception e){ 146 | e.printStackTrace(); 147 | return null; 148 | } 149 | 150 | mbundle.putIntegerArrayList("KEY_TERM_NUM", termNumList); 151 | mbundle.putStringArrayList("KEY_TERM_NAME", termNameList); 152 | return mbundle; 153 | } 154 | 155 | public static String getTermName(String term){ 156 | String termList_url = Constants.UWAPIROOT + "terms/list.json" + URLEnding(); 157 | try { 158 | JSONObject terms_listing = getJSON_from_url(termList_url).getJSONObject("data").getJSONObject("listings"); 159 | Iterator i = terms_listing.keys(); 160 | while(i.hasNext()){ 161 | String key = (String) i.next(); 162 | JSONArray year = (JSONArray) terms_listing.get(key); 163 | for(int j = 0; j < year.length(); j++){ 164 | if (year.getJSONObject(j).getString("id").equals(term)) { 165 | Log.d("Constants", year.getJSONObject(j).getString("name")); 166 | return year.getJSONObject(j).getString("name"); 167 | } 168 | } 169 | } 170 | return null; 171 | } 172 | catch (Exception e){ 173 | e.printStackTrace(); 174 | return null; 175 | } 176 | } 177 | 178 | public static String getExamsURL(int term) { 179 | return Constants.UWAPIROOT + "terms/" + term + "/examschedule" + ".json" + URLEnding(); 180 | } 181 | 182 | public static String getSubjectsOfferingURL() { 183 | return Constants.UWAPIROOT + "codes/subjects" + ".json" + URLEnding(); 184 | } 185 | 186 | public static String getCatalogNumURL(String subject) { 187 | return Constants.UWAPIROOT + "courses/" + subject + ".json" + URLEnding(); 188 | } 189 | 190 | public static JSONObject getJSON_from_url(String url) throws Exception { 191 | URL obj = new URL(url); 192 | HttpURLConnection connection = (HttpURLConnection) obj.openConnection(); 193 | JSONObject jsonObject; 194 | 195 | try { 196 | Log.d("getJSONObject", "URL is " + url); 197 | 198 | int responseCode = connection.getResponseCode(); 199 | 200 | if (responseCode != 200) { 201 | throw new RuntimeException("Failed: HTTP error code: " + responseCode); 202 | } 203 | 204 | BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8")); 205 | 206 | String inputLine; 207 | StringBuilder entityStringBuilder = new StringBuilder(); 208 | 209 | while (null != (inputLine = in.readLine())) { 210 | entityStringBuilder.append(inputLine).append("\n"); 211 | } 212 | in.close(); 213 | 214 | jsonObject = new JSONObject(entityStringBuilder.toString()); 215 | 216 | 217 | } 218 | catch (Exception e) { 219 | e.printStackTrace(); 220 | return null; 221 | } 222 | return jsonObject; 223 | } 224 | 225 | public static String URLEnding() { 226 | return "?key=" + Tools.YOUNEEDTHIS; 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/data/ReminderDBHandler.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.data; 2 | 3 | import android.content.ContentValues; 4 | import android.content.Context; 5 | import android.database.Cursor; 6 | import android.database.sqlite.SQLiteDatabase; 7 | import android.database.sqlite.SQLiteOpenHelper; 8 | import android.database.sqlite.SQLiteStatement; 9 | import android.util.Log; 10 | 11 | import com.YC2010.MyClass.model.Reminder_item; 12 | 13 | import java.util.ArrayList; 14 | import java.util.Date; 15 | import java.util.GregorianCalendar; 16 | import java.util.List; 17 | 18 | /** 19 | * Created by Jason on 2015-06-02. 20 | */ 21 | public class ReminderDBHandler extends SQLiteOpenHelper { 22 | // DB Version 23 | private static final int DATABASE_VERSION = 3; 24 | 25 | // DB Name 26 | private static final String DATABASE_NAME = "ReminderManager"; 27 | 28 | // Table name 29 | private static final String TABLE_REMINDERS = "reminders"; 30 | 31 | // TABLE_REMINDERS Columns names // columnIndex 32 | private static final String KEY_ID = "id"; // 0 33 | private static final String KEY_TITLE = "title"; // 1 34 | private static final String KEY_LOCATION = "location"; // 2 35 | private static final String KEY_UNIX_TIME = "Unix_time"; // 3 36 | private static final String KEY_TYPE = "type"; // 4 37 | 38 | public ReminderDBHandler(Context context) { 39 | super(context, DATABASE_NAME, null, DATABASE_VERSION); 40 | } 41 | 42 | @Override 43 | public void onCreate(SQLiteDatabase db) { 44 | Log.d("ReminderDBHandler", "onCreate"); 45 | String CREATE_TABLE = "CREATE TABLE " + TABLE_REMINDERS + "(" 46 | + KEY_ID + " STRING PRIMARY KEY," + KEY_TITLE + " TEXT," 47 | + KEY_LOCATION + " TEXT," + KEY_UNIX_TIME + " TEXT," 48 | + KEY_TYPE + " TEXT" + ")"; 49 | db.execSQL(CREATE_TABLE); 50 | } 51 | 52 | // Upgrading database 53 | @Override 54 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 55 | // Drop older table if existed 56 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_REMINDERS); 57 | 58 | // Create tables again 59 | onCreate(db); 60 | } 61 | 62 | /** 63 | * All CRUD(Create, Read, Update, Delete) Operations 64 | */ 65 | 66 | // Adding new Reminder 67 | public void addReminder(Reminder_item reminder) { 68 | SQLiteDatabase db = this.getWritableDatabase(); 69 | 70 | ContentValues values = new ContentValues(); 71 | values.put(KEY_ID, reminder.get_id()); 72 | values.put(KEY_TITLE, reminder.get_title()); 73 | values.put(KEY_LOCATION, reminder.get_location()); 74 | values.put(KEY_UNIX_TIME, reminder.get_unix_time()); 75 | values.put(KEY_TYPE, reminder.get_type()); 76 | 77 | // Inserting Row 78 | db.insert(TABLE_REMINDERS, null, values); 79 | db.close(); // Closing database connection 80 | } 81 | 82 | // remove a reminder 83 | public void removeReminder(String uuid_string){ 84 | SQLiteDatabase db = this.getWritableDatabase(); 85 | 86 | // deleting Row 87 | int affected_rows = db.delete(TABLE_REMINDERS, KEY_ID + " = ?", new String[]{uuid_string}); 88 | Log.d("uuid", "uuid is " + uuid_string); 89 | Log.d("removeReminder", affected_rows + " rows deleted"); 90 | db.close(); // Closing database connection 91 | } 92 | 93 | // remove a reminder 94 | public void removeAll(String type){ 95 | SQLiteDatabase db = this.getWritableDatabase(); 96 | 97 | // deleting Row 98 | int affected_rows = db.delete(TABLE_REMINDERS, KEY_TYPE + " = ?", new String[]{type}); 99 | Log.d("removeReminder", affected_rows + " rows deleted"); 100 | db.close(); // Closing database connection 101 | } 102 | 103 | public void removeAll(){ 104 | SQLiteDatabase db = this.getWritableDatabase(); 105 | 106 | // deleting Row 107 | int affected_rows = db.delete(TABLE_REMINDERS, null,null); 108 | Log.d("removeReminder", affected_rows + " rows deleted"); 109 | db.close(); // Closing database connection 110 | } 111 | 112 | // get reminder count 113 | public int CountReminders(){ 114 | SQLiteDatabase db = this.getReadableDatabase(); 115 | 116 | long now_time = GregorianCalendar.getInstance().getTime().getTime(); 117 | String selectQuery = "SELECT COUNT(*) FROM " + TABLE_REMINDERS + " WHERE " + 118 | KEY_UNIX_TIME + " > " + now_time; 119 | SQLiteStatement s = db.compileStatement(selectQuery); 120 | long count = s.simpleQueryForLong(); 121 | return (int)count; 122 | } 123 | 124 | // see if exam in 7 days 125 | public boolean closoToExam(Date mdate){ 126 | SQLiteDatabase db = this.getReadableDatabase(); 127 | long event_time = mdate.getTime(); 128 | long weeks_time = 604800000; 129 | long time_in_a_week = event_time + weeks_time; 130 | String selectQuery = "SELECT COUNT(*) FROM " + TABLE_REMINDERS + " WHERE " + 131 | KEY_UNIX_TIME + " > " + event_time + " and " + KEY_UNIX_TIME + " < " + 132 | time_in_a_week + " and " + KEY_TYPE + " = 'e'"; 133 | SQLiteStatement s = db.compileStatement(selectQuery); 134 | long count = s.simpleQueryForLong(); 135 | //Log.d("getAllReminders", "long is " + count); 136 | return count > 0; 137 | } 138 | 139 | // Get All Reminder 140 | public List getAllReminders() { 141 | List reminderList = new ArrayList<>(); 142 | 143 | // Select All Query 144 | long now_time = GregorianCalendar.getInstance().getTime().getTime(); 145 | String selectQuery = "SELECT * FROM " + TABLE_REMINDERS + " WHERE " + 146 | KEY_UNIX_TIME + " > " + now_time + " ORDER BY " + KEY_UNIX_TIME; 147 | 148 | SQLiteDatabase db = this.getWritableDatabase(); 149 | Cursor cursor = db.rawQuery(selectQuery, null); 150 | 151 | // looping through all rows and adding to list 152 | if (cursor.moveToFirst()) { 153 | do { 154 | //Log.d("getAllReminders", "uuid is " + cursor.getString(0)); 155 | Reminder_item reminder = new Reminder_item( 156 | cursor.getString(0), 157 | cursor.getString(1), 158 | cursor.getString(2), 159 | Long.parseLong(cursor.getString(3)), 160 | cursor.getString(4)); 161 | 162 | // Adding reminder to list 163 | reminderList.add(reminder); 164 | } while (cursor.moveToNext()); 165 | } 166 | cursor.close(); 167 | // return contact list 168 | return reminderList; 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/data/fetchtasks/CatalogNumFetchTask.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.data.fetchtasks; 2 | 3 | import android.app.Activity; 4 | import android.os.AsyncTask; 5 | import android.os.Bundle; 6 | import android.util.Log; 7 | 8 | import com.YC2010.MyClass.callbacks.AsyncTaskCallbackInterface; 9 | import com.YC2010.MyClass.data.Connections; 10 | 11 | import org.json.JSONArray; 12 | import org.json.JSONObject; 13 | 14 | import java.util.ArrayList; 15 | 16 | /** 17 | * Created by Danny on 2015/6/27. 18 | */ 19 | public class CatalogNumFetchTask extends AsyncTask { 20 | 21 | private Activity mActivity; 22 | AsyncTaskCallbackInterface mAsyncTaskCallbackInterface; 23 | private ArrayList mCatalogNum_arraylist = new ArrayList<>(); 24 | private String mSubject; 25 | public CatalogNumFetchTask(String subject, AsyncTaskCallbackInterface asyncTaskCallbackInterface) { 26 | mAsyncTaskCallbackInterface = asyncTaskCallbackInterface; 27 | mSubject = subject; 28 | } 29 | 30 | @Override 31 | protected Bundle doInBackground(String...params) { 32 | Bundle result = new Bundle(); 33 | fetchCourse(result); 34 | 35 | return result; 36 | } 37 | 38 | private Bundle fetchCourse(Bundle bundle) { 39 | try{ 40 | String url = Connections.getCatalogNumURL(mSubject); 41 | 42 | JSONObject jsonObject = Connections.getJSON_from_url(url); 43 | JSONArray subject_array = jsonObject.getJSONArray("data"); 44 | Log.d("SubjectFetchTask", "subject array is " + subject_array.length()); 45 | 46 | for(int i = 0; i < subject_array.length(); i++){ 47 | JSONObject subject = subject_array.getJSONObject(i); 48 | mCatalogNum_arraylist.add(i,mSubject + " " + subject.getString("catalog_number")); 49 | } 50 | 51 | bundle.putStringArrayList("CatalogNum_arraylist", mCatalogNum_arraylist); 52 | 53 | return bundle; 54 | 55 | } catch (Exception e) { 56 | e.printStackTrace(); 57 | } 58 | return bundle; 59 | } 60 | 61 | @Override 62 | protected void onPostExecute(Bundle bundle) { 63 | mAsyncTaskCallbackInterface.onOperationComplete(bundle); 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/data/fetchtasks/FinalsFetchTask.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.data.fetchtasks; 2 | 3 | import android.app.Activity; 4 | import android.app.ProgressDialog; 5 | import android.os.AsyncTask; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | 9 | import com.YC2010.MyClass.callbacks.AsyncTaskCallbackInterface; 10 | import com.YC2010.MyClass.data.Connections; 11 | import com.YC2010.MyClass.data.ReminderDBHandler; 12 | import com.YC2010.MyClass.model.Reminder_item; 13 | 14 | import org.json.JSONArray; 15 | import org.json.JSONObject; 16 | 17 | import java.text.DateFormat; 18 | import java.text.SimpleDateFormat; 19 | import java.util.Date; 20 | import java.util.List; 21 | import java.util.UUID; 22 | 23 | /** 24 | * Created by Jason on 2015/6/27. 25 | */ 26 | public class FinalsFetchTask extends AsyncTask, Void, Bundle> { 27 | 28 | private Activity mActivity; 29 | private AsyncTaskCallbackInterface mAsyncTaskCallbackInterface; 30 | 31 | public FinalsFetchTask(Activity activity, AsyncTaskCallbackInterface asyncTaskCallbackInterface) { 32 | this.mActivity = activity; 33 | mAsyncTaskCallbackInterface = asyncTaskCallbackInterface; 34 | } 35 | ProgressDialog progDailog; 36 | 37 | @Override 38 | protected void onPreExecute() { 39 | super.onPreExecute(); 40 | progDailog = new ProgressDialog(mActivity); 41 | progDailog.setMessage("Loading..."); 42 | progDailog.setIndeterminate(false); 43 | progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 44 | progDailog.setCancelable(true); 45 | progDailog.show(); 46 | } 47 | 48 | @Override 49 | protected Bundle doInBackground(List...params) { 50 | Bundle result = new Bundle(); 51 | 52 | fetchExam(result, params[0], params[1]); 53 | 54 | return result; 55 | } 56 | 57 | private Bundle fetchExam(Bundle bundle, List course_names, List course_secs) { 58 | try{ 59 | bundle.putBoolean("valid_return", false); 60 | // get schedule JSONBObject 61 | // TODO: what if no course exist??? 62 | 63 | //ArrayList termNumList = Connections.getTerms().get 64 | int current_term = Connections.getTerms().getIntegerArrayList("KEY_TERM_NUM").get(1); 65 | // get exam JSONBObject 66 | String exam_url = Connections.getExamsURL(current_term); 67 | JSONObject examObject = Connections.getJSON_from_url(exam_url); 68 | 69 | // check valid data return 70 | if (!examObject.getJSONObject("meta").getString("message").equals("Request successful")) { 71 | Log.d("FinalsFetchTask",examObject.toString()); 72 | return bundle; 73 | } 74 | bundle.putBoolean("valid_return", true); 75 | 76 | JSONArray examData = examObject.getJSONArray("data"); 77 | 78 | // get final info from courses 79 | ReminderDBHandler reminder_db = new ReminderDBHandler(mActivity); 80 | reminder_db.removeAll("e"); 81 | for (int i = 0; i < course_names.size(); i++) { 82 | String course_name = course_names.get(i); 83 | String course_sec = course_secs.get(i); 84 | 85 | Log.d("FinalsFetchTask",course_name + course_sec); 86 | 87 | // check if has final and get index for finals 88 | boolean has_final = false; 89 | int exam_index = 0; 90 | int section_index = 0; 91 | for (; exam_index < examData.length(); exam_index++) { 92 | if (examData.getJSONObject(exam_index).getString("course").equals(course_name)) { 93 | JSONArray section_array = examData.getJSONObject(exam_index).getJSONArray("sections"); 94 | int length = section_array.length(); 95 | for(; section_index < section_array.length(); section_index++){ 96 | Log.d("FinalsFetchTask",section_array.getJSONObject(section_index).getString("section")); 97 | if(section_array.getJSONObject(section_index).getString("section").equals(course_sec)){ 98 | Log.d("FinalsFetchTask","section_index is " + section_index); 99 | has_final = true; 100 | break; 101 | } 102 | } 103 | break; 104 | } 105 | } 106 | if(has_final){ 107 | JSONObject final_schedule = examData.getJSONObject(exam_index).getJSONArray("sections").getJSONObject(section_index); 108 | String loc = "SEC " + course_sec + " " + final_schedule.getString("location"); 109 | String title = course_name + " Final exam"; 110 | String start_time = final_schedule.getString("date") + " " + final_schedule.getString("start_time"); 111 | DateFormat f1 = new SimpleDateFormat("yyyy-MM-dd h:mm a"); 112 | Date d = f1.parse(start_time); 113 | 114 | Reminder_item new_exam = new Reminder_item(UUID.randomUUID().toString(), title, loc, d.getTime(), "e"); 115 | 116 | reminder_db.addReminder(new_exam); 117 | reminder_db.close(); 118 | } 119 | } 120 | //MainActivity mainActivity = (MainActivity) getActivity(); 121 | 122 | 123 | return bundle; 124 | 125 | } catch (Exception e) { 126 | e.printStackTrace(); 127 | } 128 | 129 | return bundle; 130 | } 131 | 132 | 133 | 134 | @Override 135 | protected void onPostExecute(final Bundle bundle) { 136 | progDailog.dismiss(); 137 | 138 | 139 | mAsyncTaskCallbackInterface.onOperationComplete(bundle); 140 | 141 | 142 | } 143 | 144 | 145 | } 146 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/data/fetchtasks/SubjectFetchTask.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.data.fetchtasks; 2 | 3 | import android.app.Activity; 4 | import android.os.AsyncTask; 5 | import android.os.Bundle; 6 | import android.util.Log; 7 | 8 | import com.YC2010.MyClass.callbacks.AsyncTaskCallbackInterface; 9 | import com.YC2010.MyClass.data.Connections; 10 | 11 | import org.json.JSONArray; 12 | import org.json.JSONObject; 13 | 14 | import java.util.ArrayList; 15 | 16 | /** 17 | * Created by Danny on 2015/6/27. 18 | */ 19 | public class SubjectFetchTask extends AsyncTask { 20 | 21 | private Activity mActivity; 22 | AsyncTaskCallbackInterface mAsyncTaskCallbackInterface; 23 | private ArrayList subject_arraylist = new ArrayList<>(); 24 | private ArrayList description_arraylist = new ArrayList<>(); 25 | 26 | public SubjectFetchTask(AsyncTaskCallbackInterface asyncTaskCallbackInterface) { 27 | mAsyncTaskCallbackInterface = asyncTaskCallbackInterface; 28 | } 29 | 30 | @Override 31 | protected Bundle doInBackground(String...params) { 32 | Bundle result = new Bundle(); 33 | 34 | fetchCourse(result); 35 | 36 | return result; 37 | } 38 | 39 | private Bundle fetchCourse(Bundle bundle) { 40 | try{ 41 | String url = Connections.getSubjectsOfferingURL(); 42 | 43 | JSONObject jsonObject = Connections.getJSON_from_url(url); 44 | JSONArray subject_array = jsonObject.getJSONArray("data"); 45 | Log.d("SubjectFetchTask", "subject array is " + subject_array.length()); 46 | 47 | for(int i = 0; i < subject_array.length(); i++){ 48 | JSONObject subject = subject_array.getJSONObject(i); 49 | subject_arraylist.add(i,subject.getString("subject")); 50 | description_arraylist.add(i,subject.getString("description")); 51 | //Log.d("SubjectFetchTask", "miao"); 52 | } 53 | 54 | bundle.putStringArrayList("subject_arraylist", subject_arraylist); 55 | bundle.putStringArrayList("description_arraylist", description_arraylist); 56 | 57 | return bundle; 58 | 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | } 62 | return bundle; 63 | } 64 | 65 | @Override 66 | protected void onPostExecute(Bundle bundle) { 67 | mAsyncTaskCallbackInterface.onOperationComplete(bundle); 68 | } 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/model/CourseInfo.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.model; 2 | 3 | import java.text.DateFormat; 4 | import java.text.ParseException; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | 8 | /** 9 | * Created by Lincoln on 2015-06-02. 10 | */ 11 | public class CourseInfo { 12 | private String courseName; 13 | private String courseNum; 14 | private String courseSec; 15 | private String courseTime; 16 | private String courseLoc; 17 | private String courseProf; 18 | private String tutName; 19 | private String tutNum; 20 | private String tutTime; 21 | private String tutLoc; 22 | private String tutSec; 23 | private boolean isOnline; 24 | private String labName; 25 | private String labNum; 26 | private String labTime; 27 | private String labSec; 28 | private String labLoc; 29 | 30 | public CourseInfo(String name){ 31 | courseName = name; 32 | } 33 | 34 | public void setNum(String number){ 35 | courseNum = number; 36 | } 37 | 38 | public void setLoc(String loc){ 39 | courseLoc = loc; 40 | } 41 | 42 | public void setTime(String time){ 43 | courseTime = time; 44 | } 45 | 46 | public void setTimeAPM(String time){ 47 | if (!isOnline && time != null) { 48 | int i = 0; 49 | for (; time.charAt(i) < 48 || time.charAt(i) > 57; i++); 50 | String days = time.substring(0,i); 51 | String realtime = time.substring(i); 52 | String starttime = realtime.substring(0,5); 53 | String endtime = realtime.substring(6); 54 | try{ 55 | DateFormat f1 = new SimpleDateFormat("HH:mm"); //HH for hour of the day (0 - 23) 56 | Date d = f1.parse(starttime); 57 | DateFormat f2 = new SimpleDateFormat("h:mma"); 58 | starttime = f2.format(d); // "12:18am" 59 | 60 | DateFormat f3 = new SimpleDateFormat("HH:mm"); //HH for hour of the day (0 - 23) 61 | Date d2 = f3.parse(endtime); 62 | DateFormat f4 = new SimpleDateFormat("h:mma"); 63 | endtime = f4.format(d2); // "12:18am" 64 | 65 | 66 | } catch (ParseException e){ 67 | e.printStackTrace(); 68 | } 69 | courseTime = days + starttime + "-" + endtime; 70 | } else { 71 | courseTime = time; 72 | } 73 | } 74 | public void setSec(String sec){ 75 | courseSec = sec; 76 | isOnline = sec.equals("081"); 77 | } 78 | 79 | public void setProf(String prof){ 80 | courseProf = prof; 81 | } 82 | 83 | public void setTutname(){ 84 | tutName = courseName; 85 | } 86 | 87 | public void setTutnum(String num){ 88 | tutNum = num; 89 | } 90 | 91 | public void setTutTime(String time){ 92 | tutTime = time; 93 | } 94 | 95 | public void setTutLoc(String loc) { 96 | tutLoc = loc; 97 | } 98 | 99 | public void setTutsec(String sec){ 100 | tutSec = sec; 101 | } 102 | 103 | public void setlabName(){ 104 | tutSec = courseName; 105 | } 106 | 107 | public void setlabNum(String num){ labNum = num;} 108 | 109 | public void setlabTime(String time){ labTime = time;} 110 | 111 | public void setlabLoc(String loc){ labLoc = loc;} 112 | 113 | public void setlabSec(String sec){ labSec = sec;} 114 | 115 | public void setIsOnline(boolean isOnline) { 116 | this.isOnline = isOnline; 117 | } 118 | 119 | public String getCourseName() { 120 | return courseName; 121 | } 122 | 123 | public String getCourseNum() { 124 | return courseNum; 125 | } 126 | 127 | public String getCourseSec() { 128 | return courseSec; 129 | } 130 | 131 | public String getCourseTime() { 132 | return courseTime; 133 | } 134 | 135 | public String getCourseLoc() { 136 | return courseLoc; 137 | } 138 | 139 | public String getCourseProf() { 140 | return courseProf; 141 | } 142 | 143 | public String getTutName() { 144 | return tutName; 145 | } 146 | 147 | public String getTutNum() { 148 | return tutNum; 149 | } 150 | 151 | public String getTutTime() { 152 | return tutTime; 153 | } 154 | 155 | public String getTutLoc() { 156 | return tutLoc; 157 | } 158 | 159 | public String getTutSec() { 160 | return tutSec; 161 | } 162 | 163 | public boolean isOnline() { 164 | return isOnline; 165 | } 166 | 167 | public String getLabName() { 168 | return labName; 169 | } 170 | 171 | public String getLabNum() { 172 | return labNum; 173 | } 174 | 175 | public String getLabTime() { 176 | return labTime; 177 | } 178 | 179 | public String getLabSec() { 180 | return labSec; 181 | } 182 | 183 | public String getLabLoc() { 184 | return labLoc; 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/model/FinalObject.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.model; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | /** 7 | * Created by Danny on 2015/10/17. 8 | */ 9 | public class FinalObject implements Parcelable { 10 | private String section; 11 | private String time; 12 | private String location; 13 | private String date; 14 | private boolean isOnline; 15 | 16 | public FinalObject() {} 17 | 18 | @Override 19 | public int describeContents() { 20 | return 0; 21 | } 22 | 23 | @Override 24 | public void writeToParcel(Parcel dest, int flags) { 25 | dest.writeString(section); 26 | dest.writeString(time); 27 | dest.writeString(location); 28 | dest.writeString(date); 29 | dest.writeByte((byte) (isOnline ? 1 : 0)); 30 | } 31 | 32 | public FinalObject(Parcel src) { 33 | this.section = src.readString(); 34 | this.time = src.readString(); 35 | this.location = src.readString(); 36 | this.date = src.readString(); 37 | this.isOnline = src.readByte() == 1; 38 | } 39 | 40 | public static final Creator CREATOR = new Creator() { 41 | @Override 42 | public FinalObject createFromParcel(Parcel source) { 43 | return new FinalObject(source); 44 | } 45 | 46 | @Override 47 | public FinalObject[] newArray(int size) { 48 | return new FinalObject[size]; 49 | } 50 | }; 51 | 52 | public void setSection(String section) { 53 | this.section = section; 54 | } 55 | 56 | public void setTime(String time) { 57 | this.time = time; 58 | } 59 | 60 | public void setLocation(String location) { 61 | this.location = location; 62 | } 63 | 64 | public void setDate(String date) { 65 | this.date = date; 66 | } 67 | 68 | public void setIsOnline(boolean isOnline) { 69 | this.isOnline = isOnline; 70 | } 71 | 72 | public String getSection() { 73 | return section; 74 | } 75 | 76 | public String getTime() { 77 | return time; 78 | } 79 | 80 | public String getLocation() { 81 | return location; 82 | } 83 | 84 | public String getDate() { 85 | return date; 86 | } 87 | 88 | public boolean isOnline() { 89 | return isOnline; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/model/LectureSectionObject.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.model; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | /** 7 | * Created by Danny on 2015/10/17. 8 | */ 9 | public class LectureSectionObject implements Parcelable { 10 | private String number; 11 | private String section; 12 | private String time; 13 | private String professor; 14 | private String location; 15 | private String capacity; 16 | private String total; 17 | private boolean isOnline; 18 | 19 | public LectureSectionObject(String number, String section, String time, String professor, String location, String capacity, String total, boolean isOnline) { 20 | this.number = number; 21 | this.section = section; 22 | this.time = time; 23 | this.professor = professor; 24 | this.location = location; 25 | this.capacity = capacity; 26 | this.total = total; 27 | this.isOnline = isOnline; 28 | } 29 | 30 | public LectureSectionObject() {} 31 | 32 | @Override 33 | public int describeContents() { 34 | return 0; 35 | } 36 | 37 | @Override 38 | public void writeToParcel(Parcel dest, int flags) { 39 | dest.writeString(number); 40 | dest.writeString(section); 41 | dest.writeString(time); 42 | dest.writeString(professor); 43 | dest.writeString(location); 44 | dest.writeString(capacity); 45 | dest.writeString(total); 46 | dest.writeByte((byte) (isOnline ? 1 : 0)); 47 | } 48 | 49 | public LectureSectionObject(Parcel src) { 50 | this.number = src.readString(); 51 | this.section = src.readString(); 52 | this.time = src.readString(); 53 | this.professor = src.readString(); 54 | this.location = src.readString(); 55 | this.capacity = src.readString(); 56 | this.total = src.readString(); 57 | this.isOnline = src.readByte() != 0; 58 | } 59 | 60 | public static final Creator CREATOR = new Creator() { 61 | @Override 62 | public LectureSectionObject createFromParcel(Parcel source) { 63 | return new LectureSectionObject(source); 64 | } 65 | 66 | @Override 67 | public LectureSectionObject[] newArray(int size) { 68 | return new LectureSectionObject[size]; 69 | } 70 | }; 71 | 72 | public void setNumber(String number) { 73 | this.number = number; 74 | } 75 | 76 | public void setCapacity(String capacity) { 77 | this.capacity = capacity; 78 | } 79 | 80 | public void setLocation(String location) { 81 | this.location = location; 82 | } 83 | 84 | public void setTime(String time) { 85 | this.time = time; 86 | } 87 | 88 | public void setSection(String section) { 89 | this.section = section; 90 | } 91 | 92 | public void setTotal(String total) { 93 | this.total = total; 94 | } 95 | 96 | public void setProfessor(String professor) { 97 | this.professor = professor; 98 | } 99 | 100 | public void setIsOnline(boolean isOnline) { 101 | this.isOnline = isOnline; 102 | } 103 | 104 | public String getNumber() { 105 | return number; 106 | } 107 | 108 | public String getSection() { 109 | return section; 110 | } 111 | 112 | public String getTime() { 113 | return time; 114 | } 115 | 116 | public String getProfessor() { 117 | return professor; 118 | } 119 | 120 | public String getLocation() { 121 | return location; 122 | } 123 | 124 | public String getCapacity() { 125 | return capacity; 126 | } 127 | 128 | public String getTotal() { 129 | return total; 130 | } 131 | 132 | public boolean isOnline() { 133 | return isOnline; 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/model/NavigationItem.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.model; 2 | 3 | 4 | import android.graphics.drawable.Drawable; 5 | 6 | /** 7 | * Created by poliveira on 24/10/2014. 8 | */ 9 | public class NavigationItem { 10 | private String mText; 11 | private Drawable mDrawable; 12 | 13 | public NavigationItem(String text, Drawable drawable) { 14 | mText = text; 15 | mDrawable = drawable; 16 | } 17 | 18 | public String getText() { 19 | return mText; 20 | } 21 | 22 | public void setText(String text) { 23 | mText = text; 24 | } 25 | 26 | public Drawable getDrawable() { 27 | return mDrawable; 28 | } 29 | 30 | public void setDrawable(Drawable drawable) { 31 | mDrawable = drawable; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/model/Reminder_item.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.model; 2 | 3 | import java.util.GregorianCalendar; 4 | 5 | /** 6 | * Created by Jason on 2015-06-02. 7 | */ 8 | public class Reminder_item { 9 | // variables 10 | String id; 11 | String title; 12 | String location; 13 | GregorianCalendar mClaendar; 14 | String type; 15 | 16 | // type: 17 | // "c" customized 18 | // "e" exams 19 | // "fb" facebook events 20 | // "d" important dates 21 | 22 | // constructor 23 | public Reminder_item(){ 24 | // empty 25 | } 26 | 27 | // Ctor for all 28 | public Reminder_item(String id, String title, String location, int year, int month, int day, int hour, int minute, String type){ 29 | this.id = id; 30 | this.title = title; 31 | this.location = location; 32 | this.mClaendar = new GregorianCalendar(year,month,day,hour,minute); 33 | this.type = type; 34 | } 35 | 36 | // ctor for no hout and minute 37 | public Reminder_item(String id, String title, String location, int year, int month, int day, String type){ 38 | this.id = id; 39 | this.title = title; 40 | this.location = location; 41 | this.mClaendar = new GregorianCalendar(year,month,day); 42 | this.type = type; 43 | } 44 | 45 | //Ctor for unix time 46 | public Reminder_item(String id, String title, String location, long unix_time, String type){ 47 | this.id = id; 48 | this.title = title; 49 | this.location = location; 50 | this.mClaendar = new GregorianCalendar(); 51 | this.mClaendar.setTimeInMillis(unix_time); 52 | this.type = type; 53 | } 54 | 55 | public String get_id(){ 56 | return this.id; 57 | } 58 | 59 | public String get_title(){ 60 | return this.title; 61 | } 62 | 63 | public String get_location(){ 64 | return this.location; 65 | } 66 | 67 | public long get_unix_time(){ 68 | return this.mClaendar.getTimeInMillis(); 69 | } 70 | 71 | public String get_type(){ return this.type;} 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/model/TestObject.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.model; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | /** 7 | * Created by Danny on 2015/10/17. 8 | */ 9 | public class TestObject implements Parcelable { 10 | private String section; 11 | private String time; 12 | private String location; 13 | private String capacity; 14 | private String total; 15 | 16 | public TestObject() {} 17 | 18 | @Override 19 | public int describeContents() { 20 | return 0; 21 | } 22 | 23 | @Override 24 | public void writeToParcel(Parcel dest, int flags) { 25 | dest.writeString(section); 26 | dest.writeString(time); 27 | dest.writeString(location); 28 | dest.writeString(capacity); 29 | dest.writeString(total); 30 | } 31 | 32 | public TestObject(Parcel src) { 33 | this.section = src.readString(); 34 | this.time = src.readString(); 35 | this.location = src.readString(); 36 | this.capacity = src.readString(); 37 | this.total = src.readString(); 38 | } 39 | 40 | public static final Creator CREATOR = new Creator() { 41 | @Override 42 | public TestObject createFromParcel(Parcel source) { 43 | return new TestObject(source); 44 | } 45 | 46 | @Override 47 | public TestObject[] newArray(int size) { 48 | return new TestObject[size]; 49 | } 50 | }; 51 | 52 | // Setters 53 | 54 | public void setTotal(String total) { 55 | this.total = total; 56 | } 57 | 58 | public void setSection(String section) { 59 | this.section = section; 60 | } 61 | 62 | public void setTime(String time) { 63 | this.time = time; 64 | } 65 | 66 | public void setCapacity(String capacity) { 67 | this.capacity = capacity; 68 | } 69 | 70 | public void setLocation(String location) { 71 | this.location = location; 72 | } 73 | 74 | public String getSection() { 75 | return section; 76 | } 77 | 78 | public String getTime() { 79 | return time; 80 | } 81 | 82 | public String getLocation() { 83 | return location; 84 | } 85 | 86 | public String getCapacity() { 87 | return capacity; 88 | } 89 | 90 | public String getTotal() { 91 | return total; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/model/TutorialObject.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.model; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | /** 7 | * Created by Danny on 2015/10/17. 8 | */ 9 | public class TutorialObject implements Parcelable { 10 | private String number; 11 | private String section; 12 | private String time; 13 | private String location; 14 | private String capacity; 15 | private String total; 16 | 17 | public TutorialObject() {} 18 | 19 | @Override 20 | public int describeContents() { 21 | return 0; 22 | } 23 | 24 | @Override 25 | public void writeToParcel(Parcel dest, int flags) { 26 | dest.writeString(number); 27 | dest.writeString(section); 28 | dest.writeString(time); 29 | dest.writeString(location); 30 | dest.writeString(capacity); 31 | dest.writeString(total); 32 | } 33 | 34 | public TutorialObject(Parcel src) { 35 | this.number = src.readString(); 36 | this.section = src.readString(); 37 | this.time = src.readString(); 38 | this.location = src.readString(); 39 | this.capacity = src.readString(); 40 | this.total = src.readString(); 41 | } 42 | 43 | public static final Creator CREATOR = new Creator() { 44 | @Override 45 | public TutorialObject createFromParcel(Parcel source) { 46 | return new TutorialObject(source); 47 | } 48 | 49 | @Override 50 | public TutorialObject[] newArray(int size) { 51 | return new TutorialObject[size]; 52 | } 53 | }; 54 | 55 | public void setTotal(String total) { 56 | this.total = total; 57 | } 58 | 59 | public void setSection(String section) { 60 | this.section = section; 61 | } 62 | 63 | public void setTime(String time) { 64 | this.time = time; 65 | } 66 | 67 | public void setCapacity(String capacity) { 68 | this.capacity = capacity; 69 | } 70 | 71 | public void setNumber(String number) { 72 | this.number = number; 73 | } 74 | 75 | public void setLocation(String location) { 76 | this.location = location; 77 | } 78 | 79 | public String getNumber() { 80 | return number; 81 | } 82 | 83 | public String getSection() { 84 | return section; 85 | } 86 | 87 | public String getTime() { 88 | return time; 89 | } 90 | 91 | public String getLocation() { 92 | return location; 93 | } 94 | 95 | public String getCapacity() { 96 | return capacity; 97 | } 98 | 99 | public String getTotal() { 100 | return total; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/ItemTouchHelperViewHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Paul Burke 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.YC2010.MyClass.ui; 18 | 19 | import android.support.v7.widget.helper.ItemTouchHelper; 20 | 21 | public interface ItemTouchHelperViewHolder { 22 | 23 | /** 24 | * Called when the {@link ItemTouchHelper} first registers an item as being moved or swiped. 25 | * Implementations should update the item view to indicate it's active state. 26 | */ 27 | void onItemSelected(); 28 | 29 | 30 | /** 31 | * Called when the {@link ItemTouchHelper} has completed the move or swipe, and the active item 32 | * state should be cleared. 33 | */ 34 | void onItemClear(); 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/adapters/CourseDetailPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.adapters; 2 | 3 | import android.app.Fragment; 4 | import android.app.FragmentManager; 5 | import android.content.Context; 6 | import android.os.Bundle; 7 | import android.support.v13.app.FragmentStatePagerAdapter; 8 | 9 | import com.YC2010.MyClass.R; 10 | import com.YC2010.MyClass.ui.fragments.SearchExamFragment; 11 | import com.YC2010.MyClass.ui.fragments.SearchInfoFragment; 12 | import com.YC2010.MyClass.ui.fragments.SearchScheduleFragment; 13 | 14 | /** 15 | * Created by Danny on 2015/12/25. 16 | */ 17 | public class CourseDetailPagerAdapter extends FragmentStatePagerAdapter { 18 | final int PAGE_COUNT = 3; 19 | private String tabTitle[]; 20 | private Context mContext; 21 | private Bundle mFetchedResult; 22 | 23 | public CourseDetailPagerAdapter(FragmentManager fragmentManager, Context context, Bundle bundle) { 24 | super(fragmentManager); 25 | this.mContext = context; 26 | this.mFetchedResult = bundle; 27 | this.tabTitle = new String[] { 28 | context.getResources().getString(R.string.course_tab_title1), 29 | context.getResources().getString(R.string.course_tab_title2), 30 | context.getResources().getString(R.string.course_tab_title3) 31 | }; 32 | } 33 | 34 | @Override 35 | public int getCount() { 36 | return PAGE_COUNT; 37 | } 38 | 39 | @Override 40 | public Fragment getItem(int position) { 41 | switch (position) { 42 | case 0: 43 | SearchScheduleFragment searchScheduleFragment = new SearchScheduleFragment(); 44 | searchScheduleFragment.setArguments(mFetchedResult); 45 | return searchScheduleFragment; 46 | case 1: 47 | SearchExamFragment searchExamFragment = new SearchExamFragment(); 48 | searchExamFragment.setArguments(mFetchedResult); 49 | return searchExamFragment; 50 | case 2: 51 | SearchInfoFragment searchInfoFragment = new SearchInfoFragment(); 52 | searchInfoFragment.setArguments(mFetchedResult); 53 | return searchInfoFragment; 54 | } 55 | return new Fragment(); 56 | } 57 | 58 | @Override 59 | public CharSequence getPageTitle(int position) { 60 | return tabTitle[position]; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/adapters/Course_Adapter.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.adapters; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.util.Log; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.TextView; 10 | 11 | import com.YC2010.MyClass.model.CourseInfo; 12 | import com.YC2010.MyClass.data.CoursesDBHandler; 13 | import com.YC2010.MyClass.R; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * Created by Jason on 2015-06-05. 19 | */ 20 | 21 | public class Course_Adapter extends RecyclerView.Adapter { 22 | private List mDataset; 23 | private Context mContext; 24 | private CoursesDBHandler db; 25 | // Provide a reference to the views for each data item 26 | // Complex data items may need more than one view per item, and 27 | // you provide access to all the views for a data item in a view holder 28 | public static class ViewHolder extends RecyclerView.ViewHolder{ 29 | // each data item is just a string in this case 30 | public TextView mTitle; 31 | public TextView mLocation; 32 | public TextView mSection; 33 | public TextView mTime; 34 | public ViewHolder(View v) { 35 | super(v); 36 | mTitle = (TextView) v.findViewById(R.id.TitleInCardView); 37 | mLocation = (TextView) v.findViewById(R.id.LocationInCardView); 38 | mSection = (TextView) v.findViewById(R.id.SecInCardView); 39 | mTime = (TextView) v.findViewById(R.id.TimeInCardView); 40 | //mdaysLeft = (TextView) v.findViewById(R.id.NumberofDaysLeftInCardView); 41 | //mdaysLeft_Symbol = (TextView) v.findViewById(R.id.DaysLeftInCardView); 42 | } 43 | 44 | 45 | } 46 | 47 | // Provide a suitable constructor (depends on the kind of dataset) 48 | public Course_Adapter(List myDataset, Context context) { 49 | this.mDataset = myDataset; 50 | this.mContext = context; 51 | this.db = new CoursesDBHandler(mContext); 52 | } 53 | 54 | 55 | // Create new views (invoked by the layout manager) 56 | @Override 57 | public ViewHolder onCreateViewHolder(ViewGroup parent, 58 | int viewType) { 59 | // create a new view 60 | View v = LayoutInflater.from(parent.getContext()) 61 | .inflate(R.layout.course_cardview, parent, false); 62 | 63 | // set the view's size, margins, paddings and layout parameters 64 | final ViewHolder mViewHolder = new ViewHolder(v); 65 | mViewHolder.itemView.setClickable(true); 66 | mViewHolder.itemView.setOnClickListener(new View.OnClickListener() { 67 | @Override 68 | public void onClick(View v) { 69 | Log.d("mViewHolder", "enter onclick"); 70 | } 71 | } 72 | ); 73 | return mViewHolder; 74 | } 75 | 76 | 77 | 78 | // Replace the contents of a view (invoked by the layout manager) 79 | @Override 80 | public void onBindViewHolder(ViewHolder holder, int position) { 81 | // - get element from your dataset at this position 82 | // - replace the contents of the view with that element 83 | holder.mTitle.setText(mDataset.get(position).getCourseName()); 84 | holder.mLocation.setText(mDataset.get(position).getCourseLoc()); 85 | holder.mSection.setText(mDataset.get(position).getCourseSec()); 86 | holder.mTime.setText(mDataset.get(position).getCourseTime()); 87 | } 88 | 89 | // Return the size of your dataset (invoked by the layout manager) 90 | @Override 91 | public int getItemCount() { 92 | return mDataset.size(); 93 | } 94 | 95 | @Override 96 | public void onAttachedToRecyclerView(RecyclerView recyclerView) { 97 | super.onAttachedToRecyclerView(recyclerView); 98 | } 99 | 100 | public void updateView() { 101 | Log.d("Reminder adapter ", "updating view"); 102 | CoursesDBHandler db = new CoursesDBHandler(mContext); 103 | mDataset = db.getAllCourses(mContext.getSharedPreferences("TERMS", mContext.MODE_PRIVATE).getInt("TERM_NUM", 0)); 104 | notifyDataSetChanged(); 105 | } 106 | 107 | public void removeAt(int position) { 108 | dbItemRemove(position); 109 | mDataset.remove(position); 110 | notifyItemRemoved(position); 111 | } 112 | 113 | public void dbItemRemove(int position){ 114 | String CourseNum = mDataset.get(position).getCourseNum(); 115 | Log.d("dbItemRemove", "position is " + position); 116 | db.removeCourse(CourseNum); 117 | } 118 | } -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/adapters/FinalsListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.adapters; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.BaseAdapter; 10 | import android.widget.TextView; 11 | 12 | import com.YC2010.MyClass.model.FinalObject; 13 | import com.YC2010.MyClass.utils.Constants; 14 | import com.YC2010.MyClass.R; 15 | 16 | import java.util.ArrayList; 17 | 18 | public class FinalsListAdapter extends BaseAdapter { 19 | ArrayList mArrayList; 20 | Context mContext; 21 | LayoutInflater mLayoutInflater; 22 | 23 | public FinalsListAdapter(Context context, int textViewResourceId, Bundle bundle) { 24 | mLayoutInflater = LayoutInflater.from(context); 25 | mArrayList = bundle.getParcelableArrayList(Constants.finalObjectListKey); 26 | mContext = context; 27 | Log.d("SectionListAdapter", "Course name is " + bundle.getString("courseName")); 28 | } 29 | 30 | @Override 31 | public FinalObject getItem(int i) { 32 | return mArrayList.get(i); 33 | } 34 | 35 | @Override 36 | public int getCount() { 37 | return mArrayList != null ? mArrayList.size() : 0; 38 | } 39 | 40 | @Override 41 | public long getItemId(int arg0) { 42 | return 0; 43 | } 44 | 45 | @Override 46 | public View getView(int position, View convertView, ViewGroup parent) { 47 | //Log.d("SectionListAdapter", "enter getView"); 48 | View v = convertView; 49 | 50 | v = mLayoutInflater.inflate(R.layout.section_item, null); 51 | 52 | 53 | Log.d("SectionListAdapter", "position is " + position); 54 | 55 | TextView date = (TextView) v.findViewById(R.id.section_item_capacity); 56 | TextView sec = (TextView) v.findViewById(R.id.section_item_lec); 57 | TextView loc = (TextView) v.findViewById(R.id.section_item_loc); 58 | TextView time = (TextView) v.findViewById(R.id.section_item_time); 59 | 60 | FinalObject finalInfo = getItem(position); 61 | 62 | sec.setText(finalInfo.getSection()); 63 | 64 | if (!finalInfo.isOnline()) { 65 | time.setText(finalInfo.getTime()); 66 | loc.setText(finalInfo.getLocation()); 67 | date.setText(finalInfo.getDate()); 68 | } 69 | 70 | return v; 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/adapters/ItemTouchHelperAdapter.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.adapters; 2 | 3 | /* 4 | * Copyright (C) 2015 Paul Burke 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | import android.support.v7.widget.RecyclerView; 21 | import android.support.v7.widget.helper.ItemTouchHelper; 22 | 23 | /** 24 | * Interface to listen for a move or dismissal event from a {@link ItemTouchHelper.Callback}. 25 | * 26 | * @author Paul Burke (ipaulpro) 27 | */ 28 | public interface ItemTouchHelperAdapter { 29 | 30 | /** 31 | * Called when an item has been dismissed by a swipe.
32 | *
33 | * Implementations should call {@link RecyclerView.Adapter#notifyItemRemoved(int)} after 34 | * adjusting the underlying data to reflect this removal. 35 | * 36 | * @param position The position of the item dismissed. 37 | * @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder) 38 | * @see RecyclerView.ViewHolder#getAdapterPosition() 39 | */ 40 | void onItemDismiss(int position); 41 | } -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/adapters/Reminder_Adapter.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.adapters; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.support.v7.widget.CardView; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.util.Log; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.RelativeLayout; 12 | import android.widget.TextView; 13 | 14 | import com.YC2010.MyClass.R; 15 | import com.YC2010.MyClass.data.ReminderDBHandler; 16 | import com.YC2010.MyClass.model.Reminder_item; 17 | import com.YC2010.MyClass.ui.ItemTouchHelperViewHolder; 18 | 19 | import java.util.GregorianCalendar; 20 | import java.util.List; 21 | 22 | /** 23 | * Created by Jason on 2015-06-05. 24 | */ 25 | 26 | public class Reminder_Adapter extends RecyclerView.Adapter implements ItemTouchHelperAdapter { 27 | private List mDataset; 28 | private Context mContext; 29 | private ReminderDBHandler db; 30 | 31 | 32 | // Provide a reference to the views for each data item 33 | // Complex data items may need more than one view per item, and 34 | // you provide access to all the views for a data item in a view holder 35 | public static class ViewHolder extends RecyclerView.ViewHolder implements ItemTouchHelperViewHolder { 36 | // each data item is just a string in this case 37 | public TextView mTitle; 38 | public TextView mLocation; 39 | public TextView mdaysLeft; 40 | public TextView mdaysLeft_Symbol; 41 | public CardView mcard_view; 42 | public RelativeLayout mleft_relative_Layout; 43 | public ViewHolder(View v) { 44 | super(v); 45 | mTitle = (TextView) v.findViewById(R.id.TitleInCardView); 46 | mLocation = (TextView) v.findViewById(R.id.LocationInCardView); 47 | mdaysLeft = (TextView) v.findViewById(R.id.NumberofDaysLeftInCardView); 48 | mdaysLeft_Symbol = (TextView) v.findViewById(R.id.DaysLeftInCardView); 49 | mcard_view = (CardView) v.findViewById(R.id.card_view); 50 | } 51 | 52 | @Override 53 | public void onItemSelected() { 54 | itemView.setBackgroundColor(Color.LTGRAY); 55 | } 56 | 57 | @Override 58 | public void onItemClear() { 59 | itemView.setBackgroundColor(0); 60 | } 61 | 62 | } 63 | 64 | // Provide a suitable constructor (depends on the kind of dataset) 65 | public Reminder_Adapter(List myDataset, Context context) { 66 | this.mDataset = myDataset; 67 | this.mContext = context; 68 | this.db = new ReminderDBHandler(mContext); 69 | } 70 | 71 | 72 | // Create new views (invoked by the layout manager) 73 | @Override 74 | public ViewHolder onCreateViewHolder(ViewGroup parent, 75 | int viewType) { 76 | // create a new view 77 | View v = LayoutInflater.from(parent.getContext()) 78 | .inflate(R.layout.reminderitem_cardview, parent, false); 79 | // set the view's size, margins, paddings and layout parameters 80 | final ViewHolder mViewHolder = new ViewHolder(v); 81 | mViewHolder.itemView.setClickable(true); 82 | mViewHolder.itemView.setOnClickListener(new View.OnClickListener() { 83 | @Override 84 | public void onClick(View v) { 85 | Log.d("mViewHolder", "enter onclick"); 86 | } 87 | } 88 | ); 89 | return mViewHolder; 90 | } 91 | 92 | 93 | 94 | // Replace the contents of a view (invoked by the layout manager) 95 | @Override 96 | public void onBindViewHolder(final ViewHolder holder, int position) { 97 | // - get element from your dataset at this position 98 | // - replace the contents of the view with that element 99 | holder.mTitle.setText(mDataset.get(position).get_title()); 100 | holder.mLocation.setText(mDataset.get(position).get_location()); 101 | long event_time = mDataset.get(position).get_unix_time(); 102 | long now_time = GregorianCalendar.getInstance().getTime().getTime(); 103 | long days_left = (event_time - now_time)/1000/60/60/24; 104 | 105 | if(days_left < 2){ 106 | holder.mdaysLeft_Symbol.setText("Day Left"); 107 | holder.mdaysLeft.setTextColor(mContext.getResources().getColor(R.color.fab_color_1)); 108 | } 109 | holder.mdaysLeft.setText(Long.toString(days_left)); 110 | 111 | 112 | 113 | //Log.d("onBindViewHolder", "event_time is : " + event_time); 114 | //Log.d("onBindViewHolder", "now_time is : " + now_time); 115 | //Log.d("onBindViewHolder", "now_time is : " + now_time); 116 | } 117 | 118 | // Return the size of your dataset (invoked by the layout manager) 119 | @Override 120 | public int getItemCount() { 121 | return mDataset.size(); 122 | } 123 | 124 | @Override 125 | public void onAttachedToRecyclerView(RecyclerView recyclerView) { 126 | super.onAttachedToRecyclerView(recyclerView); 127 | } 128 | 129 | public void updateView() { 130 | Log.d("Reminder adapter ", "updating view"); 131 | ReminderDBHandler db = new ReminderDBHandler(mContext); 132 | mDataset = db.getAllReminders(); 133 | notifyDataSetChanged(); 134 | } 135 | 136 | public void removeAt(int position) { 137 | dbItemRemove(position); 138 | mDataset.remove(position); 139 | notifyItemRemoved(position); 140 | } 141 | 142 | public void dbItemRemove(int position){ 143 | String mUUID_string = mDataset.get(position).get_id(); 144 | Log.d("dbItemRemove", "position is " + position); 145 | db.removeReminder(mUUID_string); 146 | } 147 | 148 | 149 | @Override 150 | public void onItemDismiss(int position) { 151 | dbItemRemove(position); 152 | mDataset.remove(position); 153 | notifyItemRemoved(position); 154 | } 155 | } -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/adapters/SectionListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.adapters; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.BaseAdapter; 10 | import android.widget.RelativeLayout; 11 | import android.widget.TextView; 12 | 13 | import com.YC2010.MyClass.model.LectureSectionObject; 14 | import com.YC2010.MyClass.utils.Constants; 15 | import com.YC2010.MyClass.R; 16 | 17 | import java.util.ArrayList; 18 | 19 | public class SectionListAdapter extends BaseAdapter { 20 | ArrayList mArrayList; 21 | Context mContext; 22 | LayoutInflater mLayoutInflater; 23 | 24 | public SectionListAdapter(Context context, int textViewResourceId, Bundle bundle) { 25 | mLayoutInflater = LayoutInflater.from(context); 26 | mArrayList = bundle.getParcelableArrayList(Constants.lectureSectionObjectListKey); 27 | mContext = context; 28 | Log.d("SectionListAdapter", "Course name is " + bundle.getString("courseName")); 29 | } 30 | 31 | @Override 32 | public LectureSectionObject getItem(int i) { 33 | return mArrayList.get(i); 34 | } 35 | 36 | @Override 37 | public int getCount() { 38 | return mArrayList != null ? mArrayList.size() : 0; 39 | } 40 | 41 | @Override 42 | public long getItemId(int arg0) { 43 | return 0; 44 | } 45 | 46 | @Override 47 | public View getView(int position, View convertView, ViewGroup parent) { 48 | 49 | View v = mLayoutInflater.inflate(R.layout.section_item, null); 50 | 51 | TextView capacity = (TextView) v.findViewById(R.id.section_item_capacity); 52 | TextView lec = (TextView) v.findViewById(R.id.section_item_lec); 53 | TextView loc = (TextView) v.findViewById(R.id.section_item_loc); 54 | TextView time = (TextView) v.findViewById(R.id.section_item_time); 55 | TextView prof = (TextView) v.findViewById(R.id.section_item_prof); 56 | RelativeLayout section_item_prof_layout = (RelativeLayout) v.findViewById((R.id.section_item_prof_layout)); 57 | 58 | LectureSectionObject sectionInfo = getItem(position); 59 | String professor = sectionInfo.getProfessor(); 60 | 61 | if (professor != null && professor.length() > 0) { 62 | prof.setText(professor); 63 | prof.setVisibility(View.VISIBLE); 64 | section_item_prof_layout.setVisibility(View.VISIBLE); 65 | } else { 66 | prof.setVisibility(View.GONE); 67 | } 68 | 69 | lec.setText(sectionInfo.getSection()); 70 | time.setText(sectionInfo.getTime()); 71 | loc.setText(sectionInfo.getLocation()); 72 | 73 | int enroll_total = Integer.parseInt(sectionInfo.getTotal()); 74 | int enroll_cap = Integer.parseInt(sectionInfo.getCapacity()); 75 | 76 | if (enroll_total/enroll_cap >= 1) { 77 | capacity.setTextColor(mContext.getResources().getColor(R.color.fab_color_1)); 78 | } else { 79 | capacity.setTextColor(mContext.getResources().getColor(R.color.light_green)); 80 | } 81 | 82 | Log.d("SectionListAdapter", "rate is " + enroll_total/enroll_cap); 83 | 84 | capacity.setText(enroll_total + "/" + enroll_cap); 85 | 86 | return v; 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/adapters/TstListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.adapters; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.BaseAdapter; 10 | import android.widget.TextView; 11 | 12 | import com.YC2010.MyClass.utils.Constants; 13 | import com.YC2010.MyClass.model.TestObject; 14 | import com.YC2010.MyClass.R; 15 | 16 | import java.util.ArrayList; 17 | 18 | public class TstListAdapter extends BaseAdapter { 19 | ArrayList mArrayList; 20 | Context mContext; 21 | LayoutInflater mLayoutInflater; 22 | 23 | public TstListAdapter(Context context, int textViewResourceId, Bundle bundle) { 24 | mLayoutInflater = LayoutInflater.from(context); 25 | mArrayList = bundle.getParcelableArrayList(Constants.testObjectListKey); 26 | mContext = context; 27 | Log.d("SectionListAdapter", "Course name is " + bundle.getString("courseName")); 28 | } 29 | 30 | 31 | @Override 32 | public TestObject getItem(int i) { 33 | return mArrayList.get(i); 34 | } 35 | 36 | @Override 37 | public int getCount() { 38 | return mArrayList != null ? mArrayList.size() : 0; 39 | } 40 | 41 | @Override 42 | public long getItemId(int arg0) { 43 | return 0; 44 | } 45 | 46 | 47 | @Override 48 | public View getView(int position, View convertView, ViewGroup parent) { 49 | //Log.d("SectionListAdapter", "enter getView"); 50 | View v = convertView; 51 | 52 | v = mLayoutInflater.inflate(R.layout.section_item, null); 53 | 54 | Log.d("SectionListAdapter", "position is " + position); 55 | 56 | TextView capacity = (TextView) v.findViewById(R.id.section_item_capacity); 57 | TextView lec = (TextView) v.findViewById(R.id.section_item_lec); 58 | TextView loc = (TextView) v.findViewById(R.id.section_item_loc); 59 | TextView time = (TextView) v.findViewById(R.id.section_item_time); 60 | TextView prof = (TextView) v.findViewById(R.id.section_item_prof); 61 | 62 | loc.setVisibility(View.GONE); 63 | prof.setVisibility(View.GONE); 64 | 65 | TestObject testInfo = getItem(position); 66 | 67 | lec.setText(testInfo.getSection()); 68 | time.setText(testInfo.getTime()); 69 | //prof.setText(mBundle.getStringArrayList("LEC_PROF").get(position)); 70 | //loc.setText(mBundle.getStringArrayList("LEC_LOC").get(position)); 71 | 72 | capacity.setText(testInfo.getTotal() + "/" + testInfo.getCapacity()); 73 | 74 | return v; 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/adapters/TutListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.adapters; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.BaseAdapter; 10 | import android.widget.TextView; 11 | 12 | import com.YC2010.MyClass.model.TutorialObject; 13 | import com.YC2010.MyClass.utils.Constants; 14 | import com.YC2010.MyClass.R; 15 | 16 | import java.util.ArrayList; 17 | 18 | public class TutListAdapter extends BaseAdapter { 19 | ArrayList mArrayList; 20 | Context mContext; 21 | LayoutInflater mLayoutInflater; 22 | 23 | public TutListAdapter(Context context, int textViewResourceId, Bundle bundle) { 24 | mLayoutInflater = LayoutInflater.from(context); 25 | mArrayList = bundle.getParcelableArrayList(Constants.tutorialObjectListKey); 26 | mContext = context; 27 | Log.d("SectionListAdapter", "Course name is " + bundle.getString("courseName")); 28 | } 29 | 30 | 31 | @Override 32 | public TutorialObject getItem(int i) { 33 | return mArrayList.get(i); 34 | } 35 | 36 | @Override 37 | public int getCount() { 38 | return mArrayList != null ? mArrayList.size() : 0; 39 | } 40 | 41 | @Override 42 | public long getItemId(int arg0) { 43 | return 0; 44 | } 45 | 46 | @Override 47 | public View getView(int position, View convertView, ViewGroup parent) { 48 | //Log.d("SectionListAdapter", "enter getView"); 49 | View v = convertView; 50 | 51 | v = mLayoutInflater.inflate(R.layout.section_item, null); 52 | 53 | 54 | Log.d("SectionListAdapter", "position is " + position); 55 | 56 | TextView capacity = (TextView) v.findViewById(R.id.section_item_capacity); 57 | TextView lec = (TextView) v.findViewById(R.id.section_item_lec); 58 | TextView loc = (TextView) v.findViewById(R.id.section_item_loc); 59 | TextView time = (TextView) v.findViewById(R.id.section_item_time); 60 | 61 | TutorialObject tutorialInfo = getItem(position); 62 | 63 | lec.setText(tutorialInfo.getSection()); 64 | time.setText(tutorialInfo.getTime()); 65 | loc.setText(tutorialInfo.getLocation()); 66 | 67 | int enroll_total = Integer.parseInt(tutorialInfo.getTotal()); 68 | int enroll_cap = Integer.parseInt(tutorialInfo.getCapacity()); 69 | 70 | if(enroll_total/enroll_cap >= 1) 71 | capacity.setTextColor(mContext.getResources().getColor(R.color.fab_color_1)); 72 | else 73 | capacity.setTextColor(mContext.getResources().getColor(R.color.light_green)); 74 | capacity.setText(enroll_total + "/" + enroll_cap); 75 | 76 | return v; 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/controls/FABScrollBehavior.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.controls; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.*; 5 | import android.support.v4.view.ViewCompat; 6 | import android.util.AttributeSet; 7 | import android.view.View; 8 | 9 | /** 10 | * Created by Danny on 2015/12/26. 11 | */ 12 | public class FABScrollBehavior extends FloatingActionButton.Behavior { 13 | 14 | public FABScrollBehavior(Context context, AttributeSet attrs) { 15 | super(); 16 | } 17 | 18 | @Override 19 | public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, 20 | final View directTargetChild, final View target, final int nestedScrollAxes) { 21 | // Ensure we react to vertical scrolling 22 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL 23 | || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes); 24 | } 25 | 26 | @Override 27 | public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, 28 | View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { 29 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, 30 | dyUnconsumed); 31 | 32 | if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { 33 | child.hide(); 34 | } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { 35 | child.show(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/fragments/CatalogNumFragment.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.fragments; 2 | 3 | import android.app.ListFragment; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AlertDialog; 6 | import android.util.Log; 7 | import android.view.View; 8 | import android.widget.ArrayAdapter; 9 | import android.widget.ListView; 10 | import android.widget.Toast; 11 | 12 | import com.YC2010.MyClass.callbacks.AsyncTaskCallbackInterface; 13 | import com.YC2010.MyClass.data.fetchtasks.CatalogNumFetchTask; 14 | import com.YC2010.MyClass.R; 15 | 16 | import java.util.ArrayList; 17 | 18 | /** 19 | * A fragment representing a list of Items. 20 | *

21 | *

22 | * Activities containing this fragment MUST implement the {@link OnFragmentInteractionListener} 23 | * interface. 24 | */ 25 | public class CatalogNumFragment extends ListFragment { 26 | 27 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER 28 | private static final String ARG_SUBJECT = "SUBJECT"; 29 | 30 | // TODO: Rename and change types of parameters 31 | private String mParam1; 32 | private String mParam2; 33 | private String mSubject; 34 | 35 | ArrayList mCatalogNum_arraylist; 36 | AlertDialog.Builder mBuilder; 37 | 38 | private OnFragmentInteractionListener mListener; 39 | 40 | // TODO: Rename and change types of parameters 41 | /*public static CatalogNumFragment newInstance(String param1, String param2) { 42 | CatalogNumFragment fragment = new CatalogNumFragment(); 43 | Bundle args = new Bundle(); 44 | args.putString(ARG_PARAM1, param1); 45 | args.putString(ARG_PARAM2, param2); 46 | fragment.setArguments(args); 47 | return fragment; 48 | }*/ 49 | 50 | public CatalogNumFragment(){ 51 | } 52 | 53 | /** 54 | * Mandatory empty constructor for the fragment manager to instantiate the 55 | * fragment (e.g. upon screen orientation changes). 56 | */ 57 | public void setSubject(String subject) { 58 | mSubject = subject; 59 | } 60 | 61 | 62 | @Override 63 | public void onCreate(Bundle savedInstanceState) { 64 | super.onCreate(savedInstanceState); 65 | 66 | String subject = getArguments().getString(ARG_SUBJECT); 67 | if(subject == null) 68 | Toast.makeText(getActivity(), "subject string not found", Toast.LENGTH_SHORT).show(); 69 | mSubject = subject; 70 | 71 | final CatalogNumFetchTask catalogNumFetchTask = new CatalogNumFetchTask(mSubject, new AsyncTaskCallbackInterface() { 72 | @Override 73 | public void onOperationComplete(Bundle bundle) { 74 | mCatalogNum_arraylist = bundle.getStringArrayList("CatalogNum_arraylist"); 75 | if(mCatalogNum_arraylist.size() == 0) { 76 | mBuilder = new AlertDialog.Builder(getActivity()); 77 | mBuilder.setMessage("Courses not available"); 78 | mBuilder.setPositiveButton("OK", null); 79 | mBuilder.create().show(); 80 | 81 | // should pop the fragment actually 82 | getFragmentManager().beginTransaction() 83 | .replace(R.id.container, new SubjectsFragment()) 84 | .addToBackStack("2") 85 | .commit(); 86 | Log.d("SubjectFragment", "dialog is shown"); 87 | } 88 | else { 89 | Log.d("SubjectFragment", "going to set up the list"); 90 | setListAdapter(new ArrayAdapter<>(getActivity(), 91 | R.layout.fragment_select_item, R.id.select_list_text, mCatalogNum_arraylist)); 92 | } 93 | } 94 | }); 95 | catalogNumFetchTask.execute(); 96 | 97 | 98 | //ArrayList Subject_arraylist = subjectFetchTask.getSubject_arraylist(); 99 | //ArrayList Description_arraylist = subjectFetchTask.getDescription_arraylist(); 100 | //Log.d("SubjectFragment", "Subject_arraylist 0 is " + Subject_arraylist.get(0)); 101 | } 102 | 103 | 104 | /*@Override 105 | public void onAttach(Activity activity) { 106 | super.onAttach(activity); 107 | try { 108 | mListener = (OnFragmentInteractionListener) activity; 109 | } catch (ClassCastException e) { 110 | throw new ClassCastException(activity.toString() 111 | + " must implement OnFragmentInteractionListener"); 112 | } 113 | }*/ 114 | 115 | @Override 116 | public void onDetach() { 117 | super.onDetach(); 118 | mListener = null; 119 | } 120 | 121 | @Override 122 | public void onListItemClick(ListView l, View v, int position, long id) { 123 | super.onListItemClick(l, v, position, id); 124 | Log.d("CatalogNumFragment", "item click: " + mCatalogNum_arraylist.get(position)); 125 | 126 | SearchFragment mSearchFragment = new SearchFragment(); 127 | Bundle args = new Bundle(); 128 | String course_name = mCatalogNum_arraylist.get(position); 129 | args.putString("COURSE", course_name); 130 | mSearchFragment.setArguments(args); 131 | getFragmentManager().beginTransaction() 132 | .replace(R.id.container, mSearchFragment) 133 | .addToBackStack("7") 134 | .commit(); 135 | } 136 | 137 | /** 138 | * This interface must be implemented by activities that contain this 139 | * fragment to allow an interaction in this fragment to be communicated 140 | * to the activity and potentially other fragments contained in that 141 | * activity. 142 | *

143 | * See the Android Training lesson Communicating with Other Fragments for more information. 146 | */ 147 | public interface OnFragmentInteractionListener { 148 | // TODO: Update argument type and name 149 | public void onFragmentInteraction(String id); 150 | } 151 | 152 | } 153 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/fragments/CoursesFragment.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.fragments; 2 | 3 | import android.app.AlertDialog; 4 | import android.app.Fragment; 5 | import android.content.Context; 6 | import android.content.DialogInterface; 7 | import android.os.Bundle; 8 | import android.os.Handler; 9 | import android.os.Vibrator; 10 | import android.support.design.widget.Snackbar; 11 | import android.support.v7.widget.LinearLayoutManager; 12 | import android.support.v7.widget.RecyclerView; 13 | import android.util.Log; 14 | import android.view.GestureDetector; 15 | import android.view.LayoutInflater; 16 | import android.view.MotionEvent; 17 | import android.view.View; 18 | import android.view.ViewGroup; 19 | 20 | import com.YC2010.MyClass.model.CourseInfo; 21 | import com.YC2010.MyClass.ui.adapters.Course_Adapter; 22 | import com.YC2010.MyClass.data.CoursesDBHandler; 23 | import com.YC2010.MyClass.R; 24 | 25 | import java.util.List; 26 | 27 | /** 28 | * Created by Jason on 2015-05-25. 29 | */ 30 | public class CoursesFragment extends Fragment { 31 | private RecyclerView mRecyclerView; 32 | private RecyclerView.Adapter mAdapter; 33 | private RecyclerView.LayoutManager mLayoutManager; 34 | 35 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER 36 | private static final String ARG_COURSE = "COURSE"; 37 | 38 | 39 | @Override 40 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 41 | Bundle savedInstanceState) { 42 | 43 | 44 | // Inflate the layout for this fragment 45 | View rootView = inflater.inflate(R.layout.fragment_courses, container, false); 46 | 47 | // RecyclerView: 48 | mRecyclerView = (RecyclerView) rootView.findViewById(R.id.courses_recycler_view); 49 | 50 | // use this setting to improve performance if you know that changes 51 | // in content do not change the layout size of the RecyclerView 52 | mRecyclerView.setHasFixedSize(true); 53 | 54 | // use a linear layout manager 55 | mLayoutManager = new LinearLayoutManager(getActivity()); 56 | mRecyclerView.setLayoutManager(mLayoutManager); 57 | 58 | // get Courses from db 59 | CoursesDBHandler db = new CoursesDBHandler(getActivity()); 60 | final List myDataset = db.getAllCourses(getActivity().getSharedPreferences("TERMS", getActivity().MODE_PRIVATE).getInt("TERM_NUM", 0)); 61 | 62 | 63 | // specify an adapter (see also next example) 64 | mAdapter = new Course_Adapter(myDataset, getActivity()); 65 | 66 | mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { 67 | @Override 68 | public void onChanged() { 69 | super.onChanged(); 70 | Log.d("CoursesFragment", "Data set changed"); 71 | } 72 | }); 73 | 74 | mRecyclerView.addOnItemTouchListener(new RecyclerTouchListener(getActivity(), mRecyclerView, new ClickListener() { 75 | @Override 76 | public void onClick(View view, final int position) { 77 | SearchFragment mSearchFragment = new SearchFragment(); 78 | Bundle args = new Bundle(); 79 | String course_name = myDataset.get(position).getCourseName(); 80 | args.putString(ARG_COURSE, course_name); 81 | mSearchFragment.setArguments(args); 82 | getFragmentManager().beginTransaction() 83 | .replace(R.id.container, mSearchFragment) 84 | .addToBackStack("7") 85 | .commit(); 86 | } 87 | 88 | @Override 89 | public void onLongClick(final View view, final int position) { 90 | Log.d("mRecyclerView", "enter onlongclick"); 91 | // vibrate 92 | Vibrator v = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE); 93 | v.vibrate(10); 94 | 95 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); 96 | builder.setTitle("Delete this Course?"); 97 | 98 | builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { 99 | @Override 100 | public void onClick(DialogInterface dialogInterface, int i) { 101 | 102 | RecyclerView recyclerView = (RecyclerView) getActivity().findViewById(R.id.courses_recycler_view); 103 | Course_Adapter adapter = (Course_Adapter) recyclerView.getAdapter(); 104 | adapter.removeAt(position); 105 | 106 | // show snackBar 107 | Snackbar.make(view, "Course Removed", Snackbar.LENGTH_SHORT) 108 | .show(); 109 | 110 | } 111 | }); 112 | builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { 113 | @Override 114 | public void onClick(DialogInterface dialogInterface, int i) { 115 | // nothing 116 | } 117 | }); 118 | AlertDialog confirmation = builder.create(); 119 | 120 | confirmation.show(); 121 | confirmation.getButton(confirmation.BUTTON_NEGATIVE).setTextColor(getResources().getColor(R.color.myPrimaryColor)); 122 | confirmation.getButton(confirmation.BUTTON_POSITIVE).setTextColor(getResources().getColor(R.color.myPrimaryColor)); 123 | } 124 | })); 125 | 126 | mRecyclerView.setAdapter(mAdapter); 127 | return rootView; 128 | } 129 | 130 | public static interface ClickListener { 131 | void onClick(View view, int position); 132 | 133 | void onLongClick(View view, int position); 134 | } 135 | 136 | static class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { 137 | 138 | private GestureDetector gestureDetector; 139 | private ClickListener clickListener; 140 | 141 | public RecyclerTouchListener(Context context, final RecyclerView recyclerView, final ClickListener clickListener) { 142 | this.clickListener = clickListener; 143 | gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { 144 | @Override 145 | public boolean onSingleTapUp(MotionEvent e) { 146 | return true; 147 | } 148 | 149 | @Override 150 | public void onLongPress(MotionEvent e) { 151 | View child = recyclerView.findChildViewUnder(e.getX(), e.getY()); 152 | if (child != null && clickListener != null) { 153 | clickListener.onLongClick(child, recyclerView.getChildLayoutPosition(child)); 154 | } 155 | } 156 | }); 157 | } 158 | 159 | @Override 160 | public boolean onInterceptTouchEvent(final RecyclerView rv, MotionEvent e) { 161 | 162 | final View child = rv.findChildViewUnder(e.getX(), e.getY()); 163 | if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) { 164 | //Log.d("onInterceptTouchEvent", "before delay"); 165 | // delay 100ms for displaying ripple effect 166 | Handler handler = new Handler(); 167 | handler.postDelayed(new Runnable() { 168 | public void run() { 169 | //write the code here which you want to run after 500 milliseconds 170 | //Log.d("onInterceptTouchEvent", "delayed"); 171 | clickListener.onClick(child, rv.getChildLayoutPosition(child)); 172 | } 173 | }, 100); 174 | } 175 | 176 | return false; 177 | } 178 | 179 | @Override 180 | public void onTouchEvent(RecyclerView rv, MotionEvent e) { 181 | } 182 | 183 | @Override 184 | public void onRequestDisallowInterceptTouchEvent(boolean bool) { 185 | } 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/fragments/SearchExamFragment.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.fragments; 2 | 3 | import android.app.Activity; 4 | import android.app.Fragment; 5 | import android.content.res.TypedArray; 6 | import android.graphics.drawable.Drawable; 7 | import android.os.Bundle; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.LinearLayout; 12 | import android.widget.TextView; 13 | 14 | import com.YC2010.MyClass.R; 15 | import com.YC2010.MyClass.ui.adapters.FinalsListAdapter; 16 | 17 | /** 18 | * Created by Danny on 2015/12/26. 19 | */ 20 | public class SearchExamFragment extends Fragment { 21 | private Activity mActivity; 22 | private View mView; 23 | private Bundle mFetchedResult; 24 | 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | this.mActivity = getActivity(); 29 | this.mFetchedResult = this.getArguments(); 30 | } 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | mView = inflater.inflate(R.layout.fragment_search_exam, container, false); 36 | 37 | if (mFetchedResult.getBoolean("has_finals", false)) { 38 | TextView finals = (TextView) mView.findViewById(R.id.final_exams); 39 | if (finals != null) { 40 | finals.setVisibility(View.VISIBLE); 41 | } 42 | updateView(); 43 | } 44 | 45 | return mView; 46 | } 47 | 48 | public void updateView() { 49 | // get default divider 50 | int[] attrs = {android.R.attr.listDivider}; 51 | TypedArray ta = mActivity.obtainStyledAttributes(attrs); 52 | Drawable divider = ta.getDrawable(0); 53 | ta.recycle(); 54 | 55 | LinearLayout mFinalLinearLayout = (LinearLayout) mView.findViewById(R.id.finals_list); 56 | FinalsListAdapter FinalsAdapter = new FinalsListAdapter(mActivity, R.layout.section_item, mFetchedResult); 57 | for (int i = 0; i < FinalsAdapter.getCount(); i++) { 58 | View view = FinalsAdapter.getView(i, null, mFinalLinearLayout); 59 | mFinalLinearLayout.addView(view); 60 | mFinalLinearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE | LinearLayout.SHOW_DIVIDER_BEGINNING); 61 | mFinalLinearLayout.setDividerDrawable(divider); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/fragments/SearchFragment.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.fragments; 2 | 3 | import android.app.Activity; 4 | import android.app.Fragment; 5 | import android.app.ProgressDialog; 6 | import android.os.Bundle; 7 | import android.support.design.widget.TabLayout; 8 | import android.support.v4.view.ViewPager; 9 | import android.support.v7.app.ActionBar; 10 | import android.support.v7.app.AppCompatActivity; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.widget.Button; 15 | import android.widget.ImageView; 16 | import android.widget.LinearLayout; 17 | import android.widget.TextView; 18 | import android.widget.Toast; 19 | 20 | import com.YC2010.MyClass.data.Connections; 21 | import com.YC2010.MyClass.ui.adapters.CourseDetailPagerAdapter; 22 | import com.YC2010.MyClass.data.fetchtasks.SearchFetchTask; 23 | import com.YC2010.MyClass.callbacks.AsyncTaskCallbackInterface; 24 | import com.YC2010.MyClass.R; 25 | 26 | 27 | /** 28 | * Created by Danny on 2015/6/27. 29 | */ 30 | public class SearchFragment extends Fragment { 31 | private String mCourse; 32 | private Activity mActivity; 33 | private View mView; 34 | private float defaultElevation; 35 | private ProgressDialog mProgDialog; 36 | 37 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER 38 | private static final String ARG_COURSE = "COURSE"; 39 | 40 | public SearchFragment() { 41 | } 42 | 43 | @Override 44 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 45 | Bundle savedInstanceState) { 46 | if (mView == null) { 47 | mView = inflater.inflate(R.layout.fragment_search, container, false); 48 | generateView(); 49 | } 50 | 51 | return mView; 52 | } 53 | 54 | 55 | @Override 56 | public void onCreate(Bundle savedInstanceState) { 57 | super.onCreate(savedInstanceState); 58 | String course = getArguments().getString(ARG_COURSE); 59 | mCourse = course; 60 | mActivity = getActivity(); 61 | 62 | if (course == null) { 63 | Toast.makeText(mActivity, "course string not found", Toast.LENGTH_SHORT).show(); 64 | } 65 | } 66 | 67 | @Override 68 | public void onResume() { 69 | super.onResume(); 70 | // Remove the shadow between the action bar and the tabs 71 | ActionBar actionBar = ((AppCompatActivity) mActivity).getSupportActionBar(); 72 | if (actionBar != null) { 73 | defaultElevation = actionBar.getElevation(); 74 | actionBar.setElevation(0); 75 | } 76 | } 77 | 78 | @Override 79 | public void onStop() { 80 | super.onStop(); 81 | 82 | // Restore the shadow in the action bar 83 | ActionBar actionBar = ((AppCompatActivity) mActivity).getSupportActionBar(); 84 | if (actionBar != null) { 85 | actionBar.setElevation(defaultElevation); 86 | } 87 | } 88 | 89 | private void setupTabs(Bundle bundle) { 90 | ViewPager viewPager = (ViewPager) mView.findViewById(R.id.viewpager); 91 | viewPager.setAdapter(new CourseDetailPagerAdapter(mActivity.getFragmentManager(), mActivity, bundle)); 92 | 93 | TabLayout tabLayout = (TabLayout) mView.findViewById(R.id.sliding_tabs); 94 | tabLayout.setupWithViewPager(viewPager); 95 | tabLayout.setVisibility(View.VISIBLE); 96 | } 97 | 98 | private void showErrorMessage(ErrorState errorState) { 99 | final LinearLayout errorView = (LinearLayout) mView.findViewById(R.id.error_view_layout); 100 | TextView errorMessage = (TextView) mView.findViewById(R.id.error_view_message); 101 | ImageView errorIcon = (ImageView) mView.findViewById(R.id.error_view_icon); 102 | Button errorButton = (Button) mView.findViewById(R.id.error_view_button); 103 | 104 | switch (errorState) { 105 | case Network: 106 | errorMessage.setText(mActivity.getString(R.string.error_message_network)); 107 | errorIcon.setImageResource(R.drawable.ic_cloud_off_black_36dp); 108 | errorButton.setOnClickListener(new View.OnClickListener() { 109 | @Override 110 | public void onClick(View v) { 111 | errorView.setVisibility(View.GONE); 112 | generateView(); 113 | } 114 | }); 115 | break; 116 | case CourseNotFound: 117 | errorMessage.setText(mActivity.getString(R.string.error_message_course)); 118 | errorIcon.setImageResource(R.drawable.ic_report_black_36dp); 119 | errorButton.setVisibility(View.GONE); 120 | break; 121 | } 122 | 123 | errorView.setVisibility(View.VISIBLE); 124 | } 125 | 126 | private void generateView() { 127 | showProgressDialog(); 128 | 129 | if (!Connections.isNetworkAvailable(mActivity)) { 130 | mProgDialog.dismiss(); 131 | showErrorMessage(ErrorState.Network); 132 | } else { 133 | SearchFetchTask searchFetchTask = new SearchFetchTask(mActivity, new AsyncTaskCallbackInterface() { 134 | @Override 135 | public void onOperationComplete(Bundle bundle) { 136 | if (bundle != null && bundle.getBoolean("valid_return")) { 137 | setupTabs(bundle); 138 | LinearLayout searchLayout = (LinearLayout) mView.findViewById(R.id.search_detail_layout); 139 | searchLayout.setVisibility(View.VISIBLE); 140 | } else { 141 | showErrorMessage(ErrorState.CourseNotFound); 142 | } 143 | mProgDialog.dismiss(); 144 | } 145 | }); 146 | searchFetchTask.execute(mCourse); 147 | } 148 | } 149 | 150 | private void showProgressDialog() { 151 | if (mProgDialog == null) { 152 | mProgDialog = new ProgressDialog(mActivity); 153 | mProgDialog.setMessage("Loading..."); 154 | mProgDialog.setCanceledOnTouchOutside(false); 155 | mProgDialog.setIndeterminate(false); 156 | mProgDialog.setCancelable(false); 157 | mProgDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 158 | } 159 | 160 | mProgDialog.show(); 161 | } 162 | } 163 | 164 | enum ErrorState { 165 | Network, CourseNotFound 166 | } -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/fragments/SearchInfoFragment.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.fragments; 2 | 3 | import android.app.Activity; 4 | import android.app.Fragment; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.TextView; 10 | 11 | import com.YC2010.MyClass.R; 12 | 13 | /** 14 | * Created by Danny on 2015/12/25. 15 | */ 16 | public class SearchInfoFragment extends Fragment { 17 | private Activity mActivity; 18 | private View mView; 19 | private Bundle mFetchedResult; 20 | 21 | @Override 22 | public void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | this.mActivity = getActivity(); 25 | this.mFetchedResult = this.getArguments(); 26 | } 27 | 28 | @Override 29 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 30 | Bundle savedInstanceState) { 31 | mView = inflater.inflate(R.layout.fragment_search_info, container, false); 32 | updateView(); 33 | 34 | return mView; 35 | } 36 | 37 | public void updateView() { 38 | TextView title = (TextView) mView.findViewById(R.id.title); 39 | TextView description = (TextView) mView.findViewById(R.id.description); 40 | 41 | TextView prerequisites = (TextView) mView.findViewById(R.id.preReq); 42 | TextView antirequisites = (TextView) mView.findViewById(R.id.antiReq); 43 | TextView prerequisitesLabel = (TextView) mView.findViewById(R.id.preReqLabel); 44 | TextView antirequisitesLabel = (TextView) mView.findViewById(R.id.antiReqLabel); 45 | 46 | title.setText(mFetchedResult.getString("title")); 47 | description.setText(mFetchedResult.getString("description")); 48 | 49 | String prerequisitesText = mFetchedResult.getString("prerequisites"); 50 | String antirequisitesText = mFetchedResult.getString("antirequisites"); 51 | 52 | if (prerequisitesText != null && prerequisitesText.length() > 0) { 53 | prerequisites.setText(prerequisitesText); 54 | prerequisites.setVisibility(View.VISIBLE); 55 | prerequisitesLabel.setVisibility(View.VISIBLE); 56 | } 57 | 58 | if (antirequisitesText != null && antirequisitesText.length() > 0) { 59 | antirequisites.setText(antirequisitesText); 60 | antirequisites.setVisibility(View.VISIBLE); 61 | antirequisitesLabel.setVisibility(View.VISIBLE); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/fragments/SettingFragment.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.fragments; 2 | 3 | import android.app.Activity; 4 | import android.content.DialogInterface; 5 | import android.net.Uri; 6 | import android.os.Bundle; 7 | import android.preference.Preference; 8 | import android.preference.PreferenceFragment; 9 | import android.support.design.widget.Snackbar; 10 | import android.support.v7.app.AlertDialog; 11 | 12 | import com.YC2010.MyClass.utils.Constants; 13 | import com.YC2010.MyClass.data.CoursesDBHandler; 14 | import com.YC2010.MyClass.R; 15 | import com.YC2010.MyClass.data.ReminderDBHandler; 16 | import com.YC2010.MyClass.model.Reminder_item; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * Created by Jason on 2015-05-26. 22 | */ 23 | 24 | public class SettingFragment extends PreferenceFragment { 25 | private OnFragmentInteractionListener mListener; 26 | 27 | public SettingFragment() {} 28 | 29 | @Override 30 | public void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | 33 | addPreferencesFromResource(R.xml.preferences); 34 | 35 | Preference clean_reminder_pref = (Preference) findPreference("pref_key_clean_reminder_db"); 36 | clean_reminder_pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 37 | public boolean onPreferenceClick(Preference preference) { 38 | //open browser or intent here 39 | // should show an alert dialog 40 | ReminderDBHandler reminder_db = new ReminderDBHandler(getActivity()); 41 | reminder_db.removeAll(); 42 | reminder_db.close(); 43 | 44 | // show snackBar 45 | Snackbar.make(getView(), "All reminders removed", Snackbar.LENGTH_SHORT) 46 | .show(); 47 | return true; 48 | } 49 | }); 50 | 51 | Preference import_sample_pref = (Preference) findPreference("pref_key_import_reminders"); 52 | import_sample_pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 53 | public boolean onPreferenceClick(Preference preference) { 54 | //open browser or intent here 55 | ReminderDBHandler reminder_db = new ReminderDBHandler(getActivity()); 56 | reminder_db.removeAll("d"); 57 | List holiday_2015 = Constants.get_holidays(); 58 | List sample_reminder = Constants.get_sample_reminder(); 59 | for(int i = 0; i < holiday_2015.size(); i++){ 60 | reminder_db.addReminder(holiday_2015.get(i)); 61 | } 62 | for(int i = 0; i < sample_reminder.size(); i++){ 63 | reminder_db.addReminder(sample_reminder.get(i)); 64 | } 65 | 66 | // show snackBar 67 | Snackbar.make(getView(), "Sample reminders added", Snackbar.LENGTH_SHORT) 68 | .show(); 69 | return true; 70 | } 71 | }); 72 | 73 | Preference clean_course_pref = (Preference) findPreference("pref_key_clean_course_db"); 74 | clean_course_pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 75 | public boolean onPreferenceClick(Preference preference) { 76 | //open browser or intent here 77 | // should show an alert dialog 78 | CoursesDBHandler courses_db = new CoursesDBHandler(getActivity()); 79 | courses_db.removeAll(); 80 | courses_db.close(); 81 | 82 | // show snackBar 83 | Snackbar.make(getView(), "All courses removed", Snackbar.LENGTH_SHORT) 84 | .show(); 85 | return true; 86 | } 87 | }); 88 | 89 | Preference credit = findPreference("pref_key_Credit"); 90 | credit.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 91 | @Override 92 | public boolean onPreferenceClick(Preference preference) { 93 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); 94 | builder 95 | .setTitle(R.string.credit_title) 96 | .setMessage(R.string.credit_content) 97 | .setPositiveButton("OK", new DialogInterface.OnClickListener() { 98 | @Override 99 | public void onClick(DialogInterface dialog, int which) {} 100 | }); 101 | builder.show(); 102 | return true; 103 | } 104 | }); 105 | 106 | } 107 | 108 | public void onButtonPressed(Uri uri) { 109 | if (mListener != null) { 110 | mListener.onFragmentInteraction(uri); 111 | } 112 | } 113 | 114 | @Override 115 | public void onAttach(Activity activity) { 116 | super.onAttach(activity); 117 | } 118 | 119 | @Override 120 | public void onDetach() { 121 | super.onDetach(); 122 | mListener = null; 123 | } 124 | 125 | public interface OnFragmentInteractionListener { 126 | 127 | void onFragmentInteraction(Uri uri); 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/ui/fragments/SubjectsFragment.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.ui.fragments; 2 | 3 | import android.app.ListFragment; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.View; 7 | import android.widget.ArrayAdapter; 8 | import android.widget.ListView; 9 | import android.widget.Toast; 10 | 11 | import com.YC2010.MyClass.data.Connections; 12 | import com.YC2010.MyClass.callbacks.AsyncTaskCallbackInterface; 13 | import com.YC2010.MyClass.data.fetchtasks.SubjectFetchTask; 14 | import com.YC2010.MyClass.R; 15 | 16 | import java.util.ArrayList; 17 | 18 | /** 19 | * A fragment representing a list of Items. 20 | *

21 | *

22 | * Activities containing this fragment MUST implement the {@link OnFragmentInteractionListener} 23 | * interface. 24 | */ 25 | public class SubjectsFragment extends ListFragment { 26 | 27 | // TODO: Rename parameter arguments, choose names that match 28 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER 29 | private static final String ARG_SUBJECT = "SUBJECT"; 30 | 31 | // TODO: Rename and change types of parameters 32 | private String mParam1; 33 | private String mParam2; 34 | ArrayList mSubject_arraylist; 35 | private OnFragmentInteractionListener mListener; 36 | 37 | // TODO: Rename and change types of parameters 38 | public static SubjectsFragment newInstance(String param1, String param2) { 39 | SubjectsFragment fragment = new SubjectsFragment(); 40 | Bundle args = new Bundle(); 41 | fragment.setArguments(args); 42 | return fragment; 43 | } 44 | 45 | /** 46 | * Mandatory empty constructor for the fragment manager to instantiate the 47 | * fragment (e.g. upon screen orientation changes). 48 | */ 49 | public SubjectsFragment() { 50 | } 51 | 52 | @Override 53 | public void onCreate(Bundle savedInstanceState) { 54 | super.onCreate(savedInstanceState); 55 | 56 | 57 | final SubjectFetchTask subjectFetchTask = new SubjectFetchTask(new AsyncTaskCallbackInterface() { 58 | @Override 59 | public void onOperationComplete(Bundle bundle) { 60 | if(!Connections.isNetworkAvailable(getActivity())){ 61 | Toast.makeText(getActivity().getApplicationContext(), "No network connection, sorry", Toast.LENGTH_LONG).show(); 62 | // pop fragment stack or something else 63 | return; 64 | } 65 | mSubject_arraylist = bundle.getStringArrayList("subject_arraylist"); 66 | setListAdapter(new ArrayAdapter<>(getActivity(), 67 | R.layout.fragment_select_list, R.id.select_list_text, mSubject_arraylist)); 68 | } 69 | }); 70 | subjectFetchTask.execute(); 71 | 72 | 73 | //ArrayList Subject_arraylist = subjectFetchTask.getSubject_arraylist(); 74 | //ArrayList Description_arraylist = subjectFetchTask.getDescription_arraylist(); 75 | //Log.d("SubjectFragment", "Subject_arraylist 0 is " + Subject_arraylist.get(0)); 76 | } 77 | 78 | 79 | /*@Override 80 | public void onAttach(Activity activity) { 81 | super.onAttach(activity); 82 | try { 83 | mListener = (OnFragmentInteractionListener) activity; 84 | } catch (ClassCastException e) { 85 | throw new ClassCastException(activity.toString() 86 | + " must implement OnFragmentInteractionListener"); 87 | } 88 | }*/ 89 | 90 | @Override 91 | public void onDetach() { 92 | super.onDetach(); 93 | mListener = null; 94 | } 95 | 96 | @Override 97 | public void onListItemClick(ListView l, View v, int position, long id) { 98 | super.onListItemClick(l, v, position, id); 99 | Log.d("SubjectsFragment", "item click: " + mSubject_arraylist.get(position)); 100 | CatalogNumFragment mCatalogNumFragment = new CatalogNumFragment(); 101 | Bundle args = new Bundle(); 102 | String subject_name = mSubject_arraylist.get(position); 103 | args.putString(ARG_SUBJECT, subject_name); 104 | mCatalogNumFragment.setArguments(args); 105 | getFragmentManager().beginTransaction() 106 | .replace(R.id.container, mCatalogNumFragment) 107 | .addToBackStack("6") 108 | .commit(); 109 | } 110 | 111 | /** 112 | * This interface must be implemented by activities that contain this 113 | * fragment to allow an interaction in this fragment to be communicated 114 | * to the activity and potentially other fragments contained in that 115 | * activity. 116 | *

117 | * See the Android Training lesson Communicating with Other Fragments for more information. 120 | */ 121 | public interface OnFragmentInteractionListener { 122 | // TODO: Update argument type and name 123 | public void onFragmentInteraction(String id); 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /app/src/main/java/com/YC2010/MyClass/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.YC2010.MyClass.utils; 2 | 3 | import com.YC2010.MyClass.model.Reminder_item; 4 | 5 | import java.util.ArrayList; 6 | import java.util.GregorianCalendar; 7 | import java.util.List; 8 | import java.util.UUID; 9 | 10 | /** 11 | * Created by Danny on 2015/6/27. 12 | */ 13 | 14 | public class Constants { 15 | public static String UWAPIROOT = "https://api.uwaterloo.ca/v2/"; 16 | public static List holiday_2015; 17 | public static List sample_reminder; 18 | 19 | public static String lectureSectionObjectListKey = "LEC_OBJECTS"; 20 | public static String testObjectListKey = "TST_OBJECTS"; 21 | public static String tutorialObjectListKey = "TUT_OBJECTS"; 22 | public static String finalObjectListKey = "FINAL_OBJECTS"; 23 | 24 | // default term value 25 | public static Integer defaultCurTermNum = 1161; 26 | public static String defaultCurTermName = "Winter 2016 (Current)"; 27 | public static Integer defaultNextTermNum = 1165; 28 | public static String defaultNextTermName = "Spring 2016 (Next)"; 29 | 30 | // temporarily hardcoded 31 | // Note: month off by one because of unix time standard 32 | public static GregorianCalendar nextTermStartDate = new GregorianCalendar(2016, 4, 2); 33 | 34 | 35 | 36 | public static List get_sample_reminder(){ 37 | sample_reminder = new ArrayList<>(); 38 | Reminder_item tmp = new Reminder_item(UUID.randomUUID().toString(), 39 | "Final end","", 2015, 7, 15, "d"); 40 | sample_reminder.add(tmp); 41 | tmp = new Reminder_item(UUID.randomUUID().toString(), 42 | "Next term start","", 2015, 8, 14, "d"); 43 | sample_reminder.add(tmp); 44 | tmp = new Reminder_item(UUID.randomUUID().toString(), 45 | "First penalty end","", 2015, 9, 3, "d"); 46 | sample_reminder.add(tmp); 47 | tmp = new Reminder_item(UUID.randomUUID().toString(), 48 | "Late fee for fall","", 2015, 7, 28, "d"); 49 | sample_reminder.add(tmp); 50 | 51 | return sample_reminder; 52 | } 53 | 54 | public static List get_holidays(){ 55 | holiday_2015 = new ArrayList<>(); 56 | Reminder_item tmp = new Reminder_item(UUID.randomUUID().toString(), 57 | "Civic Holiday","", 2015, 7, 3, "d"); 58 | holiday_2015.add(tmp); 59 | tmp = new Reminder_item(UUID.randomUUID().toString(), 60 | "Labour Day","", 2015, 8, 7, "d"); 61 | holiday_2015.add(tmp); 62 | tmp = new Reminder_item(UUID.randomUUID().toString(), 63 | "Thanksgiving","", 2015, 9, 12, "d"); 64 | holiday_2015.add(tmp); 65 | tmp = new Reminder_item(UUID.randomUUID().toString(), 66 | "Christmas","", 2015, 11, 25, "d"); 67 | holiday_2015.add(tmp); 68 | 69 | tmp = new Reminder_item(UUID.randomUUID().toString(), 70 | "Boxing Day","", 2015, 11, 28, "d"); 71 | holiday_2015.add(tmp); 72 | 73 | return holiday_2015; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/res/animator/fab_anim.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 22 | 27 | 28 | 29 | 30 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_calendar_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_calendar_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_clear_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_clear_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_cloud_off_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_cloud_off_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_delete_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_delete_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_format_list_numbers_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_format_list_numbers_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_menu_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_playlist_plus_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_playlist_plus_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_report_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_report_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_school_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_school_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-hdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_calendar_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_calendar_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_clear_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_clear_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_cloud_off_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_cloud_off_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_delete_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_delete_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_format_list_numbers_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_format_list_numbers_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_menu_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_menu_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_playlist_plus_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_playlist_plus_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_report_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_report_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_school_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_school_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-mdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/guide_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-nodpi/guide_01.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/guide_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-nodpi/guide_02.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/guide_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-nodpi/guide_03.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/guide_04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-nodpi/guide_04.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/guide_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-nodpi/guide_5.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/guide_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-nodpi/guide_6.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/guide_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-nodpi/guide_7.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_calendar_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_calendar_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_clear_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_clear_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_cloud_off_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_cloud_off_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_delete_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_delete_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_format_list_numbers_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_format_list_numbers_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_menu_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_menu_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_playlist_plus_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_playlist_plus_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_report_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_report_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_school_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_school_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xhdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/fab_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/fab_icons.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_calendar_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_calendar_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_clear_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_clear_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_cloud_off_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_cloud_off_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_delete_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_delete_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_format_list_numbers_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_format_list_numbers_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_menu_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_menu_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_playlist_plus_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_playlist_plus_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_report_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_report_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_school_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_school_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxhdpi/ic_tick.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_clear_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_clear_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_cloud_off_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_cloud_off_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_delete_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_delete_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_format_list_numbers_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_format_list_numbers_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_playlist_plus_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_playlist_plus_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_report_black_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_report_black_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_school_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_school_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_settings_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable-xxxhdpi/ic_settings_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable/avatar.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/playlist_plus.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/row_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/wallpaper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IYCI/MyClass/29a207bc01002b72a6876f4acc451f9c357667c9/app/src/main/res/drawable/wallpaper.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/course_cardview.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 26 | 27 | 32 | 39 | 48 | 58 | 59 | 60 | 61 | 67 | 68 | 78 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_add_event.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 24 | 25 | 33 | 34 | 35 |