Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First public release

  • Loading branch information...
commit f2e5d3d9b13a2852c49788fda6ff4c9aba1c0a45 1 parent 8ecf658
@pec1985 authored
Showing with 1,418 additions and 0 deletions.
  1. BIN  .DS_Store
  2. BIN  Resources/.DS_Store
  3. BIN  Resources/KS_nav_ui.png
  4. BIN  Resources/KS_nav_views.png
  5. BIN  Resources/a_add.png
  6. +110 −0 Resources/a_addchapters.js
  7. +105 −0 Resources/a_addflashcards.js
  8. +30 −0 Resources/a_addnewchapter.js
  9. +63 −0 Resources/a_addnewflashcard.js
  10. +31 −0 Resources/a_addsubjects.js
  11. BIN  Resources/a_bottombar.png
  12. BIN  Resources/a_byname.png
  13. BIN  Resources/a_chaps.png
  14. BIN  Resources/a_close.png
  15. +86 −0 Resources/a_editlist.js
  16. BIN  Resources/a_random.png
  17. BIN  Resources/a_save.png
  18. BIN  Resources/a_tab1.png
  19. BIN  Resources/a_tab2.png
  20. +63 −0 Resources/a_viewchapters.js
  21. +110 −0 Resources/a_viewflascards.js
  22. +36 −0 Resources/a_viewlist.js
  23. +106 −0 Resources/addchapter.js
  24. +55 −0 Resources/addflashcard-old.js
  25. +86 −0 Resources/addflashcard.js
  26. +35 −0 Resources/addnewchapter.js
  27. +36 −0 Resources/addsubject.js
  28. BIN  Resources/android/.DS_Store
  29. BIN  Resources/android/appicon.png
  30. BIN  Resources/android/default.png
  31. +89 −0 Resources/app.js
  32. BIN  Resources/appicon.png
  33. BIN  Resources/default.png
  34. BIN  Resources/edit_layout.psd
  35. +76 −0 Resources/editlist.js
  36. 0  Resources/extras.js
  37. BIN  Resources/flashcard.png
  38. BIN  Resources/flashcards.sqlite
  39. +79 −0 Resources/flashcardsedit.js
  40. BIN  Resources/flip.png
  41. BIN  Resources/flip1.png
  42. BIN  Resources/flip2.png
  43. BIN  Resources/icon1.png
  44. BIN  Resources/icon1s.png
  45. BIN  Resources/icon2.png
  46. BIN  Resources/icon2s.png
  47. BIN  Resources/iphone/.DS_Store
  48. BIN  Resources/iphone/Default.png
  49. BIN  Resources/iphone/appicon.png
  50. BIN  Resources/iphone/default_app_logo.png
  51. BIN  Resources/nav-bar-shadow.png
  52. BIN  Resources/nav-bar-shadow@2x.png
  53. BIN  Resources/nav-button-press.png
  54. BIN  Resources/nav-button-press@2x.png
  55. BIN  Resources/navbarbg-landscape.png
  56. BIN  Resources/navbarbg-landscape@2x.png
  57. BIN  Resources/navbarbg.png
  58. BIN  Resources/navbarbg@2x.png
  59. BIN  Resources/subjects-back.png
  60. +57 −0 Resources/viewchapter.js
  61. +123 −0 Resources/viewflashcards.js
  62. +42 −0 Resources/viewlist.js
