Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
weigenie committed Jul 10, 2019
0 parents commit 210bcc5
Show file tree
Hide file tree
Showing 67 changed files with 2,146 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.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
4 changes: 4 additions & 0 deletions .idea/encodings.xml

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

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

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

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

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

12 changes: 12 additions & 0 deletions .idea/runConfigurations.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
37 changes: 37 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.hustle"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-auth:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'androidx.cardview:cardview:1.0.0'

}

apply plugin: 'com.google.gms.google-services'
48 changes: 48 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"project_info": {
"project_number": "868021885982",
"firebase_url": "https://hustle-eb46c.firebaseio.com",
"project_id": "hustle-eb46c",
"storage_bucket": "hustle-eb46c.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:868021885982:android:6c709acc0f767834",
"android_client_info": {
"package_name": "com.example.hustle"
}
},
"oauth_client": [
{
"client_id": "868021885982-v4pj7n7lb2hkn6n9638dpjin99ej1nva.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.example.hustle",
"certificate_hash": "6aa70c7b5650947a0f42b2e58dadb820a08edd45"
}
},
{
"client_id": "868021885982-k8o4ka87ccj3kbp7nia5ook2s0fd3g3h.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCsEZteZnWamYbKey1xDihX7jENpt53jWo"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "868021885982-k8o4ka87ccj3kbp7nia5ook2s0fd3g3h.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
23 changes: 23 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
-keepattributes Signature
-keepattributes *Annotation*

# 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,27 @@
package com.example.hustle;

import android.content.Context;

import androidx.test.InstrumentationRegistry;
import androidx.test.runner.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.getTargetContext();

assertEquals("com.example.myfirstapp", appContext.getPackageName());
}
}
39 changes: 39 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hustle">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="com.example.hustle.LoginActivity"
android:label="LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.hustle.TimerActivity"
android:label="TimerActivity">

</activity>
<activity
android:name="com.example.hustle.RegisterActivity"
android:label="RegisterActivity">
</activity>
<activity
android:name="com.example.hustle.StatsActivity"
android:label="StatsActivity">
</activity>
<activity
android:name="com.example.hustle.TodoActivity"
android:label="TodoActivity">
</activity>
</application>

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

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

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

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;

public class LoginActivity extends AppCompatActivity {
Button button_login, button_register;
EditText edit_username, edit_pw;
FirebaseAuth db;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);

button_login = (Button) findViewById(R.id.button_login);
button_register = (Button) findViewById(R.id.button_toRegister);
edit_username = (EditText) findViewById(R.id.edit_username);
edit_pw = (EditText) findViewById(R.id.edit_password);
db = FirebaseAuth.getInstance();

button_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String text_username = edit_username.getText().toString().trim();
String text_password = edit_pw.getText().toString().trim();
validate(text_username, text_password);
}
});

button_register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent nextIntent = new Intent(LoginActivity.this,
RegisterActivity.class);
startActivity(nextIntent);
}
});
}

private void validate(String user, String pw) {
try {
db.signInWithEmailAndPassword(user, pw).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Intent nextIntent = new Intent(LoginActivity.this, TimerActivity.class);
startActivity(nextIntent);
} else {
Toast.makeText(getApplicationContext(), task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
} catch (Exception e) {
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
49 changes: 49 additions & 0 deletions app/src/main/java/com/example/hustle/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.example.hustle;

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

import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

import com.google.android.material.bottomnavigation.BottomNavigationView;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Button next = (Button) findViewById(R.id.button_login);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), TimerActivity.class);
startActivityForResult(myIntent, 0);
}
});

BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.bottom_nav);
navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.nav_timer:
break;
case R.id.nav_todo:
Intent a = new Intent(MainActivity.this,TodoActivity.class);
startActivity(a);
break;
case R.id.nav_profile:
Intent b = new Intent(MainActivity.this,StatsActivity.class);
startActivity(b);
break;
}
return false;
}
});
}
}
Loading

0 comments on commit 210bcc5

Please sign in to comment.