├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_splash.xml
│ │ │ │ ├── activity_subject_list.xml
│ │ │ │ ├── activity_attendance.xml
│ │ │ │ ├── activity_student_login.xml
│ │ │ │ ├── cust_list_attendance.xml
│ │ │ │ ├── activity_teacher_login.xml
│ │ │ │ ├── cust_student_list.xml
│ │ │ │ ├── activity_select_roll_no.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_teacher.xml
│ │ │ │ ├── activity_student_information.xml
│ │ │ │ └── activity_add_student.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── googlyandroid
│ │ │ │ └── eattendance
│ │ │ │ ├── AppClass.kt
│ │ │ │ ├── SplashActivity.java
│ │ │ │ ├── TeacherActivity.java
│ │ │ │ ├── TeacherLogin.java
│ │ │ │ ├── SelectRollNo.java
│ │ │ │ ├── SubjectList.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── MyAdapter.java
│ │ │ │ ├── StudentInformation.java
│ │ │ │ ├── StudentLogin.java
│ │ │ │ ├── StudentInformationActivity.java
│ │ │ │ ├── AddStudentActivity.java
│ │ │ │ └── AttendanceActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── googlyandroid
│ │ │ └── eattendance
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── googlyandroid
│ │ └── eattendance
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
├── build.gradle
└── google-services.json
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── caches
│ └── build_file_checksums.ser
├── runConfigurations.xml
├── gradle.xml
├── misc.xml
└── codeStyles
│ └── Project.xml
├── .gitignore
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | EAttendance
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oianmol/EAttendance/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu May 31 01:02:50 IST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/AppClass.kt:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance
2 |
3 | import android.app.Application
4 | import com.google.firebase.FirebaseApp
5 |
6 | class AppClass : Application() {
7 | override fun onCreate() {
8 | super.onCreate()
9 | FirebaseApp.initializeApp(this)
10 | }
11 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/googlyandroid/eattendance/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/googlyandroid/eattendance/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.googlyandroid.eattendance", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
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
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_subject_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
20 |
21 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.content.Intent;
4 | import android.os.AsyncTask;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.widget.Toast;
8 |
9 |
10 | public class SplashActivity extends AppCompatActivity {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_splash);
16 |
17 | new MyThread().start();
18 | }
19 | public class MyThread extends Thread{
20 | public void run(){
21 | try {
22 | Thread.sleep(5000);
23 | } catch (InterruptedException e) {
24 | Toast.makeText(SplashActivity.this, e.toString(), Toast.LENGTH_SHORT).show();
25 | }
26 | finally {
27 | Intent intent = new Intent(SplashActivity.this, MainActivity.class);
28 | startActivity(intent);
29 | finish();
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_attendance.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
12 |
13 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/TeacherActivity.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.Intent;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.widget.Button;
9 |
10 | public class TeacherActivity extends AppCompatActivity {
11 |
12 | Button b1,b2,b3;
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_teacher);
17 | b1=(Button)findViewById(R.id.button);
18 | b2=(Button)findViewById(R.id.button2);
19 | b3=(Button)findViewById(R.id.button4);
20 | }
21 | public void fn(View view){
22 | if(view==b1){
23 | Intent intent=new Intent(this,SubjectList.class);
24 | startActivity(intent);
25 | }
26 | else if(view==b2){
27 | Intent intent=new Intent(TeacherActivity.this,AddStudentActivity.class);
28 | startActivity(intent);
29 | }
30 | else{
31 | Intent intent=new Intent(this,SelectRollNo.class);
32 | startActivity(intent);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/TeacherLogin.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.EditText;
9 | import android.widget.Toast;
10 |
11 | public class TeacherLogin extends AppCompatActivity {
12 | EditText userId,password;
13 | Button button;
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_teacher_login);
18 | userId=(EditText)findViewById(R.id.editText);
19 | password=(EditText)findViewById(R.id.editText2);
20 | button=(Button)findViewById(R.id.button3);
21 | }
22 | public void doOnClick(View view){
23 | String user=userId.getText().toString().trim();
24 | String pass=password.getText().toString().trim();
25 | if(user.equals("abc")&&pass.equals("abc")){
26 | Intent intent=new Intent(TeacherLogin.this,TeacherActivity.class);
27 | startActivity(intent);
28 | }
29 | else{
30 | Toast.makeText(TeacherLogin.this, "Wrong Password", Toast.LENGTH_SHORT).show();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/SelectRollNo.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.util.Log;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.EditText;
10 | import android.widget.Toast;
11 |
12 | public class SelectRollNo extends AppCompatActivity {
13 | EditText et;
14 | Button bt;
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_select_roll_no);
19 | et=(EditText)findViewById(R.id.editText12);
20 | bt=(Button)findViewById(R.id.button7);
21 |
22 | }
23 | public void fn(View view){
24 | String roll=et.getText().toString();
25 | try{
26 | if(roll.isEmpty()){
27 | Toast.makeText(SelectRollNo.this, "Roll No. cannot be empty", Toast.LENGTH_SHORT).show();
28 | }
29 | Intent intent=new Intent(this,StudentInformationActivity.class);
30 | intent.putExtra("Name","RollNo");
31 | intent.putExtra("RollNo",roll);
32 | startActivity(intent);
33 | finish();
34 | }catch (Exception e){
35 | Log.e("Error is ",e.toString());
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_student_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
14 |
15 |
24 |
25 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/cust_list_attendance.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
21 |
22 |
28 |
29 |
30 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_teacher_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
17 |
27 |
28 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/cust_student_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
21 |
22 |
28 |
29 |
30 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_select_roll_no.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
17 |
18 |
28 |
29 |
41 |
42 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | android {
8 | compileSdkVersion 27
9 | defaultConfig {
10 | applicationId "com.googlyandroid.eattendance"
11 | minSdkVersion 17
12 | targetSdkVersion 27
13 | versionCode 1
14 | versionName "1.0"
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 | compile 'com.google.firebase:firebase-core:11.8.0'
28 | compile 'com.google.firebase:firebase-auth:11.8.0'
29 | compile 'com.google.firebase:firebase-database:11.8.0'
30 | compile 'com.android.support:recyclerview-v7:27.1.1'
31 | compile 'com.firebase:firebase-client-android:2.3.1'
32 |
33 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
34 | implementation 'com.android.support:appcompat-v7:27.1.1'
35 | testImplementation 'junit:junit:4.12'
36 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
37 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
38 | }
39 |
40 | apply plugin: 'com.google.gms.google-services'
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
20 |
21 |
22 |
35 |
36 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/SubjectList.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.util.Log;
8 | import android.view.View;
9 | import android.widget.AdapterView;
10 | import android.widget.ArrayAdapter;
11 | import android.widget.ListView;
12 |
13 | import java.util.List;
14 |
15 | public class SubjectList extends AppCompatActivity {
16 | ListView lv;
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | try{
22 | setContentView(R.layout.activity_subject_list);
23 | lv=(ListView)findViewById(R.id.listView);
24 | String arr[]=new String[7];
25 | for(int i=0;i<7;i++){
26 | arr[i]="CS0"+(i+1);
27 | }
28 | ArrayAdapter arrayAdapter=new ArrayAdapter(this,R.layout.support_simple_spinner_dropdown_item,arr);
29 | lv.setAdapter(arrayAdapter);
30 | lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
31 | @Override
32 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
33 | Intent intent=new Intent(SubjectList.this,AttendanceActivity.class);
34 | intent.putExtra("position",position+"");
35 | startActivity(intent);
36 | }
37 | });
38 | }catch(Exception e){
39 | Log.e("Exception is" ,e.toString());
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_teacher.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
19 |
20 |
31 |
32 |
44 |
45 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.DialogInterface;
5 | import android.content.Intent;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.os.Bundle;
8 | import android.view.View;
9 | import android.widget.Button;
10 | import android.widget.Toast;
11 |
12 | public class MainActivity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 | }
19 |
20 | @Override
21 | public void onBackPressed() {
22 | AlertDialog.Builder builder=new AlertDialog.Builder(MainActivity.this);
23 | builder.setMessage("Really Exit ??");
24 | builder.setTitle("Exit");
25 | builder.setCancelable(false);
26 | builder.setPositiveButton("Ok",new MyListener());
27 | builder.setNegativeButton("Cancel",null);
28 | builder.show();
29 | }
30 | public class MyListener implements DialogInterface.OnClickListener{
31 |
32 | @Override
33 | public void onClick(DialogInterface dialog, int which) {
34 | android.os.Process.killProcess(android.os.Process.myPid());
35 | System.exit(0);
36 | }
37 | }
38 |
39 | public void fn(View view){
40 | if(view.getId()==R.id.teacherButton){
41 | // Toast.makeText(MainActivity.this, "Hello", Toast.LENGTH_SHORT).show();
42 | Intent intent=new Intent(MainActivity.this,TeacherLogin.class);
43 | startActivity(intent);
44 | }
45 | else{
46 | Intent intent2=new Intent(MainActivity.this,StudentLogin.class);
47 | startActivity(intent2);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/MyAdapter.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.CheckBox;
9 | import android.widget.TextView;
10 |
11 | import java.util.Collections;
12 | import java.util.List;
13 |
14 | /**
15 | * Created by HP on 2/15/2018.
16 | */
17 | public class MyAdapter extends RecyclerView.Adapter {
18 |
19 | private LayoutInflater inflater;
20 | List data= Collections.emptyList();
21 |
22 | public MyAdapter(Context context,List data){
23 | inflater=LayoutInflater.from(context);
24 | this.data=data;
25 | }
26 | @Override
27 | public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
28 | View view= inflater.inflate(R.layout.cust_student_list,parent,false);
29 | MyViewHolder myViewHolder=new MyViewHolder(view);
30 | return myViewHolder;
31 | }
32 |
33 | @Override
34 | public void onBindViewHolder(MyViewHolder holder, int position) {
35 | StudentInformation std=data.get(position);
36 | holder.tv1.setText(std.getName());
37 | holder.tv2.setText(std.getRollno());
38 | holder.cb.isChecked();
39 | }
40 |
41 | @Override
42 | public int getItemCount() {
43 | return data.size();
44 | }
45 | public class MyViewHolder extends RecyclerView.ViewHolder{
46 | TextView tv1,tv2;
47 | CheckBox cb;
48 | MyViewHolder(View view){
49 | super(view);
50 | tv1=(TextView)view.findViewById(R.id.textView10);
51 | tv2=(TextView)view.findViewById(R.id.textView11);
52 | cb=(CheckBox)view.findViewById(R.id.checkBoxAtt);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/StudentInformation.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | /**
7 | * Created by HP on 2/13/2018.
8 | */
9 | public class StudentInformation {
10 |
11 | private String name,rollno,department,phone,password,email;
12 | ArrayList subjects;
13 | public StudentInformation(){
14 |
15 | }
16 |
17 | public StudentInformation(String name, String rollno, String department, String phone, String email,String password, ArrayList subjects) {
18 | this.name = name;
19 | this.rollno = rollno;
20 | this.department = department;
21 | this.phone = phone;
22 | this.email = email;
23 | this.password=password;
24 | this.subjects=subjects;
25 | }
26 |
27 |
28 | public ArrayList getSubjects() {
29 | return subjects;
30 | }
31 |
32 | public void setSubjects(ArrayList subjects) {
33 | this.subjects = subjects;
34 | }
35 |
36 |
37 | public String getName() {
38 | return name;
39 | }
40 |
41 | public void setName(String name) {
42 | this.name = name;
43 | }
44 |
45 | public String getRollno() {
46 | return rollno;
47 | }
48 |
49 | public void setRollno(String rollno) {
50 | this.rollno = rollno;
51 | }
52 |
53 | public String getDepartment() {
54 | return department;
55 | }
56 |
57 | public void setDepartment(String department) {
58 | this.department = department;
59 | }
60 |
61 | public String getPhone() {
62 | return phone;
63 | }
64 |
65 | public void setPhone(String phone) {
66 | this.phone = phone;
67 | }
68 |
69 | public String getEmail() {
70 | return email;
71 | }
72 |
73 | public void setEmail(String email) {
74 | this.email = email;
75 | }
76 |
77 |
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "327449744021",
4 | "firebase_url": "https://ibshyderabad-586f5.firebaseio.com",
5 | "project_id": "ibshyderabad-586f5",
6 | "storage_bucket": "ibshyderabad-586f5.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:327449744021:android:e01d45db861fd58a",
12 | "android_client_info": {
13 | "package_name": "com.googlyandroid.collegeadmin"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "327449744021-srqksoeodhaoe5qqqcnvjjrif1ng31hm.apps.googleusercontent.com",
19 | "client_type": 3
20 | },
21 | {
22 | "client_id": "327449744021-srqksoeodhaoe5qqqcnvjjrif1ng31hm.apps.googleusercontent.com",
23 | "client_type": 3
24 | }
25 | ],
26 | "api_key": [
27 | {
28 | "current_key": "AIzaSyDC1tMoZSIAdK0lK7wb3sePbVnsyUs5D9Q"
29 | }
30 | ],
31 | "services": {
32 | "analytics_service": {
33 | "status": 1
34 | },
35 | "appinvite_service": {
36 | "status": 1,
37 | "other_platform_oauth_client": []
38 | },
39 | "ads_service": {
40 | "status": 2
41 | }
42 | }
43 | },
44 | {
45 | "client_info": {
46 | "mobilesdk_app_id": "1:327449744021:android:2c056be09661af4f",
47 | "android_client_info": {
48 | "package_name": "com.googlyandroid.eattendance"
49 | }
50 | },
51 | "oauth_client": [
52 | {
53 | "client_id": "327449744021-os5nuiekmbu597vb3esshj3g3quvpokk.apps.googleusercontent.com",
54 | "client_type": 1,
55 | "android_info": {
56 | "package_name": "com.googlyandroid.eattendance",
57 | "certificate_hash": "2303fa57308df3b29ddcf0dc0074ebd2b5fb5879"
58 | }
59 | },
60 | {
61 | "client_id": "327449744021-srqksoeodhaoe5qqqcnvjjrif1ng31hm.apps.googleusercontent.com",
62 | "client_type": 3
63 | },
64 | {
65 | "client_id": "327449744021-srqksoeodhaoe5qqqcnvjjrif1ng31hm.apps.googleusercontent.com",
66 | "client_type": 3
67 | }
68 | ],
69 | "api_key": [
70 | {
71 | "current_key": "AIzaSyDC1tMoZSIAdK0lK7wb3sePbVnsyUs5D9Q"
72 | }
73 | ],
74 | "services": {
75 | "analytics_service": {
76 | "status": 1
77 | },
78 | "appinvite_service": {
79 | "status": 2,
80 | "other_platform_oauth_client": [
81 | {
82 | "client_id": "327449744021-srqksoeodhaoe5qqqcnvjjrif1ng31hm.apps.googleusercontent.com",
83 | "client_type": 3
84 | }
85 | ]
86 | },
87 | "ads_service": {
88 | "status": 2
89 | }
90 | }
91 | }
92 | ],
93 | "configuration_version": "1"
94 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/StudentLogin.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Intent;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.text.TextUtils;
8 | import android.util.Log;
9 | import android.view.View;
10 | import android.widget.Button;
11 | import android.widget.EditText;
12 | import android.widget.Toast;
13 |
14 | import com.google.android.gms.tasks.OnCompleteListener;
15 | import com.google.android.gms.tasks.Task;
16 | import com.google.firebase.auth.AuthResult;
17 | import com.google.firebase.auth.FirebaseAuth;
18 |
19 | public class StudentLogin extends AppCompatActivity {
20 | private EditText emails,passwords;
21 | Button signbutton;
22 | FirebaseAuth firebaseAuth;
23 | ProgressDialog pd;
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 |
28 | setContentView(R.layout.activity_student_login);
29 | emails=(EditText)findViewById(R.id.editText3);
30 | passwords=(EditText)findViewById(R.id.editText4);
31 | signbutton=(Button)findViewById(R.id.signinButton);
32 | pd=new ProgressDialog(this);
33 | firebaseAuth=FirebaseAuth.getInstance();
34 | }
35 | public void doOnClick(View view){
36 |
37 | final String email=emails.getText().toString().trim();
38 | String password=passwords.getText().toString().trim();
39 | if (TextUtils.isEmpty(email)) {
40 | Toast.makeText(StudentLogin.this, "Email cannot be empty", Toast.LENGTH_SHORT).show();
41 | return ;
42 | }
43 | if (TextUtils.isEmpty(password)) {
44 | Toast.makeText(StudentLogin.this, "Password cannot be empty", Toast.LENGTH_SHORT).show();
45 | return ;
46 | }
47 | pd.setMessage("Siging In");
48 | pd.setCancelable(false);
49 | pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
50 | pd.show();
51 |
52 | firebaseAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(this, new OnCompleteListener() {
53 | @Override
54 | public void onComplete(Task task) {
55 | if(task.isSuccessful()){
56 | Toast.makeText(getApplicationContext(), "SignIn Successful", Toast.LENGTH_SHORT).show();
57 | Intent intent=new Intent(StudentLogin.this,StudentInformationActivity.class);
58 | intent.putExtra("Name","Email");
59 | intent.putExtra("Email",email);
60 | firebaseAuth.signOut();
61 | startActivity(intent);
62 | pd.dismiss();
63 | }
64 | else{
65 | Toast.makeText(StudentLogin.this, "Oops!! Wrong credentials", Toast.LENGTH_SHORT).show();
66 | pd.dismiss();
67 | }
68 | }
69 | });
70 |
71 | }
72 |
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_student_information.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
21 |
22 |
30 |
31 |
40 |
41 |
49 |
50 |
51 |
59 |
60 |
69 |
70 |
78 |
79 |
80 |
88 |
89 |
98 |
99 |
107 |
108 |
109 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/StudentInformationActivity.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Intent;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.util.Log;
8 | import android.widget.ArrayAdapter;
9 | import android.widget.ListView;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 |
13 | import com.google.firebase.auth.FirebaseAuth;
14 | import com.google.firebase.database.DataSnapshot;
15 | import com.google.firebase.database.DatabaseError;
16 | import com.google.firebase.database.DatabaseReference;
17 | import com.google.firebase.database.FirebaseDatabase;
18 | import com.google.firebase.database.ValueEventListener;
19 |
20 | import java.util.ArrayList;
21 |
22 | public class StudentInformationActivity extends AppCompatActivity {
23 |
24 | StudentInformation std;
25 |
26 | String value="";
27 | String name="";
28 | TextView tvname,tvroll,tvdept,tvcontact;
29 | ListView lv;
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_student_information);
34 | std=new StudentInformation();
35 | std.setName("AttapattuD");
36 | final ProgressDialog pd=new ProgressDialog(this,ProgressDialog.STYLE_SPINNER);
37 | pd.setMessage("Fetching Information");
38 | pd.setCancelable(false);
39 | pd.show();
40 |
41 | Intent intent=getIntent();
42 | name=intent.getStringExtra("Name");
43 | Log.e("name is",name);
44 | if(name.equals("Email"))
45 | value=intent.getStringExtra("Email").trim();
46 | else
47 | value=intent.getStringExtra("RollNo");
48 | Log.e("email is", value);
49 | try{
50 | FirebaseDatabase database=FirebaseDatabase.getInstance();
51 | DatabaseReference databaseReference=database.getReference();
52 | databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
53 | @Override
54 | public void onDataChange(DataSnapshot dataSnapshot) {
55 | try {
56 | // Toast.makeText(StudentInformationActivity.this, "Hello bro Again", Toast.LENGTH_SHORT).show();
57 | Iterable children = dataSnapshot.getChildren();
58 | for (DataSnapshot child : children) {
59 | StudentInformation std1=child.getValue(StudentInformation.class);
60 | //check for subjects
61 | if(name.equals("Email")&&std1.getEmail().equalsIgnoreCase(value))
62 | std = std1;
63 | else if(name.equals("RollNo")&&std1.getRollno().equalsIgnoreCase(value))
64 | std = std1;
65 | }
66 | pd.dismiss();
67 | fn();
68 | } catch (Exception e) {
69 | Log.e("Exception is", e.toString());
70 | }
71 | }
72 |
73 | @Override
74 | public void onCancelled(DatabaseError databaseError) {
75 |
76 | }
77 | });
78 |
79 | }catch(Exception e){
80 | Log.e("Exception is",e.toString());
81 | }
82 |
83 | }
84 | void fn(){
85 | try{
86 | if(std.getName().equals("AttapattuD")&&name.equals("RollNo")){
87 | Toast.makeText(getApplicationContext(), "Roll No. not found", Toast.LENGTH_SHORT).show();
88 | Intent intent=new Intent(StudentInformationActivity.this,SelectRollNo.class);
89 | startActivity(intent);
90 | finish();
91 | }
92 | }catch(Exception e){
93 |
94 | }
95 | tvname=(TextView)findViewById(R.id.textView14);
96 | tvroll=(TextView)findViewById(R.id.textView17);
97 | tvdept=(TextView)findViewById(R.id.textView18);
98 | tvcontact=(TextView)findViewById(R.id.textView20);
99 | lv=(ListView)findViewById(R.id.listView3);
100 | //Toast.makeText(StudentInformationActivity.this, "fn is called", Toast.LENGTH_SHORT).show();
101 | tvname.setText(std.getName());
102 | tvroll.setText(std.getRollno());
103 | tvdept.setText(std.getDepartment());
104 | tvcontact.setText(std.getPhone());
105 | ArrayList al=std.getSubjects();
106 | ArrayList subjectList=new ArrayList();
107 | int count=0;
108 | int countTot=0;
109 | for(int i=0;i<7;i++){
110 | int val=al.get(i);
111 | if(val!=-1){
112 | count=count+val%1000;
113 | String str="CS0"+(i+1)+" ---- "+val%1000+" / ";
114 | val=val/1000;
115 | countTot=countTot+val%1000;
116 | str=str+val%1000;
117 | subjectList.add(str);
118 | }
119 | }
120 | if(countTot==0)
121 | countTot=1;
122 | Toast.makeText(StudentInformationActivity.this, "Your Total Attendance is--"+(count*100)/countTot+"%", Toast.LENGTH_LONG).show();
123 | ArrayAdapter arrayAdapter=new ArrayAdapter(this,android.R.layout.simple_list_item_1,subjectList);
124 | lv.setAdapter(arrayAdapter);
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
16 |
21 |
26 |
31 |
36 |
41 |
46 |
51 |
56 |
61 |
66 |
71 |
76 |
81 |
86 |
91 |
96 |
101 |
106 |
111 |
116 |
121 |
126 |
131 |
136 |
141 |
146 |
151 |
156 |
161 |
166 |
171 |
172 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/AddStudentActivity.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.app.ProgressDialog;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.text.TextUtils;
7 | import android.util.Log;
8 | import android.view.View;
9 | import android.widget.Button;
10 | import android.widget.CheckBox;
11 | import android.widget.EditText;
12 | import android.widget.Toast;
13 | import com.google.android.gms.tasks.OnCompleteListener;
14 | import com.google.android.gms.tasks.Task;
15 | import com.google.firebase.auth.AuthResult;
16 | import com.google.firebase.auth.FirebaseAuth;
17 | import com.google.firebase.auth.FirebaseUser;
18 | import com.google.firebase.database.DatabaseReference;
19 | import com.google.firebase.database.FirebaseDatabase;
20 | import java.util.ArrayList;
21 |
22 | public class AddStudentActivity extends AppCompatActivity {
23 | private EditText et_user_id, et_name, et_roll_no, et_dept, et_phone, et_email, et_password;
24 | ProgressDialog pd;
25 | Button b5;
26 | FirebaseAuth firebaseAuth;
27 | DatabaseReference databaseReference;
28 | CheckBox cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8;
29 | FirebaseDatabase firebaseDatabase;
30 |
31 | @Override protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_add_student);
34 | et_user_id = (EditText) findViewById(R.id.editText5);
35 | et_name = (EditText) findViewById(R.id.editText6);
36 | et_roll_no = (EditText) findViewById(R.id.editText7);
37 | et_dept = (EditText) findViewById(R.id.editText8);
38 | et_phone = (EditText) findViewById(R.id.editText9);
39 | et_email = (EditText) findViewById(R.id.editText10);
40 | et_password = (EditText) findViewById(R.id.editText11);
41 | b5 = (Button) findViewById(R.id.button5);
42 |
43 | firebaseAuth = FirebaseAuth.getInstance();
44 | pd = new ProgressDialog(this);
45 | if (firebaseAuth.getCurrentUser() != null) {
46 | Toast.makeText(AddStudentActivity.this, "Already signIn", Toast.LENGTH_SHORT).show();
47 | firebaseAuth.signOut();
48 | }
49 |
50 | cb1 = (CheckBox) findViewById(R.id.checkBox1);
51 | cb2 = (CheckBox) findViewById(R.id.checkBox2);
52 | cb3 = (CheckBox) findViewById(R.id.checkBox3);
53 | cb4 = (CheckBox) findViewById(R.id.checkBox4);
54 | cb5 = (CheckBox) findViewById(R.id.checkBox5);
55 | cb6 = (CheckBox) findViewById(R.id.checkBox6);
56 | cb7 = (CheckBox) findViewById(R.id.checkBox7);
57 | cb8 = (CheckBox) findViewById(R.id.checkBox8);
58 | }
59 |
60 | public void fnRegister(View view) {
61 | Log.e("Entering ", "In fn");
62 |
63 | String userid = et_user_id.getText().toString().trim();
64 | String name = et_name.getText().toString().trim();
65 | String rollno = et_roll_no.getText().toString().trim();
66 | String dept = et_dept.getText().toString().trim();
67 | String phone = et_phone.getText().toString().trim();
68 | String email = et_email.getText().toString().trim();
69 | String password = et_password.getText().toString().trim();
70 |
71 | //checking checkboxes
72 |
73 | ArrayList subject = new ArrayList(8);
74 | for (int i = 0; i < 8; i++)
75 | subject.add(0);
76 | if (!cb1.isChecked()) subject.add(0, -1);
77 | if (!cb2.isChecked()) subject.add(1, -1);
78 | if (!cb3.isChecked()) subject.add(2, -1);
79 | if (!cb4.isChecked()) subject.add(3, -1);
80 | if (!cb5.isChecked()) subject.add(4, -1);
81 | if (!cb6.isChecked()) subject.add(5, -1);
82 | if (!cb7.isChecked()) subject.add(6, -1);
83 | if (!cb8.isChecked()) subject.add(7, -1);
84 | int sum = 0;
85 | for (int i = 0; i < 8; i++)
86 | sum = sum + subject.get(i);
87 | if (sum == -8) {
88 | Toast.makeText(AddStudentActivity.this, "Please Select subjects", Toast.LENGTH_SHORT).show();
89 | return;
90 | }
91 | String arr[] = new String[] { userid, name, rollno, dept, phone, email, password };
92 | for (int i = 0; i < 7; i++) {
93 | if (TextUtils.isEmpty(arr[i])) {
94 | Toast.makeText(AddStudentActivity.this, "Block cannot be empty", Toast.LENGTH_SHORT).show();
95 | return;
96 | }
97 | }
98 | if (password.length() < 6) {
99 | Toast.makeText(AddStudentActivity.this, "Password should contain min. 6 characters",
100 | Toast.LENGTH_SHORT).show();
101 | return;
102 | }
103 |
104 | Log.e("Entering ", "In fn2");
105 | Toast.makeText(AddStudentActivity.this, "Validation Successful", Toast.LENGTH_SHORT).show();
106 |
107 | pd.setMessage("Registering User...");
108 | pd.setCancelable(false);
109 | pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
110 | pd.show();
111 |
112 | Log.e("Entering ", "In fn3");
113 | try {
114 | final StudentInformation stdinfo =
115 | new StudentInformation(name, rollno, dept, phone, email, password, subject);
116 | firebaseAuth.createUserWithEmailAndPassword(email, password)
117 | .addOnCompleteListener(this, new OnCompleteListener() {
118 | @Override public void onComplete(Task task) {
119 | if (task.isSuccessful()) {
120 | Toast.makeText(AddStudentActivity.this, "User Registered Successfully",
121 | Toast.LENGTH_SHORT).show();
122 | saveInformation(stdinfo);
123 | pd.dismiss();
124 | } else {
125 | Toast.makeText(AddStudentActivity.this, "Unable to register", Toast.LENGTH_SHORT)
126 | .show();
127 | Log.e("Exception is", task.getException().toString());
128 | pd.dismiss();
129 | }
130 | }
131 | });
132 | } catch (Exception e) {
133 | Log.e("Exception is ", e.toString());
134 | }
135 | }
136 |
137 | public void saveInformation(StudentInformation stdinfo) {
138 |
139 | try {
140 | FirebaseUser user = firebaseAuth.getCurrentUser();
141 | databaseReference = FirebaseDatabase.getInstance().getReference();
142 | databaseReference.child(user.getUid()).setValue(stdinfo);
143 | //Toast.makeText(AddStudentActivity.this, "Information Stored", Toast.LENGTH_SHORT).show();
144 | } catch (Exception e) {
145 | Log.e("Exception is", e.toString());
146 | }
147 |
148 | firebaseAuth.signOut();
149 | //Toast.makeText(AddStudentActivity.this, "Signed Out", Toast.LENGTH_SHORT).show();
150 | //Log.e("Signed","out");
151 |
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_add_student.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
16 |
17 |
23 |
24 |
32 |
33 |
40 |
41 |
42 |
47 |
48 |
56 |
57 |
65 |
66 |
67 |
72 |
73 |
81 |
82 |
90 |
91 |
92 |
97 |
98 |
106 |
107 |
114 |
115 |
116 |
121 |
122 |
130 |
131 |
139 |
140 |
141 |
146 |
147 |
155 |
156 |
164 |
165 |
166 |
171 |
172 |
180 |
181 |
189 |
190 |
191 |
196 |
197 |
205 |
209 |
214 |
221 |
228 |
235 |
242 |
249 |
256 |
263 |
270 |
271 |
272 |
273 |
274 |
285 |
286 |
287 |
288 |
289 |
--------------------------------------------------------------------------------
/app/src/main/java/com/googlyandroid/eattendance/AttendanceActivity.java:
--------------------------------------------------------------------------------
1 | package com.googlyandroid.eattendance;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.AsyncTask;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.os.Bundle;
9 | import android.util.Log;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.AdapterView;
14 | import android.widget.ArrayAdapter;
15 | import android.widget.BaseAdapter;
16 | import android.widget.Button;
17 | import android.widget.CheckBox;
18 | import android.widget.LinearLayout;
19 | import android.widget.ListView;
20 | import android.widget.TextView;
21 | import android.widget.Toast;
22 |
23 | import com.google.firebase.database.DataSnapshot;
24 | import com.google.firebase.database.DatabaseError;
25 | import com.google.firebase.database.DatabaseReference;
26 | import com.google.firebase.database.FirebaseDatabase;
27 | import com.google.firebase.database.ValueEventListener;
28 |
29 | import java.util.ArrayList;
30 | import java.util.HashMap;
31 | import java.util.List;
32 |
33 |
34 | public class AttendanceActivity extends AppCompatActivity {
35 | ListView lv;
36 | Button submit;
37 | Integer position=-1;
38 | public List stdinfo=new ArrayList();
39 | public HashMap hp=new HashMap();
40 |
41 |
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | setContentView(R.layout.activity_attendance);
46 | Intent intent=getIntent();
47 | final String pos=intent.getStringExtra("position");
48 | position=Integer.parseInt(pos.trim());
49 | lv=(ListView)findViewById(R.id.listView2);
50 | submit=(Button)findViewById(R.id.button6);
51 |
52 |
53 | try{
54 | FirebaseDatabase database=FirebaseDatabase.getInstance();
55 | DatabaseReference databaseReference=database.getReference();
56 | databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
57 | @Override
58 | public void onDataChange(DataSnapshot dataSnapshot) {
59 | try {
60 |
61 | Iterable children = dataSnapshot.getChildren();
62 | for (DataSnapshot child : children) {
63 | StudentInformation std = child.getValue(StudentInformation.class);
64 |
65 | //check for subjects
66 | if(std.getSubjects().get(Integer.parseInt(pos))!=-1)
67 | stdinfo.add(std);
68 | //Toast.makeText(AttendanceActivity.this, stdinfo.size() + "", Toast.LENGTH_SHORT).show();
69 | Log.e("String is", std.getName());
70 | }
71 | fn(pos);
72 | } catch (Exception e) {
73 | Log.e("Exception is", e.toString());
74 | }
75 | }
76 |
77 | @Override
78 | public void onCancelled(DatabaseError databaseError) {
79 |
80 | }
81 | });
82 |
83 | }catch(Exception e){
84 | Log.e("Exception is",e.toString());
85 | }
86 |
87 |
88 | }
89 | void fn(String pos){
90 |
91 |
92 | //making hashmap for listItem selection
93 | int siz= stdinfo.size();
94 |
95 | // Adding arraylist to listView
96 | // MyAdapter mpa=new MyAdapter(AttendanceActivity.this,R.layout.cust_list_attendance);
97 | //lv.setAdapter(mpa);
98 | MyBaseAdapter mba=new MyBaseAdapter(AttendanceActivity.this);
99 | lv.setAdapter(mba);
100 |
101 | //changing attendance of database
102 | lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
103 | @Override
104 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
105 |
106 | Log.e("String is", "Hello Dude");
107 | Toast.makeText(AttendanceActivity.this, "Hello Dude", Toast.LENGTH_SHORT).show();
108 |
109 | }
110 | });
111 | }
112 | public void submitAttendance(View view){
113 | int siz=stdinfo.size();
114 |
115 | // putting every students attendance details
116 | for(int i=0;i children = dataSnapshot.getChildren();
147 | for (DataSnapshot child : children) {
148 | StudentInformation std = child.getValue(StudentInformation.class);
149 | String rollno=std.getRollno();
150 | if(hp.containsKey(rollno)){
151 | int attendance=hp.get(rollno);
152 | child.getRef().child("subjects").child(String.valueOf(position)).setValue(attendance);
153 |
154 | }
155 | }
156 | } catch (Exception e) {
157 | Log.e("Exception is", e.toString());
158 | }
159 | }
160 |
161 | @Override
162 | public void onCancelled(DatabaseError databaseError) {
163 |
164 | }
165 | });
166 |
167 | }catch(Exception e){
168 | Log.e("Exception is",e.toString());
169 | }
170 | finish();
171 | Toast.makeText(getApplicationContext(), "Attendance Complete", Toast.LENGTH_SHORT).show();
172 |
173 | }
174 | public class MyBaseAdapter extends BaseAdapter{
175 | Context context;
176 | LayoutInflater inflater;
177 |
178 | MyBaseAdapter(Context context){
179 | this.context=context;
180 | inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
181 | }
182 |
183 | @Override
184 | public int getCount() {
185 | return stdinfo.size();
186 | }
187 |
188 | @Override
189 | public StudentInformation getItem(int position) {
190 | return stdinfo.get(position);
191 | }
192 |
193 | @Override
194 | public long getItemId(int position) {
195 | return 0;
196 | }
197 |
198 | @Override
199 | public View getView(final int position, View convertView, ViewGroup parent) {
200 |
201 | LayoutInflater inflater=getLayoutInflater();
202 | View view=inflater.inflate(R.layout.cust_list_attendance, null);
203 | final StudentInformation std=stdinfo.get(position);
204 | TextView tv1=(TextView)view.findViewById(R.id.textView12);
205 | tv1.setText(std.getName());
206 | TextView tv2=(TextView)view.findViewById(R.id.textView13);
207 | tv2.setText(std.getRollno());
208 | final CheckBox cb=(CheckBox)view.findViewById(R.id.checkBoxA);
209 |
210 | /* view.setOnClickListener(new View.OnClickListener() {
211 | @Override
212 | public void onClick(View v) {
213 | String rollno=std.getRollno();
214 | if(cb.isChecked()){
215 | Toast.makeText(AttendanceActivity.this, "Yo Bro", Toast.LENGTH_SHORT).show();
216 | cb.setEnabled(false);
217 | hp.put(rollno,false);
218 | }
219 | else{
220 | cb.setEnabled(true);
221 | hp.put(rollno,true);
222 | }
223 |
224 | }
225 | });
226 |
227 | */
228 | return view;
229 | }
230 | }
231 |
232 |
233 |
234 | }
235 |
236 |
237 |
238 | /*public class MyTask extends AsyncTask>{
239 | @Override
240 | protected void onPreExecute() {
241 | ProgressDialog pd=new ProgressDialog(AttendanceActivity.this);
242 | pd.setMessage("Getting students list");
243 | pd.setCancelable(false);
244 | pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
245 | pd.show();
246 | }
247 |
248 | @Override
249 | protected List doInBackground(String... params) {
250 |
251 | }
252 |
253 | @Override
254 | protected void onPostExecute(List integers) {
255 | nextStep(integers);
256 | }
257 | }
258 | public class MyAdapter extends ArrayAdapter{
259 |
260 | public MyAdapter(Context context, int resource) {
261 | super(context, resource);
262 | }
263 |
264 | @Override
265 | public View getView(int position, View convertView, ViewGroup parent) {
266 | LayoutInflater inflater=getLayoutInflater();
267 | View view=inflater.inflate(R.layout.cust_list_attendance, parent, false);
268 | StudentInformation std=stdinfo.get(position);
269 | TextView tv1=(TextView)view.findViewById(R.id.textView12);
270 | tv1.setText(std.getName());
271 | TextView tv2=(TextView)view.findViewById(R.id.textView13);
272 | tv2.setText(std.getRollno());
273 | return view;
274 | }
275 |
276 | @Override
277 | public int getCount() {
278 | return stdinfo.size();
279 | }
280 | }
281 |
282 | } */
--------------------------------------------------------------------------------