Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

46 changes: 43 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added app/assets
Empty file.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}

android {
Expand Down Expand Up @@ -32,6 +33,8 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-auth:21.0.5'
implementation 'com.google.firebase:firebase-database:20.0.5'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down
39 changes: 39 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"project_info": {
"project_number": "13141737605",
"project_id": "smash-f5803",
"storage_bucket": "smash-f5803.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:13141737605:android:dcfa396893b606241b29ec",
"android_client_info": {
"package_name": "com.example.smash"
}
},
"oauth_client": [
{
"client_id": "13141737605-9q68i7gc591aavpou786ca5j2e5j442g.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCgUYXF-Ba1TcYsRMCndrNmL8wBZWXS4B4"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "13141737605-9q68i7gc591aavpou786ca5j2e5j442g.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
9 changes: 8 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.smash">

<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand All @@ -18,9 +18,16 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".RealMainActivity"/>
<activity android:name="MainActivity"/>
<activity android:name=".SetupActivity"/>
<activity android:name=".RoomActivity"/>
<activity android:name=".ScheduleActivity"/>
<activity android:name=".SignupActivity"/>
<activity android:name=".InfoActivity"/>
<activity android:name=".NoticeActivity"/>
<activity android:name=".MakeNoticeActivity"/>
</application>

</manifest>
137 changes: 135 additions & 2 deletions app/src/main/java/com/example/smash/DBHelper.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,141 @@
package com.example.smash;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper{
import androidx.annotation.Nullable;

import java.util.ArrayList;
import java.util.List;

public class DBHelper extends SQLiteOpenHelper {

public static final String DBNAME = "DB";
private SQLiteDatabase userInfo;
static List<String> infoList;

public DBHelper(@Nullable Context context) {
super(context, "DB", null, 1);
}



@Override
public void onCreate(SQLiteDatabase DB) {
DB.execSQL("create Table LoginDB(school TEXT, user TEXT primary key, password TEXT)");
DB.execSQL("create Table InfoDB(name TEXT, department TEXT, grade TEXT, interest TEXT, time TEXT, place TEXT)");
}

@Override
public void onUpgrade(SQLiteDatabase Login, int oldVersion, int newVersion) {
Login.execSQL("drop Table if exists users");
}

public Boolean insertData(String school, String user, String password) {
SQLiteDatabase MyDB = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("school", school);
contentValues.put("user", user);
contentValues.put("password", password);
long result = MyDB.insert("LoginDB", null, contentValues);
if (result == -1) return false;
else
return true;
}

public Boolean checkusernamepassword(String school, String user, String password) {
SQLiteDatabase MyDB = this.getWritableDatabase();
Cursor cursor = MyDB.rawQuery("Select * from LoginDB where school = ? and user = ? and password = ?", new String[]{school, user, password});
if (cursor.getCount() > 0)
return true;
else
return false;
}

public Boolean insertInfo(String name, String department, String grade, String interest, String time, String place){
SQLiteDatabase MyDB = this. getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("name", name);
contentValues.put("department", department);
contentValues.put("grade", grade);
contentValues.put("interest", interest);
contentValues.put("time", time);
contentValues.put("place", place);

long result = MyDB.insert("InfoDB", null, contentValues);
if(result == -1) return false;
else
return true;
}

public List<String> selectInfo(String name, String department, String grade, String interest, String time, String place){
SQLiteDatabase MyDB = this.getWritableDatabase();
String SELECT_QUERY = "SELECT*FROM InfoDB where name = ? and department = ? and grade = ? and interest = ? and time = ? and place = ?";
Cursor cur = MyDB.rawQuery(SELECT_QUERY,new String[]{name, department, grade, interest, time, place});

int i=0;

infoList = new ArrayList<>();

while(cur.moveToNext()){
infoList.add(cur.getString(i));
i++;
}

return infoList;
}

/*
public static final String DBNAME = "Login.db";

public DBHelper(@Nullable Context context) {
super(context, "Login.db", null, 1);
}

@Override
public void onCreate(SQLiteDatabase MyDB) {
MyDB.execSQL("create Table users(school TEXT, user TEXT primary key, password TEXT)");
}

@Override
public void onUpgrade(SQLiteDatabase MyDB, int oldVersion, int newVersion) {
MyDB.execSQL("drop Table if exists users");
}

public Boolean insertData(String school, String user, String password){
SQLiteDatabase MyDB = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("school", school);
contentValues.put("user", user);
contentValues.put("password", password);
long result = MyDB.insert("users", null, contentValues);
if (result==-1) return false;
else
return true;
}

public Boolean checkusername(String username) {
SQLiteDatabase MyDB = this.getWritableDatabase();
Cursor cursor = MyDB.rawQuery("Select * from users where username = ?", new String[] {username});
if (cursor.getCount()>0)
return true;
else
return false;
}

public Boolean checkusernamepassword(String school, String user, String password) {
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery("Select * from users where school = ? and user = ? and password = ?", new String[] {school,user,password});
if (cursor.getCount()>0)
return true;
else
return false;
}*/

/*
static final String DATABASE_NAME = "test.db";

public DBHelper(Context context, int version){
Expand All @@ -23,7 +153,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
onCreate(db);
}

public void insert(String School, String Name, String PassWord){
public void Insert(String School, String Name, String PassWord){
SQLiteDatabase db = getWritableDatabase();
db.execSQL("INSERT INTO Person VALUES('"+ School + "', " + Name + ", '"+ PassWord + "')");
db.close();
Expand Down Expand Up @@ -57,3 +187,6 @@ public String getResult(){
}

}
*/

}
48 changes: 48 additions & 0 deletions app/src/main/java/com/example/smash/GetSetNotice.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.example.smash;

import java.util.Date;

public class GetSetNotice {

private int profile_image;
private String nickname;
private String title;
private Date write_data;
private String content;

public int getProfile_image() { return profile_image; }
public void setProfile_image(int profile_image) { this.profile_image = profile_image; }

public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}

public String getTitle() { return title; }
public void setTitle(String title) {
this.title = title;
}

public Date getWrite_data() {
return write_data;
}
public void setWrite_data(Date write_data) {
this.write_data = write_data;
}

public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}

public GetSetNotice(int profile_image, String nickname, String title, Date write_data, String content){
this.nickname = nickname;
this.title = title;
this.write_data = write_data;
this.content = content;
}
}
Loading