Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Multi-User and progress tracking functionality #18

Open
wants to merge 108 commits into
base: newmaster
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
0d06f85
Added gamesClearedInTotal to the UserDefault database
onetruffle May 29, 2019
e638e42
Added progress columns
onetruffle May 29, 2019
569ca00
Granted mainapp resource permissions to the launcher
onetruffle May 29, 2019
fd5926b
Correction about sharedUserId
onetruffle May 30, 2019
da02526
Add columns
onetruffle May 30, 2019
ce423b8
Added coins to the table
onetruffle May 30, 2019
ec329d0
Added progress variable to each user
onetruffle May 30, 2019
795b032
Revert "Correction about sharedUserId"
onetruffle May 30, 2019
651c195
Revert "Granted mainapp resource permissions to the launcher"
onetruffle May 30, 2019
9be55d1
Minor changes
onetruffle May 30, 2019
b48fa21
Changes
May 30, 2019
c505118
Changes
May 30, 2019
f2c112b
Changes
May 30, 2019
70fadf1
Very minor changes
May 31, 2019
25f2183
Revert "Changes"
onetruffle May 31, 2019
6fbad45
Minor Change
May 31, 2019
6373745
Fix sharedUserId for access
onetruffle May 31, 2019
c3d9ac8
Added a column
onetruffle May 31, 2019
2f75f9a
Changes
May 31, 2019
b1b0df4
Minor changes
May 31, 2019
699becd
Minor changes
May 31, 2019
0840358
Minor changes
May 31, 2019
dca0685
Minor Changes
May 31, 2019
ae715ad
Merge branch 'SanchitT/MultiUserFunctionality' into UserProfile_Progr…
onetruffle May 31, 2019
21a057a
.
onetruffle May 31, 2019
dbf414f
Merge branch 'SaitarunI/ProgressTracker' into UserProfile_ProgressTra…
onetruffle May 31, 2019
8707fd8
Update strings.xml
onetruffle May 31, 2019
2af22fb
Update User.java
onetruffle May 31, 2019
4ec66c8
Minor changes
May 31, 2019
762dc09
minor change
May 31, 2019
1b56336
Update FirstScreen.java
Jun 1, 2019
3566ec0
Changes
Jun 1, 2019
5ebff1b
Update build.gradle
Jun 1, 2019
a4b18bb
Update FirstScreen.java
Jun 3, 2019
62e80ae
Update UserNameListDialog.java
onetruffle Jun 3, 2019
9b74978
Merge branch 'UserProfile_ProgressTracker_Integration' of https://git…
onetruffle Jun 3, 2019
fb93084
Revert "Update build.gradle"
Jun 3, 2019
e3dacb5
Revert "Changes"
Jun 3, 2019
e50d99b
Reverted the changes of gradle files
Jun 3, 2019
d20e3e1
Updated the file name and removed unused code
Jun 3, 2019
b8dc0e6
Update MultiUserActivity.java
Jun 3, 2019
e866205
Update MultiUserActivity.java
Jun 3, 2019
2b0f25c
Update MultiUserActivity.java
Jun 3, 2019
d4916a3
Updated the UI of adding the user and removed unsued code
Jun 3, 2019
76a31e5
Removed the unused variables
Jun 3, 2019
78138e9
Update MultiUserActivity.java
Jun 3, 2019
4f5933a
Update in Manifest and multi_user layout
Jun 4, 2019
d588e9d
Removed unused code
Jun 4, 2019
15e4826
Updated the shared user id
Jun 4, 2019
b107eac
Updated the shared user id of launcher release app
Jun 4, 2019
7ef828a
Merge branch 'newmaster' into UserProfile_ProgressTracker_Integration
Jun 4, 2019
2572b21
Fixed the issue of coins
Jun 4, 2019
08aa7a6
Merge branch 'UserProfile_ProgressTracker_Integration' of https://git…
Jun 4, 2019
0233c30
Updated the SharedUserId, fixed the SetUser function, updated the lau…
Jun 4, 2019
e1cecf3
Changed the sharedUserId in release Android Manifest
Jun 4, 2019
365dfef
Resolved issues of severity "error" and "portability"
onetruffle Jun 4, 2019
c058f20
Resolve issues of severity "performance"
onetruffle Jun 5, 2019
e4d24cb
Resolve more issues of severity "performance"
onetruffle Jun 5, 2019
4833052
Resolve more issues of severity "performance"
onetruffle Jun 5, 2019
005be84
Changed the add and select buttons image in activity_multi_user
Jun 5, 2019
b2963fc
fixes
onetruffle Jun 5, 2019
56e671a
Resolve more issures of severity "performance"
onetruffle Jun 6, 2019
71ee474
Changes in Add and Select user UI
Jun 6, 2019
6463153
Merge branch 'newmaster' into UserProfile_ProgressTracker_Integration
Jun 6, 2019
6fda6d3
Resolved issues of severity "warning"
onetruffle Jun 6, 2019
5f04b9e
Updated the Add and Select User layout
Jun 7, 2019
343b6af
Merge branch 'UserProfile_ProgressTracker_Integration' of https://git…
Jun 7, 2019
e78f16f
Updated the layout of add user
Jun 7, 2019
69e4cbd
Fixed the layout for all devices
Jun 7, 2019
b218bbd
Add User functionality and Select User UI progress
Jun 8, 2019
0406c45
Added Select User Functionality
Jun 11, 2019
d17f928
Updated Select User and Main Activity
Jun 12, 2019
d0e53dd
Updated Add User
Jun 12, 2019
c8a4333
Resolve lint errors
onetruffle Jun 12, 2019
3448658
Severity "error"
onetruffle Jun 12, 2019
f48aa97
Updated the code to redirect the user to the multi-user activity
Jun 12, 2019
c3ad95a
Added code to fetch the current page
Jun 13, 2019
83d36d8
Update MultiUserActivity.java
Jun 13, 2019
22c0c49
Merge branch 'UserProfile_ProgressTracker_Integration' of https://git…
Jun 13, 2019
ba5860a
Added Edit User fuctionality and cleaned the code
Jun 13, 2019
a806b11
Revert "Severity "error""
onetruffle Jun 13, 2019
4224230
Merge branch 'newmaster' into SaitarunI/StaticCodeAnalysis_6_11
onetruffle Jun 13, 2019
d627670
Made Image to appear in circle and made multi_user.sml responsive and…
Jun 13, 2019
e64e4e2
Resolve cpp issues of severity "style"
onetruffle Jun 14, 2019
bf04dc4
Resolve cpp issues
onetruffle Jun 14, 2019
69193b7
Fixed the UI and Edit User
Jun 14, 2019
e6fca9b
Updated the version and obb size
Jun 14, 2019
7bcc11a
Revert "Updated the version and obb size"
Jun 14, 2019
60076f5
Fixed Minimum user age and Back button UI and English,Maths progress …
Jun 14, 2019
f1de7e8
Merge branch 'UserProfile_ProgressTracker_Integration' of https://git…
Jun 14, 2019
b6fd90d
Fixed Select User UI
Jun 15, 2019
4a56e4c
Merge branch 'SaitarunI/StaticCodeAnalysis_6_14' into UserProfile_Pro…
onetruffle Jun 15, 2019
f90e596
Resolved Comments
Jun 15, 2019
da52e24
Fixed the Back Button and User Image
Jun 17, 2019
a897a79
Fixed the usr image and button width in edit user
Jun 17, 2019
4fe298e
Updated the logic to fetch the user details
Jun 17, 2019
5e86ab3
UI chenges
Jun 17, 2019
4e2f290
Merge branch 'UserProfile_ProgressTracker_Integration' of https://git…
Jun 17, 2019
0c818ff
Fixed Current User and Delete User and Add User method
Jun 17, 2019
4aaa391
Merge branch 'newmaster' into UserProfile_ProgressTracker_Integration
Jun 17, 2019
9730142
Merge branch 'newmaster' into UserProfile_ProgressTracker_Integration
Jun 17, 2019
d9d497d
Fixed the register button, Back Button and improved UI
Jun 17, 2019
c2c845f
Merge branch 'UserProfile_ProgressTracker_Integration' of https://git…
Jun 17, 2019
6e82c12
Merged with master
Jun 17, 2019
33803d0
Removed unused methods and fixed the files
Jun 17, 2019
47d3d67
Updated the files
Jun 17, 2019
e19a80c
Removed Display Name, Fixed the Launcher first screen, added back but…
Jun 17, 2019
efc542a
Added previus and next image button. Also fixed user image in main ac…
Jun 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.util.List;
import java.util.Locale;

