Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
46d897b3
Commit
46d897b3
authored
Jul 15, 2017
by
Sajal Narang
Committed by
GitHub
Jul 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into PeopleUpdate
parents
f30b5139
4647c296
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
371 additions
and
60 deletions
+371
-60
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/LoginActivity.java
.../main/java/in/ac/iitb/gymkhana/iitbapp/LoginActivity.java
+2
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/MainActivity.java
...c/main/java/in/ac/iitb/gymkhana/iitbapp/MainActivity.java
+1
-1
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseContract.java
...va/in/ac/iitb/gymkhana/iitbapp/data/DatabaseContract.java
+49
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseHelper.java
...java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseHelper.java
+67
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/IITBAppContentProvider.java
...ac/iitb/gymkhana/iitbapp/data/IITBAppContentProvider.java
+249
-23
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/MapDbHelper.java
...in/java/in/ac/iitb/gymkhana/iitbapp/data/MapDbHelper.java
+0
-33
app/src/main/res/layout/content_main.xml
app/src/main/res/layout/content_main.xml
+2
-2
build.gradle
build.gradle
+1
-1
No files found.
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/LoginActivity.java
View file @
46d897b3
...
@@ -122,6 +122,7 @@ public class LoginActivity extends AppCompatActivity {
...
@@ -122,6 +122,7 @@ public class LoginActivity extends AppCompatActivity {
"AuthCode: "
+
response
.
authorizationCode
,
Toast
.
LENGTH_SHORT
)
"AuthCode: "
+
response
.
authorizationCode
,
Toast
.
LENGTH_SHORT
)
.
show
();
.
show
();
// TODO: Replace gcmId
login
(
response
.
authorizationCode
,
"xyz"
);
login
(
response
.
authorizationCode
,
"xyz"
);
}
else
{
}
else
{
Log
.
i
(
TAG
,
"Authorization failed: "
+
error
.
getMessage
());
Log
.
i
(
TAG
,
"Authorization failed: "
+
error
.
getMessage
());
...
@@ -174,6 +175,7 @@ public class LoginActivity extends AppCompatActivity {
...
@@ -174,6 +175,7 @@ public class LoginActivity extends AppCompatActivity {
@Override
@Override
public
void
onResponse
(
Call
<
LoginResponse
>
call
,
Response
<
LoginResponse
>
response
)
{
public
void
onResponse
(
Call
<
LoginResponse
>
call
,
Response
<
LoginResponse
>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
response
.
isSuccessful
())
{
//Save credentials in AccountManager to keep user logged in
//Go to MainActivity
//Go to MainActivity
}
}
//Server error
//Server error
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/MainActivity.java
View file @
46d897b3
...
@@ -146,7 +146,7 @@ public class MainActivity extends AppCompatActivity
...
@@ -146,7 +146,7 @@ public class MainActivity extends AppCompatActivity
private
void
updateFragment
(
Fragment
fragment
)
{
private
void
updateFragment
(
Fragment
fragment
)
{
FragmentManager
manager
=
getSupportFragmentManager
();
FragmentManager
manager
=
getSupportFragmentManager
();
FragmentTransaction
transaction
=
manager
.
beginTransaction
();
FragmentTransaction
transaction
=
manager
.
beginTransaction
();
transaction
.
replace
(
R
.
id
.
constraint
layout_for_fragment
,
fragment
,
fragment
.
getTag
());
transaction
.
replace
(
R
.
id
.
frame
layout_for_fragment
,
fragment
,
fragment
.
getTag
());
transaction
.
commit
();
transaction
.
commit
();
}
}
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseContract.java
View file @
46d897b3
...
@@ -7,6 +7,9 @@ public class DatabaseContract {
...
@@ -7,6 +7,9 @@ public class DatabaseContract {
public
static
final
String
CONTENT_AUTHORITY
=
"in.ac.iitb.gymkhana.iitbapp"
;
public
static
final
String
CONTENT_AUTHORITY
=
"in.ac.iitb.gymkhana.iitbapp"
;
public
static
final
Uri
BASE_CONTENT_URI
=
Uri
.
parse
(
"content://"
+
CONTENT_AUTHORITY
);
public
static
final
Uri
BASE_CONTENT_URI
=
Uri
.
parse
(
"content://"
+
CONTENT_AUTHORITY
);
public
static
final
String
PATH_MAP
=
"map"
;
public
static
final
String
PATH_MAP
=
"map"
;
public
static
final
String
PATH_USER_PROFILE
=
"userProfile"
;
public
static
final
String
PATH_USER_FOLLOWERS
=
"userFollowers"
;
public
static
final
String
PATH_USER_FOLLOWS
=
"userFollows"
;
public
static
final
class
MapEntry
implements
BaseColumns
{
public
static
final
class
MapEntry
implements
BaseColumns
{
public
static
final
Uri
CONTENT_URI
=
BASE_CONTENT_URI
.
buildUpon
()
public
static
final
Uri
CONTENT_URI
=
BASE_CONTENT_URI
.
buildUpon
()
...
@@ -20,4 +23,50 @@ public class DatabaseContract {
...
@@ -20,4 +23,50 @@ public class DatabaseContract {
}
}
public
static
final
class
UserProfileEntry
implements
BaseColumns
{
public
static
final
Uri
CONTENT_URI
=
BASE_CONTENT_URI
.
buildUpon
()
.
appendPath
(
PATH_USER_PROFILE
)
.
build
();
public
static
final
String
TABLE_NAME
=
"userProfile"
;
public
static
final
String
COLUMN_USER_NAME
=
"user_name"
;
public
static
final
String
COLUMN_USER_ROLLNO
=
"user_rollno"
;
public
static
final
String
COLUMN_USER_POR
=
"user_por"
;
public
static
final
String
COLUMN_USER_PROFILE_PICTURE
=
"user_profile_picture"
;
public
static
final
String
COLUMN_USER_HOSTELNO
=
"user_hostelno"
;
public
static
final
String
COLUMN_USER_ABOUTME
=
"user_aboutme"
;
public
static
final
String
COLUMN_USER_FOLLOWING_COUNT
=
"user_following_count"
;
public
static
final
String
COLUMN_USER_FOLLOWERS_COUNT
=
"user_follwers_count"
;
public
static
final
String
COLUMN_USER_EVENTS_COUNT
=
"user_events_count"
;
public
static
final
String
COLUMN_IS_FOLLOWED
=
"isFollowed"
;
public
static
final
String
COLUMN_FOLLOWS_YOU
=
"followsYou"
;
public
static
final
String
COLUMN_USER_ROOM_NO
=
"user_roomno"
;
public
static
final
String
COLUMN_USER_PHONE_NO
=
"user_phoneno"
;
}
public
static
final
class
UserFollowersEntry
implements
BaseColumns
{
public
static
final
Uri
CONTENT_URI
=
BASE_CONTENT_URI
.
buildUpon
()
.
appendPath
(
PATH_USER_FOLLOWERS
)
.
build
();
public
static
final
String
TABLE_NAME
=
"userFollowers"
;
public
static
final
String
COLUMN_USER_PROFILE_PICTURE
=
"user_profile_picture"
;
public
static
final
String
COLUMN_USER_NAME
=
"user_name"
;
public
static
final
String
COLUMN_USER_PROFILE
=
"userProfile"
;
}
public
static
final
class
UserFollowsEntry
implements
BaseColumns
{
public
static
final
Uri
CONTENT_URI
=
BASE_CONTENT_URI
.
buildUpon
()
.
appendPath
(
PATH_USER_FOLLOWS
)
.
build
();
public
static
final
String
TABLE_NAME
=
"userFollows"
;
public
static
final
String
COLUMN_USER_PROFILE_PICTURE
=
"user_profile_picture"
;
public
static
final
String
COLUMN_USER_NAME
=
"user_name"
;
public
static
final
String
COLUMN_USER_PROFILE
=
"userProfile"
;
}
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseHelper.java
0 → 100644
View file @
46d897b3
package
in.ac.iitb.gymkhana.iitbapp.data
;
import
android.content.Context
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteOpenHelper
;
public
class
DatabaseHelper
extends
SQLiteOpenHelper
{
private
static
final
String
DATABASE_NAME
=
"IITBAppDb.db"
;
private
static
final
int
VERSION
=
1
;
DatabaseHelper
(
Context
context
)
{
super
(
context
,
DATABASE_NAME
,
null
,
VERSION
);
}
@Override
public
void
onCreate
(
SQLiteDatabase
db
)
{
final
String
CREATE_TABLE_MAP
=
"CREATE TABLE "
+
DatabaseContract
.
MapEntry
.
TABLE_NAME
+
" ("
+
DatabaseContract
.
MapEntry
.
_ID
+
" INTEGER PRIMARY KEY, "
+
DatabaseContract
.
MapEntry
.
COLUMN_LATITUDE
+
" DOUBLE NOT NULL, "
+
DatabaseContract
.
MapEntry
.
COLUMN_LONGITUDE
+
" DOUBLE NOT NULL, "
+
DatabaseContract
.
MapEntry
.
COLUMN_NAME
+
" TEXT NOT NULL, "
+
DatabaseContract
.
MapEntry
.
COLUMN_TYPE
+
" TEXT NOT NULL);"
;
final
String
CREATE_TABLE_USER_PROFILE
=
"CREATE TABLE "
+
DatabaseContract
.
UserProfileEntry
.
TABLE_NAME
+
" ("
+
DatabaseContract
.
UserProfileEntry
.
_ID
+
" INTEGER PRIMARY KEY, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_NAME
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_ROLLNO
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_POR
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_PROFILE_PICTURE
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_HOSTELNO
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_ABOUTME
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_FOLLOWING_COUNT
+
" INTEGER NOT NULL, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_FOLLOWERS_COUNT
+
" INTEGER NOT NULL, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_EVENTS_COUNT
+
" INTEGER NOT NULL, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_IS_FOLLOWED
+
" BOOLEAN, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_FOLLOWS_YOU
+
" BOOLEAN, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_ROOM_NO
+
" TEXT, "
+
DatabaseContract
.
UserProfileEntry
.
COLUMN_USER_PHONE_NO
+
" TEXT);"
;
final
String
CREATE_TABLE_USER_FOLLOWERS
=
"CREATE TABLE "
+
DatabaseContract
.
UserFollowersEntry
.
TABLE_NAME
+
" ("
+
DatabaseContract
.
UserFollowersEntry
.
_ID
+
" INTEGER PRIMARY KEY, "
+
DatabaseContract
.
UserFollowersEntry
.
COLUMN_USER_PROFILE_PICTURE
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserFollowersEntry
.
COLUMN_USER_NAME
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserFollowersEntry
.
COLUMN_USER_PROFILE
+
" TEXT NOT NULL);"
;
final
String
CREATE_TABLE_USER_FOLLOWS
=
"CREATE TABLE "
+
DatabaseContract
.
UserFollowsEntry
.
TABLE_NAME
+
" ("
+
DatabaseContract
.
UserFollowsEntry
.
_ID
+
" INTEGER PRIMARY KEY, "
+
DatabaseContract
.
UserFollowsEntry
.
COLUMN_USER_PROFILE_PICTURE
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserFollowsEntry
.
COLUMN_USER_NAME
+
" TEXT NOT NULL, "
+
DatabaseContract
.
UserFollowsEntry
.
COLUMN_USER_PROFILE
+
" TEXT NOT NULL);"
;
db
.
execSQL
(
CREATE_TABLE_MAP
);
db
.
execSQL
(
CREATE_TABLE_USER_PROFILE
);
db
.
execSQL
(
CREATE_TABLE_USER_FOLLOWERS
);
db
.
execSQL
(
CREATE_TABLE_USER_FOLLOWS
);
}
@Override
public
void
onUpgrade
(
SQLiteDatabase
db
,
int
oldVersion
,
int
newVersion
)
{
db
.
execSQL
(
"DROP TABLE IF EXISTS "
+
DatabaseContract
.
MapEntry
.
TABLE_NAME
);
db
.
execSQL
(
"DROP TABLE IF EXISTS "
+
DatabaseContract
.
UserProfileEntry
.
TABLE_NAME
);
db
.
execSQL
(
"DROP TABLE IF EXISTS "
+
DatabaseContract
.
UserFollowersEntry
.
TABLE_NAME
);
db
.
execSQL
(
"DROP TABLE IF EXISTS "
+
DatabaseContract
.
UserFollowsEntry
.
TABLE_NAME
);
onCreate
(
db
);
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/IITBAppContentProvider.java
View file @
46d897b3
This diff is collapsed.
Click to expand it.
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/MapDbHelper.java
deleted
100644 → 0
View file @
f30b5139
package
in.ac.iitb.gymkhana.iitbapp.data
;
import
android.content.Context
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteOpenHelper
;
public
class
MapDbHelper
extends
SQLiteOpenHelper
{
private
static
final
String
DATABASE_NAME
=
"mapDb.db"
;
private
static
final
int
VERSION
=
1
;
MapDbHelper
(
Context
context
)
{
super
(
context
,
DATABASE_NAME
,
null
,
VERSION
);
}
@Override
public
void
onCreate
(
SQLiteDatabase
db
)
{
final
String
CREATE_TABLE
=
"CREATE TABLE "
+
DatabaseContract
.
MapEntry
.
TABLE_NAME
+
" ("
+
DatabaseContract
.
MapEntry
.
_ID
+
" INTEGER PRIMARY KEY, "
+
DatabaseContract
.
MapEntry
.
COLUMN_LATITUDE
+
" DOUBLE NOT NULL, "
+
DatabaseContract
.
MapEntry
.
COLUMN_LONGITUDE
+
" DOUBLE NOT NULL, "
+
DatabaseContract
.
MapEntry
.
COLUMN_NAME
+
" TEXT NOT NULL, "
+
DatabaseContract
.
MapEntry
.
COLUMN_TYPE
+
" TEXT NOT NULL);"
;
db
.
execSQL
(
CREATE_TABLE
);
}
@Override
public
void
onUpgrade
(
SQLiteDatabase
db
,
int
oldVersion
,
int
newVersion
)
{
db
.
execSQL
(
"DROP TABLE IF EXISTS "
+
DatabaseContract
.
MapEntry
.
TABLE_NAME
);
onCreate
(
db
);
}
}
app/src/main/res/layout/content_main.xml
View file @
46d897b3
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Frame
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/
constraint
layout_for_fragment"
android:id=
"@+id/
frame
layout_for_fragment"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
...
...
build.gradle
View file @
46d897b3
...
@@ -7,7 +7,7 @@ buildscript {
...
@@ -7,7 +7,7 @@ buildscript {
jcenter
()
jcenter
()
}
}
dependencies
{
dependencies
{
classpath
'com.android.tools.build:gradle:3.0.0-alpha
5
'
classpath
'com.android.tools.build:gradle:3.0.0-alpha
6
'
// NOTE: Do not place your application dependencies here; they belong
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// in the individual module build.gradle files
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment