Skip to content

Commit b6aaa07

Browse files
committed
Initial commit
0 parents  commit b6aaa07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2067
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
plugins {
2+
id 'com.android.application'
3+
}
4+
5+
android {
6+
compileSdkVersion 29
7+
8+
defaultConfig {
9+
applicationId "com.example.gymbuddiesproject"
10+
minSdkVersion 27
11+
targetSdkVersion 29
12+
versionCode 1
13+
versionName "1.0"
14+
15+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16+
}
17+
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
compileOptions {
25+
sourceCompatibility JavaVersion.VERSION_1_8
26+
targetCompatibility JavaVersion.VERSION_1_8
27+
}
28+
}
29+
30+
dependencies {
31+
32+
implementation 'androidx.appcompat:appcompat:1.2.0'
33+
implementation 'com.google.android.material:material:1.3.0'
34+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
35+
testImplementation 'junit:junit:4.+'
36+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
37+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
38+
}

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.gymbuddiesproject;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("com.example.gymbuddiesproject", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.gymbuddiesproject">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.GymBuddiesProject">
12+
13+
<activity android:name=".signup"/>
14+
<activity android:name=".signin" />
15+
<activity android:name=".MainActivity" />
16+
<activity android:name=".myaccount"/>
17+
<activity android:name=".landingpage" >
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN" />
20+
21+
<category android:name="android.intent.category.LAUNCHER" />
22+
</intent-filter>
23+
</activity>
24+
</application>
25+
26+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.example.gymbuddiesproject;
2+
3+
import android.content.ContentValues;
4+
import android.content.Context;
5+
import android.database.Cursor;
6+
import android.database.sqlite.SQLiteDatabase;
7+
import android.database.sqlite.SQLiteOpenHelper;
8+
9+
import androidx.annotation.Nullable;
10+
11+
public class DBHelper extends SQLiteOpenHelper{
12+
public DBHelper(Context context){
13+
super(context , "Login.db" , null , 1);
14+
}
15+
16+
@Override
17+
public void onCreate(SQLiteDatabase myDB) {
18+
myDB.execSQL("create Table users(username Text primary key, useremail Text, dob Text, gender Text, gymname Text, Timing Text , password Text)");
19+
}
20+
21+
@Override
22+
public void onUpgrade(SQLiteDatabase myDB, int oldVersion, int newVersion) {
23+
myDB.execSQL("drop Table if exists users");
24+
}
25+
26+
public Boolean insertData(String username , String useremail, String dob , String gender, String gymname, String timing, String password){
27+
SQLiteDatabase myDB = this.getWritableDatabase();
28+
ContentValues contentValues = new ContentValues();
29+
contentValues.put("username" , username);
30+
contentValues.put("useremail" , useremail);
31+
contentValues.put("dob" , dob);
32+
contentValues.put("gender",gender);
33+
contentValues.put("gymname" , gymname);
34+
contentValues.put("timing" , timing);
35+
contentValues.put("password" , password);
36+
37+
long result = myDB.insert("users" , null , contentValues);
38+
39+
if(result == -1){
40+
return false;
41+
}
42+
else{
43+
return true;
44+
}
45+
}
46+
47+
public Boolean checkusername(String username){
48+
SQLiteDatabase myDB = this.getWritableDatabase();
49+
Cursor cursor = myDB.rawQuery("select * from users where username = ?", new String[] {username});
50+
51+
if(cursor.getCount()>0)
52+
{
53+
return true;
54+
}
55+
else{
56+
return false;
57+
}
58+
}
59+
60+
public Boolean checkusernamePassword(String username , String password){
61+
SQLiteDatabase myDB = this.getWritableDatabase();
62+
Cursor cursor = myDB.rawQuery("select * from users where username = ? and password = ?", new String[] {username,password});
63+
64+
if(cursor.getCount() > 0){
65+
return true;
66+
}
67+
else{
68+
return false;
69+
}
70+
71+
}
72+
73+
public Cursor getdata()
74+
{
75+
SQLiteDatabase DB = this.getWritableDatabase();
76+
Cursor cursor = DB.rawQuery("select * from users", null);
77+
return cursor;
78+
79+
}
80+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.example.gymbuddiesproject;
2+
3+
import androidx.appcompat.app.AppCompatActivity;
4+
5+
import android.content.Intent;
6+
import android.database.Cursor;
7+
import android.os.Bundle;
8+
import android.view.View;
9+
import android.widget.Button;
10+
import android.widget.TextView;
11+
import android.widget.Toast;
12+
13+
public class MainActivity extends AppCompatActivity {
14+
15+
DBHelper DB;
16+
TextView userdata;
17+
18+
@Override
19+
protected void onCreate(Bundle savedInstanceState) {
20+
21+
super.onCreate(savedInstanceState);
22+
setContentView(R.layout.activity_main);
23+
DB = new DBHelper(this);
24+
25+
userdata = (TextView) findViewById(R.id.userdata);
26+
27+
Cursor cursor = DB.getdata();
28+
if(cursor.getCount() == 0){
29+
Toast.makeText(getApplicationContext(), "NO DATA", Toast.LENGTH_SHORT).show();
30+
}
31+
else{
32+
StringBuffer buffer = new StringBuffer();
33+
while(cursor.moveToNext()){
34+
buffer.append("Welcome "+cursor.getString(0)+"\n\n");
35+
buffer.append("\nEmail : " + cursor.getString(1)+"\n\n");
36+
buffer.append("\nGender : "+cursor.getString(3)+"\n\n");
37+
buffer.append("\nGym Membership : "+cursor.getString(4)+"\n\n");
38+
}
39+
40+
userdata.setText(buffer.toString());
41+
}
42+
43+
Button acc=(Button)findViewById(R.id.account);
44+
acc.setOnClickListener(new View.OnClickListener() {
45+
@Override
46+
public void onClick(View view) {
47+
Intent intent = new Intent(getApplicationContext(), myaccount.class);
48+
startActivity(intent);
49+
}
50+
});
51+
}
52+
}

0 commit comments

Comments
 (0)