Skip to content

Commit

Permalink
First commit after completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Saurabh9678 committed Jun 20, 2022
0 parents commit 432e13e
Show file tree
Hide file tree
Showing 69 changed files with 2,339 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions .idea/.gitignore

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

6 changes: 6 additions & 0 deletions .idea/compiler.xml

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

20 changes: 20 additions & 0 deletions .idea/gradle.xml

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

32 changes: 32 additions & 0 deletions .idea/misc.xml

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

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
43 changes: 43 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}

android {
compileSdk 32

defaultConfig {
applicationId "com.example.notes"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-auth:21.0.3'
implementation 'com.google.firebase:firebase-firestore:24.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.firebaseui:firebase-ui-firestore:8.0.1'
}
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": "1056157896265",
"project_id": "notesapp-saurabh",
"storage_bucket": "notesapp-saurabh.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1056157896265:android:e5926ea7d94fb7d3edf998",
"android_client_info": {
"package_name": "com.example.notes"
}
},
"oauth_client": [
{
"client_id": "1056157896265-8u49ohva6elob907q7bpig1u6bnb3cqp.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyA3hr8C4MmeDQUbMRacljPI6lxhAbFJDIk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1056157896265-8u49ohva6elob907q7bpig1u6bnb3cqp.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.notes;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.notes", appContext.getPackageName());
}
}
45 changes: 45 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.notes">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.Notes">
<activity
android:name=".noteDetails"
android:exported="false" />
<activity
android:name=".editNotesActivity"
android:exported="false" />
<activity
android:name=".createNotes"
android:exported="false" />
<activity
android:name=".notesActivity"
android:exported="false" />
<activity
android:name=".forgotPassword"
android:exported="false" />
<activity
android:name=".signUp"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>

</manifest>
101 changes: 101 additions & 0 deletions app/src/main/java/com/example/notes/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package com.example.notes;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;

public class MainActivity extends AppCompatActivity {
private EditText mloginEmail, mloginPassword;
private RelativeLayout mgoToSignup, mLogin;
private TextView mForgotPassword;
private FirebaseAuth firebaseAuth;
private ProgressBar mprogressbarOfMain;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().hide();
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
mprogressbarOfMain = findViewById(R.id.progressBarOfMainActivity);
mloginEmail=findViewById(R.id.loginEmail);
mloginPassword=findViewById(R.id.loginPassword);
mgoToSignup=findViewById(R.id.goToSignUp);
mLogin=findViewById(R.id.login);
mForgotPassword=findViewById(R.id.forgotPassword);
firebaseAuth = FirebaseAuth.getInstance();
FirebaseUser firebaseUser=firebaseAuth.getCurrentUser();
if (firebaseUser!=null){
finish();
startActivity(new Intent(MainActivity.this, notesActivity.class));
}

mgoToSignup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent =new Intent(MainActivity.this, signUp.class);
startActivity(intent);
finish();
}
});
mForgotPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, forgotPassword.class);
startActivity(intent);
finish();
}
});
mLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String mail = mloginEmail.getText().toString().trim();
String password = mloginPassword.getText().toString().trim();
if (mail.isEmpty() || password.isEmpty()){
Toast.makeText(MainActivity.this, "Enter all details", Toast.LENGTH_SHORT).show();
}else{
//login user
mprogressbarOfMain.setVisibility(View.VISIBLE);
firebaseAuth.signInWithEmailAndPassword(mail,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
checkMailVerification();
} else{
Toast.makeText(MainActivity.this, "Account Doesn't Exist", Toast.LENGTH_SHORT).show();
mprogressbarOfMain.setVisibility(View.INVISIBLE);
}
}
});

}
}
});
}
private void checkMailVerification(){
FirebaseUser firebaseUser=firebaseAuth.getCurrentUser();
assert firebaseUser != null;
if (firebaseUser.isEmailVerified()) {
Toast.makeText(this, "You are logged in", Toast.LENGTH_SHORT).show();
finish();
startActivity(new Intent(MainActivity.this, notesActivity.class));
} else {
mprogressbarOfMain.setVisibility(View.INVISIBLE);
Toast.makeText(this, "Verify your mail first", Toast.LENGTH_SHORT).show();
firebaseAuth.signOut();
}
}
}
Loading

0 comments on commit 432e13e

Please sign in to comment.