import static android.content.ContentValues.TAG;

/**
* Created by ingtellect on 9/1/17.
*/
Expand All @@ -33,6 +35,8 @@ public class KitkitDBHandler extends SQLiteOpenHelper {

public static final String COLUMN_ID = "_id";
public static final String COLUMN_USERNAME = "username";
public static final String COLUMN_AGE = "_age";
public static final String COLUMN_IMAGE = "_image";
public static final String COLUMN_STARS = "stars";
public static final String COLUMN_FINISH_TUTORIAL = "finish_tutorial";
public static final String COLUMN_UNLOCK_DRUM = "unlock_drum";
Expand Down Expand Up @@ -63,6 +67,8 @@ public class KitkitDBHandler extends SQLiteOpenHelper {
+ "("
+ COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
+ COLUMN_USERNAME + " TEXT,"
+ COLUMN_AGE + " TEXT,"
+ COLUMN_IMAGE + " BLOB,"
+ COLUMN_STARS + " INTEGER,"
+ COLUMN_FINISH_TUTORIAL + " BOOLEAN,"
+ COLUMN_UNLOCK_DRUM + " BOOLEAN,"
Expand All @@ -83,7 +89,8 @@ public class KitkitDBHandler extends SQLiteOpenHelper {
+ TABLE_CURRENT_USER
+ "("
+ COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
+ COLUMN_USERNAME + " TEXT"
+ COLUMN_USERNAME + " TEXT,"
+ COLUMN_AGE + " TEXT"
+ ")";

final String CREATE_SNTP_RESULT_TABLE = "CREATE TABLE "
Expand Down Expand Up @@ -132,8 +139,8 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < newVersion) {
List<String> arrSql = new ArrayList<String>();

arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_DISPLAY_NAME + " TEXT DEFAULT ('');");
arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_OPEN_LIBRARY + " BOOLEAN DEFAULT (" + (User.DEFAULT_OPEN_LIBRARY == false ? 0 : 1) + ");");
arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_DISPLAY_NAME + " TEXT DEFAULT ('');");
arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_OPEN_LIBRARY + " BOOLEAN DEFAULT (" + (User.DEFAULT_OPEN_LIBRARY == false ? 0 : 1) + ");");
arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_OPEN_TOOLS + " BOOLEAN DEFAULT (" + (User.DEFAULT_OPEN_TOOLS == false ? 0 : 1) + ");");
arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_UNLOCK_FISH_BOWL + " BOOLEAN DEFAULT (" + 0 + ");");
arrSql.add("ALTER TABLE " + TABLE_USERS + " ADD COLUMN " + COLUMN_UNLOCK_WRITING_BOARD + " BOOLEAN DEFAULT (" + 0 + ");");
Expand All @@ -151,7 +158,7 @@ private void execRawQuery(SQLiteDatabase db, String[] arr_sql) {
try {
db.execSQL(sql);
} catch (Exception e) {
Log.e(KitkitDBHandler.class.getName(),"SQL ERROR : " + sql);
Log.e(KitkitDBHandler.class.getName(), "SQL ERROR : " + sql);
}
}
}
Expand All @@ -160,6 +167,8 @@ private void execRawQuery(SQLiteDatabase db, String[] arr_sql) {
public void addUser(User user) {
ContentValues values = new ContentValues();
values.put(COLUMN_USERNAME, user.getUserName());
values.put(COLUMN_AGE, user.getAge());
values.put(COLUMN_IMAGE, user.getImage());
values.put(COLUMN_STARS, user.getNumStars());
values.put(COLUMN_FINISH_TUTORIAL, user.isFinishTutorial());
values.put(COLUMN_UNLOCK_DRUM, user.isUnlockDrum());
Expand All @@ -168,6 +177,7 @@ public void addUser(User user) {
values.put(COLUMN_UNLOCK_COLORING, user.isUnlockColoring());
values.put(COLUMN_UNLOCK_BLACKBOARD, user.isUnlockBlackboard());
values.put(COLUMN_FINISH_LAUNCHER_TUTORIAL, user.isFinishLauncherTutorial());
values.put(COLUMN_DISPLAY_NAME, user.getDisplayName());
values.put(COLUMN_OPEN_LIBRARY, user.isOpenLibrary());
values.put(COLUMN_OPEN_TOOLS, user.isOpenTools());
values.put(COLUMN_UNLOCK_FISH_BOWL, user.isUnlockFishBowl());
Expand All @@ -180,6 +190,8 @@ public void addUser(User user) {
public User findUser(String username) {
String[] projection = {COLUMN_ID,
COLUMN_USERNAME,
COLUMN_AGE,
COLUMN_IMAGE,
COLUMN_STARS,
COLUMN_FINISH_TUTORIAL,
COLUMN_UNLOCK_DRUM,
Expand Down Expand Up @@ -208,20 +220,22 @@ public User findUser(String username) {
cursor.moveToFirst();
user.setID(Integer.parseInt(cursor.getString(0)));
user.setUserName(cursor.getString(1));
user.setNumStars(Integer.parseInt(cursor.getString(2)));
user.setFinishTutorial("1".equals(cursor.getString(3)));
user.setUnlockDrum("1".equals(cursor.getString(4)));
user.setUnlockMarimba("1".equals(cursor.getString(5)));
user.setUnlockDrawing("1".equals(cursor.getString(6)));
user.setUnlockColoring("1".equals(cursor.getString(7)));
user.setUnlockBlackboard("1".equals(cursor.getString(8)));
user.setFinishLauncherTutorial("1".equals(cursor.getString(9)));
user.setDisplayName(cursor.getString(10));
user.setOpenLibrary("1".equals(cursor.getString(11)));
user.setOpenTools("1".equals(cursor.getString(12)));
user.setUnlockFishBowl("1".equals(cursor.getString(13)));
user.setUnlockWritingBoard("1".equals(cursor.getString(14)));
user.setFinishWritingBoardTutorial("1".equals(cursor.getString(15)));
user.setAge((cursor.getString(2)));
user.setImage(cursor.getBlob(3));
user.setNumStars(Integer.parseInt(cursor.getString(4)));
user.setFinishTutorial("1".equals(cursor.getString(5)));
user.setUnlockDrum("1".equals(cursor.getString(6)));
user.setUnlockMarimba("1".equals(cursor.getString(7)));
user.setUnlockDrawing("1".equals(cursor.getString(8)));
user.setUnlockColoring("1".equals(cursor.getString(9)));
user.setUnlockBlackboard("1".equals(cursor.getString(10)));
user.setFinishLauncherTutorial("1".equals(cursor.getString(11)));
user.setDisplayName(cursor.getString(12));
user.setOpenLibrary("1".equals(cursor.getString(13)));
user.setOpenTools("1".equals(cursor.getString(14)));
user.setUnlockFishBowl("1".equals(cursor.getString(15)));
user.setUnlockWritingBoard("1".equals(cursor.getString(16)));
user.setFinishWritingBoardTutorial("1".equals(cursor.getString(17)));
cursor.close();
} else {
user = null;
Expand All @@ -233,6 +247,8 @@ public User findUser(String username) {
public ArrayList<User> getUserList() {
String[] projection = {COLUMN_ID,
COLUMN_USERNAME,
COLUMN_AGE,
COLUMN_IMAGE,
COLUMN_STARS,
COLUMN_FINISH_TUTORIAL,
COLUMN_UNLOCK_DRUM,
Expand All @@ -254,28 +270,30 @@ public ArrayList<User> getUserList() {
null);

ArrayList<User> result = new ArrayList<User>();
if(cursor.moveToFirst()) {
if (cursor.moveToFirst()) {
do {
User user = new User();
user.setID(Integer.parseInt(cursor.getString(0)));
user.setUserName(cursor.getString(1));
user.setNumStars(Integer.parseInt(cursor.getString(2)));
user.setFinishTutorial("1".equals(cursor.getString(3)));
user.setUnlockDrum("1".equals(cursor.getString(4)));
user.setUnlockMarimba("1".equals(cursor.getString(5)));
user.setUnlockDrawing("1".equals(cursor.getString(6)));
user.setUnlockColoring("1".equals(cursor.getString(7)));
user.setUnlockBlackboard("1".equals(cursor.getString(8)));
user.setFinishLauncherTutorial("1".equals(cursor.getString(9)));
user.setDisplayName(cursor.getString(10));
user.setOpenLibrary("1".equals(cursor.getString(11)));
user.setOpenTools("1".equals(cursor.getString(12)));
user.setUnlockFishBowl("1".equals(cursor.getString(13)));
user.setUnlockWritingBoard("1".equals(cursor.getString(14)));
user.setFinishWritingBoardTutorial("1".equals(cursor.getString(15)));
user.setAge((cursor.getString(2)));
user.setImage(cursor.getBlob(3));
user.setNumStars(Integer.parseInt(cursor.getString(4)));
user.setFinishTutorial("1".equals(cursor.getString(5)));
user.setUnlockDrum("1".equals(cursor.getString(6)));
user.setUnlockMarimba("1".equals(cursor.getString(7)));
user.setUnlockDrawing("1".equals(cursor.getString(8)));
user.setUnlockColoring("1".equals(cursor.getString(9)));
user.setUnlockBlackboard("1".equals(cursor.getString(10)));
user.setFinishLauncherTutorial("1".equals(cursor.getString(11)));
user.setDisplayName(cursor.getString(12));
user.setOpenLibrary("1".equals(cursor.getString(13)));
user.setOpenTools("1".equals(cursor.getString(14)));
user.setUnlockFishBowl("1".equals(cursor.getString(15)));
user.setUnlockWritingBoard("1".equals(cursor.getString(16)));
user.setFinishWritingBoardTutorial("1".equals(cursor.getString(17)));
result.add(user);

} while(cursor.moveToNext());
} while (cursor.moveToNext());
}

cursor.close();
Expand All @@ -297,6 +315,18 @@ public boolean deleteUser(String username) {
return result;
}

public int lastRowId() {
String[] projection = {"last_insert_rowid()"};
Cursor cursor = myCR.query(KitkitProvider.CONTENT_URI, projection, null, null, null);
if (cursor != null) {
cursor.moveToFirst();
int lastRow = cursor.getInt(0);
cursor.close();
return lastRow;
}
return 0;
}

public int numUser() {
String[] projection = {"COUNT(*) AS COUNT"};
Cursor cursor = myCR.query(KitkitProvider.CONTENT_URI,
Expand Down Expand Up @@ -370,6 +400,7 @@ public User getCurrentUser() {
}

String currentUserName = cursor.getString(0);
Log.d(TAG, "HelloWord" + currentUserName);
User user = findUser(currentUserName);
cursor.close();
return user;
Expand All @@ -387,31 +418,37 @@ public String getCurrentUsername() {
}
String result = cursor.getString(0);
cursor.close();
Log.d(TAG, "HelloWord1" + result);
return result;
}

public void updateUser(User user) {

String selection = "username = \"" + user.getUserName() + "\"";

ContentValues values = new ContentValues();
values.put(COLUMN_USERNAME, user.getUserName());
values.put(COLUMN_STARS, user.getNumStars());
values.put(COLUMN_FINISH_TUTORIAL, user.isFinishTutorial());
values.put(COLUMN_UNLOCK_DRUM, user.isUnlockDrum());
values.put(COLUMN_UNLOCK_MARIMBA, user.isUnlockMarimba());
values.put(COLUMN_UNLOCK_DRAWING, user.isUnlockDrawing());
values.put(COLUMN_UNLOCK_COLORING, user.isUnlockColoring());
values.put(COLUMN_UNLOCK_BLACKBOARD, user.isUnlockBlackboard());
values.put(COLUMN_FINISH_LAUNCHER_TUTORIAL, user.isFinishLauncherTutorial());
values.put(COLUMN_DISPLAY_NAME, user.getDisplayName());
values.put(COLUMN_OPEN_LIBRARY, user.isOpenLibrary());
values.put(COLUMN_OPEN_TOOLS, user.isOpenTools());
values.put(COLUMN_UNLOCK_FISH_BOWL, user.isUnlockFishBowl());
values.put(COLUMN_UNLOCK_WRITING_BOARD, user.isUnlockWritingBoard());
values.put(COLUMN_FINISH_WRITING_BOARD_TUTORIAL, user.isFinishWritingBoardTutorial());
Log.i("myLog", "value : " + values.toString());
myCR.update(KitkitProvider.CONTENT_URI, values, selection, null);
try {
ContentValues values = new ContentValues();
values.put(COLUMN_USERNAME, user.getUserName());
values.put(COLUMN_AGE, user.getAge());
values.put(COLUMN_IMAGE, user.getImage());
values.put(COLUMN_STARS, user.getNumStars());
values.put(COLUMN_FINISH_TUTORIAL, user.isFinishTutorial());
values.put(COLUMN_UNLOCK_DRUM, user.isUnlockDrum());
values.put(COLUMN_UNLOCK_MARIMBA, user.isUnlockMarimba());
values.put(COLUMN_UNLOCK_DRAWING, user.isUnlockDrawing());
values.put(COLUMN_UNLOCK_COLORING, user.isUnlockColoring());
values.put(COLUMN_UNLOCK_BLACKBOARD, user.isUnlockBlackboard());
values.put(COLUMN_FINISH_LAUNCHER_TUTORIAL, user.isFinishLauncherTutorial());
values.put(COLUMN_DISPLAY_NAME, user.getDisplayName());
values.put(COLUMN_OPEN_LIBRARY, user.isOpenLibrary());
values.put(COLUMN_OPEN_TOOLS, user.isOpenTools());
values.put(COLUMN_UNLOCK_FISH_BOWL, user.isUnlockFishBowl());
values.put(COLUMN_UNLOCK_WRITING_BOARD, user.isUnlockWritingBoard());
values.put(COLUMN_FINISH_WRITING_BOARD_TUTORIAL, user.isFinishWritingBoardTutorial());
Log.i("myLog", "value : " + values.toString());
myCR.update(KitkitProvider.CONTENT_URI, values, selection, null);
} catch (Exception e) {
Log.e(TAG, "error updating coin:-" + e.getMessage());
}
}

public void uniqueInsertSntpResult(SntpResult sntpResult) {
Expand Down Expand Up @@ -522,7 +559,7 @@ public ArrayList<Fish> getFishes() {
projection, selection, null,
COLUMN_ID + " ASC");

if(cursor.moveToFirst()) {
if (cursor.moveToFirst()) {
do {
Fish fish = new Fish();
fish._id = cursor.getInt(0);
Expand All @@ -534,7 +571,7 @@ public ArrayList<Fish> getFishes() {
fish._position = cursor.getString(6);
result.add(fish);

} while(cursor.moveToNext());
} while (cursor.moveToNext());
}

cursor.close();
Expand Down
Loading