View
BIN  .DS_Store
Binary file not shown
View
BIN  Resources/.DS_Store
Binary file not shown
View
BIN  Resources/KS_nav_ui.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/KS_nav_views.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/a_add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
110 Resources/a_addchapters.js
@@ -0,0 +1,110 @@
+var addChapters = function(subjectId){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId);
+ var thisSubject = subjectName.fieldByName('subject');
+ subjectName.close();
+ db.close();
+
+ var win = Ti.UI.createWindow({backgroundColor:'#ccc'});
+
+ var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'});
+ var a_viewTitle = Ti.UI.createLabel({ text:'Add Chapters',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ a_topbar.add(a_viewTitle);
+ var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5});
+ var addButton = Ti.UI.createImageView({image:'a_add.png',top:9,right:5});
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44});
+
+ var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Subject',left:20,top:55,color:'black'});
+ var viewSubjectsViewTitle = Ti.UI.createTextField({value:thisSubject,top:80,height:44,right:12,left:12,color:'black'});
+ var viewChaptersTitle = Ti.UI.createLabel({text:'Chapters',left:20,top:130,color:'black'});
+
+ win.add(a_topbar);
+ win.add(closeButton);
+ win.add(addButton);
+ win.add(navbarShadow);
+ win.add(viewSubjectsTitle);
+ win.add(viewSubjectsViewTitle);
+ win.add(viewChaptersTitle);
+
+ var chaptersTable = Ti.UI.createTableView({top:160,backgroundColor:'white',editable:true});
+
+ var timer;
+ var confirmDel = function(rowId,rowName) {
+ var msgTitle = "Delete Entire Chapter";
+ var msgText = "Are you sure you want to delete the '"+rowName+"' chapter?";
+ var statusAlert = Titanium.UI.createAlertDialog({title:msgTitle,message:msgText,buttonNames: ['Cancel','Ok']});
+ statusAlert.show();
+ statusAlert.addEventListener('click',function(e){
+ if (e.index == 0){statusAlert.hide();}
+ if (e.index == 1){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("DELETE FROM chapters WHERE id = ?", rowId);
+ db.close();
+ refresh();
+ }
+ });
+
+ };
+ var tapAndHold = function(e){
+ e.addEventListener('touchstart', function(e){
+ timer = setTimeout(function() {
+ confirmDel(e.source.rowId,e.source.rowName);
+ }, 500);
+ });
+ e.addEventListener('touchend', function(e){
+ clearTimeout(timer);
+ });
+ };
+
+ var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId);
+ var x = 0;
+ while (rows.isValidRow()){
+ var chapterName = rows.fieldByName('chapter');
+ var id = rows.fieldByName('id');
+ var touchView = Ti.UI.createView({ rowId:id,rowName:chapterName,left:0, top:0, right:0, bottom:0 }); // invisible view to capture touch
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',chapterId:id,chapterName:chapterName,hasChild:true});
+ var label = Ti.UI.createLabel({text:chapterName, left:10,height:20,color:'black'});
+ row.add(touchView);
+ row.add(label);
+ tapAndHold(touchView);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ chaptersTable.data=data;
+ };
+ refresh();
+ win.add(chaptersTable);
+ var window;
+ addButton.addEventListener('click',function(){
+ viewSubjectsViewTitle.blur();
+ window = addChaptersWindow(subjectId);
+ window.open();
+ window.addEventListener('close',function(){
+ refresh();
+ });
+ });
+ chaptersTable.addEventListener('click',function(e){
+ viewSubjectsViewTitle.blur();
+ window = addFlashcards(e.rowData.chapterName,e.rowData.chapterId);
+ window.open();
+ window.addEventListener('close',function(){
+ refresh();
+ });
+
+ });
+ closeButton.addEventListener('click',function(){
+ viewSubjectsViewTitle.blur();
+ if(viewSubjectsViewTitle.value == null){ } else {
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("UPDATE subjects SET subject = '"+viewSubjectsViewTitle.value+"' WHERE id = "+subjectId);
+ db.close();
+ }
+ win.close();
+ });
+ return win;
+};
View
105 Resources/a_addflashcards.js
@@ -0,0 +1,105 @@
+var addFlashcards = function(title,chapterId){
+ var win = Ti.UI.createWindow({backgroundColor:'#ccc'});
+
+ var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'});
+ var a_viewTitle = Ti.UI.createLabel({ text:'Add Flashcards',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ a_topbar.add(a_viewTitle);
+ var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5});
+ var addButton = Ti.UI.createImageView({image:'a_add.png',top:9,right:5});
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44});
+
+ var viewSubjectsTitle = Ti.UI.createLabel({text:'Chapter',left:20,top:55,color:'black'});
+ var viewSubjectsViewTitle = Ti.UI.createTextField({value:title,top:80,height:44,right:12,left:12,color:'black'});
+ var viewChaptersTitle = Ti.UI.createLabel({text:'Flashcards',left:20,top:130,color:'black'});
+
+ win.add(a_topbar);
+ win.add(closeButton);
+ win.add(addButton);
+ win.add(navbarShadow);
+ win.add(viewSubjectsTitle);
+ win.add(viewSubjectsViewTitle);
+ win.add(viewChaptersTitle);
+
+ var chaptersTable = Ti.UI.createTableView({top:160,backgroundColor:'white',editable:true});
+ var timer;
+ var confirmDel = function(rowId,rowName) {
+ var msgTitle = "Delete Flashcard";
+ var msgText = "Are you sure you want to delete the '"+rowName+"' flashcard?";
+ var statusAlert = Titanium.UI.createAlertDialog({title:msgTitle,message:msgText,buttonNames: ['Cancel','Ok']});
+ statusAlert.show();
+ statusAlert.addEventListener('click',function(e){
+ if (e.index == 0){statusAlert.hide();}
+ if (e.index == 1){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("DELETE FROM flashcards WHERE id = ?", rowId);
+ db.close();
+ refresh();
+ }
+ });
+
+ };
+ var tapAndHold = function(e){
+ e.addEventListener('touchstart', function(e){
+ timer = setTimeout(function() {
+ confirmDel(e.source.rowId,e.source.rowName);
+ }, 500);
+ });
+ e.addEventListener('touchend', function(e){
+ clearTimeout(timer);
+ });
+ };
+
+ var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM flashcards WHERE chapter = '"+chapterId+"' ORDER BY id");
+ var x = 0;
+ while (rows.isValidRow()){
+ var flashName = rows.fieldByName('name');
+ var id = rows.fieldByName('id');
+ var touchView = Ti.UI.createView({ rowId:id,rowName:flashName,left:0, top:0, right:0, bottom:0 }); // invisible view to capture touch
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',flashId:id,flashName:flashName,hasChild:true});
+ var label = Ti.UI.createLabel({text:flashName, left:10,color:'black'});
+ row.add(touchView);
+ row.add(label);
+ tapAndHold(touchView);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ chaptersTable.data=data;
+ };
+ refresh();
+ win.add(chaptersTable);
+ var window;
+
+ addButton.addEventListener('click',function(e){
+ window = addFlashCardWindow('null',chapterId);
+ window.open();
+ window.addEventListener('close',function(){
+ refresh();
+ });
+ });
+
+ chaptersTable.addEventListener('click',function(e){
+ window = addFlashCardWindow(e.rowData.flashId,'null');
+ window.open();
+ window.addEventListener('close',function(){
+ refresh();
+ });
+ });
+
+ closeButton.addEventListener('click',function(){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("UPDATE chapters SET chapter = '"+viewSubjectsViewTitle.value+"' WHERE id = "+chapterId);
+ db.close();
+ viewSubjectsViewTitle.blur();
+ win.close();
+ });
+ viewSubjectsViewTitle.addEventListener('return',function(){
+ viewSubjectsViewTitle.blur();
+ });
+
+ return win;
+};
View
30 Resources/a_addnewchapter.js
@@ -0,0 +1,30 @@
+var addChaptersWindow = function(subjectId){
+ var win = Ti.UI.createWindow({backgroundColor:'#ccc'});
+
+ var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'});
+ var a_viewTitle = Ti.UI.createLabel({ text:'Add New Chapter',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ a_topbar.add(a_viewTitle);
+ var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5});
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44});
+
+ var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Chapter',left:20,top:55,color:'black'});
+ var viewSubjectsViewTitle = Ti.UI.createTextField({top:80,height:44,right:12,left:12,color:'black'});
+
+
+ win.add(a_topbar);
+ win.add(viewSubjectsTitle);
+ win.add(viewSubjectsViewTitle);
+ win.add(closeButton);
+ win.add(navbarShadow);
+ viewSubjectsViewTitle.focus();
+ closeButton.addEventListener('click',function(){
+ if(viewSubjectsViewTitle.value == null){ } else {
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("INSERT INTO chapters (chapter,subject) VALUES (?,?)",viewSubjectsViewTitle.value,subjectId);
+ db.close();
+ }
+ viewSubjectsViewTitle.blur();
+ win.close();
+ });
+ return win;
+};
View
63 Resources/a_addnewflashcard.js
@@ -0,0 +1,63 @@
+var addFlashCardWindow = function(flashId,chapterId){
+
+ var win = Ti.UI.createWindow({backgroundColor:'#ccc'});
+
+ var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'});
+ var a_viewTitle = Ti.UI.createLabel({ text:'Flashcard',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ a_topbar.add(a_viewTitle);
+ var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5});
+ var saveButton = Ti.UI.createImageView({image:'a_save.png',top:9,right:5});
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44});
+
+ var viewFlashTitle = Ti.UI.createLabel({text:'Name',left:20,top:55,color:'black'});
+ var viewFlashTitleField = Ti.UI.createTextField({top:80,height:44,right:12,left:12,color:'black'});
+ var viewFlashDescription = Ti.UI.createLabel({text:'Description',left:20,top:130,color:'black'});
+ var viewFlashDescriptionField = Ti.UI.createTextArea({top:160,height:100,right:12,left:12,color:'black'});
+
+ win.add(a_topbar);
+ win.add(closeButton);
+ win.add(saveButton);
+ win.add(viewFlashTitle);
+ win.add(viewFlashTitleField);
+ win.add(viewFlashDescription);
+ win.add(viewFlashDescriptionField);
+ win.add(navbarShadow);
+
+
+ saveButton.addEventListener('click',function(){
+ viewFlashTitleField.blur();
+ viewFlashDescriptionField.blur();
+ if (flashId == 'null'){
+ var db1 = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db1.execute("INSERT INTO flashcards (name,description,chapter) VALUES (?,?,?)",viewFlashTitleField.value,viewFlashDescriptionField.value,chapterId);
+ db1.close();
+ win.close();
+ } else {
+ var db2 = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db2.execute("UPDATE flashcards set name = '"+viewFlashTitleField.value+"', description = '"+viewFlashDescriptionField.value+"' WHERE id ="+flashId);
+ db2.close();
+ win.close();
+ }
+ });
+
+ closeButton.addEventListener('click',function(){
+ viewFlashTitleField.blur();
+ viewFlashDescriptionField.blur();
+ win.close();
+ });
+
+
+ if (flashId != 'null'){
+
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var subjectName = db.execute("SELECT * FROM flashcards WHERE id = ?",flashId);
+ var thisName = subjectName.fieldByName('name');
+ var thisDescription = subjectName.fieldByName('description');
+ viewFlashTitleField.value = thisName;
+ viewFlashDescriptionField.value = thisDescription;
+ subjectName.close();
+ db.close();
+ }
+
+ return win;
+};
View
31 Resources/a_addsubjects.js
@@ -0,0 +1,31 @@
+var addSubjectsWindow = function(subjectId){
+ var win = Ti.UI.createWindow({backgroundColor:'#ccc'});
+
+ var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'});
+ var a_viewTitle = Ti.UI.createLabel({ text:'Add New Subject',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ a_topbar.add(a_viewTitle);
+ var closeButton = Ti.UI.createImageView({image:'a_close.png',top:9,left:5});
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44});
+
+ var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Subject',left:20,top:55,color:'black'});
+ var viewSubjectsViewTitle = Ti.UI.createTextField({top:80,height:44,right:12,left:12,color:'black'});
+
+
+ win.add(a_topbar);
+ win.add(viewSubjectsTitle);
+ win.add(viewSubjectsViewTitle);
+ win.add(closeButton);
+ win.add(navbarShadow);
+ viewSubjectsViewTitle.focus();
+ closeButton.addEventListener('click',function(){
+ viewSubjectsViewTitle.blur();
+ if(viewSubjectsViewTitle.value == null){ } else {
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("INSERT INTO subjects (subject) VALUES (?)",viewSubjectsViewTitle.value);
+ db.close();
+ }
+ win.close();
+ });
+
+ return win;
+};
View
BIN  Resources/a_bottombar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/a_byname.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/a_chaps.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/a_close.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
86 Resources/a_editlist.js
@@ -0,0 +1,86 @@
+var a_editList = function(){
+
+ var a_view = Ti.UI.createView({bottom:48});
+ var a_viewListTopbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'});
+ var a_viewTitle = Ti.UI.createLabel({ text:'Edit Subjects',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ var a_viewListTable = Ti.UI.createTableView({backgroundColor:'white',top:44});
+ var addButton = Ti.UI.createImageView({image:'a_add.png',top:9,right:5});
+ a_viewListTopbar.add(a_viewTitle);
+ a_view.add(a_viewListTopbar);
+ a_view.add(a_viewListTable);
+ a_view.add(addButton);
+
+ var timer;
+ var confirmDel = function(rowId,rowName) {
+ var msgTitle = "Delete Entire Subject";
+ var msgText = "Are you sure you want to delete the '"+rowName+"' subject?";
+ var statusAlert = Titanium.UI.createAlertDialog({title:msgTitle,message:msgText,buttonNames: ['Cancel','Ok']});
+ statusAlert.show();
+ statusAlert.addEventListener('click',function(e){
+ if (e.index == 0){statusAlert.hide();}
+ if (e.index == 1){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("DELETE FROM subjects WHERE id = ?", rowId);
+ db.close();
+ refresh();
+ }
+ });
+
+ };
+ var tapAndHold = function(e){
+ e.addEventListener('touchstart', function(e){
+ timer = setTimeout(function() {
+ confirmDel(e.source.rowId,e.source.rowName);
+ }, 500);
+ });
+ e.addEventListener('touchend', function(e){
+ clearTimeout(timer);
+ });
+ };
+
+ var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM subjects ORDER BY subject");
+ var x = 0;
+ while (rows.isValidRow()){
+ var subjectName = rows.fieldByName('subject');
+ var id = rows.fieldByName('id');
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',subjectId:id,subjectName:subjectName,hasChild:true});
+ var touchView = Ti.UI.createView({ rowId:id,rowName:subjectName,left:0, top:0, right:0, bottom:0 }); // invisible view to capture touch
+ var label = Ti.UI.createLabel({text:subjectName, left:10,color:'black'});
+ row.add(label);
+ row.add(touchView);
+ tapAndHold(row);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ a_viewListTable.data=data;
+ };
+ refresh();
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44});
+ a_view.add(navbarShadow);
+ var window;
+ addButton.addEventListener('click',function(){
+ window = addSubjectsWindow();
+ window.open();
+ window.addEventListener('close',function(){
+ refresh();
+ });
+
+ });
+
+ a_viewListTable.addEventListener('click',function(e){
+ window = addChapters(e.rowData.subjectId);
+ window.open();
+ window.addEventListener('close',function(){
+ refresh();
+ });
+
+ });
+
+
+ return a_view;
+};
View
BIN  Resources/a_random.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/a_save.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/a_tab1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/a_tab2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
63 Resources/a_viewchapters.js
@@ -0,0 +1,63 @@
+var viewChaptertWindow = function(subjectId){
+
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId);
+ var thisSubject = subjectName.fieldByName('subject');
+ subjectName.close();
+ db.close();
+
+ var chapsWin = Ti.UI.createWindow({backgroundColor:'#ccc'});
+
+ var a_viewListTopbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'});
+ var a_viewTitle = Ti.UI.createLabel({ text:'Chapters',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ a_viewListTopbar.add(a_viewTitle);
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44});
+
+ var backButton = Ti.UI.createImageView({image:'subjects-back.png',top:9,left:5});
+
+ var viewSubjectsTitle = Ti.UI.createLabel({text:'Name of Subject',left:20,top:55,color:'black'});
+ var viewSubjectsView = Ti.UI.createView({backgroundColor:'white',left:10,right:10,height:40,top:80,borderColor:'#ababab',borderWidth:1,borderRadius:7});
+ var viewSubjectsViewTitle = Ti.UI.createLabel({text:thisSubject,left:12,color:'black'});
+ viewSubjectsView.add(viewSubjectsViewTitle);
+
+ var chaptersTitle = Ti.UI.createLabel({text:'Chapters',left:20,top:130,color:'black'});
+
+ var chaptersTable = Ti.UI.createTableView({top:160,left:10,right:10,height:'auto',borderColor:'#ababab',borderWidth:1,borderRadius:7,backgroundColor:'white'});
+ var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId);
+ var x = 0;
+ while (rows.isValidRow()){
+ var chapterName = rows.fieldByName('chapter');
+ var id = rows.fieldByName('id');
+ var row = Ti.UI.createTableViewRow({chapterId:id,chapterName:chapterName,hasChild:true});
+ var label = Ti.UI.createLabel({text:chapterName, left:10,height:20,color:'black'});
+ row.add(label);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ chaptersTable.data=data;
+ };
+ refresh();
+
+ chaptersTable.addEventListener('click',function(e){
+ flashCardsWindow(e.rowData.chapterName,e.rowData.chapterId).open();
+ });
+
+
+ chapsWin.add(a_viewListTopbar);
+ chapsWin.add(backButton);
+ chapsWin.add(navbarShadow);
+ chapsWin.add(viewSubjectsTitle);
+ chapsWin.add(viewSubjectsView);
+ chapsWin.add(chaptersTitle);
+ chapsWin.add(chaptersTable);
+
+ backButton.addEventListener('click',function(){
+ chapsWin.close();
+ });
+ return chapsWin;
+};
View
110 Resources/a_viewflascards.js
@@ -0,0 +1,110 @@
+var flashCardsWindow = function(title,chapterId){
+ var win = Ti.UI.createWindow({backgroundColor:'#ccc'});
+
+ var a_topbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'});
+ var a_bottombar = Ti.UI.createView({left:0,right:0,bottom:0,height:47,backgroundImage:'a_bottombar.png'});
+ var a_viewTitle = Ti.UI.createLabel({ text:'Chapters',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ a_topbar.add(a_viewTitle);
+ var backButton = Ti.UI.createImageView({image:'a_chaps.png',top:9,left:5});
+ var flipButton = Ti.UI.createButton({backgroundImage:'flip.png',top:9,right:5,width:48,height:30});
+ var randButton = Ti.UI.createButton({backgroundImage:'a_random.png',bottom:8,left:5,width:99,height:30});
+ var nameButton = Ti.UI.createButton({backgroundImage:'a_byname.png',bottom:8,right:5,width:99,height:30});
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44});
+
+ var totalViews1 = [];
+ var totalViews2 = [];
+ var mainView = Ti.UI.createView({left:5,right:5});
+ var scrollView1 = Ti.UI.createScrollableView({top:49,bottom:54,left:10,right:10});
+ var scrollView2 = Ti.UI.createScrollableView({top:49,bottom:54,left:10,right:10});
+ var dubleTapping = function(e){
+ e.addEventListener('doubletap',function(){
+ flip();
+ });
+ };
+ var refresh = function(order){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var flashcardsName;
+ if (order == 'random'){
+ flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY RANDOM()",chapterId);
+ } else if (order == 'name'){
+ flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY name",chapterId);
+ } else {
+ flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ?",chapterId);
+ }
+
+ var x = 0;
+ while (flashcardsName.isValidRow()){
+ var flashName = flashcardsName.fieldByName('name');
+ var flashDescription = flashcardsName.fieldByName('description');
+ var id = flashcardsName.fieldByName('id');
+
+ var flashNumber1 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right',color:'black'});
+ var flashView1 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',page:1,borderColor:'#999',borderRadius:5});
+ var flashTitle1 = Ti.UI.createLabel({text:flashName,textAlign:'center',color:'black',font:{fontWeight:'bold',fontSize:20}});
+ flashView1.add(flashNumber1);
+ flashView1.add(flashTitle1);
+ dubleTapping(flashView1);
+ var flashNumber2 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right',color:'black'});
+ var flashView2 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',backgroundImage:'flashcard.png',page:2,borderColor:'#999',borderRadius:5});
+ var flashTitle2 = Ti.UI.createLabel({text:flashDescription,textAlign:'left',left:20,right:20,font:{fontWeight:'bold',fontSize:16},color:'black'});
+ flashView2.add(flashNumber2);
+ flashView2.add(flashTitle2);
+ dubleTapping(flashView2);
+
+ totalViews1[x] = flashView1;
+ totalViews2[x++] = flashView2;
+ flashcardsName.next();
+ };
+ flashcardsName.close();
+ db.close();
+ scrollView1.views = totalViews1;
+ scrollView2.views = totalViews2;
+ };
+ refresh();
+ win.add(a_topbar);
+ win.add(a_bottombar);
+ win.add(navbarShadow);
+
+ win.add(scrollView1);
+ win.add(backButton);
+ win.add(randButton);
+ win.add(nameButton);
+ win.add(flipButton);
+
+ var pageDisplay = 1;
+ var flip = function(){
+ switch (pageDisplay){
+ case 1:
+ scrollView2.currentPage = scrollView1.currentPage;
+ win.remove(scrollView1);
+ win.add(scrollView2);
+ pageDisplay = 2;
+ break;
+ case 2:
+ scrollView1.currentPage = scrollView2.currentPage;
+ win.remove(scrollView2);
+ win.add(scrollView1);
+ pageDisplay = 1;
+ break;
+ }
+ };
+
+
+ flipButton.addEventListener('click',function(){
+ flip();
+ });
+
+ randButton.addEventListener('click',function(){
+ refresh('random');
+ });
+
+ nameButton.addEventListener('click',function(){
+ refresh('name');
+ });
+
+ backButton.addEventListener('click',function(){
+ win.close();
+ });
+
+ return win;
+};
View
36 Resources/a_viewlist.js
@@ -0,0 +1,36 @@
+var a_viewList = function(){
+
+ var a_view = Ti.UI.createView({bottom:48});
+ var a_viewListTopbar = Ti.UI.createView({left:0,right:0,top:0,height:44,backgroundImage:'navbarbg.png'});
+ var a_viewTitle = Ti.UI.createLabel({ text:'Subjects',color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ var a_viewListTable = Ti.UI.createTableView({backgroundColor:'white',top:44});
+ a_viewListTopbar.add(a_viewTitle);
+ a_view.add(a_viewListTopbar);
+ a_view.add(a_viewListTable);
+ var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM subjects ORDER BY subject");
+ var x = 0;
+ while (rows.isValidRow()){
+ var subjectName = rows.fieldByName('subject');
+ var id = rows.fieldByName('id');
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',subjectId:id,subjectName:subjectName,hasChild:true});
+ var label = Ti.UI.createLabel({text:subjectName, left:10,color:'black'});
+ row.add(label);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ a_viewListTable.data=data;
+ };
+ refresh();
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:1024, height:11,top:44});
+ a_view.add(navbarShadow);
+ a_viewListTable.addEventListener('click',function(e){
+ viewChaptertWindow(e.rowData.subjectId).open();
+ });
+
+ return a_view;
+};
View
106 Resources/addchapter.js
@@ -0,0 +1,106 @@
+var addChaptertWindow = function(subjectId){
+
+ var win = Ti.UI.createWindow({color:'#61290C',title:'Add Chapters',barImage:'navbarbg.png',barColor:'#D0A159'});
+ var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ win.titleControl = customhead;
+
+ win.hideTabBar();
+
+
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId);
+ var thisSubject = subjectName.fieldByName('subject');
+ subjectName.close();
+ db.close();
+
+
+ var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false});
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Name of Subject'});
+ var label = Ti.UI.createTextField({left:10,right:10,value:thisSubject});
+ var data = [];
+ row.add(label);
+ data[0] = row;
+ addSubjectsView.data = data;
+
+ var chaptersTable = Ti.UI.createTableView({top:90,style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',editable:true});
+
+ var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId);
+ var x = 0;
+ while (rows.isValidRow()){
+ var chapterName = rows.fieldByName('chapter');
+ var id = rows.fieldByName('id');
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',chapterId:id,chapterName:chapterName,hasChild:true});
+ if (x == 0){ row.header='Chapters';}
+ var label = Ti.UI.createLabel({text:chapterName, left:10,height:20});
+ row.add(label);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ row = Ti.UI.createTableViewRow({backgroundColor:'white',chapterName:'addChapter',header:''});
+ label = Ti.UI.createLabel({text:'Add Chapter',textAlign:'center'});
+ row.add(label);
+ data[data.length] = row;
+ chaptersTable.data=data;
+ };
+ chaptersTable.addEventListener('click',function(e){
+ var window;
+ if (e.rowData.chapterName == 'addChapter'){
+ window = addNewChapterWindow();
+ window.open({modal:true});
+ window.addEventListener('close',function(){
+ Ti.UI.currentTab.close(window);
+ if(window.addChapter=='true'){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("INSERT INTO chapters (chapter,subject) VALUES (?,?)",window.chapterValue,subjectId);
+ db.close();
+ refresh();
+ }
+ });
+
+
+ }
+ if (e.rowData.hasChild){
+ var thisId = e.rowData.chapterId;
+ window = flashCardsWindow(e.rowData.chapterName,thisId);
+ Ti.UI.currentTab.open(window);
+ window.addEventListener('close',function(){
+ Ti.UI.currentTab.close(window);
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("UPDATE chapters SET chapter = '"+window.title+"' WHERE id = "+thisId);
+ db.close();
+ refresh();
+ });
+ }
+ });
+
+ win.nameOfSubject=label.value;
+
+ label.addEventListener('change',function(){
+ win.nameOfSubject=label.value;
+ win.title=label.value;
+ });
+
+ chaptersTable.addEventListener('delete',function(e){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("DELETE FROM chapters WHERE id = ?", e.rowData.chapterId);
+ db.close();
+
+ });
+
+
+ refresh();
+
+ win.add(addSubjectsView);
+ win.add(chaptersTable);
+
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0});
+ win.add(navbarShadow);
+ win.orientationModes = [Titanium.UI.PORTRAIT];
+
+ return win;
+};
View
55 Resources/addflashcard-old.js
@@ -0,0 +1,55 @@
+var addFlashCardWindow = function(flashId,chapterId){
+ var win = Ti.UI.createWindow({color:'#61290C',title:'Add New Chapter',barImage:'navbarbg.png',barColor:'#D0A159',backgroundColor:'#ccc'});
+ var closeButton = Ti.UI.createButton({title:'cancel'});
+ var saveButton = Ti.UI.createButton({title:'save'});
+ win.leftNavButton=closeButton;
+ win.rightNavButton=saveButton;
+ var addName = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',top:0,height:90});
+
+ var data = [];
+ var row = Ti.UI.createTableViewRow({header:'Name',backgroundColor:'white'});
+ var label = Ti.UI.createTextField({left:10,right:10,hintText:'Name'});
+ row.add(label);
+ data[0] = row;
+ var contentLabel=Ti.UI.createLabel({text:'Defenition', height:30,textAlign:'left',top:90,width:300,left:20,color:'#4c566c',shadowColor:'white',shadowOffset:{x:0,y:1},font:{fontFamily:'Arial-BoldMT',fontSize:17}});
+ var label2 = Ti.UI.createTextArea({top:120,width:320,height:100,hintText:'Description',backgroundColor:'white',suppressReturn:false});
+
+ addName.data = data;
+ win.add(addName);
+ win.add(label2);
+ win.add(contentLabel);
+
+ saveButton.addEventListener('click',function(){
+ if (flashId == 'null'){
+ var db1 = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db1.execute("INSERT INTO flashcards (name,description,chapter) VALUES (?,?,?)",label1.value,label2.value,chapterId);
+ db1.close();
+ win.close();
+ } else {
+ var db2 = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db2.execute("UPDATE flashcards set name = '"+label1.value+"', description = '"+label2.value+"' WHERE id ="+flashId);
+ db2.close();
+ win.close();
+ }
+ });
+
+ closeButton.addEventListener('click',function(){
+ win.close();
+ });
+
+
+ if (flashId != 'null'){
+
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var subjectName = db.execute("SELECT * FROM flashcards WHERE id = ?",flashId);
+ var thisName = subjectName.fieldByName('name');
+ var thisDescription = subjectName.fieldByName('description');
+ label1.value = thisName;
+ label2.value = thisDescription;
+ subjectName.close();
+ db.close();
+ }
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0});
+ win.add(navbarShadow);
+ return win;
+};
View
86 Resources/addflashcard.js
@@ -0,0 +1,86 @@
+var addFlashCardWindow = function(flashId,chapterId){
+ var win = Ti.UI.createWindow({color:'#61290C',title:'Add New Flash Card',barImage:'navbarbg.png',barColor:'#D0A159'});
+
+ var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:18}});
+ win.titleControl = customhead;
+
+ var closeButton = Ti.UI.createButton({title:'cancel'});
+ var saveButton = Ti.UI.createButton({title:'save'});
+ var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc'});
+ win.leftNavButton=closeButton;
+ win.rightNavButton=saveButton;
+
+ var data = [];
+ var row1 = Ti.UI.createTableViewRow({header:'Name',backgroundColor:'white'});
+ var label1 = Ti.UI.createTextField({left:10,right:10,hintText:'Name'});
+ row1.add(label1);
+ data[0] = row1;
+
+ var row2 = Ti.UI.createTableViewRow({header:'Description',height:100,backgroundColor:'white'});
+ var label2 = Ti.UI.createTextArea({left:10,bottom:10,top:10,right:10,font:{fontSize:15},backgroundColor:'white',suppressReturn:false});
+ row2.add(label2);
+ data[1] = row2;
+
+ // this still needs to be fixed
+ var row3 = Ti.UI.createTableViewRow({header:'',height:80,backgroundImage:''});
+ data[2] = row3;
+ // ---------------------------
+
+ addSubjectsView.data = data;
+ win.add(addSubjectsView);
+
+ saveButton.addEventListener('click',function(){
+ if (flashId == 'null'){
+ var db1 = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db1.execute("INSERT INTO flashcards (name,description,chapter) VALUES (?,?,?)",label1.value,label2.value,chapterId);
+ db1.close();
+ win.close();
+ } else {
+ var db2 = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db2.execute("UPDATE flashcards set name = '"+label1.value+"', description = '"+label2.value+"' WHERE id ="+flashId);
+ db2.close();
+ win.close();
+ }
+ });
+
+ closeButton.addEventListener('click',function(){
+ win.close();
+ });
+
+
+ if (flashId != 'null'){
+
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var subjectName = db.execute("SELECT * FROM flashcards WHERE id = ?",flashId);
+ var thisName = subjectName.fieldByName('name');
+ var thisDescription = subjectName.fieldByName('description');
+ label1.value = thisName;
+ label2.value = thisDescription;
+ subjectName.close();
+ db.close();
+ }
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:'480', height:11,top:0});
+ win.add(navbarShadow);
+ win.orientationModes = [
+ Titanium.UI.PORTRAIT,
+ Titanium.UI.LANDSCAPE_LEFT,
+ Titanium.UI.LANDSCAPE_RIGHT
+ ];
+ if (Ti.UI.orientation == 3 || Ti.UI.orientation == 4){
+ win.barImage='navbarbg-landscape.png';
+ }
+ if (Ti.UI.orientation == 1 || Ti.UI.orientation == 2){
+ win.barImage='navbarbg.png';
+ }
+
+ Ti.Gesture.addEventListener('orientationchange', function(e){
+ if (e.orientation == 3 || e.orientation == 4){
+ win.barImage='navbarbg-landscape.png';
+ }
+ if (e.orientation == 1 || e.orientation == 2){
+ win.barImage='navbarbg.png';
+ }
+ });
+
+ return win;
+};
View
35 Resources/addnewchapter.js
@@ -0,0 +1,35 @@
+var addNewChapterWindow = function(){
+ var win = Ti.UI.createWindow({color:'#61290C',title:'Add New Chapter', url:'addnewchapter.js',barImage:'navbarbg.png',barColor:'#D0A159'});
+ var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ win.titleControl = customhead;
+
+ var closeButton = Ti.UI.createButton({title:'cancel'});
+ var saveButton = Ti.UI.createButton({title:'save'});
+ win.leftNavButton=closeButton;
+ win.rightNavButton=saveButton;
+ var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false});
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Name of Chapter'});
+ var label = Ti.UI.createTextField({left:10,right:10,hintText:'Subject'});
+ var data = [];
+ row.add(label);
+ data[0] = row;
+ addSubjectsView.data = data;
+ win.add(addSubjectsView);
+ label.focus();
+
+ closeButton.addEventListener('click', function(){
+ win.close();
+ });
+ saveButton.addEventListener('click', function(){
+ if (label.value){
+ win.addChapter='true';
+ }
+ win.chapterValue=label.value;
+ win.close();
+ });
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0});
+ win.add(navbarShadow);
+ win.orientationModes = [Titanium.UI.PORTRAIT];
+
+ return win;
+};
View
36 Resources/addsubject.js
@@ -0,0 +1,36 @@
+var addSubjectWindow = function(){
+ var win = Ti.UI.createWindow({color:'#61290C',title:'Add New Subject'});
+ var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ win.titleControl = customhead;
+
+ win.barImage='navbarbg.png';
+ win.barColor='#D0A159';
+ win.hideTabBar();
+
+ var closeButton = Ti.UI.createButton({title:'close'});
+ win.leftNavButton=closeButton;
+
+ var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false});
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Name of Subject'});
+ var label = Ti.UI.createTextField({left:10,right:10,hintText:'Subject'});
+ var data = [];
+ row.add(label);
+ data[0] = row;
+ addSubjectsView.data = data;
+ win.add(addSubjectsView);
+ //label.focus();
+
+ label.addEventListener('change', function(){
+ win.nameOfSubject=label.value;
+ });
+
+ closeButton.addEventListener('click',function(){
+ win.close();
+ });
+
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0});
+ win.add(navbarShadow);
+ win.orientationModes = [Titanium.UI.PORTRAIT];
+
+ return win;
+};
View
BIN  Resources/android/.DS_Store
Binary file not shown
View
BIN  Resources/android/appicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/android/default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
89 Resources/app.js
@@ -0,0 +1,89 @@
+
+Titanium.UI.setBackgroundColor('#000');
+if (Ti.Platform.name != 'android'){
+ var tabGroup = Titanium.UI.createTabGroup();
+
+ var win1 = Titanium.UI.createWindow({color:'#61290C', url:'viewlist.js',title:'Subjects',barImage:'navbarbg.png',barColor:'#D0A159' });
+ var tab1 = Titanium.UI.createTab({
+ icon:'icon1.png',
+ title:'Study',
+ window:win1
+ });
+
+ var win2 = Titanium.UI.createWindow({color:'#61290C', url:'editlist.js',title:'Subjects',barImage:'navbarbg.png',barColor:'#D0A159' });
+ var tab2 = Titanium.UI.createTab({
+ icon:'icon2.png',
+ title:'Edit Subjects',
+ window:win2
+ });
+
+ tabGroup.addTab(tab1);
+ tabGroup.addTab(tab2);
+
+
+ tabGroup.open();
+}
+else {
+
+ Ti.include('a_viewlist.js');
+ Ti.include('a_editlist.js');
+ Ti.include('a_viewchapters.js');
+ Ti.include('a_viewflascards.js');
+ Ti.include('a_addsubjects.js');
+ Ti.include('a_addchapters.js');
+ Ti.include('a_addnewchapter.js');
+ Ti.include('a_addflashcards.js');
+ Ti.include('extras.js');
+ Ti.include('a_addnewflashcard.js');
+
+
+ var a_mainWindow = Ti.UI.createWindow({backgroundColor:'white'});
+ var a_bottomTabs = Ti.UI.createView({left:0, right:0, height:48, bottom:0, backgroundImage:'a_tab2.png' });
+ var a_bottomTab1 = Ti.UI.createView({left:20, width:120, height:48, bottom:0, backgroundImage:'a_tab1.png' });
+ var a_bottomTab2 = Ti.UI.createView({right:20, width:120, height:48, bottom:0 });
+
+ var a_bottomTab1Image = Ti.UI.createImageView({image:'icon1s.png',bottom:18});
+ var a_bottomTab2Image = Ti.UI.createImageView({image:'icon2.png',bottom:18});
+
+
+ var a_bottomTab1Text = Ti.UI.createLabel({text:'Study',bottom:0,color:'white'});
+ var a_bottomTab2Text = Ti.UI.createLabel({text:'Edit Subjects',bottom:0,color:'white'});
+
+ a_bottomTab1.add(a_bottomTab1Text);
+ a_bottomTab2.add(a_bottomTab2Text);
+
+ a_bottomTab1.add(a_bottomTab1Image);
+ a_bottomTab2.add(a_bottomTab2Image);
+
+ a_mainWindow.add(a_viewList());
+ a_bottomTabs.add(a_bottomTab1);
+ a_bottomTabs.add(a_bottomTab2);
+ a_mainWindow.add(a_bottomTabs);
+
+ a_mainWindow.open();
+// var width = (a_mainWindow.size.width/2);
+
+ a_bottomTab1.addEventListener('click',function(){
+ a_bottomTab1.backgroundImage='a_tab1.png';
+ a_bottomTab2.backgroundImage=null;
+ a_bottomTab1Image.image='icon1s.png';
+ a_bottomTab2Image.image='icon2.png';
+ a_bottomTab1Text.color='white';
+ a_bottomTab2Text.color='#999';
+ a_mainWindow.remove(a_editList());
+ a_mainWindow.add(a_viewList());
+ });
+ a_bottomTab2.addEventListener('click',function(){
+ a_bottomTab2.backgroundImage='a_tab1.png';
+ a_bottomTab1.backgroundImage=null;
+ a_bottomTab1Image.image='icon1.png';
+ a_bottomTab2Image.image='icon2s.png';
+ a_bottomTab1Text.color='#999';
+ a_bottomTab2Text.color='white';
+ a_mainWindow.remove(a_viewList());
+ a_mainWindow.add(a_editList());
+ });
+ a_mainWindow.addEventListener('focus',function(){
+ alert(a_mainWindow.toImage().width);
+ });
+}
View
BIN  Resources/appicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/edit_layout.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
76 Resources/editlist.js
@@ -0,0 +1,76 @@
+Ti.include('addchapter.js');
+Ti.include('addnewchapter.js');
+Ti.include('flashcardsedit.js');
+Ti.include('addflashcard.js');
+Ti.include('addsubject.js');
+
+var win = Titanium.UI.currentWindow;
+var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+win.titleControl = customhead;
+var addSubject = Ti.UI.createButton({title:'Add'});
+var listOfSubjects = Ti.UI.createTableView({editable:true});
+win.rightNavButton = addSubject;
+win.add(listOfSubjects);
+var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0});
+win.add(navbarShadow);
+
+
+var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM subjects ORDER BY subject");
+ var x = 0;
+ while (rows.isValidRow()){
+ var subjectName = rows.fieldByName('subject');
+ var id = rows.fieldByName('id');
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',subjectId:id,subjectName:subjectName});
+ var label = Ti.UI.createLabel({text:subjectName, left:10});
+ row.add(label);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ listOfSubjects.data=data;
+};
+
+refresh();
+
+
+addSubject.addEventListener('click', function(){
+
+ var window = addSubjectWindow();
+ window.open({modal:true});
+ window.addEventListener('close',function(){
+ Ti.UI.currentTab.close(window);
+ if(window.nameOfSubject == null){ } else {
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("INSERT INTO subjects (subject) VALUES (?)",window.nameOfSubject);
+ db.close();
+ refresh();
+ }
+ });
+
+});
+
+listOfSubjects.addEventListener('delete',function(e){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("DELETE FROM subjects WHERE id = ?", e.rowData.subjectId);
+ db.close();
+});
+listOfSubjects.addEventListener('click',function(e){
+
+
+ var window = addChaptertWindow(e.rowData.subjectId);
+ Ti.UI.currentTab.open(window);
+
+ window.addEventListener('close',function(){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("UPDATE subjects SET subject = '"+window.nameOfSubject+"' WHERE id = "+e.rowData.subjectId);
+ db.close();
+ refresh();
+ });
+
+
+});
+win.orientationModes = [Titanium.UI.PORTRAIT];
View
0  Resources/extras.js
No changes.
View
BIN  Resources/flashcard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/flashcards.sqlite
Binary file not shown
View
79 Resources/flashcardsedit.js
@@ -0,0 +1,79 @@
+var flashCardsWindow = function(title,chapterId){
+
+ var win = Ti.UI.createWindow({color:'#61290C',title:title ,chapterId:chapterId,barImage:'navbarbg.png',barColor:'#D0A159'});
+ var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ win.titleControl = customhead;
+
+ var addButton = Ti.UI.createButton({title:'add'});
+ win.rightNavButton=addButton;
+
+ var chapterView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false});
+ var row1 = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Chapter'});
+ var label1 = Ti.UI.createTextField({left:10,right:10,value:win.title});
+ var data = [];
+ row1.add(label1);
+ data[0] = row1;
+ chapterView.data = data;
+
+
+ var flashCardsTable = Ti.UI.createTableView({top:90,editable:true});
+
+ var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM flashcards WHERE chapter = '"+chapterId+"' ORDER BY id");
+ var x = 0;
+ while (rows.isValidRow()){
+ var flashName = rows.fieldByName('name');
+ var id = rows.fieldByName('id');
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',flashId:id,flashName:flashName,hasChild:true});
+ var label = Ti.UI.createLabel({text:flashName, left:10});
+ row.add(label);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ flashCardsTable.data=data;
+ };
+ refresh();
+
+ win.add(chapterView);
+ win.add(flashCardsTable);
+
+ addButton.addEventListener('click',function(e){
+ var window = addFlashCardWindow('null',chapterId);
+ Ti.UI.currentTab.open(window);
+ window.addEventListener('close',function(){
+ Ti.UI.currentTab.close(window);
+ refresh();
+ });
+ });
+
+ label1.addEventListener('change', function(){
+ win.title=label1.value;
+ });
+
+
+ flashCardsTable.addEventListener('click',function(e){
+ var window = addFlashCardWindow(e.rowData.flashId,'null');
+ Ti.UI.currentTab.open(window);
+ window.addEventListener('close',function(){
+ Ti.UI.currentTab.close(window);
+ refresh();
+ });
+ });
+
+
+ flashCardsTable.addEventListener('delete',function(e){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ db.execute("DELETE FROM flashcards WHERE id = ?", e.rowData.flashId);
+ db.close();
+
+ });
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0});
+ win.add(navbarShadow);
+ win.orientationModes = [Titanium.UI.PORTRAIT];
+ return win;
+
+};
View
BIN  Resources/flip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/flip1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/flip2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/icon1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/icon1s.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/icon2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/icon2s.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/iphone/.DS_Store
Binary file not shown
View
BIN  Resources/iphone/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/iphone/appicon.png
Diff not rendered
View
BIN  Resources/iphone/default_app_logo.png
Diff not rendered
View
BIN  Resources/nav-bar-shadow.png
Diff not rendered
View
BIN  Resources/nav-bar-shadow@2x.png
Diff not rendered
View
BIN  Resources/nav-button-press.png
Diff not rendered
View
BIN  Resources/nav-button-press@2x.png
Diff not rendered
View
BIN  Resources/navbarbg-landscape.png
Diff not rendered
View
BIN  Resources/navbarbg-landscape@2x.png
Diff not rendered
View
BIN  Resources/navbarbg.png
Diff not rendered
View
BIN  Resources/navbarbg@2x.png
Diff not rendered
View
BIN  Resources/subjects-back.png
Diff not rendered
View
57 Resources/viewchapter.js
@@ -0,0 +1,57 @@
+var viewChaptertWindow = function(subjectId){
+ var win = Ti.UI.createWindow({color:'#61290C',title:'Chapters',barImage:'navbarbg.png',barColor:'#D0A159'});
+ var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ win.titleControl = customhead;
+
+ win.hideTabBar();
+
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var subjectName = db.execute("SELECT * FROM subjects WHERE id = ?",subjectId);
+ var thisSubject = subjectName.fieldByName('subject');
+ subjectName.close();
+ db.close();
+
+ var addSubjectsView = Ti.UI.createTableView({style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc',scrollable:false});
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',header:'Name of Subject'});
+ var label = Ti.UI.createLabel({left:10,right:10,text:thisSubject});
+ var data = [];
+ row.add(label);
+ data[0] = row;
+ addSubjectsView.data = data;
+
+ var chaptersTable = Ti.UI.createTableView({top:90,style:Ti.UI.iPhone.TableViewStyle.GROUPED,backgroundColor:'#ccc'});
+ var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM chapters WHERE subject = ? ORDER BY chapter",subjectId);
+ var x = 0;
+ while (rows.isValidRow()){
+ var chapterName = rows.fieldByName('chapter');
+ var id = rows.fieldByName('id');
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',chapterId:id,chapterName:chapterName,hasChild:true});
+ if (x == 0){row.header='Chapters';}
+ var label = Ti.UI.createLabel({text:chapterName, left:10,height:20});
+ row.add(label);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ chaptersTable.data=data;
+ };
+ refresh();
+ chaptersTable.addEventListener('click',function(e){
+ var window = flashCardsWindow(e.rowData.chapterName,e.rowData.chapterId);
+ Ti.UI.currentTab.open(window);
+ });
+
+
+ win.add(addSubjectsView);
+ win.add(chaptersTable);
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0});
+ win.add(navbarShadow);
+ win.orientationModes = [Titanium.UI.PORTRAIT];
+
+
+ return win;
+};
View
123 Resources/viewflashcards.js
@@ -0,0 +1,123 @@
+var flashCardsWindow = function(title,chapterId){
+ var win = Ti.UI.createWindow({color:'#61290C',title:title,barImage:'navbarbg.png', barColor:'#D0A159',backgroundColor:'#ccc'});
+ var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+ win.titleControl = customhead;
+
+
+ var flipButton = Ti.UI.createButton({title:'flip',style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED});
+ var randButton = Ti.UI.createButton({title:'random order',style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED});
+ var flexSpace = Titanium.UI.createButton({systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE});
+
+ var nameButton = Ti.UI.createButton({title:'order by name',style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED});
+ var toolbar = Ti.UI.createToolbar({bottom:0,barColor:'#1b242a',items:[randButton,flexSpace,nameButton]});
+ win.rightNavButton=flipButton;
+ var totalViews1 = [];
+ var totalViews2 = [];
+ var mainView = Ti.UI.createView({});
+ var scrollView1 = Ti.UI.createScrollableView({top:10,bottom:54});
+ var scrollView2 = Ti.UI.createScrollableView({top:10,bottom:54});
+ var refresh = function(order){
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var flashcardsName;
+ if (order == 'random'){
+ flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY RANDOM()",chapterId);
+ } else if (order == 'name'){
+ flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ? ORDER BY name",chapterId);
+ } else {
+ flashcardsName = db.execute("SELECT * FROM flashcards WHERE chapter = ?",chapterId);
+ }
+
+ var x = 0;
+ while (flashcardsName.isValidRow()){
+ var flashName = flashcardsName.fieldByName('name');
+ var flashDescription = flashcardsName.fieldByName('description');
+ var id = flashcardsName.fieldByName('id');
+
+ var flashNumber1 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right'});
+ var flashView1 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',page:1,borderColor:'#999',borderRadius:5});
+ var flashTitle1 = Ti.UI.createLabel({text:flashName,textAlign:'center',color:'black',font:{fontWeight:'bold',fontSize:20}});
+ flashView1.add(flashNumber1);
+ flashView1.add(flashTitle1);
+
+ var flashNumber2 = Ti.UI.createLabel({text:'#'+(x+1),top:10,right:10,width:300,height:20,textAlign:'right'});
+ var flashView2 = Ti.UI.createView({left:10, right:10,top:0,bottom:0,backgroundColor:'white',backgroundImage:'flashcard.png',page:2,borderColor:'#999',borderRadius:5});
+ var flashTitle2 = Ti.UI.createLabel({text:flashDescription,textAlign:'left',left:20,right:20,font:{fontWeight:'bold',fontSize:16}});
+ flashView2.add(flashNumber2);
+ flashView2.add(flashTitle2);
+
+ totalViews1[x] = flashView1;
+ totalViews2[x++] = flashView2;
+ flashcardsName.next();
+ };
+ flashcardsName.close();
+ db.close();
+ scrollView1.views = totalViews1;
+ scrollView2.views = totalViews2;
+
+ };
+ refresh();
+
+ mainView.add(scrollView1);
+ win.add(mainView);
+ win.add(toolbar);
+
+
+ var pageDisplay = 1;
+ var flip = function(){
+ switch (pageDisplay){
+ case 1:
+ scrollView2.currentPage = scrollView1.currentPage;
+ var animation2 = Ti.UI.createAnimation({view:scrollView2,transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT,duration: 500});
+ mainView.animate(animation2);
+ pageDisplay = 2;
+ break;
+ case 2:
+ scrollView1.currentPage = scrollView2.currentPage;
+ var animation1 = Ti.UI.createAnimation({view:scrollView1,transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_RIGHT,duration: 500});
+ mainView.animate(animation1);
+ pageDisplay = 1;
+ break;
+ }
+ };
+
+ flipButton.addEventListener('click',function(){
+ flip();
+ });
+ scrollView2.addEventListener('doubletap',function(){
+ flip();
+ });
+ scrollView1.addEventListener('doubletap',function(){
+ flip();
+ });
+ randButton.addEventListener('click',function(){
+ refresh('random');
+ });
+ nameButton.addEventListener('click',function(){
+ refresh('name');
+ });
+ var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0});
+ win.add(navbarShadow);
+
+ win.orientationModes = [
+ Titanium.UI.PORTRAIT,
+ Titanium.UI.LANDSCAPE_LEFT,
+ Titanium.UI.LANDSCAPE_RIGHT
+ ];
+ if (Ti.UI.orientation == 3 || Ti.UI.orientation == 4){
+ win.barImage='navbarbg-landscape.png';
+ }
+ if (Ti.UI.orientation == 1 || Ti.UI.orientation == 2){
+ win.barImage='navbarbg.png';
+ }
+
+ Ti.Gesture.addEventListener('orientationchange', function(e){
+ if (e.orientation == 3 || e.orientation == 4){
+ win.barImage='navbarbg-landscape.png';
+ }
+ if (e.orientation == 1 || e.orientation == 2){
+ win.barImage='navbarbg.png';
+ }
+ });
+
+ return win;
+};
View
42 Resources/viewlist.js
@@ -0,0 +1,42 @@
+Ti.include('viewchapter.js');
+Ti.include('viewflashcards.js');
+
+var win = Ti.UI.currentWindow;
+var customhead = Ti.UI.createLabel({ text:win.title,color:'#61290C',height:30,font:{fontFamily:'Arial-BoldMT',fontSize:20}});
+win.titleControl = customhead;
+
+win.barImage='navbarbg.png';
+win.barColor='#D0A159';
+
+var listOfSubjects = Ti.UI.createTableView({});
+win.add(listOfSubjects);
+var navbarShadow = Ti.UI.createImageView({backgroundImage:'nav-bar-shadow.png', width:480, height:11,top:0});
+win.add(navbarShadow);
+
+
+var refresh = function(){
+ var data = [];
+ var db = Titanium.Database.install('flashcards.sqlite', 'flash1');
+ var rows = db.execute("SELECT * FROM subjects ORDER BY subject");
+ var x = 0;
+ while (rows.isValidRow()){
+ var subjectName = rows.fieldByName('subject');
+ var id = rows.fieldByName('id');
+ var row = Ti.UI.createTableViewRow({backgroundColor:'white',subjectId:id,subjectName:subjectName});
+ var label = Ti.UI.createLabel({text:subjectName, left:10});
+ row.add(label);
+ data[x++] = row;
+ rows.next();
+ };
+ rows.close();
+ db.close();
+ listOfSubjects.data=data;
+};
+win.addEventListener('focus', function(){
+ refresh();
+});
+
+listOfSubjects.addEventListener('click',function(e){
+ var window = viewChaptertWindow(e.rowData.subjectId);
+ Ti.UI.currentTab.open(window);
+});
Please sign in to comment.
Something went wrong with that request. Please try again.