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
e340d77d
Commit
e340d77d
authored
Mar 14, 2018
by
Sajal Narang
Committed by
GitHub
Mar 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #40 from Mrunzzz/classes
Classes
parents
346eb890
eb59d706
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
94 additions
and
683 deletions
+94
-683
.idea/misc.xml
.idea/misc.xml
+1
-1
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/AppDatabase.java
...in/java/in/ac/iitb/gymkhana/iitbapp/data/AppDatabase.java
+34
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Body.java
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Body.java
+2
-2
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseContract.java
...va/in/ac/iitb/gymkhana/iitbapp/data/DatabaseContract.java
+0
-88
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseHelper.java
...java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseHelper.java
+0
-78
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DbDao.java
...src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DbDao.java
+50
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Event.java
...src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Event.java
+4
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/IITBAppContentProvider.java
...ac/iitb/gymkhana/iitbapp/data/IITBAppContentProvider.java
+0
-513
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/User.java
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/User.java
+1
-1
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Venue.java
...src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Venue.java
+2
-0
No files found.
.idea/misc.xml
View file @
e340d77d
...
...
@@ -24,7 +24,7 @@
</value>
</option>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
default=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
default=
"true"
project-jdk-name=
"1.8
(1)
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/AppDatabase.java
0 → 100644
View file @
e340d77d
package
in.ac.iitb.gymkhana.iitbapp.data
;
import
android.arch.persistence.room.Database
;
import
android.arch.persistence.room.Room
;
import
android.arch.persistence.room.RoomDatabase
;
import
android.content.Context
;
/**
* Created by mrunz on 14/3/18.
*/
@Database
(
entities
=
{
Event
.
class
,
Body
.
class
,
Venue
.
class
},
version
=
1
)
public
abstract
class
AppDatabase
extends
RoomDatabase
{
private
static
AppDatabase
INSTANCE
;
public
abstract
DbDao
dbDao
();
public
static
AppDatabase
getAppDatabase
(
Context
context
)
{
if
(
INSTANCE
==
null
)
{
INSTANCE
=
Room
.
databaseBuilder
(
context
.
getApplicationContext
(),
AppDatabase
.
class
,
"database"
)
// allow queries on the main thread.
// Don't do this on a real app! See PersistenceBasicSample for an example.
.
allowMainThreadQueries
()
.
build
();
}
return
INSTANCE
;
}
public
static
void
destroyInstance
()
{
INSTANCE
=
null
;
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Body.java
View file @
e340d77d
...
...
@@ -7,7 +7,7 @@ import com.google.gson.annotations.SerializedName;
import
java.util.List
;
@Entity
@Entity
(
tableName
=
"bodies"
)
class
Body
{
@ColumnInfo
(
name
=
"id"
)
@SerializedName
(
"id"
)
...
...
@@ -108,4 +108,4 @@ class Body {
public
void
setBodyFollowersCount
(
int
bodyFollowersCount
)
{
this
.
bodyFollowersCount
=
bodyFollowersCount
;
}
}
}
\ No newline at end of file
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseContract.java
deleted
100644 → 0
View file @
346eb890
package
in.ac.iitb.gymkhana.iitbapp.data
;
import
android.net.Uri
;
import
android.provider.BaseColumns
;
public
class
DatabaseContract
{
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
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
String
PATH_NEWS_FEED
=
"newsFeed"
;
public
static
final
class
MapEntry
implements
BaseColumns
{
public
static
final
Uri
CONTENT_URI
=
BASE_CONTENT_URI
.
buildUpon
()
.
appendPath
(
PATH_MAP
)
.
build
();
public
static
final
String
TABLE_NAME
=
"map"
;
public
static
final
String
COLUMN_LATITUDE
=
"latitude"
;
public
static
final
String
COLUMN_LONGITUDE
=
"longitude"
;
public
static
final
String
COLUMN_NAME
=
"name"
;
public
static
final
String
COLUMN_TYPE
=
"type"
;
}
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"
;
}
public
static
final
class
NewsFeedEntry
implements
BaseColumns
{
public
static
final
Uri
CONTENT_URI
=
BASE_CONTENT_URI
.
buildUpon
()
.
appendPath
(
PATH_NEWS_FEED
)
.
build
();
public
static
final
String
TABLE_NAME
=
"newsFeed"
;
public
static
final
String
COLUMN_EVENT_NAME
=
"event_name"
;
public
static
final
String
COLUMN_EVENT_DESCRIPTION
=
"event_description"
;
public
static
final
String
COLUMN_EVENT_IMAGE
=
"event_image"
;
public
static
final
String
COLUMN_EVENT_CREATOR_NAME
=
"event_creator_name"
;
public
static
final
String
COLUMN_EVENT_CREATOR_ID
=
"event_creator_id"
;
public
static
final
String
COLUMN_EVENT_GOING_STATUS
=
"event_going_status"
;
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DatabaseHelper.java
deleted
100644 → 0
View file @
346eb890
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);"
;
final
String
CREATE_TABLE_NEWS_FEED
=
"CREATE TABLE "
+
DatabaseContract
.
NewsFeedEntry
.
TABLE_NAME
+
" ("
+
DatabaseContract
.
NewsFeedEntry
.
_ID
+
" INTEGER PRIMARY KEY, "
+
DatabaseContract
.
NewsFeedEntry
.
COLUMN_EVENT_NAME
+
" TEXT NOT NULL, "
+
DatabaseContract
.
NewsFeedEntry
.
COLUMN_EVENT_DESCRIPTION
+
" TEXT NOT NULL, "
+
DatabaseContract
.
NewsFeedEntry
.
COLUMN_EVENT_IMAGE
+
" TEXT NOT NULL, "
+
DatabaseContract
.
NewsFeedEntry
.
COLUMN_EVENT_CREATOR_NAME
+
" TEXT NOT NULL, "
+
DatabaseContract
.
NewsFeedEntry
.
COLUMN_EVENT_CREATOR_ID
+
" TEXT NOT NULL, "
+
DatabaseContract
.
NewsFeedEntry
.
COLUMN_EVENT_GOING_STATUS
+
" INTEGER 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
);
db
.
execSQL
(
CREATE_TABLE_NEWS_FEED
);
}
@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
);
db
.
execSQL
(
"DROP TABLE IF EXISTS "
+
DatabaseContract
.
NewsFeedEntry
.
TABLE_NAME
);
onCreate
(
db
);
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DbDao.java
0 → 100644
View file @
e340d77d
package
in.ac.iitb.gymkhana.iitbapp.data
;
import
android.arch.persistence.room.Dao
;
import
android.arch.persistence.room.Delete
;
import
android.arch.persistence.room.Insert
;
import
android.arch.persistence.room.Query
;
import
java.util.List
;
/**
* Created by mrunz on 13/3/18.
*/
@Dao
public
interface
DbDao
{
@Query
(
"SELECT * FROM events"
)
List
<
Event
>
getAllEvents
();
@Query
(
"SELECT * FROM bodies"
)
List
<
Body
>
getAllBodies
();
@Query
(
"SELECT * FROM venues"
)
List
<
Venue
>
getAllVenues
();
@Query
(
"SELECT COUNT(*) from events"
)
int
countEvents
();
@Query
(
"SELECT COUNT(*) from venues"
)
int
countVenues
();
@Query
(
"SELECT COUNT(*) from bodies"
)
int
countBodies
();
@Insert
void
insertEvents
(
Event
...
events
);
@Insert
void
insertBodies
(
Body
...
bodies
);
@Insert
void
insertVenues
(
Venue
...
venues
);
@Delete
void
deleteEvent
(
Event
event
);
@Delete
void
deleteVenue
(
Venue
venue
);
@Delete
void
deleteBody
(
Body
body
);
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Event.java
View file @
e340d77d
package
in.ac.iitb.gymkhana.iitbapp.data
;
import
android.arch.persistence.room.ColumnInfo
;
import
android.arch.persistence.room.Entity
;
import
com.google.gson.annotations.SerializedName
;
import
java.util.List
;
@Entity
(
tableName
=
"events"
)
public
class
Event
{
@ColumnInfo
(
name
=
"id"
)
@SerializedName
(
"id"
)
String
eventID
;
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/IITBAppContentProvider.java
deleted
100644 → 0
View file @
346eb890
This diff is collapsed.
Click to expand it.
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/User.java
View file @
e340d77d
...
...
@@ -7,7 +7,7 @@ import com.google.gson.annotations.SerializedName;
import
java.util.List
;
@Entity
@Entity
(
tableName
=
"users"
)
class
User
{
@ColumnInfo
(
name
=
"id"
)
@SerializedName
(
"id"
)
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Venue.java
View file @
e340d77d
package
in.ac.iitb.gymkhana.iitbapp.data
;
import
android.arch.persistence.room.ColumnInfo
;
import
android.arch.persistence.room.Entity
;
import
com.google.gson.annotations.SerializedName
;
@Entity
(
tableName
=
"venues"
)
class
Venue
{
@ColumnInfo
(
name
=
"id"
)
@SerializedName
(
"id"
)
...
...
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