From 93c8f6e6d0ac1696251b946a275a22c21cb79c0a Mon Sep 17 00:00:00 2001 From: ogoldbart3 Date: Sun, 9 Mar 2014 19:14:01 -0400 Subject: [PATCH 01/73] Reworked the project to have a navigation drawer This might not work, don't edit til I make sure --- .gitignore | 231 +------------- .idea/.name | 1 + .idea/compiler.xml | 23 ++ .idea/copyright/profiles_settings.xml | 3 + .idea/encodings.xml | 5 + .idea/gradle.xml | 18 ++ .idea/libraries/appcompat_v7_19_0_1.xml | 10 + .idea/libraries/support_v4_19_0_1.xml | 11 + .idea/misc.xml | 26 ++ .idea/modules.xml | 10 + .idea/scopes/scope_settings.xml | 5 + .idea/vcs.xml | 7 + AndroidManifest.xml | 44 --- ClassNote.iml | 15 + build.gradle | 16 + classnote/.gitignore | 1 + classnote/build.gradle | 25 ++ classnote/classnote.iml | 77 +++++ classnote/proguard-rules.txt | 17 ++ classnote/src/main/AndroidManifest.xml | 53 ++++ .../classnote/AddAssignmentFragment.java | 59 ++++ .../rumbleworks/classnote/Announcement.java | 0 .../classnote/AnnouncementListFragment.java | 0 .../com/rumbleworks/classnote/Assignment.java | 0 .../classnote/AssignmentAdapter.java | 0 .../classnote/AssignmentCalendarFragment.java | 0 .../classnote/AssignmentListFragment.java | 0 .../rumbleworks/classnote/ClassNoteApp.java | 0 .../classnote/CompassActivity.java | 197 ++++++++++++ .../com/rumbleworks/classnote/Course.java | 0 .../com/rumbleworks/classnote/Datamart.java | 0 .../classnote/GradebookFragment.java | 0 .../com/rumbleworks/classnote/GradedWork.java | 0 .../rumbleworks/classnote/HelpFragment.java | 40 +++ .../classnote/JsonHttpResponseHandler.java | 0 .../classnote/NavigationDrawerFragment.java | 286 ++++++++++++++++++ .../classnote/SettingsFragment.java | 40 +++ .../com/rumbleworks/classnote/TSquareAPI.java | 0 .../java}/com/rumbleworks/classnote/Test.java | 0 .../rumbleworks/classnote/UpdateActivity.java | 120 ++++---- .../res/drawable-hdpi/drawer_shadow.9.png | Bin 0 -> 161 bytes .../src/main/res/drawable-hdpi/ic_drawer.png | Bin 0 -> 2829 bytes .../main/res}/drawable-hdpi/ic_launcher.png | Bin .../res/drawable-mdpi/drawer_shadow.9.png | Bin 0 -> 142 bytes .../src/main/res/drawable-mdpi/ic_drawer.png | Bin 0 -> 2820 bytes .../main/res}/drawable-mdpi/ic_launcher.png | Bin .../res/drawable-xhdpi/drawer_shadow.9.png | Bin 0 -> 174 bytes .../src/main/res/drawable-xhdpi/ic_drawer.png | Bin 0 -> 2836 bytes .../main/res}/drawable-xhdpi/ic_launcher.png | Bin .../res/drawable-xxhdpi/drawer_shadow.9.png | Bin 0 -> 208 bytes .../main/res/drawable-xxhdpi/ic_drawer.png | Bin 0 -> 202 bytes .../main/res}/drawable-xxhdpi/ic_launcher.png | Bin .../src/main/res/layout/activity_compass.xml | 30 ++ .../src/main/res}/layout/activity_update.xml | 0 .../res/layout/fragment_add_assignment.xml | 100 ++++++ .../layout/fragment_announcement_list.xml | 0 .../layout/fragment_assignment_calendar.xml | 0 .../res}/layout/fragment_assignment_list.xml | 0 .../src/main/res/layout/fragment_compass.xml | 16 + .../main/res}/layout/fragment_gradebook.xml | 0 .../src/main/res/layout/fragment_help.xml | 29 ++ .../res/layout/fragment_navigation_drawer.xml | 9 + .../src/main/res/layout/fragment_settings.xml | 37 +++ .../main/res}/layout/list_item_assignment.xml | 0 .../src/main/res}/menu/add_assignment.xml | 0 classnote/src/main/res/menu/compass.xml | 12 + classnote/src/main/res/menu/global.xml | 7 + {res => classnote/src/main/res}/menu/main.xml | 0 .../src/main/res}/menu/update.xml | 0 .../src/main/res}/values-large/styles.xml | 0 .../src/main/res}/values-sw600dp/dimens.xml | 14 +- .../main/res}/values-sw720dp-land/dimens.xml | 16 +- .../src/main/res}/values-v11/styles.xml | 20 +- .../src/main/res}/values-v14/styles.xml | 20 +- .../src/main/res/values-w820dp/dimens.xml | 6 + .../src/main/res}/values/dimens.xml | 2 + classnote/src/main/res/values/strings.xml | 26 ++ .../src/main/res}/values/styles.xml | 79 ++--- gradle.properties | 18 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 49896 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 164 ++++++++++ gradlew.bat | 90 ++++++ ic_launcher-web.png | Bin 51394 -> 0 bytes libs/android-support-v4.jar | Bin 621451 -> 0 bytes res/layout/activity_add_assignment.xml | 91 ------ res/layout/activity_main.xml | 11 - res/values/strings.xml | 17 -- settings.gradle | 1 + .../classnote/AddAssignmentActivity.java | 56 ---- .../rumbleworks/classnote/MainActivity.java | 229 -------------- 91 files changed, 1636 insertions(+), 810 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/libraries/appcompat_v7_19_0_1.xml create mode 100644 .idea/libraries/support_v4_19_0_1.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml delete mode 100644 AndroidManifest.xml create mode 100644 ClassNote.iml create mode 100644 build.gradle create mode 100644 classnote/.gitignore create mode 100644 classnote/build.gradle create mode 100644 classnote/classnote.iml create mode 100644 classnote/proguard-rules.txt create mode 100644 classnote/src/main/AndroidManifest.xml create mode 100644 classnote/src/main/java/com/rumbleworks/classnote/AddAssignmentFragment.java rename {src => classnote/src/main/java}/com/rumbleworks/classnote/Announcement.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/AnnouncementListFragment.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/Assignment.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/AssignmentAdapter.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/AssignmentCalendarFragment.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/AssignmentListFragment.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/ClassNoteApp.java (100%) create mode 100644 classnote/src/main/java/com/rumbleworks/classnote/CompassActivity.java rename {src => classnote/src/main/java}/com/rumbleworks/classnote/Course.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/Datamart.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/GradebookFragment.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/GradedWork.java (100%) create mode 100644 classnote/src/main/java/com/rumbleworks/classnote/HelpFragment.java rename {src => classnote/src/main/java}/com/rumbleworks/classnote/JsonHttpResponseHandler.java (100%) create mode 100644 classnote/src/main/java/com/rumbleworks/classnote/NavigationDrawerFragment.java create mode 100644 classnote/src/main/java/com/rumbleworks/classnote/SettingsFragment.java rename {src => classnote/src/main/java}/com/rumbleworks/classnote/TSquareAPI.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/Test.java (100%) rename {src => classnote/src/main/java}/com/rumbleworks/classnote/UpdateActivity.java (92%) create mode 100644 classnote/src/main/res/drawable-hdpi/drawer_shadow.9.png create mode 100644 classnote/src/main/res/drawable-hdpi/ic_drawer.png rename {res => classnote/src/main/res}/drawable-hdpi/ic_launcher.png (100%) create mode 100644 classnote/src/main/res/drawable-mdpi/drawer_shadow.9.png create mode 100644 classnote/src/main/res/drawable-mdpi/ic_drawer.png rename {res => classnote/src/main/res}/drawable-mdpi/ic_launcher.png (100%) create mode 100644 classnote/src/main/res/drawable-xhdpi/drawer_shadow.9.png create mode 100644 classnote/src/main/res/drawable-xhdpi/ic_drawer.png rename {res => classnote/src/main/res}/drawable-xhdpi/ic_launcher.png (100%) create mode 100644 classnote/src/main/res/drawable-xxhdpi/drawer_shadow.9.png create mode 100644 classnote/src/main/res/drawable-xxhdpi/ic_drawer.png rename {res => classnote/src/main/res}/drawable-xxhdpi/ic_launcher.png (100%) create mode 100644 classnote/src/main/res/layout/activity_compass.xml rename {res => classnote/src/main/res}/layout/activity_update.xml (100%) create mode 100644 classnote/src/main/res/layout/fragment_add_assignment.xml rename {res => classnote/src/main/res}/layout/fragment_announcement_list.xml (100%) rename {res => classnote/src/main/res}/layout/fragment_assignment_calendar.xml (100%) rename {res => classnote/src/main/res}/layout/fragment_assignment_list.xml (100%) create mode 100644 classnote/src/main/res/layout/fragment_compass.xml rename {res => classnote/src/main/res}/layout/fragment_gradebook.xml (100%) create mode 100644 classnote/src/main/res/layout/fragment_help.xml create mode 100644 classnote/src/main/res/layout/fragment_navigation_drawer.xml create mode 100644 classnote/src/main/res/layout/fragment_settings.xml rename {res => classnote/src/main/res}/layout/list_item_assignment.xml (100%) rename {res => classnote/src/main/res}/menu/add_assignment.xml (100%) create mode 100644 classnote/src/main/res/menu/compass.xml create mode 100644 classnote/src/main/res/menu/global.xml rename {res => classnote/src/main/res}/menu/main.xml (100%) rename {res => classnote/src/main/res}/menu/update.xml (100%) rename {res => classnote/src/main/res}/values-large/styles.xml (100%) rename {res => classnote/src/main/res}/values-sw600dp/dimens.xml (96%) rename {res => classnote/src/main/res}/values-sw720dp-land/dimens.xml (97%) rename {res => classnote/src/main/res}/values-v11/styles.xml (97%) rename {res => classnote/src/main/res}/values-v14/styles.xml (97%) create mode 100644 classnote/src/main/res/values-w820dp/dimens.xml rename {res => classnote/src/main/res}/values/dimens.xml (69%) create mode 100644 classnote/src/main/res/values/strings.xml rename {res => classnote/src/main/res}/values/styles.xml (87%) create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat delete mode 100644 ic_launcher-web.png delete mode 100644 libs/android-support-v4.jar delete mode 100644 res/layout/activity_add_assignment.xml delete mode 100644 res/layout/activity_main.xml delete mode 100644 res/values/strings.xml create mode 100644 settings.gradle delete mode 100644 src/com/rumbleworks/classnote/AddAssignmentActivity.java delete mode 100644 src/com/rumbleworks/classnote/MainActivity.java diff --git a/.gitignore b/.gitignore index 7307e71..d6bfc95 100644 --- a/.gitignore +++ b/.gitignore @@ -1,229 +1,4 @@ -################# -## Android -################# - -gen/ -out/ - -################# -## Android Studio/Intellij -################# - -.idea -*.iml - -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results - -[Dd]ebug/ -[Rr]elease/ -x64/ -build/ -[Bb]in/ -[Oo]bj/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.log -*.scc - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf -*.cachefile - -# Visual Studio profiler -*.psess -*.vsp -*.vspx - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -*.ncrunch* -.*crunch*.local.xml - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.Publish.xml -*.pubxml - -# NuGet Packages Directory -## TODO: If you have NuGet Package Restore enabled, uncomment the next line -#packages/ - -# Windows Azure Build Output -csx -*.build.csdef - -# Windows Store app package directory -AppPackages/ - -# Others -sql/ -*.Cache -ClientBin/ -[Ss]tyle[Cc]op.* -~$* -*~ -*.dbmdl -*.[Pp]ublish.xml -*.pfx -*.publishsettings - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -App_Data/*.mdf -App_Data/*.ldf - -############# -## Windows detritus -############# - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Mac crap +.gradle +/local.properties +/.idea/workspace.xml .DS_Store - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist/ -build/ -eggs/ -parts/ -var/ -sdist/ -develop-eggs/ -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..01b420f --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +ClassNote \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..26aaedc --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/.idea/libraries/appcompat_v7_19_0_1.xml b/.idea/libraries/appcompat_v7_19_0_1.xml new file mode 100644 index 0000000..32f919a --- /dev/null +++ b/.idea/libraries/appcompat_v7_19_0_1.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/support_v4_19_0_1.xml b/.idea/libraries/support_v4_19_0_1.xml new file mode 100644 index 0000000..617c323 --- /dev/null +++ b/.idea/libraries/support_v4_19_0_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..671eade --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + Android API 19 Platform + + + + + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..948386a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/AndroidManifest.xml b/AndroidManifest.xml deleted file mode 100644 index 437d64b..0000000 --- a/AndroidManifest.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ClassNote.iml b/ClassNote.iml new file mode 100644 index 0000000..c87302f --- /dev/null +++ b/ClassNote.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..80eec1a --- /dev/null +++ b/build.gradle @@ -0,0 +1,16 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:0.9.+' + } +} + +allprojects { + repositories { + mavenCentral() + } +} diff --git a/classnote/.gitignore b/classnote/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/classnote/.gitignore @@ -0,0 +1 @@ +/build diff --git a/classnote/build.gradle b/classnote/build.gradle new file mode 100644 index 0000000..2795418 --- /dev/null +++ b/classnote/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'android' + +android { + compileSdkVersion 19 + buildToolsVersion "19.0.1" + + defaultConfig { + minSdkVersion 8 + targetSdkVersion 19 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + runProguard false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } +} + +dependencies { + compile 'com.android.support:support-v4:19.0.1' + compile 'com.android.support:appcompat-v7:19.0.1' + compile fileTree(dir: 'libs', include: ['*.jar']) +} diff --git a/classnote/classnote.iml b/classnote/classnote.iml new file mode 100644 index 0000000..1cd02cc --- /dev/null +++ b/classnote/classnote.iml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/classnote/proguard-rules.txt b/classnote/proguard-rules.txt new file mode 100644 index 0000000..b7ef581 --- /dev/null +++ b/classnote/proguard-rules.txt @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:/Program Files (x86)/Android/android-studio1/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} \ No newline at end of file diff --git a/classnote/src/main/AndroidManifest.xml b/classnote/src/main/AndroidManifest.xml new file mode 100644 index 0000000..adf2676 --- /dev/null +++ b/classnote/src/main/AndroidManifest.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/classnote/src/main/java/com/rumbleworks/classnote/AddAssignmentFragment.java b/classnote/src/main/java/com/rumbleworks/classnote/AddAssignmentFragment.java new file mode 100644 index 0000000..e8b04cc --- /dev/null +++ b/classnote/src/main/java/com/rumbleworks/classnote/AddAssignmentFragment.java @@ -0,0 +1,59 @@ +package com.rumbleworks.classnote; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.Spinner; +import android.widget.TimePicker; + +import java.util.Calendar; +import java.util.GregorianCalendar; + +public class AddAssignmentFragment extends Fragment { + /** + * The fragment argument representing the section number for this + * fragment. + */ + public static final String ARG_SECTION_NUMBER = "section_number"; + + private Spinner courseSpinner; + private EditText titleField, descField; + private DatePicker datePicker; + private TimePicker timePicker; + + + public AddAssignmentFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_add_assignment, container, false); + + courseSpinner = (Spinner)rootView.findViewById(R.id.courseSpinner); + courseSpinner.setAdapter(new ArrayAdapter(getActivity().getApplicationContext(), android.R.layout.simple_spinner_item, Datamart.getInstance().getCourseIds())); + + titleField = (EditText)rootView.findViewById(R.id.titleField); + descField = (EditText)rootView.findViewById(R.id.descField); + datePicker = (DatePicker)rootView.findViewById(R.id.datePicker); + timePicker = (TimePicker)rootView.findViewById(R.id.timePicker); + + Button saveButton = (Button)rootView.findViewById(R.id.saveAssignmentButton); + saveButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Calendar date = new GregorianCalendar(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth(), timePicker.getCurrentHour(), timePicker.getCurrentMinute()); + Assignment assignment = new Assignment(titleField.getText().toString(), descField.getText().toString(), true, date.getTime(), (String)courseSpinner.getSelectedItem(), -1, -1, -1, -1); + //AddAssignmentActivity.this.finish(); + } + }); + + return rootView; + } +} \ No newline at end of file diff --git a/src/com/rumbleworks/classnote/Announcement.java b/classnote/src/main/java/com/rumbleworks/classnote/Announcement.java similarity index 100% rename from src/com/rumbleworks/classnote/Announcement.java rename to classnote/src/main/java/com/rumbleworks/classnote/Announcement.java diff --git a/src/com/rumbleworks/classnote/AnnouncementListFragment.java b/classnote/src/main/java/com/rumbleworks/classnote/AnnouncementListFragment.java similarity index 100% rename from src/com/rumbleworks/classnote/AnnouncementListFragment.java rename to classnote/src/main/java/com/rumbleworks/classnote/AnnouncementListFragment.java diff --git a/src/com/rumbleworks/classnote/Assignment.java b/classnote/src/main/java/com/rumbleworks/classnote/Assignment.java similarity index 100% rename from src/com/rumbleworks/classnote/Assignment.java rename to classnote/src/main/java/com/rumbleworks/classnote/Assignment.java diff --git a/src/com/rumbleworks/classnote/AssignmentAdapter.java b/classnote/src/main/java/com/rumbleworks/classnote/AssignmentAdapter.java similarity index 100% rename from src/com/rumbleworks/classnote/AssignmentAdapter.java rename to classnote/src/main/java/com/rumbleworks/classnote/AssignmentAdapter.java diff --git a/src/com/rumbleworks/classnote/AssignmentCalendarFragment.java b/classnote/src/main/java/com/rumbleworks/classnote/AssignmentCalendarFragment.java similarity index 100% rename from src/com/rumbleworks/classnote/AssignmentCalendarFragment.java rename to classnote/src/main/java/com/rumbleworks/classnote/AssignmentCalendarFragment.java diff --git a/src/com/rumbleworks/classnote/AssignmentListFragment.java b/classnote/src/main/java/com/rumbleworks/classnote/AssignmentListFragment.java similarity index 100% rename from src/com/rumbleworks/classnote/AssignmentListFragment.java rename to classnote/src/main/java/com/rumbleworks/classnote/AssignmentListFragment.java diff --git a/src/com/rumbleworks/classnote/ClassNoteApp.java b/classnote/src/main/java/com/rumbleworks/classnote/ClassNoteApp.java similarity index 100% rename from src/com/rumbleworks/classnote/ClassNoteApp.java rename to classnote/src/main/java/com/rumbleworks/classnote/ClassNoteApp.java diff --git a/classnote/src/main/java/com/rumbleworks/classnote/CompassActivity.java b/classnote/src/main/java/com/rumbleworks/classnote/CompassActivity.java new file mode 100644 index 0000000..61c7b76 --- /dev/null +++ b/classnote/src/main/java/com/rumbleworks/classnote/CompassActivity.java @@ -0,0 +1,197 @@ +package com.rumbleworks.classnote; + +import android.app.Activity; +import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.ActionBar; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.content.Context; +import android.os.Build; +import android.os.Bundle; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.support.v4.widget.DrawerLayout; +import android.widget.ArrayAdapter; +import android.widget.TextView; + + +//CompassActivity is the new MainActivity. It is effectively the back activity for all the fragments shown in the app and the drawer fragment + +public class CompassActivity extends ActionBarActivity + implements NavigationDrawerFragment.NavigationDrawerCallbacks { + + /** + * Fragment managing the behaviors, interactions and presentation of the navigation drawer. + */ + private NavigationDrawerFragment mNavigationDrawerFragment; + + /** + * Used to store the last screen title. For use in {@link #restoreActionBar()}. + */ + private CharSequence mTitle; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_compass); + + mNavigationDrawerFragment = (NavigationDrawerFragment) + getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); + mTitle = getTitle(); + + // Set up the drawer. + mNavigationDrawerFragment.setUp( + R.id.navigation_drawer, + (DrawerLayout) findViewById(R.id.drawer_layout)); + } + + @Override + public void onNavigationDrawerItemSelected(int position) { + // update the main content by replacing fragments + FragmentManager fragmentManager = getSupportFragmentManager(); + + switch (position) { + case 0: + fragmentManager.beginTransaction() + .replace(R.id.container, new AnnouncementListFragment()) + .commit(); + break; + case 1: + fragmentManager.beginTransaction() + .replace(R.id.container, new AssignmentListFragment()) + .commit(); + break; + case 2: + fragmentManager.beginTransaction() + .replace(R.id.container, new AssignmentCalendarFragment()) + .commit(); + break; + case 3: + fragmentManager.beginTransaction() + .replace(R.id.container, new GradebookFragment()) + .commit(); + break; + case 4: + fragmentManager.beginTransaction() + .replace(R.id.container, new AddAssignmentFragment()) + .commit(); + break; + case 5: + fragmentManager.beginTransaction() + .replace(R.id.container, new SettingsFragment()) + .commit(); + break; + case 6: + fragmentManager.beginTransaction() + .replace(R.id.container, new HelpFragment()) + .commit(); + break; + } + } + + public void onSectionAttached(int number) { + switch (number) { + case 0: + mTitle = getString(R.string.title_section0); + break; + case 1: + mTitle = getString(R.string.title_section1); + break; + case 2: + mTitle = getString(R.string.title_section2); + break; + case 3: + mTitle = getString(R.string.title_section3); + break; + case 4: + mTitle = getString(R.string.title_section4); + break; + case 5: + mTitle = getString(R.string.title_section5); + break; + case 6: + mTitle = getString(R.string.title_section6); + break; + } + } + + public void restoreActionBar() { + ActionBar actionBar = getSupportActionBar(); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setTitle(mTitle); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + if (!mNavigationDrawerFragment.isDrawerOpen()) { + // Only show items in the action bar relevant to this screen + // if the drawer is not showing. Otherwise, let the drawer + // decide what to show in the action bar. + getMenuInflater().inflate(R.menu.compass, menu); + restoreActionBar(); + return true; + } + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + if (id == R.id.action_settings) { + return true; + } + return super.onOptionsItemSelected(item); + } + + /** + * A placeholder fragment containing a simple view. + */ + public static class PlaceholderFragment extends Fragment { + /** + * The fragment argument representing the section number for this + * fragment. + */ + private static final String ARG_SECTION_NUMBER = "section_number"; + + /** + * Returns a new instance of this fragment for the given section + * number. + */ + public static PlaceholderFragment newInstance(int sectionNumber) { + PlaceholderFragment fragment = new PlaceholderFragment(); + Bundle args = new Bundle(); + args.putInt(ARG_SECTION_NUMBER, sectionNumber); + fragment.setArguments(args); + return fragment; + } + + public PlaceholderFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_compass, container, false); + TextView textView = (TextView) rootView.findViewById(R.id.section_label); + textView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER))); + return rootView; + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + ((CompassActivity) activity).onSectionAttached( + getArguments().getInt(ARG_SECTION_NUMBER)); + } + } + +} diff --git a/src/com/rumbleworks/classnote/Course.java b/classnote/src/main/java/com/rumbleworks/classnote/Course.java similarity index 100% rename from src/com/rumbleworks/classnote/Course.java rename to classnote/src/main/java/com/rumbleworks/classnote/Course.java diff --git a/src/com/rumbleworks/classnote/Datamart.java b/classnote/src/main/java/com/rumbleworks/classnote/Datamart.java similarity index 100% rename from src/com/rumbleworks/classnote/Datamart.java rename to classnote/src/main/java/com/rumbleworks/classnote/Datamart.java diff --git a/src/com/rumbleworks/classnote/GradebookFragment.java b/classnote/src/main/java/com/rumbleworks/classnote/GradebookFragment.java similarity index 100% rename from src/com/rumbleworks/classnote/GradebookFragment.java rename to classnote/src/main/java/com/rumbleworks/classnote/GradebookFragment.java diff --git a/src/com/rumbleworks/classnote/GradedWork.java b/classnote/src/main/java/com/rumbleworks/classnote/GradedWork.java similarity index 100% rename from src/com/rumbleworks/classnote/GradedWork.java rename to classnote/src/main/java/com/rumbleworks/classnote/GradedWork.java diff --git a/classnote/src/main/java/com/rumbleworks/classnote/HelpFragment.java b/classnote/src/main/java/com/rumbleworks/classnote/HelpFragment.java new file mode 100644 index 0000000..a1fe695 --- /dev/null +++ b/classnote/src/main/java/com/rumbleworks/classnote/HelpFragment.java @@ -0,0 +1,40 @@ +package com.rumbleworks.classnote; + +import android.app.Activity; +import android.net.Uri; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + + + +/** + * A simple {@link android.support.v4.app.Fragment} subclass. + * Activities that contain this fragment must implement the + * {@link SettingsFragment.OnFragmentInteractionListener} interface + * to handle interaction events. + * Use the {@link SettingsFragment#newInstance} factory method to + * create an instance of this fragment. + * + */ +public class HelpFragment extends Fragment { + /** + * The fragment argument representing the section number for this + * fragment. + */ + public static final String ARG_SECTION_NUMBER = "section_number"; + + public HelpFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_help, container, false); + //TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label); + //dummyTextView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER))); + return rootView; + } +} \ No newline at end of file diff --git a/src/com/rumbleworks/classnote/JsonHttpResponseHandler.java b/classnote/src/main/java/com/rumbleworks/classnote/JsonHttpResponseHandler.java similarity index 100% rename from src/com/rumbleworks/classnote/JsonHttpResponseHandler.java rename to classnote/src/main/java/com/rumbleworks/classnote/JsonHttpResponseHandler.java diff --git a/classnote/src/main/java/com/rumbleworks/classnote/NavigationDrawerFragment.java b/classnote/src/main/java/com/rumbleworks/classnote/NavigationDrawerFragment.java new file mode 100644 index 0000000..ff3df75 --- /dev/null +++ b/classnote/src/main/java/com/rumbleworks/classnote/NavigationDrawerFragment.java @@ -0,0 +1,286 @@ +package com.rumbleworks.classnote; + +import android.support.v7.app.ActionBarActivity; +import android.app.Activity; +import android.support.v7.app.ActionBar; +import android.support.v4.app.Fragment; +import android.support.v4.app.ActionBarDrawerToggle; +import android.support.v4.view.GravityCompat; +import android.support.v4.widget.DrawerLayout; +import android.content.SharedPreferences; +import android.content.res.Configuration; +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.Toast; + +/** + * Fragment used for managing interactions for and presentation of a navigation drawer. + * See the + * design guidelines for a complete explanation of the behaviors implemented here. + */ +public class NavigationDrawerFragment extends Fragment { + + /** + * Remember the position of the selected item. + */ + private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position"; + + /** + * Per the design guidelines, you should show the drawer on launch until the user manually + * expands it. This shared preference tracks this. + */ + private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned"; + + /** + * A pointer to the current callbacks instance (the Activity). + */ + private NavigationDrawerCallbacks mCallbacks; + + /** + * Helper component that ties the action bar to the navigation drawer. + */ + private ActionBarDrawerToggle mDrawerToggle; + + private DrawerLayout mDrawerLayout; + private ListView mDrawerListView; + private View mFragmentContainerView; + + private int mCurrentSelectedPosition = 0; + private boolean mFromSavedInstanceState; + private boolean mUserLearnedDrawer; + + public NavigationDrawerFragment() { + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Read in the flag indicating whether or not the user has demonstrated awareness of the + // drawer. See PREF_USER_LEARNED_DRAWER for details. + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); + mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); + + if (savedInstanceState != null) { + mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); + mFromSavedInstanceState = true; + } + + // Select either the default item (0) or the last selected item. + selectItem(mCurrentSelectedPosition); + } + + @Override + public void onActivityCreated (Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + // Indicate that this fragment would like to influence the set of actions in the action bar. + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + mDrawerListView = (ListView) inflater.inflate( + R.layout.fragment_navigation_drawer, container, false); + mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + selectItem(position); + } + }); + mDrawerListView.setAdapter(new ArrayAdapter( + getActionBar().getThemedContext(), + android.R.layout.simple_list_item_1, + android.R.id.text1, + new String[]{ + getString(R.string.title_section0), + getString(R.string.title_section1), + getString(R.string.title_section2), + getString(R.string.title_section3), + getString(R.string.title_section4), + getString(R.string.title_section5), + getString(R.string.title_section6), + })); + mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); + return mDrawerListView; + } + + public boolean isDrawerOpen() { + return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView); + } + + /** + * Users of this fragment must call this method to set up the navigation drawer interactions. + * + * @param fragmentId The android:id of this fragment in its activity's layout. + * @param drawerLayout The DrawerLayout containing this fragment's UI. + */ + public void setUp(int fragmentId, DrawerLayout drawerLayout) { + mFragmentContainerView = getActivity().findViewById(fragmentId); + mDrawerLayout = drawerLayout; + + // set a custom shadow that overlays the main content when the drawer opens + mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); + // set up the drawer's list view with items and click listener + + ActionBar actionBar = getActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setHomeButtonEnabled(true); + + // ActionBarDrawerToggle ties together the the proper interactions + // between the navigation drawer and the action bar app icon. + mDrawerToggle = new ActionBarDrawerToggle( + getActivity(), /* host Activity */ + mDrawerLayout, /* DrawerLayout object */ + R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ + R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ + R.string.navigation_drawer_close /* "close drawer" description for accessibility */ + ) { + @Override + public void onDrawerClosed(View drawerView) { + super.onDrawerClosed(drawerView); + if (!isAdded()) { + return; + } + + getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() + } + + @Override + public void onDrawerOpened(View drawerView) { + super.onDrawerOpened(drawerView); + if (!isAdded()) { + return; + } + + if (!mUserLearnedDrawer) { + // The user manually opened the drawer; store this flag to prevent auto-showing + // the navigation drawer automatically in the future. + mUserLearnedDrawer = true; + SharedPreferences sp = PreferenceManager + .getDefaultSharedPreferences(getActivity()); + sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit(); + } + + getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() + } + }; + + // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, + // per the navigation drawer design guidelines. + if (!mUserLearnedDrawer && !mFromSavedInstanceState) { + mDrawerLayout.openDrawer(mFragmentContainerView); + } + + // Defer code dependent on restoration of previous instance state. + mDrawerLayout.post(new Runnable() { + @Override + public void run() { + mDrawerToggle.syncState(); + } + }); + + mDrawerLayout.setDrawerListener(mDrawerToggle); + } + + private void selectItem(int position) { + mCurrentSelectedPosition = position; + if (mDrawerListView != null) { + mDrawerListView.setItemChecked(position, true); + } + if (mDrawerLayout != null) { + mDrawerLayout.closeDrawer(mFragmentContainerView); + } + if (mCallbacks != null) { + mCallbacks.onNavigationDrawerItemSelected(position); + } + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + try { + mCallbacks = (NavigationDrawerCallbacks) activity; + } catch (ClassCastException e) { + throw new ClassCastException("Activity must implement NavigationDrawerCallbacks."); + } + } + + @Override + public void onDetach() { + super.onDetach(); + mCallbacks = null; + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + // Forward the new configuration the drawer toggle component. + mDrawerToggle.onConfigurationChanged(newConfig); + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + // If the drawer is open, show the global app actions in the action bar. See also + // showGlobalContextActionBar, which controls the top-left area of the action bar. + if (mDrawerLayout != null && isDrawerOpen()) { + inflater.inflate(R.menu.global, menu); + showGlobalContextActionBar(); + } + super.onCreateOptionsMenu(menu, inflater); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (mDrawerToggle.onOptionsItemSelected(item)) { + return true; + } + + if (item.getItemId() == R.id.action_example) { + Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show(); + return true; + } + + return super.onOptionsItemSelected(item); + } + + /** + * Per the navigation drawer design guidelines, updates the action bar to show the global app + * 'context', rather than just what's in the current screen. + */ + private void showGlobalContextActionBar() { + ActionBar actionBar = getActionBar(); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + actionBar.setTitle(R.string.app_name); + } + + private ActionBar getActionBar() { + return ((ActionBarActivity) getActivity()).getSupportActionBar(); + } + + /** + * Callbacks interface that all activities using this fragment must implement. + */ + public static interface NavigationDrawerCallbacks { + /** + * Called when an item in the navigation drawer is selected. + */ + void onNavigationDrawerItemSelected(int position); + } +} diff --git a/classnote/src/main/java/com/rumbleworks/classnote/SettingsFragment.java b/classnote/src/main/java/com/rumbleworks/classnote/SettingsFragment.java new file mode 100644 index 0000000..0722465 --- /dev/null +++ b/classnote/src/main/java/com/rumbleworks/classnote/SettingsFragment.java @@ -0,0 +1,40 @@ +package com.rumbleworks.classnote; + +import android.app.Activity; +import android.net.Uri; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + + + +/** + * A simple {@link android.support.v4.app.Fragment} subclass. + * Activities that contain this fragment must implement the + * {@link SettingsFragment.OnFragmentInteractionListener} interface + * to handle interaction events. + * Use the {@link SettingsFragment#newInstance} factory method to + * create an instance of this fragment. + * + */ +public class SettingsFragment extends Fragment { + /** + * The fragment argument representing the section number for this + * fragment. + */ + public static final String ARG_SECTION_NUMBER = "section_number"; + + public SettingsFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_settings, container, false); + //TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label); + //dummyTextView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER))); + return rootView; + } +} \ No newline at end of file diff --git a/src/com/rumbleworks/classnote/TSquareAPI.java b/classnote/src/main/java/com/rumbleworks/classnote/TSquareAPI.java similarity index 100% rename from src/com/rumbleworks/classnote/TSquareAPI.java rename to classnote/src/main/java/com/rumbleworks/classnote/TSquareAPI.java diff --git a/src/com/rumbleworks/classnote/Test.java b/classnote/src/main/java/com/rumbleworks/classnote/Test.java similarity index 100% rename from src/com/rumbleworks/classnote/Test.java rename to classnote/src/main/java/com/rumbleworks/classnote/Test.java diff --git a/src/com/rumbleworks/classnote/UpdateActivity.java b/classnote/src/main/java/com/rumbleworks/classnote/UpdateActivity.java similarity index 92% rename from src/com/rumbleworks/classnote/UpdateActivity.java rename to classnote/src/main/java/com/rumbleworks/classnote/UpdateActivity.java index 9721a47..292b117 100644 --- a/src/com/rumbleworks/classnote/UpdateActivity.java +++ b/classnote/src/main/java/com/rumbleworks/classnote/UpdateActivity.java @@ -1,60 +1,60 @@ -package com.rumbleworks.classnote; - -import android.os.Bundle; -import android.app.Activity; -import android.content.Intent; -import android.view.Menu; -import android.view.View; -import android.widget.EditText; -import android.widget.Toast; - -import org.json.JSONObject; - -public class UpdateActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_update); - - - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.update, menu); - return true; - } - - public void login( View view ) { - EditText usernameField = (EditText)findViewById(R.id.usernameField); - EditText passwordField = (EditText)findViewById(R.id.passwordField); - final String username = usernameField.getText().toString(); - - TSquareAPI.login(usernameField.getText().toString(), passwordField.getText().toString(), new JsonHttpResponseHandler() { - @Override - public void onSuccess(JSONObject object) { - Intent intent = new Intent(); - intent.putExtra("username", username); - intent.setClass(UpdateActivity.this, MainActivity.class); - - startActivity(intent); - finish(); - } - - @Override - public void onFailure() { - UpdateActivity.this.runOnUiThread(new Runnable() { - @Override - public void run() { - Toast toast = Toast.makeText(UpdateActivity.this, "Invalid Username or Password", Toast.LENGTH_LONG); - toast.show(); - } - }); - } - }); - - } - -} +package com.rumbleworks.classnote; + +import android.os.Bundle; +import android.app.Activity; +import android.content.Intent; +import android.view.Menu; +import android.view.View; +import android.widget.EditText; +import android.widget.Toast; + +import org.json.JSONObject; + +public class UpdateActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_update); + + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.update, menu); + return true; + } + + public void login( View view ) { + EditText usernameField = (EditText)findViewById(R.id.usernameField); + EditText passwordField = (EditText)findViewById(R.id.passwordField); + final String username = usernameField.getText().toString(); + + TSquareAPI.login(usernameField.getText().toString(), passwordField.getText().toString(), new JsonHttpResponseHandler() { + @Override + public void onSuccess(JSONObject object) { + Intent intent = new Intent(); + intent.putExtra("username", username); + intent.setClass(UpdateActivity.this, CompassActivity.class); + + startActivity(intent); + finish(); + } + + @Override + public void onFailure() { + UpdateActivity.this.runOnUiThread(new Runnable() { + @Override + public void run() { + Toast toast = Toast.makeText(UpdateActivity.this, "Invalid Username or Password", Toast.LENGTH_LONG); + toast.show(); + } + }); + } + }); + + } + +} diff --git a/classnote/src/main/res/drawable-hdpi/drawer_shadow.9.png b/classnote/src/main/res/drawable-hdpi/drawer_shadow.9.png new file mode 100644 index 0000000000000000000000000000000000000000..236bff558af07faa3921ba35e2515edf62d04bb9 GIT binary patch literal 161 zcmeAS@N?(olHy`uVBq!ia0vp^JV0#3!3HEVSgovp6icy_X9x!n)NrJ90QsB+9+AZi z4BVX{%xHe{^je^xv!{z=h{y5dAOHW`Gf#YA@1xt%!KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_A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7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0000lNkl)HFiry~4#d$|ph7GRd^8UISO5Sz W9s(?08bak5Rc<;uP@|nU=UzFz%6x@#ly{E6Z5RU$2Hhw*i>Gs`(~~C zr~2_>(e4Ka`gpa)&de}Ks*u{@U5E@m-v9X3<$3NT3r3p*`<7|@n1Ecw;OXk;vd$@? F2>^8yH@N@+ literal 0 HcmV?d00001 diff --git a/classnote/src/main/res/drawable-xhdpi/ic_drawer.png b/classnote/src/main/res/drawable-xhdpi/ic_drawer.png new file mode 100644 index 0000000000000000000000000000000000000000..a5fa74def4b40d7eb6826da05bd5e12b836cb999 GIT binary patch literal 2836 zcmV+v3+wcWP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb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ycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0000#NklPK!-MKjcfMdXz>*{m> m06>TUe1Q%C00DSr z1<%~X^wgl##FWaylc_d9MMa)2jv*QM-d<4Ta$*#5x!8O#VbcvCx78OjjCM19-`|n` zlcQ;yJWqK-!X?h+v^9}Es?F+hJ07=b>sdT*QRcgm+^%b8|A7C`|A*gYPjm3$2miRv cpZdzQt0C%<%j~>EK-(ESUHx3vIVCg!0CP)0sQ>@~ literal 0 HcmV?d00001 diff --git a/classnote/src/main/res/drawable-xxhdpi/ic_drawer.png b/classnote/src/main/res/drawable-xxhdpi/ic_drawer.png new file mode 100644 index 0000000000000000000000000000000000000000..9c4685d6e046ce6c450c19426dce627a88718bfc GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC&H|6fVg?3oVGw3ym^DWND5#L^ z5#-Cjkf+YTP`sXjk!=$LL!~YQgWnqlM%L3n1JW26goK+9UQq_B4e)ev49U3n_PU`U zg8>io#t-TVJM=pEGT)onF!&ZOd;8}O149hcq!N%?hK6(oZAK7-f#HS|n9?%@Qw{w* cAUc7wfPvd9>y+w~O{pNhr>mdKI;Vst074Kf@&Et; literal 0 HcmV?d00001 diff --git a/res/drawable-xxhdpi/ic_launcher.png b/classnote/src/main/res/drawable-xxhdpi/ic_launcher.png similarity index 100% rename from res/drawable-xxhdpi/ic_launcher.png rename to classnote/src/main/res/drawable-xxhdpi/ic_launcher.png diff --git a/classnote/src/main/res/layout/activity_compass.xml b/classnote/src/main/res/layout/activity_compass.xml new file mode 100644 index 0000000..ce21120 --- /dev/null +++ b/classnote/src/main/res/layout/activity_compass.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/res/layout/activity_update.xml b/classnote/src/main/res/layout/activity_update.xml similarity index 100% rename from res/layout/activity_update.xml rename to classnote/src/main/res/layout/activity_update.xml diff --git a/classnote/src/main/res/layout/fragment_add_assignment.xml b/classnote/src/main/res/layout/fragment_add_assignment.xml new file mode 100644 index 0000000..54f5fff --- /dev/null +++ b/classnote/src/main/res/layout/fragment_add_assignment.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +